- fixed the PR.

This commit is contained in:
Christoph Oelckers 2019-08-18 18:45:18 +02:00
parent e4896e343b
commit 94179a11f5

View file

@ -188,7 +188,6 @@ EXTERN_CVAR (Int, turnspeedwalkfast)
EXTERN_CVAR (Int, turnspeedsprintfast) EXTERN_CVAR (Int, turnspeedsprintfast)
EXTERN_CVAR (Int, turnspeedwalkslow) EXTERN_CVAR (Int, turnspeedwalkslow)
EXTERN_CVAR (Int, turnspeedsprintslow) EXTERN_CVAR (Int, turnspeedsprintslow)
const char *TURNSPEEDCVARKEYS[4] = {"turnspeedwalkfast", "turnspeedsprintfast", "turnspeedwalkslow", "turnspeedsprintslow"};
int forwardmove[2], sidemove[2]; int forwardmove[2], sidemove[2];
FIntCVar *angleturn[4] = {&turnspeedwalkfast, &turnspeedsprintfast, &turnspeedwalkslow, &turnspeedsprintslow}; FIntCVar *angleturn[4] = {&turnspeedwalkfast, &turnspeedsprintfast, &turnspeedwalkslow, &turnspeedsprintslow};
@ -263,41 +262,36 @@ CUSTOM_CVAR (Float, turbo, 100.f, CVAR_NOINITCALL)
#pragma optimize("", on) #pragma optimize("", on)
#endif // _M_X64 && _MSC_VER < 1910 #endif // _M_X64 && _MSC_VER < 1910
ECVarType dummy;
#define ANGLETURN(at) at->GetFavoriteRep(&dummy).Int
CCMD (turnspeeds) CCMD (turnspeeds)
{ {
if (argv.argc() == 1) if (argv.argc() == 1)
{ {
Printf ("\034H Current turn speeds:\n\ Printf ("Current turn speeds:\n"
\034N turnspeedwalkfast: \034D %d\n\ TEXTCOLOR_BLUE " turnspeedwalkfast: " TEXTCOLOR_GREEN " %d\n"
\034N turnspeedsprintfast: \034D %d\n\ TEXTCOLOR_BLUE " turnspeedsprintfast: " TEXTCOLOR_GREEN " %d\n"
\034N turnspeedwalkslow: \034D %d\n\ TEXTCOLOR_BLUE " turnspeedwalkslow: " TEXTCOLOR_GREEN " %d\n"
\034N turnspeedsprintslow: \034D %d\n", ANGLETURN(angleturn[0]), TEXTCOLOR_BLUE " turnspeedsprintslow: " TEXTCOLOR_GREEN " %d\n", *turnspeedwalkfast,
ANGLETURN(angleturn[1]), ANGLETURN(angleturn[2]), ANGLETURN(angleturn[3])); *turnspeedsprintfast, *turnspeedwalkslow, *turnspeedsprintslow);
} }
else else
{ {
int i; int i;
char val[10];
for (i = 1; i <= 4 && i < argv.argc(); ++i) for (i = 1; i <= 4 && i < argv.argc(); ++i)
{ {
cvar_forceset(TURNSPEEDCVARKEYS[i - 1], argv[i]); *angleturn[i-1] = atoi (argv[i]);
} }
if (i <= 2) if (i <= 2)
{ {
sprintf(val, "%d", ANGLETURN(angleturn[0]) * 2); *angleturn[1] = *angleturn[0] * 2;
cvar_forceset(TURNSPEEDCVARKEYS[1], val);
} }
if (i <= 3) if (i <= 3)
{ {
sprintf(val, "%d", ANGLETURN(angleturn[0]) / 2); *angleturn[2] = *angleturn[0] / 2;
cvar_forceset(TURNSPEEDCVARKEYS[2], val);
} }
if (i <= 4) if (i <= 4)
{ {
sprintf(val, "%d", ANGLETURN(angleturn[2])); *angleturn[3] = *angleturn[2];
cvar_forceset(TURNSPEEDCVARKEYS[3], val);
} }
} }
} }
@ -584,11 +578,11 @@ void G_BuildTiccmd (ticcmd_t *cmd)
if (Button_Right.bDown) if (Button_Right.bDown)
{ {
G_AddViewAngle (ANGLETURN(angleturn[tspeed])); G_AddViewAngle (*angleturn[tspeed]);
} }
if (Button_Left.bDown) if (Button_Left.bDown)
{ {
G_AddViewAngle (-ANGLETURN(angleturn[tspeed])); G_AddViewAngle (-*angleturn[tspeed]);
} }
} }