- animated transitions are working.

This commit is contained in:
Christoph Oelckers 2019-11-26 22:05:52 +01:00
parent 248c2feba2
commit 46d1f8517a
5 changed files with 45 additions and 8 deletions

View file

@ -64,6 +64,7 @@ void DListMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
{ {
mParentMenu = parent; mParentMenu = parent;
mDesc = desc; mDesc = desc;
canAnimate = !!(mDesc->mFlags & LMF_Animate);
if (mDesc->mScriptId >= 0) scriptID = mDesc->mScriptId; if (mDesc->mScriptId >= 0) scriptID = mDesc->mScriptId;
#if 0 #if 0
if (desc->mCenter) if (desc->mCenter)

View file

@ -133,6 +133,7 @@ bool M_DrawTransition(MenuTransition &transition)
transition.previous->origin.X = factor * transition.dir * (sin(phase) - 1.); transition.previous->origin.X = factor * transition.dir * (sin(phase) - 1.);
transition.current->origin.X = factor * transition.dir * (sin(phase) + 1.); transition.current->origin.X = factor * transition.dir * (sin(phase) + 1.);
Printf("prev.X = %2.5f, next.X = %2.5f\n", transition.previous->origin.X, transition.current->origin.X);
transition.previous->Drawer(); transition.previous->Drawer();
transition.current->Drawer(); transition.current->Drawer();
return true; return true;
@ -763,6 +764,7 @@ void M_Ticker (void)
if (DMenu::MenuTime & 3) return; if (DMenu::MenuTime & 3) return;
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off) if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
{ {
if (transition.previous) transition.previous->Ticker();
DMenu::CurrentMenu->Ticker(); DMenu::CurrentMenu->Ticker();
for (int i = 0; i < NUM_MKEYS; ++i) for (int i = 0; i < NUM_MKEYS; ++i)
@ -804,18 +806,18 @@ void M_Drawer (void)
{ {
if (DMenu::CurrentMenu->DimAllowed() && fade && !DrawBackground) twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade); if (DMenu::CurrentMenu->DimAllowed() && fade && !DrawBackground) twod.AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
bool done = false; bool going = false;
if (transition.previous) if (transition.previous)
{ {
done = M_DrawTransition(transition); going = M_DrawTransition(transition);
if (!done) if (!going)
{ {
delete transition.previous; if (transition.dir == -1) delete transition.previous;
transition.previous = nullptr; transition.previous = nullptr;
transition.current = nullptr; transition.current = nullptr;
} }
} }
if (!done) if (!going)
{ {
DMenu::CurrentMenu->origin = { 0,0 }; DMenu::CurrentMenu->origin = { 0,0 };
// else if (DrawBackground) Menu_DrawBackground(origin); // else if (DrawBackground) Menu_DrawBackground(origin);

View file

@ -167,7 +167,8 @@ class FOptionMenuItem;
enum ListMenuFlags enum ListMenuFlags
{ {
LMF_Centered = 1, LMF_Centered = 1,
LMF_DontSpace = 2 LMF_DontSpace = 2,
LMF_Animate = 4,
}; };
struct FListMenuDescriptor : public FMenuDescriptor struct FListMenuDescriptor : public FMenuDescriptor
@ -318,7 +319,7 @@ public:
static int MenuTime; static int MenuTime;
DMenu *mParentMenu; DMenu *mParentMenu;
DVector2 origin; DVector2 origin = { 0,0 };
int scriptID = INT_MAX; int scriptID = INT_MAX;
bool canAnimate = false; bool canAnimate = false;

View file

@ -284,6 +284,10 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
{ {
desc->mFlags |= LMF_Centered; desc->mFlags |= LMF_Centered;
} }
else if (sc.Compare("animatedtransition"))
{
desc->mFlags |= LMF_Animate;
}
else if (sc.Compare("Fixedspacing")) else if (sc.Compare("Fixedspacing"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();

View file

@ -18,6 +18,7 @@ LISTMENU "MainMenu"
{ {
position 160, 55, 115 position 160, 55, 115
centermenu centermenu
animatedtransition
} }
class "Duke.MainMenu" class "Duke.MainMenu"
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
@ -81,6 +82,7 @@ LISTMENU "IngameMenu"
{ {
position 160, 55, 115 position 160, 55, 115
centermenu centermenu
animatedtransition
} }
linespacing 15 linespacing 15
class "Duke.MainMenu" class "Duke.MainMenu"
@ -134,6 +136,7 @@ LISTMENU "EpisodeMenu"
position 160, 48, 142 position 160, 48, 142
centermenu centermenu
fixedspacing 5 fixedspacing 5
animatedtransition
class "Duke.ListMenu" class "Duke.ListMenu"
} }
@ -149,17 +152,20 @@ LISTMENU "SkillMenu"
centermenu centermenu
fixedspacing 5 fixedspacing 5
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
ScriptId 110 ScriptId 110
} }
// The custom menus are only supported by the EDuke32 frontend.
LISTMENU "CustomGameMenu" LISTMENU "CustomGameMenu"
{ {
position 160, 48, 142 position 160, 48, 142
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 102 ScriptId 102
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu1" LISTMENU "CustomSubMenu1"
@ -168,6 +174,8 @@ LISTMENU "CustomSubMenu1"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu2" LISTMENU "CustomSubMenu2"
@ -176,6 +184,8 @@ LISTMENU "CustomSubMenu2"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu3" LISTMENU "CustomSubMenu3"
@ -184,6 +194,8 @@ LISTMENU "CustomSubMenu3"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu4" LISTMENU "CustomSubMenu4"
@ -192,6 +204,8 @@ LISTMENU "CustomSubMenu4"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu5" LISTMENU "CustomSubMenu5"
@ -200,6 +214,8 @@ LISTMENU "CustomSubMenu5"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu6" LISTMENU "CustomSubMenu6"
@ -208,6 +224,8 @@ LISTMENU "CustomSubMenu6"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu7" LISTMENU "CustomSubMenu7"
@ -216,10 +234,21 @@ LISTMENU "CustomSubMenu7"
centermenu centermenu
fixedspacing 5 fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "MultiMenu" LISTMENU "MultiMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury) // Ion Fury does not use this menu.
{
position 160, 55, 135
centermenu
fixedspacing 5
class "Duke.ListMenu"
animatedtransition
}
Caption "$MNU_NETWORKGAME" Caption "$MNU_NETWORKGAME"
NativeTextItem "$MNU_PLAYERSETUP", "p", "PlayerSetupMenu" NativeTextItem "$MNU_PLAYERSETUP", "p", "PlayerSetupMenu"
NativeTextItem "$MNU_JOINGAME", "j", "JoinGameMenu" NativeTextItem "$MNU_JOINGAME", "j", "JoinGameMenu"