Skip to content

Commit

Permalink
Make sure to call SCR_FinishCinematic() only once to avoid lockups wh…
Browse files Browse the repository at this point in the history
…en input queue is full.
  • Loading branch information
kondrak committed Aug 17, 2020
1 parent 6f635af commit eb8d069
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/cl_cin.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef struct
} cinematics_t;

cinematics_t cin;
qboolean cin_finished = false;

/*
=================================================================
Expand Down Expand Up @@ -197,6 +198,13 @@ Called when either the cinematic completes, or it is aborted
*/
void SCR_FinishCinematic (void)
{
// For expansions packs/mods with multiple cinematics played in a row, the input queue
// may cause the "nextserver" message to be sent out more than once which results in a lockup.
// Here we make sure that SCR_FinishCinematic() is called exactly once to avoid this.
if (cin_finished)
return;

cin_finished = true;
// tell the server to advance to the next map / cinematic
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, va("nextserver %i\n", cl.servercount));
Expand Down Expand Up @@ -584,6 +592,7 @@ void SCR_PlayCinematic (char *arg)
CDAudio_Stop();
Miniaudio_Stop();

cin_finished = false;
cl.cinematicframe = 0;
dot = strstr (arg, ".");
if (dot && !strcmp (dot, ".pcx"))
Expand Down

0 comments on commit eb8d069

Please sign in to comment.