GliderPRO/Sources/Menu.c

1 line
18 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // Menu.c //---------------------------------------------------------------------------- //============================================================================ //#include <Balloons.h> #include <NumberFormatting.h> #include <ToolUtils.h> #include "DialogUtils.h" #include "Externs.h" #include "House.h" #include "ObjectEdit.h" #define kSheWantsNewGame 1 #define kSheWantsResumeGame 2 void UpdateMenusEditMode (void); void UpdateMenusNonEditMode (void); void UpdateMenusHouseOpen (void); void UpdateMenusHouseClosed (void); void UpdateResumeDialog (DialogPtr); pascal Boolean ResumeFilter (DialogPtr, EventRecord *, short *); short QueryResumeGame (void); void HeyYourPissingAHighScore (void); MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu; Boolean menusUp, resumedSavedGame; extern long incrementModeTime; extern short demoHouseIndex, wasHouseVersion; extern short splashOriginH, splashOriginV, numberRooms; extern Boolean quitting, noRoomAtAll, twoPlayerGame; extern Boolean isMapOpen, isToolsOpen, isPlayMusicIdle; extern Boolean isCoordOpen, failedMusic, splashDrawn; extern Boolean houseOpen; //============================================================== Functions //-------------------------------------------------------------- UpdateMenusEditMode // Sets the menus to reflect that user is in edit mode. void UpdateMenusEditMode (void) { DisableMenuItem(gameMenu, iNewGame); DisableMenuItem(gameMenu, iTwoPlayer); DisableMenuItem(gameMenu, iOpenSavedGame); DisableMenuItem(optionsMenu, iHighScores); DisableMenuItem(optionsMenu, iHelp); CheckMenuItem(optionsMenu, iEditor, true); } //-------------------------------------------------------------- UpdateMenusNonEditMode // Sets the menus to reflect that user is NOT in edit mode. void UpdateMenusNonEditMode (void) { if ((noRoomAtAll) || (!houseOpen) || (numberRooms <= 0)) { DisableMenuItem(gameMenu, iNewGame); DisableMenuItem(gameMenu, iTwoPlayer); DisableMenuItem(gameMenu, iOpenSavedGame); if (houseOpen) { EnableMenuItem(gameMenu, iLoadHouse); EnableMenuItem(optionsMenu, iHighScores); } else { DisableMenuItem(gameMenu, iLoadHouse); DisableMenuItem(optionsMenu, iHighScores); } } else { EnableMenuItem(gameMenu, iNewGame); EnableMenuItem(gameMenu, iTwoPlayer); EnableMenuItem(gameMenu, iOpenSavedGame); EnableMenuItem(gameMenu, iLoadHouse); EnableMenuItem(optionsMenu, iHighScores); } if (demoHouseIndex == -1) DisableMenuItem(optionsMenu, iHelp); else EnableMenuItem(optionsMenu, iHelp); CheckMenuItem(optionsMenu, iEditor, false); } //-------------------------------------------------------------- UpdateMenusHouseOpen // Sets the menus to reflect that a house is currently open. void UpdateMenusHouseOpen (void) { EnableMenuItem(gameMenu, iLoadHouse); if ((fileDirty) && (houseUnlocked)) EnableMenuItem(houseMenu, iSave); else DisableMenuItem(houseMenu, iSave); if (houseUnlocked) { // EnableMenuItem(houseMenu, iSaveAs); EnableMenuItem(houseMenu, iHouse); } else { // DisableMenuItem(houseMenu, iSaveAs); DisableMenuItem(houseMenu, iHouse); } if ((noRoomAtAll) || (!houseUnlocked)) DisableMenuItem(houseMenu, iRoom); else EnableMenuItem(houseMenu, iRoom); if ((objActive == kNoObjectSelected) || (!houseUnlocked)) { DisableMenuItem(houseMenu, iObject); DisableMenuItem(houseMenu, iBringForward); DisableMenuItem(houseMenu, iSendBack); } else { EnableMenuItem(houseMenu, iObject); if ((objActive == kInitialGliderSelected) || (objActive == kLeftGliderSelected) || (objActive == kRightGliderSelected)) { DisableMenuItem(houseMenu, iBringForward); DisableMenuItem(houseMenu, iSendBack); } else { EnableMenuItem(houseMenu, iBringForward); EnableMenuItem(houseMenu, iSendBack); } } } //-------------------------------------------------------------- UpdateMenusHouseClosed // Sets t