mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-17 10:11:12 +00:00
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:
parent
43842468cf
commit
03b194c7ea
4 changed files with 49 additions and 27 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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,6 +1609,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
cmd->angleturn = (INT16)(lang >> 16);
|
cmd->angleturn = (INT16)(lang >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hu_stopped)
|
||||||
|
{
|
||||||
if (ssplayer == 2)
|
if (ssplayer == 2)
|
||||||
{
|
{
|
||||||
localangle2 = lang;
|
localangle2 = lang;
|
||||||
|
@ -1636,6 +1639,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
keyboard_look = kbl;
|
keyboard_look = kbl;
|
||||||
turnheld = th;
|
turnheld = th;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Reset away view if a command is given.
|
//Reset away view if a command is given.
|
||||||
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
||||||
|
|
Loading…
Reference in a new issue