Character Select menu: Forceskin is now reflected on the menu

Matches cvar updates in real time, so can't change what's written to setup_chargrid
This commit is contained in:
toaster 2023-02-17 17:07:33 +00:00
parent 4d607ccdec
commit 0474675109
2 changed files with 79 additions and 28 deletions

View file

@ -50,6 +50,7 @@
#include "k_follower.h" #include "k_follower.h"
#include "d_player.h" // KITEM_ constants #include "d_player.h" // KITEM_ constants
#include "doomstat.h" // MAXSPLITSCREENPLAYERS #include "doomstat.h" // MAXSPLITSCREENPLAYERS
#include "k_grandprix.h" // K_CanChangeRules
#include "i_joy.h" // for joystick menu controls #include "i_joy.h" // for joystick menu controls
@ -1689,6 +1690,7 @@ void M_DrawCharacterSelect(void)
INT16 quadx, quady; INT16 quadx, quady;
INT16 skin; INT16 skin;
INT32 basex = optionsmenu.profile != NULL ? 64 : 0; INT32 basex = optionsmenu.profile != NULL ? 64 : 0;
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
if (setup_numplayers > 0) if (setup_numplayers > 0)
{ {
@ -1696,26 +1698,29 @@ void M_DrawCharacterSelect(void)
} }
// We have to loop twice -- first time to draw the drop shadows, a second time to draw the icons. // We have to loop twice -- first time to draw the drop shadows, a second time to draw the icons.
for (i = 0; i < 9; i++) if (forceskin == false)
{ {
for (j = 0; j < 9; j++) for (i = 0; i < 9; i++)
{ {
skin = setup_chargrid[i][j].skinlist[setup_page]; for (j = 0; j < 9; j++)
quadx = 4 * (i / 3);
quady = 4 * (j / 3);
// Here's a quick little cheat to save on drawing time!
// Don't draw a shadow if it'll get covered by another icon
if ((i % 3 < 2) && (j % 3 < 2))
{ {
if ((setup_chargrid[i+1][j].skinlist[setup_page] != -1) skin = setup_chargrid[i][j].skinlist[setup_page];
&& (setup_chargrid[i][j+1].skinlist[setup_page] != -1) quadx = 4 * (i / 3);
&& (setup_chargrid[i+1][j+1].skinlist[setup_page] != -1)) quady = 4 * (j / 3);
continue;
}
if (skin != -1) // Here's a quick little cheat to save on drawing time!
V_DrawScaledPatch(basex+ 82 + (i*16) + quadx + 1, 22 + (j*16) + quady + 1, 0, W_CachePatchName("ICONBACK", PU_CACHE)); // Don't draw a shadow if it'll get covered by another icon
if ((i % 3 < 2) && (j % 3 < 2))
{
if ((setup_chargrid[i+1][j].skinlist[setup_page] != -1)
&& (setup_chargrid[i][j+1].skinlist[setup_page] != -1)
&& (setup_chargrid[i+1][j+1].skinlist[setup_page] != -1))
continue;
}
if (skin != -1)
V_DrawScaledPatch(basex+ 82 + (i*16) + quadx + 1, 22 + (j*16) + quady + 1, 0, W_CachePatchName("ICONBACK", PU_CACHE));
}
} }
} }
@ -1725,8 +1730,22 @@ void M_DrawCharacterSelect(void)
// Draw the icons now // Draw the icons now
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
{ {
if ((forceskin == true) && (i != skins[cv_forceskin.value].kartspeed-1))
continue;
for (j = 0; j < 9; j++) for (j = 0; j < 9; j++)
{ {
if (forceskin == true)
{
if (j != skins[cv_forceskin.value].kartweight-1)
continue;
skin = cv_forceskin.value;
}
else
{
skin = setup_chargrid[i][j].skinlist[setup_page];
}
for (k = 0; k < setup_numplayers; k++) for (k = 0; k < setup_numplayers; k++)
{ {
if (setup_player[k].mdepth < CSSTEP_ASKCHANGES) if (setup_player[k].mdepth < CSSTEP_ASKCHANGES)
@ -1736,7 +1755,6 @@ void M_DrawCharacterSelect(void)
break; // k == setup_numplayers means no one has it selected break; // k == setup_numplayers means no one has it selected
} }
skin = setup_chargrid[i][j].skinlist[setup_page];
quadx = 4 * (i / 3); quadx = 4 * (i / 3);
quady = 4 * (j / 3); quady = 4 * (j / 3);
@ -1752,7 +1770,7 @@ void M_DrawCharacterSelect(void)
V_DrawMappedPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady, 0, faceprefix[skin][FACE_RANK], colormap); V_DrawMappedPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady, 0, faceprefix[skin][FACE_RANK], colormap);
// draw dot if there are more alts behind there! // draw dot if there are more alts behind there!
if (setup_page+1 < setup_chargrid[i][j].numskins) if (forceskin == false && setup_page+1 < setup_chargrid[i][j].numskins)
V_DrawScaledPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady + 11, 0, W_CachePatchName("ALTSDOT", PU_CACHE)); V_DrawScaledPatch(basex + 82 + (i*16) + quadx, 22 + (j*16) + quady + 11, 0, W_CachePatchName("ALTSDOT", PU_CACHE));
} }
} }

View file

@ -4,6 +4,7 @@
#include "../k_menu.h" #include "../k_menu.h"
#include "../r_skins.h" #include "../r_skins.h"
#include "../s_sound.h" #include "../s_sound.h"
#include "../k_grandprix.h" // K_CanChangeRules
menuitem_t PLAY_CharSelect[] = menuitem_t PLAY_CharSelect[] =
{ {
@ -789,6 +790,7 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
{ {
UINT8 numclones; UINT8 numclones;
INT32 skin; INT32 skin;
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
if (cv_splitdevice.value) if (cv_splitdevice.value)
num = 0; num = 0;
@ -848,19 +850,35 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
if (M_MenuConfirmPressed(num) /*|| M_MenuButtonPressed(num, MBT_START)*/) if (M_MenuConfirmPressed(num) /*|| M_MenuButtonPressed(num, MBT_START)*/)
{ {
skin = setup_chargrid[p->gridx][p->gridy].skinlist[setup_page]; if (forceskin)
if (setup_page >= setup_chargrid[p->gridx][p->gridy].numskins || skin == -1)
{ {
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2 if ((p->gridx != skins[cv_forceskin.value].kartspeed-1)
|| (p->gridy != skins[cv_forceskin.value].kartweight-1))
{
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
}
else
{
p->mdepth = CSSTEP_COLORS;
S_StartSound(NULL, sfx_s3k63);
}
} }
else else
{ {
if (setup_page+1 == setup_chargrid[p->gridx][p->gridy].numskins) skin = setup_chargrid[p->gridx][p->gridy].skinlist[setup_page];
p->mdepth = CSSTEP_COLORS; // Skip clones menu if there are none on this page. if (setup_page >= setup_chargrid[p->gridx][p->gridy].numskins || skin == -1)
{
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
}
else else
p->mdepth = CSSTEP_ALTS; {
if (setup_page+1 == setup_chargrid[p->gridx][p->gridy].numskins)
p->mdepth = CSSTEP_COLORS; // Skip clones menu if there are none on this page.
else
p->mdepth = CSSTEP_ALTS;
S_StartSound(NULL, sfx_s3k63); S_StartSound(NULL, sfx_s3k63);
}
} }
M_SetMenuDelay(num); M_SetMenuDelay(num);
@ -884,7 +902,7 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
M_SetMenuDelay(num); M_SetMenuDelay(num);
} }
if (num == 0 && setup_numplayers == 1 && setup_maxpage) // ONLY one player. if (num == 0 && setup_numplayers == 1 && setup_maxpage && !forceskin) // ONLY one player.
{ {
if (M_MenuButtonPressed(num, MBT_L)) if (M_MenuButtonPressed(num, MBT_L))
{ {
@ -961,6 +979,8 @@ static void M_HandleCharRotate(setup_player_t *p, UINT8 num)
static void M_HandleColorRotate(setup_player_t *p, UINT8 num) static void M_HandleColorRotate(setup_player_t *p, UINT8 num)
{ {
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
if (cv_splitdevice.value) if (cv_splitdevice.value)
num = 0; num = 0;
@ -987,7 +1007,8 @@ static void M_HandleColorRotate(setup_player_t *p, UINT8 num)
} }
else if (M_MenuBackPressed(num)) else if (M_MenuBackPressed(num))
{ {
if (setup_chargrid[p->gridx][p->gridy].numskins == 1) if (forceskin
|| setup_chargrid[p->gridx][p->gridy].numskins == 1)
{ {
p->mdepth = CSSTEP_CHARS; // Skip clones menu p->mdepth = CSSTEP_CHARS; // Skip clones menu
} }
@ -1253,6 +1274,7 @@ static void M_HandleFollowerColorRotate(setup_player_t *p, UINT8 num)
boolean M_CharacterSelectHandler(INT32 choice) boolean M_CharacterSelectHandler(INT32 choice)
{ {
INT32 i; INT32 i;
boolean forceskin = (Playing() && K_CanChangeRules(true) == true) && (cv_forceskin.value != -1);
(void)choice; (void)choice;
@ -1318,7 +1340,18 @@ boolean M_CharacterSelectHandler(INT32 choice)
} }
// Just makes it easier to access later // Just makes it easier to access later
p->skin = setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum]; if (forceskin)
{
if (p->gridx != skins[cv_forceskin.value].kartspeed-1
|| p->gridy != skins[cv_forceskin.value].kartweight-1)
p->skin = -1;
else
p->skin = cv_forceskin.value;
}
else
{
p->skin = setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum];
}
// Keep profile colour. // Keep profile colour.
/*if (p->mdepth < CSSTEP_COLORS) /*if (p->mdepth < CSSTEP_COLORS)