Add page system on csel when alone to make alts easier to see

This commit is contained in:
SinnamonLat 2022-07-22 13:57:48 +02:00
parent 3e904e23aa
commit fc4b0d8776
3 changed files with 63 additions and 10 deletions

View file

@ -559,6 +559,10 @@ extern setup_player_t setup_player[MAXSPLITSCREENPLAYERS];
extern UINT8 setup_numplayers; extern UINT8 setup_numplayers;
extern tic_t setup_animcounter; extern tic_t setup_animcounter;
// for charsel pages.
extern UINT8 setup_page;
extern UINT8 setup_maxpage;
#define CSROTATETICS 6 #define CSROTATETICS 6
// The selection spawns 3 explosions in 4 directions, and there's 4 players -- 3 * 4 * 4 = 48 // The selection spawns 3 explosions in 4 directions, and there's 4 players -- 3 * 4 * 4 = 48

View file

@ -1123,8 +1123,13 @@ static boolean M_DrawFollowerSprite(INT16 x, INT16 y, INT32 num, INT32 addflags,
static void M_DrawCharSelectSprite(UINT8 num, INT16 x, INT16 y) static void M_DrawCharSelectSprite(UINT8 num, INT16 x, INT16 y)
{ {
setup_player_t *p = &setup_player[num]; setup_player_t *p = &setup_player[num];
UINT8 cnum = p->clonenum;
SINT8 skin = setup_chargrid[p->gridx][p->gridy].skinlist[p->clonenum]; // for p1 alone don't try to preview things on pages that don't exist lol.
if (p->mdepth == CSSTEP_CHARS && setup_numplayers == 1)
cnum = setup_page;
INT16 skin = setup_chargrid[p->gridx][p->gridy].skinlist[cnum];
UINT8 color = p->color; UINT8 color = p->color;
UINT8 *colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE); UINT8 *colormap = R_GetTranslationColormap(skin, color, GTC_MENUCACHE);
INT32 flags = 0; INT32 flags = 0;
@ -1449,6 +1454,11 @@ void M_DrawCharacterSelect(void)
SINT8 skin; SINT8 skin;
INT32 basex = optionsmenu.profile != NULL ? 64 : 0; INT32 basex = optionsmenu.profile != NULL ? 64 : 0;
// Draw page num.
// @TODO: make it fancier than the default string lol.
if (setup_numplayers < 2)
V_DrawCenteredString(160, 1, 0, va("%d/%d", setup_page+1, setup_maxpage+1));
if (setup_numplayers > 0) if (setup_numplayers > 0)
{ {
priority = setup_animcounter % setup_numplayers; priority = setup_animcounter % setup_numplayers;
@ -1459,7 +1469,7 @@ void M_DrawCharacterSelect(void)
{ {
for (j = 0; j < 9; j++) for (j = 0; j < 9; j++)
{ {
skin = setup_chargrid[i][j].skinlist[0]; skin = setup_chargrid[i][j].skinlist[setup_page];
quadx = 4 * (i / 3); quadx = 4 * (i / 3);
quady = 4 * (j / 3); quady = 4 * (j / 3);
@ -1467,9 +1477,9 @@ void M_DrawCharacterSelect(void)
// Don't draw a shadow if it'll get covered by another icon // Don't draw a shadow if it'll get covered by another icon
if ((i % 3 < 2) && (j % 3 < 2)) if ((i % 3 < 2) && (j % 3 < 2))
{ {
if ((setup_chargrid[i+1][j].skinlist[0] != -1) if ((setup_chargrid[i+1][j].skinlist[setup_page] != -1)
&& (setup_chargrid[i][j+1].skinlist[0] != -1) && (setup_chargrid[i][j+1].skinlist[setup_page] != -1)
&& (setup_chargrid[i+1][j+1].skinlist[0] != -1)) && (setup_chargrid[i+1][j+1].skinlist[setup_page] != -1))
continue; continue;
} }
@ -1492,7 +1502,7 @@ 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[0]; skin = setup_chargrid[i][j].skinlist[setup_page];
quadx = 4 * (i / 3); quadx = 4 * (i / 3);
quady = 4 * (j / 3); quady = 4 * (j / 3);
@ -1507,7 +1517,8 @@ 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);
if (setup_chargrid[i][j].numskins > 1) // draw dot if there are more alts behind there!
if (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

@ -2148,6 +2148,9 @@ 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. 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; tic_t setup_animcounter = 0;
UINT8 setup_page = 0;
UINT8 setup_maxpage = 0; // For charsel page to identify alts easier...
// sets up the grid pos for the skin used by the profile. // sets up the grid pos for the skin used by the profile.
static void M_SetupProfileGridPos(setup_player_t *p) static void M_SetupProfileGridPos(setup_player_t *p)
{ {
@ -2210,6 +2213,7 @@ static void M_SetupMidGameGridPos(setup_player_t *p, UINT8 num)
void M_CharacterSelectInit(void) void M_CharacterSelectInit(void)
{ {
UINT8 i, j; UINT8 i, j;
setup_maxpage = 0;
// While we're editing profiles, don't unset the devices for p1 // While we're editing profiles, don't unset the devices for p1
if (gamestate == GS_MENU) if (gamestate == GS_MENU)
@ -2263,6 +2267,8 @@ void M_CharacterSelectInit(void)
{ {
setup_chargrid[x][y].skinlist[setup_chargrid[x][y].numskins] = i; setup_chargrid[x][y].skinlist[setup_chargrid[x][y].numskins] = i;
setup_chargrid[x][y].numskins++; setup_chargrid[x][y].numskins++;
setup_maxpage = max(setup_maxpage, setup_chargrid[x][y].numskins-1);
} }
for (j = 0; j < MAXSPLITSCREENPLAYERS; j++) for (j = 0; j < MAXSPLITSCREENPLAYERS; j++)
@ -2295,6 +2301,8 @@ void M_CharacterSelectInit(void)
} }
} }
} }
setup_page = 0;
} }
void M_CharacterSelect(INT32 choice) void M_CharacterSelect(INT32 choice)
@ -2595,6 +2603,7 @@ static void M_HandleCharAskChange(setup_player_t *p, UINT8 num)
static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num) static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
{ {
UINT8 numclones; UINT8 numclones;
INT32 skin;
if (cv_splitdevice.value) if (cv_splitdevice.value)
num = 0; num = 0;
@ -2633,6 +2642,9 @@ static boolean M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
M_SetMenuDelay(num); M_SetMenuDelay(num);
} }
// try to set the clone num to the page # if possible.
p->clonenum = setup_page;
// Process this after possible pad movement, // Process this after possible pad movement,
// this makes sure we don't have a weird ghost hover on a character with no clones. // 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; numclones = setup_chargrid[p->gridx][p->gridy].numskins;
@ -2642,14 +2654,15 @@ 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)*/)
{ {
if (setup_chargrid[p->gridx][p->gridy].numskins == 0) skin = setup_chargrid[p->gridx][p->gridy].skinlist[setup_page];
if (setup_page >= setup_chargrid[p->gridx][p->gridy].numskins || skin == -1)
{ {
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2 S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
} }
else else
{ {
if (setup_chargrid[p->gridx][p->gridy].numskins == 1) if (setup_page+1 == setup_chargrid[p->gridx][p->gridy].numskins)
p->mdepth = CSSTEP_COLORS; // Skip clones menu p->mdepth = CSSTEP_COLORS; // Skip clones menu if there are none on this page.
else else
p->mdepth = CSSTEP_ALTS; p->mdepth = CSSTEP_ALTS;
@ -2677,6 +2690,30 @@ 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 (M_MenuButtonPressed(num, MBT_L))
{
if (setup_page == 0)
setup_page = setup_maxpage;
else
setup_page--;
S_StartSound(NULL, sfx_s3k63);
M_SetMenuDelay(num);
}
else if (M_MenuButtonPressed(num, MBT_R))
{
if (setup_page == setup_maxpage)
setup_page = 0;
else
setup_page++;
S_StartSound(NULL, sfx_s3k63);
M_SetMenuDelay(num);
}
}
return false; return false;
} }
@ -2994,6 +3031,7 @@ boolean M_CharacterSelectHandler(INT32 choice)
if (playersChanged == true) if (playersChanged == true)
{ {
setup_page = 0; // reset that.
break; break;
} }
} }