mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 06:42:12 +00:00
- wrapper classes to run existing intermissions and status screens as screenjobs.
This commit is contained in:
parent
390bf58698
commit
0d23db5b4a
1 changed files with 62 additions and 0 deletions
62
wadsrc/static/zscript/ui/intermission.zs
Normal file
62
wadsrc/static/zscript/ui/intermission.zs
Normal file
|
@ -0,0 +1,62 @@
|
|||
|
||||
|
||||
class IntermissionController native
|
||||
{
|
||||
// This is mostly a black box to the native intermission code.
|
||||
// May be scriptified later, but right now we do not need it.
|
||||
static native IntermissionController Creeate(String music, int musicorder, String flat, String text, int textInLump, int finalePic, int lookupText, bool ending, Name endsequence);
|
||||
static native IntermissionController CreateNamed(Name nm);
|
||||
native bool Responder(InputEvent ev);
|
||||
native bool Ticker();
|
||||
native void Drawer();
|
||||
native bool NextPage();
|
||||
}
|
||||
|
||||
// Wrappers to play the old intermissions and status screens within a screen job.
|
||||
class IntermissionScreenJob : ScreenJob
|
||||
{
|
||||
IntermissionController controller;
|
||||
|
||||
void Init(String music, int musicorder, String flat, String text, int textInLump, int finalePic, int lookupText, bool ending, Name endsequence)
|
||||
{
|
||||
controller = IntermissionController.Create(music, musicorder, flat, text, textInLump, finalePic, lookupText, ending, endsequence);
|
||||
}
|
||||
|
||||
void InitNamed(Name nm)
|
||||
{
|
||||
controller = IntermissionController.CreateNamed(nm);
|
||||
}
|
||||
|
||||
override bool OnEvent(InputEvent evt) { return controller.Responder(evt); }
|
||||
virtual void OnTick() { if (!controller.Ticker()) jobstate = finished; }
|
||||
virtual void Draw(double smoothratio) { controller.Drawer(); }
|
||||
virtual void OnSkip() { if (!controller.NextPage()) jobstate = finished; }
|
||||
|
||||
override void OnDestroy()
|
||||
{
|
||||
controller.Destroy();
|
||||
Super.OnDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class StatusScreenJob : ScreenJob
|
||||
{
|
||||
StatusScreen controller;
|
||||
|
||||
void Init(StatusScreen scr)
|
||||
{
|
||||
controller = scr;
|
||||
}
|
||||
|
||||
override bool OnEvent(InputEvent evt) { return controller.Responder(evt); }
|
||||
virtual void OnTick() { controller.Ticker(); if (controller.CurState == StatusScreen.LeavingIntermission) jobstate = finished; }
|
||||
virtual void Draw(double smoothratio) { controller.Drawer(); }
|
||||
virtual void OnSkip() { if (!controller.NextStage()) jobstate = finished; }
|
||||
|
||||
override void OnDestroy()
|
||||
{
|
||||
controller.Destroy();
|
||||
Super.OnDestroy();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue