mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-17 02:01:15 +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;
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
58
src/g_game.c
58
src/g_game.c
|
@ -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,33 +1609,36 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
}
|
||||
|
||||
if (ssplayer == 2)
|
||||
if (!hu_stopped)
|
||||
{
|
||||
localangle2 = lang;
|
||||
localaiming2 = laim;
|
||||
keyboard_look2 = kbl;
|
||||
turnheld2 = th;
|
||||
}
|
||||
else if (ssplayer == 3)
|
||||
{
|
||||
localangle3 = lang;
|
||||
localaiming3 = laim;
|
||||
keyboard_look3 = kbl;
|
||||
turnheld3 = th;
|
||||
}
|
||||
else if (ssplayer == 4)
|
||||
{
|
||||
localangle4 = lang;
|
||||
localaiming4 = laim;
|
||||
keyboard_look4 = kbl;
|
||||
turnheld4 = th;
|
||||
}
|
||||
else
|
||||
{
|
||||
localangle = lang;
|
||||
localaiming = laim;
|
||||
keyboard_look = kbl;
|
||||
turnheld = th;
|
||||
if (ssplayer == 2)
|
||||
{
|
||||
localangle2 = lang;
|
||||
localaiming2 = laim;
|
||||
keyboard_look2 = kbl;
|
||||
turnheld2 = th;
|
||||
}
|
||||
else if (ssplayer == 3)
|
||||
{
|
||||
localangle3 = lang;
|
||||
localaiming3 = laim;
|
||||
keyboard_look3 = kbl;
|
||||
turnheld3 = th;
|
||||
}
|
||||
else if (ssplayer == 4)
|
||||
{
|
||||
localangle4 = lang;
|
||||
localaiming4 = laim;
|
||||
keyboard_look4 = kbl;
|
||||
turnheld4 = th;
|
||||
}
|
||||
else
|
||||
{
|
||||
localangle = lang;
|
||||
localaiming = laim;
|
||||
keyboard_look = kbl;
|
||||
turnheld = th;
|
||||
}
|
||||
}
|
||||
|
||||
//Reset away view if a command is given.
|
||||
|
|
Loading…
Reference in a new issue