mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 21:41:03 +00:00
- fixed music in intermissions.
The starting of the first screen's music must be delayed until the playback of this screen actually starts. Since the controller objects are created up front it cannot be done in the Init() method anymore.
This commit is contained in:
parent
30a0177352
commit
e639030276
3 changed files with 41 additions and 7 deletions
|
@ -144,12 +144,7 @@ void DrawFullscreenSubtitle(FFont* font, const char *text)
|
||||||
|
|
||||||
void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
|
void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
|
||||||
{
|
{
|
||||||
if (desc->mMusic.IsEmpty())
|
if (!first && desc->mMusic.IsNotEmpty())
|
||||||
{
|
|
||||||
// only start the default music if this is the first action in an intermission
|
|
||||||
if (first) S_ChangeMusic (gameinfo.finaleMusic, gameinfo.finaleOrder, desc->mMusicLooping);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
S_ChangeMusic (desc->mMusic, desc->mMusicOrder, desc->mMusicLooping);
|
S_ChangeMusic (desc->mMusic, desc->mMusicOrder, desc->mMusicLooping);
|
||||||
}
|
}
|
||||||
|
@ -193,8 +188,27 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
|
||||||
}
|
}
|
||||||
mTicker = 0;
|
mTicker = 0;
|
||||||
mSubtitle = desc->mSubtitle;
|
mSubtitle = desc->mSubtitle;
|
||||||
|
mFirst = first;
|
||||||
|
// If this is the first element of an intermission we must delay starting the music until Start() is called.
|
||||||
|
mMusic = desc->mMusic;
|
||||||
|
mMusicLooping = desc->mMusicLooping;
|
||||||
|
mMusicOrder = desc->mMusicOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DIntermissionScreen::Start()
|
||||||
|
{
|
||||||
|
if (mFirst)
|
||||||
|
{
|
||||||
|
if (mMusic.IsEmpty())
|
||||||
|
{
|
||||||
|
S_ChangeMusic(gameinfo.finaleMusic, gameinfo.finaleOrder, mMusicLooping);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
S_ChangeMusic(mMusic, mMusicOrder, mMusicLooping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int DIntermissionScreen::Responder (FInputEvent *ev)
|
int DIntermissionScreen::Responder (FInputEvent *ev)
|
||||||
{
|
{
|
||||||
|
@ -900,6 +914,11 @@ again:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DIntermissionController::Start()
|
||||||
|
{
|
||||||
|
if (mScreen) mScreen->Start();
|
||||||
|
}
|
||||||
|
|
||||||
bool DIntermissionController::Responder (FInputEvent *ev)
|
bool DIntermissionController::Responder (FInputEvent *ev)
|
||||||
{
|
{
|
||||||
if (mScreen != NULL)
|
if (mScreen != NULL)
|
||||||
|
@ -1042,6 +1061,13 @@ DEFINE_ACTION_FUNCTION(DIntermissionController, Ticker)
|
||||||
ACTION_RETURN_BOOL(self->Ticker());
|
ACTION_RETURN_BOOL(self->Ticker());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DIntermissionController, Start)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DIntermissionController);
|
||||||
|
self->Start();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DIntermissionController, Drawer)
|
DEFINE_ACTION_FUNCTION(DIntermissionController, Drawer)
|
||||||
{
|
{
|
||||||
PARAM_SELF_PROLOGUE(DIntermissionController);
|
PARAM_SELF_PROLOGUE(DIntermissionController);
|
||||||
|
|
|
@ -166,7 +166,11 @@ protected:
|
||||||
int mDuration;
|
int mDuration;
|
||||||
FTextureID mBackground;
|
FTextureID mBackground;
|
||||||
FString mSubtitle;
|
FString mSubtitle;
|
||||||
|
FString mMusic;
|
||||||
|
int mMusicOrder;
|
||||||
|
bool mMusicLooping;
|
||||||
bool mFlatfill;
|
bool mFlatfill;
|
||||||
|
bool mFirst;
|
||||||
TArray<FIIntermissionPatch> mOverlays;
|
TArray<FIIntermissionPatch> mOverlays;
|
||||||
|
|
||||||
bool CheckOverlay(int i);
|
bool CheckOverlay(int i);
|
||||||
|
@ -176,6 +180,7 @@ public:
|
||||||
|
|
||||||
DIntermissionScreen() {}
|
DIntermissionScreen() {}
|
||||||
virtual void Init(FIntermissionAction *desc, bool first);
|
virtual void Init(FIntermissionAction *desc, bool first);
|
||||||
|
virtual void Start();
|
||||||
virtual int Responder (FInputEvent *ev);
|
virtual int Responder (FInputEvent *ev);
|
||||||
virtual int Ticker ();
|
virtual int Ticker ();
|
||||||
virtual void Drawer ();
|
virtual void Drawer ();
|
||||||
|
@ -304,6 +309,7 @@ public:
|
||||||
DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false, bool ending = false);
|
DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false, bool ending = false);
|
||||||
bool Responder (FInputEvent *ev);
|
bool Responder (FInputEvent *ev);
|
||||||
bool Ticker ();
|
bool Ticker ();
|
||||||
|
void Start();
|
||||||
void Drawer ();
|
void Drawer ();
|
||||||
void OnDestroy() override;
|
void OnDestroy() override;
|
||||||
bool NextPage();
|
bool NextPage();
|
||||||
|
|
|
@ -5,6 +5,7 @@ class IntermissionController native ui
|
||||||
// This is mostly a black box to the native intermission code.
|
// This is mostly a black box to the native intermission code.
|
||||||
// May be scriptified later, but right now we do not need it.
|
// May be scriptified later, but right now we do not need it.
|
||||||
|
|
||||||
|
native void Start();
|
||||||
native bool Responder(InputEvent ev);
|
native bool Responder(InputEvent ev);
|
||||||
native bool Ticker();
|
native bool Ticker();
|
||||||
native void Drawer();
|
native void Drawer();
|
||||||
|
@ -24,6 +25,7 @@ class IntermissionScreenJob : ScreenJob
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void Start() { controller.Start(); }
|
||||||
override bool OnEvent(InputEvent evt) { return controller.Responder(evt); }
|
override bool OnEvent(InputEvent evt) { return controller.Responder(evt); }
|
||||||
override void OnTick() { if (!controller.Ticker()) jobstate = finished; }
|
override void OnTick() { if (!controller.Ticker()) jobstate = finished; }
|
||||||
override void Draw(double smoothratio) { controller.Drawer(); }
|
override void Draw(double smoothratio) { controller.Drawer(); }
|
||||||
|
|
Loading…
Reference in a new issue