From a10aacea3a8f2cb6046446f24b4ff82da88835bc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Oct 2020 00:50:21 +0200 Subject: [PATCH] - added the QAV drawer page. --- source/blood/src/d_menu.cpp | 30 ++++++++++++++ wadsrc/static/menudef.txt | 20 ++++------ wadsrc/static/zscript/games/blood/ui/menu.zs | 39 +++++++++++++++++++ .../static/zscript/ui/menu/imagescroller.zs | 9 +++++ 4 files changed, 85 insertions(+), 13 deletions(-) diff --git a/source/blood/src/d_menu.cpp b/source/blood/src/d_menu.cpp index 7842c4ddf..9096f2a5f 100644 --- a/source/blood/src/d_menu.cpp +++ b/source/blood/src/d_menu.cpp @@ -201,5 +201,35 @@ void GameInterface::QuitToTitle() gameaction = ga_mainmenu; } +//---------------------------------------------------------------------------- +// +// +// +//---------------------------------------------------------------------------- + +DEFINE_ACTION_FUNCTION(_ImageScrollerPageQavDrawer, LoadQav) +{ + PARAM_PROLOGUE; + PARAM_STRING(str); + auto qav = new CGameMenuItemQAV(160, 100, str, false, true); + ACTION_RETURN_POINTER(qav); +} + +DEFINE_ACTION_FUNCTION(_ImageScrollerPageQavDrawer, DestroyQav) +{ + PARAM_PROLOGUE; + PARAM_POINTER(qav, CGameMenuItemQAV); + if (qav) delete qav; + return 0; +} + +DEFINE_ACTION_FUNCTION(_ImageScrollerPageQavDrawer, DrawQav) +{ + PARAM_PROLOGUE; + PARAM_POINTER(qav, CGameMenuItemQAV); + qav->Draw(); + return 0; +} + END_BLD_NS diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 0ae0f2819..16564aeed 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -212,19 +212,16 @@ ImageScroller "HelpMenu" } animatedtransition } - /* ifgame(blood) { - class "$.ImageScrollerMenu" // The duplication here is to integrate the alternating versions of HELP3 - QAVAnimationItem "Help4.qav" - QAVAnimationItem "Help5.qav" - QAVAnimationItem "Help3.qav" - QAVAnimationItem "Help4.qav" - QAVAnimationItem "Help5.qav" - QAVAnimationItem "Help3b.qav" + QAVDrawer "Help4.qav" + QAVDrawer "Help5.qav" + QAVDrawer "Help3.qav" + QAVDrawer "Help4.qav" + QAVDrawer "Help5.qav" + QAVDrawer "Help3b.qav" } - */ ifgame(ShadowWarrior) { // The menu has no default binding, but if someone tries to open it anyway show the cool retro ads that were shipped with the game. :D @@ -341,13 +338,10 @@ ImageScroller "CreditsMenu" TextItem "REDNECK RAMPAGE RIDES AGAIN\n(c) 1998 XATRIX ENTERTAINMENT, INC.\n\nREDNECK RAMPAGE RIDES AGAIN\nIS A TRADEMARK OF\nINTERPLAY PRODUCTIONS" //, 70 animatedtransition } - /* ifgame(blood) { - class "Blood.ImageScrollerMenu" - QAVAnimationItem "Credits.qav" + QAVDrawer "Credits.qav" } - */ ifgame(ShadowWarrior) { ifgame (shareware) diff --git a/wadsrc/static/zscript/games/blood/ui/menu.zs b/wadsrc/static/zscript/games/blood/ui/menu.zs index 51f539dee..775afb5d3 100644 --- a/wadsrc/static/zscript/games/blood/ui/menu.zs +++ b/wadsrc/static/zscript/games/blood/ui/menu.zs @@ -90,3 +90,42 @@ class ListMenuItemBloodTextItem : ListMenuItemTextItem } + +class ImageScrollerPageQavDrawer : ImageScrollerPage +{ + String qavn; + voidptr qav; + + void Init(ImageScrollerDescriptor desc, String qavname) + { + Super.Init(); + qavn = qavname; + qav = null; + } + + override void OnDestroy() + { + if (qav) DestroyQav(qav); + Super.OnDestroy(); + } + + override void Drawer(bool selected) + { + if (qav) DrawQav(qav); + } + + override void OnStartPage() + { + qav = LoadQav(qavn); + } + + override void OnEndPage() + { + if (qav) DestroyQav(qav); + qav = null; + } + + native static voidptr LoadQav(string s); + native static void DestroyQav(voidptr s); + native static void DrawQav(voidptr s); +} diff --git a/wadsrc/static/zscript/ui/menu/imagescroller.zs b/wadsrc/static/zscript/ui/menu/imagescroller.zs index db4c5b273..a5e581c71 100644 --- a/wadsrc/static/zscript/ui/menu/imagescroller.zs +++ b/wadsrc/static/zscript/ui/menu/imagescroller.zs @@ -56,6 +56,12 @@ class ImageScrollerPage : MenuItemBase { screen.DrawTexture(tex, true, x, y, DTA_VirtualWidth, virtWidth, DTA_VirtualHeight, virtHeight, DTA_FullscreenScale, FSMode_ScaleToFit43); } + + virtual void OnStartPage() + {} + + virtual void OnEndPage() + {} } //============================================================================= @@ -152,6 +158,7 @@ class ImageScrollerMenu : Menu dir = animtype; previous = current; } + to.onStartPage(); current = to; } @@ -162,6 +169,7 @@ class ImageScrollerMenu : Menu mDesc = desc; AnimatedTransition = desc.mAnimatedTransition; current = mDesc.mItems[0]; + current.onStartPage(); previous = null; } @@ -250,6 +258,7 @@ class ImageScrollerMenu : Menu screen.SetOffset(0, 0); return true; } + previous.OnEndPage(); previous = null; return false; }