From f0ce22edb6e82686e8926de4d9d88d902363f11c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 25 Sep 2017 20:35:04 +0100 Subject: [PATCH] Fix issue #72 (where closed captioning jingles didn't account for pausing). --- src/s_sound.c | 32 +++++++++++++++++++------------- src/screen.c | 6 +++++- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 2f3b1ae93..f6fef915a 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -959,21 +959,27 @@ void S_UpdateSounds(void) notinlevel: I_UpdateSound(); - for (i = 0; i < NUMCAPTIONS; i++) // update captions { - if (!closedcaptions[i].s) - continue; + boolean gamestopped = (paused || P_AutoPause()); + for (i = 0; i < NUMCAPTIONS; i++) // update captions + { + if (!closedcaptions[i].s) + continue; - if (!(--closedcaptions[i].t)) - { - closedcaptions[i].c = NULL; - closedcaptions[i].s = NULL; - } - else if (closedcaptions[i].c && !I_SoundIsPlaying(closedcaptions[i].c->handle)) - { - closedcaptions[i].c = NULL; - if (closedcaptions[i].t > CAPTIONFADETICS) - closedcaptions[i].t = CAPTIONFADETICS; + if (i == 0 && (closedcaptions[0].s-S_sfx == sfx_None) && gamestopped) + continue; + + if (!(--closedcaptions[i].t)) + { + closedcaptions[i].c = NULL; + closedcaptions[i].s = NULL; + } + else if (closedcaptions[i].c && !I_SoundIsPlaying(closedcaptions[i].c->handle)) + { + closedcaptions[i].c = NULL; + if (closedcaptions[i].t > CAPTIONFADETICS) + closedcaptions[i].t = CAPTIONFADETICS; + } } } } diff --git a/src/screen.c b/src/screen.c index 8c1811d5d..a9b85d1a1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -31,6 +31,7 @@ #include "i_sound.h" // closed captions #include "s_sound.h" // ditto #include "g_game.h" // ditto +#include "p_local.h" // P_AutoPause() #if defined (USEASM) && !defined (NORUSEASM)//&& (!defined (_MSC_VER) || (_MSC_VER <= 1200)) @@ -444,6 +445,7 @@ void SCR_DisplayTicRate(void) void SCR_ClosedCaptions(void) { UINT8 i; + boolean gamestopped = (paused || P_AutoPause()); for (i = 0; i < NUMCAPTIONS; i++) { @@ -454,7 +456,9 @@ void SCR_ClosedCaptions(void) if (!closedcaptions[i].s) continue; - if ((music = (closedcaptions[i].s-S_sfx == sfx_None)) && (closedcaptions[i].t < flashingtics) && (closedcaptions[i].t & 1)) + music = (closedcaptions[i].s-S_sfx == sfx_None); + + if (music && !gamestopped && (closedcaptions[i].t < flashingtics) && (closedcaptions[i].t & 1)) continue; flags = V_NOSCALESTART|V_ALLOWLOWERCASE;