diff options
author | Simon Howard | 2015-02-20 00:31:09 -0500 |
---|---|---|
committer | Simon Howard | 2015-02-20 00:33:12 -0500 |
commit | b39121c6a682eb8ae5efd29a875bd7c098185f04 (patch) | |
tree | c6a8b42412682c49d73aff7c794e333e55c807bc | |
parent | 1f5ce047ad6cb709f746b794b4a2dea9e2f89fb6 (diff) | |
download | chocolate-doom-b39121c6a682eb8ae5efd29a875bd7c098185f04.tar.gz chocolate-doom-b39121c6a682eb8ae5efd29a875bd7c098185f04.tar.bz2 chocolate-doom-b39121c6a682eb8ae5efd29a875bd7c098185f04.zip |
Refactor config file API.
The config file API previously relied on binding config variables
using M_BindVariable() which took a void pointer. It occurred to me
that if used on a boolean variable, this would be erroneous, but the
void pointer would make it impossible to tell. Split this into
separate M_Bind{Foo}Variable() functions based on type, which allows
for proper type checking on the pointers that are passed.
Vaguely related to #509.
-rw-r--r-- | src/d_iwad.c | 2 | ||||
-rw-r--r-- | src/doom/d_main.c | 22 | ||||
-rw-r--r-- | src/gusconf.c | 2 | ||||
-rw-r--r-- | src/gusconf.h | 2 | ||||
-rw-r--r-- | src/heretic/d_main.c | 16 | ||||
-rw-r--r-- | src/hexen/h2_main.c | 19 | ||||
-rw-r--r-- | src/i_joystick.c | 18 | ||||
-rw-r--r-- | src/i_sound.c | 34 | ||||
-rw-r--r-- | src/i_video.c | 34 | ||||
-rw-r--r-- | src/m_config.c | 64 | ||||
-rw-r--r-- | src/m_config.h | 6 | ||||
-rw-r--r-- | src/m_controls.c | 250 | ||||
-rw-r--r-- | src/net_client.c | 2 | ||||
-rw-r--r-- | src/setup/compatibility.c | 4 | ||||
-rw-r--r-- | src/setup/display.c | 26 | ||||
-rw-r--r-- | src/setup/joystick.c | 18 | ||||
-rw-r--r-- | src/setup/keyboard.c | 2 | ||||
-rw-r--r-- | src/setup/mode.c | 19 | ||||
-rw-r--r-- | src/setup/mouse.c | 12 | ||||
-rw-r--r-- | src/setup/multiplayer.c | 4 | ||||
-rw-r--r-- | src/setup/sound.c | 50 | ||||
-rw-r--r-- | src/strife/d_main.c | 33 |
22 files changed, 338 insertions, 301 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c index 7f512965..2d6460bc 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -332,7 +332,7 @@ static void CheckSteamGUSPatches(void) int len; // Already configured? Don't stomp on the user's choices. - current_path = M_GetStrVariable("gus_patch_path"); + current_path = M_GetStringVariable("gus_patch_path"); if (current_path != NULL && strlen(current_path) > 0) { return; diff --git a/src/doom/d_main.c b/src/doom/d_main.c index 1e9e950e..ca722dc6 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -359,16 +359,16 @@ void D_BindVariables(void) NET_BindVariables(); #endif - 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); - M_BindVariable("show_endoom", &show_endoom); + M_BindIntVariable("mouse_sensitivity", &mouseSensitivity); + M_BindIntVariable("sfx_volume", &sfxVolume); + M_BindIntVariable("music_volume", &musicVolume); + M_BindIntVariable("show_messages", &showMessages); + M_BindIntVariable("screenblocks", &screenblocks); + M_BindIntVariable("detaillevel", &detailLevel); + M_BindIntVariable("snd_channels", &snd_channels); + M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit); + M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit); + M_BindIntVariable("show_endoom", &show_endoom); // Multiplayer chat macros @@ -377,7 +377,7 @@ void D_BindVariables(void) char buf[12]; M_snprintf(buf, sizeof(buf), "chatmacro%i", i); - M_BindVariable(buf, &chat_macros[i]); + M_BindStringVariable(buf, &chat_macros[i]); } } diff --git a/src/gusconf.c b/src/gusconf.c index a2dfdac3..f1575c41 100644 --- a/src/gusconf.c +++ b/src/gusconf.c @@ -39,7 +39,7 @@ typedef struct } gus_config_t; char *gus_patch_path = ""; -unsigned int gus_ram_kb = 1024; +int gus_ram_kb = 1024; static unsigned int MappingIndex(void) { diff --git a/src/gusconf.h b/src/gusconf.h index e0124266..4efbe995 100644 --- a/src/gusconf.h +++ b/src/gusconf.h @@ -21,7 +21,7 @@ #include "doomtype.h" extern char *gus_patch_path; -extern unsigned int gus_ram_kb; +extern int gus_ram_kb; boolean GUS_WriteConfig(char *path); diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 8389a23d..2a57016f 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -756,20 +756,20 @@ void D_BindVariables(void) M_BindMenuControls(); M_BindMapControls(); - M_BindVariable("mouse_sensitivity", &mouseSensitivity); - M_BindVariable("sfx_volume", &snd_MaxVolume); - M_BindVariable("music_volume", &snd_MusicVolume); - M_BindVariable("screenblocks", &screenblocks); - M_BindVariable("snd_channels", &snd_Channels); - M_BindVariable("show_endoom", &show_endoom); - M_BindVariable("graphical_startup", &graphical_startup); + M_BindIntVariable("mouse_sensitivity", &mouseSensitivity); + M_BindIntVariable("sfx_volume", &snd_MaxVolume); + M_BindIntVariable("music_volume", &snd_MusicVolume); + M_BindIntVariable("screenblocks", &screenblocks); + M_BindIntVariable("snd_channels", &snd_Channels); + M_BindIntVariable("show_endoom", &show_endoom); + M_BindIntVariable("graphical_startup", &graphical_startup); for (i=0; i<10; ++i) { char buf[12]; M_snprintf(buf, sizeof(buf), "chatmacro%i", i); - M_BindVariable(buf, &chat_macros[i]); + M_BindStringVariable(buf, &chat_macros[i]); } } diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 23131e9b..9d92a65b 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -149,14 +149,15 @@ void D_BindVariables(void) key_multi_msgplayer[6] = CT_KEY_PLAYER7; key_multi_msgplayer[7] = CT_KEY_PLAYER8; - M_BindVariable("graphical_startup", &graphical_startup); - M_BindVariable("mouse_sensitivity", &mouseSensitivity); - M_BindVariable("sfx_volume", &snd_MaxVolume); - M_BindVariable("music_volume", &snd_MusicVolume); - M_BindVariable("messageson", &messageson); - M_BindVariable("screenblocks", &screenblocks); - M_BindVariable("snd_channels", &snd_Channels); - M_BindVariable("savedir", &SavePath); + M_BindIntVariable("graphical_startup", &graphical_startup); + M_BindIntVariable("mouse_sensitivity", &mouseSensitivity); + M_BindIntVariable("sfx_volume", &snd_MaxVolume); + M_BindIntVariable("music_volume", &snd_MusicVolume); + M_BindIntVariable("messageson", &messageson); + M_BindIntVariable("screenblocks", &screenblocks); + M_BindIntVariable("snd_channels", &snd_Channels); + + M_BindStringVariable("savedir", &SavePath); // Multiplayer chat macros @@ -165,7 +166,7 @@ void D_BindVariables(void) char buf[12]; M_snprintf(buf, sizeof(buf), "chatmacro%i", i); - M_BindVariable(buf, &chat_macros[i]); + M_BindStringVariable(buf, &chat_macros[i]); } } diff --git a/src/i_joystick.c b/src/i_joystick.c index 06531a0b..eba7f21a 100644 --- a/src/i_joystick.c +++ b/src/i_joystick.c @@ -328,20 +328,20 @@ void I_BindJoystickVariables(void) { int i; - M_BindVariable("use_joystick", &usejoystick); - M_BindVariable("joystick_index", &joystick_index); - M_BindVariable("joystick_x_axis", &joystick_x_axis); - M_BindVariable("joystick_y_axis", &joystick_y_axis); - M_BindVariable("joystick_strafe_axis", &joystick_strafe_axis); - M_BindVariable("joystick_x_invert", &joystick_x_invert); - M_BindVariable("joystick_y_invert", &joystick_y_invert); - M_BindVariable("joystick_strafe_invert",&joystick_strafe_invert); + M_BindIntVariable("use_joystick", &usejoystick); + M_BindIntVariable("joystick_index", &joystick_index); + M_BindIntVariable("joystick_x_axis", &joystick_x_axis); + M_BindIntVariable("joystick_y_axis", &joystick_y_axis); + M_BindIntVariable("joystick_strafe_axis", &joystick_strafe_axis); + M_BindIntVariable("joystick_x_invert", &joystick_x_invert); + M_BindIntVariable("joystick_y_invert", &joystick_y_invert); + M_BindIntVariable("joystick_strafe_invert",&joystick_strafe_invert); for (i = 0; i < NUM_VIRTUAL_BUTTONS; ++i) { char name[32]; M_snprintf(name, sizeof(name), "joystick_physical_button%i", i); - M_BindVariable(name, &joystick_physical_buttons[i]); + M_BindIntVariable(name, &joystick_physical_buttons[i]); } } diff --git a/src/i_sound.c b/src/i_sound.c index 4432a468..e70b9bc7 100644 --- a/src/i_sound.c +++ b/src/i_sound.c @@ -434,25 +434,25 @@ void I_BindSoundVariables(void) extern int use_libsamplerate; extern float libsamplerate_scale; - M_BindVariable("snd_musicdevice", &snd_musicdevice); - M_BindVariable("snd_sfxdevice", &snd_sfxdevice); - M_BindVariable("snd_sbport", &snd_sbport); - M_BindVariable("snd_sbirq", &snd_sbirq); - M_BindVariable("snd_sbdma", &snd_sbdma); - M_BindVariable("snd_mport", &snd_mport); - M_BindVariable("snd_maxslicetime_ms", &snd_maxslicetime_ms); - M_BindVariable("snd_musiccmd", &snd_musiccmd); - M_BindVariable("snd_samplerate", &snd_samplerate); - M_BindVariable("snd_cachesize", &snd_cachesize); - M_BindVariable("opl_io_port", &opl_io_port); - - M_BindVariable("timidity_cfg_path", &timidity_cfg_path); - M_BindVariable("gus_patch_path", &gus_patch_path); - M_BindVariable("gus_ram_kb", &gus_ram_kb); + M_BindIntVariable("snd_musicdevice", &snd_musicdevice); + M_BindIntVariable("snd_sfxdevice", &snd_sfxdevice); + M_BindIntVariable("snd_sbport", &snd_sbport); + M_BindIntVariable("snd_sbirq", &snd_sbirq); + M_BindIntVariable("snd_sbdma", &snd_sbdma); + M_BindIntVariable("snd_mport", &snd_mport); + M_BindIntVariable("snd_maxslicetime_ms", &snd_maxslicetime_ms); + M_BindStringVariable("snd_musiccmd", &snd_musiccmd); + M_BindIntVariable("snd_samplerate", &snd_samplerate); + M_BindIntVariable("snd_cachesize", &snd_cachesize); + M_BindIntVariable("opl_io_port", &opl_io_port); + + M_BindStringVariable("timidity_cfg_path", &timidity_cfg_path); + M_BindStringVariable("gus_patch_path", &gus_patch_path); + M_BindIntVariable("gus_ram_kb", &gus_ram_kb); #ifdef FEATURE_SOUND - M_BindVariable("use_libsamplerate", &use_libsamplerate); - M_BindVariable("libsamplerate_scale", &libsamplerate_scale); + M_BindIntVariable("use_libsamplerate", &use_libsamplerate); + M_BindFloatVariable("libsamplerate_scale", &libsamplerate_scale); #endif // Before SDL_mixer version 1.2.11, MIDI music caused the game diff --git a/src/i_video.c b/src/i_video.c index 76ad23af..8fb1f178 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -2161,23 +2161,23 @@ void I_InitGraphics(void) void I_BindVideoVariables(void) { - M_BindVariable("use_mouse", &usemouse); - M_BindVariable("autoadjust_video_settings", &autoadjust_video_settings); - M_BindVariable("fullscreen", &fullscreen); - M_BindVariable("aspect_ratio_correct", &aspect_ratio_correct); - M_BindVariable("startup_delay", &startup_delay); - M_BindVariable("screen_width", &screen_width); - M_BindVariable("screen_height", &screen_height); - M_BindVariable("screen_bpp", &screen_bpp); - M_BindVariable("grabmouse", &grabmouse); - M_BindVariable("mouse_acceleration", &mouse_acceleration); - M_BindVariable("mouse_threshold", &mouse_threshold); - M_BindVariable("video_driver", &video_driver); - M_BindVariable("window_position", &window_position); - M_BindVariable("usegamma", &usegamma); - M_BindVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping); - M_BindVariable("novert", &novert); - M_BindVariable("png_screenshots", &png_screenshots); + M_BindIntVariable("use_mouse", &usemouse); + M_BindIntVariable("autoadjust_video_settings", &autoadjust_video_settings); + M_BindIntVariable("fullscreen", &fullscreen); + M_BindIntVariable("aspect_ratio_correct", &aspect_ratio_correct); + M_BindIntVariable("startup_delay", &startup_delay); + M_BindIntVariable("screen_width", &screen_width); + M_BindIntVariable("screen_height", &screen_height); + M_BindIntVariable("screen_bpp", &screen_bpp); + M_BindIntVariable("grabmouse", &grabmouse); + M_BindFloatVariable("mouse_acceleration", &mouse_acceleration); + M_BindIntVariable("mouse_threshold", &mouse_threshold); + M_BindStringVariable("video_driver", &video_driver); + M_BindStringVariable("window_position", &window_position); + M_BindIntVariable("usegamma", &usegamma); + M_BindIntVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping); + M_BindIntVariable("novert", &novert); + M_BindIntVariable("png_screenshots", &png_screenshots); // Windows Vista or later? Set screen color depth to // 32 bits per pixel, as 8-bit palettized screen modes diff --git a/src/m_config.c b/src/m_config.c index 083d298a..ad539a7f 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -23,6 +23,7 @@ #include <string.h> #include <ctype.h> #include <errno.h> +#include <assert.h> #include "config.h" @@ -64,7 +65,11 @@ typedef struct char *name; // Pointer to the location in memory of the variable - void *location; + union { + int *i; + char **s; + float *f; + } location; // Type of the variable default_type_t type; @@ -93,7 +98,7 @@ typedef struct } default_collection_t; #define CONFIG_VARIABLE_GENERIC(name, type) \ - { #name, NULL, type, 0, 0, false } + { #name, {NULL}, type, 0, 0, false } #define CONFIG_VARIABLE_KEY(name) \ CONFIG_VARIABLE_GENERIC(name, DEFAULT_KEY) @@ -1646,7 +1651,7 @@ static void SaveDefaultCollection(default_collection_t *collection) // the possibility of screwing up the user's config // file - v = * (int *) defaults[i].location; + v = *defaults[i].location.i; if (v == KEY_RSHIFT) { @@ -1687,19 +1692,19 @@ static void SaveDefaultCollection(default_collection_t *collection) break; case DEFAULT_INT: - fprintf(f, "%i", * (int *) defaults[i].location); + fprintf(f, "%i", *defaults[i].location.i); break; case DEFAULT_INT_HEX: - fprintf(f, "0x%x", * (int *) defaults[i].location); + fprintf(f, "0x%x", *defaults[i].location.i); break; case DEFAULT_FLOAT: - fprintf(f, "%f", * (float *) defaults[i].location); + fprintf(f, "%f", *defaults[i].location.f); break; case DEFAULT_STRING: - fprintf(f,"\"%s\"", * (char **) (defaults[i].location)); + fprintf(f,"\"%s\"", *defaults[i].location.s); break; } @@ -1732,12 +1737,12 @@ static void SetVariable(default_t *def, char *value) switch (def->type) { case DEFAULT_STRING: - * (char **) def->location = M_StringDuplicate(value); + *def->location.s = M_StringDuplicate(value); break; case DEFAULT_INT: case DEFAULT_INT_HEX: - * (int *) def->location = ParseIntParameter(value); + *def->location.i = ParseIntParameter(value); break; case DEFAULT_KEY: @@ -1757,11 +1762,11 @@ static void SetVariable(default_t *def, char *value) } def->original_translated = intparm; - * (int *) def->location = intparm; + *def->location.i = intparm; break; case DEFAULT_FLOAT: - * (float *) def->location = (float) atof(value); + *def->location.f = (float) atof(value); break; } } @@ -1957,13 +1962,38 @@ static default_t *GetDefaultForName(char *name) // Bind a variable to a given configuration file variable, by name. // -void M_BindVariable(char *name, void *location) +void M_BindIntVariable(char *name, int *location) { default_t *variable; variable = GetDefaultForName(name); + assert(variable->type == DEFAULT_INT + || variable->type == DEFAULT_INT_HEX + || variable->type == DEFAULT_KEY); - variable->location = location; + variable->location.i = location; + variable->bound = true; +} + +void M_BindFloatVariable(char *name, float *location) +{ + default_t *variable; + + variable = GetDefaultForName(name); + assert(variable->type == DEFAULT_FLOAT); + + variable->location.f = location; + variable->bound = true; +} + +void M_BindStringVariable(char *name, char **location) +{ + default_t *variable; + + variable = GetDefaultForName(name); + assert(variable->type == DEFAULT_STRING); + + variable->location.s = location; variable->bound = true; } @@ -2000,10 +2030,10 @@ int M_GetIntVariable(char *name) return 0; } - return *((int *) variable->location); + return *variable->location.i; } -const char *M_GetStrVariable(char *name) +const char *M_GetStringVariable(char *name) { default_t *variable; @@ -2015,7 +2045,7 @@ const char *M_GetStrVariable(char *name) return NULL; } - return *((const char **) variable->location); + return *variable->location.s; } float M_GetFloatVariable(char *name) @@ -2030,7 +2060,7 @@ float M_GetFloatVariable(char *name) return 0; } - return *((float *) variable->location); + return *variable->location.f; } // Get the path to the default configuration dir to use, if NULL diff --git a/src/m_config.h b/src/m_config.h index a17de2b4..43882a49 100644 --- a/src/m_config.h +++ b/src/m_config.h @@ -26,10 +26,12 @@ void M_LoadDefaults(void); void M_SaveDefaults(void); void M_SaveDefaultsAlternate(char *main, char *extra); void M_SetConfigDir(char *dir); -void M_BindVariable(char *name, void *variable); +void M_BindIntVariable(char *name, int *variable); +void M_BindFloatVariable(char *name, float *variable); +void M_BindStringVariable(char *name, char **variable); boolean M_SetVariable(char *name, char *value); int M_GetIntVariable(char *name); -const char *M_GetStrVariable(char *name); +const char *M_GetStringVariable(char *name); float M_GetFloatVariable(char *name); void M_SetConfigFilenames(char *main_config, char *extra_config); char *M_GetSaveGameDir(char *iwadname); diff --git a/src/m_controls.c b/src/m_controls.c index c05c8bda..35f848c7 100644 --- a/src/m_controls.c +++ b/src/m_controls.c @@ -204,70 +204,70 @@ int dclick_use = 1; void M_BindBaseControls(void) { - M_BindVariable("key_right", &key_right); - M_BindVariable("key_left", &key_left); - M_BindVariable("key_up", &key_up); - M_BindVariable("key_down", &key_down); - M_BindVariable("key_strafeleft", &key_strafeleft); - M_BindVariable("key_straferight", &key_straferight); - M_BindVariable("key_fire", &key_fire); - M_BindVariable("key_use", &key_use); - M_BindVariable("key_strafe", &key_strafe); - M_BindVariable("key_speed", &key_speed); - - M_BindVariable("mouseb_fire", &mousebfire); - M_BindVariable("mouseb_strafe", &mousebstrafe); - M_BindVariable("mouseb_forward", &mousebforward); - - M_BindVariable("joyb_fire", &joybfire); - M_BindVariable("joyb_strafe", &joybstrafe); - M_BindVariable("joyb_use", &joybuse); - M_BindVariable("joyb_speed", &joybspeed); - - M_BindVariable("joyb_menu_activate", &joybmenu); + M_BindIntVariable("key_right", &key_right); + M_BindIntVariable("key_left", &key_left); + M_BindIntVariable("key_up", &key_up); + M_BindIntVariable("key_down", &key_down); + M_BindIntVariable("key_strafeleft", &key_strafeleft); + M_BindIntVariable("key_straferight", &key_straferight); + M_BindIntVariable("key_fire", &key_fire); + M_BindIntVariable("key_use", &key_use); + M_BindIntVariable("key_strafe", &key_strafe); + M_BindIntVariable("key_speed", &key_speed); + + M_BindIntVariable("mouseb_fire", &mousebfire); + M_BindIntVariable("mouseb_strafe", &mousebstrafe); + M_BindIntVariable("mouseb_forward", &mousebforward); + + M_BindIntVariable("joyb_fire", &joybfire); + M_BindIntVariable("joyb_strafe", &joybstrafe); + M_BindIntVariable("joyb_use", &joybuse); + M_BindIntVariable("joyb_speed", &joybspeed); + + M_BindIntVariable("joyb_menu_activate", &joybmenu); // Extra controls that are not in the Vanilla versions: - M_BindVariable("joyb_strafeleft", &joybstrafeleft); - M_BindVariable("joyb_straferight", &joybstraferight); - M_BindVariable("mouseb_strafeleft", &mousebstrafeleft); - M_BindVariable("mouseb_straferight", &mousebstraferight); - M_BindVariable("mouseb_use", &mousebuse); - M_BindVariable("mouseb_backward", &mousebbackward); - M_BindVariable("dclick_use", &dclick_use); - M_BindVariable("key_pause", &key_pause); - M_BindVariable("key_message_refresh", &key_message_refresh); + M_BindIntVariable("joyb_strafeleft", &joybstrafeleft); + M_BindIntVariable("joyb_straferight", &joybstraferight); + M_BindIntVariable("mouseb_strafeleft", &mousebstrafeleft); + M_BindIntVariable("mouseb_straferight", &mousebstraferight); + M_BindIntVariable("mouseb_use", &mousebuse); + M_BindIntVariable("mouseb_backward", &mousebbackward); + M_BindIntVariable("dclick_use", &dclick_use); + M_BindIntVariable("key_pause", &key_pause); + M_BindIntVariable("key_message_refresh", &key_message_refresh); } void M_BindHereticControls(void) { - M_BindVariable("key_flyup", &key_flyup); - M_BindVariable("key_flydown", &key_flydown); - M_BindVariable("key_flycenter", &key_flycenter); + M_BindIntVariable("key_flyup", &key_flyup); + M_BindIntVariable("key_flydown", &key_flydown); + M_BindIntVariable("key_flycenter", &key_flycenter); - M_BindVariable("key_lookup", &key_lookup); - M_BindVariable("key_lookdown", &key_lookdown); - M_BindVariable("key_lookcenter", &key_lookcenter); + M_BindIntVariable("key_lookup", &key_lookup); + M_BindIntVariable("key_lookdown", &key_lookdown); + M_BindIntVariable("key_lookcenter", &key_lookcenter); - M_BindVariable("key_invleft", &key_invleft); - M_BindVariable("key_invright", &key_invright); - M_BindVariable("key_useartifact", &key_useartifact); + M_BindIntVariable("key_invleft", &key_invleft); + M_BindIntVariable("key_invright", &key_invright); + M_BindIntVariable("key_useartifact", &key_useartifact); } void M_BindHexenControls(void) { - M_BindVariable("key_jump", &key_jump); - M_BindVariable("mouseb_jump", &mousebjump); - M_BindVariable("joyb_jump", &joybjump); - - M_BindVariable("key_arti_all", &key_arti_all); - M_BindVariable("key_arti_health", &key_arti_health); - M_BindVariable("key_arti_poisonbag", &key_arti_poisonbag); - M_BindVariable("key_arti_blastradius", &key_arti_blastradius); - M_BindVariable("key_arti_teleport", &key_arti_teleport); - M_BindVariable("key_arti_teleportother", &key_arti_teleportother); - M_BindVariable("key_arti_egg", &key_arti_egg); - M_BindVariable("key_arti_invulnerability", &key_arti_invulnerability); + M_BindIntVariable("key_jump", &key_jump); + M_BindIntVariable("mouseb_jump", &mousebjump); + M_BindIntVariable("joyb_jump", &joybjump); + + M_BindIntVariable("key_arti_all", &key_arti_all); + M_BindIntVariable("key_arti_health", &key_arti_health); + M_BindIntVariable("key_arti_poisonbag", &key_arti_poisonbag); + M_BindIntVariable("key_arti_blastradius", &key_arti_blastradius); + M_BindIntVariable("key_arti_teleport", &key_arti_teleport); + M_BindIntVariable("key_arti_teleportother", &key_arti_teleportother); + M_BindIntVariable("key_arti_egg", &key_arti_egg); + M_BindIntVariable("key_arti_invulnerability", &key_arti_invulnerability); } void M_BindStrifeControls(void) @@ -282,95 +282,95 @@ void M_BindStrifeControls(void) key_invleft = KEY_INS; key_invright = KEY_DEL; - M_BindVariable("key_jump", &key_jump); - M_BindVariable("key_lookUp", &key_lookup); - M_BindVariable("key_lookDown", &key_lookdown); - M_BindVariable("key_invLeft", &key_invleft); - M_BindVariable("key_invRight", &key_invright); + M_BindIntVariable("key_jump", &key_jump); + M_BindIntVariable("key_lookUp", &key_lookup); + M_BindIntVariable("key_lookDown", &key_lookdown); + M_BindIntVariable("key_invLeft", &key_invleft); + M_BindIntVariable("key_invRight", &key_invright); // Custom Strife-only Keys: - M_BindVariable("key_useHealth", &key_usehealth); - M_BindVariable("key_invquery", &key_invquery); - M_BindVariable("key_mission", &key_mission); - M_BindVariable("key_invPop", &key_invpop); - M_BindVariable("key_invKey", &key_invkey); - M_BindVariable("key_invHome", &key_invhome); - M_BindVariable("key_invEnd", &key_invend); - M_BindVariable("key_invUse", &key_invuse); - M_BindVariable("key_invDrop", &key_invdrop); + M_BindIntVariable("key_useHealth", &key_usehealth); + M_BindIntVariable("key_invquery", &key_invquery); + M_BindIntVariable("key_mission", &key_mission); + M_BindIntVariable("key_invPop", &key_invpop); + M_BindIntVariable("key_invKey", &key_invkey); + M_BindIntVariable("key_invHome", &key_invhome); + M_BindIntVariable("key_invEnd", &key_invend); + M_BindIntVariable("key_invUse", &key_invuse); + M_BindIntVariable("key_invDrop", &key_invdrop); // Strife also supports jump on mouse and joystick, and in the exact same // manner as Hexen! - M_BindVariable("mouseb_jump", &mousebjump); - M_BindVariable("joyb_jump", &joybjump); + M_BindIntVariable("mouseb_jump", &mousebjump); + M_BindIntVariable("joyb_jump", &joybjump); } void M_BindWeaponControls(void) { - M_BindVariable("key_weapon1", &key_weapon1); - M_BindVariable("key_weapon2", &key_weapon2); - M_BindVariable("key_weapon3", &key_weapon3); - M_BindVariable("key_weapon4", &key_weapon4); - M_BindVariable("key_weapon5", &key_weapon5); - M_BindVariable("key_weapon6", &key_weapon6); - M_BindVariable("key_weapon7", &key_weapon7); - M_BindVariable("key_weapon8", &key_weapon8); - - M_BindVariable("key_prevweapon", &key_prevweapon); - M_BindVariable("key_nextweapon", &key_nextweapon); - - M_BindVariable("joyb_prevweapon", &joybprevweapon); - M_BindVariable("joyb_nextweapon", &joybnextweapon); - - M_BindVariable("mouseb_prevweapon", &mousebprevweapon); - M_BindVariable("mouseb_nextweapon", &mousebnextweapon); + M_BindIntVariable("key_weapon1", &key_weapon1); + M_BindIntVariable("key_weapon2", &key_weapon2); + M_BindIntVariable("key_weapon3", &key_weapon3); + M_BindIntVariable("key_weapon4", &key_weapon4); + M_BindIntVariable("key_weapon5", &key_weapon5); + M_BindIntVariable("key_weapon6", &key_weapon6); + M_BindIntVariable("key_weapon7", &key_weapon7); + M_BindIntVariable("key_weapon8", &key_weapon8); + + M_BindIntVariable("key_prevweapon", &key_prevweapon); + M_BindIntVariable("key_nextweapon", &key_nextweapon); + + M_BindIntVariable("joyb_prevweapon", &joybprevweapon); + M_BindIntVariable("joyb_nextweapon", &joybnextweapon); + + M_BindIntVariable("mouseb_prevweapon", &mousebprevweapon); + M_BindIntVariable("mouseb_nextweapon", &mousebnextweapon); } void M_BindMapControls(void) { - M_BindVariable("key_map_north", &key_map_north); - M_BindVariable("key_map_south", &key_map_south); - M_BindVariable("key_map_east", &key_map_east); - M_BindVariable("key_map_west", &key_map_west); - M_BindVariable("key_map_zoomin", &key_map_zoomin); - M_BindVariable("key_map_zoomout", &key_map_zoomout); - M_BindVariable("key_map_toggle", &key_map_toggle); - M_BindVariable("key_map_maxzoom", &key_map_maxzoom); - M_BindVariable("key_map_follow", &key_map_follow); - M_BindVariable("key_map_grid", &key_map_grid); - M_BindVariable("key_map_mark", &key_map_mark); - M_BindVariable("key_map_clearmark", &key_map_clearmark); + M_BindIntVariable("key_map_north", &key_map_north); + M_BindIntVariable("key_map_south", &key_map_south); + M_BindIntVariable("key_map_east", &key_map_east); + M_BindIntVariable("key_map_west", &key_map_west); + M_BindIntVariable("key_map_zoomin", &key_map_zoomin); + M_BindIntVariable("key_map_zoomout", &key_map_zoomout); + M_BindIntVariable("key_map_toggle", &key_map_toggle); + M_BindIntVariable("key_map_maxzoom", &key_map_maxzoom); + M_BindIntVariable("key_map_follow", &key_map_follow); + M_BindIntVariable("key_map_grid", &key_map_grid); + M_BindIntVariable("key_map_mark", &key_map_mark); + M_BindIntVariable("key_map_clearmark", &key_map_clearmark); } void M_BindMenuControls(void) { - M_BindVariable("key_menu_activate", &key_menu_activate); - M_BindVariable("key_menu_up", &key_menu_up); - M_BindVariable("key_menu_down", &key_menu_down); - M_BindVariable("key_menu_left", &key_menu_left); - M_BindVariable("key_menu_right", &key_menu_right); - M_BindVariable("key_menu_back", &key_menu_back); - M_BindVariable("key_menu_forward", &key_menu_forward); - M_BindVariable("key_menu_confirm", &key_menu_confirm); - M_BindVariable("key_menu_abort", &key_menu_abort); - - M_BindVariable("key_menu_help", &key_menu_help); - M_BindVariable("key_menu_save", &key_menu_save); - M_BindVariable("key_menu_load", &key_menu_load); - M_BindVariable("key_menu_volume", &key_menu_volume); - M_BindVariable("key_menu_detail", &key_menu_detail); - M_BindVariable("key_menu_qsave", &key_menu_qsave); - M_BindVariable("key_menu_endgame", &key_menu_endgame); - M_BindVariable("key_menu_messages", &key_menu_messages); - M_BindVariable("key_menu_qload", &key_menu_qload); - M_BindVariable("key_menu_quit", &key_menu_quit); - M_BindVariable("key_menu_gamma", &key_menu_gamma); - - M_BindVariable("key_menu_incscreen", &key_menu_incscreen); - M_BindVariable("key_menu_decscreen", &key_menu_decscreen); - M_BindVariable("key_menu_screenshot",&key_menu_screenshot); - M_BindVariable("key_demo_quit", &key_demo_quit); - M_BindVariable("key_spy", &key_spy); + M_BindIntVariable("key_menu_activate", &key_menu_activate); + M_BindIntVariable("key_menu_up", &key_menu_up); + M_BindIntVariable("key_menu_down", &key_menu_down); + M_BindIntVariable("key_menu_left", &key_menu_left); + M_BindIntVariable("key_menu_right", &key_menu_right); + M_BindIntVariable("key_menu_back", &key_menu_back); + M_BindIntVariable("key_menu_forward", &key_menu_forward); + M_BindIntVariable("key_menu_confirm", &key_menu_confirm); + M_BindIntVariable("key_menu_abort", &key_menu_abort); + + M_BindIntVariable("key_menu_help", &key_menu_help); + M_BindIntVariable("key_menu_save", &key_menu_save); + M_BindIntVariable("key_menu_load", &key_menu_load); + M_BindIntVariable("key_menu_volume", &key_menu_volume); + M_BindIntVariable("key_menu_detail", &key_menu_detail); + M_BindIntVariable("key_menu_qsave", &key_menu_qsave); + M_BindIntVariable("key_menu_endgame", &key_menu_endgame); + M_BindIntVariable("key_menu_messages", &key_menu_messages); + M_BindIntVariable("key_menu_qload", &key_menu_qload); + M_BindIntVariable("key_menu_quit", &key_menu_quit); + M_BindIntVariable("key_menu_gamma", &key_menu_gamma); + + M_BindIntVariable("key_menu_incscreen", &key_menu_incscreen); + M_BindIntVariable("key_menu_decscreen", &key_menu_decscreen); + M_BindIntVariable("key_menu_screenshot",&key_menu_screenshot); + M_BindIntVariable("key_demo_quit", &key_demo_quit); + M_BindIntVariable("key_spy", &key_spy); } void M_BindChatControls(unsigned int num_players) @@ -378,12 +378,12 @@ void M_BindChatControls(unsigned int num_players) char name[32]; // haleyjd: 20 not large enough - Thank you, come again! unsigned int i; // haleyjd: signedness conflict - M_BindVariable("key_multi_msg", &key_multi_msg); + M_BindIntVariable("key_multi_msg", &key_multi_msg); for (i=0; i<num_players; ++i) { M_snprintf(name, sizeof(name), "key_multi_msgplayer%i", i + 1); - M_BindVariable(name, &key_multi_msgplayer[i]); + M_BindIntVariable(name, &key_multi_msgplayer[i]); } } diff --git a/src/net_client.c b/src/net_client.c index 54903dae..e0037e3e 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -1102,5 +1102,5 @@ void NET_Init(void) void NET_BindVariables(void) { - M_BindVariable("player_name", &net_player_name); + M_BindStringVariable("player_name", &net_player_name); } diff --git a/src/setup/compatibility.c b/src/setup/compatibility.c index 83dabdc8..df202117 100644 --- a/src/setup/compatibility.c +++ b/src/setup/compatibility.c @@ -43,8 +43,8 @@ void BindCompatibilityVariables(void) { if (gamemission == doom || gamemission == strife) { - M_BindVariable("vanilla_savegame_limit", &vanilla_savegame_limit); - M_BindVariable("vanilla_demo_limit", &vanilla_demo_limit); + M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit); + M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit); } } diff --git a/src/setup/display.c b/src/setup/display.c index 090fd445..1398aaf0 100644 --- a/src/setup/display.c +++ b/src/setup/display.c @@ -700,28 +700,28 @@ void ConfigDisplay(void) void BindDisplayVariables(void) { - M_BindVariable("autoadjust_video_settings", &autoadjust_video_settings); - M_BindVariable("aspect_ratio_correct", &aspect_ratio_correct); - M_BindVariable("fullscreen", &fullscreen); - M_BindVariable("screen_width", &screen_width); - M_BindVariable("screen_height", &screen_height); - M_BindVariable("screen_bpp", &screen_bpp); - M_BindVariable("startup_delay", &startup_delay); - M_BindVariable("video_driver", &video_driver); - M_BindVariable("window_position", &window_position); - M_BindVariable("usegamma", &usegamma); - M_BindVariable("png_screenshots", &png_screenshots); + M_BindIntVariable("autoadjust_video_settings", &autoadjust_video_settings); + M_BindIntVariable("aspect_ratio_correct", &aspect_ratio_correct); + M_BindIntVariable("fullscreen", &fullscreen); + M_BindIntVariable("screen_width", &screen_width); + M_BindIntVariable("screen_height", &screen_height); + M_BindIntVariable("screen_bpp", &screen_bpp); + M_BindIntVariable("startup_delay", &startup_delay); + M_BindStringVariable("video_driver", &video_driver); + M_BindStringVariable("window_position", &window_position); + M_BindIntVariable("usegamma", &usegamma); + M_BindIntVariable("png_screenshots", &png_screenshots); if (gamemission == doom || gamemission == heretic || gamemission == strife) { - M_BindVariable("show_endoom", &show_endoom); + M_BindIntVariable("show_endoom", &show_endoom); } if (gamemission == heretic || gamemission == hexen || gamemission == strife) { - M_BindVariable("graphical_startup", &graphical_startup); + M_BindIntVariable("graphical_startup", &graphical_startup); } // Windows Vista or later? Set screen color depth to diff --git a/src/setup/joystick.c b/src/setup/joystick.c index 49931312..dc94b2f0 100644 --- a/src/setup/joystick.c +++ b/src/setup/joystick.c @@ -757,20 +757,20 @@ void BindJoystickVariables(void) { int i; - M_BindVariable("use_joystick", &usejoystick); - M_BindVariable("joystick_index", &joystick_index); - M_BindVariable("joystick_x_axis", &joystick_x_axis); - M_BindVariable("joystick_y_axis", &joystick_y_axis); - M_BindVariable("joystick_strafe_axis", &joystick_strafe_axis); - M_BindVariable("joystick_x_invert", &joystick_x_invert); - M_BindVariable("joystick_y_invert", &joystick_y_invert); - M_BindVariable("joystick_strafe_invert",&joystick_strafe_invert); + M_BindIntVariable("use_joystick", &usejoystick); + M_BindIntVariable("joystick_index", &joystick_index); + M_BindIntVariable("joystick_x_axis", &joystick_x_axis); + M_BindIntVariable("joystick_y_axis", &joystick_y_axis); + M_BindIntVariable("joystick_strafe_axis", &joystick_strafe_axis); + M_BindIntVariable("joystick_x_invert", &joystick_x_invert); + M_BindIntVariable("joystick_y_invert", &joystick_y_invert); + M_BindIntVariable("joystick_strafe_invert", &joystick_strafe_invert); for (i = 0; i < NUM_VIRTUAL_BUTTONS; ++i) { char name[32]; M_snprintf(name, sizeof(name), "joystick_physical_button%i", i); - M_BindVariable(name, &joystick_physical_buttons[i]); + M_BindIntVariable(name, &joystick_physical_buttons[i]); } } diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c index 2964606b..0d672436 100644 --- a/src/setup/keyboard.c +++ b/src/setup/keyboard.c @@ -408,5 +408,5 @@ void ConfigKeyboard(void) void BindKeyboardVariables(void) { - M_BindVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping); + M_BindIntVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping); } diff --git a/src/setup/mode.c b/src/setup/mode.c index d0e1f201..ed637849 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -115,14 +115,14 @@ static void BindMiscVariables(void) { if (gamemission == doom) { - M_BindVariable("detaillevel", &detailLevel); - M_BindVariable("show_messages", &showMessages); + M_BindIntVariable("detaillevel", &detailLevel); + M_BindIntVariable("show_messages", &showMessages); } if (gamemission == hexen) { - M_BindVariable("savedir", &savedir); - M_BindVariable("messageson", &showMessages); + M_BindStringVariable("savedir", &savedir); + M_BindIntVariable("messageson", &showMessages); // Hexen has a variable to control the savegame directory // that is used. @@ -140,14 +140,15 @@ static void BindMiscVariables(void) if (gamemission == strife) { - M_BindVariable("back_flat", &back_flat); - M_BindVariable("screensize" , &screenblocks); - M_BindVariable("comport", &comport); - M_BindVariable("nickname", &nickname); + M_BindStringVariable("back_flat", &back_flat); + M_BindStringVariable("nickname", &nickname); + + M_BindIntVariable("screensize", &screenblocks); + M_BindIntVariable("comport", &comport); } else { - M_BindVariable("screenblocks", &screenblocks); + M_BindIntVariable("screenblocks", &screenblocks); } } diff --git a/src/setup/mouse.c b/src/setup/mouse.c index 1d7ed68e..9fdfc833 100644 --- a/src/setup/mouse.c +++ b/src/setup/mouse.c @@ -153,10 +153,10 @@ void ConfigMouse(void) void BindMouseVariables(void) { - M_BindVariable("use_mouse", &usemouse); - M_BindVariable("novert", &novert); - M_BindVariable("mouse_sensitivity", &mouseSensitivity); - M_BindVariable("mouse_acceleration", &mouse_acceleration); - M_BindVariable("mouse_threshold", &mouse_threshold); - M_BindVariable("grabmouse", &grabmouse); + M_BindIntVariable("use_mouse", &usemouse); + M_BindIntVariable("novert", &novert); + M_BindIntVariable("grabmouse", &grabmouse); + M_BindIntVariable("mouse_sensitivity", &mouseSensitivity); + M_BindIntVariable("mouse_threshold", &mouse_threshold); + M_BindFloatVariable("mouse_acceleration", &mouse_acceleration); } diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c index 8e123b03..6b294077 100644 --- a/src/setup/multiplayer.c +++ b/src/setup/multiplayer.c @@ -1127,13 +1127,13 @@ void BindMultiplayerVariables(void) int i; #ifdef FEATURE_MULTIPLAYER - M_BindVariable("player_name", &net_player_name); + M_BindStringVariable("player_name", &net_player_name); #endif for (i=0; i<10; ++i) { M_snprintf(buf, sizeof(buf), "chatmacro%i", i); - M_BindVariable(buf, &chat_macros[i]); + M_BindStringVariable(buf, &chat_macros[i]); } switch (gamemission) diff --git a/src/setup/sound.c b/src/setup/sound.c index 2b9bfcbb..e7670feb 100644 --- a/src/setup/sound.c +++ b/src/setup/sound.c @@ -81,7 +81,7 @@ static float libsamplerate_scale = 0.65; static char *timidity_cfg_path = NULL; static char *gus_patch_path = NULL; -static unsigned int gus_ram_kb = 1024; +static int gus_ram_kb = 1024; // DOS specific variables: these are unused but should be maintained // so that the config file can be shared between chocolate @@ -297,32 +297,34 @@ 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("libsamplerate_scale", &libsamplerate_scale); - M_BindVariable("timidity_cfg_path", &timidity_cfg_path); - M_BindVariable("gus_patch_path", &gus_patch_path); - M_BindVariable("gus_ram_kb", &gus_ram_kb); - - M_BindVariable("snd_sbport", &snd_sbport); - M_BindVariable("snd_sbirq", &snd_sbirq); - M_BindVariable("snd_sbdma", &snd_sbdma); - M_BindVariable("snd_mport", &snd_mport); - M_BindVariable("snd_maxslicetime_ms", &snd_maxslicetime_ms); - M_BindVariable("snd_musiccmd", &snd_musiccmd); - - M_BindVariable("snd_cachesize", &snd_cachesize); - M_BindVariable("opl_io_port", &opl_io_port); + M_BindIntVariable("snd_sfxdevice", &snd_sfxdevice); + M_BindIntVariable("snd_musicdevice", &snd_musicdevice); + M_BindIntVariable("snd_channels", &numChannels); + M_BindIntVariable("snd_samplerate", &snd_samplerate); + M_BindIntVariable("sfx_volume", &sfxVolume); + M_BindIntVariable("music_volume", &musicVolume); + + M_BindIntVariable("use_libsamplerate", &use_libsamplerate); + M_BindFloatVariable("libsamplerate_scale", &libsamplerate_scale); + + M_BindIntVariable("gus_ram_kb", &gus_ram_kb); + M_BindStringVariable("gus_patch_path", &gus_patch_path); + M_BindStringVariable("timidity_cfg_path", &timidity_cfg_path); + + M_BindIntVariable("snd_sbport", &snd_sbport); + M_BindIntVariable("snd_sbirq", &snd_sbirq); + M_BindIntVariable("snd_sbdma", &snd_sbdma); + M_BindIntVariable("snd_mport", &snd_mport); + M_BindIntVariable("snd_maxslicetime_ms", &snd_maxslicetime_ms); + M_BindStringVariable("snd_musiccmd", &snd_musiccmd); + + M_BindIntVariable("snd_cachesize", &snd_cachesize); + M_BindIntVariable("opl_io_port", &opl_io_port); if (gamemission == strife) { - M_BindVariable("voice_volume", &voiceVolume); - M_BindVariable("show_talk", &show_talk); + M_BindIntVariable("voice_volume", &voiceVolume); + M_BindIntVariable("show_talk", &show_talk); } timidity_cfg_path = M_StringDuplicate(""); diff --git a/src/strife/d_main.c b/src/strife/d_main.c index 5cc8be5e..35d2c908 100644 --- a/src/strife/d_main.c +++ b/src/strife/d_main.c @@ -431,21 +431,22 @@ void D_BindVariables(void) // * screenblocks -> screensize // * Added nickname, comport - M_BindVariable("mouse_sensitivity", &mouseSensitivity); - M_BindVariable("sfx_volume", &sfxVolume); - M_BindVariable("music_volume", &musicVolume); - M_BindVariable("voice_volume", &voiceVolume); - M_BindVariable("show_talk", &dialogshowtext); - M_BindVariable("screensize", &screenblocks); - M_BindVariable("snd_channels", &snd_channels); - M_BindVariable("vanilla_savegame_limit", &vanilla_savegame_limit); - M_BindVariable("vanilla_demo_limit", &vanilla_demo_limit); - M_BindVariable("show_endoom", &show_endoom); - M_BindVariable("back_flat", &back_flat); - M_BindVariable("graphical_startup", &graphical_startup); - - M_BindVariable("nickname", &nickname); - M_BindVariable("comport", &comport); + M_BindIntVariable("mouse_sensitivity", &mouseSensitivity); + M_BindIntVariable("sfx_volume", &sfxVolume); + M_BindIntVariable("music_volume", &musicVolume); + M_BindIntVariable("voice_volume", &voiceVolume); + M_BindIntVariable("show_talk", &dialogshowtext); + M_BindIntVariable("screensize", &screenblocks); + M_BindIntVariable("snd_channels", &snd_channels); + M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit); + M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit); + M_BindIntVariable("show_endoom", &show_endoom); + M_BindIntVariable("graphical_startup", &graphical_startup); + + M_BindStringVariable("back_flat", &back_flat); + M_BindStringVariable("nickname", &nickname); + + M_BindIntVariable("comport", &comport); // Multiplayer chat macros @@ -454,7 +455,7 @@ void D_BindVariables(void) char buf[12]; M_snprintf(buf, sizeof(buf), "chatmacro%i", i); - M_BindVariable(buf, &chat_macros[i]); + M_BindStringVariable(buf, &chat_macros[i]); } } |