Clean up the menu input layer.

git-svn-id: https://svn.eduke32.com/eduke32@4511 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-06-16 23:15:49 +00:00
parent ec3717167e
commit 71cf9af5f5
4 changed files with 240 additions and 274 deletions

View file

@ -2771,24 +2771,24 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
////////// OFTEN-USED FEW-LINERS ////////// ////////// OFTEN-USED FEW-LINERS //////////
static void G_HandleEventsWhileNoInput(void) static void G_HandleEventsWhileNoInput(void)
{ {
I_ClearInputWaiting(); I_ClearAllInput();
while (!I_CheckInputWaiting()) while (!I_CheckAllInput())
G_HandleAsync(); G_HandleAsync();
I_ClearInputWaiting(); I_ClearAllInput();
} }
static int32_t G_PlaySoundWhileNoInput(int32_t soundnum) static int32_t G_PlaySoundWhileNoInput(int32_t soundnum)
{ {
S_PlaySound(soundnum); S_PlaySound(soundnum);
I_ClearInputWaiting(); I_ClearAllInput();
while (S_CheckSoundPlaying(-1, soundnum)) while (S_CheckSoundPlaying(-1, soundnum))
{ {
G_HandleAsync(); G_HandleAsync();
if (I_CheckInputWaiting()) if (I_CheckAllInput())
{ {
I_ClearInputWaiting(); I_ClearAllInput();
return 1; return 1;
} }
} }
@ -10430,7 +10430,7 @@ static void G_DisplayLogo(void)
nextpage(); nextpage();
fadepaltile(0,0,0, 63,0,-7,DREALMS); fadepaltile(0,0,0, 63,0,-7,DREALMS);
totalclock = 0; totalclock = 0;
while (totalclock < (120*7) && !I_CheckInputWaiting()) while (totalclock < (120*7) && !I_CheckAllInput())
{ {
clearallviews(0); clearallviews(0);
@ -10447,7 +10447,7 @@ static void G_DisplayLogo(void)
} }
fadepaltile(0,0,0, 0,63,7,DREALMS); fadepaltile(0,0,0, 0,63,7,DREALMS);
} }
I_ClearInputWaiting(); I_ClearAllInput();
} }
clearallviews(0L); clearallviews(0L);
@ -10465,7 +10465,7 @@ static void G_DisplayLogo(void)
fadepaltile(0,0,0, 63,0,-7,BETASCREEN); fadepaltile(0,0,0, 63,0,-7,BETASCREEN);
totalclock = 0; totalclock = 0;
while (totalclock < (860+120) && !I_CheckInputWaiting()) while (totalclock < (860+120) && !I_CheckAllInput())
{ {
clearallviews(0); clearallviews(0);
@ -10545,7 +10545,7 @@ static void G_DisplayLogo(void)
nextpage(); nextpage();
} }
} }
I_ClearInputWaiting(); I_ClearAllInput();
} }
flushperms(); flushperms();
@ -12355,7 +12355,7 @@ static void G_BonusCutscenes(void)
fadepal(0,0,0, 0,63,1); fadepal(0,0,0, 0,63,1);
I_ClearAllInput(); I_ClearAllInput();
I_ClearInputWaiting(); I_ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
rotatesprite_fs(0,0,65536L,0,3292,0,0,2+8+16+64+(ud.bgstretch?1024:0)); rotatesprite_fs(0,0,65536L,0,3292,0,0,2+8+16+64+(ud.bgstretch?1024:0));
@ -12375,7 +12375,7 @@ static void G_BonusCutscenes(void)
if (ud.lockout == 0) if (ud.lockout == 0)
{ {
G_PlayAnim("cineov2.anm",1); G_PlayAnim("cineov2.anm",1);
I_ClearInputWaiting(); I_ClearAllInput();
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
} }
@ -12384,7 +12384,7 @@ static void G_BonusCutscenes(void)
fadepal(0,0,0, 0,63,1); fadepal(0,0,0, 0,63,1);
setview(0,0,xdim-1,ydim-1); setview(0,0,xdim-1,ydim-1);
I_ClearInputWaiting(); I_ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
rotatesprite_fs(0,0,65536L,0,3293,0,0,2+8+16+64+(ud.bgstretch?1024:0)); rotatesprite_fs(0,0,65536L,0,3293,0,0,2+8+16+64+(ud.bgstretch?1024:0));
fadepal(0,0,0, 63,0,-1); fadepal(0,0,0, 63,0,-1);
@ -12402,7 +12402,7 @@ static void G_BonusCutscenes(void)
if (ud.lockout == 0) if (ud.lockout == 0)
{ {
I_ClearInputWaiting(); I_ClearAllInput();
t = G_PlayAnim("vol4e1.anm",8); t = G_PlayAnim("vol4e1.anm",8);
clearallviews(0L); clearallviews(0L);
nextpage(); nextpage();
@ -12424,7 +12424,7 @@ end_vol4e:
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
S_PlaySound(ENDSEQVOL3SND4); S_PlaySound(ENDSEQVOL3SND4);
I_ClearInputWaiting(); I_ClearAllInput();
G_FadePalette(0,0,0,0); G_FadePalette(0,0,0,0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
@ -12439,7 +12439,7 @@ end_vol4e:
fadepal(0,0,0, 63,0,-3); fadepal(0,0,0, 63,0,-3);
nextpage(); nextpage();
I_ClearInputWaiting(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
fadepal(0,0,0, 0,63,3); fadepal(0,0,0, 0,63,3);
@ -12448,7 +12448,7 @@ end_vol4e:
G_PlayAnim("DUKETEAM.ANM",4); G_PlayAnim("DUKETEAM.ANM",4);
I_ClearInputWaiting(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
clearallviews(0L); clearallviews(0L);
@ -12457,7 +12457,7 @@ end_vol4e:
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
I_ClearInputWaiting(); I_ClearAllInput();
break; break;
@ -12469,7 +12469,7 @@ end_vol4e:
{ {
fadepal(0,0,0, 63,0,-1); fadepal(0,0,0, 63,0,-1);
G_PlayAnim("cineov3.anm",2); G_PlayAnim("cineov3.anm",2);
I_ClearInputWaiting(); I_ClearAllInput();
ototalclock = totalclock+200; ototalclock = totalclock+200;
while (totalclock < ototalclock) while (totalclock < ototalclock)
G_HandleAsync(); G_HandleAsync();
@ -12482,7 +12482,7 @@ end_vol4e:
G_PlayAnim("RADLOGO.ANM",3); G_PlayAnim("RADLOGO.ANM",3);
if (ud.lockout == 0 && !I_CheckInputWaiting()) if (ud.lockout == 0 && !I_CheckAllInput())
{ {
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM;
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM;
@ -12491,15 +12491,15 @@ end_vol4e:
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM;
} }
I_ClearInputWaiting(); I_ClearAllInput();
totalclock = 0; totalclock = 0;
if (PLUTOPAK) if (PLUTOPAK)
{ {
while (totalclock < 120 && !I_CheckInputWaiting()) while (totalclock < 120 && !I_CheckAllInput())
G_HandleAsync(); G_HandleAsync();
I_ClearInputWaiting(); I_ClearAllInput();
} }
else else
{ {
@ -12518,7 +12518,7 @@ ENDANM:
G_PlayAnim("DUKETEAM.ANM",4); G_PlayAnim("DUKETEAM.ANM",4);
I_ClearInputWaiting(); I_ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
clearallviews(0L); clearallviews(0L);
@ -12526,7 +12526,7 @@ ENDANM:
G_FadePalette(0,0,0,63); G_FadePalette(0,0,0,63);
} }
I_ClearInputWaiting(); I_ClearAllInput();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();

View file

@ -45,27 +45,13 @@ void I_ClearAllInput(void)
JOYSTICK_ClearAllButtons(); JOYSTICK_ClearAllButtons();
} }
int32_t I_CheckInputWaiting(void)
{
return (
KB_KeyWaiting() ||
(MOUSE_GetButtons()&LEFT_MOUSE) ||
I_JoystickAdvanceTrigger()
);
}
int32_t I_ClearInputWaiting(void)
{
KB_FlushKeyboardQueue();
KB_ClearKeysDown(); // JBF
I_JoystickAdvanceTriggerClear();
return (
MOUSE_ClearButton(LEFT_MOUSE)
);
}
int32_t I_JoystickAdvanceTrigger(void) int32_t I_AdvanceTrigger(void)
{ {
return ( return (
KB_KeyPressed(sc_kpad_Enter) ||
KB_KeyPressed(sc_Enter) ||
(MOUSE_GetButtons()&LEFT_MOUSE) ||
#if defined(GEKKO) #if defined(GEKKO)
(JOYSTICK_GetButtons()&WII_A) (JOYSTICK_GetButtons()&WII_A)
#else #else
@ -74,225 +60,223 @@ int32_t I_JoystickAdvanceTrigger(void)
#endif #endif
); );
} }
int32_t I_JoystickAdvanceTriggerClear(void)
void I_AdvanceTriggerClear(void)
{ {
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_kpad_Enter);
KB_ClearKeyDown(sc_Enter);
MOUSE_ClearButton(LEFT_MOUSE);
#if defined(GEKKO) #if defined(GEKKO)
return JOYSTICK_ClearButton(WII_A); JOYSTICK_ClearButton(WII_A);
#else #else
CONTROL_ClearButton(gamefunc_Open); CONTROL_ClearButton(gamefunc_Open);
CONTROL_ClearButton(gamefunc_Fire); CONTROL_ClearButton(gamefunc_Fire);
return 0;
#endif #endif
} }
int32_t I_JoystickReturnTrigger(void)
int32_t I_ReturnTrigger(void)
{ {
return ( return (
KB_KeyPressed(sc_Escape) ||
(MOUSE_GetButtons()&RIGHT_MOUSE) ||
BUTTON(gamefunc_Crouch) BUTTON(gamefunc_Crouch)
#if defined(GEKKO) #if defined(GEKKO)
|| (JOYSTICK_GetButtons()&(WII_B|WII_HOME)) || (JOYSTICK_GetButtons()&(WII_B|WII_HOME))
#endif #endif
); );
} }
int32_t I_JoystickReturnTriggerClear(void)
void I_ReturnTriggerClear(void)
{ {
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_Escape);
MOUSE_ClearButton(RIGHT_MOUSE);
CONTROL_ClearButton(gamefunc_Crouch); CONTROL_ClearButton(gamefunc_Crouch);
return (
#if defined(GEKKO) #if defined(GEKKO)
JOYSTICK_ClearButton(WII_B) || JOYSTICK_ClearButton(WII_B);
JOYSTICK_ClearButton(WII_HOME) JOYSTICK_ClearButton(WII_HOME);
#else
0
#endif #endif
);
} }
int32_t I_JoystickEscapeTrigger(void)
int32_t I_EscapeTrigger(void)
{ {
return ( return (
KB_KeyPressed(sc_Escape)
#if defined(GEKKO) #if defined(GEKKO)
(JOYSTICK_GetButtons()&WII_HOME) || (JOYSTICK_GetButtons()&WII_HOME)
#else
0
#endif
);
}
int32_t I_JoystickEscapeTriggerClear(void)
{
return (
#if defined(GEKKO)
JOYSTICK_ClearButton(WII_HOME)
#else
0
#endif #endif
); );
} }
int32_t I_AdvanceTrigger(void) void I_EscapeTriggerClear(void)
{
return (
KB_KeyPressed(sc_kpad_Enter) ||
KB_KeyPressed(sc_Enter) ||
(MOUSE_GetButtons()&LEFT_MOUSE) ||
I_JoystickAdvanceTrigger()
);
}
int32_t I_AdvanceTriggerClear(void)
{
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_kpad_Enter);
KB_ClearKeyDown(sc_Enter);
I_JoystickAdvanceTriggerClear();
return (
MOUSE_ClearButton(LEFT_MOUSE)
);
}
int32_t I_ReturnTrigger(void)
{
return (
KB_KeyPressed(sc_Escape) ||
(MOUSE_GetButtons()&RIGHT_MOUSE) ||
I_JoystickReturnTrigger()
);
}
int32_t I_ReturnTriggerClear(void)
{ {
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_Escape); KB_ClearKeyDown(sc_Escape);
return ( #if defined(GEKKO)
MOUSE_ClearButton(RIGHT_MOUSE) || JOYSTICK_ClearButton(WII_HOME);
I_JoystickReturnTriggerClear() #endif
);
} }
int32_t I_EscapeTrigger(void)
int32_t I_MenuUp(void)
{ {
return ( return (
KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_UpArrow) ||
I_JoystickEscapeTrigger() KB_KeyPressed(sc_kpad_8) ||
(MOUSE_GetButtons()&WHEELUP_MOUSE) ||
BUTTON(gamefunc_Move_Forward) ||
(JOYSTICK_GetHat(0)&HAT_UP)
); );
} }
int32_t I_EscapeTriggerClear(void)
void I_MenuUpClear(void)
{
KB_ClearKeyDown(sc_UpArrow);
KB_ClearKeyDown(sc_kpad_8);
MOUSE_ClearButton(WHEELUP_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Forward);
JOYSTICK_ClearHat(0);
}
int32_t I_MenuDown(void)
{ {
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_Escape);
return ( return (
I_JoystickEscapeTriggerClear() KB_KeyPressed(sc_DownArrow) ||
KB_KeyPressed(sc_kpad_2) ||
(MOUSE_GetButtons()&WHEELDOWN_MOUSE) ||
BUTTON(gamefunc_Move_Backward) ||
(JOYSTICK_GetHat(0)&HAT_DOWN)
); );
} }
void I_MenuDownClear(void)
{
KB_ClearKeyDown(sc_DownArrow);
KB_ClearKeyDown(sc_kpad_2);
KB_ClearKeyDown(sc_PgDn);
MOUSE_ClearButton(WHEELDOWN_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Backward);
JOYSTICK_ClearHat(0);
}
int32_t I_MenuLeft(void)
{
return (
KB_KeyPressed(sc_LeftArrow) ||
KB_KeyPressed(sc_kpad_4) ||
(SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab)) ||
BUTTON(gamefunc_Turn_Left) ||
BUTTON(gamefunc_Strafe_Left) ||
(JOYSTICK_GetHat(0)&HAT_LEFT)
);
}
void I_MenuLeftClear(void)
{
KB_ClearKeyDown(sc_LeftArrow);
KB_ClearKeyDown(sc_kpad_4);
KB_ClearKeyDown(sc_Tab);
CONTROL_ClearButton(gamefunc_Turn_Left);
CONTROL_ClearButton(gamefunc_Strafe_Left);
JOYSTICK_ClearHat(0);
}
int32_t I_MenuRight(void)
{
return (
KB_KeyPressed(sc_RightArrow) ||
KB_KeyPressed(sc_kpad_6) ||
(!SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab)) ||
BUTTON(gamefunc_Turn_Right) ||
BUTTON(gamefunc_Strafe_Right) ||
(MOUSE_GetButtons()&MIDDLE_MOUSE) ||
(JOYSTICK_GetHat(0)&HAT_RIGHT)
);
}
void I_MenuRightClear(void)
{
KB_ClearKeyDown(sc_RightArrow);
KB_ClearKeyDown(sc_kpad_6);
KB_ClearKeyDown(sc_Tab);
CONTROL_ClearButton(gamefunc_Turn_Right);
CONTROL_ClearButton(gamefunc_Strafe_Right);
MOUSE_ClearButton(MIDDLE_MOUSE);
JOYSTICK_ClearHat(0);
}
int32_t I_PanelUp(void) int32_t I_PanelUp(void)
{ {
return ( return (
KB_KeyPressed(sc_LeftArrow) ||
KB_KeyPressed(sc_kpad_4) ||
KB_KeyPressed(sc_UpArrow) ||
KB_KeyPressed(sc_kpad_8) ||
KB_KeyPressed(sc_PgUp) || KB_KeyPressed(sc_PgUp) ||
(MOUSE_GetButtons()&WHEELUP_MOUSE) || I_MenuUp() ||
BUTTON(gamefunc_Move_Forward) || I_MenuLeft()
BUTTON(gamefunc_Turn_Left) ||
BUTTON(gamefunc_Strafe_Left) ||
(JOYSTICK_GetHat(0)&HAT_UP)
); );
} }
int32_t I_PanelUpClear(void)
void I_PanelUpClear(void)
{ {
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_LeftArrow);
KB_ClearKeyDown(sc_kpad_4);
KB_ClearKeyDown(sc_UpArrow);
KB_ClearKeyDown(sc_kpad_8);
KB_ClearKeyDown(sc_PgUp); KB_ClearKeyDown(sc_PgUp);
CONTROL_ClearButton(gamefunc_Move_Forward); I_MenuUpClear();
CONTROL_ClearButton(gamefunc_Turn_Left); I_MenuLeftClear();
CONTROL_ClearButton(gamefunc_Strafe_Left);
JOYSTICK_ClearHat(0);
return (
MOUSE_ClearButton(WHEELUP_MOUSE)
);
} }
int32_t I_PanelDown(void) int32_t I_PanelDown(void)
{ {
return ( return (
KB_KeyPressed(sc_RightArrow) ||
KB_KeyPressed(sc_kpad_6) ||
KB_KeyPressed(sc_DownArrow) ||
KB_KeyPressed(sc_kpad_2) ||
KB_KeyPressed(sc_PgDn) || KB_KeyPressed(sc_PgDn) ||
(MOUSE_GetButtons()&WHEELDOWN_MOUSE) || I_MenuDown() ||
BUTTON(gamefunc_Move_Backward) || I_MenuRight() ||
BUTTON(gamefunc_Turn_Right) ||
BUTTON(gamefunc_Strafe_Right) ||
(JOYSTICK_GetHat(0)&HAT_DOWN) ||
I_AdvanceTrigger() I_AdvanceTrigger()
); );
} }
int32_t I_PanelDownClear(void)
{
KB_FlushKeyboardQueue();
KB_ClearKeyDown(sc_RightArrow);
KB_ClearKeyDown(sc_kpad_6);
KB_ClearKeyDown(sc_DownArrow);
KB_ClearKeyDown(sc_kpad_2);
KB_ClearKeyDown(sc_PgDn);
CONTROL_ClearButton(gamefunc_Move_Backward);
CONTROL_ClearButton(gamefunc_Turn_Right);
CONTROL_ClearButton(gamefunc_Strafe_Right);
JOYSTICK_ClearHat(0);
return (
MOUSE_ClearButton(WHEELDOWN_MOUSE) ||
I_AdvanceTriggerClear()
);
}
void I_PanelDownClear(void)
{
KB_ClearKeyDown(sc_PgDn);
I_MenuDownClear();
I_MenuRightClear();
I_AdvanceTriggerClear();
}
int32_t I_SliderLeft(void) int32_t I_SliderLeft(void)
{ {
return ( return (
KB_KeyPressed(sc_LeftArrow) || ((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) ||
KB_KeyPressed(sc_kpad_4) || I_MenuLeft()
((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) ||
BUTTON(gamefunc_Turn_Left) ||
BUTTON(gamefunc_Strafe_Left) ||
(JOYSTICK_GetHat(0)&HAT_LEFT)
); );
} }
int32_t I_SliderLeftClear(void)
void I_SliderLeftClear(void)
{ {
KB_ClearKeyDown(sc_LeftArrow); I_MenuLeftClear();
KB_ClearKeyDown(sc_kpad_4); MOUSE_ClearButton(WHEELUP_MOUSE);
CONTROL_ClearButton(gamefunc_Turn_Left);
CONTROL_ClearButton(gamefunc_Strafe_Left);
JOYSTICK_ClearHat(0);
return (
MOUSE_ClearButton(WHEELUP_MOUSE)
);
} }
int32_t I_SliderRight(void) int32_t I_SliderRight(void)
{ {
return ( return (
KB_KeyPressed(sc_RightArrow) ||
KB_KeyPressed(sc_kpad_6) ||
((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) || ((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) ||
BUTTON(gamefunc_Turn_Right) || I_MenuRight()
BUTTON(gamefunc_Strafe_Right) ||
(JOYSTICK_GetHat(0)&HAT_RIGHT)
); );
} }
int32_t I_SliderRightClear(void)
void I_SliderRightClear(void)
{ {
KB_ClearKeyDown(sc_RightArrow); I_MenuRightClear();
KB_ClearKeyDown(sc_kpad_6); MOUSE_ClearButton(WHEELDOWN_MOUSE);
CONTROL_ClearButton(gamefunc_Turn_Right);
CONTROL_ClearButton(gamefunc_Strafe_Right);
JOYSTICK_ClearHat(0);
return (
MOUSE_ClearButton(WHEELDOWN_MOUSE)
);
} }
int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags) int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
{ {
char ch; char ch;

View file

@ -26,39 +26,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int32_t I_CheckAllInput(void); extern int32_t I_CheckAllInput(void);
extern void I_ClearAllInput(void); extern void I_ClearAllInput(void);
extern int32_t I_CheckInputWaiting(void);
extern int32_t I_ClearInputWaiting(void);
// Advance = Selecting a menu option || Saying "Yes" || Going forward in Help/Credits // Advance = Selecting a menu option || Saying "Yes" || Going forward in Help/Credits
// Return = Closing a sub-menu || Saying "No" // Return = Closing a sub-menu || Saying "No"
// Escape = Opening the menu in-game (should not be any gamefuncs) // Escape = Opening the menu in-game (should not be any gamefuncs)
// Joysticks have separate functions to avoid spamming duplicated "ifdef GEKKO" everywhere.
extern int32_t I_JoystickAdvanceTrigger(void);
extern int32_t I_JoystickAdvanceTriggerClear(void);
extern int32_t I_JoystickReturnTrigger(void);
extern int32_t I_JoystickReturnTriggerClear(void);
extern int32_t I_JoystickEscapeTrigger(void);
extern int32_t I_JoystickEscapeTriggerClear(void);
extern int32_t I_AdvanceTrigger(void); extern int32_t I_AdvanceTrigger(void);
extern int32_t I_AdvanceTriggerClear(void); extern void I_AdvanceTriggerClear(void);
extern int32_t I_ReturnTrigger(void); extern int32_t I_ReturnTrigger(void);
extern int32_t I_ReturnTriggerClear(void); extern void I_ReturnTriggerClear(void);
extern int32_t I_EscapeTrigger(void); extern int32_t I_EscapeTrigger(void);
extern int32_t I_EscapeTriggerClear(void); extern void I_EscapeTriggerClear(void);
extern int32_t I_MenuUp(void);
extern void I_MenuUpClear(void);
extern int32_t I_MenuDown(void);
extern void I_MenuDownClear(void);
extern int32_t I_MenuLeft(void);
extern void I_MenuLeftClear(void);
extern int32_t I_MenuRight(void);
extern void I_MenuRightClear(void);
extern int32_t I_PanelUp(void); extern int32_t I_PanelUp(void);
extern int32_t I_PanelUpClear(void); extern void I_PanelUpClear(void);
extern int32_t I_PanelDown(void); extern int32_t I_PanelDown(void);
extern int32_t I_PanelDownClear(void); extern void I_PanelDownClear(void);
extern int32_t I_SliderLeft(void); extern int32_t I_SliderLeft(void);
extern int32_t I_SliderLeftClear(void); extern void I_SliderLeftClear(void);
extern int32_t I_SliderRight(void); extern int32_t I_SliderRight(void);
extern int32_t I_SliderRightClear(void); extern void I_SliderRightClear(void);
enum EnterTextFlags_t { enum EnterTextFlags_t {

View file

@ -3940,17 +3940,41 @@ static void M_RunMenuInput(Menu_t *cm)
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
} }
else if (KB_KeyPressed(sc_PgUp) || KB_KeyPressed(sc_PgDn)) else if (KB_KeyPressed(sc_PgUp))
{ {
int32_t i = 6; int32_t i;
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList]; CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
while (i>0)
for (i = 0; i < 6; ++i)
{ {
if (seeker && (KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev)) if (seeker && seeker->prev)
seeker = KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev; seeker = seeker->prev;
i--;
} }
if (seeker)
{
movement = 1;
object->findhigh[object->currentList] = seeker;
KB_ClearKeyDown(sc_PgUp);
S_PlaySound(KICK_HIT);
}
}
else if (KB_KeyPressed(sc_PgDn))
{
int32_t i;
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
for (i = 0; i < 6; ++i)
{
if (seeker && seeker->next)
seeker = seeker->next;
}
if (seeker) if (seeker)
{ {
movement = 1; movement = 1;
@ -3958,21 +3982,14 @@ static void M_RunMenuInput(Menu_t *cm)
object->findhigh[object->currentList] = seeker; object->findhigh[object->currentList] = seeker;
KB_ClearKeyDown(sc_PgDn); KB_ClearKeyDown(sc_PgDn);
KB_ClearKeyDown(sc_PgUp);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
} }
} }
else if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || else if (I_MenuLeft() || I_MenuRight())
KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) ||
KB_KeyPressed(sc_Tab) || (MOUSE_GetButtons()&MIDDLE_MOUSE))
{ {
KB_ClearKeyDown(sc_LeftArrow); I_MenuLeftClear();
KB_ClearKeyDown(sc_kpad_4); I_MenuRightClear();
KB_ClearKeyDown(sc_RightArrow);
KB_ClearKeyDown(sc_kpad_6);
KB_ClearKeyDown(sc_Tab);
MOUSE_ClearButton(MIDDLE_MOUSE);
if ((object->currentList ? object->fnlist.numdirs : object->fnlist.numfiles) > 0) if ((object->currentList ? object->fnlist.numdirs : object->fnlist.numfiles) > 0)
{ {
@ -3981,15 +3998,11 @@ static void M_RunMenuInput(Menu_t *cm)
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
} }
} }
else if (KB_KeyPressed(sc_UpArrow) || KB_KeyPressed(sc_kpad_8) || (MOUSE_GetButtons()&WHEELUP_MOUSE) || BUTTON(gamefunc_Move_Forward) || (JOYSTICK_GetHat(0)&HAT_UP)) else if (I_MenuUp())
{ {
movement = 1; movement = 1;
KB_ClearKeyDown(sc_UpArrow); I_MenuUpClear();
KB_ClearKeyDown(sc_kpad_8);
MOUSE_ClearButton(WHEELUP_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Forward);
JOYSTICK_ClearHat(0);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
@ -4001,16 +4014,11 @@ static void M_RunMenuInput(Menu_t *cm)
object->findhigh[object->currentList] = object->findhigh[object->currentList]->userb; object->findhigh[object->currentList] = object->findhigh[object->currentList]->userb;
} }
} }
else if (KB_KeyPressed(sc_DownArrow) || KB_KeyPressed(sc_kpad_2) || (MOUSE_GetButtons()&WHEELDOWN_MOUSE) || BUTTON(gamefunc_Move_Backward) || (JOYSTICK_GetHat(0)&HAT_DOWN)) else if (I_MenuDown())
{ {
movement = 1; movement = 1;
KB_ClearKeyDown(sc_DownArrow); I_MenuDownClear();
KB_ClearKeyDown(sc_kpad_2);
KB_ClearKeyDown(sc_PgDn);
MOUSE_ClearButton(WHEELDOWN_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Backward);
JOYSTICK_ClearHat(0);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
@ -4168,24 +4176,24 @@ static void M_RunMenuInput(Menu_t *cm)
object->options->currentEntry = object->currentOption; object->options->currentEntry = object->currentOption;
} }
} }
else if (KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6)) else if (I_MenuRight())
{ {
modification = object->currentOption + 1; modification = object->currentOption + 1;
if (modification >= object->options->numOptions) if (modification >= object->options->numOptions)
modification = 0; modification = 0;
KB_ClearKeyDown(sc_RightArrow); I_MenuRightClear();
KB_ClearKeyDown(sc_kpad_6);
S_PlaySound(PISTOL_BODYHIT); S_PlaySound(PISTOL_BODYHIT);
} }
else if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4)) else if (I_MenuLeft())
{ {
modification = object->currentOption - 1; modification = object->currentOption - 1;
if (modification < 0) if (modification < 0)
modification = object->options->numOptions - 1; modification = object->options->numOptions - 1;
KB_ClearKeyDown(sc_LeftArrow); I_MenuLeftClear();
KB_ClearKeyDown(sc_kpad_4);
S_PlaySound(PISTOL_BODYHIT); S_PlaySound(PISTOL_BODYHIT);
} }
@ -4202,17 +4210,13 @@ static void M_RunMenuInput(Menu_t *cm)
} }
break; break;
case Custom2Col: case Custom2Col:
if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || if (I_MenuLeft() || I_MenuRight())
KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) ||
KB_KeyPressed(sc_Tab) || (MOUSE_GetButtons()&MIDDLE_MOUSE))
{ {
currgroup->currentColumn = !currgroup->currentColumn; currgroup->currentColumn = !currgroup->currentColumn;
KB_ClearKeyDown(sc_LeftArrow);
KB_ClearKeyDown(sc_RightArrow); I_MenuLeftClear();
KB_ClearKeyDown(sc_kpad_4); I_MenuRightClear();
KB_ClearKeyDown(sc_kpad_6);
KB_ClearKeyDown(sc_Tab);
MOUSE_ClearButton(MIDDLE_MOUSE);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
} }
@ -4434,15 +4438,11 @@ static void M_RunMenuInput(Menu_t *cm)
M_MenuEntryFocus(currgroup/*, currentry*/); M_MenuEntryFocus(currgroup/*, currentry*/);
} }
else if (KB_KeyPressed(sc_UpArrow) || KB_KeyPressed(sc_kpad_8) || (MOUSE_GetButtons()&WHEELUP_MOUSE) || BUTTON(gamefunc_Move_Forward) || (JOYSTICK_GetHat(0)&HAT_UP)) else if (I_MenuUp())
{ {
movement = 1; movement = 1;
KB_ClearKeyDown(sc_UpArrow); I_MenuUpClear();
KB_ClearKeyDown(sc_kpad_8);
MOUSE_ClearButton(WHEELUP_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Forward);
JOYSTICK_ClearHat(0);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
@ -4462,16 +4462,11 @@ static void M_RunMenuInput(Menu_t *cm)
M_MenuEntryFocus(currgroup/*, currentry*/); M_MenuEntryFocus(currgroup/*, currentry*/);
} }
else if (KB_KeyPressed(sc_DownArrow) || KB_KeyPressed(sc_kpad_2) || (MOUSE_GetButtons()&WHEELDOWN_MOUSE) || BUTTON(gamefunc_Move_Backward) || (JOYSTICK_GetHat(0)&HAT_DOWN)) else if (I_MenuDown())
{ {
movement = 1; movement = 1;
KB_ClearKeyDown(sc_DownArrow); I_MenuDownClear();
KB_ClearKeyDown(sc_kpad_2);
KB_ClearKeyDown(sc_PgDn);
MOUSE_ClearButton(WHEELDOWN_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Backward);
JOYSTICK_ClearHat(0);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
@ -4582,15 +4577,11 @@ static void M_RunMenuInput(Menu_t *cm)
object->options->currentEntry = object->options->numOptions-1; object->options->currentEntry = object->options->numOptions-1;
} }
else if (KB_KeyPressed(sc_UpArrow) || KB_KeyPressed(sc_kpad_8) || (MOUSE_GetButtons()&WHEELUP_MOUSE) || BUTTON(gamefunc_Move_Forward) || (JOYSTICK_GetHat(0)&HAT_UP)) else if (I_MenuUp())
{ {
movement = 1; movement = 1;
KB_ClearKeyDown(sc_UpArrow); I_MenuUpClear();
KB_ClearKeyDown(sc_kpad_8);
MOUSE_ClearButton(WHEELUP_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Forward);
JOYSTICK_ClearHat(0);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);
@ -4599,16 +4590,11 @@ static void M_RunMenuInput(Menu_t *cm)
if (object->options->currentEntry < 0) if (object->options->currentEntry < 0)
object->options->currentEntry = object->options->numOptions-1; object->options->currentEntry = object->options->numOptions-1;
} }
else if (KB_KeyPressed(sc_DownArrow) || KB_KeyPressed(sc_kpad_2) || (MOUSE_GetButtons()&WHEELDOWN_MOUSE) || BUTTON(gamefunc_Move_Backward) || (JOYSTICK_GetHat(0)&HAT_DOWN)) else if (I_MenuDown())
{ {
movement = 1; movement = 1;
KB_ClearKeyDown(sc_DownArrow); I_MenuDownClear();
KB_ClearKeyDown(sc_kpad_2);
KB_ClearKeyDown(sc_PgDn);
MOUSE_ClearButton(WHEELDOWN_MOUSE);
CONTROL_ClearButton(gamefunc_Move_Backward);
JOYSTICK_ClearHat(0);
S_PlaySound(KICK_HIT); S_PlaySound(KICK_HIT);