From 69e3722e816fd027af17f9800a136b4eff57de86 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 9 May 2025 15:07:49 +0200 Subject: [PATCH 1/4] Fix controls getting stuck when opening the pause menu https://git.srb2.org/Hanicef/SRB2Classic/-/commit/ed53d96430dedac42b288bd6a5ca8152e6e6acc4 --- src/g_game.c | 3 ++- src/g_input.c | 22 ++++++++++++++++++++++ src/g_input.h | 1 + src/lua_script.c | 5 ++++- src/m_menu.c | 4 +--- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index d1a5a440c..bf1ce0206 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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) { diff --git a/src/g_input.c b/src/g_input.c index f7ea83a75..41c11c204 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -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. // diff --git a/src/g_input.h b/src/g_input.h index b8e4cd8d8..478dae8f1 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -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); diff --git a/src/lua_script.c b/src/lua_script.c index 8d481b95b..799cb101a 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -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); diff --git a/src/m_menu.c b/src/m_menu.c index a87033997..efb56cd9a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -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) { From 5b44c0389256ab9dadc21691aa7fcced9b482c77 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 08:35:52 +0100 Subject: [PATCH 2/4] these should be reset in the loop --- src/k_kart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 96b3cb7b2..3f3048278 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10105,6 +10105,9 @@ static void K_drawNameTags(void) for (i = 0; i < MAXPLAYERS; i++) { + distance = 0; + flipped = false; + if (i > PLAYERSMASK) continue; if (players[i].spectator || !playeringame[i] || P_MobjWasRemoved(players[i].mo)) From bfc34337a30dc519fbfd1b589f165c77d955e5e3 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 10 May 2025 16:54:38 +0300 Subject: [PATCH 3/4] Add P_CheckSightFast into LUASTUFF.md --- LUASTUFF.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LUASTUFF.md b/LUASTUFF.md index 881cbe4f7..8960fad48 100644 --- a/LUASTUFF.md +++ b/LUASTUFF.md @@ -156,6 +156,11 @@ Add Gamepad Rumble support for things. To be used with Displayplayers. Duration is in milliseconds and is optional to set, default value is 84ms. +## P_CheckSightFast(mo1, mo2) + +Exactly same as P_CheckSight but uses cheaper algorithm, useful for things like nametags. Doesn't work exactly +like P_CheckSight so don't use it for anything gameplay-related. + # Other changes ## P_PlayRinglossSound(source, damager) From 679e58202843fa75a4f050f97b5e5ef459303473 Mon Sep 17 00:00:00 2001 From: Indev Date: Sat, 10 May 2025 17:01:14 +0300 Subject: [PATCH 4/4] jin is with lowercase j --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index efb56cd9a..3e8832853 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2595,7 +2595,7 @@ static menuitem_t OP_SaturnCreditsMenu[] = {IT_STRING2+IT_SPACE, NULL, "EXpand", NULL, 117}, {IT_STRING2+IT_SPACE, NULL, "Nexit", NULL, 127}, {IT_STRING2+IT_SPACE, NULL, "Spee", NULL, 137}, - {IT_STRING2+IT_SPACE, NULL, "Jin", NULL, 147}, + {IT_STRING2+IT_SPACE, NULL, "jin", NULL, 147}, {IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 157}, {IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 167}, {IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 177},