summaryrefslogtreecommitdiff
path: root/src/doom
diff options
context:
space:
mode:
authorSimon Howard2008-09-08 17:55:12 +0000
committerSimon Howard2008-09-08 17:55:12 +0000
commit3a41ade9fab0556d0d025c0b0e81834436a4f2e8 (patch)
tree0df9a93616e608a679c33e0c32de353cc93220ef /src/doom
parent0a5d1795ce8fe46e20627f8a7b4ba348f2ec400e (diff)
downloadchocolate-doom-3a41ade9fab0556d0d025c0b0e81834436a4f2e8.tar.gz
chocolate-doom-3a41ade9fab0556d0d025c0b0e81834436a4f2e8.tar.bz2
chocolate-doom-3a41ade9fab0556d0d025c0b0e81834436a4f2e8.zip
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
Diffstat (limited to 'src/doom')
-rw-r--r--src/doom/d_main.c5
-rw-r--r--src/doom/d_net.c4
-rw-r--r--src/doom/s_sound.c2
3 files changed, 11 insertions, 0 deletions
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)