diff --git a/src/k_menu.h b/src/k_menu.h index 2d78dd7af..539a29c17 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1065,10 +1065,12 @@ void M_DrawEggaChannel(void); // Extras menu: #define DF_ENCORE 0x40 +#define M_EXTRAS_OFSTIME 4 + extern struct extrasmenu_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! // 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 diff --git a/src/k_menudraw.c b/src/k_menudraw.c index f4fb42766..e5195c932 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -4942,8 +4942,9 @@ void M_DrawExtrasMovingButton(void) void M_DrawExtras(void) { UINT8 i; - INT32 x = 140 - (48*itemOn) + extrasmenu.offset; - INT32 y = 70 + extrasmenu.offset; + INT32 t = Easing_OutSine(M_DueFrac(extrasmenu.offset.start, M_EXTRAS_OFSTIME), extrasmenu.offset.dist, 0); + INT32 x = 140 - (48*itemOn) + t; + INT32 y = 70 + t; patch_t *buttback = W_CachePatchName("OPT_BUTT", PU_CACHE); UINT8 *c = NULL; diff --git a/src/menus/extras-1.c b/src/menus/extras-1.c index 2ae596544..9d1ab4b55 100644 --- a/src/menus/extras-1.c +++ b/src/menus/extras-1.c @@ -1,6 +1,7 @@ /// \file menus/extras-1.c /// \brief Extras Menu +#include "../i_time.h" #include "../k_menu.h" #include "../m_cond.h" #include "../m_cheat.h" @@ -127,7 +128,7 @@ void M_InitExtras(INT32 choice) return; extrasmenu.ticker = 0; - extrasmenu.offset = 0; + extrasmenu.offset.start = 0; extrasmenu.extx = 0; extrasmenu.exty = 0; @@ -148,7 +149,6 @@ boolean M_ExtrasQuit(void) void M_ExtrasTick(void) { - extrasmenu.offset /= 2; extrasmenu.ticker++; extrasmenu.extx += (extrasmenu.textx - extrasmenu.extx)/2; @@ -197,12 +197,14 @@ boolean M_ExtrasInputs(INT32 ch) if (menucmd[pid].dpad_ud > 0) { - extrasmenu.offset += 48; + extrasmenu.offset.dist = 48; M_NextOpt(); S_StartSound(NULL, sfx_s3k5b); if (itemOn == 0) - extrasmenu.offset -= currentMenu->numitems*48; + extrasmenu.offset.dist -= currentMenu->numitems*48; + + extrasmenu.offset.start = I_GetTime(); M_SetMenuDelay(pid); return true; @@ -210,12 +212,14 @@ boolean M_ExtrasInputs(INT32 ch) else if (menucmd[pid].dpad_ud < 0) { - extrasmenu.offset -= 48; + extrasmenu.offset.dist = -48; M_PrevOpt(); S_StartSound(NULL, sfx_s3k5b); if (itemOn == currentMenu->numitems-1) - extrasmenu.offset += currentMenu->numitems*48; + extrasmenu.offset.dist += currentMenu->numitems*48; + + extrasmenu.offset.start = I_GetTime(); M_SetMenuDelay(pid); return true;