mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
- make StatusScreen inherit directly from ScreenJob
This commit is contained in:
parent
3ca8c528e0
commit
ce59b47e93
2 changed files with 37 additions and 47 deletions
|
@ -4,23 +4,22 @@ 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.
|
||||||
/*
|
|
||||||
static native IntermissionController Create(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 Responder(InputEvent ev);
|
||||||
native bool Ticker();
|
native bool Ticker();
|
||||||
native void Drawer();
|
native void Drawer();
|
||||||
native bool NextPage();
|
native bool NextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrappers to play the old intermissions and status screens within a screen job.
|
// Wrapper to play the native intermissions within a screen job.
|
||||||
class IntermissionScreenJob : ScreenJob
|
class IntermissionScreenJob : ScreenJob
|
||||||
{
|
{
|
||||||
IntermissionController controller;
|
IntermissionController controller;
|
||||||
|
|
||||||
ScreenJob Init(IntermissionController ctrl)
|
ScreenJob Init(IntermissionController ctrl, bool allowwipe)
|
||||||
{
|
{
|
||||||
|
Super.Init();
|
||||||
|
if (allowwipe && wipetype != 0) flags = wipetype << ScreenJob.transition_shift;
|
||||||
controller = ctrl;
|
controller = ctrl;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -37,29 +36,6 @@ class IntermissionScreenJob : ScreenJob
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class StatusScreenJob : ScreenJob
|
|
||||||
{
|
|
||||||
StatusScreen controller;
|
|
||||||
|
|
||||||
ScreenJob Init(StatusScreen scr, bool allowwipe)
|
|
||||||
{
|
|
||||||
if (allowwipe && wipetype != 0) flags |= wipetype << ScreenJob.transition_shift;
|
|
||||||
controller = scr;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
override void OnTick() { controller.Ticker(); if (controller.CurState == StatusScreen.LeavingIntermission) jobstate = finished; }
|
|
||||||
override void Draw(double smoothratio) { controller.Drawer(); }
|
|
||||||
override bool OnEvent(InputEvent evt) { return controller.Responder(evt); }
|
|
||||||
|
|
||||||
override void OnDestroy()
|
|
||||||
{
|
|
||||||
controller.Destroy();
|
|
||||||
Super.OnDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class DoomCutscenes ui
|
class DoomCutscenes ui
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -72,11 +48,11 @@ class DoomCutscenes ui
|
||||||
{
|
{
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
runner.Append(new("StatusScreenJob").Init(status));
|
runner.Append(status);
|
||||||
}
|
}
|
||||||
if (inter)
|
if (inter)
|
||||||
{
|
{
|
||||||
runner.Append(new("IntermissionScreenJob").Init(inter, status != nullptr));
|
runner.Append(new("IntermissionScreenJob").Init(inter, status != null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct PatchInfo ui version("2.5")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class StatusScreen abstract ui version("2.5")
|
class StatusScreen : ScreenJob abstract version("2.5")
|
||||||
{
|
{
|
||||||
enum EValues
|
enum EValues
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ class StatusScreen abstract ui version("2.5")
|
||||||
float shadowalpha;
|
float shadowalpha;
|
||||||
|
|
||||||
PatchInfo mapname;
|
PatchInfo mapname;
|
||||||
PatchInfo finished;
|
PatchInfo finishedp;
|
||||||
PatchInfo entering;
|
PatchInfo entering;
|
||||||
PatchInfo content;
|
PatchInfo content;
|
||||||
PatchInfo author;
|
PatchInfo author;
|
||||||
|
@ -334,7 +334,7 @@ class StatusScreen abstract ui version("2.5")
|
||||||
|
|
||||||
if (!TexMan.OkForLocalization(finishedPatch, "$WI_FINISHED"))
|
if (!TexMan.OkForLocalization(finishedPatch, "$WI_FINISHED"))
|
||||||
{
|
{
|
||||||
disp += finished.mFont.GetMaxAscender("$WI_FINISHED");
|
disp += finishedp.mFont.GetMaxAscender("$WI_FINISHED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -349,10 +349,10 @@ class StatusScreen abstract ui version("2.5")
|
||||||
// draw "Finished!"
|
// draw "Finished!"
|
||||||
|
|
||||||
int statsy = multiplayer? NG_STATSY : SP_STATSY * scaleFactorY;
|
int statsy = multiplayer? NG_STATSY : SP_STATSY * scaleFactorY;
|
||||||
if (y < (statsy - finished.mFont.GetHeight()*3/4) * scaleFactorY)
|
if (y < (statsy - finishedp.mFont.GetHeight()*3/4) * scaleFactorY)
|
||||||
{
|
{
|
||||||
// don't draw 'finished' if the level name is too tall
|
// don't draw 'finished' if the level name is too tall
|
||||||
y = DrawPatchOrText(y, finished, finishedPatch, "$WI_FINISHED");
|
y = DrawPatchOrText(y, finishedp, finishedPatch, "$WI_FINISHED");
|
||||||
}
|
}
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ class StatusScreen abstract ui version("2.5")
|
||||||
|
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
// checkForAccelerate
|
//
|
||||||
// Purpose: See if the player has hit either the attack or use key
|
// Purpose: See if the player has hit either the attack or use key
|
||||||
// or mouse button. If so we set acceleratestage to 1 and
|
// or mouse button. If so we set acceleratestage to 1 and
|
||||||
// all those display routines above jump right to the end.
|
// all those display routines above jump right to the end.
|
||||||
|
@ -796,7 +796,7 @@ class StatusScreen abstract ui version("2.5")
|
||||||
//
|
//
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
virtual bool Responder(InputEvent evt)
|
override bool OnEvent(InputEvent evt)
|
||||||
{
|
{
|
||||||
if (evt.type == InputEvent.Type_KeyDown)
|
if (evt.type == InputEvent.Type_KeyDown)
|
||||||
{
|
{
|
||||||
|
@ -806,9 +806,14 @@ class StatusScreen abstract ui version("2.5")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkForAccelerate()
|
void nextStage()
|
||||||
|
{
|
||||||
|
accelerateStage = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this one is no longer used, but still needed for old content referencing them.
|
||||||
|
deprecated("4.8") void checkForAccelerate()
|
||||||
{
|
{
|
||||||
// no longer used, but still needed for old content.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
@ -827,11 +832,11 @@ class StatusScreen abstract ui version("2.5")
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
//
|
//
|
||||||
//
|
// Two stage interface to allow redefining this class as a screen job
|
||||||
//
|
//
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
||||||
virtual void Ticker(void)
|
protected virtual void Ticker()
|
||||||
{
|
{
|
||||||
// counter for general background animation
|
// counter for general background animation
|
||||||
bcnt++;
|
bcnt++;
|
||||||
|
@ -858,18 +863,23 @@ class StatusScreen abstract ui version("2.5")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LeavingIntermission:
|
case LeavingIntermission:
|
||||||
// Hush, GCC.
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void OnTick()
|
||||||
|
{
|
||||||
|
Ticker();
|
||||||
|
if (CurState == StatusScreen.LeavingIntermission) jobstate = finished;
|
||||||
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
||||||
virtual void Drawer (void)
|
protected virtual void Drawer()
|
||||||
{
|
{
|
||||||
switch (CurState)
|
switch (CurState)
|
||||||
{
|
{
|
||||||
|
@ -890,6 +900,11 @@ class StatusScreen abstract ui version("2.5")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void Draw(double smoothratio)
|
||||||
|
{
|
||||||
|
Drawer();
|
||||||
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -917,7 +932,7 @@ class StatusScreen abstract ui version("2.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
entering.Init(gameinfo.mStatscreenEnteringFont);
|
entering.Init(gameinfo.mStatscreenEnteringFont);
|
||||||
finished.Init(gameinfo.mStatscreenFinishedFont);
|
finishedp.Init(gameinfo.mStatscreenFinishedFont);
|
||||||
mapname.Init(gameinfo.mStatscreenMapNameFont);
|
mapname.Init(gameinfo.mStatscreenMapNameFont);
|
||||||
content.Init(gameinfo.mStatscreenContentFont);
|
content.Init(gameinfo.mStatscreenContentFont);
|
||||||
author.Init(gameinfo.mStatscreenAuthorFont);
|
author.Init(gameinfo.mStatscreenAuthorFont);
|
||||||
|
@ -948,7 +963,6 @@ class StatusScreen abstract ui version("2.5")
|
||||||
scaleFactorY = CleanYfac;
|
scaleFactorY = CleanYfac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected virtual void initStats() {}
|
protected virtual void initStats() {}
|
||||||
protected virtual void updateStats() {}
|
protected virtual void updateStats() {}
|
||||||
protected virtual void drawStats() {}
|
protected virtual void drawStats() {}
|
||||||
|
|
Loading…
Reference in a new issue