BOOLEAN InitializeGame(void) { UINT32 uiIndex; giStartingMemValue = MemGetFree( ); ClearAllDebugTopics(); RegisterJA2DebugTopic( TOPIC_JA2OPPLIST, "Reg" ); //RegisterJA2DebugTopic( TOPIC_MEMORY_MANAGER, "Reg" ); // Initlaize mouse subsystems MSYS_Init( ); InitButtonSystem(); InitCursors( ); // Init Fonts if ( !InitializeFonts( ) ) { // Send debug message and quit DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "COULD NOT INUT FONT SYSTEM..."); return( ERROR_SCREEN ); } //Deletes all the Temp files in the Maps\Temp directory InitTacticalSave( TRUE ); // Initialize Game Screens. for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++) { if ((*(GameScreens[uiIndex].InitializeScreen))() == FALSE) { // Failed to initialize one of the screens. return FALSE; } } //Init the help screen system InitHelpScreenSystem(); //Loads the saved (if any) general JA2 game settings LoadGameSettings(); //Initialize the Game options ( Gun nut, scifi and dif. levels InitGameOptions(); // preload mapscreen graphics HandlePreloadOfMapGraphics( ); guiCurrentScreen = INIT_SCREEN; return TRUE; }
void ShutdownGame(void) { // handle shutdown of game with respect to preloaded mapscreen graphics HandleRemovalOfPreLoadedMapGraphics( ); ShutdownJA2( ); //Save the general save game settings to disk SaveGameSettings(); //shutdown the file database manager ShutDownFileDatabase( ); //Deletes all the Temp files in the Maps\Temp directory InitTacticalSave( FALSE ); }
//This function is called when the game is REstarted. Things that need to be reinited are placed in here void ReStartingGame() { UINT16 cnt; //Pause the game gfGamePaused = TRUE; //Reset the sectors gWorldSectorX = gWorldSectorY = 0; gbWorldSectorZ = -1; SoundStopAll( ); //we are going to restart a game so initialize the variable so we can initialize a new game InitNewGame( TRUE ); //Deletes all the Temp files in the Maps\Temp directory InitTacticalSave( TRUE ); //Loop through all the soldier and delete them all for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) { TacticalRemoveSoldier( cnt ); } // Re-init overhead... InitOverhead( ); //Reset the email list ShutDownEmailList(); //Reinit the laptopn screen variables InitLaptopAndLaptopScreens(); LaptopScreenInit(); //Reload the Merc profiles LoadMercProfiles( ); // Reload quote files ReloadAllQuoteFiles(); //Initialize the ShopKeeper Interface ( arms dealer inventory, etc. ) ShopKeeperScreenInit(); //Delete the world info TrashWorld(); //Init the help screen system InitHelpScreenSystem(); EmptyDialogueQueue( ); if ( InAirRaid( ) ) { EndAirRaid( ); } #ifdef JA2TESTVERSION //Reset so we can use the 'cheat key' to start with mercs TempHiringOfMercs( 0, TRUE ); #endif //Make sure the game starts in the TEAM panel ( it wasnt being reset ) gsCurInterfacePanel = TEAM_PANEL; //Delete all the strategic events DeleteAllStrategicEvents(); //This function gets called when ur in a game a click the quit to main menu button, therefore no game is in progress gTacticalStatus.fHasAGameBeenStarted = FALSE; // Reset timer callbacks gpCustomizableTimerCallback = NULL; gubCheatLevel = STARTING_CHEAT_LEVEL; }