- refactored cl_weaponswitch

This commit is contained in:
Christoph Oelckers 2019-10-22 02:31:14 +02:00
parent 3f48ecd479
commit bdf2d24b21
16 changed files with 46 additions and 39 deletions

View File

@ -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);
}

View File

@ -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");

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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());

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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;