mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +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)
|
||||
{
|
||||
if (desc->mMusic.IsEmpty())
|
||||
{
|
||||
// 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
|
||||
if (!first && desc->mMusic.IsNotEmpty())
|
||||
{
|
||||
S_ChangeMusic (desc->mMusic, desc->mMusicOrder, desc->mMusicLooping);
|
||||
}
|
||||
|
@ -193,8 +188,27 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
|
|||
}
|
||||
mTicker = 0;
|
||||
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)
|
||||
{
|
||||
|
@ -900,6 +914,11 @@ again:
|
|||
return false;
|
||||
}
|
||||
|
||||
void DIntermissionController::Start()
|
||||
{
|
||||
if (mScreen) mScreen->Start();
|
||||
}
|
||||
|
||||
bool DIntermissionController::Responder (FInputEvent *ev)
|
||||
{
|
||||
if (mScreen != NULL)
|
||||
|
@ -1042,10 +1061,17 @@ DEFINE_ACTION_FUNCTION(DIntermissionController, Ticker)
|
|||
ACTION_RETURN_BOOL(self->Ticker());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DIntermissionController, Start)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DIntermissionController);
|
||||
self->Start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DIntermissionController, Drawer)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DIntermissionController);
|
||||
self->Drawer ();
|
||||
self->Drawer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,11 @@ protected:
|
|||
int mDuration;
|
||||
FTextureID mBackground;
|
||||
FString mSubtitle;
|
||||
FString mMusic;
|
||||
int mMusicOrder;
|
||||
bool mMusicLooping;
|
||||
bool mFlatfill;
|
||||
bool mFirst;
|
||||
TArray<FIIntermissionPatch> mOverlays;
|
||||
|
||||
bool CheckOverlay(int i);
|
||||
|
@ -176,6 +180,7 @@ public:
|
|||
|
||||
DIntermissionScreen() {}
|
||||
virtual void Init(FIntermissionAction *desc, bool first);
|
||||
virtual void Start();
|
||||
virtual int Responder (FInputEvent *ev);
|
||||
virtual int Ticker ();
|
||||
virtual void Drawer ();
|
||||
|
@ -304,6 +309,7 @@ public:
|
|||
DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false, bool ending = false);
|
||||
bool Responder (FInputEvent *ev);
|
||||
bool Ticker ();
|
||||
void Start();
|
||||
void Drawer ();
|
||||
void OnDestroy() override;
|
||||
bool NextPage();
|
||||
|
|
|
@ -5,6 +5,7 @@ class IntermissionController native ui
|
|||
// This is mostly a black box to the native intermission code.
|
||||
// May be scriptified later, but right now we do not need it.
|
||||
|
||||
native void Start();
|
||||
native bool Responder(InputEvent ev);
|
||||
native bool Ticker();
|
||||
native void Drawer();
|
||||
|
@ -24,6 +25,7 @@ class IntermissionScreenJob : ScreenJob
|
|||
return self;
|
||||
}
|
||||
|
||||
override void Start() { controller.Start(); }
|
||||
override bool OnEvent(InputEvent evt) { return controller.Responder(evt); }
|
||||
override void OnTick() { if (!controller.Ticker()) jobstate = finished; }
|
||||
override void Draw(double smoothratio) { controller.Drawer(); }
|
||||
|
|
Loading…
Reference in a new issue