diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 634c6b81..b78804f4 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -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 diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 2d49bd61..12ff0a96 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -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 diff --git a/src/d_main.c b/src/d_main.c index f94331cd..542d266b 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -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) diff --git a/src/g_game.c b/src/g_game.c index a0a40329..644f600e 100644 --- a/src/g_game.c +++ b/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.