Fix controls getting stuck when opening the pause menu

https://git.srb2.org/Hanicef/SRB2Classic/-/commit/ed53d96430dedac42b288bd6a5ca8152e6e6acc4
This commit is contained in:
Alug committed 2025-05-09 15:17:30 +02:00
1 parent 2fbc1140c4
commit 69e3722e81
5 files changed
+30 -5

No files matched your search

+2 -1
View File
@@ -1471,7 +1471,8 @@ boolean G_Responder(event_t *ev)
}
// update keys current state
G_MapEventsToControls(ev);
if (!menuactive)
G_MapEventsToControls(ev);
switch (ev->type)
{
+22
View File
@@ -20,6 +20,8 @@
#include "d_net.h"
#include "console.h"
#include "m_menu.h"
#include "i_system.h"
#include "i_video.h"
#include "r_draw.h"
@@ -261,6 +263,26 @@ void G_MapEventsToControls(event_t *ev)
}
}
void G_ResetControls(void)
{
memset(gamekeydown, 0, NUMINPUTS);
memset(joyxmove, 0, sizeof(joyxmove));
memset(joyymove, 0, sizeof(joyymove));
memset(joy2xmove, 0, sizeof(joy2xmove));
memset(joy2ymove, 0, sizeof(joy2ymove));
memset(joy3xmove, 0, sizeof(joy3xmove));
memset(joy3ymove, 0, sizeof(joy3ymove));
memset(joy4xmove, 0, sizeof(joy4xmove));
memset(joy4ymove, 0, sizeof(joy4ymove));
// reset those just in case the game missed the keyup event
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
}
//
// General double-click detection routine for any kind of input.
//
+1
View File
@@ -138,6 +138,7 @@ void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_stre
// remaps the input event to a game control.
void G_MapEventsToControls(event_t *ev);
void G_ResetControls(void);
// returns the name of a key
const char *G_KeynumToString(INT32 keynum);
+4 -1
View File
@@ -861,7 +861,8 @@ static void ArchiveExtVars(UINT8 **p, void *pointer, const char *ptype)
int TABLESINDEX;
UINT16 i;
if (!gL) {
if (!gL)
{
if (fastcmp(ptype,"player")) // players must always be included, even if no vars
WRITEUINT16(*p, 0);
return;
@@ -898,8 +899,10 @@ static void ArchiveExtVars(UINT8 **p, void *pointer, const char *ptype)
if (fastcmp(ptype,"mobj")) // mobjs must write their mobjnum as a header
WRITEUINT32(*p, ((mobj_t *)pointer)->mobjnum);
WRITEUINT16(*p, i);
lua_pushnil(gL);
while (lua_next(gL, -2))
{
I_Assert(lua_type(gL, -2) == LUA_TSTRING);
+1 -3
View File
@@ -4556,9 +4556,7 @@ void M_StartControlPanel(void)
}
menuactive = true;
// reset those just in case the game missed the keyup event
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
G_ResetControls();
if (demo.playback)
{