diff options
author | Simon Howard | 2008-09-11 21:03:48 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-11 21:03:48 +0000 |
commit | b868352951acee0e556d702e5e90aa67d9a2b39e (patch) | |
tree | b07b281ae6be155d2b80fdc09c2daa3c3132d238 /src/doom | |
parent | d863f019a2d19f1146d92c4db71883ab2ead87ec (diff) | |
download | chocolate-doom-b868352951acee0e556d702e5e90aa67d9a2b39e.tar.gz chocolate-doom-b868352951acee0e556d702e5e90aa67d9a2b39e.tar.bz2 chocolate-doom-b868352951acee0e556d702e5e90aa67d9a2b39e.zip |
Refactor configuration file system to allow configuration file variables
to be bound in a distributed fashion around the program. Remove
dependency of m_config.c on doom/.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1222
Diffstat (limited to 'src/doom')
-rw-r--r-- | src/doom/d_main.c | 44 | ||||
-rw-r--r-- | src/doom/g_game.h | 3 | ||||
-rw-r--r-- | src/doom/hu_stuff.c | 2 | ||||
-rw-r--r-- | src/doom/hu_stuff.h | 2 | ||||
-rw-r--r-- | src/doom/s_sound.c | 22 | ||||
-rw-r--r-- | src/doom/s_sound.h | 1 |
6 files changed, 58 insertions, 16 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c index c84783bc..ef5c4317 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -55,6 +55,7 @@ #include "m_argv.h" #include "m_config.h" +#include "m_controls.h" #include "m_misc.h" #include "m_menu.h" #include "p_saveg.h" @@ -336,6 +337,39 @@ void D_Display (void) } // +// Add configuration file variable bindings. +// + +void D_BindVariables(void) +{ + int i; + + I_BindVariables(); + M_BindBaseControls(); + NET_BindVariables(); + + M_BindVariable("mouse_sensitivity", &mouseSensitivity); + M_BindVariable("sfx_volume", &sfxVolume); + M_BindVariable("music_volume", &musicVolume); + M_BindVariable("show_messages", &showMessages); + M_BindVariable("screenblocks", &screenblocks); + M_BindVariable("detaillevel", &detailLevel); + M_BindVariable("snd_channels", &snd_channels); + M_BindVariable("vanilla_savegame_limit", &vanilla_savegame_limit); + M_BindVariable("vanilla_demo_limit", &vanilla_demo_limit); + + // Multiplayer chat macros + + for (i=0; i<10; ++i) + { + char buf[12]; + + sprintf(buf, "chatmacro%i", i); + M_BindVariable(buf, &chat_macros[i]); + } +} + +// // D_GrabMouseCallback // // Called to determine whether to grab the mouse pointer @@ -944,11 +978,13 @@ void D_DoomMain (void) } // init subsystems - printf (DEH_String("V_Init: allocate screens.\n")); - V_Init (); + printf(DEH_String("V_Init: allocate screens.\n")); + V_Init(); - printf (DEH_String("M_LoadDefaults: Load system defaults.\n")); - M_LoadDefaults (); // load before initing other systems + // Load configuration files before initialising other subsystems. + printf(DEH_String("M_LoadDefaults: Load system defaults.\n")); + D_BindVariables(); + M_LoadDefaults(); // Save configuration at exit. I_AtExit(M_SaveDefaults, false); diff --git a/src/doom/g_game.h b/src/doom/g_game.h index 65fb06b0..8cf5b068 100644 --- a/src/doom/g_game.h +++ b/src/doom/g_game.h @@ -81,4 +81,7 @@ void G_ScreenShot (void); void G_DrawMouseSpeedBox(void); +extern int vanilla_savegame_limit; +extern int vanilla_demo_limit; #endif + diff --git a/src/doom/hu_stuff.c b/src/doom/hu_stuff.c index ace4cef2..d31b8ce8 100644 --- a/src/doom/hu_stuff.c +++ b/src/doom/hu_stuff.c @@ -67,7 +67,7 @@ -char* chat_macros[] = +char *chat_macros[10] = { HUSTR_CHATMACRO0, HUSTR_CHATMACRO1, diff --git a/src/doom/hu_stuff.h b/src/doom/hu_stuff.h index 310201f6..26bc92ee 100644 --- a/src/doom/hu_stuff.h +++ b/src/doom/hu_stuff.h @@ -62,5 +62,7 @@ void HU_Drawer(void); char HU_dequeueChatChar(void); void HU_Erase(void); +extern char *chat_macros[10]; #endif + diff --git a/src/doom/s_sound.c b/src/doom/s_sound.c index fa236970..e78f763a 100644 --- a/src/doom/s_sound.c +++ b/src/doom/s_sound.c @@ -110,7 +110,7 @@ static musicinfo_t *mus_playing = NULL; // Number of channels to use -int numChannels = 8; +int snd_channels = 8; // // Initializes sound stuff, including volume @@ -131,10 +131,10 @@ void S_Init(int sfxVolume, int musicVolume) // Allocating the internal channels for mixing // (the maximum numer of sounds rendered // simultaneously) within zone memory. - channels = Z_Malloc(numChannels*sizeof(channel_t), PU_STATIC, 0); + channels = Z_Malloc(snd_channels*sizeof(channel_t), PU_STATIC, 0); // Free all channels for use - for (i=0 ; i<numChannels ; i++) + for (i=0 ; i<snd_channels ; i++) { channels[i].sfxinfo = 0; } @@ -175,7 +175,7 @@ static void S_StopChannel(int cnum) // check to see if other channels are playing the sound - for (i=0; i<numChannels; i++) + for (i=0; i<snd_channels; i++) { if (cnum != i && c->sfxinfo == channels[i].sfxinfo) { @@ -203,7 +203,7 @@ void S_Start(void) // kill all playing sounds at start of level // (trust me - a good idea) - for (cnum=0 ; cnum<numChannels ; cnum++) + for (cnum=0 ; cnum<snd_channels ; cnum++) { if (channels[cnum].sfxinfo) { @@ -252,7 +252,7 @@ void S_StopSound(mobj_t *origin) { int cnum; - for (cnum=0 ; cnum<numChannels ; cnum++) + for (cnum=0 ; cnum<snd_channels ; cnum++) { if (channels[cnum].sfxinfo && channels[cnum].origin == origin) { @@ -275,7 +275,7 @@ static int S_GetChannel(mobj_t *origin, sfxinfo_t *sfxinfo) channel_t* c; // Find an open channel - for (cnum=0 ; cnum<numChannels ; cnum++) + for (cnum=0 ; cnum<snd_channels ; cnum++) { if (!channels[cnum].sfxinfo) { @@ -289,10 +289,10 @@ static int S_GetChannel(mobj_t *origin, sfxinfo_t *sfxinfo) } // None available - if (cnum == numChannels) + if (cnum == snd_channels) { // Look for lower priority - for (cnum=0 ; cnum<numChannels ; cnum++) + for (cnum=0 ; cnum<snd_channels ; cnum++) { if (channels[cnum].sfxinfo->priority >= sfxinfo->priority) { @@ -300,7 +300,7 @@ static int S_GetChannel(mobj_t *origin, sfxinfo_t *sfxinfo) } } - if (cnum == numChannels) + if (cnum == snd_channels) { // FUCK! No lower priority. Sorry, Charlie. return -1; @@ -524,7 +524,7 @@ void S_UpdateSounds(mobj_t *listener) sfxinfo_t* sfx; channel_t* c; - for (cnum=0; cnum<numChannels; cnum++) + for (cnum=0; cnum<snd_channels; cnum++) { c = &channels[cnum]; sfx = c->sfxinfo; diff --git a/src/doom/s_sound.h b/src/doom/s_sound.h index d2af9e88..7bb0a605 100644 --- a/src/doom/s_sound.h +++ b/src/doom/s_sound.h @@ -91,6 +91,7 @@ void S_UpdateSounds(mobj_t *listener); void S_SetMusicVolume(int volume); void S_SetSfxVolume(int volume); +extern int snd_channels; #endif |