mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Menus/Level Select: interpolate
- Uses slightly different easing
This commit is contained in:
parent
1c2ed2b306
commit
d9f0f70987
4 changed files with 28 additions and 18 deletions
|
|
@ -808,10 +808,12 @@ typedef struct levelsearch_s {
|
|||
boolean checklocked;
|
||||
} levelsearch_t;
|
||||
|
||||
#define M_LEVELLIST_SLIDETIME 4
|
||||
|
||||
extern struct levellist_s {
|
||||
SINT8 cursor;
|
||||
menu_anim_t slide;
|
||||
UINT16 y;
|
||||
UINT16 dest;
|
||||
UINT16 choosemap;
|
||||
UINT16 mapcount;
|
||||
UINT8 newgametype;
|
||||
|
|
|
|||
|
|
@ -3271,8 +3271,13 @@ void M_DrawLevelSelect(void)
|
|||
INT16 i = 0;
|
||||
UINT8 j = 0;
|
||||
INT16 map = M_GetFirstLevelInList(&j, &levellist.levelsearch);
|
||||
INT16 t = (64*menutransition.tics), tay = 0;
|
||||
INT16 y = 80 - (12 * levellist.y);
|
||||
INT16 t = M_EaseWithTransition(Easing_Linear, 5 * 64), tay = 0;
|
||||
INT16 y = 80 - levellist.y +
|
||||
Easing_OutSine(
|
||||
M_DueFrac(levellist.slide.start, 4),
|
||||
levellist.slide.dist,
|
||||
0
|
||||
);
|
||||
boolean tatransition = ((menutransition.startmenu == &PLAY_TimeAttackDef || menutransition.endmenu == &PLAY_TimeAttackDef) && menutransition.tics);
|
||||
|
||||
if (tatransition)
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ void M_CupSelectHandler(INT32 choice)
|
|||
|
||||
levellist.mapcount = count;
|
||||
M_LevelSelectScrollDest();
|
||||
levellist.y = levellist.dest;
|
||||
levellist.slide.start = 0;
|
||||
|
||||
M_SetupNextMenu(&PLAY_LevelSelectDef, false);
|
||||
S_StartSound(NULL, sfx_s3k63);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/// \file menus/transient/level-select.c
|
||||
/// \brief Level Select
|
||||
|
||||
#include "../../i_time.h"
|
||||
#include "../../k_menu.h"
|
||||
#include "../../m_cond.h" // Condition Sets
|
||||
#include "../../z_zone.h"
|
||||
|
|
@ -223,14 +224,23 @@ UINT16 M_GetNextLevelInList(UINT16 mapnum, UINT8 *i, levelsearch_t *levelsearch)
|
|||
void M_LevelSelectScrollDest(void)
|
||||
{
|
||||
UINT16 m = levellist.mapcount-1;
|
||||
UINT16 dest = (6*levellist.cursor);
|
||||
|
||||
levellist.dest = (6*levellist.cursor);
|
||||
if (dest < 3)
|
||||
dest = 3;
|
||||
|
||||
if (levellist.dest < 3)
|
||||
levellist.dest = 3;
|
||||
if (m && dest > (6*m)-3)
|
||||
dest = (6*m)-3;
|
||||
|
||||
if (m && levellist.dest > (6*m)-3)
|
||||
levellist.dest = (6*m)-3;
|
||||
dest *= 12;
|
||||
|
||||
if (levellist.y != dest)
|
||||
{
|
||||
levellist.slide.start = I_GetTime();
|
||||
levellist.slide.dist = dest - levellist.y;
|
||||
}
|
||||
|
||||
levellist.y = dest;
|
||||
}
|
||||
|
||||
// Builds the level list we'll be using from the gametype we're choosing and send us to the apropriate menu.
|
||||
|
|
@ -599,7 +609,7 @@ boolean M_LevelListFromGametype(INT16 gt)
|
|||
}
|
||||
|
||||
M_LevelSelectScrollDest();
|
||||
levellist.y = levellist.dest;
|
||||
levellist.slide.start = 0;
|
||||
|
||||
if (gt != -1)
|
||||
{
|
||||
|
|
@ -778,7 +788,7 @@ void M_LevelSelectHandler(INT32 choice)
|
|||
|
||||
(void)choice;
|
||||
|
||||
if (levellist.y != levellist.dest)
|
||||
if (I_GetTime() - levellist.slide.start < M_LEVELLIST_SLIDETIME)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -820,11 +830,4 @@ void M_LevelSelectHandler(INT32 choice)
|
|||
|
||||
void M_LevelSelectTick(void)
|
||||
{
|
||||
|
||||
INT16 dist = levellist.dest - levellist.y;
|
||||
|
||||
if (abs(dist) == 1) // cheating to avoid off by 1 errors with divisions.
|
||||
levellist.y = levellist.dest;
|
||||
else
|
||||
levellist.y += dist/2;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue