Menus/Challenges: interpolate scrolling

This commit is contained in:
James R 2024-01-04 01:16:41 -08:00
parent 3f58a01774
commit b676d5137e
3 changed files with 14 additions and 0 deletions

View file

@ -1320,6 +1320,7 @@ extern struct challengesmenu_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! INT16 offset; // To make the icons move smoothly when we transition!
menu_anim_t move;
UINT16 currentunlock; UINT16 currentunlock;
char *unlockcondition; char *unlockcondition;

View file

@ -6871,6 +6871,8 @@ void M_DrawChallenges(void)
x += challengesmenu.offset; x += challengesmenu.offset;
x += Easing_OutQuad(M_DueFrac(challengesmenu.move.start, 4), challengesgridstep * challengesmenu.move.dist, 0);
if (challengegridloops) if (challengegridloops)
{ {
if (!challengesmenu.col && challengesmenu.hilix) if (!challengesmenu.col && challengesmenu.hilix)

View file

@ -1,6 +1,7 @@
/// \file menus/extras-challenges.c /// \file menus/extras-challenges.c
/// \brief Challenges. /// \brief Challenges.
#include "../i_time.h"
#include "../k_menu.h" #include "../k_menu.h"
#include "../m_cond.h" // Condition Sets #include "../m_cond.h" // Condition Sets
#include "../m_random.h" // And just some randomness for the exits. #include "../m_random.h" // And just some randomness for the exits.
@ -862,6 +863,11 @@ boolean M_ChallengesInputs(INT32 ch)
{ {
challengesmenu.focusx--; challengesmenu.focusx--;
} }
else
{
challengesmenu.move.dist = 1;
challengesmenu.move.start = I_GetTime();
}
// Step the actual column right. // Step the actual column right.
if (challengesmenu.col < gamedata->challengegridwidth-1) if (challengesmenu.col < gamedata->challengegridwidth-1)
@ -899,6 +905,11 @@ boolean M_ChallengesInputs(INT32 ch)
{ {
challengesmenu.focusx++; challengesmenu.focusx++;
} }
else
{
challengesmenu.move.dist = -1;
challengesmenu.move.start = I_GetTime();
}
// Step the actual column left. // Step the actual column left.
if (challengesmenu.col > 0) if (challengesmenu.col > 0)