From 3a41ade9fab0556d0d025c0b0e81834436a4f2e8 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 8 Sep 2008 17:55:12 +0000 Subject: Remove i_system.c dependency on doom/ code and add a generic I_AtExit() API for scheduling functions to call on quit. Subversion-branch: /branches/raven-branch Subversion-revision: 1216 --- src/doom/d_main.c | 5 +++++ src/doom/d_net.c | 4 ++++ src/doom/s_sound.c | 2 ++ 3 files changed, 11 insertions(+) (limited to 'src/doom') diff --git a/src/doom/d_main.c b/src/doom/d_main.c index a7fed952..c84783bc 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -950,6 +950,9 @@ void D_DoomMain (void) printf (DEH_String("M_LoadDefaults: Load system defaults.\n")); M_LoadDefaults (); // load before initing other systems + // Save configuration at exit. + I_AtExit(M_SaveDefaults, false); + printf (DEH_String("W_Init: Init WADfiles.\n")); D_AddFile(iwadfile); @@ -1193,6 +1196,8 @@ void D_DoomMain (void) } + I_AtExit((atexit_func_t) G_CheckDemoStatus, true); + // Generate the WAD hash table. Speed things up a bit. W_GenerateHashTable(); diff --git a/src/doom/d_net.c b/src/doom/d_net.c index 4e87a813..8f75fd06 100644 --- a/src/doom/d_net.c +++ b/src/doom/d_net.c @@ -237,6 +237,10 @@ void D_CheckNetGame (void) int i; int num_players; + // Call D_QuitNetGame on exit + + I_AtExit(D_QuitNetGame, true); + // default values for single player consoleplayer = 0; diff --git a/src/doom/s_sound.c b/src/doom/s_sound.c index 964ed27f..fa236970 100644 --- a/src/doom/s_sound.c +++ b/src/doom/s_sound.c @@ -147,6 +147,8 @@ void S_Init(int sfxVolume, int musicVolume) { S_sfx[i].lumpnum = S_sfx[i].usefulness = -1; } + + I_AtExit(S_Shutdown, true); } void S_Shutdown(void) -- cgit v1.2.3