Merge branch 'fix-wipe-key-repeat' into 'master'

Reset all gamekeydown arrays for all devices

Closes #513

See merge request KartKrew/Kart!1825
This commit is contained in:
Eidolon 2024-01-12 17:45:26 +00:00
commit 0e30dcc38e
7 changed files with 20 additions and 6 deletions

View file

@ -1082,7 +1082,7 @@ void D_ClearState(void)
paused = false; paused = false;
// clear cmd building stuff // clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown)); G_ResetAllDeviceGameKeyDown();
G_ResetAllDeviceResponding(); G_ResetAllDeviceResponding();
// Reset the palette // Reset the palette

View file

@ -497,7 +497,7 @@ void F_RunWipe(UINT8 wipemode, UINT8 wipetype, boolean drawMenu, const char *col
// FIXME: Wipes SUCK and drop input events for some reason, causing stuck gamepad inputs. // FIXME: Wipes SUCK and drop input events for some reason, causing stuck gamepad inputs.
// It's better to ignore an intentional hold than to turn a tap into a phantom hold. // It's better to ignore an intentional hold than to turn a tap into a phantom hold.
// (If you're removing this, remove the one after the inner loop too!) // (If you're removing this, remove the one after the inner loop too!)
memset(gamekeydown, 0, sizeof(gamekeydown)); G_ResetAllDeviceGameKeyDown();
// lastwipetic should either be 0 or the tic we last wiped // lastwipetic should either be 0 or the tic we last wiped
// on for fade-to-black // on for fade-to-black
@ -589,7 +589,7 @@ void F_RunWipe(UINT8 wipemode, UINT8 wipetype, boolean drawMenu, const char *col
// FIXME: Wipes SUCK and drop input events for some reason, causing stuck gamepad inputs. // FIXME: Wipes SUCK and drop input events for some reason, causing stuck gamepad inputs.
// It's better to ignore an intentional hold than to turn a tap into a phantom hold. // It's better to ignore an intentional hold than to turn a tap into a phantom hold.
// (If you're removing this, remove the one before the inner loop too!) // (If you're removing this, remove the one before the inner loop too!)
memset(gamekeydown, 0, sizeof(gamekeydown)); G_ResetAllDeviceGameKeyDown();
if (fcolor) if (fcolor)
{ {

View file

@ -1181,7 +1181,7 @@ void G_DoLoadLevelEx(boolean resetplayer, gamestate_t newstate)
} }
// clear cmd building stuff // clear cmd building stuff
memset(gamekeydown, 0, sizeof (gamekeydown)); G_ResetAllDeviceGameKeyDown();
G_ResetAllDeviceResponding(); G_ResetAllDeviceResponding();
// clear hud messages remains (usually from game startup) // clear hud messages remains (usually from game startup)

View file

@ -249,6 +249,19 @@ INT32* G_GetDeviceGameKeyDownArray(INT32 device)
return NULL; return NULL;
} }
void G_ResetAllDeviceGameKeyDown(void)
{
int i;
memset(gamekeydown, 0, sizeof(gamekeydown));
memset(g_gamekeydown_device0, 0, sizeof(g_gamekeydown_device0));
for (i = 0; i < g_available_gamepad_devices; i++)
{
memset(g_gamepad_gamekeydown[i], 0, sizeof(INT32) * NUMINPUTS);
}
}
boolean G_IsDeviceResponding(INT32 device) boolean G_IsDeviceResponding(INT32 device)
{ {
int i; int i;

View file

@ -167,6 +167,7 @@ void G_ResetAllDeviceRumbles(void);
/// Get the gamekeydown array (NUMINPUTS values) for the given device, or NULL if the device id is invalid. /// Get the gamekeydown array (NUMINPUTS values) for the given device, or NULL if the device id is invalid.
INT32* G_GetDeviceGameKeyDownArray(INT32 device); INT32* G_GetDeviceGameKeyDownArray(INT32 device);
void G_ResetAllDeviceGameKeyDown(void);
boolean G_IsDeviceResponding(INT32 device); boolean G_IsDeviceResponding(INT32 device);
void G_SetDeviceResponding(INT32 device, boolean responding); void G_SetDeviceResponding(INT32 device, boolean responding);

View file

@ -598,7 +598,7 @@ void M_StartControlPanel(void)
{ {
INT32 i; INT32 i;
memset(gamekeydown, 0, sizeof (gamekeydown)); G_ResetAllDeviceGameKeyDown();
memset(menucmd, 0, sizeof (menucmd)); memset(menucmd, 0, sizeof (menucmd));
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{ {

View file

@ -547,7 +547,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
{ {
SDLforceUngrabMouse(); SDLforceUngrabMouse();
} }
memset(gamekeydown, 0, sizeof(gamekeydown)); // TODO this is a scary memset G_ResetAllDeviceGameKeyDown();
G_ResetAllDeviceResponding(); G_ResetAllDeviceResponding();
if (MOUSE_MENU) if (MOUSE_MENU)