diff --git a/source/blood/src/input.h b/source/blood/src/input.h index f1bf82f44..dbbda1814 100644 --- a/source/blood/src/input.h +++ b/source/blood/src/input.h @@ -25,9 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -#define WIN_IS_PRESSED ( KB_KeyPressed( sc_RightWin ) || KB_KeyPressed( sc_LeftWin ) ) -#define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) ) -#define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) ) +#define WIN_IS_PRESSED ( inputState.WinPressed() ) +#define ALT_IS_PRESSED ( inputState.AltPressed() ) +#define SHIFTS_IS_PRESSED ( inputState.ShiftPressed() ) extern int32_t I_CheckAllInput(void); extern void I_ClearAllInput(void); diff --git a/source/common/inputstate.h b/source/common/inputstate.h index 22868e0d0..7a16eecab 100644 --- a/source/common/inputstate.h +++ b/source/common/inputstate.h @@ -196,12 +196,17 @@ public: { return KeyStatus[sc_LeftControl] || KeyStatus[sc_RightControl]; } + + bool WinPressed() + { + return KeyStatus[sc_LeftWin] || KeyStatus[sc_RightWin]; + } bool ShiftPressed() { return KeyStatus[sc_LeftShift] || KeyStatus[sc_RightShift]; } - + bool EscapePressed() { return !!KeyStatus[sc_Escape]; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 5b0eeef74..f85d42448 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -233,13 +233,6 @@ void G_HandleSpecialKeys(void) if ((myplayer.gm & MODE_GAME) != MODE_GAME) OSD_DispatchQueued(); -#ifdef DEBUGGINGAIDS - if (g_quickExit == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && KB_KeyPressed(sc_End)) - { - g_quickExit = 1; - G_GameExit("Quick Exit."); - } -#endif } void G_GameQuit(void) diff --git a/source/duke3d/src/macros.h b/source/duke3d/src/macros.h index f9d3c3234..ab8120d83 100644 --- a/source/duke3d/src/macros.h +++ b/source/duke3d/src/macros.h @@ -32,9 +32,9 @@ BEGIN_DUKE_NS #define BGSTRETCH (hud_bgstretch ? 1024 : 0) -#define WIN_IS_PRESSED ( KB_KeyPressed( sc_RightWin ) || KB_KeyPressed( sc_LeftWin ) ) -#define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) ) -#define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) ) +#define WIN_IS_PRESSED ( inputState.WinPressed() ) +#define ALT_IS_PRESSED ( inputState.AltPressed() ) +#define SHIFTS_IS_PRESSED ( inputState.ShiftPressed() ) #ifndef EDUKE32_STANDALONE #define RANDOMSCRAP(s, i) A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,s->z-ZOFFSET3-(krand()&8191),\ diff --git a/source/rr/src/macros.h b/source/rr/src/macros.h index c4087a43e..5a17e07ad 100644 --- a/source/rr/src/macros.h +++ b/source/rr/src/macros.h @@ -37,9 +37,9 @@ static FORCE_INLINE int32_t krand2(void) #define BGSTRETCH (hud_bgstretch ? 1024 : 0) -#define WIN_IS_PRESSED ( KB_KeyPressed( sc_RightWin ) || KB_KeyPressed( sc_LeftWin ) ) -#define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) ) -#define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) ) +#define WIN_IS_PRESSED ( inputState.WinPressed() ) +#define ALT_IS_PRESSED ( inputState.AltPressed() ) +#define SHIFTS_IS_PRESSED ( inputState.ShiftPressed() ) #define RANDOMSCRAP(s, i) \ { \ diff --git a/source/sw/src/demo.cpp b/source/sw/src/demo.cpp index 403d3b250..8bb309c4f 100644 --- a/source/sw/src/demo.cpp +++ b/source/sw/src/demo.cpp @@ -470,13 +470,6 @@ DemoPlayBack(void) } else { -#if DEBUG - if (KB_KeyPressed(KEYSC_ALT) && KB_KeyPressed(KEYSC_CTRL) && KB_KeyPressed(KEYSC_S)) - { - KB_KeyPressed(KEYSC_ALT) = KB_KeyPressed(KEYSC_CTRL) = KB_KeyPressed(KEYSC_S) = 0; - saveboard("demosave.map", (vec3_t *)Player, &Player->pang, &Player->cursectnum); - } -#endif if (BUTTON(gamefunc_See_Coop_View)) { @@ -487,19 +480,6 @@ DemoPlayBack(void) if (screenpeek < 0) screenpeek = connecthead; } - -#if DEBUG - if (KB_KeyPressed(KEYSC_RIGHT) || KB_KeyPressed(KEYSC_UP)) - { - if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT)) - totalclock += synctics; - else - totalclock += synctics-1; - } - - if (KB_KeyPressed(KEYSC_LEFT) || KB_KeyPressed(KEYSC_DOWN)) - totalclock += 1-synctics; -#endif } diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 444d227e6..d5ed9822e 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -1686,14 +1686,6 @@ void DrawCheckKeys(PLAYERp pp) extern SWBOOL ResCheat; extern SWBOOL PauseKeySet; - /* JonoF: Who really needs this now? - if (KB_KeyPressed(KEYSC_F5) && !(KB_KeyPressed(KEYSC_RSHIFT) || KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)) && !PauseKeySet) - { - KB_KeyPressed(KEYSC_F5) = 0; - ResChange(); - } - */ - if (ResCheat) { ResCheat = FALSE; diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index ce3ce0c7d..f5b8b6784 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -4149,115 +4149,7 @@ SinglePlayInput(PLAYERp pp) } } - if (!(KB_KeyPressed(KEYSC_ALT) | KB_KeyPressed(KEYSC_RALT))) - return; - - if (!SW_SHAREWARE && KB_KeyPressed(KEYSC_M)) - { - extern SWBOOL DebugActorFreeze; - - KB_KeyPressed(KEYSC_M) = 0; - DebugActorFreeze++; - if (DebugActorFreeze > 2) - DebugActorFreeze = 0; - - if (DebugActorFreeze == 2) - { - short i, nexti; - - TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) - { - SET(sprite[i].cstat, CSTAT_SPRITE_INVISIBLE); - if (TEST(sprite[i].cstat, CSTAT_SPRITE_BLOCK)) - { - SET(sprite[i].extra, SPRX_BLOCK); - RESET(sprite[i].cstat, CSTAT_SPRITE_BLOCK); - } - } - } - - if (DebugActorFreeze == 0) - { - short i, nexti; - - TRAVERSE_SPRITE_STAT(headspritestat[STAT_ENEMY], i, nexti) - { - RESET(sprite[i].cstat, CSTAT_SPRITE_INVISIBLE); - if (TEST(sprite[i].extra, SPRX_BLOCK)) - SET(sprite[i].cstat, CSTAT_SPRITE_BLOCK); - } - } - } - - - // Insert a player - if (KB_KeyPressed(KEYSC_INS)) - // player - { - KB_KeyPressed(KEYSC_INS) = 0; - ManualPlayerInsert(pp); - // comes back looking through screenpeek - InitPlayerSprite(Player + screenpeek); - PlayerDeathReset(Player + screenpeek); - SetFragBar(pp); - } - - - // Delete a player - if (KB_KeyPressed(KEYSC_DEL)) - { - KB_KeyPressed(KEYSC_DEL) = 0; - ManualPlayerDelete(pp); - } - - // Move control to numbered player - - if ((kp = KeyPressedRange(&KB_KeyPressed(KEYSC_1), &KB_KeyPressed(KEYSC_9))) && numplayers > 1) - { - short save_myconnectindex; - - save_myconnectindex = myconnectindex; - - myconnectindex = (intptr_t)kp - (intptr_t)(&KB_KeyPressed(KEYSC_1)); - - if (myconnectindex >= numplayers) - myconnectindex = save_myconnectindex; - - screenpeek = myconnectindex; - - DoPlayerDivePalette(pp); - - // Now check for item or pain palette stuff - // This sets the palette to whatever it is of the player you - // just chose to view the game through. -// printf("SingPlayInput ALT+1-9 set_pal: pp->PlayerSprite = %d\n",pp->PlayerSprite); - //COVERsetbrightness(0,(char *)palette_data); // JBF: figure out what's going on here - - DoPlayerNightVisionPalette(pp); - - ResetKeyRange(&KB_KeyPressed(KEYSC_1), &KB_KeyPressed(KEYSC_9)); - } - -#if 0 - if (KB_KeyPressed(KEYSC_T)) - { - KB_KeyPressed(KEYSC_T) = 0; - PlayerTrackingMode ^= 1; - } -#endif - - if (KB_KeyPressed(KEYSC_H)) - { - short pnum; - - KB_KeyPressed(KEYSC_H) = 0; - - TRAVERSE_CONNECT(pnum) - { - User[Player[pnum].PlayerSprite]->Health = 100; - } - } } void @@ -4391,7 +4283,7 @@ FunctionKeys(PLAYERp pp) if (KB_KeyPressed(sc_F9)) { fn_key = 9; } if (KB_KeyPressed(sc_F10)) { fn_key = 10; } - if (KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)) + if (inputState.AltPressed()) { if (rts_delay > 16 && fn_key && CommEnabled && !adult_lockout && !Global_PLock) { @@ -4403,7 +4295,6 @@ FunctionKeys(PLAYERp pp) if (CommEnabled) { - short pnum; PACKET_RTS p; p.PacketType = PACKET_TYPE_RTS; @@ -4416,7 +4307,7 @@ FunctionKeys(PLAYERp pp) return; } - if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT)) + if (inputState.ShiftPressed()) { if (fn_key && CommEnabled) { diff --git a/source/sw/src/game.h b/source/sw/src/game.h index ca1aeda45..ad7d0adc1 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -498,8 +498,6 @@ int StdRandomRange(int range); // just determine if the player is moving #define PLAYER_MOVING(pp) ((pp)->xvect|(pp)->yvect) -#define KEY_EXT(scan) (KB_KeyPressed(scan) | KB_KeyPressed(scan+128)) - #define TEST_GOTSECTOR(sect_num) (TEST(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7))) #define RESET_GOTSECTOR(sect_num) (RESET(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7))) #define SET_GOTSECTOR(sect_num) (SET(gotsector[(sect_num) >> 3], 1 << ((sect_num) & 7)))