Finish menu input for char select

TODO:
- Menu delay shouldn't be a static value and work closer to how it did before (likely requires a more complicated system than just calling G_PlayerInputDown ... menu ticcmds? lol)
- Create a sdl function to determine if any of the possible joysticks' buttons are being pressed & return the joystick number & set usejoystick to that number ... for the PRESS START prompt.

Already tired of this code, I'm good
This commit is contained in:
Sally Coolatta 2021-12-04 17:58:23 -05:00
parent 58d5d1759b
commit d2e26bbc86
2 changed files with 75 additions and 71 deletions

View file

@ -335,7 +335,7 @@ extern INT16 skullAnimCounter; // skull animation counter
extern INT32 menuKey; // keyboard key pressed for menu extern INT32 menuKey; // keyboard key pressed for menu
#define MENUDELAYTIME 5 #define MENUDELAYTIME 3 // TODO: recreate how old input holding worked
extern INT16 menuInputDelay; extern INT16 menuInputDelay;
extern struct menutransition_s { extern struct menutransition_s {

View file

@ -1875,7 +1875,7 @@ static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
if (p->gridy > 8) if (p->gridy > 8)
p->gridy = 0; p->gridy = 0;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
menuInputDelay = MENUDELAYTIME; p->delay = MENUDELAYTIME;
} }
else if (G_PlayerInputDown(num, gc_up, true) == true) else if (G_PlayerInputDown(num, gc_up, true) == true)
{ {
@ -1883,7 +1883,7 @@ static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
if (p->gridy < 0) if (p->gridy < 0)
p->gridy = 8; p->gridy = 8;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
menuInputDelay = MENUDELAYTIME; p->delay = MENUDELAYTIME;
} }
else if (G_PlayerInputDown(num, gc_right, true) == true) else if (G_PlayerInputDown(num, gc_right, true) == true)
{ {
@ -1891,7 +1891,7 @@ static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
if (p->gridx > 8) if (p->gridx > 8)
p->gridx = 0; p->gridx = 0;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
menuInputDelay = MENUDELAYTIME; p->delay = MENUDELAYTIME;
} }
else if (G_PlayerInputDown(num, gc_left, true) == true) else if (G_PlayerInputDown(num, gc_left, true) == true)
{ {
@ -1899,7 +1899,7 @@ static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
if (p->gridx < 0) if (p->gridx < 0)
p->gridx = 8; p->gridx = 8;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
menuInputDelay = MENUDELAYTIME; p->delay = MENUDELAYTIME;
} }
else if (G_PlayerInputDown(num, gc_a, true) == true || G_PlayerInputDown(num, gc_start, true) == true) else if (G_PlayerInputDown(num, gc_a, true) == true || G_PlayerInputDown(num, gc_start, true) == true)
{ {
@ -1917,7 +1917,7 @@ static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
S_StartSound(NULL, sfx_s3k63); S_StartSound(NULL, sfx_s3k63);
} }
menuInputDelay = MENUDELAYTIME; p->delay = MENUDELAYTIME;
} }
else if (G_PlayerInputDown(num, gc_b, true) == true) else if (G_PlayerInputDown(num, gc_b, true) == true)
{ {
@ -1931,80 +1931,81 @@ static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
S_StartSound(NULL, sfx_s3kb2); S_StartSound(NULL, sfx_s3kb2);
} }
menuInputDelay = MENUDELAYTIME; p->delay = MENUDELAYTIME;
} }
} }
static void M_HandleCharRotate(INT32 choice, setup_player_t *p) static void M_HandleCharRotate(setup_player_t *p, UINT8 num)
{ {
UINT8 numclones = setup_chargrid[p->gridx][p->gridy].numskins; UINT8 numclones = setup_chargrid[p->gridx][p->gridy].numskins;
switch (choice) if (G_PlayerInputDown(num, gc_right, true) == true)
{ {
case KEY_RIGHTARROW: p->clonenum++;
p->clonenum++; if (p->clonenum >= numclones)
if (p->clonenum >= numclones) p->clonenum = 0;
p->clonenum = 0; p->rotate = CSROTATETICS;
p->rotate = CSROTATETICS; p->delay = CSROTATETICS;
p->delay = CSROTATETICS; S_StartSound(NULL, sfx_s3kc3s);
S_StartSound(NULL, sfx_s3kc3s); }
break; else if (G_PlayerInputDown(num, gc_left, true) == true)
case KEY_LEFTARROW: {
p->clonenum--; p->clonenum--;
if (p->clonenum < 0) if (p->clonenum < 0)
p->clonenum = numclones-1; p->clonenum = numclones-1;
p->rotate = -CSROTATETICS; p->rotate = -CSROTATETICS;
p->delay = CSROTATETICS; p->delay = CSROTATETICS;
S_StartSound(NULL, sfx_s3kc3s); S_StartSound(NULL, sfx_s3kc3s);
break; }
case KEY_ENTER: else if (G_PlayerInputDown(num, gc_a, true) == true || G_PlayerInputDown(num, gc_start, true) == true)
p->mdepth = CSSTEP_COLORS; {
S_StartSound(NULL, sfx_s3k63); p->mdepth = CSSTEP_COLORS;
break; S_StartSound(NULL, sfx_s3k63);
case KEY_ESCAPE: p->delay = MENUDELAYTIME;
p->mdepth = CSSTEP_CHARS; }
S_StartSound(NULL, sfx_s3k5b); else if (G_PlayerInputDown(num, gc_b, true) == true)
break; {
default: p->mdepth = CSSTEP_CHARS;
break; S_StartSound(NULL, sfx_s3k5b);
p->delay = MENUDELAYTIME;
} }
} }
static void M_HandleColorRotate(INT32 choice, setup_player_t *p) static void M_HandleColorRotate(setup_player_t *p, UINT8 num)
{ {
switch (choice) if (G_PlayerInputDown(num, gc_right, true) == true)
{ {
case KEY_RIGHTARROW: p->color++;
p->color++; if (p->color >= numskincolors)
if (p->color >= numskincolors) p->color = 1;
p->color = 1; p->rotate = CSROTATETICS;
p->rotate = CSROTATETICS; p->delay = MENUDELAYTIME; //CSROTATETICS
//p->delay = CSROTATETICS; S_StartSound(NULL, sfx_s3k5b); //sfx_s3kc3s
S_StartSound(NULL, sfx_s3k5b); //sfx_s3kc3s }
break; else if (G_PlayerInputDown(num, gc_left, true) == true)
case KEY_LEFTARROW: {
p->color--; p->color--;
if (p->color < 1) if (p->color < 1)
p->color = numskincolors-1; p->color = numskincolors-1;
p->rotate = -CSROTATETICS; p->rotate = -CSROTATETICS;
//p->delay = CSROTATETICS; p->delay = MENUDELAYTIME; //CSROTATETICS
S_StartSound(NULL, sfx_s3k5b); //sfx_s3kc3s S_StartSound(NULL, sfx_s3k5b); //sfx_s3kc3s
break; }
case KEY_ENTER: else if (G_PlayerInputDown(num, gc_a, true) == true || G_PlayerInputDown(num, gc_start, true) == true)
p->mdepth = CSSTEP_READY; {
p->delay = TICRATE; p->mdepth = CSSTEP_READY;
M_SetupReadyExplosions(p); p->delay = TICRATE;
S_StartSound(NULL, sfx_s3k4e); M_SetupReadyExplosions(p);
break; S_StartSound(NULL, sfx_s3k4e);
case KEY_ESCAPE: }
if (setup_chargrid[p->gridx][p->gridy].numskins == 1) else if (G_PlayerInputDown(num, gc_b, true) == true)
p->mdepth = CSSTEP_CHARS; // Skip clones menu {
else if (setup_chargrid[p->gridx][p->gridy].numskins == 1)
p->mdepth = CSSTEP_ALTS; p->mdepth = CSSTEP_CHARS; // Skip clones menu
S_StartSound(NULL, sfx_s3k5b); else
break; p->mdepth = CSSTEP_ALTS;
default: S_StartSound(NULL, sfx_s3k5b);
break; p->delay = MENUDELAYTIME;
} }
} }
@ -2012,6 +2013,8 @@ boolean M_CharacterSelectHandler(INT32 choice)
{ {
UINT8 i; UINT8 i;
(void)choice;
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {
setup_player_t *p = &setup_player[i]; setup_player_t *p = &setup_player[i];
@ -2036,17 +2039,18 @@ boolean M_CharacterSelectHandler(INT32 choice)
M_HandleCharacterGrid(p, i); M_HandleCharacterGrid(p, i);
break; break;
case CSSTEP_ALTS: // Select clone case CSSTEP_ALTS: // Select clone
M_HandleCharRotate(choice, p); M_HandleCharRotate(p, i);
break; break;
case CSSTEP_COLORS: // Select color case CSSTEP_COLORS: // Select color
M_HandleColorRotate(choice, p); M_HandleColorRotate(p, i);
break; break;
case CSSTEP_READY: case CSSTEP_READY:
default: // Unready default: // Unready
if (choice == KEY_ESCAPE) if (G_PlayerInputDown(i, gc_b, true) == true)
{ {
p->mdepth = CSSTEP_COLORS; p->mdepth = CSSTEP_COLORS;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
p->delay = MENUDELAYTIME;
} }
break; break;
} }