Menus/Character Select: interpolate Profile selection

This commit is contained in:
James R 2023-12-27 11:41:44 -08:00 committed by toaster
parent 7d35c0db4b
commit 30e94d81fe
3 changed files with 26 additions and 3 deletions

View file

@ -715,6 +715,7 @@ struct setup_player_t
{
SINT8 gridx, gridy;
UINT8 profilen;
menu_anim_t profilen_slide;
INT16 skin;
SINT8 clonenum;
SINT8 rotate;

View file

@ -1930,12 +1930,20 @@ static void M_DrawCharSelectPreview(UINT8 num)
if (p->mdepth == CSSTEP_PROFILE)
{
INT16 px = x+12;
INT16 py = y+48 - p->profilen*12;
INT16 py = y+48 - p->profilen*12 +
Easing_OutSine(
M_DueFrac(p->profilen_slide.start, 5),
p->profilen_slide.dist*12,
0
);
UINT8 maxp = PR_GetNumProfiles();
UINT8 i = 0;
UINT8 j;
V_SetClipRect(0, (y+25)*FRACUNIT, BASEVIDWIDTH*FRACUNIT, (5*12)*FRACUNIT, 0);
for (i = 0; i < maxp; i++)
{
profile_t *pr = PR_GetProfile(i);
@ -1961,13 +1969,13 @@ static void M_DrawCharSelectPreview(UINT8 num)
notSelectable |= V_TRANSLUCENT;
}
if (dist > 2)
if (dist > 3)
{
py += 12;
continue;
}
if (dist == 2)
if (dist > 1)
{
V_DrawCenteredFileString(px+26, py, notSelectable, pr->version ? pr->profilename : "NEW");
V_DrawScaledPatch(px, py, V_TRANSLUCENT, W_CachePatchName("FILEBACK", PU_CACHE));
@ -1984,6 +1992,7 @@ static void M_DrawCharSelectPreview(UINT8 num)
py += 12;
}
V_ClearClipRect();
}
// "Changes?"
else if (p->mdepth == CSSTEP_ASKCHANGES)

View file

@ -1,6 +1,7 @@
/// \file menus/play-char-select.c
/// \brief Character Select
#include "../i_time.h"
#include "../k_menu.h"
#include "../r_skins.h"
#include "../s_sound.h"
@ -278,6 +279,9 @@ void M_CharacterSelectInit(void)
setup_player[i].followercategory = -1;
setup_player[i].followercolor = SKINCOLOR_NONE;
setup_player[i].profilen_slide.start = 0;
setup_player[i].profilen_slide.dist = 0;
// If we're on prpfile select, skip straight to CSSTEP_CHARS
// do the same if we're midgame, but make sure to consider splitscreen properly.
if (optionsmenu.profile && i == 0)
@ -525,19 +529,25 @@ static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num)
if (menucmd[num].dpad_ud > 0)
{
UINT8 oldn = p->profilen;
p->profilen++;
if (p->profilen > maxp)
p->profilen = 0;
p->profilen_slide.dist = p->profilen - oldn;
p->profilen_slide.start = I_GetTime();
S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(num);
}
else if (menucmd[num].dpad_ud < 0)
{
UINT8 oldn = p->profilen;
if (p->profilen == 0)
p->profilen = maxp;
else
p->profilen--;
p->profilen_slide.dist = p->profilen - oldn;
p->profilen_slide.start = I_GetTime();
S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(num);
@ -616,11 +626,14 @@ static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num)
}
else if (M_MenuExtraPressed(num))
{
UINT8 oldn = p->profilen;
UINT8 yourprofile = min(cv_lastprofile[realnum].value, PR_GetNumProfiles());
if (p->profilen == yourprofile)
p->profilen = PROFILE_GUEST;
else
p->profilen = yourprofile;
p->profilen_slide.dist = p->profilen - oldn;
p->profilen_slide.start = I_GetTime();
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kc3s
M_SetMenuDelay(num);
}