summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Greffrath2015-03-26 16:31:57 +0100
committerFabian Greffrath2015-03-26 16:31:57 +0100
commit27b5915111ffbdae97ce0c415157e104ee6f3493 (patch)
tree850fc62208b642b07047e0a9ea968c365d4dfd1f
parent350ac122030d198b187255b19b2519ef8267364a (diff)
parentad027ef6dbfeebabe0e6701eec968e9d474e497f (diff)
downloadchocolate-doom-27b5915111ffbdae97ce0c415157e104ee6f3493.tar.gz
chocolate-doom-27b5915111ffbdae97ce0c415157e104ee6f3493.tar.bz2
chocolate-doom-27b5915111ffbdae97ce0c415157e104ee6f3493.zip
Merge branch 'master' of https://github.com/chocolate-doom/chocolate-doom into hexndemo
-rw-r--r--HACKING13
-rwxr-xr-xman/docgen2
-rw-r--r--src/d_iwad.c2
-rw-r--r--src/doom/d_main.c22
-rw-r--r--src/doom/d_player.h2
-rw-r--r--src/doom/p_floor.c6
-rw-r--r--src/doom/p_inter.c15
-rw-r--r--src/doom/p_map.c2
-rw-r--r--src/doom/p_maputl.c2
-rw-r--r--src/doom/st_stuff.c11
-rw-r--r--src/gusconf.c2
-rw-r--r--src/gusconf.h2
-rw-r--r--src/heretic/d_main.c16
-rw-r--r--src/heretic/p_map.c2
-rw-r--r--src/heretic/p_maputl.c2
-rw-r--r--src/hexen/h2_main.c19
-rw-r--r--src/hexen/p_map.c2
-rw-r--r--src/hexen/p_maputl.c2
-rw-r--r--src/hexen/p_spec.c2
-rw-r--r--src/i_joystick.c18
-rw-r--r--src/i_sdlmusic.c5
-rw-r--r--src/i_sound.c34
-rw-r--r--src/i_video.c34
-rw-r--r--src/m_config.c64
-rw-r--r--src/m_config.h6
-rw-r--r--src/m_controls.c250
-rw-r--r--src/net_client.c6
-rw-r--r--src/net_server.c3
-rw-r--r--src/net_structrw.c2
-rw-r--r--src/setup/compatibility.c4
-rw-r--r--src/setup/display.c26
-rw-r--r--src/setup/joystick.c18
-rw-r--r--src/setup/keyboard.c2
-rw-r--r--src/setup/mode.c19
-rw-r--r--src/setup/mouse.c12
-rw-r--r--src/setup/multiplayer.c4
-rw-r--r--src/setup/sound.c50
-rw-r--r--src/setup/txt_joyaxis.c4
-rw-r--r--src/strife/d_main.c33
-rw-r--r--src/strife/p_enemy.c4
-rw-r--r--src/strife/p_inter.c10
-rw-r--r--src/strife/p_map.c2
-rw-r--r--src/strife/p_maputl.c2
-rw-r--r--src/strife/s_sound.c7
-rw-r--r--textscreen/txt_io.c4
45 files changed, 408 insertions, 341 deletions
diff --git a/HACKING b/HACKING
index 3bbe23d0..db20f963 100644
--- a/HACKING
+++ b/HACKING
@@ -64,11 +64,15 @@ typedef struct
void FunctionName(int argument, int arg2, int arg3, int arg4, int arg5,
int arg6, int arg7)
{
- if (condition)
+ int assign_var;
+
+ assign_var = arg2 + arg3 * arg4 * (arg5 + arg6);
+
+ if (foo && !bar || baz && qux || !(foo && bar && baz))
{
body;
}
- else if (condition)
+ else if (xyz + 4 < abc * 4 + 3)
{
body;
}
@@ -97,9 +101,10 @@ void FunctionName(int argument, int arg2, int arg3, int arg4, int arg5,
break;
}
- for (a=0; a<10; ++a)
+ for (a = 0; a < 10; ++a)
{
- loop_body;
+ FunctionCall(arg1, arg2, arg3, arg4,
+ arg_split_onto_second_line);
}
while (a < 10)
diff --git a/man/docgen b/man/docgen
index d9535be8..3b11ad8c 100755
--- a/man/docgen
+++ b/man/docgen
@@ -425,6 +425,8 @@ def manpage_output(targets, template_file):
for t in targets:
content += t.manpage_output() + "\n"
+ content = content.replace("-", "\\-")
+
print_template(template_file, content)
def wiki_output(targets, template):
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/doom/d_player.h b/src/doom/d_player.h
index a72c2f5f..04e47109 100644
--- a/src/doom/d_player.h
+++ b/src/doom/d_player.h
@@ -111,7 +111,7 @@ typedef struct player_s
// Is wp_nochange if not changing.
weapontype_t pendingweapon;
- boolean weaponowned[NUMWEAPONS];
+ int weaponowned[NUMWEAPONS];
int ammo[NUMAMMO];
int maxammo[NUMAMMO];
diff --git a/src/doom/p_floor.c b/src/doom/p_floor.c
index 1384ee6b..c120d616 100644
--- a/src/doom/p_floor.c
+++ b/src/doom/p_floor.c
@@ -493,6 +493,9 @@ EV_BuildStairs
floor->speed = speed;
height = sec->floorheight + stairsize;
floor->floordestheight = height;
+ // Initialize
+ floor->type = lowerFloor;
+ floor->crush = true;
texture = sec->floorpic;
@@ -536,6 +539,9 @@ EV_BuildStairs
floor->sector = sec;
floor->speed = speed;
floor->floordestheight = height;
+ // Initialize
+ floor->type = lowerFloor;
+ floor->crush = true;
ok = 1;
break;
}
diff --git a/src/doom/p_inter.c b/src/doom/p_inter.c
index c9965799..633408fe 100644
--- a/src/doom/p_inter.c
+++ b/src/doom/p_inter.c
@@ -603,8 +603,9 @@ P_TouchSpecialThing
break;
case SPR_MGUN:
- if (!P_GiveWeapon (player, wp_chaingun, special->flags&MF_DROPPED) )
- return;
+ if (!P_GiveWeapon(player, wp_chaingun,
+ (special->flags & MF_DROPPED) != 0))
+ return;
player->message = DEH_String(GOTCHAINGUN);
sound = sfx_wpnup;
break;
@@ -631,15 +632,17 @@ P_TouchSpecialThing
break;
case SPR_SHOT:
- if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) )
- return;
+ if (!P_GiveWeapon(player, wp_shotgun,
+ (special->flags & MF_DROPPED) != 0))
+ return;
player->message = DEH_String(GOTSHOTGUN);
sound = sfx_wpnup;
break;
case SPR_SGN2:
- if (!P_GiveWeapon (player, wp_supershotgun, special->flags&MF_DROPPED ) )
- return;
+ if (!P_GiveWeapon(player, wp_supershotgun,
+ (special->flags & MF_DROPPED) != 0))
+ return;
player->message = DEH_String(GOTSHOTGUN2);
sound = sfx_wpnup;
break;
diff --git a/src/doom/p_map.c b/src/doom/p_map.c
index e371869a..9d3086fd 100644
--- a/src/doom/p_map.c
+++ b/src/doom/p_map.c
@@ -357,7 +357,7 @@ boolean PIT_CheckThing (mobj_t* thing)
// check for special pickup
if (thing->flags & MF_SPECIAL)
{
- solid = thing->flags&MF_SOLID;
+ solid = (thing->flags & MF_SOLID) != 0;
if (tmflags&MF_PICKUP)
{
// can remove thing
diff --git a/src/doom/p_maputl.c b/src/doom/p_maputl.c
index 916f2b64..098c2c73 100644
--- a/src/doom/p_maputl.c
+++ b/src/doom/p_maputl.c
@@ -887,7 +887,7 @@ P_PathTraverse
int count;
- earlyout = flags & PT_EARLYOUT;
+ earlyout = (flags & PT_EARLYOUT) != 0;
validcount++;
intercept_p = intercepts;
diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c
index 9a25865c..693b6ef2 100644
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -1261,11 +1261,12 @@ void ST_createWidgets(void)
// weapons owned
for(i=0;i<6;i++)
{
- STlib_initMultIcon(&w_arms[i],
- ST_ARMSX+(i%3)*ST_ARMSXSPACE,
- ST_ARMSY+(i/3)*ST_ARMSYSPACE,
- arms[i], (int *) &plyr->weaponowned[i+1],
- &st_armson);
+ STlib_initMultIcon(&w_arms[i],
+ ST_ARMSX+(i%3)*ST_ARMSXSPACE,
+ ST_ARMSY+(i/3)*ST_ARMSYSPACE,
+ arms[i],
+ &plyr->weaponowned[i+1],
+ &st_armson);
}
// frags sum
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/heretic/p_map.c b/src/heretic/p_map.c
index 48db07e5..6f1e64d7 100644
--- a/src/heretic/p_map.c
+++ b/src/heretic/p_map.c
@@ -428,7 +428,7 @@ boolean PIT_CheckThing(mobj_t * thing)
// Check for special thing
if (thing->flags & MF_SPECIAL)
{
- solid = thing->flags & MF_SOLID;
+ solid = (thing->flags & MF_SOLID) != 0;
if (tmflags & MF_PICKUP)
{ // Can be picked up by tmthing
P_TouchSpecialThing(thing, tmthing); // Can remove thing
diff --git a/src/heretic/p_maputl.c b/src/heretic/p_maputl.c
index 577f527c..e2a71556 100644
--- a/src/heretic/p_maputl.c
+++ b/src/heretic/p_maputl.c
@@ -667,7 +667,7 @@ boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
int mapx, mapy, mapxstep, mapystep;
int count;
- earlyout = flags & PT_EARLYOUT;
+ earlyout = (flags & PT_EARLYOUT) != 0;
validcount++;
intercept_p = intercepts;
diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 62cd3d38..c907d29c 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -150,14 +150,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
@@ -166,7 +167,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/hexen/p_map.c b/src/hexen/p_map.c
index 11aa23e0..b1c542ca 100644
--- a/src/hexen/p_map.c
+++ b/src/hexen/p_map.c
@@ -661,7 +661,7 @@ boolean PIT_CheckThing(mobj_t * thing)
// Check for special thing
if (thing->flags & MF_SPECIAL)
{
- solid = thing->flags & MF_SOLID;
+ solid = (thing->flags & MF_SOLID) != 0;
if (tmflags & MF_PICKUP)
{ // Can be picked up by tmthing
P_TouchSpecialThing(thing, tmthing); // Can remove thing
diff --git a/src/hexen/p_maputl.c b/src/hexen/p_maputl.c
index a48ea8fa..dcc7d5d2 100644
--- a/src/hexen/p_maputl.c
+++ b/src/hexen/p_maputl.c
@@ -699,7 +699,7 @@ boolean P_PathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
int mapx, mapy, mapxstep, mapystep;
int count;
- earlyout = flags & PT_EARLYOUT;
+ earlyout = (flags & PT_EARLYOUT) != 0;
validcount++;
intercept_p = intercepts;
diff --git a/src/hexen/p_spec.c b/src/hexen/p_spec.c
index e2069fb9..d36d3e86 100644
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -864,7 +864,7 @@ boolean P_ActivateLine(line_t * line, mobj_t * mo, int side,
if (line->flags & ML_SECRET)
return false; // never open secret doors
}
- repeat = line->flags & ML_REPEAT_SPECIAL;
+ repeat = (line->flags & ML_REPEAT_SPECIAL) != 0;
buttonSuccess = false;
// Construct args[] array to contain the arguments from the line, as we
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_sdlmusic.c b/src/i_sdlmusic.c
index e70b2c05..63a3467a 100644
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -422,7 +422,7 @@ static char *GetSubstituteMusicFile(void *data, size_t data_len)
sha1_context_t context;
sha1_digest_t hash;
char *filename;
- int i;
+ unsigned int i;
// Don't bother doing a hash if we're never going to find anything.
if (subst_music_len == 0)
@@ -734,7 +734,8 @@ static void DumpSubstituteConfig(char *filename)
char name[9];
byte *data;
FILE *fs;
- int lumpnum, h;
+ unsigned int lumpnum;
+ size_t h;
fs = fopen(filename, "w");
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..ac81e367 100644
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -279,8 +279,8 @@ static void NET_CL_AdvanceWindow(void)
// Advance the window
- memcpy(recvwindow, recvwindow + 1,
- sizeof(net_server_recv_t) * (BACKUPTICS - 1));
+ memmove(recvwindow, recvwindow + 1,
+ sizeof(net_server_recv_t) * (BACKUPTICS - 1));
memset(&recvwindow[BACKUPTICS-1], 0, sizeof(net_server_recv_t));
++recvwindow_start;
@@ -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/net_server.c b/src/net_server.c
index b4496bb5..b3ec1693 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -514,7 +514,8 @@ static void NET_SV_AdvanceWindow(void)
// Advance the window
- memcpy(recvwindow, recvwindow + 1, sizeof(*recvwindow) * (BACKUPTICS - 1));
+ memmove(recvwindow, recvwindow + 1,
+ sizeof(*recvwindow) * (BACKUPTICS - 1));
memset(&recvwindow[BACKUPTICS-1], 0, sizeof(*recvwindow));
++recvwindow_start;
diff --git a/src/net_structrw.c b/src/net_structrw.c
index 60316dc7..a820df5f 100644
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -316,7 +316,7 @@ void NET_TiccmdDiff(ticcmd_t *tic1, ticcmd_t *tic2, net_ticdiff_t *diff)
void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest)
{
- memcpy(dest, src, sizeof(ticcmd_t));
+ memmove(dest, src, sizeof(ticcmd_t));
// Apply the diff
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/setup/txt_joyaxis.c b/src/setup/txt_joyaxis.c
index 4747a4ff..5e59b9f7 100644
--- a/src/setup/txt_joyaxis.c
+++ b/src/setup/txt_joyaxis.c
@@ -63,6 +63,8 @@ static char *CalibrationLabel(txt_joystick_axis_t *joystick_axis)
"right, and press the button.";
}
}
+
+ return NULL;
}
static void SetCalibrationLabel(txt_joystick_axis_t *joystick_axis)
@@ -265,6 +267,8 @@ static int NextCalibrateStage(txt_joystick_axis_t *joystick_axis)
case CONFIG_STAGE2:
return CONFIG_CENTER;
}
+
+ return -1;
}
static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_axis))
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]);
}
}
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index 8aad08fc..e358e616 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -891,7 +891,7 @@ void A_Look (mobj_t* actor)
// as a parameter to control allaround look behavior. Did they just run out of
// flags, or what?
// STRIFE-TODO: Needs serious verification.
- if (!P_LookForPlayers (actor, actor->flags & MF_GIVEQUEST) )
+ if (!P_LookForPlayers(actor, (actor->flags & MF_GIVEQUEST) != 0))
return;
// go into chase state
@@ -975,7 +975,7 @@ void A_FriendLook(mobj_t* actor)
gamemap != 3 && gamemap != 34)
{
// STRIFE-TODO: Needs serious verification.
- if(P_LookForPlayers(actor, actor->flags & MF_GIVEQUEST))
+ if(P_LookForPlayers(actor, (actor->flags & MF_GIVEQUEST) != 0))
{
P_SetMobjState(actor, actor->info->seestate);
actor->flags |= MF_NODIALOG;
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c
index 71db6fe1..f2e16efb 100644
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -537,7 +537,7 @@ void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher)
// rifle
case SPR_RIFL:
- if(!P_GiveWeapon(player, wp_rifle, special->flags & MF_DROPPED))
+ if(!P_GiveWeapon(player, wp_rifle, (special->flags & MF_DROPPED) != 0))
return;
sound = sfx_wpnup; // haleyjd: SHK-CHK!
break;
@@ -560,7 +560,8 @@ void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher)
// grenade launcher
case SPR_GRND:
- if(!P_GiveWeapon(player, wp_hegrenade, special->flags & MF_DROPPED))
+ if(!P_GiveWeapon(player, wp_hegrenade,
+ (special->flags & MF_DROPPED) != 0))
return;
sound = sfx_wpnup; // haleyjd: SHK-CHK!
break;
@@ -574,14 +575,15 @@ void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher)
// electric bolt crossbow
case SPR_CBOW:
- if(!P_GiveWeapon(player, wp_elecbow, special->flags & MF_DROPPED))
+ if(!P_GiveWeapon(player, wp_elecbow,
+ (special->flags & MF_DROPPED) != 0))
return;
sound = sfx_wpnup; // haleyjd: SHK-CHK!
break;
// haleyjd 09/21/10: missed case: THE SIGIL!
case SPR_SIGL:
- if(!P_GiveWeapon(player, wp_sigil, special->flags & MF_DROPPED))
+ if(!P_GiveWeapon(player, wp_sigil, (special->flags & MF_DROPPED) != 0))
{
player->sigiltype = special->frame;
return;
diff --git a/src/strife/p_map.c b/src/strife/p_map.c
index 13a1bb54..03b57edd 100644
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -384,7 +384,7 @@ boolean PIT_CheckThing (mobj_t* thing)
// check for special pickup
if (thing->flags & MF_SPECIAL)
{
- solid = thing->flags&MF_SOLID;
+ solid = (thing->flags & MF_SOLID) != 0;
if (tmthing->player) // villsa [STRIFE] no longer checks MF_PICKUP flag
{
// can remove thing
diff --git a/src/strife/p_maputl.c b/src/strife/p_maputl.c
index 4ecb5566..f1773858 100644
--- a/src/strife/p_maputl.c
+++ b/src/strife/p_maputl.c
@@ -941,7 +941,7 @@ P_PathTraverse
int count;
- earlyout = flags & PT_EARLYOUT;
+ earlyout = (flags & PT_EARLYOUT) != 0;
validcount++;
intercept_p = intercepts;
diff --git a/src/strife/s_sound.c b/src/strife/s_sound.c
index 7a919737..d22f84e4 100644
--- a/src/strife/s_sound.c
+++ b/src/strife/s_sound.c
@@ -277,7 +277,7 @@ static int S_GetChannel(mobj_t *origin, sfxinfo_t *sfxinfo, boolean isvoice)
channel_t* c;
// Find an open channel
- for (cnum=0 ; cnum<snd_channels ; cnum++)
+ for (cnum=0 ; cnum<snd_channels ; cnum++)
{
if (!channels[cnum].sfxinfo)
{
@@ -286,6 +286,11 @@ static int S_GetChannel(mobj_t *origin, sfxinfo_t *sfxinfo, boolean isvoice)
else if (origin && channels[cnum].origin == origin &&
(isvoice || cnum != i_voicehandle)) // haleyjd
{
+ // haleyjd 20150220: [STRIFE] missing sound channel priority check
+ // Is a higher priority sound by same origin already playing?
+ if(!isvoice && sfxinfo->priority > channels[cnum].sfxinfo->priority)
+ return -1;
+
S_StopChannel(cnum);
break;
}
diff --git a/textscreen/txt_io.c b/textscreen/txt_io.c
index ed25503c..0c5e274f 100644
--- a/textscreen/txt_io.c
+++ b/textscreen/txt_io.c
@@ -39,8 +39,8 @@ static void NewLine(unsigned char *screendata)
cur_y = TXT_SCREEN_H - 1;
- memcpy(screendata, screendata + TXT_SCREEN_W * 2,
- TXT_SCREEN_W * 2 * (TXT_SCREEN_H -1));
+ memmove(screendata, screendata + TXT_SCREEN_W * 2,
+ TXT_SCREEN_W * 2 * (TXT_SCREEN_H -1));
// Clear the bottom line