Stop players from being able to turn during any resynch, player join, or disconeccting/lag spikes. Stops us from endless drift turning or our turns being broken by lag.

Also disable the lagless camera of SRB2 as lag spikes make it look a bit wonky and jerky.
This commit is contained in:
Sryder13 2018-01-19 02:47:10 +00:00
parent 43842468cf
commit 03b194c7ea
4 changed files with 49 additions and 27 deletions

View file

@ -118,6 +118,9 @@ static UINT8 resynch_local_inprogress = false; // WE are desynched and getting p
static UINT8 player_joining = false;
UINT8 hu_resynching = 0;
// kart, true when a player is connecting or disconnecting so that the gameplay has stopped in its tracks
UINT8 hu_stopped = 0;
// Client specific
static ticcmd_t localcmds;
static ticcmd_t localcmds2;
@ -4733,8 +4736,16 @@ void TryRunTics(tic_t realtics)
}
#endif
if (neededtic > gametic)
{
hu_stopped = false;
}
if (player_joining)
{
hu_stopped = true;
return;
}
if (neededtic > gametic)
{
@ -4752,6 +4763,10 @@ void TryRunTics(tic_t realtics)
consistancy[gametic%BACKUPTICS] = Consistancy();
}
}
else
{
hu_stopped = true;
}
}
#ifdef NEWPING

View file

@ -553,4 +553,5 @@ tic_t GetLag(INT32 node);
UINT8 GetFreeXCmdSize(void);
extern UINT8 hu_resynching;
extern UINT8 hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
#endif

View file

@ -694,6 +694,7 @@ void D_SRB2Loop(void)
else if (rendertimeout < entertic) // in case the server hang or netsplit
{
// Lagless camera! Yay!
/*
if (gamestate == GS_LEVEL && netgame)
{
if (camera.chase)
@ -705,6 +706,7 @@ void D_SRB2Loop(void)
if (splitscreen > 2 && camera4.chase)
P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false);
}
*/
D_Display();
if (moviemode)

View file

@ -1222,7 +1222,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// why build a ticcmd if we're paused?
// Or, for that matter, if we're being reborn.
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN))
// Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching)
{
cmd->angleturn = (INT16)(lang >> 16);
cmd->aiming = G_ClipAimingPitch(&laim);
@ -1608,6 +1609,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->angleturn = (INT16)(lang >> 16);
}
if (!hu_stopped)
{
if (ssplayer == 2)
{
localangle2 = lang;
@ -1636,6 +1639,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
keyboard_look = kbl;
turnheld = th;
}
}
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)