From 2b5de0bafc1ebe347e08617de7595c1ea507c0b9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 26 Nov 2008 21:09:12 +0000 Subject: Add bindings for remaining missing config file variables, to get chocolate-setup functional again. Subversion-branch: /branches/raven-branch Subversion-revision: 1388 --- src/setup/display.c | 2 ++ src/setup/mainmenu.c | 32 ++++++++++++++++++++++++++++++-- src/setup/multiplayer.c | 21 +++++++++++++++++++-- src/setup/multiplayer.h | 5 ++--- src/setup/sound.c | 40 +++++++++++++++++++++++++++++++++------- src/setup/sound.h | 12 +----------- 6 files changed, 87 insertions(+), 25 deletions(-) diff --git a/src/setup/display.c b/src/setup/display.c index efb659a3..a8865c30 100644 --- a/src/setup/display.c +++ b/src/setup/display.c @@ -74,6 +74,7 @@ static int screen_width = 320; static int screen_height = 200; static int startup_delay = 1000; static int show_endoom = 1; +static int usegamma = 0; // These are the last screen width/height values that were chosen by the // user. These are used when finding the "nearest" mode, so when @@ -446,6 +447,7 @@ void BindDisplayVariables(void) M_BindVariable("screen_height", &screen_height); M_BindVariable("startup_delay", &startup_delay); M_BindVariable("video_driver", &video_driver); + M_BindVariable("usegamma", &usegamma); // doom, heretic only: M_BindVariable("show_endoom", &show_endoom); diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c index 1585c96b..7564fe36 100644 --- a/src/setup/mainmenu.c +++ b/src/setup/mainmenu.c @@ -28,6 +28,7 @@ #include "m_argv.h" #include "m_config.h" +#include "m_controls.h" #include "setup_icon.c" @@ -39,12 +40,24 @@ #include "multiplayer.h" #include "sound.h" +// Miscellaneous variables that aren't used in setup. + +static int showMessages = 1; +static int screenblocks = 9; +static int detailLevel = 0; + +static void BindMiscVariables(void) +{ + M_BindVariable("show_messages", &showMessages); + M_BindVariable("screenblocks", &screenblocks); + M_BindVariable("detaillevel", &detailLevel); +} + static void DoQuit(void *widget, void *dosave) { if (dosave != NULL) { - // DANGER: this is broken. Do not save. -// M_SaveDefaults(); + M_SaveDefaults(); } exit(0); @@ -142,6 +155,21 @@ static void InitConfig(void) SetChatMacroDefaults(); SetPlayerNameDefault(); + // Keyboard, mouse, joystick controls + + M_BindBaseControls(); + + // All other variables + + BindCompatibilityVariables(); + BindDisplayVariables(); + BindJoystickVariables(); + BindKeyboardVariables(); + BindMouseVariables(); + BindSoundVariables(); + BindMiscVariables(); + BindMultiplayerVariables(); + M_SetConfigFilenames("default.cfg", "chocolate-doom.cfg"); M_SetConfigDir(); M_LoadDefaults(); diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c index b1f1d67b..86455a8a 100644 --- a/src/setup/multiplayer.c +++ b/src/setup/multiplayer.c @@ -18,6 +18,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. // + #include #include #include @@ -94,8 +95,8 @@ static char *gamemodes[] = "Deathmatch 2.0", }; -char *net_player_name; -char *chat_macros[10]; +static char *net_player_name; +static char *chat_macros[10]; static char *wads[NUM_WADS]; static char *extra_params[NUM_EXTRA_PARAMS]; @@ -747,3 +748,19 @@ void MultiplayerConfig(void) TXT_AddWidget(window, table); } +void BindMultiplayerVariables(void) +{ + char buf[15]; + int i; + +#ifdef FEATURE_MULTIPLAYER + M_BindVariable("player_name", &net_player_name); +#endif + + for (i=0; i<10; ++i) + { + sprintf(buf, "chatmacro%i", i); + M_BindVariable(buf, &chat_macros[i]); + } +} + diff --git a/src/setup/multiplayer.h b/src/setup/multiplayer.h index b9871ed5..7490bc3c 100644 --- a/src/setup/multiplayer.h +++ b/src/setup/multiplayer.h @@ -22,9 +22,6 @@ #ifndef SETUP_MULTIPLAYER_H #define SETUP_MULTIPLAYER_H -extern char *net_player_name; -extern char *chat_macros[10]; - void StartMultiGame(void); void JoinMultiGame(void); void MultiplayerConfig(void); @@ -32,5 +29,7 @@ void MultiplayerConfig(void); void SetChatMacroDefaults(void); void SetPlayerNameDefault(void); +void BindMultiplayerVariables(void); + #endif /* #ifndef SETUP_MULTIPLAYER_H */ diff --git a/src/setup/sound.c b/src/setup/sound.c index 72414c83..91b6804a 100644 --- a/src/setup/sound.c +++ b/src/setup/sound.c @@ -24,6 +24,7 @@ #include #include "textscreen.h" +#include "m_config.h" #include "sound.h" @@ -65,20 +66,29 @@ static char *sfxmode_strings[] = #define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB #endif -int snd_sfxdevice = SNDDEVICE_SB; -int numChannels = 8; -int sfxVolume = 15; +static int snd_sfxdevice = SNDDEVICE_SB; +static int numChannels = 8; +static int sfxVolume = 15; -int snd_musicdevice = DEFAULT_MUSIC_DEVICE; -int musicVolume = 15; +static int snd_musicdevice = DEFAULT_MUSIC_DEVICE; +static int musicVolume = 15; -int snd_samplerate = 22050; +static int snd_samplerate = 22050; -int use_libsamplerate = 0; +static int use_libsamplerate = 0; static int snd_sfxmode; static int snd_musicenabled; +// DOS specific options: these are unused but should be maintained +// so that the config file can be shared between chocolate +// doom and doom.exe + +static int snd_sbport = 0; +static int snd_sbirq = 0; +static int snd_sbdma = 0; +static int snd_mport = 0; + static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) { switch (snd_sfxmode) @@ -165,3 +175,19 @@ void ConfigSound(void) } +void BindSoundVariables(void) +{ + M_BindVariable("snd_sfxdevice", &snd_sfxdevice); + M_BindVariable("snd_musicdevice", &snd_musicdevice); + M_BindVariable("snd_channels", &numChannels); + M_BindVariable("sfx_volume", &sfxVolume); + M_BindVariable("music_volume", &musicVolume); + M_BindVariable("snd_samplerate", &snd_samplerate); + M_BindVariable("use_libsamplerate", &use_libsamplerate); + + M_BindVariable("snd_sbport", &snd_sbport); + M_BindVariable("snd_sbirq", &snd_sbirq); + M_BindVariable("snd_sbdma", &snd_sbdma); + M_BindVariable("snd_mport", &snd_mport); +} + diff --git a/src/setup/sound.h b/src/setup/sound.h index 170dda0a..0b183502 100644 --- a/src/setup/sound.h +++ b/src/setup/sound.h @@ -22,18 +22,8 @@ #ifndef SETUP_SOUND_H #define SETUP_SOUND_H -extern int snd_sfxdevice; -extern int numChannels; -extern int sfxVolume; - -extern int snd_musicdevice; -extern int musicVolume; - -extern int snd_samplerate; - -extern int use_libsamplerate; - void ConfigSound(void); +void BindSoundVariables(void); #endif /* #ifndef SETUP_SOUND_H */ -- cgit v1.2.3