Added animation support for OptionMenus

Adds Animated and AnimatedTransition MENUDEF instructions for OptionMenus. Added DontDim and DontBlur MENUDEF instructions for all menus.
This commit is contained in:
Boondorl 2022-11-23 22:56:40 -05:00 committed by Christoph Oelckers
parent b002d5b8ec
commit f322792783
7 changed files with 82 additions and 3 deletions

View file

@ -1033,6 +1033,8 @@ DEFINE_FIELD(DListMenuDescriptor, mFontColor2)
DEFINE_FIELD(DListMenuDescriptor, mAnimatedTransition)
DEFINE_FIELD(DListMenuDescriptor, mAnimated)
DEFINE_FIELD(DListMenuDescriptor, mCenter)
DEFINE_FIELD(DListMenuDescriptor, mDontDim)
DEFINE_FIELD(DListMenuDescriptor, mDontBlur)
DEFINE_FIELD(DListMenuDescriptor, mVirtWidth)
DEFINE_FIELD(DListMenuDescriptor, mVirtHeight)
@ -1045,6 +1047,9 @@ DEFINE_FIELD(DOptionMenuDescriptor, mScrollPos)
DEFINE_FIELD(DOptionMenuDescriptor, mIndent)
DEFINE_FIELD(DOptionMenuDescriptor, mPosition)
DEFINE_FIELD(DOptionMenuDescriptor, mDontDim)
DEFINE_FIELD(DOptionMenuDescriptor, mDontBlur)
DEFINE_FIELD(DOptionMenuDescriptor, mAnimatedTransition)
DEFINE_FIELD(DOptionMenuDescriptor, mAnimated)
DEFINE_FIELD(DOptionMenuDescriptor, mFont)
DEFINE_FIELD(FOptionMenuSettings, mTitleColor)
@ -1063,6 +1068,8 @@ DEFINE_FIELD(DImageScrollerDescriptor,textFont)
DEFINE_FIELD(DImageScrollerDescriptor, textScale)
DEFINE_FIELD(DImageScrollerDescriptor, mAnimatedTransition)
DEFINE_FIELD(DImageScrollerDescriptor, mAnimated)
DEFINE_FIELD(DImageScrollerDescriptor, mDontDim)
DEFINE_FIELD(DImageScrollerDescriptor, mDontBlur)
DEFINE_FIELD(DImageScrollerDescriptor, virtWidth)
DEFINE_FIELD(DImageScrollerDescriptor, virtHeight)

View file

@ -91,6 +91,8 @@ public:
bool mFromEngine;
bool mAnimated;
bool mAnimatedTransition;
bool mDontDim;
bool mDontBlur;
int mVirtWidth;
int mVirtHeight;
bool mCustomSizeSet;
@ -124,6 +126,9 @@ public:
int mIndent;
int mPosition;
bool mDontDim;
bool mDontBlur;
bool mAnimatedTransition;
bool mAnimated;
FFont *mFont;
void CalcIndent();
@ -143,6 +148,8 @@ public:
double textScale;
bool mAnimatedTransition;
bool mAnimated;
bool mDontDim;
bool mDontBlur;
int virtWidth, virtHeight;
};

View file

@ -358,6 +358,14 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
{
desc->mAnimated = true;
}
else if (sc.Compare("DontDim"))
{
desc->mDontDim = true;
}
else if (sc.Compare("DontBlur"))
{
desc->mDontBlur = true;
}
else if (sc.Compare("MouseWindow"))
{
sc.MustGetNumber();
@ -763,6 +771,10 @@ static void ParseListMenu(FScanner &sc)
desc->mFromEngine = fileSystem.GetFileContainer(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD.
desc->mVirtWidth = -2;
desc->mCustomSizeSet = false;
desc->mAnimatedTransition = false;
desc->mAnimated = false;
desc->mDontDim = false;
desc->mDontBlur = false;
desc->mForceList = false;
if (DefaultListMenuSettings->mCustomSizeSet)
{
@ -1020,6 +1032,22 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc, int i
sc.MustGetNumber();
desc->mIndent = sc.Number;
}
else if (sc.Compare("AnimatedTransition"))
{
desc->mAnimatedTransition = true;
}
else if (sc.Compare("Animated"))
{
desc->mAnimated = true;
}
else if (sc.Compare("DontDim"))
{
desc->mDontDim = true;
}
else if (sc.Compare("DontBlur"))
{
desc->mDontBlur = true;
}
else
{
bool success = false;
@ -1189,7 +1217,10 @@ static void ParseOptionMenu(FScanner &sc)
desc->mPosition = DefaultOptionMenuSettings->mPosition;
desc->mScrollTop = DefaultOptionMenuSettings->mScrollTop;
desc->mIndent = DefaultOptionMenuSettings->mIndent;
desc->mDontDim = DefaultOptionMenuSettings->mDontDim;
desc->mDontDim = false;
desc->mDontBlur = false;
desc->mAnimatedTransition = false;
desc->mAnimated = false;
desc->mProtected = sc.CheckString("protected");
ParseOptionMenuBody(sc, desc, -1);
@ -1275,6 +1306,14 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc)
{
desc->mAnimated = true;
}
else if (sc.Compare("DontDim"))
{
desc->mDontDim = true;
}
else if (sc.Compare("DontBlur"))
{
desc->mDontBlur = true;
}
else if (sc.Compare("textBackground"))
{
sc.MustGetString();
@ -1450,7 +1489,10 @@ static void ParseImageScroller(FScanner& sc)
desc->textBackgroundBrightness = 0xffffffff;
desc->textFont = SmallFont;
desc->textScale = 1;
desc->mDontDim = false;
desc->mDontBlur = false;
desc->mAnimatedTransition = false;
desc->mAnimated = false;
desc->virtWidth = 320;
desc->virtHeight = 200;

View file

@ -694,6 +694,9 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
od->mScrollTop = 0;
od->mIndent = 160;
od->mDontDim = false;
od->mDontBlur = false;
od->mAnimatedTransition = false;
od->mAnimated = false;
GC::WriteBarrier(od);
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
{
@ -829,6 +832,9 @@ static void BuildPlayerclassMenu()
od->mScrollTop = 0;
od->mIndent = 160;
od->mDontDim = false;
od->mDontBlur = false;
od->mAnimatedTransition = false;
od->mAnimated = false;
od->mNetgameMessage = "$NEWGAME";
GC::WriteBarrier(od);
for (unsigned i = 0; i < PlayerClasses.Size (); i++)
@ -1252,6 +1258,9 @@ fail:
od->mScrollTop = 0;
od->mIndent = 160;
od->mDontDim = false;
od->mDontBlur = false;
od->mAnimatedTransition = false;
od->mAnimated = false;
GC::WriteBarrier(od);
}
else

View file

@ -41,6 +41,8 @@ class ImageScrollerDescriptor : MenuDescriptor native
native double textScale;
native bool mAnimatedTransition;
native bool mAnimated;
native bool mDontBlur;
native bool mDontDim;
native int virtWidth, virtHeight;
}
@ -168,8 +170,10 @@ class ImageScrollerMenu : Menu
mParentMenu = parent;
index = 0;
mDesc = desc;
AnimatedTransition = desc.mAnimatedTransition;
Animated = desc.mAnimated;
AnimatedTransition = mDesc.mAnimatedTransition;
Animated = mDesc.mAnimated;
DontBlur = mDesc.mDontBlur;
DontDim = mDesc.mDontDim;
current = mDesc.mItems[0];
current.onStartPage();
previous = null;

View file

@ -57,6 +57,8 @@ class ListMenuDescriptor : MenuDescriptor native
native bool mCenter;
native bool mAnimatedTransition;
native bool mAnimated;
native bool mDontBlur;
native bool mDontDim;
native int mVirtWidth, mVirtHeight;
native void Reset();
@ -89,6 +91,8 @@ class ListMenu : Menu
mDesc = desc;
AnimatedTransition = mDesc.mAnimatedTransition;
Animated = mDesc.mAnimated;
DontBlur = mDesc.mDontBlur;
DontDim = mDesc.mDontDim;
if (desc.mCenter)
{
double center = 160;

View file

@ -55,6 +55,9 @@ class OptionMenuDescriptor : MenuDescriptor native
native int mIndent;
native int mPosition;
native bool mDontDim;
native bool mDontBlur;
native bool mAnimatedTransition;
native bool mAnimated;
native Font mFont;
void Reset()
@ -106,6 +109,9 @@ class OptionMenu : Menu
mParentMenu = parent;
mDesc = desc;
DontDim = desc.mDontDim;
DontBlur = desc.mDontBlur;
AnimatedTransition = desc.mAnimatedTransition;
Animated = desc.mAnimated;
let itemCount = mDesc.mItems.size();
if (itemCount > 0)