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; static UINT8 player_joining = false;
UINT8 hu_resynching = 0; 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 // Client specific
static ticcmd_t localcmds; static ticcmd_t localcmds;
static ticcmd_t localcmds2; static ticcmd_t localcmds2;
@ -4733,8 +4736,16 @@ void TryRunTics(tic_t realtics)
} }
#endif #endif
if (neededtic > gametic)
{
hu_stopped = false;
}
if (player_joining) if (player_joining)
{
hu_stopped = true;
return; return;
}
if (neededtic > gametic) if (neededtic > gametic)
{ {
@ -4752,6 +4763,10 @@ void TryRunTics(tic_t realtics)
consistancy[gametic%BACKUPTICS] = Consistancy(); consistancy[gametic%BACKUPTICS] = Consistancy();
} }
} }
else
{
hu_stopped = true;
}
} }
#ifdef NEWPING #ifdef NEWPING

View File

@ -553,4 +553,5 @@ tic_t GetLag(INT32 node);
UINT8 GetFreeXCmdSize(void); UINT8 GetFreeXCmdSize(void);
extern UINT8 hu_resynching; 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 #endif

View File

@ -694,6 +694,7 @@ void D_SRB2Loop(void)
else if (rendertimeout < entertic) // in case the server hang or netsplit else if (rendertimeout < entertic) // in case the server hang or netsplit
{ {
// Lagless camera! Yay! // Lagless camera! Yay!
/*
if (gamestate == GS_LEVEL && netgame) if (gamestate == GS_LEVEL && netgame)
{ {
if (camera.chase) if (camera.chase)
@ -705,6 +706,7 @@ void D_SRB2Loop(void)
if (splitscreen > 2 && camera4.chase) if (splitscreen > 2 && camera4.chase)
P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false); P_MoveChaseCamera(&players[fourthdisplayplayer], &camera4, false);
} }
*/
D_Display(); D_Display();
if (moviemode) 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? // why build a ticcmd if we're paused?
// Or, for that matter, if we're being reborn. // 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->angleturn = (INT16)(lang >> 16);
cmd->aiming = G_ClipAimingPitch(&laim); cmd->aiming = G_ClipAimingPitch(&laim);
@ -1608,33 +1609,36 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->angleturn = (INT16)(lang >> 16); cmd->angleturn = (INT16)(lang >> 16);
} }
if (ssplayer == 2) if (!hu_stopped)
{ {
localangle2 = lang; if (ssplayer == 2)
localaiming2 = laim; {
keyboard_look2 = kbl; localangle2 = lang;
turnheld2 = th; localaiming2 = laim;
} keyboard_look2 = kbl;
else if (ssplayer == 3) turnheld2 = th;
{ }
localangle3 = lang; else if (ssplayer == 3)
localaiming3 = laim; {
keyboard_look3 = kbl; localangle3 = lang;
turnheld3 = th; localaiming3 = laim;
} keyboard_look3 = kbl;
else if (ssplayer == 4) turnheld3 = th;
{ }
localangle4 = lang; else if (ssplayer == 4)
localaiming4 = laim; {
keyboard_look4 = kbl; localangle4 = lang;
turnheld4 = th; localaiming4 = laim;
} keyboard_look4 = kbl;
else turnheld4 = th;
{ }
localangle = lang; else
localaiming = laim; {
keyboard_look = kbl; localangle = lang;
turnheld = th; localaiming = laim;
keyboard_look = kbl;
turnheld = th;
}
} }
//Reset away view if a command is given. //Reset away view if a command is given.