Restore turn smoothing in the most horrific way possible
This commit is contained in:
parent
fb230a27d3
commit
e669ca6edb
4 changed files with 24 additions and 12 deletions
24
src/g_game.c
24
src/g_game.c
|
|
@ -977,18 +977,15 @@ static void G_DoAnglePrediction(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer, p
|
|||
cmd->angle = (INT16)(localangle[ssplayer-1] >> TICCMD_REDUCE);
|
||||
}
|
||||
|
||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
{
|
||||
const boolean fordemocam = ssplayer == UINT8_MAX;
|
||||
const UINT8 forplayer = fordemocam ? 0 : ssplayer-1;
|
||||
|
||||
const INT32 baseturnspeed = 1;
|
||||
|
||||
static INT32 turnheld[MAXSPLITSCREENPLAYERS]; // for accelerative turning
|
||||
static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame
|
||||
|
||||
INT32 forward, side, tspeed;
|
||||
INT32 forward, side;
|
||||
|
||||
joystickvector2_t joystickvector;
|
||||
|
||||
|
|
@ -1049,17 +1046,24 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
forward = side = 0;
|
||||
|
||||
// use two stage accelerative turning
|
||||
// on the keyboard and joystick
|
||||
// on the keyboard and (NOT!) joystick
|
||||
if (joystickvector.xaxis != 0)
|
||||
{
|
||||
turnheld[forplayer] += realtics;
|
||||
if (turnheld[forplayer] < cv_turnsmooth.value * 3)
|
||||
{
|
||||
boolean digital;
|
||||
inputcheckdigital = true;
|
||||
digital = G_PlayerInputDown(forplayer, gc_turnleft, false) || G_PlayerInputDown(forplayer, gc_turnright, false);
|
||||
inputcheckdigital = false;
|
||||
|
||||
if (digital)
|
||||
joystickvector.xaxis /= cv_turnsmooth.value * 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
turnheld[forplayer] = 0;
|
||||
|
||||
if (turnheld[forplayer] < SLOWTURNTICS)
|
||||
tspeed = cv_turnsmooth.value == 2 ? 2 : 0; // slow turn
|
||||
else
|
||||
tspeed = baseturnspeed;
|
||||
|
||||
cmd->turning = 0;
|
||||
|
||||
if (joystickvector.xaxis != 0)
|
||||
|
|
|
|||
|
|
@ -95,9 +95,7 @@ void weaponPrefChange2(void);
|
|||
void weaponPrefChange3(void);
|
||||
void weaponPrefChange4(void);
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
#define MAXPLMOVE (50)
|
||||
#define SLOWTURNTICS (cv_turnsmooth.value * 3)
|
||||
|
||||
const char *G_BuildMapName(INT32 map);
|
||||
INT32 G_MapNumber(const char *mapname);
|
||||
|
|
|
|||
|
|
@ -443,6 +443,8 @@ boolean G_KeyBindIsNecessary(INT32 gc)
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean inputcheckdigital = false;
|
||||
|
||||
// Returns false if a key is deemed unreachable for this device.
|
||||
boolean G_KeyIsAvailable(INT32 key, INT32 deviceID)
|
||||
{
|
||||
|
|
@ -472,6 +474,12 @@ boolean G_KeyIsAvailable(INT32 key, INT32 deviceID)
|
|||
}
|
||||
*/
|
||||
|
||||
// this is ugly as fuck, but it's also better than copy-pasting half of G_PlayerInputAnalog just for turn smoothing
|
||||
if (inputcheckdigital && key >= KEY_AXIS1 && key < JOYINPUTEND)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ INT32 G_KeyStringtoNum(const char *keystr);
|
|||
boolean G_KeyBindIsNecessary(INT32 gc);
|
||||
boolean G_KeyIsAvailable(INT32 key, INT32 deviceID);
|
||||
|
||||
extern boolean inputcheckdigital;
|
||||
|
||||
// detach any keys associated to the given game control
|
||||
void G_ClearControlKeys(INT32 (*setupcontrols)[MAXINPUTMAPPING], INT32 control);
|
||||
void G_ClearAllControlKeys(void);
|
||||
|
|
|
|||
Loading…
Reference in a new issue