- menu system update from Raze for better control of animated menus.

This commit is contained in:
Christoph Oelckers 2021-09-18 12:19:35 +02:00
parent 31de21e6aa
commit fc2818b195
7 changed files with 20 additions and 3 deletions

View file

@ -1036,6 +1036,7 @@ DEFINE_FIELD(DListMenuDescriptor, mFont)
DEFINE_FIELD(DListMenuDescriptor, mFontColor) DEFINE_FIELD(DListMenuDescriptor, mFontColor)
DEFINE_FIELD(DListMenuDescriptor, mFontColor2) DEFINE_FIELD(DListMenuDescriptor, mFontColor2)
DEFINE_FIELD(DListMenuDescriptor, mAnimatedTransition) DEFINE_FIELD(DListMenuDescriptor, mAnimatedTransition)
DEFINE_FIELD(DListMenuDescriptor, mAnimated)
DEFINE_FIELD(DListMenuDescriptor, mCenter) DEFINE_FIELD(DListMenuDescriptor, mCenter)
DEFINE_FIELD(DListMenuDescriptor, mVirtWidth) DEFINE_FIELD(DListMenuDescriptor, mVirtWidth)
DEFINE_FIELD(DListMenuDescriptor, mVirtHeight) DEFINE_FIELD(DListMenuDescriptor, mVirtHeight)
@ -1066,6 +1067,7 @@ DEFINE_FIELD(DImageScrollerDescriptor, textBackgroundBrightness)
DEFINE_FIELD(DImageScrollerDescriptor,textFont) DEFINE_FIELD(DImageScrollerDescriptor,textFont)
DEFINE_FIELD(DImageScrollerDescriptor, textScale) DEFINE_FIELD(DImageScrollerDescriptor, textScale)
DEFINE_FIELD(DImageScrollerDescriptor, mAnimatedTransition) DEFINE_FIELD(DImageScrollerDescriptor, mAnimatedTransition)
DEFINE_FIELD(DImageScrollerDescriptor, mAnimated)
DEFINE_FIELD(DImageScrollerDescriptor, virtWidth) DEFINE_FIELD(DImageScrollerDescriptor, virtWidth)
DEFINE_FIELD(DImageScrollerDescriptor, virtHeight) DEFINE_FIELD(DImageScrollerDescriptor, virtHeight)

View file

@ -141,6 +141,7 @@ public:
FFont *textFont; FFont *textFont;
double textScale; double textScale;
bool mAnimatedTransition; bool mAnimatedTransition;
bool mAnimated;
int virtWidth, virtHeight; int virtWidth, virtHeight;
}; };

View file

@ -344,6 +344,10 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
{ {
desc->mAnimatedTransition = true; desc->mAnimatedTransition = true;
} }
else if (sc.Compare("animated"))
{
desc->mAnimated = true;
}
else if (sc.Compare("MouseWindow")) else if (sc.Compare("MouseWindow"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();
@ -1212,6 +1216,10 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc)
{ {
desc->mAnimatedTransition = true; desc->mAnimatedTransition = true;
} }
else if (sc.Compare("animated"))
{
desc->mAnimated = true;
}
else if (sc.Compare("textBackground")) else if (sc.Compare("textBackground"))
{ {
sc.MustGetString(); sc.MustGetString();

View file

@ -570,7 +570,7 @@ void SetMaterialProps(inout Material material, vec2 texCoord)
if ((uTextureMode & TEXF_Detailmap) != 0) if ((uTextureMode & TEXF_Detailmap) != 0)
{ {
vec4 Detail = texture(detailtexture, texCoord.st * uDetailParms.xy) * uDetailParms.z; vec4 Detail = texture(detailtexture, texCoord.st * uDetailParms.xy) * uDetailParms.z;
material.Base *= Detail; material.Base.rgb *= Detail.rgb;
} }
if ((uTextureMode & TEXF_Glowmap) != 0) if ((uTextureMode & TEXF_Glowmap) != 0)

View file

@ -439,6 +439,7 @@ struct Font native
enum EColorRange enum EColorRange
{ {
CR_UNDEFINED = -1, CR_UNDEFINED = -1,
CR_NATIVEPAL = -1,
CR_BRICK, CR_BRICK,
CR_TAN, CR_TAN,
CR_GRAY, CR_GRAY,

View file

@ -40,6 +40,7 @@ class ImageScrollerDescriptor : MenuDescriptor native
native Color textBackgroundBrightness; native Color textBackgroundBrightness;
native double textScale; native double textScale;
native bool mAnimatedTransition; native bool mAnimatedTransition;
native bool mAnimated;
native int virtWidth, virtHeight; native int virtWidth, virtHeight;
} }
@ -168,6 +169,7 @@ class ImageScrollerMenu : Menu
index = 0; index = 0;
mDesc = desc; mDesc = desc;
AnimatedTransition = desc.mAnimatedTransition; AnimatedTransition = desc.mAnimatedTransition;
Animated = desc.mAnimated;
current = mDesc.mItems[0]; current = mDesc.mItems[0];
current.onStartPage(); current.onStartPage();
previous = null; previous = null;
@ -273,11 +275,12 @@ class ImageScrollerMenu : Menu
{ {
if (previous != null) if (previous != null)
{ {
bool wasAnimated = Animated;
Animated = true; Animated = true;
if (DrawTransition()) return; if (DrawTransition()) return;
previous = null; previous = null;
Animated = wasAnimated;
} }
current.Drawer(false); current.Drawer(false);
Animated = false;
} }
} }

View file

@ -56,6 +56,7 @@ class ListMenuDescriptor : MenuDescriptor native
native int mFontColor2; native int mFontColor2;
native bool mCenter; native bool mCenter;
native bool mAnimatedTransition; native bool mAnimatedTransition;
native bool mAnimated;
native int mVirtWidth, mVirtHeight; native int mVirtWidth, mVirtHeight;
native void Reset(); native void Reset();
@ -87,6 +88,7 @@ class ListMenu : Menu
Super.Init(parent); Super.Init(parent);
mDesc = desc; mDesc = desc;
AnimatedTransition = mDesc.mAnimatedTransition; AnimatedTransition = mDesc.mAnimatedTransition;
Animated = mDesc.mAnimated;
if (desc.mCenter) if (desc.mCenter)
{ {
double center = 160; double center = 160;
@ -258,7 +260,7 @@ class ListMenu : Menu
{ {
for(int i=0;i<mDesc.mItems.Size(); i++) for(int i=0;i<mDesc.mItems.Size(); i++)
{ {
if (mDesc.mItems[i].CheckCoordinate(x, y)) if (mDesc.mItems[i].Selectable() && mDesc.mItems[i].CheckCoordinate(x, y))
{ {
if (i != mDesc.mSelectedItem) if (i != mDesc.mSelectedItem)
{ {