GliderPRO/Sources/RoomInfo.c

1 line
22 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // RoomInfo.c //---------------------------------------------------------------------------- //============================================================================ #include <NumberFormatting.h> #include <Resources.h> #include <Sound.h> #include "DialogUtils.h" #include "Externs.h" #include "RectUtils.h" #include "Utilities.h" #define kRoomInfoDialogID 1003 #define kOriginalArtDialogID 1016 #define kNoPICTFoundAlert 1036 #define kRoomNameItem 3 #define kRoomLocationBox 6 #define kRoomTilesBox 10 #define kRoomPopupItem 11 #define kRoomDividerLine 12 #define kRoomTilesBox2 15 #define kRoomFirstCheck 17 #define kLitUnlitText 18 #define kMiniTileWide 16 #define kBoundsButton 19 #define kOriginalArtworkItem 19 #define kPICTIDItem 5 #define kFloorSupportCheck 12 void UpdateRoomInfoDialog (DialogPtr); void DragMiniTile (Point, short *); void HiliteTileOver (Point); pascal Boolean RoomFilter (DialogPtr, EventRecord *, short *); short ChooseOriginalArt (short); void UpdateOriginalArt (DialogPtr); pascal Boolean OriginalArtFilter (DialogPtr, EventRecord *, short *); Boolean PictIDExists (short); short GetFirstPICT (void); void BitchAboutPICTNotFound (void); Rect tileSrc, tileDest, tileSrcRect, editTETextBox; Rect leftBound, topBound, rightBound, bottomBound; CGrafPtr tileSrcMap; short tempTiles[kNumTiles]; short tileOver, tempBack, cursorIs; Boolean originalLeftOpen, originalTopOpen, originalRightOpen, originalBottomOpen; Boolean originalFloor; extern Cursor handCursor, beamCursor; extern short houseResFork, lastBackground; //============================================================== Functions //-------------------------------------------------------------- UpdateRoomInfoDialog #ifndef COMPILEDEMO void UpdateRoomInfoDialog (DialogPtr theDialog) { Rect src, dest; short i; DrawDialog(theDialog); if (tempBack >= kUserBackground) SetPopUpMenuValue(theDialog, kRoomPopupItem, kOriginalArtworkItem); else SetPopUpMenuValue(theDialog, kRoomPopupItem, (tempBack - kBaseBackgroundID) + 1); CopyBits(GetPortBitMapForCopyBits(tileSrcMap), GetPortBitMapForCopyBits(GetDialogPort(theDialog)), &tileSrcRect, &tileSrc, srcCopy, nil); /* CopyBits(&((GrafPtr)tileSrcMap)->portBits, &(((GrafPtr)theDialog)->portBits), &tileSrcRect, &tileSrc, srcCopy, nil); */ dest = tileDest; dest.right = dest.left + kMiniTileWide; for (i = 0; i < kNumTiles; i++) { QSetRect(&src, 0, 0, kMiniTileWide, 80); QOffsetRect(&src, tempTiles[i] * kMiniTileWide, 0); CopyBits(GetPortBitMapForCopyBits(tileSrcMap), GetPortBitMapForCopyBits(GetDialogPort(theDialog)), &src, &dest, srcCopy, nil); /* CopyBits(&((GrafPtr)tileSrcMap)->portBits, &(((GrafPtr)theDialog)->portBits), &src, &dest, srcCopy, nil); */ QOffsetRect(&dest, kMiniTileWide, 0); } if (GetNumberOfLights(thisRoomNumber) == 0) SetDialogString(theDialog, kLitUnlitText, "\p(Room Is Dark)"); else SetDialogString(theDialog, kLitUnlitText, "\p(Room Is Lit)"); FrameDialogItemC(theDialog, kRoomLocationBox, kRedOrangeColor8); FrameDialogItem(theDialog, kRoomTilesBox); FrameDialogItemC(theDialog, kRoomDividerLine, kRedOrangeColor8); FrameDialogItem(theDialog, kRoomTilesBox2); } #endif //-------------------------------------------------------------- DragMiniTile #ifndef COMPILEDEMO void DragMiniTile (Point mouseIs, short *newTileOver) { Rect dragRect; Point mouseWas; short wasTileOver; Pattern dummyPattern; tileOver = (mouseIs.h - tileSrc.left) / kMiniTileWide; wasTileOver = -1; QSetRect(&dragRect, 0, 0, kMiniTileWide, 80); QOffsetRect(&dragRect, tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top); PenMode(patXor); PenPat(GetQDGlobalsGray(&dummyPattern)); FrameRect(&dragRect); mouseWas = mouseIs; while (WaitMouseUp()) // loop until mouse button let up { GetM