diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index b8c8bcac8..3e0ce2ea9 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -273,17 +273,10 @@ void CONFIG_SetDefaults(void) #else gSetup.bpp = 8; #endif - -#ifdef GEKKO - gSetup.usejoystick = 1; -#else - gSetup.usejoystick = 0; -#endif - + gSetup.forcesetup = 1; gSetup.noautoload = 1; gSetup.fullscreen = 1; - gSetup.usemouse = 1; //snd_ambience = 1; //ud.config.AutoAim = 1; @@ -829,7 +822,7 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_PutNumber(scripthandle, "Updates", "LastUpdateCheck", LastUpdateCheck, FALSE, FALSE); #endif - if (gSetup.usemouse) + if (in_mouse) { for (int i=0; iname, "in_mouse")) - { - CONTROL_MouseEnabled = (gSetup.usemouse && CONTROL_MousePresent); - } - else if (!Bstrcasecmp(parm->name, "in_joystick")) - { - CONTROL_JoystickEnabled = (gSetup.usejoystick && CONTROL_JoyPresent); - } else if (!Bstrcasecmp(parm->name, "vid_gamma")) { gBrightness = GAMMA_CALC; diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index 9cea5bc3f..0b75b413e 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -3,6 +3,7 @@ #include "fx_man.h" #include "baselayer.h" #include "gameconfigfile.h" +#include "control.h" /* Notes @@ -219,6 +220,16 @@ CUSTOM_CVARD(Int, r_fov, 90, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "change the field o CVARD(Bool, r_horizcenter, false, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disable centered horizon line") // only present in Blood, maybe add to others? +CUSTOM_CVARD(Bool, in_joystick, false, CVAR_ARCHIVE|CVAR_NOINITCALL, "enables input from the joystick if it is present") +{ + CONTROL_JoystickEnabled = (self && CONTROL_JoyPresent); +} + +CUSTOM_CVARD(Bool, in_mouse, true, CVAR_ARCHIVE|CVAR_NOINITCALL, "enables input from the mouse if it is present") +{ + CONTROL_MouseEnabled = (self && CONTROL_MousePresent); +} + #if 0 @@ -226,9 +237,6 @@ CVARD(Bool, r_horizcenter, false, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disa static osdcvardata_t cvars_game[] = { - { "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_aimmode", "0:toggle, 1:hold to aim", (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 }, { "in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", @@ -280,10 +288,6 @@ CVARD(Bool, r_horizcenter, false, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disa static osdcvardata_t cvars_game[] = { - - { "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_aimmode", "0:toggle, 1:hold to aim", (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 }, { "in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", @@ -338,9 +342,6 @@ int32_t registerosdcommands(void) char buffer[256]; static osdcvardata_t cvars_game[] = { - { "in_joystick","enables input from the joystick if it is present",(void *)&gSetup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_mouse","enables input from the mouse if it is present",(void *)&gSetup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_aimmode", "0:toggle, 1:hold to aim", (void *)&gMouseAiming, CVAR_BOOL, 0, 1 }, { "in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time", diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 9f1de9fb3..98104d486 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -58,6 +58,9 @@ EXTERN_CVAR(Int, r_fov) EXTERN_CVAR(r_horizcenter) +EXTERN_CVAR(in_joystick) +EXTERN_CVAR(in_mouse) + extern int hud_statusbarrange; // will be set by the game's configuration setup. bool G_ChangeHudLayout(int direction); bool G_CheckAutorun(bool button); diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 22cff9a34..1cbb3c8e8 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -230,17 +230,12 @@ void CONFIG_SetDefaults(void) ud.camera_time = 4; #endif - // currently settings.cfg is only read after the startup window launches the game, - // and rereading binds might be fickle so just enable this - ud.setup.usejoystick = 1; - g_myAimMode = 1; g_player[0].ps->aim_mode = 1; ud.setup.forcesetup = 1; ud.setup.noautoload = 1; ud.setup.fullscreen = 1; - ud.setup.usemouse = 1; ud.althud = 1; ud.angleinterpolation = 0; @@ -971,7 +966,7 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE); #endif - if (ud.setup.usemouse) + if (in_mouse) { for (int i=0; iname, "in_mouse")) - { - CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent); - } - else if (!Bstrcasecmp(parm->name, "in_joystick")) - { - CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent); - } else if (!Bstrcasecmp(parm->name, "vid_gamma")) { ud.brightness = GAMMA_CALC; diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index d5b139417..594863ca7 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -253,16 +253,10 @@ void CONFIG_SetDefaults(void) ud.team = 0; cl_weaponswitch = 3; // new+empty ud.angleinterpolation = 0; -#ifdef GEKKO - ud.setup.usejoystick = 1; -#else - ud.setup.usejoystick = 0; -#endif ud.setup.forcesetup = 1; ud.setup.noautoload = 1; ud.setup.fullscreen = 1; - ud.setup.usemouse = 1; snd_speech = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM ud.display_bonus_screen = 1; @@ -801,7 +795,7 @@ void CONFIG_WriteSetup(uint32_t flags) SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE); #endif - if (ud.setup.usemouse) + if (in_mouse) { for (dummy=0; dummyname, "in_mouse")) - { - CONTROL_MouseEnabled = (ud.setup.usemouse && CONTROL_MousePresent); - } - else if (!Bstrcasecmp(parm->name, "in_joystick")) - { - CONTROL_JoystickEnabled = (ud.setup.usejoystick && CONTROL_JoyPresent); - } else if (!Bstrcasecmp(parm->name, "vid_gamma")) { ud.brightness = GAMMA_CALC;