mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- Converts keyboard turnspeeds into global CVars
This commit is contained in:
parent
1dde2ef597
commit
e4896e343b
2 changed files with 40 additions and 10 deletions
|
@ -56,6 +56,22 @@ CVAR(Bool, var_friction, true, CVAR_SERVERINFO);
|
|||
// Option Search
|
||||
CVAR(Bool, os_isanyof, true, CVAR_ARCHIVE);
|
||||
|
||||
CUSTOM_CVAR (Int, turnspeedwalkfast, 640, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self <= 0) self = 1;
|
||||
}
|
||||
CUSTOM_CVAR (Int, turnspeedsprintfast, 1280, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self <= 0) self = 1;
|
||||
}
|
||||
CUSTOM_CVAR (Int, turnspeedwalkslow, 320, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self <= 0) self = 1;
|
||||
}
|
||||
CUSTOM_CVAR (Int, turnspeedsprintslow, 320, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self <= 0) self = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -184,9 +184,14 @@ short consistancy[MAXPLAYERS][BACKUPTICS];
|
|||
|
||||
#define TURBOTHRESHOLD 12800
|
||||
|
||||
EXTERN_CVAR (Int, turnspeedwalkfast)
|
||||
EXTERN_CVAR (Int, turnspeedsprintfast)
|
||||
EXTERN_CVAR (Int, turnspeedwalkslow)
|
||||
EXTERN_CVAR (Int, turnspeedsprintslow)
|
||||
const char *TURNSPEEDCVARKEYS[4] = {"turnspeedwalkfast", "turnspeedsprintfast", "turnspeedwalkslow", "turnspeedsprintslow"};
|
||||
|
||||
int forwardmove[2], sidemove[2];
|
||||
int angleturn[4] = {640, 1280, 320, 320}; // + slow turn
|
||||
FIntCVar *angleturn[4] = {&turnspeedwalkfast, &turnspeedsprintfast, &turnspeedwalkslow, &turnspeedsprintslow};
|
||||
int flyspeed[2] = {1*256, 3*256};
|
||||
int lookspeed[2] = {450, 512};
|
||||
|
||||
|
@ -258,32 +263,41 @@ CUSTOM_CVAR (Float, turbo, 100.f, CVAR_NOINITCALL)
|
|||
#pragma optimize("", on)
|
||||
#endif // _M_X64 && _MSC_VER < 1910
|
||||
|
||||
ECVarType dummy;
|
||||
#define ANGLETURN(at) at->GetFavoriteRep(&dummy).Int
|
||||
CCMD (turnspeeds)
|
||||
{
|
||||
if (argv.argc() == 1)
|
||||
{
|
||||
Printf ("Current turn speeds: %d %d %d %d\n", angleturn[0],
|
||||
angleturn[1], angleturn[2], angleturn[3]);
|
||||
Printf ("\034H Current turn speeds:\n\
|
||||
\034N turnspeedwalkfast: \034D %d\n\
|
||||
\034N turnspeedsprintfast: \034D %d\n\
|
||||
\034N turnspeedwalkslow: \034D %d\n\
|
||||
\034N turnspeedsprintslow: \034D %d\n", ANGLETURN(angleturn[0]),
|
||||
ANGLETURN(angleturn[1]), ANGLETURN(angleturn[2]), ANGLETURN(angleturn[3]));
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
char val[10];
|
||||
for (i = 1; i <= 4 && i < argv.argc(); ++i)
|
||||
{
|
||||
angleturn[i-1] = atoi (argv[i]);
|
||||
cvar_forceset(TURNSPEEDCVARKEYS[i - 1], argv[i]);
|
||||
}
|
||||
if (i <= 2)
|
||||
{
|
||||
angleturn[1] = angleturn[0] * 2;
|
||||
sprintf(val, "%d", ANGLETURN(angleturn[0]) * 2);
|
||||
cvar_forceset(TURNSPEEDCVARKEYS[1], val);
|
||||
}
|
||||
if (i <= 3)
|
||||
{
|
||||
angleturn[2] = angleturn[0] / 2;
|
||||
sprintf(val, "%d", ANGLETURN(angleturn[0]) / 2);
|
||||
cvar_forceset(TURNSPEEDCVARKEYS[2], val);
|
||||
}
|
||||
if (i <= 4)
|
||||
{
|
||||
angleturn[3] = angleturn[2];
|
||||
sprintf(val, "%d", ANGLETURN(angleturn[2]));
|
||||
cvar_forceset(TURNSPEEDCVARKEYS[3], val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -570,11 +584,11 @@ void G_BuildTiccmd (ticcmd_t *cmd)
|
|||
|
||||
if (Button_Right.bDown)
|
||||
{
|
||||
G_AddViewAngle (angleturn[tspeed]);
|
||||
G_AddViewAngle (ANGLETURN(angleturn[tspeed]));
|
||||
}
|
||||
if (Button_Left.bDown)
|
||||
{
|
||||
G_AddViewAngle (-angleturn[tspeed]);
|
||||
G_AddViewAngle (-ANGLETURN(angleturn[tspeed]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue