Menus/Extras: interpolate

- Uses a different easing
This commit is contained in:
James R 2023-12-27 12:08:03 -08:00
parent d9f0f70987
commit 8a2e0469e9
3 changed files with 17 additions and 10 deletions

View file

@ -1065,10 +1065,12 @@ void M_DrawEggaChannel(void);
// Extras menu: // Extras menu:
#define DF_ENCORE 0x40 #define DF_ENCORE 0x40
#define M_EXTRAS_OFSTIME 4
extern struct extrasmenu_s { extern struct extrasmenu_s {
tic_t ticker; // How long the menu's been open for tic_t ticker; // How long the menu's been open for
INT16 offset; // To make the icons move smoothly when we transition! menu_anim_t offset; // To make the icons move smoothly when we transition!
// For moving the button when we get into a submenu. it's smooth and cool! (normal x/y and target x/y.) // For moving the button when we get into a submenu. it's smooth and cool! (normal x/y and target x/y.)
// this is only used during menu transitions. (and will probably remain unused until we get the statistics menu // this is only used during menu transitions. (and will probably remain unused until we get the statistics menu

View file

@ -4942,8 +4942,9 @@ void M_DrawExtrasMovingButton(void)
void M_DrawExtras(void) void M_DrawExtras(void)
{ {
UINT8 i; UINT8 i;
INT32 x = 140 - (48*itemOn) + extrasmenu.offset; INT32 t = Easing_OutSine(M_DueFrac(extrasmenu.offset.start, M_EXTRAS_OFSTIME), extrasmenu.offset.dist, 0);
INT32 y = 70 + extrasmenu.offset; INT32 x = 140 - (48*itemOn) + t;
INT32 y = 70 + t;
patch_t *buttback = W_CachePatchName("OPT_BUTT", PU_CACHE); patch_t *buttback = W_CachePatchName("OPT_BUTT", PU_CACHE);
UINT8 *c = NULL; UINT8 *c = NULL;

View file

@ -1,6 +1,7 @@
/// \file menus/extras-1.c /// \file menus/extras-1.c
/// \brief Extras Menu /// \brief Extras Menu
#include "../i_time.h"
#include "../k_menu.h" #include "../k_menu.h"
#include "../m_cond.h" #include "../m_cond.h"
#include "../m_cheat.h" #include "../m_cheat.h"
@ -127,7 +128,7 @@ void M_InitExtras(INT32 choice)
return; return;
extrasmenu.ticker = 0; extrasmenu.ticker = 0;
extrasmenu.offset = 0; extrasmenu.offset.start = 0;
extrasmenu.extx = 0; extrasmenu.extx = 0;
extrasmenu.exty = 0; extrasmenu.exty = 0;
@ -148,7 +149,6 @@ boolean M_ExtrasQuit(void)
void M_ExtrasTick(void) void M_ExtrasTick(void)
{ {
extrasmenu.offset /= 2;
extrasmenu.ticker++; extrasmenu.ticker++;
extrasmenu.extx += (extrasmenu.textx - extrasmenu.extx)/2; extrasmenu.extx += (extrasmenu.textx - extrasmenu.extx)/2;
@ -197,12 +197,14 @@ boolean M_ExtrasInputs(INT32 ch)
if (menucmd[pid].dpad_ud > 0) if (menucmd[pid].dpad_ud > 0)
{ {
extrasmenu.offset += 48; extrasmenu.offset.dist = 48;
M_NextOpt(); M_NextOpt();
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
if (itemOn == 0) if (itemOn == 0)
extrasmenu.offset -= currentMenu->numitems*48; extrasmenu.offset.dist -= currentMenu->numitems*48;
extrasmenu.offset.start = I_GetTime();
M_SetMenuDelay(pid); M_SetMenuDelay(pid);
return true; return true;
@ -210,12 +212,14 @@ boolean M_ExtrasInputs(INT32 ch)
else if (menucmd[pid].dpad_ud < 0) else if (menucmd[pid].dpad_ud < 0)
{ {
extrasmenu.offset -= 48; extrasmenu.offset.dist = -48;
M_PrevOpt(); M_PrevOpt();
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
if (itemOn == currentMenu->numitems-1) if (itemOn == currentMenu->numitems-1)
extrasmenu.offset += currentMenu->numitems*48; extrasmenu.offset.dist += currentMenu->numitems*48;
extrasmenu.offset.start = I_GetTime();
M_SetMenuDelay(pid); M_SetMenuDelay(pid);
return true; return true;