diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 4beed9706..7bcaddff6 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -811,8 +811,6 @@ void LocalKeys(void) gPlayerMsg.Set(*CombatMacros[fk]); gPlayerMsg.Send(); } - inputState.keyFlushScans(); - inputState.ClearKeyStatus(key); buttonMap.ClearButton(gamefunc_See_Chase_View); return; } diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 558404b4b..d689ab47f 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -38,24 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -int32_t ctrlCheckAllInput(void) -{ - return ( - inputState.keyBufferWaiting() || - inputState.MouseGetButtons() - //JOYSTICK_GetButtons() - ); -} - -void ctrlClearAllInput(void) -{ - inputState.keyFlushChars(); - inputState.ClearKeysDown(); - inputState.MouseClearAllButtonss(); - //JOYSTICK_ClearAllButtons() - ; -} - GINPUT gInput; bool bSilentAim = false; diff --git a/source/blood/src/controls.h b/source/blood/src/controls.h index ecfdb0ef1..e7a10b125 100644 --- a/source/blood/src/controls.h +++ b/source/blood/src/controls.h @@ -106,8 +106,6 @@ struct GINPUT extern GINPUT gInput; extern bool bSilentAim; -int32_t ctrlCheckAllInput(void); -void ctrlClearAllInput(void); void ctrlInit(); void ctrlGetInput(); diff --git a/source/blood/src/credits.cpp b/source/blood/src/credits.cpp index 009f2bf74..0ff8586ca 100644 --- a/source/blood/src/credits.cpp +++ b/source/blood/src/credits.cpp @@ -47,7 +47,7 @@ char Wait(int nTicks) while (totalclock < nTicks) { gameHandleEvents(); - char key = inputState.keyGetScan(); + auto key = inputState.keyGetScan(); if (key) { if (key == sc_Escape) // sc_Escape @@ -253,7 +253,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) gameHandleEvents(); ClockTicks nStartTime = totalclock; - ctrlClearAllInput(); + inputState.ClearAllInput(); int nFrame = 0; do @@ -262,7 +262,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) if (scale((int)(totalclock-nStartTime), nFrameRate, kTicRate) < nFrame) continue; - if (ctrlCheckAllInput()) + if (inputState.CheckAllInput()) break; videoClearScreen(0); @@ -275,13 +275,12 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) videoNextPage(); - ctrlClearAllInput(); nFrame++; Smacker_GetNextFrame(hSMK); } while(nFrame < nFrames); Smacker_Close(hSMK); - ctrlClearAllInput(); + inputState.ClearAllInput(); soundEngine->StopAllChannels(); videoSetPalette(0, 0, 8+2); tileDelete(kSMKTile); diff --git a/source/blood/src/macros.h b/source/blood/src/macros.h index 2f23d30b2..2d2ed2fd3 100644 --- a/source/blood/src/macros.h +++ b/source/blood/src/macros.h @@ -29,10 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define BGSTRETCH (hud_bgstretch ? 1024 : 0) -#define WIN_IS_PRESSED ( inputState.GetKeyStatus( sc_RightWin ) || inputState.GetKeyStatus( sc_LeftWin ) ) -#define ALT_IS_PRESSED ( inputState.GetKeyStatus( sc_RightAlt ) || inputState.GetKeyStatus( sc_LeftAlt ) ) -#define SHIFTS_IS_PRESSED ( inputState.GetKeyStatus( sc_RightShift ) || inputState.GetKeyStatus( sc_LeftShift ) ) - #define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n) #define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n) #define TRAVERSE_CONNECT(i) i = 0; i != -1; i = connectpoint2[i] diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 0ede685fe..3133dc055 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -90,23 +90,16 @@ extern int32_t qsetmode; extern int32_t g_logFlushWindow; -void I_GetEvent(); +void I_StartTic(); inline int32_t handleevents(void) { timerUpdateClock(); - I_GetEvent(); + I_StartTic(); return 0; } -int32_t handleevents_peekkeys(void); - -int32_t initinput(void); -void uninitinput(void); - void mouseGrabInput(bool grab); -void mouseLockToWindow(bool a); -void mouseMoveToCenter(void); extern int32_t inputchecked; @@ -115,7 +108,6 @@ void getScreen(uint8_t* imgBuf); int32_t wm_msgbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); int32_t wm_ynbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); -void wm_setapptitle(const char *name); #include "print.h" diff --git a/source/common/filesystem/file_grp.cpp b/source/common/filesystem/file_grp.cpp index 532681289..ad12cf486 100644 --- a/source/common/filesystem/file_grp.cpp +++ b/source/common/filesystem/file_grp.cpp @@ -117,7 +117,7 @@ bool FGrpFile::Open(bool quiet) fileinfo[i].NameWithZero[12] = '\0'; // Be sure filename is null-terminated Lumps[i].LumpNameSetup(fileinfo[i].NameWithZero); } - //if (!quiet) Printf(", %d lumps\n", NumLumps); + if (!quiet) Printf(", %d lumps\n", NumLumps); delete[] fileinfo; return true; } diff --git a/source/common/filesystem/file_pak.cpp b/source/common/filesystem/file_pak.cpp index f2d0d35f8..3102c52f2 100644 --- a/source/common/filesystem/file_pak.cpp +++ b/source/common/filesystem/file_pak.cpp @@ -33,6 +33,7 @@ */ #include "resourcefile.h" +#include "printf.h" //#include "w_wad.h" //#include "doomtype.h" @@ -103,7 +104,7 @@ bool FPakFile::Open(bool quiet) Lumps.Resize(NumLumps); - //if (!quiet) Printf(", %d lumps\n", NumLumps); + if (!quiet) Printf(", %d lumps\n", NumLumps); for(uint32_t i = 0; i < NumLumps; i++) { diff --git a/source/common/filesystem/file_rff.cpp b/source/common/filesystem/file_rff.cpp index b6bc7aef4..11a341cb1 100644 --- a/source/common/filesystem/file_rff.cpp +++ b/source/common/filesystem/file_rff.cpp @@ -34,6 +34,7 @@ */ #include #include "resourcefile.h" +#include "printf.h" //========================================================================== // @@ -144,7 +145,7 @@ bool FRFFFile::Open(bool quiet) Lumps.Grow(NumLumps); - //if (!quiet) Printf(", %d lumps\n", NumLumps); + if (!quiet) Printf(", %d lumps\n", NumLumps); for (uint32_t i = 0; i < NumLumps; ++i) { Lumps.Reserve(1); diff --git a/source/common/filesystem/file_zip.cpp b/source/common/filesystem/file_zip.cpp index 579391147..1a15c6b90 100644 --- a/source/common/filesystem/file_zip.cpp +++ b/source/common/filesystem/file_zip.cpp @@ -279,6 +279,7 @@ bool FZipFile::Open(bool quiet) // Resize the lump record array to its actual size NumLumps -= skipped; free(directory); + if (!quiet) Printf(", %d lumps\n", NumLumps); PostProcessArchive(&Lumps[0], sizeof(FZipLump)); return true; diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index f2c2291af..f3c64222c 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -50,6 +50,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "inputstate.h" #include "v_video.h" #include "st_start.h" +#include "s_music.h" #ifndef NETCODE_DISABLE #include "enet.h" #endif @@ -530,6 +531,7 @@ int RunGame() I_Error("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr); } + mouseGrabInput(true); // the intros require the mouse to be grabbed. return gi->app_main(); } diff --git a/source/common/input/input.cpp b/source/common/input/input.cpp index 0b7f25939..0fa32494c 100644 --- a/source/common/input/input.cpp +++ b/source/common/input/input.cpp @@ -32,30 +32,12 @@ bool mouseInactiveConditional(bool condition) return condition; } -int32_t I_CheckAllInput(void) -{ - return - inputState.keyBufferWaiting() - || inputState.MouseGetButtons() - //|| JOYSTICK_GetButtons() - ; -} -void I_ClearAllInput(void) -{ - inputState.keyFlushChars(); - inputState.ClearKeysDown(); - inputState.MouseClearAllButtonss(); - //JOYSTICK_ClearAllButtons(); - buttonMap.ResetButtonStates(); -} - - int32_t I_TextSubmit(void) { return inputState.GetKeyStatus(sc_Enter) || inputState.GetKeyStatus(sc_kpad_Enter) - || mouseInactiveConditional(inputState.MouseGetButtons()&LEFT_MOUSE) + || inputState.GetKeyStatus(KEY_MOUSE1) /*|| (JOYSTICK_GetGameControllerButtons()&(1<type == EV_KeyDown || ev->type == EV_KeyUp) { - switch (ev->data1) - { - case KEY_MOUSE1 : mouseSetBit(LEFT_MOUSE, ev->type == EV_KeyDown); handleevents_updatemousestate(ev->type); break; - case KEY_MOUSE2 : mouseSetBit(RIGHT_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MOUSE3 : mouseSetBit(MIDDLE_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MOUSE4 : mouseSetBit(THUMB_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MWHEELUP: mouseSetBit(WHEELUP_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MWHEELDOWN: mouseSetBit(WHEELDOWN_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MWHEELLEFT: mouseSetBit(WHEELLEFT_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MWHEELRIGHT: mouseSetBit(WHEELRIGHT_MOUSE, ev->type == EV_KeyDown); break; - case KEY_MOUSE5: mouseSetBit(THUMB2_MOUSE, ev->type == EV_KeyDown); break; - default: break; - } keySetState(ev->data1, ev->type == EV_KeyDown); if (ev->data2) keySetChar(ev->data2); } diff --git a/source/common/inputstate.h b/source/common/inputstate.h index 85f31b5c4..fc42f2dff 100644 --- a/source/common/inputstate.h +++ b/source/common/inputstate.h @@ -12,7 +12,7 @@ extern char appactive; -typedef uint8_t kb_scancode; +typedef uint16_t kb_scancode; extern int GUICapture; // This encapsulates the entire game-readable input state which previously was spread out across several files. @@ -72,8 +72,8 @@ class InputState uint8_t KeyStatus[NUM_KEYS]; - char g_keyFIFO[KEYFIFOSIZ]; - char g_keyAsciiFIFO[KEYFIFOSIZ]; + kb_scancode g_keyFIFO[KEYFIFOSIZ]; + char16_t g_keyAsciiFIFO[KEYFIFOSIZ]; uint8_t g_keyFIFOpos; uint8_t g_keyFIFOend; uint8_t g_keyAsciiPos; @@ -81,9 +81,6 @@ class InputState kb_scancode KB_LastScan; - int g_mouseBits; - uint8_t g_mouseClickState; - vec2_t g_mousePos; vec2_t g_mouseAbs; @@ -148,12 +145,6 @@ public: return ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)) == g_keyAsciiPos; } - void keyBufferInsert(char code) - { - g_keyAsciiFIFO[g_keyAsciiEnd] = code; - g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)); - } - void keySetState(int32_t key, int32_t state) { if (state && !GetKeyStatus(key)) @@ -162,8 +153,6 @@ public: } SetKeyStatus(key, state); - event_t ev = { (uint8_t)(state ? EV_KeyDown : EV_KeyUp), 0, (int16_t)key }; - if (state) { g_keyFIFO[g_keyFIFOend] = key; @@ -172,14 +161,13 @@ public: } } - char keyGetScan(void) + kb_scancode keyGetScan() { if (g_keyFIFOpos == g_keyFIFOend) return 0; - char const c = g_keyFIFO[g_keyFIFOpos]; + auto const c = g_keyFIFO[g_keyFIFOpos]; g_keyFIFOpos = ((g_keyFIFOpos + 2) & (KEYFIFOSIZ - 1)); - return c; } @@ -205,7 +193,7 @@ public: void keySetChar(int key) { - g_keyAsciiFIFO[g_keyAsciiEnd] = key; + g_keyAsciiFIFO[g_keyAsciiEnd] = (char16_t)key; g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)); } @@ -242,46 +230,8 @@ public: ClearAllKeyStatus(); } - void mouseSetBit(int val, int state) - { - if (state) g_mouseBits |= val; - else g_mouseBits &=~val; - } - - void handleevents_updatemousestate(uint8_t state) - { - g_mouseClickState = state == EV_KeyUp ? MOUSE_RELEASED : MOUSE_PRESSED; - } - void AddEvent(const event_t* ev); - int32_t mouseReadButtons(void) - { - return (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || GUICapture) ? 0 : g_mouseBits; - } - - int mouseClickState() - { - return g_mouseClickState; - } - - void clearMouseClickState() - { - g_mouseClickState = MOUSE_IDLE; - } - - - int32_t mouseAdvanceClickState(void) - { - switch (g_mouseClickState) - { - case MOUSE_PRESSED: g_mouseClickState = MOUSE_HELD; return 1; - case MOUSE_RELEASED: g_mouseClickState = MOUSE_IDLE; return 1; - case MOUSE_HELD: return 1; - } - return 0; - } - void MouseSetPos(int x, int y) { g_mousePos = { x, y }; @@ -301,9 +251,6 @@ public: // fixme: This needs to be tracked. return false; } - int32_t MouseGetButtons(void) { return mouseReadButtons(); } - inline void MouseClearButton(int32_t b) { g_mouseBits &= ~b; } - inline void MouseClearAllButtonss(void) { g_mouseBits = 0; } int32_t mouseReadAbs(vec2_t* const pResult); void GetMouseDelta(ControlInfo* info); @@ -312,6 +259,14 @@ public: ClearKeysDown(); keyFlushChars(); keyFlushScans(); + buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well. + } + + bool CheckAllInput() + { + auto res = keyGetScan(); + ClearAllInput(); + return res; } }; @@ -339,5 +294,6 @@ inline void CONTROL_GetInput(ControlInfo* info) } } - - +#define WIN_IS_PRESSED ( inputState.WinPressed() ) +#define ALT_IS_PRESSED ( inputState.AltPressed() ) +#define SHIFTS_IS_PRESSED ( inputState.ShiftPressed() ) diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 76e74dd8e..5486be86a 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -238,7 +238,7 @@ int32_t Anim_Play(const char *fn) uint16_t soundidx = 0; // custom anim sounds int32_t running = 1, i; - I_ClearAllInput(); + inputState.ClearAllInput(); #ifdef USE_LIBVPX uint16_t framenum = 0; @@ -389,13 +389,13 @@ int32_t Anim_Play(const char *fn) palfadedelta = 0; videoShowFrame(0); - // I_ClearAllInput(); + // inputState.ClearAllInput(); do { gameHandleEvents(); - if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, I_GeneralTrigger())) + if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, inputState.CheckAllInput())) { running = 0; break; @@ -409,7 +409,6 @@ int32_t Anim_Play(const char *fn) animvpx_restore_glstate(); animvpx_uninit_codec(&codec); - I_ClearAllInput(); return !running; // done with playing VP8! } #endif @@ -482,7 +481,7 @@ int32_t Anim_Play(const char *fn) TileFiles.tileSetExternal(TILE_ANIM, 200, 320, ANIM_DrawFrame(i)); tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228 - if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, I_GeneralTrigger())) + if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, inputState.CheckAllInput())) { running = 0; goto end_anim_restore_gl; @@ -526,7 +525,7 @@ int32_t Anim_Play(const char *fn) videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); ototalclock += anim->framedelay; @@ -550,7 +549,7 @@ end_anim_restore_gl: gltexapplyprops(); #endif end_anim: - I_ClearAllInput(); + inputState.ClearAllInput(); anim->animbuf = nullptr; ANIM_FreeAnim(); diff --git a/source/duke3d/src/d_menu.cpp b/source/duke3d/src/d_menu.cpp index d113a82e6..eb1a93fa6 100644 --- a/source/duke3d/src/d_menu.cpp +++ b/source/duke3d/src/d_menu.cpp @@ -505,7 +505,7 @@ void GameInterface::MenuClosed() if (gm & MODE_GAME) { if (gm & MODE_MENU) - I_ClearAllInput(); + inputState.ClearAllInput(); // The following lines are here so that you cannot close the menu when no game is running. gm &= ~MODE_MENU; diff --git a/source/duke3d/src/demo.cpp b/source/duke3d/src/demo.cpp index 3cf9cfa46..c592df775 100644 --- a/source/duke3d/src/demo.cpp +++ b/source/duke3d/src/demo.cpp @@ -517,7 +517,7 @@ RECHECK: } } - if (foundemo == 0 || in_menu || I_CheckAllInput() || numplayers > 1) + if (foundemo == 0 || in_menu || inputState.CheckAllInput() || numplayers > 1) { FX_StopAllSounds(); S_ClearSoundLocks(); @@ -527,7 +527,7 @@ RECHECK: ready2send = 0; bigi = 0; - I_ClearAllInput(); + inputState.ClearAllInput(); // OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt); while (g_demo_cnt < g_demo_totalCnt || foundemo==0) @@ -791,7 +791,7 @@ nextdemo_nomenu: // draw status Demo_DisplayProfStatus(); - if (I_GeneralTrigger()) + if (inputState.CheckAllInput()) Demo_StopProfiling(); } else @@ -897,7 +897,7 @@ nextdemo_nomenu: if (VOLUMEONE) { - if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) + if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0) rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128); } diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 671007d9b..47efa7cc1 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -687,7 +687,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) VM_OnEvent(EVENT_DISPLAYSTART, pPlayer->i, playerNum); - if ((ud.overhead_on == 2 && !automapping) || ud.show_help || (pPlayer->cursectnum == -1 && videoGetRenderMode() != REND_CLASSIC)) + if ((ud.overhead_on == 2 && !automapping) || (pPlayer->cursectnum == -1 && videoGetRenderMode() != REND_CLASSIC)) return; if (r_usenewaspect) @@ -4635,8 +4635,7 @@ void G_HandleLocalKeys(void) } } } - - if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED && !WIN_IS_PRESSED) + else { if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) { @@ -4674,6 +4673,7 @@ void G_HandleLocalKeys(void) } } +#if 0 // fixme: We should not query Esc here, this needs to be done differently if (I_EscapeTrigger() && ud.overhead_on && myplayer.newowner == -1) { I_EscapeTriggerClear(); @@ -4682,6 +4682,7 @@ void G_HandleLocalKeys(void) ud.scrollmode = 0; G_UpdateScreenArea(); } +#endif if (buttonMap.ButtonDown(gamefunc_Map)) { @@ -6066,7 +6067,7 @@ MAIN_LOOP_RESTART: int const moveClock = (int)totalclock; - if (((ud.show_help == 0 && !GUICapture && (myplayer.gm & MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) + if (((!GUICapture && (myplayer.gm & MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && (myplayer.gm & MODE_GAME)) { G_MoveLoop(); diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index c17d64a31..45385896e 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -181,7 +181,7 @@ typedef struct { char overhead_on,last_overhead,showweapons; char god,warp_on,cashman,eog,showallmap; - char show_help,scrollmode,noclip; + char scrollmode,noclip; char display_bonus_screen; char show_level_text; @@ -344,7 +344,7 @@ static inline int32_t calc_smoothratio_demo(ClockTicks totalclk, ClockTicks otot static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) { - if (!((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || + if (!(((!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || (g_netServer || ud.multimode > 1) || ud.recstat == 2) || ud.pause_on) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index a6a570d84..665ba2390 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1238,7 +1238,7 @@ void Screen_Play(void) { bool running = true; - I_ClearAllInput(); + inputState.ClearAllInput(); // This needs to be disabled during the loop. auto r2dover = rotatesprite_2doverride; @@ -1254,11 +1254,11 @@ void Screen_Play(void) videoClearScreen(0); - if (VM_OnEventWithReturn(EVENT_SCREEN, -1, myconnectindex, I_CheckAllInput())) + if (VM_OnEventWithReturn(EVENT_SCREEN, -1, myconnectindex, inputState.CheckAllInput())) running = false; videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); } while (running); rotatesprite_2doverride = r2dover; } @@ -4146,7 +4146,7 @@ badindex: } tw = vm.pPlayer->palette; - I_ClearAllInput(); + inputState.ClearAllInput(); Anim_Play(quoteMgr.GetQuote(nQuote)); P_SetGamePalette(vm.pPlayer, tw, 2 + 16); dispatch(); @@ -4154,7 +4154,7 @@ badindex: vInstruction(CON_STARTSCREEN): insptr++; - I_ClearAllInput(); + inputState.ClearAllInput(); Screen_Play(); dispatch(); diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 9b89cf272..8a4713b98 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -1383,7 +1383,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2) case USERDEFS_CASHMAN: labelNum = ud.cashman; break; case USERDEFS_EOG: labelNum = ud.eog; break; case USERDEFS_SHOWALLMAP: labelNum = ud.showallmap; break; - case USERDEFS_SHOW_HELP: labelNum = ud.show_help; break; + case USERDEFS_SHOW_HELP: labelNum = 0; break; case USERDEFS_SCROLLMODE: labelNum = ud.scrollmode; break; case USERDEFS_CLIPPING: labelNum = ud.noclip; break; // case USERDEFS_USER_NAME: labelNum = ud.user_name[MAXPLAYERS][32]; break; @@ -1571,7 +1571,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons case USERDEFS_CASHMAN: ud.cashman = iSet; break; case USERDEFS_EOG: ud.eog = iSet; break; case USERDEFS_SHOWALLMAP: ud.showallmap = iSet; break; - case USERDEFS_SHOW_HELP: ud.show_help = iSet; break; + case USERDEFS_SHOW_HELP: break; case USERDEFS_SCROLLMODE: ud.scrollmode = iSet; break; case USERDEFS_CLIPPING: ud.noclip = iSet; break; // case USERDEFS_USER_NAME: ud.user_name[MAXPLAYERS][32] = lValue; break; diff --git a/source/duke3d/src/macros.h b/source/duke3d/src/macros.h index ab8120d83..05084c269 100644 --- a/source/duke3d/src/macros.h +++ b/source/duke3d/src/macros.h @@ -32,10 +32,6 @@ BEGIN_DUKE_NS #define BGSTRETCH (hud_bgstretch ? 1024 : 0) -#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),\ SCRAP6+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-512-(krand()&2047),i,5) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 147c4f3a6..8f0e5f1f9 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -3066,7 +3066,7 @@ void P_GetInput(int const playerNum) localInput.bits |= (mouseaim << SK_AIMMODE); localInput.bits |= (g_gameQuit << SK_GAMEQUIT); localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; - localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; + //localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; fixme.This needs to be done differently if (buttonMap.ButtonDown(gamefunc_Dpad_Select)) { diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 139569b6f..cc9641d8f 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -669,7 +669,6 @@ void P_ResetPlayer(int playerNum) { auto &p = *g_player[playerNum].ps; - ud.show_help = 0; ud.showallmap = 0; p.access_spritenum = -1; diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 9c2fc68e0..b5d5b8ec6 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -55,24 +55,21 @@ int32_t g_noLogo = 0; #ifndef EDUKE32_STANDALONE static void G_HandleEventsWhileNoInput(void) { - I_ClearAllInput(); + inputState.ClearAllInput(); - while (!I_GeneralTrigger()) + while (!inputState.CheckAllInput()) gameHandleEvents(); - - I_ClearAllInput(); } static int32_t G_PlaySoundWhileNoInput(int32_t soundnum) { S_PlaySound(soundnum); - I_ClearAllInput(); + inputState.ClearAllInput(); while (S_CheckSoundPlaying(soundnum)) { gameHandleEvents(); - if (I_GeneralTrigger()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); return 1; } } @@ -811,33 +808,6 @@ void G_DisplayRest(int32_t smoothratio) } } - if (ud.show_help) - { - switch (ud.show_help) - { - case 1: - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TEXTSTORY, 0, 0, 10+64); - break; - case 2: - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, F1HELP, 0, 0, 10+64); - break; - } - - if (I_ReturnTrigger()) - { - I_ReturnTriggerClear(); - ud.show_help = 0; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - G_UpdateScreenArea(); - } - - return; - } - i = pp->cursectnum; if (i > -1) { @@ -1092,7 +1062,7 @@ void G_DisplayRest(int32_t smoothratio) #ifndef EDUKE32_TOUCH_DEVICES if (VOLUMEONE) { - if (ud.show_help == 0 && g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) + if (g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128); } #endif @@ -1160,9 +1130,8 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_ // (end-start)/step + 1 iterations do { - if (I_GeneralTrigger()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); videoFadePalette(r, g, b, end); // have to set to end fade value if we break! return; } @@ -1186,9 +1155,8 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t // (end-start)/step + 1 iterations do { - if (I_GeneralTrigger()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); videoFadePalette(r, g, b, end); // have to set to end fade value if we break! return; } @@ -1217,15 +1185,15 @@ void gameDisplayTENScreen() // g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 fadepal(0, 0, 0, 0, 252, 28); - I_ClearAllInput(); + inputState.ClearAllInput(); totalclock = 0; rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH); fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN); - while (!I_GeneralTrigger() && totalclock < 2400) + while (!inputState.CheckAllInput() && totalclock < 2400) gameHandleEvents(); fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); - I_ClearAllInput(); + inputState.ClearAllInput(); #ifdef __ANDROID__ inExtraScreens = 0; #endif @@ -1241,17 +1209,17 @@ void gameDisplaySharewareScreens() // g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 fadepal(0, 0, 0, 0, 252, 28); - I_ClearAllInput(); + inputState.ClearAllInput(); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3291, 0, 0, 2 + 8 + 64 + BGSTRETCH); fadepaltile(0, 0, 0, 252, 0, -28, 3291); - while (!I_GeneralTrigger()) + while (!inputState.CheckAllInput()) gameHandleEvents(); fadepaltile(0, 0, 0, 0, 252, 28, 3291); - I_ClearAllInput(); + inputState.ClearAllInput(); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3290, 0, 0, 2 + 8 + 64 + BGSTRETCH); fadepaltile(0, 0, 0, 252, 0, -28, 3290); - while (!I_GeneralTrigger()) + while (!inputState.CheckAllInput()) gameHandleEvents(); #ifdef __ANDROID__ @@ -1273,7 +1241,7 @@ void G_DisplayExtraScreens(void) void gameDisplay3DRScreen() { - if (!I_GeneralTrigger() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); @@ -1281,7 +1249,7 @@ void gameDisplay3DRScreen() { Anim_Play("3dr.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } else { @@ -1295,7 +1263,7 @@ void gameDisplay3DRScreen() fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); totalclock = 0; - while (totalclock < (120 * 7) && !I_GeneralTrigger()) + while (totalclock < (120 * 7) && !inputState.CheckAllInput()) { if (G_FPSLimit()) { @@ -1336,7 +1304,7 @@ void gameDisplayTitleScreen(void) #ifndef EDUKE32_SIMPLE_MENU totalclock < (860 + 120) && #endif - !I_GeneralTrigger()) + !inputState.CheckAllInput()) { if (G_FPSLimit()) { @@ -1432,7 +1400,7 @@ void G_DisplayLogo(void) ready2send = 0; - I_ClearAllInput(); + inputState.ClearAllInput(); videoSetViewableArea(0, 0, xdim-1, ydim-1); videoClearScreen(0L); @@ -1455,12 +1423,12 @@ void G_DisplayLogo(void) #endif (logoflags & LOGO_PLAYANIM)) { - if (!I_GeneralTrigger() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); Anim_Play("logo.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } videoClearScreen(0L); @@ -1489,7 +1457,7 @@ void G_DisplayLogo(void) videoNextPage(); } - I_ClearAllInput(); + inputState.ClearAllInput(); } videoClearScreen(0L); @@ -1498,7 +1466,7 @@ void G_DisplayLogo(void) if (logoflags & LOGO_TITLESCREEN) gameDisplayTitleScreen(); - I_ClearAllInput(); + inputState.ClearAllInput(); } renderFlushPerms(); @@ -1523,14 +1491,14 @@ void G_DoOrderScreen(void) for (int i=0; i<4; i++) { fadepal(0, 0, 0, 0, 252, 28); - I_ClearAllInput(); + inputState.ClearAllInput(); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, ORDERING+i, 0, 0, 2+8+64+BGSTRETCH); fadepal(0, 0, 0, 252, 0, -28); - while (!I_CheckAllInput()) + while (!inputState.CheckAllInput()) gameHandleEvents(); } - I_ClearAllInput(); + inputState.ClearAllInput(); } @@ -1565,7 +1533,7 @@ static void G_BonusCutscenes(void) videoNextPage(); fadepal(0, 0, 0, 252, 0, -4); - I_ClearAllInput(); + inputState.ClearAllInput(); totalclock = 0; do @@ -1625,7 +1593,7 @@ static void G_BonusCutscenes(void) gameHandleEvents(); - if (I_GeneralTrigger()) break; + if (inputState.CheckAllInput()) break; } while (1); fadepal(0, 0, 0, 0, 252, 4); @@ -1634,7 +1602,7 @@ static void G_BonusCutscenes(void) if (G_GetLogoFlags() & LOGO_NOE1ENDSCREEN) goto VOL1_END; - I_ClearAllInput(); + inputState.ClearAllInput(); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3292, 0, 0, 2+8+64+BGSTRETCH); @@ -1662,7 +1630,7 @@ static void G_BonusCutscenes(void) { fadepal(0, 0, 0, 252, 0, -4); Anim_Play("cineov2.anm"); - I_ClearAllInput(); + inputState.ClearAllInput(); videoClearScreen(0L); videoNextPage(); @@ -1673,7 +1641,7 @@ static void G_BonusCutscenes(void) if (G_GetLogoFlags() & LOGO_NOE2ENDSCREEN) return; - I_ClearAllInput(); + inputState.ClearAllInput(); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH); fadepal(0, 0, 0, 252, 0, -4); @@ -1696,7 +1664,7 @@ static void G_BonusCutscenes(void) { fadepal(0, 0, 0, 252, 0, -4); - I_ClearAllInput(); + inputState.ClearAllInput(); int t = Anim_Play("vol4e1.anm"); videoClearScreen(0L); videoNextPage(); @@ -1721,7 +1689,7 @@ static void G_BonusCutscenes(void) FX_StopAllSounds(); S_ClearSoundLocks(); S_PlaySound(ENDSEQVOL3SND4); - I_ClearAllInput(); + inputState.ClearAllInput(); if (G_GetLogoFlags() & LOGO_NODUKETEAMTEXT) goto VOL4_DUKETEAM; @@ -1739,7 +1707,7 @@ static void G_BonusCutscenes(void) fadepal(0, 0, 0, 252, 0, -12); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); fadepal(0, 0, 0, 0, 252, 12); @@ -1752,7 +1720,7 @@ static void G_BonusCutscenes(void) Anim_Play("DUKETEAM.ANM"); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); videoClearScreen(0L); @@ -1762,7 +1730,7 @@ static void G_BonusCutscenes(void) VOL4_END: FX_StopAllSounds(); S_ClearSoundLocks(); - I_ClearAllInput(); + inputState.ClearAllInput(); break; @@ -1777,7 +1745,7 @@ static void G_BonusCutscenes(void) { fadepal(0, 0, 0, 252, 0, -4); Anim_Play("cineov3.anm"); - I_ClearAllInput(); + inputState.ClearAllInput(); ototalclock = totalclock+200; while (totalclock < ototalclock) gameHandleEvents(); @@ -1793,7 +1761,7 @@ static void G_BonusCutscenes(void) Anim_Play("RADLOGO.ANM"); - if (adult_lockout == 0 && !I_GeneralTrigger()) + if (adult_lockout == 0 && !inputState.CheckAllInput()) { if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; @@ -1802,15 +1770,15 @@ static void G_BonusCutscenes(void) if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM; } - I_ClearAllInput(); + inputState.ClearAllInput(); totalclock = 0; if (PLUTOPAK || (G_GetLogoFlags() & LOGO_NODUKETEAMPIC)) { - while (totalclock < 120 && !I_GeneralTrigger()) + while (totalclock < 120 && !inputState.CheckAllInput()) gameHandleEvents(); - I_ClearAllInput(); + inputState.ClearAllInput(); } else { @@ -1829,7 +1797,7 @@ static void G_BonusCutscenes(void) Anim_Play("DUKETEAM.ANM"); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); videoClearScreen(0L); @@ -1837,7 +1805,7 @@ static void G_BonusCutscenes(void) G_FadePalette(0, 0, 0, 252); } - I_ClearAllInput(); + inputState.ClearAllInput(); FX_StopAllSounds(); S_ClearSoundLocks(); @@ -2030,7 +1998,7 @@ void G_BonusScreen(int32_t bonusonly) S_PlaySound(BONUSMUSIC); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); fadepal(0, 0, 0, 252, 0, -28); totalclock = 0; @@ -2045,9 +2013,8 @@ void G_BonusScreen(int32_t bonusonly) videoNextPage(); } - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); break; } } @@ -2070,7 +2037,7 @@ void G_BonusScreen(int32_t bonusonly) S_PlaySound(BONUSMUSIC); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); fadepal(0, 0, 0, 252, 0, -4); bonuscnt = 0; totalclock = 0; @@ -2298,9 +2265,8 @@ void G_BonusScreen(int32_t bonusonly) if (totalclock > 10240 && totalclock < 10240+10240) totalclock = 1024; - if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 + if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809 { - I_ClearAllInput(); if (totalclock < (60*13)) { inputState.keyFlushChars(); diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 72bd8f687..917df5c27 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -3105,9 +3105,6 @@ static int32_t our_neartag_blacklist(int32_t spriteNum) static void G_ClearCameras(DukePlayer_t *p) { G_ClearCameraView(p); - - if (I_EscapeTrigger()) - I_EscapeTriggerClear(); } void P_CheckSectors(int playerNum) diff --git a/source/platform/win32/i_input.cpp b/source/platform/win32/i_input.cpp index 6f03602dd..01ac32431 100644 --- a/source/platform/win32/i_input.cpp +++ b/source/platform/win32/i_input.cpp @@ -412,13 +412,15 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } return 0; +#if 0 // NOTE: Reactivate!!! case WM_KILLFOCUS: I_CheckNativeMouse (true, false); // Make sure mouse gets released right away break; case WM_SETFOCUS: - I_CheckNativeMouse (false, EventHandlerResultForNativeMouse); // This cannot call the event handler. Doing it from here is unsafe. + I_CheckNativeMouse (false, false); // This cannot call the event handler. Doing it from here is unsafe. break; +#endif case WM_SETCURSOR: if (!CursorState) @@ -736,6 +738,7 @@ void I_GetEvent () // void I_StartTic () { + I_StartFrame(); BlockMouseMove--; buttonMap.ResetButtonTriggers (); I_CheckNativeMouse (false, false); diff --git a/source/platform/win32/i_mouse.cpp b/source/platform/win32/i_mouse.cpp index 503c67983..3e72d1cb3 100644 --- a/source/platform/win32/i_mouse.cpp +++ b/source/platform/win32/i_mouse.cpp @@ -280,6 +280,8 @@ static bool grab_mouse; void mouseGrabInput(bool grab) { grab_mouse = grab; + if (grab) GUICapture &= ~1; + else GUICapture |= 1; } void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult) diff --git a/source/rr/src/anim.cpp b/source/rr/src/anim.cpp index 8053a7cb8..d89e9f8be 100644 --- a/source/rr/src/anim.cpp +++ b/source/rr/src/anim.cpp @@ -274,7 +274,7 @@ int32_t Anim_Play(const char *fn) uint16_t soundidx = 0; // custom anim sounds int32_t running = 1, i; - I_ClearAllInput(); + inputState.ClearAllInput(); #ifdef USE_LIBVPX uint16_t framenum = 0; @@ -421,13 +421,13 @@ int32_t Anim_Play(const char *fn) palfadedelta = 0; videoShowFrame(0); - // I_ClearAllInput(); + // inputState.ClearAllInput(); do { G_HandleAsync(); - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { running = 0; break; @@ -441,7 +441,7 @@ int32_t Anim_Play(const char *fn) animvpx_restore_glstate(); animvpx_uninit_codec(&codec); - I_ClearAllInput(); + inputState.ClearAllInput(); return !running; // done with playing VP8! } #endif @@ -514,7 +514,7 @@ int32_t Anim_Play(const char *fn) TileFiles.tileSetExternal(TILE_ANIM, 200, 320, ANIM_DrawFrame(i)); tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228 - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { running = 0; goto end_anim_restore_gl; @@ -556,7 +556,7 @@ int32_t Anim_Play(const char *fn) videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); ototalclock += anim->framedelay; @@ -580,7 +580,7 @@ end_anim_restore_gl: gltexapplyprops(); #endif end_anim: - I_ClearAllInput(); + inputState.ClearAllInput(); anim->animbuf = nullptr; ANIM_FreeAnim(); tileDelete(TILE_ANIM); diff --git a/source/rr/src/d_menu.cpp b/source/rr/src/d_menu.cpp index d2af6d069..65471e76d 100644 --- a/source/rr/src/d_menu.cpp +++ b/source/rr/src/d_menu.cpp @@ -384,7 +384,7 @@ void GameInterface::MenuClosed() if (gm & MODE_GAME) { if (gm & MODE_MENU) - I_ClearAllInput(); + inputState.ClearAllInput(); // The following lines are here so that you cannot close the menu when no game is running. gm &= ~MODE_MENU; diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index 3f5ca9a63..d167beb46 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -517,7 +517,7 @@ RECHECK: } } - if (foundemo == 0 || in_menu || I_CheckAllInput() || numplayers > 1) + if (foundemo == 0 || in_menu || inputState.CheckAllInput() || numplayers > 1) { FX_StopAllSounds(); S_ClearSoundLocks(); @@ -527,7 +527,7 @@ RECHECK: ready2send = 0; bigi = 0; - I_ClearAllInput(); + inputState.ClearAllInput(); // OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt); while (g_demo_cnt < g_demo_totalCnt || foundemo==0) @@ -793,7 +793,7 @@ nextdemo_nomenu: // draw status Demo_DisplayProfStatus(); - if (I_GeneralTrigger()) + if (inputState.CheckAllInput()) Demo_StopProfiling(); } else @@ -902,7 +902,7 @@ nextdemo_nomenu: if (VOLUMEONE) { - if (ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) + if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0) rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128); } diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 4fd378145..ece7b710e 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -905,7 +905,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) pub = 0; } - if (ud.overhead_on == 2 || ud.show_help || (pPlayer->cursectnum == -1 && videoGetRenderMode() != REND_CLASSIC)) + if (ud.overhead_on == 2 || (pPlayer->cursectnum == -1 && videoGetRenderMode() != REND_CLASSIC)) return; if (r_usenewaspect) @@ -6188,8 +6188,7 @@ void G_HandleLocalKeys(void) } } } - - if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED && !WIN_IS_PRESSED) + else { if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) { @@ -6230,6 +6229,7 @@ void G_HandleLocalKeys(void) } } +#if 0 // fixme: We should not query Esc here, this needs to be done differently if (I_EscapeTrigger() && ud.overhead_on && g_player[myconnectindex].ps->newowner == -1) { I_EscapeTriggerClear(); @@ -6238,6 +6238,7 @@ void G_HandleLocalKeys(void) ud.scrollmode = 0; G_UpdateScreenArea(); } +#endif if (buttonMap.ButtonDown(gamefunc_Map)) { @@ -7518,7 +7519,7 @@ MAIN_LOOP_RESTART: int const moveClock = (int) totalclock; - if (((ud.show_help == 0 && !GUICapture && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && + if (((!GUICapture && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) && (g_player[myconnectindex].ps->gm&MODE_GAME)) { G_MoveLoop(); diff --git a/source/rr/src/game.h b/source/rr/src/game.h index 5660e5e61..7a06c5f6a 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -180,7 +180,7 @@ typedef struct { char overhead_on,last_overhead,showweapons; char god,warp_on,cashman,eog,showallmap; - char show_help,scrollmode,noclip; + char scrollmode,noclip; char display_bonus_screen; char show_level_text; @@ -346,7 +346,7 @@ static inline int32_t calc_smoothratio_demo(ClockTicks totalclk, ClockTicks otot static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk) { - if (!((ud.show_help == 0 && (!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || + if (!(((!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) || (g_netServer || ud.multimode > 1) || ud.recstat == 2) || ud.pause_on) diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index e6efa911a..426515789 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -1119,7 +1119,7 @@ void Screen_Play(void) { int32_t running = 1; - I_ClearAllInput(); + inputState.ClearAllInput(); auto r2dover = rotatesprite_2doverride; rotatesprite_2doverride = false; @@ -1133,11 +1133,11 @@ void Screen_Play(void) continue; videoClearScreen(0); - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) running = 0; videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); } while (running); rotatesprite_2doverride = r2dover; } diff --git a/source/rr/src/macros.h b/source/rr/src/macros.h index 5a17e07ad..0a60ae583 100644 --- a/source/rr/src/macros.h +++ b/source/rr/src/macros.h @@ -37,10 +37,6 @@ static FORCE_INLINE int32_t krand2(void) #define BGSTRETCH (hud_bgstretch ? 1024 : 0) -#define WIN_IS_PRESSED ( inputState.WinPressed() ) -#define ALT_IS_PRESSED ( inputState.AltPressed() ) -#define SHIFTS_IS_PRESSED ( inputState.ShiftPressed() ) - #define RANDOMSCRAP(s, i) \ { \ int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(), r5 = krand2(), r6 = krand2(), r7 = krand2(); \ diff --git a/source/rr/src/player.cpp b/source/rr/src/player.cpp index d8fb37069..20a092a9c 100644 --- a/source/rr/src/player.cpp +++ b/source/rr/src/player.cpp @@ -2956,7 +2956,7 @@ void P_GetInput(int playerNum) localInput.bits |= (mouseaim << SK_AIMMODE); localInput.bits |= (g_gameQuit << SK_GAMEQUIT); localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; - localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; + //localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; fixme.This needs to be done differently if (RR) { @@ -3077,7 +3077,7 @@ void P_GetInputMotorcycle(int playerNum) (buttonMap.ButtonDown(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT; localInput.bits |= buttonMap.ButtonDown(gamefunc_Open) << SK_OPEN; localInput.bits |= buttonMap.ButtonDown(gamefunc_Inventory) << SK_INVENTORY; - localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; + //localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; fixme.This needs to be done differently if (buttonMap.ButtonDown(gamefunc_Dpad_Select)) { @@ -3342,7 +3342,7 @@ void P_GetInputBoat(int playerNum) (buttonMap.ButtonDown(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT; localInput.bits |= buttonMap.ButtonDown(gamefunc_Open) << SK_OPEN; localInput.bits |= buttonMap.ButtonDown(gamefunc_Inventory) << SK_INVENTORY; - localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; + //localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE; fixme.This needs to be done differently if (buttonMap.ButtonDown(gamefunc_Dpad_Select)) { diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 73bdd3d00..d3605feb1 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -841,7 +841,6 @@ void P_ResetStatus(int playerNum) { DukePlayer_t *const pPlayer = g_player[playerNum].ps; - ud.show_help = 0; ud.showallmap = 0; pPlayer->dead_flag = 0; pPlayer->wackedbyactor = -1; diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 1ae2fb144..e6d4b1a99 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -54,24 +54,22 @@ int32_t g_noLogo = 0; ////////// OFTEN-USED FEW-LINERS ////////// static void G_HandleEventsWhileNoInput(void) { - I_ClearAllInput(); + inputState.ClearAllInput(); - while (!I_CheckAllInput()) + while (!inputState.CheckAllInput()) G_HandleAsync(); - I_ClearAllInput(); } static int32_t G_PlaySoundWhileNoInput(int32_t soundnum) { S_PlaySound(soundnum); - I_ClearAllInput(); + inputState.ClearAllInput(); while (S_CheckSoundPlaying(-1, soundnum)) { G_HandleAsync(); - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); return 1; } } @@ -830,37 +828,6 @@ void G_DisplayRest(int32_t smoothratio) } } - if (ud.show_help) - { - switch (ud.show_help) - { - case 1: - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TEXTSTORY, 0, 0, 10+64); - break; - case 2: - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, F1HELP, 0, 0, 10+64); - break; - case 3: - if (RRRA) - rotatesprite_fs(160<<16, 100<<16, 65536L, 0, RRTILE1636, 0, 0, 10+64); - break; - } - - if (I_ReturnTrigger()) - { - I_ReturnTriggerClear(); - ud.show_help = 0; - if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - G_UpdateScreenArea(); - } - - return; - } - i = pp->cursectnum; if (i > -1) { @@ -1096,7 +1063,7 @@ void G_DisplayRest(int32_t smoothratio) #ifndef EDUKE32_TOUCH_DEVICES if (VOLUMEONE) { - if (ud.show_help == 0 && g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) + if (g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128); } #endif @@ -1216,17 +1183,16 @@ void G_DisplayExtraScreens(void) //g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 fadepal(0, 0, 0, 0, 252, 28); - I_ClearAllInput(); + inputState.ClearAllInput(); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3291, 0, 0, 2+8+64+BGSTRETCH); fadepaltile(0, 0, 0, 252, 0, -28, 3291); - while (!I_CheckAllInput()) + while (!inputState.CheckAllInput()) G_HandleAsync(); fadepaltile(0, 0, 0, 0, 252, 28, 3291); - I_ClearAllInput(); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3290, 0, 0, 2+8+64+BGSTRETCH); fadepaltile(0, 0, 0, 252, 0, -28, 3290); - while (!I_CheckAllInput()) + while (!inputState.CheckAllInput()) G_HandleAsync(); #ifdef __ANDROID__ @@ -1244,15 +1210,15 @@ void G_DisplayExtraScreens(void) //g_player[myconnectindex].ps->palette = palette; P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 fadepal(0, 0, 0, 0, 252, 28); - I_ClearAllInput(); + inputState.ClearAllInput(); totalclock = 0; rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TENSCREEN, 0, 0, 2+8+64+BGSTRETCH); fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN); - while (!I_CheckAllInput() && totalclock < 2400) + while (!inputState.CheckAllInput() && totalclock < 2400) G_HandleAsync(); fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); - I_ClearAllInput(); + inputState.ClearAllInput(); #ifdef __ANDROID__ inExtraScreens = 0; #endif @@ -1266,7 +1232,7 @@ void G_DisplayLogo(void) ready2send = 0; - I_ClearAllInput(); + inputState.ClearAllInput(); videoSetViewableArea(0, 0, xdim-1, ydim-1); videoClearScreen(0L); @@ -1282,12 +1248,12 @@ void G_DisplayLogo(void) return; if (RR) { - if (!I_CheckAllInput() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); Anim_Play("rr_intro.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } videoClearScreen(0L); @@ -1295,12 +1261,12 @@ void G_DisplayLogo(void) FX_StopAllSounds(); S_ClearSoundLocks(); - if (!I_CheckAllInput() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); Anim_Play("redneck.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } videoClearScreen(0L); @@ -1308,12 +1274,12 @@ void G_DisplayLogo(void) FX_StopAllSounds(); S_ClearSoundLocks(); - if (!I_CheckAllInput() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); Anim_Play("xatlogo.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } videoClearScreen(0L); @@ -1335,12 +1301,12 @@ void G_DisplayLogo(void) if (VOLUMEALL) #endif { - if (!I_CheckAllInput() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); Anim_Play("logo.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } videoClearScreen(0L); @@ -1354,7 +1320,7 @@ void G_DisplayLogo(void) //g_player[myconnectindex].ps->palette = drealms; //G_FadePalette(0,0,0,252); - if (!I_CheckAllInput() && g_noLogoAnim == 0) + if (!inputState.CheckAllInput() && g_noLogoAnim == 0) { Net_GetPackets(); @@ -1362,7 +1328,7 @@ void G_DisplayLogo(void) { Anim_Play("3dr.anm"); G_FadePalette(0, 0, 0, 252); - I_ClearAllInput(); + inputState.ClearAllInput(); } else { @@ -1376,7 +1342,7 @@ void G_DisplayLogo(void) fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); totalclock = 0; - while (totalclock < (120 * 7) && !I_CheckAllInput()) + while (totalclock < (120 * 7) && !inputState.CheckAllInput()) { if (G_FPSLimit()) { @@ -1400,7 +1366,7 @@ void G_DisplayLogo(void) videoClearScreen(0L); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); videoClearScreen(0L); videoNextPage(); @@ -1419,7 +1385,7 @@ void G_DisplayLogo(void) #ifndef EDUKE32_SIMPLE_MENU totalclock < (860+120) && #endif - !I_CheckAllInput()) + !inputState.CheckAllInput()) { if (G_FPSLimit()) { @@ -1487,7 +1453,7 @@ void G_DisplayLogo(void) G_HandleAsync(); } - I_ClearAllInput(); + inputState.ClearAllInput(); } renderFlushPerms(); @@ -1513,14 +1479,12 @@ void G_DoOrderScreen(void) for (i=0; i<4; i++) { fadepal(0, 0, 0, 0, 252, 28); - I_ClearAllInput(); + inputState.ClearAllInput(); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, ORDERING+i, 0, 0, 2+8+64+BGSTRETCH); fadepal(0, 0, 0, 252, 0, -28); - while (!I_CheckAllInput()) + while (!inputState.CheckAllInput()) G_HandleAsync(); } - - I_ClearAllInput(); } @@ -1541,7 +1505,7 @@ static void G_BonusCutscenes(void) if (adult_lockout == 0) { Anim_Play("turdmov.anm"); - I_ClearAllInput(); + inputState.ClearAllInput(); videoClearScreen(0L); videoNextPage(); } @@ -1549,12 +1513,12 @@ static void G_BonusCutscenes(void) ud.volume_number = 1; ud.eog = 0; fadepal(0, 0, 0, 0, 252, 4); - I_ClearAllInput(); + inputState.ClearAllInput(); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); rotatesprite_fs(0, 0, 65536L, 0, TENSCREEN, 0, 0, 2+8+16+64+128+BGSTRETCH); videoNextPage(); fadepal(0, 0, 0, 252, 0, -4); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); fadepal(0, 0, 0, 0, 252, 4); FX_StopAllSounds(); @@ -1566,7 +1530,7 @@ static void G_BonusCutscenes(void) if (adult_lockout == 0) { Anim_Play("rr_outro.anm"); - I_ClearAllInput(); + inputState.ClearAllInput(); videoClearScreen(0L); videoNextPage(); } @@ -1576,12 +1540,12 @@ static void G_BonusCutscenes(void) ud.volume_number = 0; fadepal(0, 0, 0, 0, 252, 4); videoSetViewableArea(0, 0, xdim-1, ydim-1); - I_ClearAllInput(); + inputState.ClearAllInput(); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8 + 2 + 1); rotatesprite_fs(0, 0, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 16 + 64 + 128 + BGSTRETCH); videoNextPage(); fadepal(0, 0, 0, 252, 0, -4); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); fadepal(0, 0, 0, 0, 252, 4); FX_StopAllSounds(); @@ -1614,7 +1578,7 @@ static void G_BonusCutscenes(void) videoNextPage(); fadepal(0, 0, 0, 252, 0, -4); - I_ClearAllInput(); + inputState.ClearAllInput(); totalclock = 0; while (1) @@ -1675,13 +1639,13 @@ static void G_BonusCutscenes(void) G_HandleAsync(); - if (I_CheckAllInput()) break; + if (inputState.CheckAllInput()) break; } fadepal(0, 0, 0, 0, 252, 4); } - I_ClearAllInput(); + inputState.ClearAllInput(); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3292, 0, 0, 2+8+64+BGSTRETCH); @@ -1705,7 +1669,7 @@ static void G_BonusCutscenes(void) { fadepal(0, 0, 0, 252, 0, -4); Anim_Play("cineov2.anm"); - I_ClearAllInput(); + inputState.ClearAllInput(); videoClearScreen(0L); videoNextPage(); @@ -1713,7 +1677,7 @@ static void G_BonusCutscenes(void) fadepal(0, 0, 0, 0, 252, 4); } - I_ClearAllInput(); + inputState.ClearAllInput(); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH); fadepal(0, 0, 0, 252, 0, -4); @@ -1733,7 +1697,7 @@ static void G_BonusCutscenes(void) { fadepal(0, 0, 0, 252, 0, -4); - I_ClearAllInput(); + inputState.ClearAllInput(); int t = Anim_Play("vol4e1.anm"); videoClearScreen(0L); videoNextPage(); @@ -1755,7 +1719,7 @@ static void G_BonusCutscenes(void) FX_StopAllSounds(); S_ClearSoundLocks(); S_PlaySound(ENDSEQVOL3SND4); - I_ClearAllInput(); + inputState.ClearAllInput(); G_FadePalette(0, 0, 0, 0); P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308 @@ -1770,7 +1734,7 @@ static void G_BonusCutscenes(void) fadepal(0, 0, 0, 252, 0, -12); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); fadepal(0, 0, 0, 0, 252, 12); @@ -1779,7 +1743,7 @@ static void G_BonusCutscenes(void) Anim_Play("DUKETEAM.ANM"); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); videoClearScreen(0L); @@ -1788,7 +1752,7 @@ static void G_BonusCutscenes(void) FX_StopAllSounds(); S_ClearSoundLocks(); - I_ClearAllInput(); + inputState.ClearAllInput(); break; @@ -1800,7 +1764,7 @@ static void G_BonusCutscenes(void) { fadepal(0, 0, 0, 252, 0, -4); Anim_Play("cineov3.anm"); - I_ClearAllInput(); + inputState.ClearAllInput(); ototalclock = totalclock+200; while (totalclock < ototalclock) G_HandleAsync(); @@ -1813,7 +1777,7 @@ static void G_BonusCutscenes(void) Anim_Play("RADLOGO.ANM"); - if (adult_lockout == 0 && !I_CheckAllInput()) + if (!inputState.CheckAllInput() && adult_lockout == 0) { if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; @@ -1822,15 +1786,11 @@ static void G_BonusCutscenes(void) if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM; } - I_ClearAllInput(); - totalclock = 0; if (PLUTOPAK) { - while (totalclock < 120 && !I_CheckAllInput()) + while (!inputState.CheckAllInput() && totalclock < 120) G_HandleAsync(); - - I_ClearAllInput(); } else { @@ -1849,7 +1809,7 @@ static void G_BonusCutscenes(void) Anim_Play("DUKETEAM.ANM"); - I_ClearAllInput(); + inputState.ClearAllInput(); G_HandleEventsWhileNoInput(); videoClearScreen(0L); @@ -1857,7 +1817,7 @@ static void G_BonusCutscenes(void) G_FadePalette(0, 0, 0, 252); } - I_ClearAllInput(); + inputState.ClearAllInput(); FX_StopAllSounds(); S_ClearSoundLocks(); @@ -2044,7 +2004,7 @@ void G_BonusScreen(int32_t bonusonly) S_PlaySound(BONUSMUSIC); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); fadepal(0, 0, 0, 252, 0, RR ? -4 : -28); totalclock = 0; @@ -2059,9 +2019,8 @@ void G_BonusScreen(int32_t bonusonly) videoNextPage(); } - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); break; } } @@ -2105,7 +2064,7 @@ void G_BonusScreen(int32_t bonusonly) } videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); fadepal(0, 0, 0, 252, 0, -4); bonuscnt = 0; totalclock = 0; @@ -2408,12 +2367,10 @@ void G_BonusScreen(int32_t bonusonly) if (totalclock > 10240 && totalclock < 10240+10240) totalclock = 1024; - if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 + if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809 { - I_ClearAllInput(); if (totalclock < (60*13)) { - inputState.keyFlushChars(); totalclock = (60*13); } else if (totalclock < 1000000000) @@ -2626,7 +2583,7 @@ void G_BonusScreenRRRA(int32_t bonusonly) S_PlaySound(BONUSMUSIC); videoNextPage(); - I_ClearAllInput(); + inputState.ClearAllInput(); fadepal(0, 0, 0, 252, 0, -4); totalclock = 0; @@ -2641,9 +2598,8 @@ void G_BonusScreenRRRA(int32_t bonusonly) videoNextPage(); } - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); break; } } @@ -2669,7 +2625,7 @@ void G_BonusScreenRRRA(int32_t bonusonly) menutext(15, 192, "Press any key to continue"); - I_ClearAllInput(); + inputState.ClearAllInput(); if (!showMap) { videoNextPage(); @@ -2907,13 +2863,10 @@ void G_BonusScreenRRRA(int32_t bonusonly) if (totalclock > 10240 && totalclock < 10240+10240) totalclock = 1024; - if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 + if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809 { - I_ClearAllInput(); - if (totalclock < (60*13)) { - inputState.keyFlushChars(); totalclock = (60*13); } else if (totalclock < 1000000000) @@ -2954,9 +2907,8 @@ void G_BonusScreenRRRA(int32_t bonusonly) } if (!S_CheckSoundPlaying(-1,35)) break; - if (I_CheckAllInput()) + if (inputState.CheckAllInput()) { - I_ClearAllInput(); S_StopSound(35); break; } diff --git a/source/rr/src/sector.cpp b/source/rr/src/sector.cpp index 6f5fe66e2..bae6f1abf 100644 --- a/source/rr/src/sector.cpp +++ b/source/rr/src/sector.cpp @@ -4268,9 +4268,6 @@ static int32_t our_neartag_blacklist(int32_t UNUSED(spriteNum)) static void G_ClearCameras(DukePlayer_t *p) { G_ClearCameraView(p); - - if (I_EscapeTrigger()) - I_EscapeTriggerClear(); } void P_CheckSectors(int playerNum) diff --git a/source/sw/src/anim.cpp b/source/sw/src/anim.cpp index 09dc527f2..561d8f70b 100644 --- a/source/sw/src/anim.cpp +++ b/source/sw/src/anim.cpp @@ -281,16 +281,9 @@ playanm(short anim_num) switch (ANIMnum) { case ANIM_INTRO: - if (I_GeneralTrigger()) - { - I_GeneralTriggerClear(); - goto ENDOFANIMLOOP; - } - break; case ANIM_SERP: - if (I_EscapeTrigger()) + if (inputState.CheckAllInput()) { - I_EscapeTriggerClear(); goto ENDOFANIMLOOP; } break; diff --git a/source/sw/src/demo.cpp b/source/sw/src/demo.cpp index 7fc518b16..a73218950 100644 --- a/source/sw/src/demo.cpp +++ b/source/sw/src/demo.cpp @@ -598,7 +598,7 @@ ScenePlayBack(void) } } - if (KeyPressed()) + if (inputState.CheckAllInput()) DemoDone = TRUE; if (DemoDone) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index e47dd5d2d..4cab482a3 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -1455,11 +1455,6 @@ ResetKeys(void) } -SWBOOL KeyPressed(void) -{ - return I_GeneralTrigger(); -} - uint8_t* KeyPressedRange(uint8_t* kb, uint8_t* ke) { uint8_t* k; @@ -1539,9 +1534,9 @@ void LogoLevel(void) ototalclock += synctics; } - if (totalclock > 5*120 || I_GeneralTrigger()) + if (totalclock > 5*120 || inputState.CheckAllInput()) { - I_GeneralTriggerClear(); + inputState.ClearAllInput(); break; } } @@ -1658,7 +1653,7 @@ void SybexScreen(void) videoNextPage(); ResetKeys(); - while (!KeyPressed()) handleevents(); + while (!inputState.CheckAllInput()) handleevents(); } // CTW REMOVED END @@ -1713,7 +1708,7 @@ TitleLevel(void) videoNextPage(); - if (totalclock > 5*120 || KeyPressed()) + if (totalclock > 5*120 || inputState.CheckAllInput()) { DemoMode = TRUE; DemoPlaying = TRUE; @@ -2154,9 +2149,8 @@ void BonusScreen(PLAYERp pp) } ototalclock += limit; - if (I_GeneralTrigger()) + if (inputState.CheckAllInput()) { - I_GeneralTriggerClear(); if (State >= s_BonusRest && State < &s_BonusRest[SIZ(s_BonusRest)]) { State = s_BonusAnim[STD_RANDOM_RANGE(SIZ(s_BonusAnim))]; @@ -2437,13 +2431,7 @@ void StatScreen(PLAYERp mpp) videoNextPage(); - if (KeyPressed()) - { - while (KeyPressed()) ; - } - - inputState.ClearKeyStatus(KEYSC_SPACE); - inputState.ClearKeyStatus(KEYSC_ENTER); + inputState.ClearAllInput(); PlaySong(nullptr, ThemeSongs[1], ThemeTrack[1]); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index b727de59b..c28f98132 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2333,7 +2333,6 @@ void MapSetAll2D(uint8_t fill); // game.c void TerminateGame(void); // game.c void TerminateLevel(void); // game.c void ResetKeys(void); // game.c -SWBOOL KeyPressed(void); // game.c void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c void COVERsetbrightness(int bright, unsigned char *pal); // game.c void DrawMenuLevelScreen(void); // game.c