From 7612d7cdf9d596f756cf99006e21a98a4f2e9ca9 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Sat, 19 Feb 2022 22:15:56 +0100 Subject: [PATCH] CharSel: Make sure the clone we're hovering over actually exists --- src/k_menufunc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/k_menufunc.c b/src/k_menufunc.c index c5adc1afa..a7b710ba6 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -2296,6 +2296,8 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num) { INT32 i; + UINT8 numclones; + if (menucmd[num].dpad_ud > 0) { p->gridy++; @@ -2330,6 +2332,13 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num) M_SetMenuDelay(num); } + // Process this after possible pad movement, + // this makes sure we don't have a weird ghost hover on a character with no clones. + numclones = setup_chargrid[p->gridx][p->gridy].numskins; + + if (p->clonenum >= numclones) + p->clonenum = 0; + if (M_MenuButtonPressed(num, MBT_A) || M_MenuButtonPressed(num, MBT_X) /*|| M_MenuButtonPressed(num, MBT_START)*/) { if (setup_chargrid[p->gridx][p->gridy].numskins == 0)