From 0d9afc1aafd3eddbd5ddfe7274ab1a3bb5835ef7 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 5 Aug 2021 13:11:07 +1000 Subject: [PATCH] - Extend menu's `ImageScroller` ZScript class with `mAnimated` and use with Blood for the help and credits menu. --- source/common/menu/menu.cpp | 1 + source/common/menu/menu.h | 1 + source/common/menu/menudef.cpp | 4 ++++ wadsrc/static/menudef.txt | 2 ++ wadsrc/static/zscript/engine/ui/menu/imagescroller.zs | 5 ++++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index 231fb94a5..bbfe2f4a5 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -1067,6 +1067,7 @@ DEFINE_FIELD(DImageScrollerDescriptor, textBackgroundBrightness) DEFINE_FIELD(DImageScrollerDescriptor,textFont) DEFINE_FIELD(DImageScrollerDescriptor, textScale) DEFINE_FIELD(DImageScrollerDescriptor, mAnimatedTransition) +DEFINE_FIELD(DImageScrollerDescriptor, mAnimated) DEFINE_FIELD(DImageScrollerDescriptor, virtWidth) DEFINE_FIELD(DImageScrollerDescriptor, virtHeight) diff --git a/source/common/menu/menu.h b/source/common/menu/menu.h index d6f200bfc..a8ed61061 100644 --- a/source/common/menu/menu.h +++ b/source/common/menu/menu.h @@ -141,6 +141,7 @@ public: FFont *textFont; double textScale; bool mAnimatedTransition; + bool mAnimated; int virtWidth, virtHeight; }; diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index c5ce40b2a..3b6f25a1e 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -1216,6 +1216,10 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc) { desc->mAnimatedTransition = true; } + else if (sc.Compare("animated")) + { + desc->mAnimated = true; + } else if (sc.Compare("textBackground")) { sc.MustGetString(); diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 157946458..b0eb740d8 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -236,6 +236,7 @@ ImageScroller "HelpMenu" QAVDrawer "Help4.qav" QAVDrawer "Help5.qav" QAVDrawer "Help3b.qav" + animated } ifgame(ShadowWarrior) { @@ -356,6 +357,7 @@ ImageScroller "CreditsMenu" ifgame(blood) { QAVDrawer "Credits.qav" + animated } ifgame(ShadowWarrior) { diff --git a/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs b/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs index 45607448a..cab771ae7 100644 --- a/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs +++ b/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs @@ -40,6 +40,7 @@ class ImageScrollerDescriptor : MenuDescriptor native native Color textBackgroundBrightness; native double textScale; native bool mAnimatedTransition; + native bool mAnimated; native int virtWidth, virtHeight; } @@ -168,6 +169,7 @@ class ImageScrollerMenu : Menu index = 0; mDesc = desc; AnimatedTransition = desc.mAnimatedTransition; + Animated = desc.mAnimated; current = mDesc.mItems[0]; current.onStartPage(); previous = null; @@ -273,11 +275,12 @@ class ImageScrollerMenu : Menu { if (previous != null) { + bool wasAnimated = Animated; Animated = true; if (DrawTransition()) return; previous = null; + Animated = wasAnimated; } current.Drawer(false); - Animated = false; } }