Allow selecting profile with no changes to speed up charsel process

This commit is contained in:
SinnamonLat 2022-05-28 13:12:42 +02:00
parent f0e5c144ec
commit d5e9283c2e
5 changed files with 92 additions and 21 deletions

View file

@ -243,6 +243,9 @@ void HU_Init(void)
PR ("TNYFN");
REG;
PR ("FILEF");
REG;
ADIM (LT);
PR ("LTFNT");
REG;
@ -287,10 +290,6 @@ void HU_Init(void)
PR ("GAMEM");
REG;
ADIM (AZ);
PR ("FILEF");
REG;
ADIM (LT);
PR ("THIFN");
REG;

View file

@ -54,6 +54,7 @@ enum
{
X (HU),
X (TINY),
X (FILE),
X (LT),
X (CRED),
@ -68,7 +69,6 @@ enum
X (KART),
X (GM),
X (FILE),
X (LSHI),
X (LSLOW),
};

View file

@ -519,6 +519,7 @@ typedef enum
{
CSSTEP_NONE = 0,
CSSTEP_PROFILE,
CSSTEP_ASKCHANGES,
CSSTEP_CHARS,
CSSTEP_ALTS,
CSSTEP_COLORS,
@ -543,6 +544,8 @@ typedef struct setup_player_s
// We can allow them to retain the device with no consequence as when P1 is alone, they have exclusive keyboard fallback options.
UINT8 ponedevice;
UINT8 changeselect;
INT32 followern;
UINT16 followercolor;
tic_t follower_tics;

View file

@ -1227,6 +1227,26 @@ static void M_DrawCharSelectPreview(UINT8 num)
}
}
// "Changes?"
else if (p->mdepth == CSSTEP_ASKCHANGES)
{
UINT8 i;
char choices[][4] = {"NO", "YES"};
INT32 xpos = x+8;
INT32 ypos = y+38;
V_DrawFileString(xpos, ypos, 0, "CHANGES?");
for (i = 0; i < 2; i++)
{
UINT8 cy = ypos+16 + (i*10);
if (p->changeselect == i)
V_DrawScaledPatch(xpos+4, cy, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
V_DrawString(xpos+20, cy, p->changeselect == i ? highlightflags : 0, choices[i]);
}
}
}
static void M_DrawCharSelectExplosions(void)

View file

@ -2351,6 +2351,21 @@ static void M_SetupReadyExplosions(setup_player_t *p)
}
}
// Gets the selected follower's state for a given setup player.
static void M_GetFollowerState(setup_player_t *p)
{
p->follower_state = &states[followers[p->followern].followstate];
if (p->follower_state->frame & FF_ANIMATE)
p->follower_tics = p->follower_state->var2; // support for FF_ANIMATE
else
p->follower_tics = p->follower_state->tics;
p->follower_frame = p->follower_state->frame & FF_FRAMEMASK;
}
static boolean M_DeviceAvailable(INT32 deviceID, UINT8 numPlayers)
{
INT32 i;
@ -2523,7 +2538,8 @@ static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num)
PR_ApplyProfile(p->profilen, realnum); // Otherwise P1 would inherit the last player's profile in splitdevice and that's not what we want...
M_SetupProfileGridPos(p);
p->mdepth = CSSTEP_CHARS;
p->changeselect = 0;
p->mdepth = CSSTEP_ASKCHANGES;
S_StartSound(NULL, sfx_s3k63);
}
@ -2531,6 +2547,51 @@ static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num)
}
static void M_HandleCharAskChange(setup_player_t *p, UINT8 num)
{
if (cv_splitdevice.value)
num = 0;
// there's only 2 options so lol
if (menucmd[num].dpad_ud != 0)
{
p->changeselect = (p->changeselect == 0) ? 1 : 0;
S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(num);
}
else if (M_MenuBackPressed(num))
{
p->changeselect = 0;
p->mdepth = CSSTEP_PROFILE;
S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(num);
}
else if (M_MenuConfirmPressed(num))
{
// no changes
if (!p->changeselect)
{
M_GetFollowerState(p);
p->mdepth = CSSTEP_READY;
p->delay = TICRATE;
S_StartSound(NULL, sfx_s3k4e);
M_SetupReadyExplosions(p);
}
// changes
else
p->mdepth = CSSTEP_CHARS;
M_SetMenuDelay(num);
S_StartSound(NULL, sfx_s3k63);
}
}
static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
{
INT32 i;
@ -2639,20 +2700,6 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
return false;
}
// Gets the selected follower's state for a given setup player.
static void M_GetFollowerState(setup_player_t *p)
{
p->follower_state = &states[followers[p->followern].followstate];
if (p->follower_state->frame & FF_ANIMATE)
p->follower_tics = p->follower_state->var2; // support for FF_ANIMATE
else
p->follower_tics = p->follower_state->tics;
p->follower_frame = p->follower_state->frame & FF_FRAMEMASK;
}
static void M_HandleCharRotate(setup_player_t *p, UINT8 num)
{
@ -2800,7 +2847,6 @@ static void M_HandleChooseFollower(setup_player_t *p, UINT8 num)
p->delay = TICRATE;
M_SetupReadyExplosions(p);
S_StartSound(NULL, sfx_s3k4e);
M_SetMenuDelay(num);
}
S_StartSound(NULL, sfx_s3k63);
@ -2926,6 +2972,9 @@ boolean M_CharacterSelectHandler(INT32 choice)
case CSSTEP_PROFILE:
playersChanged = M_HandleCSelectProfile(p, i);
break;
case CSSTEP_ASKCHANGES:
M_HandleCharAskChange(p, i);
break;
case CSSTEP_CHARS: // Character Select grid
M_HandleCharacterGrid(p, i);
break;