GliderPRO/Sources/Objects.c

1 line
24 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // Objects.c //---------------------------------------------------------------------------- //============================================================================ #include "Externs.h" #include "ObjectEdit.h" #define kMaxTempManholes 8 short GetObjectLinked (objectType *); void ListOneRoomsObjects (short); Rect blowerSrcRect; // Blowers GWorldPtr blowerSrcMap; GWorldPtr blowerMaskMap; Rect flame[kNumCandleFlames], tikiFlame[kNumTikiFlames]; Rect coals[kNumBBQCoals]; Rect furnitureSrcRect; // Furniture GWorldPtr furnitureSrcMap; GWorldPtr furnitureMaskMap; Rect tableSrc, shelfSrc, hingeSrc, handleSrc, knobSrc; Rect leftFootSrc, rightFootSrc, deckSrc; Rect bonusSrcRect; // Bonuses GWorldPtr bonusSrcMap; GWorldPtr bonusMaskMap; Rect pointsSrcRect; GWorldPtr pointsSrcMap; GWorldPtr pointsMaskMap; Rect starSrc[6], sparkleSrc[kNumSparkleModes]; Rect digits[11], pendulumSrc[3], greaseSrcRt[4], greaseSrcLf[4]; Rect transSrcRect; // Transport GWorldPtr transSrcMap; GWorldPtr transMaskMap; Rect switchSrcRect; // Switches GWorldPtr switchSrcMap; Rect lightSwitchSrc[2], machineSwitchSrc[2], thermostatSrc[2]; Rect powerSrc[2], knifeSwitchSrc[2]; Rect lightSrcRect; // Lights GWorldPtr lightSrcMap; GWorldPtr lightMaskMap; Rect flourescentSrc1, flourescentSrc2, trackLightSrc[kNumTrackLights]; Rect applianceSrcRect, toastSrcRect, shredSrcRect; // Appliances GWorldPtr applianceSrcMap, toastSrcMap, shredSrcMap; GWorldPtr applianceMaskMap, toastMaskMap, shredMaskMap; Rect plusScreen1, plusScreen2, tvScreen1, tvScreen2; Rect coffeeLight1, coffeeLight2, vcrTime1, vcrTime2; Rect stereoLight1, stereoLight2, microOn, microOff; Rect outletSrc[kNumOutletPicts]; Rect balloonSrcRect, copterSrcRect, dartSrcRect; // Enemies Rect ballSrcRect, dripSrcRect, enemySrcRect; Rect fishSrcRect; GWorldPtr balloonSrcMap, copterSrcMap, dartSrcMap; GWorldPtr ballSrcMap, dripSrcMap, enemySrcMap; GWorldPtr fishSrcMap; GWorldPtr balloonMaskMap, copterMaskMap, dartMaskMap; GWorldPtr ballMaskMap, dripMaskMap, enemyMaskMap; GWorldPtr fishMaskMap; Rect balloonSrc[kNumBalloonFrames], copterSrc[kNumCopterFrames]; Rect dartSrc[kNumDartFrames], ballSrc[kNumBallFrames]; Rect dripSrc[kNumDripFrames], fishSrc[kNumFishFrames]; GWorldPtr clutterSrcMap; // Clutter GWorldPtr clutterMaskMap; Rect clutterSrcRect; Rect flowerSrc[kNumFlowers]; Rect *srcRects; Rect tempManholes[kMaxTempManholes]; savedType savedMaps[kMaxSavedMaps]; objDataPtr masterObjects; hotPtr hotSpots; short nLocalObj, nHotSpots, numMasterObjects, numLocalMasterObjects; short numTempManholes, tvWithMovieNumber; Boolean newState; extern linksPtr linksList; extern short srcLocations[], destLocations[]; extern short localNumbers[]; extern short numNeighbors; //============================================================== Functions //-------------------------------------------------------------- IsThisValid Boolean IsThisValid (short where, short who) { char wasState; Boolean itsGood; itsGood = true; wasState = HGetState((Handle)thisHouse); HLock((Handle)thisHouse); switch ((*thisHouse)->rooms[where].objects[who].what) { case kObjectIsEmpty: itsGood = false; break; case kRedClock: case kBlueClock: case kYellowClock: case kCuckoo: case kPaper: case kBattery: case kBands: case kFoil: case kInvisBonus: case kStar: case kSparkle: case kHelium: itsGood = (*thisHouse)->rooms[where].objects[who].data.c.state; break; } HSetState((Handle)thisHouse, wasState); return (itsGood); } //-------------------------------------------------------------- GetRoomLinked short GetRoomLinked (objectType *who) { short compoundRoomNumber, whereLinked; short floor, suite; switch (who->what) { case kMailboxLf: case kMailboxRt: case kFloorTrans: case kCeilingTrans: case kInvisTrans: case kDel