diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 837f6c034..ba184840c 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -687,7 +687,7 @@ void StartLevel(GAMEOPTIONS *gameOptions) { gProfile[i].skill = gSkill; gProfile[i].nAutoAim = cl_autoaim; - gProfile[i].nWeaponSwitch = gWeaponSwitch; + gProfile[i].nWeaponSwitch = cl_weaponswitch; } playerInit(i,0); } diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index e52e4fd16..7e47658c2 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -81,7 +81,7 @@ char szPlayerName[MAXPLAYERNAME]; int32_t gTurnSpeed; int32_t gDetail; int32_t gMouseAim; -int32_t gWeaponSwitch; +int32_t cl_weaponswitch; int32_t gAutoRun; int32_t gFollowMap; int32_t gOverlayMap; @@ -337,7 +337,7 @@ void CONFIG_SetDefaults(void) //ud.team = 0; //ud.textscale = 200; //ud.weaponscale = 100; - //ud.weaponswitch = 3; // new+empty + //cl_weaponswitch = 3; // new+empty gFov = 90; gCenterHoriz = 0; gDeliriumBlur = 1; @@ -358,7 +358,7 @@ void CONFIG_SetDefaults(void) gMouseAimingFlipped = 0; gMouseAim = 1; - gWeaponSwitch = 1; + cl_weaponswitch = 1; Bstrcpy(szPlayerName, "Player"); diff --git a/source/blood/src/config.h b/source/blood/src/config.h index 81539ba37..c26cb4ec6 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -62,7 +62,7 @@ extern char CommbatMacro[MAXRIDECULE][MAXRIDECULELENGTH]; extern char szPlayerName[MAXPLAYERNAME]; extern int32_t gTurnSpeed; extern int32_t gDetail; -extern int32_t gWeaponSwitch; +extern int32_t cl_weaponswitch; extern int32_t gAutoRun; extern int32_t gFollowMap; extern int32_t gOverlayMap; diff --git a/source/blood/src/menu.cpp b/source/blood/src/menu.cpp index f806f6998..362f59b22 100644 --- a/source/blood/src/menu.cpp +++ b/source/blood/src/menu.cpp @@ -1123,7 +1123,7 @@ void SetupOptionsMenu(void) itemOptionsGameBoolViewBobbing.at20 = cl_viewvbob; itemOptionsGameBoolViewSwaying.at20 = cl_viewhbob; itemOptionsGameBoolAutoAim.m_nFocus = cl_autoaim; - itemOptionsGameWeaponSwitch.m_nFocus = (gWeaponSwitch&1) ? ((gWeaponSwitch&2) ? 1 : 2) : 0; + itemOptionsGameWeaponSwitch.m_nFocus = (cl_weaponswitch&1) ? ((cl_weaponswitch&2) ? 1 : 2) : 0; /////// itemOptionsGameBoolWeaponsV10X.at20 = gWeaponsV10x; @@ -1494,22 +1494,23 @@ void SetShowMapTitle(CGameMenuItemZBool* pItem) void SetWeaponSwitch(CGameMenuItemZCycle *pItem) { - gWeaponSwitch &= ~(1|2); + + cl_weaponswitch = cl_weaponswitch & ~(1|2); switch (pItem->m_nFocus) { case 0: break; case 1: - gWeaponSwitch |= 2; + cl_weaponswitch = cl_weaponswitch | 2; fallthrough__; case 2: default: - gWeaponSwitch |= 1; + cl_weaponswitch = cl_weaponswitch | 1; break; } if (!gDemo.at0 && !gDemo.at1) { - gProfile[myconnectindex].nWeaponSwitch = gWeaponSwitch; + gProfile[myconnectindex].nWeaponSwitch = cl_weaponswitch; netBroadcastPlayerInfo(myconnectindex); } } diff --git a/source/blood/src/menus.cpp b/source/blood/src/menus.cpp index fa6aa409a..e96336d0f 100644 --- a/source/blood/src/menus.cpp +++ b/source/blood/src/menus.cpp @@ -3272,14 +3272,14 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) #endif else if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP) { - ud.weaponswitch &= ~(1|4); + ud.weaponswitch = ud.weaponswitch & ~(1|4); switch (newOption) { case 2: - ud.weaponswitch |= 4; + ud.weaponswitch = ud.weaponswitch | 4; fallthrough__; case 1: - ud.weaponswitch |= 1; + ud.weaponswitch = ud.weaponswitch | 1; break; default: break; @@ -3604,7 +3604,7 @@ This is polled when the menu code is populating the screen but for some reason d static int32_t Menu_EntryOptionSource(MenuEntry_t *entry, int32_t currentValue) { if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP) - return (ud.weaponswitch & 1) ? ((ud.weaponswitch & 4) ? 2 : 1) : 0; + return (cl_weaponswitch & 1) ? ((cl_weaponswitch & 4) ? 2 : 1) : 0; else if (entry == &ME_SOUND_DUKETALK) return snd_speech & 1; else if (entry == &ME_NETOPTIONS_MONSTERS) diff --git a/source/blood/src/network.cpp b/source/blood/src/network.cpp index 6213fb783..5da4387b9 100644 --- a/source/blood/src/network.cpp +++ b/source/blood/src/network.cpp @@ -579,7 +579,7 @@ void netBroadcastPlayerInfo(int nPlayer) strcpy(pProfile->name, szPlayerName); pProfile->skill = gSkill; pProfile->nAutoAim = cl_autoaim; - pProfile->nWeaponSwitch = gWeaponSwitch; + pProfile->nWeaponSwitch = cl_weaponswitch; if (numplayers < 2) return; char *pPacket = packet; diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index dfa0cbb35..b91d496ac 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -39,6 +39,16 @@ CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE, "enable/disable weapon autoaim") //UpdatePlayerFromMenu(); todo: networking (only operational in EDuke32 frontend anyway.) }; +CUSTOM_CVARD(Int, cl_weaponswitch, 3, CVAR_ARCHIVE, "enable/disable auto weapon switching")//, (void *)&cl_weaponswitch, CVAR_INT|CVAR_MULTI, 0, 7 }, (void *)&cl_weaponswitch, CVAR_INT|CVAR_MULTI, 0, 3 }, + +{ + if (self < 0) self = 0; + if (self > 3 && playing_blood) self = 3; + if (self > 7) self = 7; + //UpdatePlayerFromMenu(); todo: networking (only operational in EDuke32 frontend anyway.) +} + + CUSTOM_CVARD(Int, cl_autovote, 0, CVAR_ARCHIVE, "enable/disable automatic voting") { if (self < 0 || self > 2) self = 0; @@ -119,8 +129,7 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus // DN3D static osdcvardata_t cvars_game[] = { - { "cl_weaponswitch", "enable/disable auto weapon switching", (void *)&ud.weaponswitch, CVAR_INT|CVAR_MULTI, 0, 7 }, - + { "color", "changes player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 }, { "crosshairscale","changes the size of the crosshair", (void *)&ud.crosshairscale, CVAR_INT, 10, 100 }, @@ -164,7 +173,6 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus { "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 }, { "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 }, { "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&ud.detail, CVAR_INT|CVAR_FUNCPTR, 1, 16 }, { "r_precache", "enable/disable the pre-level caching routine", (void *)&ud.config.useprecache, CVAR_BOOL, 0, 1 }, { "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, @@ -200,8 +208,6 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus static osdcvardata_t cvars_game[] = { - { "cl_weaponswitch", "enable/disable auto weapon switching", (void *)&ud.weaponswitch, CVAR_INT|CVAR_MULTI, 0, 7 }, - { "color", "changes player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 }, { "crosshairscale","changes the size of the crosshair", (void *)&ud.crosshairscale, CVAR_INT, 10, 100 }, @@ -245,7 +251,6 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus { "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 }, { "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 }, { "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&ud.detail, CVAR_INT|CVAR_FUNCPTR, 1, 16 }, { "r_precache", "enable/disable the pre-level caching routine", (void *)&ud.config.useprecache, CVAR_BOOL, 0, 1 }, { "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, @@ -285,7 +290,6 @@ int32_t registerosdcommands(void) static osdcvardata_t cvars_game[] = { - { "cl_weaponswitch", "enable/disable auto weapon switching", (void *)&gWeaponSwitch, CVAR_INT|CVAR_MULTI, 0, 3 }, // // { "color", "changes player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 }, // @@ -333,7 +337,7 @@ int32_t registerosdcommands(void) // { "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 }, { "r_size", "change size of viewable area", (void *)&gViewSize, CVAR_INT|CVAR_FUNCPTR, 0, 7 }, // { "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&gUpscaleFactor, CVAR_INT|CVAR_FUNCPTR, 1, 16 }, +}, { "r_precache", "enable/disable the pre-level caching routine", (void *)&useprecache, CVAR_BOOL, 0, 1 }, // { "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, @@ -363,4 +367,7 @@ int32_t registerosdcommands(void) } } +// These I don't care about. +//{ "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&ud.detail, CVAR_INT|CVAR_FUNCPTR, 1, 16 }, +//{ "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&gUpscaleFactor, CVAR_INT|CVAR_FUNCPTR, 1, 16 #endif diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 3e9bde3af..757e7a015 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -289,7 +289,6 @@ void CONFIG_SetDefaults(void) ud.team = 0; ud.textscale = 200; ud.weaponscale = 100; - ud.weaponswitch = 3; // new+empty Bstrcpy(ud.rtsname, G_DefaultRtsFile()); diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 5937d8a7f..3d74e73f8 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -6145,7 +6145,7 @@ static void P_SetupMiscInputSettings(void) ps->aim_mode = ud.mouseaiming; ps->auto_aim = cl_autoaim; - ps->weaponswitch = ud.weaponswitch; + ps->weaponswitch = cl_weaponswitch; } void G_UpdatePlayerFromMenu(void) diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index e4d01cda6..82168bfa6 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -1449,7 +1449,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2) case USERDEFS_STATUSBARSCALE: labelNum = ud.statusbarscale; break; case USERDEFS_DRAWWEAPON: labelNum = ud.drawweapon; break; case USERDEFS_MOUSEAIMING: labelNum = ud.mouseaiming; break; - case USERDEFS_WEAPONSWITCH: labelNum = ud.weaponswitch; break; + case USERDEFS_WEAPONSWITCH: labelNum = cl_weaponswitch; break; case USERDEFS_DEMOCAMS: labelNum = cl_democams; break; case USERDEFS_COLOR: labelNum = ud.color; break; case USERDEFS_MSGDISPTIME: labelNum = ud.msgdisptime; break; @@ -1650,7 +1650,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons case USERDEFS_STATUSBARSCALE: ud.statusbarscale = iSet; break; case USERDEFS_DRAWWEAPON: ud.drawweapon = iSet; break; case USERDEFS_MOUSEAIMING: ud.mouseaiming = iSet; break; - case USERDEFS_WEAPONSWITCH: ud.weaponswitch = iSet; break; + case USERDEFS_WEAPONSWITCH: cl_weaponswitch = iSet; break; //!!! case USERDEFS_DEMOCAMS: cl_democams = iSet; break; case USERDEFS_COLOR: ud.color = iSet; break; case USERDEFS_MSGDISPTIME: ud.msgdisptime = iSet; break; diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index baa30fc2e..6c78c33b1 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -3286,14 +3286,14 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) #endif else if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP) { - ud.weaponswitch &= ~(1|4); + ud.weaponswitch = ud.weaponswitch & ~(1|4); switch (newOption) { case 2: - ud.weaponswitch |= 4; + ud.weaponswitch = ud.weaponswitch | 4; fallthrough__; case 1: - ud.weaponswitch |= 1; + ud.weaponswitch = ud.weaponswitch | 1; break; default: break; @@ -3618,7 +3618,7 @@ This is polled when the menu code is populating the screen but for some reason d static int32_t Menu_EntryOptionSource(MenuEntry_t *entry, int32_t currentValue) { if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP) - return (ud.weaponswitch & 1) ? ((ud.weaponswitch & 4) ? 2 : 1) : 0; + return (cl_weaponswitch & 1) ? ((cl_weaponswitch & 4) ? 2 : 1) : 0; else if (entry == &ME_SOUND_DUKETALK) return snd_speech & 1; else if (entry == &ME_NETOPTIONS_MONSTERS) diff --git a/source/duke3d/src/network.cpp b/source/duke3d/src/network.cpp index a68cf5f92..48afc247f 100644 --- a/source/duke3d/src/network.cpp +++ b/source/duke3d/src/network.cpp @@ -4809,7 +4809,7 @@ void Net_SendClientInfo(void) tempnetbuf[l++] = g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; tempnetbuf[l++] = g_player[myconnectindex].ps->auto_aim = cl_autoaim; - tempnetbuf[l++] = g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch; + tempnetbuf[l++] = g_player[myconnectindex].ps->weaponswitch = cl_weaponswitch; tempnetbuf[l++] = g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color; tempnetbuf[l++] = g_player[myconnectindex].pteam = ud.team; diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index fb8a975ca..ab0f67a1d 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -253,7 +253,7 @@ void CONFIG_SetDefaults(void) ud.statusbarmode = 1; ud.statusbarscale = 100; ud.team = 0; - ud.weaponswitch = 3; // new+empty + cl_weaponswitch = 3; // new+empty ud.angleinterpolation = 0; #ifdef GEKKO ud.setup.usejoystick = 1; diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 19f959224..24a250d02 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7539,7 +7539,7 @@ static void P_SetupMiscInputSettings(void) ps->aim_mode = ud.mouseaiming; ps->auto_aim = cl_autoaim; - ps->weaponswitch = ud.weaponswitch; + ps->weaponswitch = cl_weaponswitch; } void G_UpdatePlayerFromMenu(void) diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index 60b1f5c2f..0886bbb1c 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -3691,14 +3691,14 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) #endif else if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP) { - ud.weaponswitch &= ~(1|4); + ud.weaponswitch = ud.weaponswitch & ~(1|4); switch (newOption) { case 2: - ud.weaponswitch |= 4; + ud.weaponswitch = ud.weaponswitch | 4; fallthrough__; case 1: - ud.weaponswitch |= 1; + ud.weaponswitch = ud.weaponswitch | 1; break; default: break; @@ -4016,7 +4016,7 @@ This is polled when the menu code is populating the screen but for some reason d static int32_t Menu_EntryOptionSource(MenuEntry_t *entry, int32_t currentValue) { if (entry == &ME_GAMESETUP_WEAPSWITCH_PICKUP) - return (ud.weaponswitch & 1) ? ((ud.weaponswitch & 4) ? 2 : 1) : 0; + return (cl_weaponswitch & 1) ? ((cl_weaponswitch & 4) ? 2 : 1) : 0; else if (entry == &ME_SOUND_DUKETALK) return snd_speech & 1; else if (entry == &ME_NETOPTIONS_MONSTERS) diff --git a/source/rr/src/net.cpp b/source/rr/src/net.cpp index a1d178950..42b94d703 100644 --- a/source/rr/src/net.cpp +++ b/source/rr/src/net.cpp @@ -3469,7 +3469,7 @@ void Net_SendClientInfo(void) tempbuf[l++] = g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; tempbuf[l++] = g_player[myconnectindex].ps->auto_aim = cl_autoaim; - tempbuf[l++] = g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch; + tempbuf[l++] = g_player[myconnectindex].ps->weaponswitch = cl_weaponswitch; tempbuf[l++] = g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color; tempbuf[l++] = g_player[myconnectindex].pteam = ud.team;