shithub: choc

Download patch

ref: 27b5915111ffbdae97ce0c415157e104ee6f3493
parent: 350ac122030d198b187255b19b2519ef8267364a
parent: ad027ef6dbfeebabe0e6701eec968e9d474e497f
author: Fabian Greffrath <fabian@greffrath.com>
date: Thu Mar 26 12:31:57 EDT 2015

Merge branch 'master' of https://github.com/chocolate-doom/chocolate-doom into hexndemo

--- a/HACKING
+++ b/HACKING
@@ -64,11 +64,15 @@
 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 @@
             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)
--- a/man/docgen
+++ b/man/docgen
@@ -425,6 +425,8 @@
     for t in targets:
         content += t.manpage_output() + "\n"
 
+    content = content.replace("-", "\\-")
+
     print_template(template_file, content)
 
 def wiki_output(targets, template):
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -332,7 +332,7 @@
     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;
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -359,16 +359,16 @@
     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 @@
         char buf[12];
 
         M_snprintf(buf, sizeof(buf), "chatmacro%i", i);
-        M_BindVariable(buf, &chat_macros[i]);
+        M_BindStringVariable(buf, &chat_macros[i]);
     }
 }
 
--- a/src/doom/d_player.h
+++ b/src/doom/d_player.h
@@ -111,7 +111,7 @@
     // Is wp_nochange if not changing.
     weapontype_t	pendingweapon;
 
-    boolean		weaponowned[NUMWEAPONS];
+    int                 weaponowned[NUMWEAPONS];
     int			ammo[NUMAMMO];
     int			maxammo[NUMAMMO];
 
--- a/src/doom/p_floor.c
+++ b/src/doom/p_floor.c
@@ -493,6 +493,9 @@
 	floor->speed = speed;
 	height = sec->floorheight + stairsize;
 	floor->floordestheight = height;
+	// Initialize
+	floor->type = lowerFloor;
+	floor->crush = true;
 		
 	texture = sec->floorpic;
 	
@@ -536,6 +539,9 @@
 		floor->sector = sec;
 		floor->speed = speed;
 		floor->floordestheight = height;
+		// Initialize
+		floor->type = lowerFloor;
+		floor->crush = true;
 		ok = 1;
 		break;
 	    }
--- a/src/doom/p_inter.c
+++ b/src/doom/p_inter.c
@@ -603,8 +603,9 @@
 	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 @@
 	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;
--- a/src/doom/p_map.c
+++ b/src/doom/p_map.c
@@ -357,7 +357,7 @@
     // 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
--- a/src/doom/p_maputl.c
+++ b/src/doom/p_maputl.c
@@ -887,7 +887,7 @@
 
     int		count;
 		
-    earlyout = flags & PT_EARLYOUT;
+    earlyout = (flags & PT_EARLYOUT) != 0;
 		
     validcount++;
     intercept_p = intercepts;
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -1261,11 +1261,12 @@
     // 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
--- a/src/gusconf.c
+++ b/src/gusconf.c
@@ -39,7 +39,7 @@
 } gus_config_t;
 
 char *gus_patch_path = "";
-unsigned int gus_ram_kb = 1024;
+int gus_ram_kb = 1024;
 
 static unsigned int MappingIndex(void)
 {
--- 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);
 
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -756,13 +756,13 @@
     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)
     {
@@ -769,7 +769,7 @@
         char buf[12];
 
         M_snprintf(buf, sizeof(buf), "chatmacro%i", i);
-        M_BindVariable(buf, &chat_macros[i]);
+        M_BindStringVariable(buf, &chat_macros[i]);
     }
 }
 
--- a/src/heretic/p_map.c
+++ b/src/heretic/p_map.c
@@ -428,7 +428,7 @@
     // 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
--- a/src/heretic/p_maputl.c
+++ b/src/heretic/p_maputl.c
@@ -667,7 +667,7 @@
     int mapx, mapy, mapxstep, mapystep;
     int count;
 
-    earlyout = flags & PT_EARLYOUT;
+    earlyout = (flags & PT_EARLYOUT) != 0;
 
     validcount++;
     intercept_p = intercepts;
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -150,15 +150,16 @@
     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
 
     for (i=0; i<10; ++i)
@@ -166,7 +167,7 @@
         char buf[12];
 
         M_snprintf(buf, sizeof(buf), "chatmacro%i", i);
-        M_BindVariable(buf, &chat_macros[i]);
+        M_BindStringVariable(buf, &chat_macros[i]);
     }
 }
 
--- a/src/hexen/p_map.c
+++ b/src/hexen/p_map.c
@@ -661,7 +661,7 @@
     // 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
--- a/src/hexen/p_maputl.c
+++ b/src/hexen/p_maputl.c
@@ -699,7 +699,7 @@
     int mapx, mapy, mapxstep, mapystep;
     int count;
 
-    earlyout = flags & PT_EARLYOUT;
+    earlyout = (flags & PT_EARLYOUT) != 0;
 
     validcount++;
     intercept_p = intercepts;
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -864,7 +864,7 @@
         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
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -328,20 +328,20 @@
 {
     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]);
     }
 }
 
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -422,7 +422,7 @@
     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 @@
     char name[9];
     byte *data;
     FILE *fs;
-    int lumpnum, h;
+    unsigned int lumpnum;
+    size_t h;
 
     fs = fopen(filename, "w");
 
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -434,25 +434,25 @@
     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_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_BindVariable("timidity_cfg_path", &timidity_cfg_path);
-    M_BindVariable("gus_patch_path",    &gus_patch_path);
-    M_BindVariable("gus_ram_kb",        &gus_ram_kb);
+    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
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -2161,23 +2161,23 @@
 
 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
--- 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 @@
     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 @@
 } 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 @@
                 // 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 @@
                 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 @@
     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 @@
             }
 
             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,16 +1962,41 @@
 // 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;
+}
+
 // Set the value of a particular variable; an API function for other
 // parts of the program to assign values to config variables by name.
 
@@ -2000,10 +2030,10 @@
         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 @@
         return NULL;
     }
 
-    return *((const char **) variable->location);
+    return *variable->location.s;
 }
 
 float M_GetFloatVariable(char *name)
@@ -2030,7 +2060,7 @@
         return 0;
     }
 
-    return *((float *) variable->location);
+    return *variable->location.f;
 }
 
 // Get the path to the default configuration dir to use, if NULL
--- a/src/m_config.h
+++ b/src/m_config.h
@@ -26,10 +26,12 @@
 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);
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -204,70 +204,70 @@
 
 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_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_BindVariable("mouseb_fire",        &mousebfire);
-    M_BindVariable("mouseb_strafe",      &mousebstrafe);
-    M_BindVariable("mouseb_forward",     &mousebforward);
+    M_BindIntVariable("mouseb_fire",        &mousebfire);
+    M_BindIntVariable("mouseb_strafe",      &mousebstrafe);
+    M_BindIntVariable("mouseb_forward",     &mousebforward);
 
-    M_BindVariable("joyb_fire",          &joybfire);
-    M_BindVariable("joyb_strafe",        &joybstrafe);
-    M_BindVariable("joyb_use",           &joybuse);
-    M_BindVariable("joyb_speed",         &joybspeed);
+    M_BindIntVariable("joyb_fire",          &joybfire);
+    M_BindIntVariable("joyb_strafe",        &joybstrafe);
+    M_BindIntVariable("joyb_use",           &joybuse);
+    M_BindIntVariable("joyb_speed",         &joybspeed);
 
-    M_BindVariable("joyb_menu_activate", &joybmenu);
+    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_BindIntVariable("key_jump",           &key_jump);
+    M_BindIntVariable("mouseb_jump",        &mousebjump);
+    M_BindIntVariable("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_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 @@
     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_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_BindVariable("key_prevweapon",     &key_prevweapon);
-    M_BindVariable("key_nextweapon",     &key_nextweapon);
+    M_BindIntVariable("key_prevweapon",     &key_prevweapon);
+    M_BindIntVariable("key_nextweapon",     &key_nextweapon);
 
-    M_BindVariable("joyb_prevweapon",    &joybprevweapon);
-    M_BindVariable("joyb_nextweapon",    &joybnextweapon);
+    M_BindIntVariable("joyb_prevweapon",    &joybprevweapon);
+    M_BindIntVariable("joyb_nextweapon",    &joybnextweapon);
 
-    M_BindVariable("mouseb_prevweapon",  &mousebprevweapon);
-    M_BindVariable("mouseb_nextweapon",  &mousebnextweapon);
+    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_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_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_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_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_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 @@
     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]);
     }
 }
 
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -279,8 +279,8 @@
 
         // 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_BindVariables(void)
 {
-    M_BindVariable("player_name", &net_player_name);
+    M_BindStringVariable("player_name", &net_player_name);
 }
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -514,7 +514,8 @@
         
         // 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;
 
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -316,7 +316,7 @@
 
 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
 
--- a/src/setup/compatibility.c
+++ b/src/setup/compatibility.c
@@ -43,8 +43,8 @@
 {
     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);
     }
 }
 
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -700,28 +700,28 @@
 
 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
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -757,20 +757,20 @@
 {
     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]);
     }
 }
 
--- a/src/setup/keyboard.c
+++ b/src/setup/keyboard.c
@@ -408,5 +408,5 @@
 
 void BindKeyboardVariables(void)
 {
-    M_BindVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping);
+    M_BindIntVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping);
 }
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -115,14 +115,14 @@
 {
     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 @@
 
     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);
     }
 
 }
--- a/src/setup/mouse.c
+++ b/src/setup/mouse.c
@@ -153,10 +153,10 @@
 
 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);
 }
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -1127,13 +1127,13 @@
     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)
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -81,7 +81,7 @@
 
 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 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_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_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_BindIntVariable("use_libsamplerate",        &use_libsamplerate);
+    M_BindFloatVariable("libsamplerate_scale",    &libsamplerate_scale);
 
-    M_BindVariable("snd_cachesize",       &snd_cachesize);
-    M_BindVariable("opl_io_port",         &opl_io_port);
+    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("");
--- a/src/setup/txt_joyaxis.c
+++ b/src/setup/txt_joyaxis.c
@@ -63,6 +63,8 @@
                        "right, and press the button.";
             }
     }
+
+    return NULL;
 }
 
 static void SetCalibrationLabel(txt_joystick_axis_t *joystick_axis)
@@ -265,6 +267,8 @@
         case CONFIG_STAGE2:
             return CONFIG_CENTER;
     }
+
+    return -1;
 }
 
 static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_axis))
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -431,22 +431,23 @@
     // * 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_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_BindVariable("nickname",               &nickname);
-    M_BindVariable("comport",                &comport);
+    M_BindStringVariable("back_flat",           &back_flat);
+    M_BindStringVariable("nickname",            &nickname);
 
+    M_BindIntVariable("comport",                &comport);
+
     // Multiplayer chat macros
 
     for (i=0; i<10; ++i)
@@ -454,7 +455,7 @@
         char buf[12];
 
         M_snprintf(buf, sizeof(buf), "chatmacro%i", i);
-        M_BindVariable(buf, &chat_macros[i]);
+        M_BindStringVariable(buf, &chat_macros[i]);
     }
 }
 
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -891,7 +891,7 @@
     // 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 @@
             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;
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -537,7 +537,7 @@
 
     // 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 @@
 
     // 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,7 +575,8 @@
 
     // 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;
@@ -581,7 +583,7 @@
 
     // 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;
--- a/src/strife/p_map.c
+++ b/src/strife/p_map.c
@@ -384,7 +384,7 @@
     // 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
--- a/src/strife/p_maputl.c
+++ b/src/strife/p_maputl.c
@@ -941,7 +941,7 @@
 
     int     count;
 
-    earlyout = flags & PT_EARLYOUT;
+    earlyout = (flags & PT_EARLYOUT) != 0;
 
     validcount++;
     intercept_p = intercepts;
--- a/src/strife/s_sound.c
+++ b/src/strife/s_sound.c
@@ -277,7 +277,7 @@
     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 @@
         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;
         }
--- a/textscreen/txt_io.c
+++ b/textscreen/txt_io.c
@@ -39,8 +39,8 @@
 
         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