Character select: Fix mismatch between ground truth and unlock-dependent followercategory

Resolves Fyrus' follower select bug
This commit is contained in:
toaster 2023-12-26 22:13:05 +00:00
parent 122ede8de9
commit bfa52b695e

View file

@ -1016,26 +1016,30 @@ static void M_HandleFollowerCategoryRotate(setup_player_t *p, UINT8 num)
} }
else else
{ {
if (p->followern < 0 || followers[p->followern].category != p->followercategory) if (p->followern < 0
|| followers[p->followern].category != setup_followercategories[p->followercategory][1])
{ {
p->followern = 0; p->followern = 0;
while (p->followern < numfollowers while (p->followern < numfollowers)
&& (followers[p->followern].category != setup_followercategories[p->followercategory][1] {
|| !K_FollowerUsable(p->followern))) if (followers[p->followern].category == setup_followercategories[p->followercategory][1]
&& K_FollowerUsable(p->followern))
break;
p->followern++; p->followern++;
} }
if (p->followern >= numfollowers)
{
p->followern = -1;
S_StartSound(NULL, sfx_s3kb2);
} }
else
if (p->followern < numfollowers)
{ {
M_GetFollowerState(p); M_GetFollowerState(p);
p->mdepth = CSSTEP_FOLLOWER; p->mdepth = CSSTEP_FOLLOWER;
S_StartSound(NULL, sfx_s3k63); S_StartSound(NULL, sfx_s3k63);
} }
else
{
p->followern = -1;
S_StartSound(NULL, sfx_s3kb2);
}
} }
M_SetMenuDelay(num); M_SetMenuDelay(num);
@ -1049,10 +1053,25 @@ static void M_HandleFollowerCategoryRotate(setup_player_t *p, UINT8 num)
} }
else if (M_MenuExtraPressed(num)) else if (M_MenuExtraPressed(num))
{ {
if (p->followercategory >= 0 || p->followern < 0 || p->followern >= numfollowers || followers[p->followern].category >= numfollowercategories) INT16 i = -1;
p->followercategory = -1; if (p->followercategory < 0
else && p->followern >= 0
p->followercategory = followers[p->followern].category; && 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;
break;
}
if (i >= setup_numfollowercategories)
i = -1;
}
p->followercategory = i;
p->rotate = CSROTATETICS; p->rotate = CSROTATETICS;
p->hitlag = true; p->hitlag = true;
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kc3s S_StartSound(NULL, sfx_s3k7b); //sfx_s3kc3s