mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
Prevent SV_SpawnPlayer from being able to freeze the game if gametic is 0. Additionally add a sanity check to prevent the loop going on more than necessary anyway
This commit fixes -playdemo and -timedemo params for command line, allowing them to actually work again
This commit is contained in:
parent
f1b8e122a2
commit
0ef7aff5c0
1 changed files with 15 additions and 0 deletions
|
@ -4445,6 +4445,7 @@ static void Local_Maketic(INT32 realtics)
|
|||
void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
|
||||
{
|
||||
tic_t tic;
|
||||
UINT8 numadjust = 0;
|
||||
|
||||
(void)x;
|
||||
(void)y;
|
||||
|
@ -4454,7 +4455,21 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
|
|||
// spawning, but will be applied afterwards.
|
||||
|
||||
for (tic = server ? maketic : (neededtic - 1); tic >= gametic; tic--)
|
||||
{
|
||||
if (numadjust++ == BACKUPTICS)
|
||||
{
|
||||
DEBFILE(va("SV_SpawnPlayer: All netcmds for player %d adjusted!\n", playernum));
|
||||
// We already adjusted them all, waste of time doing the same thing over and over
|
||||
// This shouldn't happen normally though, either gametic was 0 (which is handled now anyway)
|
||||
// or maketic >= gametic + BACKUPTICS
|
||||
// -- Monster Iestyn 16/01/18
|
||||
break;
|
||||
}
|
||||
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED);
|
||||
|
||||
if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create missed tic
|
||||
|
|
Loading…
Reference in a new issue