diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index e8380d6e0..96cec98a9 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -346,9 +346,6 @@ void CONFIG_SetDefaults(void) memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions)); memset(JoystickFunctions, -1, sizeof(JoystickFunctions)); memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions)); - - CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; - for (int i=0; ifValue; + in_mousesensitivity = pItem->fValue; } void SetMouseAimFlipped(CGameMenuItemZBool *pItem) diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index ae9a464c4..b2cf6839d 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -790,13 +790,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm) videoSetPalette(gBrightness>>2,gLastPal,0); } #if 0 - else if (!Bstrcasecmp(parm->name, "skill")) - { - if (numplayers > 1) - return r; - - ud.player_skill = ud.m_player_skill; - } else if (!Bstrcasecmp(parm->name, "color")) { ud.color = G_CheckPlayerColor(ud.color); @@ -809,54 +802,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm) if (xdim && ydim) OSD_ResizeDisplay(xdim, ydim); } - else if (!Bstrcasecmp(parm->name, "wchoice")) - { - if (parm->numparms == 1) - { - if (g_forceWeaponChoice) // rewrite ud.wchoice because osdcmd_cvar_set already changed it - { - int j = 0; - - while (j < 10) - { - ud.wchoice[j] = g_player[myconnectindex].wchoice[j] + '0'; - j++; - } - - ud.wchoice[j] = 0; - } - else - { - char const *c = parm->parms[0]; - - if (*c) - { - int j = 0; - - while (*c && j < 10) - { - g_player[myconnectindex].wchoice[j] = *c - '0'; - c++; - j++; - } - - while (j < 10) - { - if (j == 9) - g_player[myconnectindex].wchoice[9] = 1; - else - g_player[myconnectindex].wchoice[j] = 2; - - j++; - } - } - } - - g_forceWeaponChoice = 0; - } - - /* Net_SendClientInfo();*/ - } #endif return r; diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index 900fff761..51fa5790d 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -4,6 +4,7 @@ #include "baselayer.h" #include "gameconfigfile.h" #include "control.h" +#include "_control.h" /* Notes @@ -257,6 +258,14 @@ CUSTOM_CVARD(Bool, in_mousesmoothing, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE, "en CONTROL_SmoothMouse = self; } +CUSTOM_CVARD(Float, in_mousesensitivity, DEFAULTMOUSESENSITIVITY, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "changes the mouse sensitivity") +{ + if (self < 0) self = 0; + else if (self > 25) self = 25; + else CONTROL_MouseSensitivity = self; +} + + CUSTOM_CVARD(Int, r_drawweapon, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disable weapon drawing") { if (self < 0 || self > 2) self = 1; @@ -323,19 +332,48 @@ int G_FPSLimit(void) return 0; } +CUSTOM_CVARD(String, wchoice, "3457860291", CVAR_ARCHIVE|CVAR_NOINITCALL|CVAR_FRONTEND_DUKELIKE, "sets weapon autoselection order") +{ + char dest[11]; + char const *c = self; + if (*c) + { + int j = 0; + + while (*c && j < 10) + { + dest[j] = *c - '0'; + c++; + j++; + } + + while (j < 10) + { + if (j == 9) + dest[9] = 1; + else + dest[j] = 2; + + j++; + } + // if (!gi->SetWeaponChoice(dest)) OSD_Printf("Weapon ordering not supported\n"); + } + else + { + OSD_Printf("Using default weapon orders.\n"); + self = "3457860291"; + } + + #if 0 // DN3D static osdcvardata_t cvars_game[] = { - { "sensitivity","changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 }, - { "skill","changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOSAVE/*|CVAR_NOMULTI*/, 0, 5 }, - { "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 }, - { "wchoice","sets weapon autoselection order", (void *)ud.wchoice, CVAR_STRING|CVAR_FUNCPTR, 0, MAX_WEAPONS }, }; // These I don't care about. @@ -369,5 +407,9 @@ int G_FPSLimit(void) // This option is not really useful anymore { "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 }, -*/ + // This requires a different approach, because it got used like a CCMD, not a CVAR. + { "skill","changes the game skill setting", (void *)&ud.m_player_skill, CVAR_INT|CVAR_FUNCPTR|CVAR_NOSAVE/*|CVAR_NOMULTI*/, 0, 5 }, + + // requires cleanup first + //{ "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 }, #endif diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 24e33c8cd..1ceb59e42 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -73,8 +73,10 @@ EXTERN_CVAR(Int, in_mousedeadzone) EXTERN_CVAR(Bool, in_mouseflip) EXTERN_CVAR(Bool, in_mousemode) EXTERN_CVAR(Bool, in_mousesmoothing) +EXTERN_CVAR(Float, in_mousesensitivity) extern int32_t g_MyAimMode; EXTERN_CVAR(Bool, in_mousemode) +EXTERN_CVAR(String, wchoice) extern float r_ambientlightrecip; extern int hud_statusbarrange; // will be set by the game's configuration setup. diff --git a/source/duke3d/src/cmdline.cpp b/source/duke3d/src/cmdline.cpp index 3817e2b92..991b04abe 100644 --- a/source/duke3d/src/cmdline.cpp +++ b/source/duke3d/src/cmdline.cpp @@ -37,7 +37,6 @@ int32_t g_noSound = 0; int32_t g_noMusic = 0; const char *CommandMap = NULL; const char *CommandName = NULL; -int32_t g_forceWeaponChoice = 0; int32_t g_fakeMultiMode = 0; void G_ShowParameterHelp(void) @@ -169,17 +168,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) ud.cashman = 0; ud.m_ffire = 1; ud.m_player_skill = ud.player_skill = 2; - g_player[0].wchoice[0] = 3; - g_player[0].wchoice[1] = 4; - g_player[0].wchoice[2] = 5; - g_player[0].wchoice[3] = 7; - g_player[0].wchoice[4] = 8; - g_player[0].wchoice[5] = 6; - g_player[0].wchoice[6] = 0; - g_player[0].wchoice[7] = 2; - g_player[0].wchoice[8] = 9; - g_player[0].wchoice[9] = 1; - Bsprintf(ud.wchoice, "3457860291"); + memcpy(g_player[0].wchoice, "\3\4\5\7\0x8\6\0\2\0x9\1", 10); + wchoice.Callback(); #ifdef HAVE_CLIPSHAPE_FEATURE // pre-form the default 10 clipmaps @@ -687,52 +677,6 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) initprintf("Respawn on.\n"); break; case 'u': - g_forceWeaponChoice = 1; - c++; - j = 0; - if (*c) - { - initprintf("Using favorite weapon order(s).\n"); - while (*c) - { - g_player[0].wchoice[j] = *c-'0'; - ud.wchoice[j] = *c; - c++; - j++; - } - - while (j < 10) - { - if (j == 9) - { - g_player[0].wchoice[9] = 1; - ud.wchoice[9] = '1'; - } - else - { - g_player[0].wchoice[j] = 2; - ud.wchoice[j] = '2'; - } - - j++; - } - } - else - { - initprintf("Using default weapon orders.\n"); - g_player[0].wchoice[0] = 3; - g_player[0].wchoice[1] = 4; - g_player[0].wchoice[2] = 5; - g_player[0].wchoice[3] = 7; - g_player[0].wchoice[4] = 8; - g_player[0].wchoice[5] = 6; - g_player[0].wchoice[6] = 0; - g_player[0].wchoice[7] = 2; - g_player[0].wchoice[8] = 9; - g_player[0].wchoice[9] = 1; - - Bsprintf(ud.wchoice, "3457860291"); - } break; case 'v': c++; diff --git a/source/duke3d/src/cmdline.h b/source/duke3d/src/cmdline.h index f273cd956..4442e90c2 100644 --- a/source/duke3d/src/cmdline.h +++ b/source/duke3d/src/cmdline.h @@ -39,7 +39,6 @@ extern int32_t g_noSound; extern int32_t g_noMusic; extern const char *CommandMap; extern const char *CommandName; -extern int32_t g_forceWeaponChoice; extern int32_t g_fakeMultiMode; END_DUKE_NS diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index a16a70a88..a047dd60e 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -295,8 +295,6 @@ void CONFIG_SetDefaults(void) memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions)); memset(ud.config.JoystickDigitalFunctions, -1, sizeof(ud.config.JoystickDigitalFunctions)); - CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; - for (int i=0; i>2,g_player[myconnectindex].ps->palette,0); } - else if (!Bstrcasecmp(parm->name, "skill")) - { - if (numplayers > 1) - return r; - - ud.player_skill = ud.m_player_skill; - } else if (!Bstrcasecmp(parm->name, "color")) { ud.color = G_CheckPlayerColor(ud.color); @@ -1474,54 +1467,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm) if (xdim && ydim) OSD_ResizeDisplay(xdim, ydim); } - else if (!Bstrcasecmp(parm->name, "wchoice")) - { - if (parm->numparms == 1) - { - if (g_forceWeaponChoice) // rewrite ud.wchoice because osdcmd_cvar_set already changed it - { - int j = 0; - - while (j < 10) - { - ud.wchoice[j] = g_player[myconnectindex].wchoice[j] + '0'; - j++; - } - - ud.wchoice[j] = 0; - } - else - { - char const *c = parm->parms[0]; - - if (*c) - { - int j = 0; - - while (*c && j < 10) - { - g_player[myconnectindex].wchoice[j] = *c - '0'; - c++; - j++; - } - - while (j < 10) - { - if (j == 9) - g_player[myconnectindex].wchoice[9] = 1; - else - g_player[myconnectindex].wchoice[j] = 2; - - j++; - } - } - } - - g_forceWeaponChoice = 0; - } - - /* Net_SendClientInfo();*/ - } return r; } diff --git a/source/rr/src/cmdline.cpp b/source/rr/src/cmdline.cpp index 9daa1ba4a..c9596248a 100644 --- a/source/rr/src/cmdline.cpp +++ b/source/rr/src/cmdline.cpp @@ -37,7 +37,6 @@ int32_t g_noSound = 0; int32_t g_noMusic = 0; const char *CommandMap = NULL; const char *CommandName = NULL; -int32_t g_forceWeaponChoice = 0; int32_t g_fakeMultiMode = 0; void G_ShowParameterHelp(void) @@ -160,17 +159,9 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) ud.warp_on = 0; ud.cashman = 0; ud.m_player_skill = ud.player_skill = 2; - g_player[0].wchoice[0] = 3; - g_player[0].wchoice[1] = 4; - g_player[0].wchoice[2] = 5; - g_player[0].wchoice[3] = 7; - g_player[0].wchoice[4] = 8; - g_player[0].wchoice[5] = 6; - g_player[0].wchoice[6] = 0; - g_player[0].wchoice[7] = 2; - g_player[0].wchoice[8] = 9; - g_player[0].wchoice[9] = 1; - Bsprintf(ud.wchoice, "3457860291"); + memcpy(g_player[0].wchoice, "\3\4\5\7\0x8\6\0\2\0x9\1", 10); + wchoice.Callback(); + #ifdef HAVE_CLIPSHAPE_FEATURE // pre-form the default 10 clipmaps @@ -664,52 +655,6 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) initprintf("Respawn on.\n"); break; case 'u': - g_forceWeaponChoice = 1; - c++; - j = 0; - if (*c) - { - initprintf("Using favorite weapon order(s).\n"); - while (*c) - { - g_player[0].wchoice[j] = *c-'0'; - ud.wchoice[j] = *c; - c++; - j++; - } - - while (j < 10) - { - if (j == 9) - { - g_player[0].wchoice[9] = 1; - ud.wchoice[9] = '1'; - } - else - { - g_player[0].wchoice[j] = 2; - ud.wchoice[j] = '2'; - } - - j++; - } - } - else - { - initprintf("Using default weapon orders.\n"); - g_player[0].wchoice[0] = 3; - g_player[0].wchoice[1] = 4; - g_player[0].wchoice[2] = 5; - g_player[0].wchoice[3] = 7; - g_player[0].wchoice[4] = 8; - g_player[0].wchoice[5] = 6; - g_player[0].wchoice[6] = 0; - g_player[0].wchoice[7] = 2; - g_player[0].wchoice[8] = 9; - g_player[0].wchoice[9] = 1; - - Bsprintf(ud.wchoice, "3457860291"); - } break; case 'v': c++; diff --git a/source/rr/src/cmdline.h b/source/rr/src/cmdline.h index e5138288a..74371437f 100644 --- a/source/rr/src/cmdline.h +++ b/source/rr/src/cmdline.h @@ -38,7 +38,6 @@ extern int32_t g_noSound; extern int32_t g_noMusic; extern const char *CommandMap; extern const char *CommandName; -extern int32_t g_forceWeaponChoice; extern int32_t g_fakeMultiMode; END_RR_NS diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index 39a38810c..f76cd70e4 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -337,8 +337,6 @@ void CONFIG_SetDefaults(void) ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]); CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse); } - CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; - memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions)); for (i=0; i>2,g_player[myconnectindex].ps->palette,0); } - else if (!Bstrcasecmp(parm->name, "skill")) - { - if (numplayers > 1) - return r; - - ud.player_skill = ud.m_player_skill; - } else if (!Bstrcasecmp(parm->name, "color")) { ud.color = G_CheckPlayerColor(ud.color); @@ -1261,55 +1254,6 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm) if (xdim && ydim) OSD_ResizeDisplay(xdim, ydim); } - else if (!Bstrcasecmp(parm->name, "wchoice")) - { - if (parm->numparms == 1) - { - if (g_forceWeaponChoice) // rewrite ud.wchoice because osdcmd_cvar_set already changed it - { - int j = 0; - - while (j < 10) - { - ud.wchoice[j] = g_player[myconnectindex].wchoice[j] + '0'; - j++; - } - - ud.wchoice[j] = 0; - } - else - { - char const *c = parm->parms[0]; - - if (*c) - { - int j = 0; - - while (*c && j < 10) - { - g_player[myconnectindex].wchoice[j] = *c - '0'; - c++; - j++; - } - - while (j < 10) - { - if (j == 9) - g_player[myconnectindex].wchoice[9] = 1; - else - g_player[myconnectindex].wchoice[j] = 2; - - j++; - } - } - } - - g_forceWeaponChoice = 0; - } - - /* Net_SendClientInfo();*/ - } - return r; } diff --git a/source/sw/src/config.cpp b/source/sw/src/config.cpp index 0755f2464..206ff444e 100644 --- a/source/sw/src/config.cpp +++ b/source/sw/src/config.cpp @@ -255,7 +255,7 @@ void CONFIG_SetDefaults(void) MouseAnalogAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]); } - CONTROL_MouseSensitivity = float(gs.MouseSpeed); // [JM] Temporary !CHECKME! + in_mousesensitivity = float(gs.MouseSpeed); // [JM] Temporary !CHECKME! memset(JoystickButtons, -1, sizeof(JoystickButtons)); memset(JoystickButtonsClicked, -1, sizeof(JoystickButtonsClicked)); @@ -476,7 +476,7 @@ void CONFIG_SetupMouse(void) CONTROL_SetAnalogAxisScale(i, MouseAnalogScale[i], controldevice_mouse); } - CONTROL_MouseSensitivity = float(gs.MouseSpeed); // [JM] Temporary !CHECKME! + in_mousesensitivity = float(gs.MouseSpeed); // [JM] Temporary !CHECKME! } /* diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 77b1ff290..cf892df56 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -3615,7 +3615,7 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw) slidersettings[sldr_mouse] = offset; gs.MouseSpeed = offset * (MOUSE_SENS_MAX_VALUE/SLDR_MOUSESENSEMAX); - CONTROL_MouseSensitivity = float(gs.MouseSpeed); // [JM] Will need to verify this. !CHECKME! + in_mousesensitivity = float(gs.MouseSpeed); // [JM] Will need to verify this. !CHECKME! break; case sldr_sndfxvolume: