void systemShutdown(void) { pie_ShutdownRadar(); if (mod_list) { free(mod_list); } shutdownEffectsSystem(); keyClearMappings(); // free up all the load functions (all the data should already have been freed) resReleaseAll(); if (!multiShutdown()) // ajl. init net stuff { debug(LOG_FATAL, "Unable to multiShutdown() cleanly!"); abort(); } debug(LOG_MAIN, "shutting down audio subsystems"); debug(LOG_MAIN, "shutting down CD audio"); cdAudio_Close(); if ( audio_Disabled() == false && !audio_Shutdown() ) { debug(LOG_FATAL, "Unable to audio_Shutdown() cleanly!"); abort(); } debug(LOG_MAIN, "shutting down graphics subsystem"); iV_ShutDown(); levShutDown(); widgShutDown(); fpathShutdown(); mapShutdown(); debug(LOG_MAIN, "shutting down everything else"); pal_ShutDown(); // currently unused stub frameShutDown(); // close screen / SDL / resources / cursors / trig closeConfig(); // "registry" close cleanSearchPath(); // clean PHYSFS search paths debug_exit(); // cleanup debug routines PHYSFS_deinit(); // cleanup PHYSFS (If failure, state of PhysFS is undefined, and probably badly screwed up.) // NOTE: Exception handler is cleaned via atexit(ExchndlShutdown); }
bool stageTwoInitialise(void) { int i; debug(LOG_WZ, "== stageTwoInitalise =="); // make sure we clear on loading; this a bad hack to fix a bug when // loading a savegame where we are building a lassat for (i = 0; i < MAX_PLAYERS; i++) { setLasSatExists(false, i); } if(bMultiPlayer) { if (!multiTemplateSetup()) { return false; } } if (!dispInitialise()) /* Initialise the display system */ { return false; } if(!initMiscImds()) /* Set up the explosions */ { iV_ShutDown(); debug( LOG_FATAL, "Can't find all the explosions graphics?" ); abort(); return false; } if (!cmdDroidInit()) { return false; } /* Shift the interface initialisation here temporarily so that it can pick up the stats after they have been loaded */ if (!intInitialise()) { return false; } if (!initMessage()) /* Initialise the message heaps */ { return false; } if (!gwInitialise()) { return false; } // keymappings keyClearMappings(); keyInitMappings(false); // Set the default uncoloured cursor here, since it looks slightly // better for menus and such. wzSetCursor(CURSOR_DEFAULT); SetFormAudioIDs(ID_SOUND_WINDOWOPEN,ID_SOUND_WINDOWCLOSE); // Setup game queues. // Don't ask why this doesn't go in stage three. In fact, don't even ask me what stage one/two/three is supposed to mean, it seems about as descriptive as stage doStuff, stage doMoreStuff and stage doEvenMoreStuff... debug(LOG_MAIN, "Init game queues, I am %d.", selectedPlayer); sendQueuedDroidInfo(); // Discard any pending orders which could later get flushed into the game queue. for (i = 0; i < MAX_PLAYERS; ++i) { NETinitQueue(NETgameQueue(i)); if (!myResponsibility(i)) { NETsetNoSendOverNetwork(NETgameQueue(i)); } } debug(LOG_MAIN, "stageTwoInitialise: done"); return true; }