From 9c91dd03da5492c2ec4a8eab2aecdd0b8f2fbca9 Mon Sep 17 00:00:00 2001 From: luigi budd <4997-luigi-budd@users.noreply.git.do.srb2.org> Date: Fri, 27 Jun 2025 21:16:11 +0000 Subject: [PATCH 1/4] port from github ringracers-edit lul --- src/k_menu.h | 2 ++ src/k_menufunc.c | 8 ++++++++ src/menus/options-profiles-edit-1.c | 12 +++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/k_menu.h b/src/k_menu.h index 9fec6b6ba..5567d3825 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1167,6 +1167,8 @@ void M_MapProfileControl(event_t *ev); void M_ProfileTryController(INT32 choice); void M_ProfileControlsConfirm(INT32 choice); +boolean M_ProfileQuitHandle(void); + // video modes menu (resolution) void M_HandleVideoModes(INT32 ch); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 0e3b1385d..9545b79a3 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -932,6 +932,14 @@ void M_ClearMenus(boolean callexitmenufunc) D_StartTitle(); } + // this is not a good place to put this i thinkMore actions + if (optionsmenu.profile) + { + M_ResetOptions(); + optionsmenu.profile = NULL; + } + + M_AbortVirtualKeyboard(); menumessage.active = false; diff --git a/src/menus/options-profiles-edit-1.c b/src/menus/options-profiles-edit-1.c index be805aa36..96d167dcf 100644 --- a/src/menus/options-profiles-edit-1.c +++ b/src/menus/options-profiles-edit-1.c @@ -52,7 +52,7 @@ menu_t OPTIONS_EditProfileDef = { M_DrawOptionsCogs, M_HandleProfileEdit, NULL, - NULL, + M_ProfileQuitHandle, M_ProfileEditInputs, }; @@ -238,3 +238,13 @@ void M_ProfileDeviceSelect(INT32 choice) M_SetupNextMenu(&OPTIONS_ProfileControlsDef, false); // Don't set device here anymore. } + +boolean M_ProfileQuitHandle(void) +{ + if (optionsmenu.profile != NULL) + { + M_ResetOptions(); // Reset all options variables otherwise things are gonna go reaaal bad lol. + optionsmenu.profile = NULL; // Make sure to get rid of that, too. + } + return false; +} \ No newline at end of file From 5d9dcd02430c354791efdb8d812d6a01070003da Mon Sep 17 00:00:00 2001 From: luigi budd <4997-luigi-budd@users.noreply.git.do.srb2.org> Date: Mon, 14 Jul 2025 22:55:22 +0000 Subject: [PATCH 2/4] Properly fix the spb-profile stat grid bug --- src/k_menu.h | 2 -- src/k_menufunc.c | 8 -------- src/menus/options-profiles-edit-1.c | 12 +----------- src/menus/transient/pause-replay.c | 4 ++++ 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/k_menu.h b/src/k_menu.h index 5567d3825..9fec6b6ba 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1167,8 +1167,6 @@ void M_MapProfileControl(event_t *ev); void M_ProfileTryController(INT32 choice); void M_ProfileControlsConfirm(INT32 choice); -boolean M_ProfileQuitHandle(void); - // video modes menu (resolution) void M_HandleVideoModes(INT32 ch); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 9545b79a3..0e3b1385d 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -932,14 +932,6 @@ void M_ClearMenus(boolean callexitmenufunc) D_StartTitle(); } - // this is not a good place to put this i thinkMore actions - if (optionsmenu.profile) - { - M_ResetOptions(); - optionsmenu.profile = NULL; - } - - M_AbortVirtualKeyboard(); menumessage.active = false; diff --git a/src/menus/options-profiles-edit-1.c b/src/menus/options-profiles-edit-1.c index 96d167dcf..be805aa36 100644 --- a/src/menus/options-profiles-edit-1.c +++ b/src/menus/options-profiles-edit-1.c @@ -52,7 +52,7 @@ menu_t OPTIONS_EditProfileDef = { M_DrawOptionsCogs, M_HandleProfileEdit, NULL, - M_ProfileQuitHandle, + NULL, M_ProfileEditInputs, }; @@ -238,13 +238,3 @@ void M_ProfileDeviceSelect(INT32 choice) M_SetupNextMenu(&OPTIONS_ProfileControlsDef, false); // Don't set device here anymore. } - -boolean M_ProfileQuitHandle(void) -{ - if (optionsmenu.profile != NULL) - { - M_ResetOptions(); // Reset all options variables otherwise things are gonna go reaaal bad lol. - optionsmenu.profile = NULL; // Make sure to get rid of that, too. - } - return false; -} \ No newline at end of file diff --git a/src/menus/transient/pause-replay.c b/src/menus/transient/pause-replay.c index 864344d91..f0ea1ca9d 100644 --- a/src/menus/transient/pause-replay.c +++ b/src/menus/transient/pause-replay.c @@ -137,6 +137,10 @@ void M_EndModeAttackRun(void) // Return to the menu. D_ClearState(); M_StartControlPanel(); + // This removes any lingering optionsmenu.profile pointers, + // so that when returning to char select, it will show the normal + // stat grid instead of the profile one (this is also most likely a bad way to fix this) + M_ResetOptions(); } // Replay Playback Menu From b8223197cc0e3e4e56005c75be1088547d138c6b Mon Sep 17 00:00:00 2001 From: Nep2Disk Date: Thu, 24 Jul 2025 12:43:39 +0000 Subject: [PATCH 3/4] Prevent battle monitors getting stuck in pits --- src/p_mobj.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4fe37026e..0d64d971b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2309,6 +2309,14 @@ boolean P_ZMovement(mobj_t *mo) return false; } break; + case MT_MONITOR: + // Prevent battle monitors getting stuck in pits + if (P_CheckDeathPitCollide(mo)) + { + P_RemoveMobj(mo); + return false; + } + break; default: // SRB2kart stuff that should die in pits // Shouldn't stop moving along the Z if there's no speed though! From 979db521bda45919f38296eb0c93ede5211f29c9 Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Wed, 6 Aug 2025 19:11:56 +0200 Subject: [PATCH 4/4] Fix displayplayers.iterate hang when multiple viewports view the same player --- src/lua_playerlib.c | 51 ++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index ee56da06f..a58958e7b 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -97,44 +97,29 @@ static int lib_lenPlayer(lua_State *L) static int lib_iterateDisplayplayers(lua_State *L) { - INT32 i = -1; - INT32 temp = -1; - INT32 iter = 0; + INT32 i = lua_tonumber(L, lua_upvalueindex(1)); if (lua_gettop(L) < 2) - { - //return luaL_error(L, "Don't call displayplayers.iterate() directly, use it as 'for player in displayplayers.iterate do end'."); - lua_pushcfunction(L, lib_iterateDisplayplayers); + { + lua_pushcclosure(L, lib_iterateDisplayplayers, 1); return 1; } - lua_settop(L, 2); - lua_remove(L, 1); // state is unused. - if (!lua_isnil(L, 1)) + + if (i <= r_splitscreen) { - temp = (INT32)(*((player_t **)luaL_checkudata(L, 1, META_PLAYER)) - players); // get the player # of the last iterated player. - - // @FIXME: - // I didn't quite find a better way for this; Here, we go back to which player in displayplayers we last iterated to resume the for loop below for this new function call - // I don't understand enough about how the Lua stacks work to get this to work in possibly a single line. - // So anyone feel free to correct this! - - for (; iter < MAXSPLITSCREENPLAYERS; iter++) - { - if (displayplayers[iter] == temp) - { - i = iter; - break; - } - } - } - - for (i++; i < MAXSPLITSCREENPLAYERS; i++) - { - if (i > r_splitscreen || !playeringame[displayplayers[i]]) - return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers. - + if (!playeringame[displayplayers[i]]) + return 0; + + // Return player and splitscreen index. LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER); - lua_pushinteger(L, i); // push this to recall what number we were on for the next function call. I suppose this also means you can retrieve the splitscreen player number with 'for p, n in displayplayers.iterate'! + lua_pushnumber(L, i); + + // Update splitscreen index value for next iteration. + lua_pushnumber(L, i + 1); + lua_pushvalue(L, -1); + lua_replace(L, lua_upvalueindex(1)); + lua_pop(L, 1); + return 2; } return 0; @@ -160,7 +145,7 @@ static int lib_getDisplayplayers(lua_State *L) field = luaL_checkstring(L, 2); if (fastcmp(field,"iterate")) { - lua_pushcfunction(L, lib_iterateDisplayplayers); + lua_pushcclosure(L, lib_iterateDisplayplayers, 1); return 1; } return 0;