- hooked up the input system and did a major cleanup.

Much of the old system is no longer needed with all buttons being handled as keys.
Mouse axis movement is not working yet.
This commit is contained in:
Christoph Oelckers 2019-12-24 12:59:26 +01:00
parent 141887263d
commit a870df840e
44 changed files with 205 additions and 467 deletions

View file

@ -811,8 +811,6 @@ void LocalKeys(void)
gPlayerMsg.Set(*CombatMacros[fk]); gPlayerMsg.Set(*CombatMacros[fk]);
gPlayerMsg.Send(); gPlayerMsg.Send();
} }
inputState.keyFlushScans();
inputState.ClearKeyStatus(key);
buttonMap.ClearButton(gamefunc_See_Chase_View); buttonMap.ClearButton(gamefunc_See_Chase_View);
return; return;
} }

View file

@ -38,24 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS 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; GINPUT gInput;
bool bSilentAim = false; bool bSilentAim = false;

View file

@ -106,8 +106,6 @@ struct GINPUT
extern GINPUT gInput; extern GINPUT gInput;
extern bool bSilentAim; extern bool bSilentAim;
int32_t ctrlCheckAllInput(void);
void ctrlClearAllInput(void);
void ctrlInit(); void ctrlInit();
void ctrlGetInput(); void ctrlGetInput();

View file

@ -47,7 +47,7 @@ char Wait(int nTicks)
while (totalclock < nTicks) while (totalclock < nTicks)
{ {
gameHandleEvents(); gameHandleEvents();
char key = inputState.keyGetScan(); auto key = inputState.keyGetScan();
if (key) if (key)
{ {
if (key == sc_Escape) // sc_Escape if (key == sc_Escape) // sc_Escape
@ -253,7 +253,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
gameHandleEvents(); gameHandleEvents();
ClockTicks nStartTime = totalclock; ClockTicks nStartTime = totalclock;
ctrlClearAllInput(); inputState.ClearAllInput();
int nFrame = 0; int nFrame = 0;
do do
@ -262,7 +262,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
if (scale((int)(totalclock-nStartTime), nFrameRate, kTicRate) < nFrame) if (scale((int)(totalclock-nStartTime), nFrameRate, kTicRate) < nFrame)
continue; continue;
if (ctrlCheckAllInput()) if (inputState.CheckAllInput())
break; break;
videoClearScreen(0); videoClearScreen(0);
@ -275,13 +275,12 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
videoNextPage(); videoNextPage();
ctrlClearAllInput();
nFrame++; nFrame++;
Smacker_GetNextFrame(hSMK); Smacker_GetNextFrame(hSMK);
} while(nFrame < nFrames); } while(nFrame < nFrames);
Smacker_Close(hSMK); Smacker_Close(hSMK);
ctrlClearAllInput(); inputState.ClearAllInput();
soundEngine->StopAllChannels(); soundEngine->StopAllChannels();
videoSetPalette(0, 0, 8+2); videoSetPalette(0, 0, 8+2);
tileDelete(kSMKTile); tileDelete(kSMKTile);

View file

@ -29,10 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define BGSTRETCH (hud_bgstretch ? 1024 : 0) #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_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_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] #define TRAVERSE_CONNECT(i) i = 0; i != -1; i = connectpoint2[i]

View file

@ -90,23 +90,16 @@ extern int32_t qsetmode;
extern int32_t g_logFlushWindow; extern int32_t g_logFlushWindow;
void I_GetEvent(); void I_StartTic();
inline int32_t handleevents(void) inline int32_t handleevents(void)
{ {
timerUpdateClock(); timerUpdateClock();
I_GetEvent(); I_StartTic();
return 0; return 0;
} }
int32_t handleevents_peekkeys(void);
int32_t initinput(void);
void uninitinput(void);
void mouseGrabInput(bool grab); void mouseGrabInput(bool grab);
void mouseLockToWindow(bool a);
void mouseMoveToCenter(void);
extern int32_t inputchecked; 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_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))); int32_t wm_ynbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3)));
void wm_setapptitle(const char *name);
#include "print.h" #include "print.h"

View file

@ -117,7 +117,7 @@ bool FGrpFile::Open(bool quiet)
fileinfo[i].NameWithZero[12] = '\0'; // Be sure filename is null-terminated fileinfo[i].NameWithZero[12] = '\0'; // Be sure filename is null-terminated
Lumps[i].LumpNameSetup(fileinfo[i].NameWithZero); Lumps[i].LumpNameSetup(fileinfo[i].NameWithZero);
} }
//if (!quiet) Printf(", %d lumps\n", NumLumps); if (!quiet) Printf(", %d lumps\n", NumLumps);
delete[] fileinfo; delete[] fileinfo;
return true; return true;
} }

View file

@ -33,6 +33,7 @@
*/ */
#include "resourcefile.h" #include "resourcefile.h"
#include "printf.h"
//#include "w_wad.h" //#include "w_wad.h"
//#include "doomtype.h" //#include "doomtype.h"
@ -103,7 +104,7 @@ bool FPakFile::Open(bool quiet)
Lumps.Resize(NumLumps); 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++) for(uint32_t i = 0; i < NumLumps; i++)
{ {

View file

@ -34,6 +34,7 @@
*/ */
#include <algorithm> #include <algorithm>
#include "resourcefile.h" #include "resourcefile.h"
#include "printf.h"
//========================================================================== //==========================================================================
// //
@ -144,7 +145,7 @@ bool FRFFFile::Open(bool quiet)
Lumps.Grow(NumLumps); 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) for (uint32_t i = 0; i < NumLumps; ++i)
{ {
Lumps.Reserve(1); Lumps.Reserve(1);

View file

@ -279,6 +279,7 @@ bool FZipFile::Open(bool quiet)
// Resize the lump record array to its actual size // Resize the lump record array to its actual size
NumLumps -= skipped; NumLumps -= skipped;
free(directory); free(directory);
if (!quiet) Printf(", %d lumps\n", NumLumps);
PostProcessArchive(&Lumps[0], sizeof(FZipLump)); PostProcessArchive(&Lumps[0], sizeof(FZipLump));
return true; return true;

View file

@ -50,6 +50,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "inputstate.h" #include "inputstate.h"
#include "v_video.h" #include "v_video.h"
#include "st_start.h" #include "st_start.h"
#include "s_music.h"
#ifndef NETCODE_DISABLE #ifndef NETCODE_DISABLE
#include "enet.h" #include "enet.h"
#endif #endif
@ -530,6 +531,7 @@ int RunGame()
I_Error("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr); 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(); return gi->app_main();
} }

View file

@ -32,30 +32,12 @@ bool mouseInactiveConditional(bool condition)
return 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) int32_t I_TextSubmit(void)
{ {
return return
inputState.GetKeyStatus(sc_Enter) inputState.GetKeyStatus(sc_Enter)
|| inputState.GetKeyStatus(sc_kpad_Enter) || inputState.GetKeyStatus(sc_kpad_Enter)
|| mouseInactiveConditional(inputState.MouseGetButtons()&LEFT_MOUSE) || inputState.GetKeyStatus(KEY_MOUSE1)
/*|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A))*/; /*|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A))*/;
} }
@ -64,7 +46,7 @@ void I_TextSubmitClear(void)
inputState.keyFlushChars(); inputState.keyFlushChars();
inputState.ClearKeyStatus(sc_kpad_Enter); inputState.ClearKeyStatus(sc_kpad_Enter);
inputState.ClearKeyStatus(sc_Enter); inputState.ClearKeyStatus(sc_Enter);
inputState.MouseClearButton(LEFT_MOUSE); inputState.ClearKeyStatus(KEY_MOUSE1);
//JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A); //JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A);
} }
@ -85,7 +67,7 @@ int32_t I_ReturnTrigger(void)
{ {
return return
inputState.GetKeyStatus(sc_Escape) inputState.GetKeyStatus(sc_Escape)
|| (inputState.MouseGetButtons()&RIGHT_MOUSE) || inputState.GetKeyStatus(KEY_MOUSE2)
/*|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B))*/; /*|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B))*/;
} }
@ -93,46 +75,10 @@ void I_ReturnTriggerClear(void)
{ {
inputState.keyFlushChars(); inputState.keyFlushChars();
inputState.ClearKeyStatus(sc_Escape); inputState.ClearKeyStatus(sc_Escape);
inputState.MouseClearButton(RIGHT_MOUSE); inputState.ClearKeyStatus(KEY_MOUSE2);
//JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B); //JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B);
} }
int32_t I_GeneralTrigger(void)
{
return
I_AdvanceTrigger()
|| I_ReturnTrigger()
|| buttonMap.ButtonDown(gamefunc_Open)
|| mouseInactiveConditional(buttonMap.ButtonDown(gamefunc_Fire))
|| buttonMap.ButtonDown(gamefunc_Crouch)
/*|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START))*/;
}
void I_GeneralTriggerClear(void)
{
I_AdvanceTriggerClear();
I_ReturnTriggerClear();
buttonMap.ClearButton(gamefunc_Open);
buttonMap.ClearButton(gamefunc_Fire);
buttonMap.ClearButton(gamefunc_Crouch);
//JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
}
int32_t I_EscapeTrigger(void)
{
return
inputState.GetKeyStatus(sc_Escape)
/*|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START))*/;
}
void I_EscapeTriggerClear(void)
{
inputState.keyFlushChars();
inputState.ClearKeyStatus(sc_Escape);
//JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
}
int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags) int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
{ {

View file

@ -30,8 +30,6 @@ enum {
extern char typebuf[TYPEBUFSIZE]; extern char typebuf[TYPEBUFSIZE];
extern int32_t I_CheckAllInput(void);
extern void I_ClearAllInput(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"
@ -40,12 +38,6 @@ extern void I_ClearAllInput(void);
extern int32_t I_AdvanceTrigger(void); extern int32_t I_AdvanceTrigger(void);
extern void I_AdvanceTriggerClear(void); extern void I_AdvanceTriggerClear(void);
extern int32_t I_ReturnTrigger(void);
extern void I_ReturnTriggerClear(void);
extern int32_t I_GeneralTrigger(void);
extern void I_GeneralTriggerClear(void);
extern int32_t I_EscapeTrigger(void);
extern void I_EscapeTriggerClear(void);
enum EnterTextFlags_t { enum EnterTextFlags_t {

View file

@ -72,22 +72,8 @@ void InputState::GetMouseDelta(ControlInfo * info)
void InputState::AddEvent(const event_t *ev) void InputState::AddEvent(const event_t *ev)
{ {
// Set the old mouseBits. Yet another piece of cruft that needs to go away.
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp) if (ev->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); keySetState(ev->data1, ev->type == EV_KeyDown);
if (ev->data2) keySetChar(ev->data2); if (ev->data2) keySetChar(ev->data2);
} }

View file

@ -12,7 +12,7 @@
extern char appactive; extern char appactive;
typedef uint8_t kb_scancode; typedef uint16_t kb_scancode;
extern int GUICapture; extern int GUICapture;
// This encapsulates the entire game-readable input state which previously was spread out across several files. // 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]; uint8_t KeyStatus[NUM_KEYS];
char g_keyFIFO[KEYFIFOSIZ]; kb_scancode g_keyFIFO[KEYFIFOSIZ];
char g_keyAsciiFIFO[KEYFIFOSIZ]; char16_t g_keyAsciiFIFO[KEYFIFOSIZ];
uint8_t g_keyFIFOpos; uint8_t g_keyFIFOpos;
uint8_t g_keyFIFOend; uint8_t g_keyFIFOend;
uint8_t g_keyAsciiPos; uint8_t g_keyAsciiPos;
@ -81,9 +81,6 @@ class InputState
kb_scancode KB_LastScan; kb_scancode KB_LastScan;
int g_mouseBits;
uint8_t g_mouseClickState;
vec2_t g_mousePos; vec2_t g_mousePos;
vec2_t g_mouseAbs; vec2_t g_mouseAbs;
@ -148,12 +145,6 @@ public:
return ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)) == g_keyAsciiPos; 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) void keySetState(int32_t key, int32_t state)
{ {
if (state && !GetKeyStatus(key)) if (state && !GetKeyStatus(key))
@ -162,8 +153,6 @@ public:
} }
SetKeyStatus(key, state); SetKeyStatus(key, state);
event_t ev = { (uint8_t)(state ? EV_KeyDown : EV_KeyUp), 0, (int16_t)key };
if (state) if (state)
{ {
g_keyFIFO[g_keyFIFOend] = key; g_keyFIFO[g_keyFIFOend] = key;
@ -172,14 +161,13 @@ public:
} }
} }
char keyGetScan(void) kb_scancode keyGetScan()
{ {
if (g_keyFIFOpos == g_keyFIFOend) if (g_keyFIFOpos == g_keyFIFOend)
return 0; return 0;
char const c = g_keyFIFO[g_keyFIFOpos]; auto const c = g_keyFIFO[g_keyFIFOpos];
g_keyFIFOpos = ((g_keyFIFOpos + 2) & (KEYFIFOSIZ - 1)); g_keyFIFOpos = ((g_keyFIFOpos + 2) & (KEYFIFOSIZ - 1));
return c; return c;
} }
@ -205,7 +193,7 @@ public:
void keySetChar(int key) void keySetChar(int key)
{ {
g_keyAsciiFIFO[g_keyAsciiEnd] = key; g_keyAsciiFIFO[g_keyAsciiEnd] = (char16_t)key;
g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)); g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1));
} }
@ -242,46 +230,8 @@ public:
ClearAllKeyStatus(); 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); 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) void MouseSetPos(int x, int y)
{ {
g_mousePos = { x, y }; g_mousePos = { x, y };
@ -301,9 +251,6 @@ public:
// fixme: This needs to be tracked. // fixme: This needs to be tracked.
return false; 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); int32_t mouseReadAbs(vec2_t* const pResult);
void GetMouseDelta(ControlInfo* info); void GetMouseDelta(ControlInfo* info);
@ -312,6 +259,14 @@ public:
ClearKeysDown(); ClearKeysDown();
keyFlushChars(); keyFlushChars();
keyFlushScans(); 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() )

View file

@ -238,7 +238,7 @@ int32_t Anim_Play(const char *fn)
uint16_t soundidx = 0; // custom anim sounds uint16_t soundidx = 0; // custom anim sounds
int32_t running = 1, i; int32_t running = 1, i;
I_ClearAllInput(); inputState.ClearAllInput();
#ifdef USE_LIBVPX #ifdef USE_LIBVPX
uint16_t framenum = 0; uint16_t framenum = 0;
@ -389,13 +389,13 @@ int32_t Anim_Play(const char *fn)
palfadedelta = 0; palfadedelta = 0;
videoShowFrame(0); videoShowFrame(0);
// I_ClearAllInput(); // inputState.ClearAllInput();
do do
{ {
gameHandleEvents(); 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; running = 0;
break; break;
@ -409,7 +409,6 @@ int32_t Anim_Play(const char *fn)
animvpx_restore_glstate(); animvpx_restore_glstate();
animvpx_uninit_codec(&codec); animvpx_uninit_codec(&codec);
I_ClearAllInput();
return !running; // done with playing VP8! return !running; // done with playing VP8!
} }
#endif #endif
@ -482,7 +481,7 @@ int32_t Anim_Play(const char *fn)
TileFiles.tileSetExternal(TILE_ANIM, 200, 320, ANIM_DrawFrame(i)); TileFiles.tileSetExternal(TILE_ANIM, 200, 320, ANIM_DrawFrame(i));
tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228 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; running = 0;
goto end_anim_restore_gl; goto end_anim_restore_gl;
@ -526,7 +525,7 @@ int32_t Anim_Play(const char *fn)
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
ototalclock += anim->framedelay; ototalclock += anim->framedelay;
@ -550,7 +549,7 @@ end_anim_restore_gl:
gltexapplyprops(); gltexapplyprops();
#endif #endif
end_anim: end_anim:
I_ClearAllInput(); inputState.ClearAllInput();
anim->animbuf = nullptr; anim->animbuf = nullptr;
ANIM_FreeAnim(); ANIM_FreeAnim();

View file

@ -505,7 +505,7 @@ void GameInterface::MenuClosed()
if (gm & MODE_GAME) if (gm & MODE_GAME)
{ {
if (gm & MODE_MENU) 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. // The following lines are here so that you cannot close the menu when no game is running.
gm &= ~MODE_MENU; gm &= ~MODE_MENU;

View file

@ -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(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
@ -527,7 +527,7 @@ RECHECK:
ready2send = 0; ready2send = 0;
bigi = 0; bigi = 0;
I_ClearAllInput(); inputState.ClearAllInput();
// OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt); // OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt);
while (g_demo_cnt < g_demo_totalCnt || foundemo==0) while (g_demo_cnt < g_demo_totalCnt || foundemo==0)
@ -791,7 +791,7 @@ nextdemo_nomenu:
// draw status // draw status
Demo_DisplayProfStatus(); Demo_DisplayProfStatus();
if (I_GeneralTrigger()) if (inputState.CheckAllInput())
Demo_StopProfiling(); Demo_StopProfiling();
} }
else else
@ -897,7 +897,7 @@ nextdemo_nomenu:
if (VOLUMEONE) 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); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
} }

View file

@ -687,7 +687,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
VM_OnEvent(EVENT_DISPLAYSTART, pPlayer->i, playerNum); 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; return;
if (r_usenewaspect) if (r_usenewaspect)
@ -4635,8 +4635,7 @@ void G_HandleLocalKeys(void)
} }
} }
} }
else
if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED && !WIN_IS_PRESSED)
{ {
if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) 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) if (I_EscapeTrigger() && ud.overhead_on && myplayer.newowner == -1)
{ {
I_EscapeTriggerClear(); I_EscapeTriggerClear();
@ -4682,6 +4682,7 @@ void G_HandleLocalKeys(void)
ud.scrollmode = 0; ud.scrollmode = 0;
G_UpdateScreenArea(); G_UpdateScreenArea();
} }
#endif
if (buttonMap.ButtonDown(gamefunc_Map)) if (buttonMap.ButtonDown(gamefunc_Map))
{ {
@ -6066,7 +6067,7 @@ MAIN_LOOP_RESTART:
int const moveClock = (int)totalclock; 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)) && (myplayer.gm & MODE_GAME))
{ {
G_MoveLoop(); G_MoveLoop();

View file

@ -181,7 +181,7 @@ typedef struct {
char overhead_on,last_overhead,showweapons; char overhead_on,last_overhead,showweapons;
char god,warp_on,cashman,eog,showallmap; char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,noclip; char scrollmode,noclip;
char display_bonus_screen; char display_bonus_screen;
char show_level_text; 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) 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) || (g_netServer || ud.multimode > 1) ||
ud.recstat == 2) || ud.recstat == 2) ||
ud.pause_on) ud.pause_on)

View file

@ -1238,7 +1238,7 @@ void Screen_Play(void)
{ {
bool running = true; bool running = true;
I_ClearAllInput(); inputState.ClearAllInput();
// This needs to be disabled during the loop. // This needs to be disabled during the loop.
auto r2dover = rotatesprite_2doverride; auto r2dover = rotatesprite_2doverride;
@ -1254,11 +1254,11 @@ void Screen_Play(void)
videoClearScreen(0); videoClearScreen(0);
if (VM_OnEventWithReturn(EVENT_SCREEN, -1, myconnectindex, I_CheckAllInput())) if (VM_OnEventWithReturn(EVENT_SCREEN, -1, myconnectindex, inputState.CheckAllInput()))
running = false; running = false;
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
} while (running); } while (running);
rotatesprite_2doverride = r2dover; rotatesprite_2doverride = r2dover;
} }
@ -4146,7 +4146,7 @@ badindex:
} }
tw = vm.pPlayer->palette; tw = vm.pPlayer->palette;
I_ClearAllInput(); inputState.ClearAllInput();
Anim_Play(quoteMgr.GetQuote(nQuote)); Anim_Play(quoteMgr.GetQuote(nQuote));
P_SetGamePalette(vm.pPlayer, tw, 2 + 16); P_SetGamePalette(vm.pPlayer, tw, 2 + 16);
dispatch(); dispatch();
@ -4154,7 +4154,7 @@ badindex:
vInstruction(CON_STARTSCREEN): vInstruction(CON_STARTSCREEN):
insptr++; insptr++;
I_ClearAllInput(); inputState.ClearAllInput();
Screen_Play(); Screen_Play();
dispatch(); dispatch();

View file

@ -1383,7 +1383,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
case USERDEFS_CASHMAN: labelNum = ud.cashman; break; case USERDEFS_CASHMAN: labelNum = ud.cashman; break;
case USERDEFS_EOG: labelNum = ud.eog; break; case USERDEFS_EOG: labelNum = ud.eog; break;
case USERDEFS_SHOWALLMAP: labelNum = ud.showallmap; 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_SCROLLMODE: labelNum = ud.scrollmode; break;
case USERDEFS_CLIPPING: labelNum = ud.noclip; break; case USERDEFS_CLIPPING: labelNum = ud.noclip; break;
// case USERDEFS_USER_NAME: labelNum = ud.user_name[MAXPLAYERS][32]; 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_CASHMAN: ud.cashman = iSet; break;
case USERDEFS_EOG: ud.eog = iSet; break; case USERDEFS_EOG: ud.eog = iSet; break;
case USERDEFS_SHOWALLMAP: ud.showallmap = 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_SCROLLMODE: ud.scrollmode = iSet; break;
case USERDEFS_CLIPPING: ud.noclip = iSet; break; case USERDEFS_CLIPPING: ud.noclip = iSet; break;
// case USERDEFS_USER_NAME: ud.user_name[MAXPLAYERS][32] = lValue; break; // case USERDEFS_USER_NAME: ud.user_name[MAXPLAYERS][32] = lValue; break;

View file

@ -32,10 +32,6 @@ BEGIN_DUKE_NS
#define BGSTRETCH (hud_bgstretch ? 1024 : 0) #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 #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),\ #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) SCRAP6+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-512-(krand()&2047),i,5)

View file

@ -3066,7 +3066,7 @@ void P_GetInput(int const playerNum)
localInput.bits |= (mouseaim << SK_AIMMODE); localInput.bits |= (mouseaim << SK_AIMMODE);
localInput.bits |= (g_gameQuit << SK_GAMEQUIT); localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; 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)) if (buttonMap.ButtonDown(gamefunc_Dpad_Select))
{ {

View file

@ -669,7 +669,6 @@ void P_ResetPlayer(int playerNum)
{ {
auto &p = *g_player[playerNum].ps; auto &p = *g_player[playerNum].ps;
ud.show_help = 0;
ud.showallmap = 0; ud.showallmap = 0;
p.access_spritenum = -1; p.access_spritenum = -1;

View file

@ -55,24 +55,21 @@ int32_t g_noLogo = 0;
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
static void G_HandleEventsWhileNoInput(void) static void G_HandleEventsWhileNoInput(void)
{ {
I_ClearAllInput(); inputState.ClearAllInput();
while (!I_GeneralTrigger()) while (!inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
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_ClearAllInput(); inputState.ClearAllInput();
while (S_CheckSoundPlaying(soundnum)) while (S_CheckSoundPlaying(soundnum))
{ {
gameHandleEvents(); gameHandleEvents();
if (I_GeneralTrigger()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
return 1; 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; i = pp->cursectnum;
if (i > -1) if (i > -1)
{ {
@ -1092,7 +1062,7 @@ void G_DisplayRest(int32_t smoothratio)
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
if (VOLUMEONE) 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); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
} }
#endif #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 // (end-start)/step + 1 iterations
do do
{ {
if (I_GeneralTrigger()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
videoFadePalette(r, g, b, end); // have to set to end fade value if we break! videoFadePalette(r, g, b, end); // have to set to end fade value if we break!
return; 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 // (end-start)/step + 1 iterations
do do
{ {
if (I_GeneralTrigger()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
videoFadePalette(r, g, b, end); // have to set to end fade value if we break! videoFadePalette(r, g, b, end); // have to set to end fade value if we break!
return; return;
} }
@ -1217,15 +1185,15 @@ void gameDisplayTENScreen()
// g_player[myconnectindex].ps->palette = palette; // g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
I_ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN); fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN);
while (!I_GeneralTrigger() && totalclock < 2400) while (!inputState.CheckAllInput() && totalclock < 2400)
gameHandleEvents(); gameHandleEvents();
fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN);
I_ClearAllInput(); inputState.ClearAllInput();
#ifdef __ANDROID__ #ifdef __ANDROID__
inExtraScreens = 0; inExtraScreens = 0;
#endif #endif
@ -1241,17 +1209,17 @@ void gameDisplaySharewareScreens()
// g_player[myconnectindex].ps->palette = palette; // g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); 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); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3291, 0, 0, 2 + 8 + 64 + BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3291); fadepaltile(0, 0, 0, 252, 0, -28, 3291);
while (!I_GeneralTrigger()) while (!inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
fadepaltile(0, 0, 0, 0, 252, 28, 3291); 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); rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 3290, 0, 0, 2 + 8 + 64 + BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3290); fadepaltile(0, 0, 0, 252, 0, -28, 3290);
while (!I_GeneralTrigger()) while (!inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
#ifdef __ANDROID__ #ifdef __ANDROID__
@ -1273,7 +1241,7 @@ void G_DisplayExtraScreens(void)
void gameDisplay3DRScreen() void gameDisplay3DRScreen()
{ {
if (!I_GeneralTrigger() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
@ -1281,7 +1249,7 @@ void gameDisplay3DRScreen()
{ {
Anim_Play("3dr.anm"); Anim_Play("3dr.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
else else
{ {
@ -1295,7 +1263,7 @@ void gameDisplay3DRScreen()
fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 7) && !I_GeneralTrigger()) while (totalclock < (120 * 7) && !inputState.CheckAllInput())
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
@ -1336,7 +1304,7 @@ void gameDisplayTitleScreen(void)
#ifndef EDUKE32_SIMPLE_MENU #ifndef EDUKE32_SIMPLE_MENU
totalclock < (860 + 120) && totalclock < (860 + 120) &&
#endif #endif
!I_GeneralTrigger()) !inputState.CheckAllInput())
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
@ -1432,7 +1400,7 @@ void G_DisplayLogo(void)
ready2send = 0; ready2send = 0;
I_ClearAllInput(); inputState.ClearAllInput();
videoSetViewableArea(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
videoClearScreen(0L); videoClearScreen(0L);
@ -1455,12 +1423,12 @@ void G_DisplayLogo(void)
#endif #endif
(logoflags & LOGO_PLAYANIM)) (logoflags & LOGO_PLAYANIM))
{ {
if (!I_GeneralTrigger() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
Anim_Play("logo.anm"); Anim_Play("logo.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1489,7 +1457,7 @@ void G_DisplayLogo(void)
videoNextPage(); videoNextPage();
} }
I_ClearAllInput(); inputState.ClearAllInput();
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1498,7 +1466,7 @@ void G_DisplayLogo(void)
if (logoflags & LOGO_TITLESCREEN) if (logoflags & LOGO_TITLESCREEN)
gameDisplayTitleScreen(); gameDisplayTitleScreen();
I_ClearAllInput(); inputState.ClearAllInput();
} }
renderFlushPerms(); renderFlushPerms();
@ -1523,14 +1491,14 @@ void G_DoOrderScreen(void)
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
{ {
fadepal(0, 0, 0, 0, 252, 28); 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); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, ORDERING+i, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -28); fadepal(0, 0, 0, 252, 0, -28);
while (!I_CheckAllInput()) while (!inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
} }
I_ClearAllInput(); inputState.ClearAllInput();
} }
@ -1565,7 +1533,7 @@ static void G_BonusCutscenes(void)
videoNextPage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
do do
@ -1625,7 +1593,7 @@ static void G_BonusCutscenes(void)
gameHandleEvents(); gameHandleEvents();
if (I_GeneralTrigger()) break; if (inputState.CheckAllInput()) break;
} while (1); } while (1);
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
@ -1634,7 +1602,7 @@ static void G_BonusCutscenes(void)
if (G_GetLogoFlags() & LOGO_NOE1ENDSCREEN) if (G_GetLogoFlags() & LOGO_NOE1ENDSCREEN)
goto VOL1_END; goto VOL1_END;
I_ClearAllInput(); inputState.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(160<<16, 100<<16, 65536L, 0, 3292, 0, 0, 2+8+64+BGSTRETCH); 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); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov2.anm"); Anim_Play("cineov2.anm");
I_ClearAllInput(); inputState.ClearAllInput();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
@ -1673,7 +1641,7 @@ static void G_BonusCutscenes(void)
if (G_GetLogoFlags() & LOGO_NOE2ENDSCREEN) if (G_GetLogoFlags() & LOGO_NOE2ENDSCREEN)
return; return;
I_ClearAllInput(); inputState.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(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1696,7 +1664,7 @@ static void G_BonusCutscenes(void)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); inputState.ClearAllInput();
int t = Anim_Play("vol4e1.anm"); int t = Anim_Play("vol4e1.anm");
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
@ -1721,7 +1689,7 @@ static void G_BonusCutscenes(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
S_PlaySound(ENDSEQVOL3SND4); S_PlaySound(ENDSEQVOL3SND4);
I_ClearAllInput(); inputState.ClearAllInput();
if (G_GetLogoFlags() & LOGO_NODUKETEAMTEXT) if (G_GetLogoFlags() & LOGO_NODUKETEAMTEXT)
goto VOL4_DUKETEAM; goto VOL4_DUKETEAM;
@ -1739,7 +1707,7 @@ static void G_BonusCutscenes(void)
fadepal(0, 0, 0, 252, 0, -12); fadepal(0, 0, 0, 252, 0, -12);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 12); fadepal(0, 0, 0, 0, 252, 12);
@ -1752,7 +1720,7 @@ static void G_BonusCutscenes(void)
Anim_Play("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
videoClearScreen(0L); videoClearScreen(0L);
@ -1762,7 +1730,7 @@ static void G_BonusCutscenes(void)
VOL4_END: VOL4_END:
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
I_ClearAllInput(); inputState.ClearAllInput();
break; break;
@ -1777,7 +1745,7 @@ static void G_BonusCutscenes(void)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov3.anm"); Anim_Play("cineov3.anm");
I_ClearAllInput(); inputState.ClearAllInput();
ototalclock = totalclock+200; ototalclock = totalclock+200;
while (totalclock < ototalclock) while (totalclock < ototalclock)
gameHandleEvents(); gameHandleEvents();
@ -1793,7 +1761,7 @@ static void G_BonusCutscenes(void)
Anim_Play("RADLOGO.ANM"); 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(ENDSEQVOL3SND5)) goto ENDANM;
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM;
@ -1802,15 +1770,15 @@ static void G_BonusCutscenes(void)
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM;
} }
I_ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
if (PLUTOPAK || (G_GetLogoFlags() & LOGO_NODUKETEAMPIC)) if (PLUTOPAK || (G_GetLogoFlags() & LOGO_NODUKETEAMPIC))
{ {
while (totalclock < 120 && !I_GeneralTrigger()) while (totalclock < 120 && !inputState.CheckAllInput())
gameHandleEvents(); gameHandleEvents();
I_ClearAllInput(); inputState.ClearAllInput();
} }
else else
{ {
@ -1829,7 +1797,7 @@ static void G_BonusCutscenes(void)
Anim_Play("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
videoClearScreen(0L); videoClearScreen(0L);
@ -1837,7 +1805,7 @@ static void G_BonusCutscenes(void)
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
} }
I_ClearAllInput(); inputState.ClearAllInput();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
@ -2030,7 +1998,7 @@ void G_BonusScreen(int32_t bonusonly)
S_PlaySound(BONUSMUSIC); S_PlaySound(BONUSMUSIC);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
fadepal(0, 0, 0, 252, 0, -28); fadepal(0, 0, 0, 252, 0, -28);
totalclock = 0; totalclock = 0;
@ -2045,9 +2013,8 @@ void G_BonusScreen(int32_t bonusonly)
videoNextPage(); videoNextPage();
} }
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
break; break;
} }
} }
@ -2070,7 +2037,7 @@ void G_BonusScreen(int32_t bonusonly)
S_PlaySound(BONUSMUSIC); S_PlaySound(BONUSMUSIC);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
bonuscnt = 0; bonuscnt = 0;
totalclock = 0; totalclock = 0;
@ -2298,9 +2265,8 @@ void G_BonusScreen(int32_t bonusonly)
if (totalclock > 10240 && totalclock < 10240+10240) if (totalclock > 10240 && totalclock < 10240+10240)
totalclock = 1024; totalclock = 1024;
if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809
{ {
I_ClearAllInput();
if (totalclock < (60*13)) if (totalclock < (60*13))
{ {
inputState.keyFlushChars(); inputState.keyFlushChars();

View file

@ -3105,9 +3105,6 @@ static int32_t our_neartag_blacklist(int32_t spriteNum)
static void G_ClearCameras(DukePlayer_t *p) static void G_ClearCameras(DukePlayer_t *p)
{ {
G_ClearCameraView(p); G_ClearCameraView(p);
if (I_EscapeTrigger())
I_EscapeTriggerClear();
} }
void P_CheckSectors(int playerNum) void P_CheckSectors(int playerNum)

View file

@ -412,13 +412,15 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
return 0; return 0;
#if 0 // NOTE: Reactivate!!!
case WM_KILLFOCUS: case WM_KILLFOCUS:
I_CheckNativeMouse (true, false); // Make sure mouse gets released right away I_CheckNativeMouse (true, false); // Make sure mouse gets released right away
break; break;
case WM_SETFOCUS: 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; break;
#endif
case WM_SETCURSOR: case WM_SETCURSOR:
if (!CursorState) if (!CursorState)
@ -736,6 +738,7 @@ void I_GetEvent ()
// //
void I_StartTic () void I_StartTic ()
{ {
I_StartFrame();
BlockMouseMove--; BlockMouseMove--;
buttonMap.ResetButtonTriggers (); buttonMap.ResetButtonTriggers ();
I_CheckNativeMouse (false, false); I_CheckNativeMouse (false, false);

View file

@ -280,6 +280,8 @@ static bool grab_mouse;
void mouseGrabInput(bool grab) void mouseGrabInput(bool grab)
{ {
grab_mouse = grab; grab_mouse = grab;
if (grab) GUICapture &= ~1;
else GUICapture |= 1;
} }
void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult) void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)

View file

@ -274,7 +274,7 @@ int32_t Anim_Play(const char *fn)
uint16_t soundidx = 0; // custom anim sounds uint16_t soundidx = 0; // custom anim sounds
int32_t running = 1, i; int32_t running = 1, i;
I_ClearAllInput(); inputState.ClearAllInput();
#ifdef USE_LIBVPX #ifdef USE_LIBVPX
uint16_t framenum = 0; uint16_t framenum = 0;
@ -421,13 +421,13 @@ int32_t Anim_Play(const char *fn)
palfadedelta = 0; palfadedelta = 0;
videoShowFrame(0); videoShowFrame(0);
// I_ClearAllInput(); // inputState.ClearAllInput();
do do
{ {
G_HandleAsync(); G_HandleAsync();
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
running = 0; running = 0;
break; break;
@ -441,7 +441,7 @@ int32_t Anim_Play(const char *fn)
animvpx_restore_glstate(); animvpx_restore_glstate();
animvpx_uninit_codec(&codec); animvpx_uninit_codec(&codec);
I_ClearAllInput(); inputState.ClearAllInput();
return !running; // done with playing VP8! return !running; // done with playing VP8!
} }
#endif #endif
@ -514,7 +514,7 @@ int32_t Anim_Play(const char *fn)
TileFiles.tileSetExternal(TILE_ANIM, 200, 320, ANIM_DrawFrame(i)); TileFiles.tileSetExternal(TILE_ANIM, 200, 320, ANIM_DrawFrame(i));
tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228 tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
running = 0; running = 0;
goto end_anim_restore_gl; goto end_anim_restore_gl;
@ -556,7 +556,7 @@ int32_t Anim_Play(const char *fn)
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
ototalclock += anim->framedelay; ototalclock += anim->framedelay;
@ -580,7 +580,7 @@ end_anim_restore_gl:
gltexapplyprops(); gltexapplyprops();
#endif #endif
end_anim: end_anim:
I_ClearAllInput(); inputState.ClearAllInput();
anim->animbuf = nullptr; anim->animbuf = nullptr;
ANIM_FreeAnim(); ANIM_FreeAnim();
tileDelete(TILE_ANIM); tileDelete(TILE_ANIM);

View file

@ -384,7 +384,7 @@ void GameInterface::MenuClosed()
if (gm & MODE_GAME) if (gm & MODE_GAME)
{ {
if (gm & MODE_MENU) 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. // The following lines are here so that you cannot close the menu when no game is running.
gm &= ~MODE_MENU; gm &= ~MODE_MENU;

View file

@ -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(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
@ -527,7 +527,7 @@ RECHECK:
ready2send = 0; ready2send = 0;
bigi = 0; bigi = 0;
I_ClearAllInput(); inputState.ClearAllInput();
// OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt); // OSD_Printf("ticcnt=%d, total=%d\n", g_demo_cnt, g_demo_totalCnt);
while (g_demo_cnt < g_demo_totalCnt || foundemo==0) while (g_demo_cnt < g_demo_totalCnt || foundemo==0)
@ -793,7 +793,7 @@ nextdemo_nomenu:
// draw status // draw status
Demo_DisplayProfStatus(); Demo_DisplayProfStatus();
if (I_GeneralTrigger()) if (inputState.CheckAllInput())
Demo_StopProfiling(); Demo_StopProfiling();
} }
else else
@ -902,7 +902,7 @@ nextdemo_nomenu:
if (VOLUMEONE) 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); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
} }

View file

@ -905,7 +905,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
pub = 0; 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; return;
if (r_usenewaspect) if (r_usenewaspect)
@ -6188,8 +6188,7 @@ void G_HandleLocalKeys(void)
} }
} }
} }
else
if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED && !WIN_IS_PRESSED)
{ {
if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) 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) if (I_EscapeTrigger() && ud.overhead_on && g_player[myconnectindex].ps->newowner == -1)
{ {
I_EscapeTriggerClear(); I_EscapeTriggerClear();
@ -6238,6 +6238,7 @@ void G_HandleLocalKeys(void)
ud.scrollmode = 0; ud.scrollmode = 0;
G_UpdateScreenArea(); G_UpdateScreenArea();
} }
#endif
if (buttonMap.ButtonDown(gamefunc_Map)) if (buttonMap.ButtonDown(gamefunc_Map))
{ {
@ -7518,7 +7519,7 @@ MAIN_LOOP_RESTART:
int const moveClock = (int) totalclock; 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_player[myconnectindex].ps->gm&MODE_GAME))
{ {
G_MoveLoop(); G_MoveLoop();

View file

@ -180,7 +180,7 @@ typedef struct {
char overhead_on,last_overhead,showweapons; char overhead_on,last_overhead,showweapons;
char god,warp_on,cashman,eog,showallmap; char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,noclip; char scrollmode,noclip;
char display_bonus_screen; char display_bonus_screen;
char show_level_text; 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) 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) || (g_netServer || ud.multimode > 1) ||
ud.recstat == 2) || ud.recstat == 2) ||
ud.pause_on) ud.pause_on)

View file

@ -1119,7 +1119,7 @@ void Screen_Play(void)
{ {
int32_t running = 1; int32_t running = 1;
I_ClearAllInput(); inputState.ClearAllInput();
auto r2dover = rotatesprite_2doverride; auto r2dover = rotatesprite_2doverride;
rotatesprite_2doverride = false; rotatesprite_2doverride = false;
@ -1133,11 +1133,11 @@ void Screen_Play(void)
continue; continue;
videoClearScreen(0); videoClearScreen(0);
if (I_CheckAllInput()) if (inputState.CheckAllInput())
running = 0; running = 0;
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
} while (running); } while (running);
rotatesprite_2doverride = r2dover; rotatesprite_2doverride = r2dover;
} }

View file

@ -37,10 +37,6 @@ static FORCE_INLINE int32_t krand2(void)
#define BGSTRETCH (hud_bgstretch ? 1024 : 0) #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) \ #define RANDOMSCRAP(s, i) \
{ \ { \
int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(), r5 = krand2(), r6 = krand2(), r7 = krand2(); \ int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(), r5 = krand2(), r6 = krand2(), r7 = krand2(); \

View file

@ -2956,7 +2956,7 @@ void P_GetInput(int playerNum)
localInput.bits |= (mouseaim << SK_AIMMODE); localInput.bits |= (mouseaim << SK_AIMMODE);
localInput.bits |= (g_gameQuit << SK_GAMEQUIT); localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE; 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) 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; (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_Open) << SK_OPEN;
localInput.bits |= buttonMap.ButtonDown(gamefunc_Inventory) << SK_INVENTORY; 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)) 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; (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_Open) << SK_OPEN;
localInput.bits |= buttonMap.ButtonDown(gamefunc_Inventory) << SK_INVENTORY; 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)) if (buttonMap.ButtonDown(gamefunc_Dpad_Select))
{ {

View file

@ -841,7 +841,6 @@ void P_ResetStatus(int playerNum)
{ {
DukePlayer_t *const pPlayer = g_player[playerNum].ps; DukePlayer_t *const pPlayer = g_player[playerNum].ps;
ud.show_help = 0;
ud.showallmap = 0; ud.showallmap = 0;
pPlayer->dead_flag = 0; pPlayer->dead_flag = 0;
pPlayer->wackedbyactor = -1; pPlayer->wackedbyactor = -1;

View file

@ -54,24 +54,22 @@ int32_t g_noLogo = 0;
////////// OFTEN-USED FEW-LINERS ////////// ////////// OFTEN-USED FEW-LINERS //////////
static void G_HandleEventsWhileNoInput(void) static void G_HandleEventsWhileNoInput(void)
{ {
I_ClearAllInput(); inputState.ClearAllInput();
while (!I_CheckAllInput()) while (!inputState.CheckAllInput())
G_HandleAsync(); G_HandleAsync();
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_ClearAllInput(); inputState.ClearAllInput();
while (S_CheckSoundPlaying(-1, soundnum)) while (S_CheckSoundPlaying(-1, soundnum))
{ {
G_HandleAsync(); G_HandleAsync();
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
return 1; 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; i = pp->cursectnum;
if (i > -1) if (i > -1)
{ {
@ -1096,7 +1063,7 @@ void G_DisplayRest(int32_t smoothratio)
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
if (VOLUMEONE) 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); rotatesprite_fs((320-50)<<16, 9<<16, 65536L, 0, BETAVERSION, 0, 0, 2+8+16+128);
} }
#endif #endif
@ -1216,17 +1183,16 @@ void G_DisplayExtraScreens(void)
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); 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); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3291, 0, 0, 2+8+64+BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3291); fadepaltile(0, 0, 0, 252, 0, -28, 3291);
while (!I_CheckAllInput()) while (!inputState.CheckAllInput())
G_HandleAsync(); G_HandleAsync();
fadepaltile(0, 0, 0, 0, 252, 28, 3291); 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); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3290, 0, 0, 2+8+64+BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, 3290); fadepaltile(0, 0, 0, 252, 0, -28, 3290);
while (!I_CheckAllInput()) while (!inputState.CheckAllInput())
G_HandleAsync(); G_HandleAsync();
#ifdef __ANDROID__ #ifdef __ANDROID__
@ -1244,15 +1210,15 @@ void G_DisplayExtraScreens(void)
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
fadepal(0, 0, 0, 0, 252, 28); fadepal(0, 0, 0, 0, 252, 28);
I_ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TENSCREEN, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, TENSCREEN, 0, 0, 2+8+64+BGSTRETCH);
fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN); fadepaltile(0, 0, 0, 252, 0, -28, TENSCREEN);
while (!I_CheckAllInput() && totalclock < 2400) while (!inputState.CheckAllInput() && totalclock < 2400)
G_HandleAsync(); G_HandleAsync();
fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN);
I_ClearAllInput(); inputState.ClearAllInput();
#ifdef __ANDROID__ #ifdef __ANDROID__
inExtraScreens = 0; inExtraScreens = 0;
#endif #endif
@ -1266,7 +1232,7 @@ void G_DisplayLogo(void)
ready2send = 0; ready2send = 0;
I_ClearAllInput(); inputState.ClearAllInput();
videoSetViewableArea(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
videoClearScreen(0L); videoClearScreen(0L);
@ -1282,12 +1248,12 @@ void G_DisplayLogo(void)
return; return;
if (RR) if (RR)
{ {
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
Anim_Play("rr_intro.anm"); Anim_Play("rr_intro.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1295,12 +1261,12 @@ void G_DisplayLogo(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
Anim_Play("redneck.anm"); Anim_Play("redneck.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1308,12 +1274,12 @@ void G_DisplayLogo(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
Anim_Play("xatlogo.anm"); Anim_Play("xatlogo.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1335,12 +1301,12 @@ void G_DisplayLogo(void)
if (VOLUMEALL) if (VOLUMEALL)
#endif #endif
{ {
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
Anim_Play("logo.anm"); Anim_Play("logo.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
videoClearScreen(0L); videoClearScreen(0L);
@ -1354,7 +1320,7 @@ void G_DisplayLogo(void)
//g_player[myconnectindex].ps->palette = drealms; //g_player[myconnectindex].ps->palette = drealms;
//G_FadePalette(0,0,0,252); //G_FadePalette(0,0,0,252);
if (!I_CheckAllInput() && g_noLogoAnim == 0) if (!inputState.CheckAllInput() && g_noLogoAnim == 0)
{ {
Net_GetPackets(); Net_GetPackets();
@ -1362,7 +1328,7 @@ void G_DisplayLogo(void)
{ {
Anim_Play("3dr.anm"); Anim_Play("3dr.anm");
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
I_ClearAllInput(); inputState.ClearAllInput();
} }
else else
{ {
@ -1376,7 +1342,7 @@ void G_DisplayLogo(void)
fadepaltile(0, 0, 0, 252, 0, -28, DREALMS); fadepaltile(0, 0, 0, 252, 0, -28, DREALMS);
totalclock = 0; totalclock = 0;
while (totalclock < (120 * 7) && !I_CheckAllInput()) while (totalclock < (120 * 7) && !inputState.CheckAllInput())
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
@ -1400,7 +1366,7 @@ void G_DisplayLogo(void)
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
@ -1419,7 +1385,7 @@ void G_DisplayLogo(void)
#ifndef EDUKE32_SIMPLE_MENU #ifndef EDUKE32_SIMPLE_MENU
totalclock < (860+120) && totalclock < (860+120) &&
#endif #endif
!I_CheckAllInput()) !inputState.CheckAllInput())
{ {
if (G_FPSLimit()) if (G_FPSLimit())
{ {
@ -1487,7 +1453,7 @@ void G_DisplayLogo(void)
G_HandleAsync(); G_HandleAsync();
} }
I_ClearAllInput(); inputState.ClearAllInput();
} }
renderFlushPerms(); renderFlushPerms();
@ -1513,14 +1479,12 @@ void G_DoOrderScreen(void)
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {
fadepal(0, 0, 0, 0, 252, 28); 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); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, ORDERING+i, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -28); fadepal(0, 0, 0, 252, 0, -28);
while (!I_CheckAllInput()) while (!inputState.CheckAllInput())
G_HandleAsync(); G_HandleAsync();
} }
I_ClearAllInput();
} }
@ -1541,7 +1505,7 @@ static void G_BonusCutscenes(void)
if (adult_lockout == 0) if (adult_lockout == 0)
{ {
Anim_Play("turdmov.anm"); Anim_Play("turdmov.anm");
I_ClearAllInput(); inputState.ClearAllInput();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
} }
@ -1549,12 +1513,12 @@ static void G_BonusCutscenes(void)
ud.volume_number = 1; ud.volume_number = 1;
ud.eog = 0; ud.eog = 0;
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
I_ClearAllInput(); inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); 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); rotatesprite_fs(0, 0, 65536L, 0, TENSCREEN, 0, 0, 2+8+16+64+128+BGSTRETCH);
videoNextPage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
FX_StopAllSounds(); FX_StopAllSounds();
@ -1566,7 +1530,7 @@ static void G_BonusCutscenes(void)
if (adult_lockout == 0) if (adult_lockout == 0)
{ {
Anim_Play("rr_outro.anm"); Anim_Play("rr_outro.anm");
I_ClearAllInput(); inputState.ClearAllInput();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
} }
@ -1576,12 +1540,12 @@ static void G_BonusCutscenes(void)
ud.volume_number = 0; ud.volume_number = 0;
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
videoSetViewableArea(0, 0, xdim-1, ydim-1); videoSetViewableArea(0, 0, xdim-1, ydim-1);
I_ClearAllInput(); inputState.ClearAllInput();
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8 + 2 + 1); 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); rotatesprite_fs(0, 0, 65536L, 0, TENSCREEN, 0, 0, 2 + 8 + 16 + 64 + 128 + BGSTRETCH);
videoNextPage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
FX_StopAllSounds(); FX_StopAllSounds();
@ -1614,7 +1578,7 @@ static void G_BonusCutscenes(void)
videoNextPage(); videoNextPage();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); inputState.ClearAllInput();
totalclock = 0; totalclock = 0;
while (1) while (1)
@ -1675,13 +1639,13 @@ static void G_BonusCutscenes(void)
G_HandleAsync(); G_HandleAsync();
if (I_CheckAllInput()) break; if (inputState.CheckAllInput()) break;
} }
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
} }
I_ClearAllInput(); inputState.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(160<<16, 100<<16, 65536L, 0, 3292, 0, 0, 2+8+64+BGSTRETCH); 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); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov2.anm"); Anim_Play("cineov2.anm");
I_ClearAllInput(); inputState.ClearAllInput();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
@ -1713,7 +1677,7 @@ static void G_BonusCutscenes(void)
fadepal(0, 0, 0, 0, 252, 4); fadepal(0, 0, 0, 0, 252, 4);
} }
I_ClearAllInput(); inputState.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(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH); rotatesprite_fs(160<<16, 100<<16, 65536L, 0, 3293, 0, 0, 2+8+64+BGSTRETCH);
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1733,7 +1697,7 @@ static void G_BonusCutscenes(void)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
I_ClearAllInput(); inputState.ClearAllInput();
int t = Anim_Play("vol4e1.anm"); int t = Anim_Play("vol4e1.anm");
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
@ -1755,7 +1719,7 @@ static void G_BonusCutscenes(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
S_PlaySound(ENDSEQVOL3SND4); S_PlaySound(ENDSEQVOL3SND4);
I_ClearAllInput(); inputState.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
@ -1770,7 +1734,7 @@ static void G_BonusCutscenes(void)
fadepal(0, 0, 0, 252, 0, -12); fadepal(0, 0, 0, 252, 0, -12);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
fadepal(0, 0, 0, 0, 252, 12); fadepal(0, 0, 0, 0, 252, 12);
@ -1779,7 +1743,7 @@ static void G_BonusCutscenes(void)
Anim_Play("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
videoClearScreen(0L); videoClearScreen(0L);
@ -1788,7 +1752,7 @@ static void G_BonusCutscenes(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
I_ClearAllInput(); inputState.ClearAllInput();
break; break;
@ -1800,7 +1764,7 @@ static void G_BonusCutscenes(void)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov3.anm"); Anim_Play("cineov3.anm");
I_ClearAllInput(); inputState.ClearAllInput();
ototalclock = totalclock+200; ototalclock = totalclock+200;
while (totalclock < ototalclock) while (totalclock < ototalclock)
G_HandleAsync(); G_HandleAsync();
@ -1813,7 +1777,7 @@ static void G_BonusCutscenes(void)
Anim_Play("RADLOGO.ANM"); 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(ENDSEQVOL3SND5)) goto ENDANM;
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM;
@ -1822,15 +1786,11 @@ static void G_BonusCutscenes(void)
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND9)) goto ENDANM;
} }
I_ClearAllInput();
totalclock = 0; totalclock = 0;
if (PLUTOPAK) if (PLUTOPAK)
{ {
while (totalclock < 120 && !I_CheckAllInput()) while (!inputState.CheckAllInput() && totalclock < 120)
G_HandleAsync(); G_HandleAsync();
I_ClearAllInput();
} }
else else
{ {
@ -1849,7 +1809,7 @@ static void G_BonusCutscenes(void)
Anim_Play("DUKETEAM.ANM"); Anim_Play("DUKETEAM.ANM");
I_ClearAllInput(); inputState.ClearAllInput();
G_HandleEventsWhileNoInput(); G_HandleEventsWhileNoInput();
videoClearScreen(0L); videoClearScreen(0L);
@ -1857,7 +1817,7 @@ static void G_BonusCutscenes(void)
G_FadePalette(0, 0, 0, 252); G_FadePalette(0, 0, 0, 252);
} }
I_ClearAllInput(); inputState.ClearAllInput();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
@ -2044,7 +2004,7 @@ void G_BonusScreen(int32_t bonusonly)
S_PlaySound(BONUSMUSIC); S_PlaySound(BONUSMUSIC);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
fadepal(0, 0, 0, 252, 0, RR ? -4 : -28); fadepal(0, 0, 0, 252, 0, RR ? -4 : -28);
totalclock = 0; totalclock = 0;
@ -2059,9 +2019,8 @@ void G_BonusScreen(int32_t bonusonly)
videoNextPage(); videoNextPage();
} }
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
break; break;
} }
} }
@ -2105,7 +2064,7 @@ void G_BonusScreen(int32_t bonusonly)
} }
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
bonuscnt = 0; bonuscnt = 0;
totalclock = 0; totalclock = 0;
@ -2408,12 +2367,10 @@ void G_BonusScreen(int32_t bonusonly)
if (totalclock > 10240 && totalclock < 10240+10240) if (totalclock > 10240 && totalclock < 10240+10240)
totalclock = 1024; totalclock = 1024;
if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809
{ {
I_ClearAllInput();
if (totalclock < (60*13)) if (totalclock < (60*13))
{ {
inputState.keyFlushChars();
totalclock = (60*13); totalclock = (60*13);
} }
else if (totalclock < 1000000000) else if (totalclock < 1000000000)
@ -2626,7 +2583,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
S_PlaySound(BONUSMUSIC); S_PlaySound(BONUSMUSIC);
videoNextPage(); videoNextPage();
I_ClearAllInput(); inputState.ClearAllInput();
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
totalclock = 0; totalclock = 0;
@ -2641,9 +2598,8 @@ void G_BonusScreenRRRA(int32_t bonusonly)
videoNextPage(); videoNextPage();
} }
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
break; break;
} }
} }
@ -2669,7 +2625,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
menutext(15, 192, "Press any key to continue"); menutext(15, 192, "Press any key to continue");
I_ClearAllInput(); inputState.ClearAllInput();
if (!showMap) if (!showMap)
{ {
videoNextPage(); videoNextPage();
@ -2907,13 +2863,10 @@ void G_BonusScreenRRRA(int32_t bonusonly)
if (totalclock > 10240 && totalclock < 10240+10240) if (totalclock > 10240 && totalclock < 10240+10240)
totalclock = 1024; totalclock = 1024;
if (I_CheckAllInput() && totalclock >(60*2)) // JBF 20030809 if (inputState.CheckAllInput() && totalclock >(60*2)) // JBF 20030809
{ {
I_ClearAllInput();
if (totalclock < (60*13)) if (totalclock < (60*13))
{ {
inputState.keyFlushChars();
totalclock = (60*13); totalclock = (60*13);
} }
else if (totalclock < 1000000000) else if (totalclock < 1000000000)
@ -2954,9 +2907,8 @@ void G_BonusScreenRRRA(int32_t bonusonly)
} }
if (!S_CheckSoundPlaying(-1,35)) break; if (!S_CheckSoundPlaying(-1,35)) break;
if (I_CheckAllInput()) if (inputState.CheckAllInput())
{ {
I_ClearAllInput();
S_StopSound(35); S_StopSound(35);
break; break;
} }

View file

@ -4268,9 +4268,6 @@ static int32_t our_neartag_blacklist(int32_t UNUSED(spriteNum))
static void G_ClearCameras(DukePlayer_t *p) static void G_ClearCameras(DukePlayer_t *p)
{ {
G_ClearCameraView(p); G_ClearCameraView(p);
if (I_EscapeTrigger())
I_EscapeTriggerClear();
} }
void P_CheckSectors(int playerNum) void P_CheckSectors(int playerNum)

View file

@ -281,16 +281,9 @@ playanm(short anim_num)
switch (ANIMnum) switch (ANIMnum)
{ {
case ANIM_INTRO: case ANIM_INTRO:
if (I_GeneralTrigger())
{
I_GeneralTriggerClear();
goto ENDOFANIMLOOP;
}
break;
case ANIM_SERP: case ANIM_SERP:
if (I_EscapeTrigger()) if (inputState.CheckAllInput())
{ {
I_EscapeTriggerClear();
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
} }
break; break;

View file

@ -598,7 +598,7 @@ ScenePlayBack(void)
} }
} }
if (KeyPressed()) if (inputState.CheckAllInput())
DemoDone = TRUE; DemoDone = TRUE;
if (DemoDone) if (DemoDone)

View file

@ -1455,11 +1455,6 @@ ResetKeys(void)
} }
SWBOOL KeyPressed(void)
{
return I_GeneralTrigger();
}
uint8_t* KeyPressedRange(uint8_t* kb, uint8_t* ke) uint8_t* KeyPressedRange(uint8_t* kb, uint8_t* ke)
{ {
uint8_t* k; uint8_t* k;
@ -1539,9 +1534,9 @@ void LogoLevel(void)
ototalclock += synctics; ototalclock += synctics;
} }
if (totalclock > 5*120 || I_GeneralTrigger()) if (totalclock > 5*120 || inputState.CheckAllInput())
{ {
I_GeneralTriggerClear(); inputState.ClearAllInput();
break; break;
} }
} }
@ -1658,7 +1653,7 @@ void SybexScreen(void)
videoNextPage(); videoNextPage();
ResetKeys(); ResetKeys();
while (!KeyPressed()) handleevents(); while (!inputState.CheckAllInput()) handleevents();
} }
// CTW REMOVED END // CTW REMOVED END
@ -1713,7 +1708,7 @@ TitleLevel(void)
videoNextPage(); videoNextPage();
if (totalclock > 5*120 || KeyPressed()) if (totalclock > 5*120 || inputState.CheckAllInput())
{ {
DemoMode = TRUE; DemoMode = TRUE;
DemoPlaying = TRUE; DemoPlaying = TRUE;
@ -2154,9 +2149,8 @@ void BonusScreen(PLAYERp pp)
} }
ototalclock += limit; ototalclock += limit;
if (I_GeneralTrigger()) if (inputState.CheckAllInput())
{ {
I_GeneralTriggerClear();
if (State >= s_BonusRest && State < &s_BonusRest[SIZ(s_BonusRest)]) if (State >= s_BonusRest && State < &s_BonusRest[SIZ(s_BonusRest)])
{ {
State = s_BonusAnim[STD_RANDOM_RANGE(SIZ(s_BonusAnim))]; State = s_BonusAnim[STD_RANDOM_RANGE(SIZ(s_BonusAnim))];
@ -2437,13 +2431,7 @@ void StatScreen(PLAYERp mpp)
videoNextPage(); videoNextPage();
if (KeyPressed()) inputState.ClearAllInput();
{
while (KeyPressed()) ;
}
inputState.ClearKeyStatus(KEYSC_SPACE);
inputState.ClearKeyStatus(KEYSC_ENTER);
PlaySong(nullptr, ThemeSongs[1], ThemeTrack[1]); PlaySong(nullptr, ThemeSongs[1], ThemeTrack[1]);

View file

@ -2333,7 +2333,6 @@ void MapSetAll2D(uint8_t fill); // game.c
void TerminateGame(void); // game.c void TerminateGame(void); // game.c
void TerminateLevel(void); // game.c void TerminateLevel(void); // game.c
void ResetKeys(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 drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c
void COVERsetbrightness(int bright, unsigned char *pal); // game.c void COVERsetbrightness(int bright, unsigned char *pal); // game.c
void DrawMenuLevelScreen(void); // game.c void DrawMenuLevelScreen(void); // game.c