mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-11 17:22:17 +00:00
Merge branch 'char-select-polish-pass-1' into 'master'
Character Select polish for Profile selection See merge request KartKrew/Kart!1735
This commit is contained in:
commit
26ec935bba
3 changed files with 93 additions and 39 deletions
|
|
@ -715,6 +715,7 @@ struct setup_player_t
|
|||
{
|
||||
SINT8 gridx, gridy;
|
||||
UINT8 profilen;
|
||||
menu_anim_t profilen_slide;
|
||||
INT16 skin;
|
||||
SINT8 clonenum;
|
||||
SINT8 rotate;
|
||||
|
|
|
|||
|
|
@ -1844,7 +1844,7 @@ static boolean M_DrawFollowerSprite(INT16 x, INT16 y, INT32 num, boolean charfli
|
|||
if (p != NULL)
|
||||
{
|
||||
UINT16 color = K_GetEffectiveFollowerColor(
|
||||
(p->mdepth < CSSTEP_FOLLOWERCOLORS) ? fl->defaultcolor : p->followercolor,
|
||||
(p->mdepth < CSSTEP_FOLLOWERCOLORS && p->mdepth != CSSTEP_ASKCHANGES) ? fl->defaultcolor : p->followercolor,
|
||||
fl,
|
||||
p->color,
|
||||
&skins[p->skin]
|
||||
|
|
@ -1869,7 +1869,7 @@ static void M_DrawCharSelectSprite(UINT8 num, INT16 x, INT16 y, boolean charflip
|
|||
return;
|
||||
}
|
||||
|
||||
if (p->mdepth < CSSTEP_COLORS)
|
||||
if (p->mdepth < CSSTEP_COLORS && p->mdepth != CSSTEP_ASKCHANGES)
|
||||
{
|
||||
color = skins[p->skin].prefcolor;
|
||||
}
|
||||
|
|
@ -1885,7 +1885,8 @@ static void M_DrawCharSelectSprite(UINT8 num, INT16 x, INT16 y, boolean charflip
|
|||
|
||||
colormap = R_GetTranslationColormap(p->skin, color, GTC_MENUCACHE);
|
||||
|
||||
M_DrawCharacterSprite(x, y, p->skin, SPR2_STIN, (charflip ? 1 : 7), ((p->mdepth == CSSTEP_READY) ? setup_animcounter : 0), 0, colormap);
|
||||
M_DrawCharacterSprite(x, y, p->skin, SPR2_STIN, (charflip ? 1 : 7), ((p->mdepth == CSSTEP_READY) ? setup_animcounter : 0),
|
||||
p->mdepth == CSSTEP_ASKCHANGES ? V_TRANSLUCENT : 0, colormap);
|
||||
}
|
||||
|
||||
static void M_DrawCharSelectPreview(UINT8 num)
|
||||
|
|
@ -1903,7 +1904,7 @@ static void M_DrawCharSelectPreview(UINT8 num)
|
|||
|
||||
V_DrawScaledPatch(x, y+6, V_TRANSLUCENT, W_CachePatchName("PREVBACK", PU_CACHE));
|
||||
|
||||
if (p->mdepth >= CSSTEP_CHARS)
|
||||
if (p->mdepth >= CSSTEP_CHARS || p->mdepth == CSSTEP_ASKCHANGES)
|
||||
{
|
||||
M_DrawCharSelectSprite(num, x+32, y+75, charflip);
|
||||
M_DrawCharSelectCircle(p, x+32, y+64);
|
||||
|
|
@ -1924,9 +1925,9 @@ static void M_DrawCharSelectPreview(UINT8 num)
|
|||
V_DrawCenteredFileString(backx+26, y+2, 0, pr ? pr->profilename : "PLAYER");
|
||||
}
|
||||
|
||||
if (p->mdepth >= CSSTEP_FOLLOWER)
|
||||
if (p->mdepth >= CSSTEP_FOLLOWER || p->mdepth == CSSTEP_ASKCHANGES)
|
||||
{
|
||||
M_DrawFollowerSprite(x+32+((charflip ? 1 : -1)*16), y+75, -1, charflip, 0, 0, p);
|
||||
M_DrawFollowerSprite(x+32+((charflip ? 1 : -1)*16), y+75, -1, charflip, p->mdepth == CSSTEP_ASKCHANGES ? V_TRANSLUCENT : 0, NULL, p);
|
||||
}
|
||||
|
||||
if ((setup_animcounter/10) & 1)
|
||||
|
|
@ -1945,12 +1946,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);
|
||||
|
|
@ -1976,13 +1985,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));
|
||||
|
|
@ -1993,12 +2002,34 @@ static void M_DrawCharSelectPreview(UINT8 num)
|
|||
|
||||
if (i != p->profilen || ((setup_animcounter/10) & 1))
|
||||
{
|
||||
V_DrawCenteredFileString(px+26, py, notSelectable, pr->version ? pr->profilename : "NEW");
|
||||
const char *txt = pr->version ? pr->profilename : "NEW";
|
||||
|
||||
fixed_t w = V_StringScaledWidth(
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
notSelectable,
|
||||
FILE_FONT,
|
||||
txt
|
||||
);
|
||||
|
||||
V_DrawStringScaled(
|
||||
((px+26) * FRACUNIT) - (w/2),
|
||||
py * FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
FRACUNIT,
|
||||
notSelectable,
|
||||
i == p->profilen ? R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE) : NULL,
|
||||
FILE_FONT,
|
||||
txt
|
||||
);
|
||||
}
|
||||
}
|
||||
py += 12;
|
||||
}
|
||||
|
||||
V_ClearClipRect();
|
||||
}
|
||||
// "Changes?"
|
||||
else if (p->mdepth == CSSTEP_ASKCHANGES)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -175,6 +176,29 @@ static void M_NewPlayerColors(setup_player_t *p)
|
|||
}
|
||||
}
|
||||
|
||||
static INT16 M_GetMenuCategoryFromFollower(setup_player_t *p)
|
||||
{
|
||||
if (p->followern < 0
|
||||
|| p->followern >= numfollowers
|
||||
|| !K_FollowerUsable(p->followern))
|
||||
return -1;
|
||||
|
||||
INT16 i;
|
||||
|
||||
for (i = 0; i < setup_numfollowercategories; i++)
|
||||
{
|
||||
if (followers[p->followern].category != setup_followercategories[i][1])
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= setup_numfollowercategories)
|
||||
return -1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
// sets up the grid pos for the skin used by the profile.
|
||||
static void M_SetupProfileGridPos(setup_player_t *p)
|
||||
{
|
||||
|
|
@ -188,10 +212,9 @@ static void M_SetupProfileGridPos(setup_player_t *p)
|
|||
// While we're here, read follower values.
|
||||
p->followern = K_FollowerAvailable(pr->follower);
|
||||
|
||||
if (p->followern < 0 || p->followern >= numfollowers || followers[p->followern].category >= numfollowercategories || !K_FollowerUsable(p->followern))
|
||||
p->followercategory = p->followern = -1;
|
||||
else
|
||||
p->followercategory = followers[p->followern].category;
|
||||
p->followercategory = M_GetMenuCategoryFromFollower(p);
|
||||
if (p->followercategory == -1) // unlock gate failed?
|
||||
p->followern = -1;
|
||||
|
||||
p->followercolor = pr->followercolor;
|
||||
if (K_ColorUsable(p->followercolor, true, true) == false)
|
||||
|
|
@ -234,10 +257,9 @@ static void M_SetupMidGameGridPos(setup_player_t *p, UINT8 num)
|
|||
p->followern = cv_follower[num].value;
|
||||
p->followercolor = cv_followercolor[num].value;
|
||||
|
||||
if (p->followern < 0 || p->followern >= numfollowers || followers[p->followern].category >= numfollowercategories || !K_FollowerUsable(p->followern))
|
||||
p->followercategory = p->followern = -1;
|
||||
else
|
||||
p->followercategory = followers[p->followern].category;
|
||||
p->followercategory = M_GetMenuCategoryFromFollower(p);
|
||||
if (p->followercategory == -1) // unlock gate failed?
|
||||
p->followern = -1;
|
||||
|
||||
// Now position the grid for skin
|
||||
p->gridx = skins[i].kartspeed-1;
|
||||
|
|
@ -278,6 +300,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 +550,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);
|
||||
|
|
@ -610,17 +641,21 @@ static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num)
|
|||
else
|
||||
{
|
||||
p->mdepth = CSSTEP_ASKCHANGES;
|
||||
M_GetFollowerState(p);
|
||||
}
|
||||
|
||||
S_StartSound(NULL, sfx_s3k63);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
|
@ -665,7 +700,6 @@ static void M_HandleCharAskChange(setup_player_t *p, UINT8 num)
|
|||
if (!p->changeselect)
|
||||
{
|
||||
// no changes
|
||||
M_GetFollowerState(p);
|
||||
M_HandlePlayerFinalise(p);
|
||||
}
|
||||
else
|
||||
|
|
@ -1066,25 +1100,10 @@ static void M_HandleFollowerCategoryRotate(setup_player_t *p, UINT8 num)
|
|||
}
|
||||
else if (M_MenuExtraPressed(num))
|
||||
{
|
||||
INT16 i = -1;
|
||||
if (p->followercategory < 0
|
||||
&& p->followern >= 0
|
||||
&& p->followern < numfollowers
|
||||
&& followers[p->followern].category < numfollowercategories)
|
||||
{
|
||||
for (i = 0; i < setup_numfollowercategories; i++)
|
||||
{
|
||||
if (followers[p->followern].category != setup_followercategories[i][1])
|
||||
continue;
|
||||
p->followercategory = (p->followercategory == -1)
|
||||
? M_GetMenuCategoryFromFollower(p)
|
||||
: -1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= setup_numfollowercategories)
|
||||
i = -1;
|
||||
}
|
||||
|
||||
p->followercategory = i;
|
||||
p->rotate = CSROTATETICS;
|
||||
p->hitlag = true;
|
||||
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kc3s
|
||||
|
|
@ -1173,8 +1192,6 @@ static void M_HandleFollowerColorRotate(setup_player_t *p, UINT8 num)
|
|||
if (cv_splitdevice.value)
|
||||
num = 0;
|
||||
|
||||
M_AnimateFollower(p);
|
||||
|
||||
if (menucmd[num].dpad_lr > 0)
|
||||
{
|
||||
p->followercolor = M_GetColorAfter(&p->colors, p->followercolor, 1);
|
||||
|
|
@ -1229,6 +1246,11 @@ boolean M_CharacterSelectHandler(INT32 choice)
|
|||
setup_player_t *p = &setup_player[i];
|
||||
boolean playersChanged = false;
|
||||
|
||||
if (p->mdepth > CSSTEP_FOLLOWER)
|
||||
{
|
||||
M_AnimateFollower(p);
|
||||
}
|
||||
|
||||
if (p->delay == 0 && menucmd[i].delay == 0)
|
||||
{
|
||||
if (!optionsmenu.profile)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue