From fc2818b195516b8840a8d61118c120921afe1f91 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 18 Sep 2021 12:19:35 +0200 Subject: [PATCH] - menu system update from Raze for better control of animated menus. --- src/common/menu/menu.cpp | 2 ++ src/common/menu/menu.h | 1 + src/common/menu/menudef.cpp | 8 ++++++++ wadsrc/static/shaders/glsl/main.fp | 2 +- wadsrc/static/zscript/engine/base.zs | 1 + wadsrc/static/zscript/engine/ui/menu/imagescroller.zs | 5 ++++- wadsrc/static/zscript/engine/ui/menu/listmenu.zs | 4 +++- 7 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/common/menu/menu.cpp b/src/common/menu/menu.cpp index bf773214d..bbfe2f4a5 100644 --- a/src/common/menu/menu.cpp +++ b/src/common/menu/menu.cpp @@ -1036,6 +1036,7 @@ DEFINE_FIELD(DListMenuDescriptor, mFont) DEFINE_FIELD(DListMenuDescriptor, mFontColor) DEFINE_FIELD(DListMenuDescriptor, mFontColor2) DEFINE_FIELD(DListMenuDescriptor, mAnimatedTransition) +DEFINE_FIELD(DListMenuDescriptor, mAnimated) DEFINE_FIELD(DListMenuDescriptor, mCenter) DEFINE_FIELD(DListMenuDescriptor, mVirtWidth) DEFINE_FIELD(DListMenuDescriptor, mVirtHeight) @@ -1066,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/src/common/menu/menu.h b/src/common/menu/menu.h index d6f200bfc..a8ed61061 100644 --- a/src/common/menu/menu.h +++ b/src/common/menu/menu.h @@ -141,6 +141,7 @@ public: FFont *textFont; double textScale; bool mAnimatedTransition; + bool mAnimated; int virtWidth, virtHeight; }; diff --git a/src/common/menu/menudef.cpp b/src/common/menu/menudef.cpp index b6ebefc15..280349781 100644 --- a/src/common/menu/menudef.cpp +++ b/src/common/menu/menudef.cpp @@ -344,6 +344,10 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s { desc->mAnimatedTransition = true; } + else if (sc.Compare("animated")) + { + desc->mAnimated = true; + } else if (sc.Compare("MouseWindow")) { sc.MustGetNumber(); @@ -1212,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/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index 90ad8cbee..513dae3a7 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -570,7 +570,7 @@ void SetMaterialProps(inout Material material, vec2 texCoord) if ((uTextureMode & TEXF_Detailmap) != 0) { vec4 Detail = texture(detailtexture, texCoord.st * uDetailParms.xy) * uDetailParms.z; - material.Base *= Detail; + material.Base.rgb *= Detail.rgb; } if ((uTextureMode & TEXF_Glowmap) != 0) diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 64f5921fe..95b678225 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -439,6 +439,7 @@ struct Font native enum EColorRange { CR_UNDEFINED = -1, + CR_NATIVEPAL = -1, CR_BRICK, CR_TAN, CR_GRAY, 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; } } diff --git a/wadsrc/static/zscript/engine/ui/menu/listmenu.zs b/wadsrc/static/zscript/engine/ui/menu/listmenu.zs index dc12f4129..cc4656d95 100644 --- a/wadsrc/static/zscript/engine/ui/menu/listmenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/listmenu.zs @@ -56,6 +56,7 @@ class ListMenuDescriptor : MenuDescriptor native native int mFontColor2; native bool mCenter; native bool mAnimatedTransition; + native bool mAnimated; native int mVirtWidth, mVirtHeight; native void Reset(); @@ -87,6 +88,7 @@ class ListMenu : Menu Super.Init(parent); mDesc = desc; AnimatedTransition = mDesc.mAnimatedTransition; + Animated = mDesc.mAnimated; if (desc.mCenter) { double center = 160; @@ -258,7 +260,7 @@ class ListMenu : Menu { for(int i=0;i