From ed46dd08a6a2ae85f7eebc9d15cb5c2c024e0e96 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 7 May 2023 17:33:12 +0200 Subject: [PATCH 1/2] Prevent tmthing crash with P_SpawnParaloop in Lua --- src/lua_baselib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 6e258c82a9..db06d53dd9 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -874,6 +874,7 @@ static int lib_pGetClosestAxis(lua_State *L) static int lib_pSpawnParaloop(lua_State *L) { + mobj_t *ptmthing = tmthing; fixed_t x = luaL_checkfixed(L, 1); fixed_t y = luaL_checkfixed(L, 2); fixed_t z = luaL_checkfixed(L, 3); @@ -890,6 +891,7 @@ static int lib_pSpawnParaloop(lua_State *L) if (nstate >= NUMSTATES) return luaL_error(L, "state %d out of range (0 - %d)", nstate, NUMSTATES-1); P_SpawnParaloop(x, y, z, radius, number, type, nstate, rotangle, spawncenter); + P_SetTarget(&tmthing, ptmthing); return 0; } From b99ecde7b85ae78482762f0e73162b817e7edcfd Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 7 May 2023 17:42:39 +0200 Subject: [PATCH 2/2] Fix [BOT] indicator color not being cleared --- src/lua_baselib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index db06d53dd9..6f5b46e302 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3589,14 +3589,14 @@ static int lib_gAddPlayer(lua_State *L) char joinmsg[256]; // Truncate bot name - player_names[newplayernum][sizeof(*player_names) - 7] = '\0'; // The length of colored [BOT] + 1 + player_names[newplayernum][sizeof(*player_names) - 8] = '\0'; // The length of colored [BOT] + 1 strcpy(joinmsg, M_GetText("\x82*Bot %s has joined the game (player %d)")); strcpy(joinmsg, va(joinmsg, player_names[newplayernum], newplayernum)); HU_AddChatText(joinmsg, false); // Append blue [BOT] tag at the end - strlcat(player_names[newplayernum], "\x84[BOT]", sizeof(*player_names)); + strlcat(player_names[newplayernum], "\x84[BOT]\x80", sizeof(*player_names)); } LUA_PushUserdata(L, newplayer, META_PLAYER);