GliderPRO/Sources/ObjectEdit.c

1 line
72 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // ObjectEdit.c //---------------------------------------------------------------------------- //============================================================================ #include <Sound.h> #include <ToolUtils.h> #include "Externs.h" #include "House.h" #include "MainWindow.h" #include "Marquee.h" #include "ObjectEdit.h" #include "Objects.h" #include "Play.h" #include "RectUtils.h" #include "Room.h" short FindObjectSelected (Point); void DragHandle (Point); void DragObject (Point); void AddObjectPairing (void); Boolean ObjectIsUpBlower (objectType *); Rect roomObjectRects[kMaxRoomObs]; Rect initialGliderRect; Rect leftStartGliderSrc, rightStartGliderSrc; Rect leftStartGliderDest, rightStartGliderDest; short objActive; Boolean isFirstRoom; extern retroLink retroLinkList[]; extern Rect gliderSrc[kNumGliderSrcRects]; extern short toolSelected, toolMode; extern Boolean noRoomAtAll; //============================================================== Functions //-------------------------------------------------------------- FindObjectSelected #ifndef COMPILEDEMO short FindObjectSelected (Point where) { short found, i; found = kNoObjectSelected; if (PtInRect(where, &initialGliderRect)) return (kInitialGliderSelected); else if (PtInRect(where, &leftStartGliderDest)) return (kLeftGliderSelected); else if (PtInRect(where, &rightStartGliderDest)) return (kRightGliderSelected); for (i = kMaxRoomObs - 1; i >= 0; i--) { if (PtInRect(where, &roomObjectRects[i])) { found = i; break; } } return (found); } #endif //-------------------------------------------------------------- DoSelectionClick void DoSelectionClick (Point where, Boolean isDoubleClick) { #ifndef COMPILEDEMO short direction, dist; StopMarquee(); if ((PtInMarqueeHandle(where)) && (objActive != kNoObjectSelected)) { if (StillDown()) DragHandle(where); if (ObjectHasHandle(&direction, &dist)) { StartMarqueeHandled(&roomObjectRects[objActive], direction, dist); HandleBlowerGlider(); } else StartMarquee(&roomObjectRects[objActive]); } else { objActive = FindObjectSelected(where); if (objActive == kNoObjectSelected) { if (isDoubleClick) DoRoomInfo(); } else { if (isDoubleClick) { DoObjectInfo(); if (ObjectHasHandle(&direction, &dist)) { StartMarqueeHandled(&roomObjectRects[objActive], direction, dist); HandleBlowerGlider(); } else StartMarquee(&roomObjectRects[objActive]); } else { if (StillDown()) DragObject(where); if (ObjectHasHandle(&direction, &dist)) { StartMarqueeHandled(&roomObjectRects[objActive], direction, dist); HandleBlowerGlider(); } else { if (objActive == kInitialGliderSelected) StartMarquee(&initialGliderRect); else if (objActive == kLeftGliderSelected) StartMarquee(&leftStartGliderDest); else if (objActive == kRightGliderSelected) StartMarquee(&rightStartGliderDest); else StartMarquee(&roomObjectRects[objActive]); } } } } UpdateMenus(false); #endif } //-------------------------------------------------------------- DragHandle #ifndef COMPILEDEMO void DragHandle (Point where) { short hDelta, vDelta; Boolean whoCares; switch (thisRoom->objects[objActive].what) { case kFloorVent: case kCeilingVent: case kFloorBlower: case kCeilingBlower: case kSewerGrate: case kTaper: case kCandle: case kStubby: case kTiki: case kBBQ: case kGrecoVent: case kSewerBlower: vDelta = thisRoom->objects[objActive].data.a.distance; DragMarqueeHandle(where, &vDelta); thisRoom->objects[objActive].data.a.distance = vDelta; whoCares = KeepObjectLegal(); break; case kLiftArea: hDelta = thisRoom->objects[objActive].data.a.distance; vDelta = thisRoom->objects[objActive].data.a.tall * 2; DragMarqueeCorner(where, &hDelta, &vDelta