mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-02 21:22:40 +00:00
Menus: pop out highlighted button on Gamemode menus (except when fading in)
Effective for: - Gamepad up/down - Transition (without fade) Does not affect buttons inside boxes. My reasoning here is that these show arrows when highlighted anyway, so that fulfills the extra feedback.
This commit is contained in:
parent
0ff29a2a41
commit
e114bf8f95
3 changed files with 57 additions and 26 deletions
|
|
@ -1186,6 +1186,7 @@ void M_DrawMenuForeground(void);
|
|||
void M_Drawer(void);
|
||||
void M_DrawGenericMenu(void);
|
||||
void M_DrawKartGamemodeMenu(void);
|
||||
void M_FlipKartGamemodeMenu(boolean slide);
|
||||
void M_DrawHorizontalMenu(void);
|
||||
void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines);
|
||||
void M_DrawMessageMenu(void);
|
||||
|
|
|
|||
|
|
@ -1130,6 +1130,9 @@ void M_DrawGenericMenu(void)
|
|||
#define GM_STARTY 80
|
||||
#define GM_XOFFSET 17
|
||||
#define GM_YOFFSET 34
|
||||
#define GM_FLIPTIME 5
|
||||
|
||||
static tic_t gm_flipStart;
|
||||
|
||||
//
|
||||
// M_DrawKartGamemodeMenu
|
||||
|
|
@ -1182,6 +1185,13 @@ void M_DrawKartGamemodeMenu(void)
|
|||
}
|
||||
}
|
||||
|
||||
INT32 cx = x;
|
||||
|
||||
if (i == itemOn && menutransition.tics == menutransition.dest)
|
||||
{
|
||||
cx -= Easing_OutSine(M_DueFrac(gm_flipStart, GM_FLIPTIME), 0, GM_XOFFSET / 2);
|
||||
}
|
||||
|
||||
type = (currentMenu->menuitems[i].status & IT_DISPLAY);
|
||||
|
||||
switch (type)
|
||||
|
|
@ -1191,7 +1201,7 @@ void M_DrawKartGamemodeMenu(void)
|
|||
{
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
if (i == itemOn)
|
||||
if (i == itemOn && menutransition.tics == menutransition.dest)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE);
|
||||
}
|
||||
|
|
@ -1200,8 +1210,8 @@ void M_DrawKartGamemodeMenu(void)
|
|||
colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_MOSS, GTC_CACHE);
|
||||
}
|
||||
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUPLTR", PU_CACHE), colormap);
|
||||
V_DrawGamemodeString(x + 16, y - 3,
|
||||
V_DrawFixedPatch(cx*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUPLTR", PU_CACHE), colormap);
|
||||
V_DrawGamemodeString(cx + 16, y - 3,
|
||||
(type == IT_TRANSTEXT2
|
||||
? V_TRANSLUCENT
|
||||
: 0
|
||||
|
|
@ -1217,6 +1227,11 @@ void M_DrawKartGamemodeMenu(void)
|
|||
}
|
||||
}
|
||||
|
||||
void M_FlipKartGamemodeMenu(boolean slide)
|
||||
{
|
||||
gm_flipStart = slide ? I_GetTime() : 0;
|
||||
}
|
||||
|
||||
void M_DrawHorizontalMenu(void)
|
||||
{
|
||||
INT32 x, y, i, final = currentMenu->extra2-1, showflags;
|
||||
|
|
@ -2489,11 +2504,17 @@ void M_DrawRaceDifficulty(void)
|
|||
case IT_STRING:
|
||||
{
|
||||
|
||||
INT32 cx = x;
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
if (i == itemOn)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE);
|
||||
|
||||
if (i >= drace_boxend)
|
||||
{
|
||||
cx -= Easing_OutSine(M_DueFrac(gm_flipStart, GM_FLIPTIME), 0, GM_XOFFSET / 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2504,13 +2525,13 @@ void M_DrawRaceDifficulty(void)
|
|||
if (currentMenu->menuitems[i].status & IT_CVAR)
|
||||
{
|
||||
|
||||
INT32 fx = (x - 48*menutransition.tics);
|
||||
INT32 fx = (cx - 48*menutransition.tics);
|
||||
INT32 centx = fx + (320-fx)/2 + (menutransition.tics*48); // undo the menutransition movement to redo it here otherwise the text won't move at the same speed lole.
|
||||
|
||||
// implicitely we'll only take care of normal consvars
|
||||
consvar_t *cv = currentMenu->menuitems[i].itemaction.cvar;
|
||||
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUSHRT", PU_CACHE), colormap);
|
||||
V_DrawFixedPatch(cx*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUSHRT", PU_CACHE), colormap);
|
||||
V_DrawCenteredGamemodeString(centx, y - 3, 0, colormap, cv->string);
|
||||
|
||||
if (i == itemOn)
|
||||
|
|
@ -2525,8 +2546,8 @@ void M_DrawRaceDifficulty(void)
|
|||
}
|
||||
else // not a cvar
|
||||
{
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUPLTR", PU_CACHE), colormap);
|
||||
V_DrawGamemodeString(x + 16, y - 3, 0, colormap, currentMenu->menuitems[i].text);
|
||||
V_DrawFixedPatch(cx*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, W_CachePatchName("MENUPLTR", PU_CACHE), colormap);
|
||||
V_DrawGamemodeString(cx + 16, y - 3, 0, colormap, currentMenu->menuitems[i].text);
|
||||
}
|
||||
x += GM_XOFFSET;
|
||||
y += GM_YOFFSET;
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ boolean M_NextOpt(void)
|
|||
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
|
||||
|
||||
M_UpdateMenuBGImage(false);
|
||||
M_FlipKartGamemodeMenu(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -176,6 +177,7 @@ boolean M_PrevOpt(void)
|
|||
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
|
||||
|
||||
M_UpdateMenuBGImage(false);
|
||||
M_FlipKartGamemodeMenu(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -715,6 +717,7 @@ void M_SetupNextMenu(menu_t *menudef, boolean notransition)
|
|||
else if (gamestate == GS_MENU)
|
||||
{
|
||||
menuwipe = true;
|
||||
M_FlipKartGamemodeMenu(false);
|
||||
F_WipeStartScreen();
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
F_WipeEndScreen();
|
||||
|
|
@ -1139,30 +1142,36 @@ void M_Ticker(void)
|
|||
|
||||
// If dest is non-zero, we've started transition and want to switch menus
|
||||
// If dest is zero, we're mid-transition and want to end it
|
||||
if (menutransition.tics == menutransition.dest
|
||||
&& menutransition.endmenu != NULL
|
||||
&& currentMenu != menutransition.endmenu
|
||||
)
|
||||
if (menutransition.tics == menutransition.dest)
|
||||
{
|
||||
if (menutransition.startmenu->transitionID == menutransition.endmenu->transitionID
|
||||
&& menutransition.endmenu->transitionTics)
|
||||
if (menutransition.endmenu != NULL
|
||||
&& currentMenu != menutransition.endmenu)
|
||||
{
|
||||
menutransition.tics = menutransition.endmenu->transitionTics;
|
||||
menutransition.dest = 0;
|
||||
menutransition.in = true;
|
||||
if (menutransition.startmenu->transitionID == menutransition.endmenu->transitionID
|
||||
&& menutransition.endmenu->transitionTics)
|
||||
{
|
||||
menutransition.tics = menutransition.endmenu->transitionTics;
|
||||
menutransition.dest = 0;
|
||||
menutransition.in = true;
|
||||
}
|
||||
else if (gamestate == GS_MENU)
|
||||
{
|
||||
memset(&menutransition, 0, sizeof(menutransition));
|
||||
|
||||
menuwipe = true;
|
||||
F_WipeStartScreen();
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipe_menu_toblack, wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
|
||||
}
|
||||
|
||||
M_SetupNextMenu(menutransition.endmenu, true);
|
||||
}
|
||||
else if (gamestate == GS_MENU)
|
||||
else
|
||||
{
|
||||
memset(&menutransition, 0, sizeof(menutransition));
|
||||
|
||||
menuwipe = true;
|
||||
F_WipeStartScreen();
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipe_menu_toblack, wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
|
||||
// Menu is done transitioning in
|
||||
M_FlipKartGamemodeMenu(true);
|
||||
}
|
||||
|
||||
M_SetupNextMenu(menutransition.endmenu, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue