mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Menus/Pause: interpolate
This commit is contained in:
parent
a36c46bbaa
commit
bef7c3634b
3 changed files with 23 additions and 17 deletions
|
|
@ -1134,11 +1134,11 @@ void M_EggTV_RefreshButtonLabels(void);
|
|||
// Keep track of some pause menu data for visual goodness.
|
||||
extern struct pausemenu_s {
|
||||
|
||||
tic_t ticker; // How long the menu's been open for
|
||||
INT16 offset; // To make the icons move smoothly when we transition!
|
||||
tic_t ticker; // How long the menu's been open for
|
||||
menu_anim_t offset; // To make the icons move smoothly when we transition!
|
||||
|
||||
INT16 openoffset; // Used when you open / close the menu to slide everything in.
|
||||
boolean closing; // When this is set, the open offset goes backwards to close the menu smoothly.
|
||||
menu_anim_t openoffset; // Used when you open / close the menu to slide everything in.
|
||||
boolean closing; // When this is set, the open offset goes backwards to close the menu smoothly.
|
||||
} pausemenu;
|
||||
|
||||
void M_OpenPauseMenu(void);
|
||||
|
|
|
|||
|
|
@ -5175,7 +5175,9 @@ void M_DrawPause(void)
|
|||
INT16 ypos = -50; // Draw 3 items from selected item (y=100 - 3 items spaced by 50 px each... you get the idea.)
|
||||
INT16 dypos;
|
||||
|
||||
INT16 offset = menutransition.tics ? floor(pow(2, (double)menutransition.tics)) : pausemenu.openoffset;
|
||||
fixed_t t = M_DueFrac(pausemenu.openoffset.start, 6);
|
||||
INT16 offset = menutransition.tics ? floor(pow(2, (double)menutransition.tics)) :
|
||||
(pausemenu.openoffset.dist ? Easing_InQuad(t, 0, 256) : Easing_OutQuad(t, 256, 0));
|
||||
INT16 arrxpos = 150 + 2*offset; // To draw the background arrow.
|
||||
|
||||
INT16 j = 0;
|
||||
|
|
@ -5184,6 +5186,8 @@ void M_DrawPause(void)
|
|||
patch_t *arrstart = W_CachePatchName("M_PTIP", PU_CACHE);
|
||||
patch_t *arrfill = W_CachePatchName("M_PFILL", PU_CACHE);
|
||||
|
||||
t = M_DueFrac(pausemenu.offset.start, 3);
|
||||
|
||||
//V_DrawFadeScreen(0xFF00, 16);
|
||||
|
||||
// "PAUSED"
|
||||
|
|
@ -5255,8 +5259,9 @@ void M_DrawPause(void)
|
|||
// Multiply by -1 or 1 depending on whether we're below or above 100 px.
|
||||
// This double ternary is awful, yes.
|
||||
|
||||
dypos = ypos + pausemenu.offset;
|
||||
V_DrawFixedPatch( ((i == itemOn ? (294 - pausemenu.offset*2/3 * (dypos > 100 ? 1 : -1)) : 261) + offset) << FRACBITS, (dypos)*FRACUNIT, FRACUNIT, 0, pp, colormap);
|
||||
INT32 yofs = Easing_InQuad(t, pausemenu.offset.dist, 0);
|
||||
dypos = ypos + yofs;
|
||||
V_DrawFixedPatch( ((i == itemOn ? (294 - yofs*2/3 * (dypos > 100 ? 1 : -1)) : 261) + offset) << FRACBITS, (dypos)*FRACUNIT, FRACUNIT, 0, pp, colormap);
|
||||
|
||||
ypos += 50;
|
||||
itemsdrawn++; // We drew that!
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/// \brief In-game/pause menus
|
||||
|
||||
#include "../../d_netcmd.h"
|
||||
#include "../../i_time.h"
|
||||
#include "../../k_menu.h"
|
||||
#include "../../k_grandprix.h" // K_CanChangeRules
|
||||
#include "../../m_cond.h"
|
||||
|
|
@ -117,8 +118,9 @@ void M_OpenPauseMenu(void)
|
|||
// Ready the variables
|
||||
pausemenu.ticker = 0;
|
||||
|
||||
pausemenu.offset = 0;
|
||||
pausemenu.openoffset = 256;
|
||||
pausemenu.offset.dist = 0;
|
||||
pausemenu.openoffset.start = I_GetTime();
|
||||
pausemenu.openoffset.dist = 0;
|
||||
pausemenu.closing = false;
|
||||
|
||||
currentMenu->lastOn = mpause_continue; // Make sure we select "RESUME GAME" by default
|
||||
|
|
@ -260,23 +262,20 @@ void M_QuitPauseMenu(INT32 choice)
|
|||
(void)choice;
|
||||
// M_PauseTick actually handles the quitting when it's been long enough.
|
||||
pausemenu.closing = true;
|
||||
pausemenu.openoffset = 4;
|
||||
pausemenu.openoffset.start = I_GetTime();
|
||||
pausemenu.openoffset.dist = 1;
|
||||
}
|
||||
|
||||
void M_PauseTick(void)
|
||||
{
|
||||
pausemenu.offset /= 2;
|
||||
pausemenu.ticker++;
|
||||
|
||||
if (pausemenu.closing)
|
||||
{
|
||||
pausemenu.openoffset *= 2;
|
||||
if (pausemenu.openoffset > 255)
|
||||
if (I_GetTime() - pausemenu.openoffset.start > 6)
|
||||
M_ClearMenus(true);
|
||||
|
||||
}
|
||||
else
|
||||
pausemenu.openoffset /= 2;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
// Show discord requests menu option if any requests are pending
|
||||
|
|
@ -299,7 +298,8 @@ boolean M_PauseInputs(INT32 ch)
|
|||
if (menucmd[pid].dpad_ud < 0)
|
||||
{
|
||||
M_SetMenuDelay(pid);
|
||||
pausemenu.offset -= 50; // Each item is spaced by 50 px
|
||||
pausemenu.offset.start = I_GetTime();
|
||||
pausemenu.offset.dist = -50; // Each item is spaced by 50 px
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_PrevOpt();
|
||||
return true;
|
||||
|
|
@ -307,7 +307,8 @@ boolean M_PauseInputs(INT32 ch)
|
|||
|
||||
else if (menucmd[pid].dpad_ud > 0)
|
||||
{
|
||||
pausemenu.offset += 50; // Each item is spaced by 50 px
|
||||
pausemenu.offset.start = I_GetTime();
|
||||
pausemenu.offset.dist = 50; // Each item is spaced by 50 px
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_NextOpt();
|
||||
M_SetMenuDelay(pid);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue