From 71cf9af5f580c65fce3dbeedd325ebc1009915eb Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 16 Jun 2014 23:15:49 +0000 Subject: [PATCH] Clean up the menu input layer. git-svn-id: https://svn.eduke32.com/eduke32@4511 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 50 +++--- polymer/eduke32/source/input.c | 302 ++++++++++++++++----------------- polymer/eduke32/source/input.h | 36 ++-- polymer/eduke32/source/menus.c | 126 ++++++-------- 4 files changed, 240 insertions(+), 274 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0a0f35c02..012e1c9f3 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2771,24 +2771,24 @@ void P_DoQuote(int32_t q, DukePlayer_t *p) ////////// OFTEN-USED FEW-LINERS ////////// static void G_HandleEventsWhileNoInput(void) { - I_ClearInputWaiting(); + I_ClearAllInput(); - while (!I_CheckInputWaiting()) + while (!I_CheckAllInput()) G_HandleAsync(); - I_ClearInputWaiting(); + I_ClearAllInput(); } static int32_t G_PlaySoundWhileNoInput(int32_t soundnum) { S_PlaySound(soundnum); - I_ClearInputWaiting(); + I_ClearAllInput(); while (S_CheckSoundPlaying(-1, soundnum)) { G_HandleAsync(); - if (I_CheckInputWaiting()) + if (I_CheckAllInput()) { - I_ClearInputWaiting(); + I_ClearAllInput(); return 1; } } @@ -10430,7 +10430,7 @@ static void G_DisplayLogo(void) nextpage(); fadepaltile(0,0,0, 63,0,-7,DREALMS); totalclock = 0; - while (totalclock < (120*7) && !I_CheckInputWaiting()) + while (totalclock < (120*7) && !I_CheckAllInput()) { clearallviews(0); @@ -10447,7 +10447,7 @@ static void G_DisplayLogo(void) } fadepaltile(0,0,0, 0,63,7,DREALMS); } - I_ClearInputWaiting(); + I_ClearAllInput(); } clearallviews(0L); @@ -10465,7 +10465,7 @@ static void G_DisplayLogo(void) fadepaltile(0,0,0, 63,0,-7,BETASCREEN); totalclock = 0; - while (totalclock < (860+120) && !I_CheckInputWaiting()) + while (totalclock < (860+120) && !I_CheckAllInput()) { clearallviews(0); @@ -10545,7 +10545,7 @@ static void G_DisplayLogo(void) nextpage(); } } - I_ClearInputWaiting(); + I_ClearAllInput(); } flushperms(); @@ -12355,7 +12355,7 @@ static void G_BonusCutscenes(void) fadepal(0,0,0, 0,63,1); I_ClearAllInput(); - I_ClearInputWaiting(); + I_ClearAllInput(); 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)); @@ -12375,7 +12375,7 @@ static void G_BonusCutscenes(void) if (ud.lockout == 0) { G_PlayAnim("cineov2.anm",1); - I_ClearInputWaiting(); + I_ClearAllInput(); clearallviews(0L); nextpage(); } @@ -12384,7 +12384,7 @@ static void G_BonusCutscenes(void) fadepal(0,0,0, 0,63,1); setview(0,0,xdim-1,ydim-1); - I_ClearInputWaiting(); + I_ClearAllInput(); 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)); fadepal(0,0,0, 63,0,-1); @@ -12402,7 +12402,7 @@ static void G_BonusCutscenes(void) if (ud.lockout == 0) { - I_ClearInputWaiting(); + I_ClearAllInput(); t = G_PlayAnim("vol4e1.anm",8); clearallviews(0L); nextpage(); @@ -12424,7 +12424,7 @@ end_vol4e: FX_StopAllSounds(); S_ClearSoundLocks(); S_PlaySound(ENDSEQVOL3SND4); - I_ClearInputWaiting(); + I_ClearAllInput(); G_FadePalette(0,0,0,0); 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); nextpage(); - I_ClearInputWaiting(); + I_ClearAllInput(); G_HandleEventsWhileNoInput(); fadepal(0,0,0, 0,63,3); @@ -12448,7 +12448,7 @@ end_vol4e: G_PlayAnim("DUKETEAM.ANM",4); - I_ClearInputWaiting(); + I_ClearAllInput(); G_HandleEventsWhileNoInput(); clearallviews(0L); @@ -12457,7 +12457,7 @@ end_vol4e: FX_StopAllSounds(); S_ClearSoundLocks(); - I_ClearInputWaiting(); + I_ClearAllInput(); break; @@ -12469,7 +12469,7 @@ end_vol4e: { fadepal(0,0,0, 63,0,-1); G_PlayAnim("cineov3.anm",2); - I_ClearInputWaiting(); + I_ClearAllInput(); ototalclock = totalclock+200; while (totalclock < ototalclock) G_HandleAsync(); @@ -12482,7 +12482,7 @@ end_vol4e: 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(ENDSEQVOL3SND6)) goto ENDANM; @@ -12491,15 +12491,15 @@ end_vol4e: if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM; } - I_ClearInputWaiting(); + I_ClearAllInput(); totalclock = 0; if (PLUTOPAK) { - while (totalclock < 120 && !I_CheckInputWaiting()) + while (totalclock < 120 && !I_CheckAllInput()) G_HandleAsync(); - I_ClearInputWaiting(); + I_ClearAllInput(); } else { @@ -12518,7 +12518,7 @@ ENDANM: G_PlayAnim("DUKETEAM.ANM",4); - I_ClearInputWaiting(); + I_ClearAllInput(); G_HandleEventsWhileNoInput(); clearallviews(0L); @@ -12526,7 +12526,7 @@ ENDANM: G_FadePalette(0,0,0,63); } - I_ClearInputWaiting(); + I_ClearAllInput(); FX_StopAllSounds(); S_ClearSoundLocks(); diff --git a/polymer/eduke32/source/input.c b/polymer/eduke32/source/input.c index 03f149770..b22419f0b 100644 --- a/polymer/eduke32/source/input.c +++ b/polymer/eduke32/source/input.c @@ -45,27 +45,13 @@ void I_ClearAllInput(void) 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 ( + KB_KeyPressed(sc_kpad_Enter) || + KB_KeyPressed(sc_Enter) || + (MOUSE_GetButtons()&LEFT_MOUSE) || #if defined(GEKKO) (JOYSTICK_GetButtons()&WII_A) #else @@ -74,225 +60,223 @@ int32_t I_JoystickAdvanceTrigger(void) #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) - return JOYSTICK_ClearButton(WII_A); + JOYSTICK_ClearButton(WII_A); #else CONTROL_ClearButton(gamefunc_Open); CONTROL_ClearButton(gamefunc_Fire); - return 0; #endif } -int32_t I_JoystickReturnTrigger(void) + +int32_t I_ReturnTrigger(void) { return ( + KB_KeyPressed(sc_Escape) || + (MOUSE_GetButtons()&RIGHT_MOUSE) || BUTTON(gamefunc_Crouch) #if defined(GEKKO) || (JOYSTICK_GetButtons()&(WII_B|WII_HOME)) #endif ); } -int32_t I_JoystickReturnTriggerClear(void) + +void I_ReturnTriggerClear(void) { + KB_FlushKeyboardQueue(); + KB_ClearKeyDown(sc_Escape); + MOUSE_ClearButton(RIGHT_MOUSE); CONTROL_ClearButton(gamefunc_Crouch); - return ( #if defined(GEKKO) - JOYSTICK_ClearButton(WII_B) || - JOYSTICK_ClearButton(WII_HOME) -#else - 0 + JOYSTICK_ClearButton(WII_B); + JOYSTICK_ClearButton(WII_HOME); #endif - ); } -int32_t I_JoystickEscapeTrigger(void) + + +int32_t I_EscapeTrigger(void) { return ( + KB_KeyPressed(sc_Escape) #if defined(GEKKO) - (JOYSTICK_GetButtons()&WII_HOME) -#else - 0 -#endif - ); -} -int32_t I_JoystickEscapeTriggerClear(void) -{ - return ( -#if defined(GEKKO) - JOYSTICK_ClearButton(WII_HOME) -#else - 0 + || (JOYSTICK_GetButtons()&WII_HOME) #endif ); } -int32_t I_AdvanceTrigger(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) +void I_EscapeTriggerClear(void) { KB_FlushKeyboardQueue(); KB_ClearKeyDown(sc_Escape); - return ( - MOUSE_ClearButton(RIGHT_MOUSE) || - I_JoystickReturnTriggerClear() - ); +#if defined(GEKKO) + JOYSTICK_ClearButton(WII_HOME); +#endif } -int32_t I_EscapeTrigger(void) + + +int32_t I_MenuUp(void) { return ( - KB_KeyPressed(sc_Escape) || - I_JoystickEscapeTrigger() + KB_KeyPressed(sc_UpArrow) || + 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 ( - 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) { return ( - KB_KeyPressed(sc_LeftArrow) || - KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_UpArrow) || - KB_KeyPressed(sc_kpad_8) || KB_KeyPressed(sc_PgUp) || - (MOUSE_GetButtons()&WHEELUP_MOUSE) || - BUTTON(gamefunc_Move_Forward) || - BUTTON(gamefunc_Turn_Left) || - BUTTON(gamefunc_Strafe_Left) || - (JOYSTICK_GetHat(0)&HAT_UP) + I_MenuUp() || + I_MenuLeft() ); } -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); - CONTROL_ClearButton(gamefunc_Move_Forward); - CONTROL_ClearButton(gamefunc_Turn_Left); - CONTROL_ClearButton(gamefunc_Strafe_Left); - JOYSTICK_ClearHat(0); - return ( - MOUSE_ClearButton(WHEELUP_MOUSE) - ); + I_MenuUpClear(); + I_MenuLeftClear(); } + int32_t I_PanelDown(void) { return ( - KB_KeyPressed(sc_RightArrow) || - KB_KeyPressed(sc_kpad_6) || - KB_KeyPressed(sc_DownArrow) || - KB_KeyPressed(sc_kpad_2) || KB_KeyPressed(sc_PgDn) || - (MOUSE_GetButtons()&WHEELDOWN_MOUSE) || - BUTTON(gamefunc_Move_Backward) || - BUTTON(gamefunc_Turn_Right) || - BUTTON(gamefunc_Strafe_Right) || - (JOYSTICK_GetHat(0)&HAT_DOWN) || + I_MenuDown() || + I_MenuRight() || 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) { return ( - KB_KeyPressed(sc_LeftArrow) || - KB_KeyPressed(sc_kpad_4) || - ((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) || - BUTTON(gamefunc_Turn_Left) || - BUTTON(gamefunc_Strafe_Left) || - (JOYSTICK_GetHat(0)&HAT_LEFT) + ((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) || + I_MenuLeft() ); } -int32_t I_SliderLeftClear(void) + +void I_SliderLeftClear(void) { - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); - CONTROL_ClearButton(gamefunc_Turn_Left); - CONTROL_ClearButton(gamefunc_Strafe_Left); - JOYSTICK_ClearHat(0); - return ( - MOUSE_ClearButton(WHEELUP_MOUSE) - ); + I_MenuLeftClear(); + MOUSE_ClearButton(WHEELUP_MOUSE); } + int32_t I_SliderRight(void) { return ( - KB_KeyPressed(sc_RightArrow) || - KB_KeyPressed(sc_kpad_6) || ((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) || - BUTTON(gamefunc_Turn_Right) || - BUTTON(gamefunc_Strafe_Right) || - (JOYSTICK_GetHat(0)&HAT_RIGHT) + I_MenuRight() ); } -int32_t I_SliderRightClear(void) + +void I_SliderRightClear(void) { - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_6); - CONTROL_ClearButton(gamefunc_Turn_Right); - CONTROL_ClearButton(gamefunc_Strafe_Right); - JOYSTICK_ClearHat(0); - return ( - MOUSE_ClearButton(WHEELDOWN_MOUSE) - ); + I_MenuRightClear(); + MOUSE_ClearButton(WHEELDOWN_MOUSE); } + int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags) { char ch; diff --git a/polymer/eduke32/source/input.h b/polymer/eduke32/source/input.h index b9846f881..d6e3a77d0 100644 --- a/polymer/eduke32/source/input.h +++ b/polymer/eduke32/source/input.h @@ -26,39 +26,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern int32_t I_CheckAllInput(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 // Return = Closing a sub-menu || Saying "No" // 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_AdvanceTriggerClear(void); +extern void I_AdvanceTriggerClear(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_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_PanelUpClear(void); - +extern void I_PanelUpClear(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_SliderLeftClear(void); - +extern void I_SliderLeftClear(void); extern int32_t I_SliderRight(void); -extern int32_t I_SliderRightClear(void); +extern void I_SliderRightClear(void); enum EnterTextFlags_t { diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index db0078fcf..24bbb8fdc 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -3940,17 +3940,41 @@ static void M_RunMenuInput(Menu_t *cm) 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]; - while (i>0) + + for (i = 0; i < 6; ++i) { - if (seeker && (KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev)) - seeker = KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev; - i--; + if (seeker && seeker->prev) + seeker = seeker->prev; } + + 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) { movement = 1; @@ -3958,21 +3982,14 @@ static void M_RunMenuInput(Menu_t *cm) object->findhigh[object->currentList] = seeker; KB_ClearKeyDown(sc_PgDn); - KB_ClearKeyDown(sc_PgUp); S_PlaySound(KICK_HIT); } } - else if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || - KB_KeyPressed(sc_Tab) || (MOUSE_GetButtons()&MIDDLE_MOUSE)) + else if (I_MenuLeft() || I_MenuRight()) { - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_Tab); - MOUSE_ClearButton(MIDDLE_MOUSE); + I_MenuLeftClear(); + I_MenuRightClear(); 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); } } - 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; - KB_ClearKeyDown(sc_UpArrow); - KB_ClearKeyDown(sc_kpad_8); - MOUSE_ClearButton(WHEELUP_MOUSE); - CONTROL_ClearButton(gamefunc_Move_Forward); - JOYSTICK_ClearHat(0); + I_MenuUpClear(); S_PlaySound(KICK_HIT); @@ -4001,16 +4014,11 @@ static void M_RunMenuInput(Menu_t *cm) 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; - 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); + I_MenuDownClear(); S_PlaySound(KICK_HIT); @@ -4168,24 +4176,24 @@ static void M_RunMenuInput(Menu_t *cm) object->options->currentEntry = object->currentOption; } } - else if (KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6)) + else if (I_MenuRight()) { modification = object->currentOption + 1; if (modification >= object->options->numOptions) modification = 0; - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_6); + I_MenuRightClear(); + S_PlaySound(PISTOL_BODYHIT); } - else if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4)) + else if (I_MenuLeft()) { modification = object->currentOption - 1; if (modification < 0) modification = object->options->numOptions - 1; - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); + I_MenuLeftClear(); + S_PlaySound(PISTOL_BODYHIT); } @@ -4202,17 +4210,13 @@ static void M_RunMenuInput(Menu_t *cm) } break; case Custom2Col: - if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || - KB_KeyPressed(sc_Tab) || (MOUSE_GetButtons()&MIDDLE_MOUSE)) + if (I_MenuLeft() || I_MenuRight()) { currgroup->currentColumn = !currgroup->currentColumn; - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_Tab); - MOUSE_ClearButton(MIDDLE_MOUSE); + + I_MenuLeftClear(); + I_MenuRightClear(); + S_PlaySound(KICK_HIT); } @@ -4434,15 +4438,11 @@ static void M_RunMenuInput(Menu_t *cm) 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; - KB_ClearKeyDown(sc_UpArrow); - KB_ClearKeyDown(sc_kpad_8); - MOUSE_ClearButton(WHEELUP_MOUSE); - CONTROL_ClearButton(gamefunc_Move_Forward); - JOYSTICK_ClearHat(0); + I_MenuUpClear(); S_PlaySound(KICK_HIT); @@ -4462,16 +4462,11 @@ static void M_RunMenuInput(Menu_t *cm) 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; - 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); + I_MenuDownClear(); S_PlaySound(KICK_HIT); @@ -4582,15 +4577,11 @@ static void M_RunMenuInput(Menu_t *cm) 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; - KB_ClearKeyDown(sc_UpArrow); - KB_ClearKeyDown(sc_kpad_8); - MOUSE_ClearButton(WHEELUP_MOUSE); - CONTROL_ClearButton(gamefunc_Move_Forward); - JOYSTICK_ClearHat(0); + I_MenuUpClear(); S_PlaySound(KICK_HIT); @@ -4599,16 +4590,11 @@ static void M_RunMenuInput(Menu_t *cm) if (object->options->currentEntry < 0) 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; - 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); + I_MenuDownClear(); S_PlaySound(KICK_HIT);