From c750c17f377e8e651aaa63235cf07e2af7a48456 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sat, 26 Feb 2022 10:52:50 +0100 Subject: [PATCH] fix softlock on profile character select --- src/k_menufunc.c | 57 ++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/k_menufunc.c b/src/k_menufunc.c index c806446d1..4204df463 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -1990,6 +1990,32 @@ struct setup_explosions_s setup_explosions[48]; UINT8 setup_numplayers = 0; // This variable is very important, it was extended to determine how many players exist in ALL menus. tic_t setup_animcounter = 0; +// sets up the grid pos for the skin used by the profile. +static void M_SetupProfileGridPos(setup_player_t *p) +{ + profile_t *pr = PR_GetProfile(p->profilen); + INT32 i; + + for (i = 0; i < numskins; i++) + { + if (!(strcmp(pr->skinname, skins[i].name))) + { + INT32 alt = 0; // Hey it's my character's name! + p->gridx = skins[i].kartspeed-1; + p->gridy = skins[i].kartweight-1; + + // Now this put our cursor on the good alt + while (setup_chargrid[p->gridx][p->gridy].skinlist[alt] != i) + alt++; + + p->clonenum = alt; + p->color = pr->color; + return; // we're done here + } + } +} + + void M_CharacterSelectInit(void) { UINT8 i, j; @@ -2041,8 +2067,12 @@ void M_CharacterSelectInit(void) // If we're on prpfile select, skip straight to CSSTEP_CHARS if (optionsmenu.profile && j == 0) + { + setup_player[j].profilen = optionsmenu.profilen; + PR_ApplyProfile(setup_player[j].profilen, 0); + M_SetupProfileGridPos(&setup_player[j]); setup_player[j].mdepth = CSSTEP_CHARS; - + } } } } @@ -2199,31 +2229,6 @@ static boolean M_HandlePressStart(setup_player_t *p, UINT8 num) return false; } -// sets up the grid pos for the skin used by the profile. -static void M_SetupProfileGridPos(setup_player_t *p) -{ - profile_t *pr = PR_GetProfile(p->profilen); - INT32 i; - - for (i = 0; i < numskins; i++) - { - if (!(strcmp(pr->skinname, skins[i].name))) - { - INT32 alt = 0; // Hey it's my character's name! - p->gridx = skins[i].kartspeed-1; - p->gridy = skins[i].kartweight-1; - - // Now this put our cursor on the good alt - while (setup_chargrid[p->gridx][p->gridy].skinlist[alt] != i) - alt++; - - p->clonenum = alt; - p->color = pr->color; - return; // we're done here - } - } -} - static boolean M_HandleCSelectProfile(setup_player_t *p, UINT8 num) { const UINT8 maxp = PR_GetNumProfiles() -1;