More menu inputting (delays + partial support for character select)

Suddenly stopped compiling as I was working on this, with the same error it gave when before james merged the makefile changes, even though it was fine a minute ago and those changes are distinctly in here, so I guess it ends here.
This commit is contained in:
Sally Coolatta 2021-12-04 16:23:21 -05:00
parent 8cbaad4e4f
commit 4cef6ee0df
3 changed files with 93 additions and 61 deletions

View file

@ -335,6 +335,9 @@ extern INT16 skullAnimCounter; // skull animation counter
extern INT32 menuKey; // keyboard key pressed for menu extern INT32 menuKey; // keyboard key pressed for menu
#define MENUDELAYTIME 3
extern INT16 menuInputDelay;
extern struct menutransition_s { extern struct menutransition_s {
INT16 tics; INT16 tics;
INT16 dest; INT16 dest;
@ -620,7 +623,7 @@ char *M_AddonsHeaderPath(void);
void M_Manual(INT32 choice); void M_Manual(INT32 choice);
void M_HandleImageDef(INT32 choice); void M_HandleImageDef(INT32 choice);
// M_MENUDRAW.C // K_MENUDRAW.C
// flags for text highlights // flags for text highlights
#define highlightflags V_ORANGEMAP #define highlightflags V_ORANGEMAP

View file

@ -94,6 +94,7 @@ INT16 skullAnimCounter = 8; // skull animation counter
struct menutransition_s menutransition; // Menu transition properties struct menutransition_s menutransition; // Menu transition properties
INT32 menuKey = -1; // keyboard key pressed for menu INT32 menuKey = -1; // keyboard key pressed for menu
INT16 menuInputDelay = 0; // Delay before registering multiple inputs.
// finish wipes between screens // finish wipes between screens
boolean menuwipe = false; boolean menuwipe = false;
@ -1164,12 +1165,17 @@ static boolean M_HandleMenuInput(void)
{ {
void (*routine)(INT32 choice); // for some casting problem void (*routine)(INT32 choice); // for some casting problem
if (menuInputDelay > 0)
{
return false;
}
// Handle menu-specific input handling. If this returns true, we skip regular input handling. // Handle menu-specific input handling. If this returns true, we skip regular input handling.
if (currentMenu->inputroutine) if (currentMenu->inputroutine)
{ {
if (currentMenu->inputroutine(menuKey)) if (currentMenu->inputroutine(menuKey))
{ {
return true; return false;
} }
} }
@ -1205,7 +1211,7 @@ static boolean M_HandleMenuInput(void)
return true; return true;
} }
return true; return false;
} }
else else
{ {
@ -1217,7 +1223,7 @@ static boolean M_HandleMenuInput(void)
} }
#endif #endif
return true; return false;
} }
} }
@ -1255,9 +1261,10 @@ static boolean M_HandleMenuInput(void)
{ {
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
routine(0); routine(0);
return true;
} }
return true; return false;
} }
else if (M_BasicMenuInput(gc_right) == true) else if (M_BasicMenuInput(gc_right) == true)
{ {
@ -1266,9 +1273,10 @@ static boolean M_HandleMenuInput(void)
{ {
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
routine(1); routine(1);
return true;
} }
return true; return false;
} }
else if (M_BasicMenuInput(gc_a) == true) else if (M_BasicMenuInput(gc_a) == true)
{ {
@ -1341,7 +1349,7 @@ static boolean M_HandleMenuInput(void)
return false; return false;
} }
return true; return false;
} }
void M_Ticker(void) void M_Ticker(void)
@ -1397,9 +1405,17 @@ void M_Ticker(void)
} }
} }
if (menuInputDelay > 0)
{
menuInputDelay--;
}
if (noFurtherInput == false) if (noFurtherInput == false)
{ {
M_HandleMenuInput(); if (M_HandleMenuInput() == true)
{
menuInputDelay = MENUDELAYTIME;
}
} }
if (currentMenu->tickroutine) if (currentMenu->tickroutine)
@ -1848,60 +1864,71 @@ static void M_SetupReadyExplosions(setup_player_t *p)
} }
} }
static void M_HandleCharacterGrid(INT32 choice, setup_player_t *p, UINT8 num) static void M_HandleCharacterGrid(setup_player_t *p, UINT8 num)
{ {
switch (choice) if (G_PlayerInputDown(num, gc_down, true) == true)
{ {
case KEY_DOWNARROW: p->gridy++;
p->gridy++; 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;
break; }
case KEY_UPARROW: else if (G_PlayerInputDown(num, gc_up, true) == true)
p->gridy--; {
if (p->gridy < 0) p->gridy--;
p->gridy = 8; if (p->gridy < 0)
S_StartSound(NULL, sfx_s3k5b); p->gridy = 8;
break; S_StartSound(NULL, sfx_s3k5b);
case KEY_RIGHTARROW: menuInputDelay = MENUDELAYTIME;
p->gridx++; }
if (p->gridx > 8) else if (G_PlayerInputDown(num, gc_right, true) == true)
p->gridx = 0; {
S_StartSound(NULL, sfx_s3k5b); p->gridx++;
break; if (p->gridx > 8)
case KEY_LEFTARROW: p->gridx = 0;
p->gridx--; S_StartSound(NULL, sfx_s3k5b);
if (p->gridx < 0) menuInputDelay = MENUDELAYTIME;
p->gridx = 8; }
S_StartSound(NULL, sfx_s3k5b); else if (G_PlayerInputDown(num, gc_left, true) == true)
break; {
case KEY_ENTER: p->gridx--;
if (setup_chargrid[p->gridx][p->gridy].numskins == 0) if (p->gridx < 0)
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2 p->gridx = 8;
S_StartSound(NULL, sfx_s3k5b);
menuInputDelay = MENUDELAYTIME;
}
else if (G_PlayerInputDown(num, gc_a, true) == true || G_PlayerInputDown(num, gc_start, true) == true)
{
if (setup_chargrid[p->gridx][p->gridy].numskins == 0)
{
S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2
}
else
{
if (setup_chargrid[p->gridx][p->gridy].numskins == 1)
p->mdepth = CSSTEP_COLORS; // Skip clones menu
else else
{ p->mdepth = CSSTEP_ALTS;
if (setup_chargrid[p->gridx][p->gridy].numskins == 1)
p->mdepth = CSSTEP_COLORS; // Skip clones menu
else
p->mdepth = CSSTEP_ALTS;
S_StartSound(NULL, sfx_s3k63); S_StartSound(NULL, sfx_s3k63);
} }
break;
case KEY_ESCAPE: menuInputDelay = MENUDELAYTIME;
if (num == setup_numplayers-1) }
{ else if (G_PlayerInputDown(num, gc_b, true) == true)
p->mdepth = CSSTEP_NONE; {
S_StartSound(NULL, sfx_s3k5b); if (num == setup_numplayers-1)
} {
else p->mdepth = CSSTEP_NONE;
{ S_StartSound(NULL, sfx_s3k5b);
S_StartSound(NULL, sfx_s3kb2); }
} else
break; {
default: S_StartSound(NULL, sfx_s3kb2);
break; }
menuInputDelay = MENUDELAYTIME;
} }
} }
@ -1994,14 +2021,16 @@ boolean M_CharacterSelectHandler(INT32 choice)
switch (p->mdepth) switch (p->mdepth)
{ {
case CSSTEP_NONE: // Enter Game case CSSTEP_NONE: // Enter Game
if (choice == KEY_ENTER && i == setup_numplayers) if (i == setup_numplayers)
{ {
//I_DetectNewControllers(); // Look through all joysticks to see if any have pressed start.
p->mdepth = CSSTEP_CHARS; p->mdepth = CSSTEP_CHARS;
S_StartSound(NULL, sfx_s3k65); S_StartSound(NULL, sfx_s3k65);
} }
break; break;
case CSSTEP_CHARS: // Character Select grid case CSSTEP_CHARS: // Character Select grid
M_HandleCharacterGrid(choice, p, i); M_HandleCharacterGrid(p, i);
break; break;
case CSSTEP_ALTS: // Select clone case CSSTEP_ALTS: // Select clone
M_HandleCharRotate(choice, p); M_HandleCharRotate(choice, p);

View file

@ -55,7 +55,7 @@
#include "../screen.h" #include "../screen.h"
#include "../m_menu.h" #include "../k_menu.h"
// Wheel support for Win95/WinNT3.51 // Wheel support for Win95/WinNT3.51
#include <zmouse.h> #include <zmouse.h>