mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- enabled the menu transitions.
This commit is contained in:
parent
2ed598bb6c
commit
0597b4cf12
1 changed files with 40 additions and 25 deletions
|
@ -105,6 +105,8 @@ struct MenuTransition
|
||||||
int32_t dir;
|
int32_t dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static MenuTransition transition;
|
||||||
|
|
||||||
bool M_StartTransition(DMenu *from, DMenu *to, MenuTransitionType animtype, MenuTransition &transition)
|
bool M_StartTransition(DMenu *from, DMenu *to, MenuTransitionType animtype, MenuTransition &transition)
|
||||||
{
|
{
|
||||||
if (!from->canAnimate || !to->canAnimate || animtype == MA_None)
|
if (!from->canAnimate || !to->canAnimate || animtype == MA_None)
|
||||||
|
@ -133,10 +135,10 @@ bool M_DrawTransition(MenuTransition &transition)
|
||||||
transition.current->origin.X = factor * transition.dir * (sin(phase) + 1.);
|
transition.current->origin.X = factor * transition.dir * (sin(phase) + 1.);
|
||||||
transition.previous->Drawer();
|
transition.previous->Drawer();
|
||||||
transition.current->Drawer();
|
transition.current->Drawer();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
|
@ -225,7 +227,14 @@ bool DMenu::MenuEvent (int mkey, bool fromcontroller)
|
||||||
void DMenu::Close ()
|
void DMenu::Close ()
|
||||||
{
|
{
|
||||||
assert(DMenu::CurrentMenu == this);
|
assert(DMenu::CurrentMenu == this);
|
||||||
|
|
||||||
DMenu::CurrentMenu = mParentMenu;
|
DMenu::CurrentMenu = mParentMenu;
|
||||||
|
if (mParentMenu && M_StartTransition(this, mParentMenu, MA_Return, transition))
|
||||||
|
{
|
||||||
|
g_currentMenu = DMenu::CurrentMenu->scriptID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
delete this;
|
delete this;
|
||||||
if (DMenu::CurrentMenu == NULL)
|
if (DMenu::CurrentMenu == NULL)
|
||||||
|
@ -237,6 +246,7 @@ void DMenu::Close ()
|
||||||
g_currentMenu = DMenu::CurrentMenu->scriptID;
|
g_currentMenu = DMenu::CurrentMenu->scriptID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
|
@ -399,7 +409,11 @@ void M_ActivateMenu(DMenu *menu)
|
||||||
{
|
{
|
||||||
g_currentMenu = menu->scriptID;
|
g_currentMenu = menu->scriptID;
|
||||||
if (menuactive == MENU_Off) menuactive = MENU_On;
|
if (menuactive == MENU_Off) menuactive = MENU_On;
|
||||||
if (DMenu::CurrentMenu != NULL) DMenu::CurrentMenu->ReleaseCapture();
|
if (DMenu::CurrentMenu != NULL)
|
||||||
|
{
|
||||||
|
DMenu::CurrentMenu->ReleaseCapture();
|
||||||
|
M_StartTransition(DMenu::CurrentMenu, menu, MA_Advance, transition);
|
||||||
|
}
|
||||||
DMenu::CurrentMenu = menu;
|
DMenu::CurrentMenu = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,28 +799,29 @@ void M_Drawer (void)
|
||||||
{
|
{
|
||||||
rotatesprite_2doverride = true;
|
rotatesprite_2doverride = true;
|
||||||
PalEntry fade = 0x70000000;
|
PalEntry fade = 0x70000000;
|
||||||
#if 0
|
|
||||||
player_t *player = &players[consoleplayer];
|
|
||||||
AActor *camera = player->camera;
|
|
||||||
|
|
||||||
if (!screen->Accel2D && camera != NULL && (gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL))
|
|
||||||
{
|
|
||||||
if (camera->player != NULL)
|
|
||||||
{
|
|
||||||
player = camera->player;
|
|
||||||
}
|
|
||||||
fade = PalEntry (BYTE(player->BlendA*255), BYTE(player->BlendR*255), BYTE(player->BlendG*255), BYTE(player->BlendB*255));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
|
if (DMenu::CurrentMenu != NULL && menuactive != MENU_Off)
|
||||||
{
|
{
|
||||||
DMenu::CurrentMenu->origin = { 0,0 };
|
|
||||||
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;
|
||||||
|
if (transition.previous)
|
||||||
|
{
|
||||||
|
done = M_DrawTransition(transition);
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
delete transition.previous;
|
||||||
|
transition.previous = nullptr;
|
||||||
|
transition.current = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
DMenu::CurrentMenu->origin = { 0,0 };
|
||||||
// else if (DrawBackground) Menu_DrawBackground(origin);
|
// else if (DrawBackground) Menu_DrawBackground(origin);
|
||||||
DMenu::CurrentMenu->Drawer();
|
DMenu::CurrentMenu->Drawer();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
rotatesprite_2doverride = false;
|
rotatesprite_2doverride = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue