- fixed: SW's intro cutscene must not terminate its sound.

Fixes #201.
This commit is contained in:
Christoph Oelckers 2020-08-18 00:04:48 +02:00
parent 65cb267d56
commit a535f62d4a
4 changed files with 12 additions and 9 deletions

View File

@ -99,12 +99,13 @@ class DAnmPlayer : public DScreenJob
AnimTextures animtex;
const AnimSound* animSnd;
const int* frameTicks;
bool nostopsound;
public:
bool isvalid() { return numframes > 0; }
DAnmPlayer(FileReader& fr, const AnimSound* ans, const int *frameticks)
: animSnd(ans), frameTicks(frameticks)
DAnmPlayer(FileReader& fr, const AnimSound* ans, const int *frameticks, bool nosoundcutoff)
: animSnd(ans), frameTicks(frameticks), nostopsound(nosoundcutoff)
{
buffer = fr.ReadPadded(1);
fr.Close();
@ -138,7 +139,7 @@ public:
{
twod->ClearScreen();
DrawTexture(twod, animtex.GetFrame(), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Masked, false, TAG_DONE);
if (skiprequest) soundEngine->StopAllChannels();
if (skiprequest && !nostopsound) soundEngine->StopAllChannels();
return skiprequest? -1 : 1;
}
@ -169,7 +170,7 @@ public:
}
}
curframe++;
if (skiprequest) soundEngine->StopAllChannels();
if (skiprequest && !nostopsound) soundEngine->StopAllChannels();
return skiprequest ? -1 : curframe < numframes? 1 : 0;
}
@ -325,7 +326,7 @@ public:
//
//---------------------------------------------------------------------------
DScreenJob* PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks)
DScreenJob* PlayVideo(const char* filename, const AnimSound* ans, const int* frameticks, bool nosoundcutoff)
{
auto nothing = []()->DScreenJob* { return Create<DScreenJob>(); };
if (!filename)
@ -355,7 +356,7 @@ DScreenJob* PlayVideo(const char* filename, const AnimSound* ans, const int* fra
if (!memcmp(id, "LPF ", 4))
{
auto anm = Create<DAnmPlayer>(fr, ans, frameticks);
auto anm = Create<DAnmPlayer>(fr, ans, frameticks, nosoundcutoff);
if (!anm->isvalid())
{
Printf("%s: invalid ANM file.\n", filename);

View File

@ -106,4 +106,4 @@ struct AnimSound
int soundnum;
};
DScreenJob *PlayVideo(const char *filename, const AnimSound *ans = nullptr, const int *frameticks = nullptr);
DScreenJob *PlayVideo(const char *filename, const AnimSound *ans = nullptr, const int *frameticks = nullptr, bool nosoundstop = false);

View File

@ -89,7 +89,7 @@ void Logo(const CompletionFunc& completion)
JobDesc jobs[3];
int job = 0;
jobs[job++] = { Create<DSWDRealmsScreen>() };
jobs[job++] = { PlayVideo("sw.anm", logosound, logoframetimes)};
jobs[job++] = { PlayVideo("sw.anm", logosound, logoframetimes, true)};
RunScreenJob(jobs, job, completion, true, true);
}
else completion(false);

View File

@ -5726,7 +5726,9 @@ KeyMain:
// print to the console, and the user quote display.
FStringf msg("%s %s", GStrings("TXTS_FORTUNE"), quoteMgr.GetQuote(QUOTE_COOKIE + cookie));
Printf(TEXTCOLOR_SAPPHIRE "%s\n", msg.GetChars());
adduserquote(msg.GetChars());
strncpy(pp->cookieQuote, msg, 255);
pp->cookieQuote[255] = 0;
pp->cookieTime = totalclock + 540;
}
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup