From 70928120c26b38f8bba06bcacfd753b78fbab7dd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Aug 2023 12:45:58 +0100 Subject: [PATCH 1/3] allow use of P_IsFlagAtBase in HUD code, since it doesn't actually modify anything --- src/lua_baselib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index bf3fd1dec..915669bb2 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2456,7 +2456,7 @@ static int lib_pFadeLight(lua_State *L) static int lib_pIsFlagAtBase(lua_State *L) { mobjtype_t flag = luaL_checkinteger(L, 1); - NOHUD + //HUDSAFE INLEVEL if (flag >= NUMMOBJTYPES) return luaL_error(L, "mobj type %d out of range (0 - %d)", flag, NUMMOBJTYPES-1); From d91d9bf7fca33682eee1231f0d1d918ce3d1ff94 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Aug 2023 12:57:03 +0100 Subject: [PATCH 2/3] add redflag, blueflag, rflagpoint and bflagpoint to Lua --- src/lua_script.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lua_script.c b/src/lua_script.c index a8263ea5f..6a23c23bd 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -225,6 +225,18 @@ int LUA_PushGlobals(lua_State *L, const char *word) } else if (fastcmp(word,"pointlimit")) { lua_pushinteger(L, cv_pointlimit.value); return 1; + } else if (fastcmp(word, "redflag")) { + LUA_PushUserdata(L, redflag, META_MOBJ); + return 1; + } else if (fastcmp(word, "blueflag")) { + LUA_PushUserdata(L, blueflag, META_MOBJ); + return 1; + } else if (fastcmp(word, "rflagpoint")) { + LUA_PushUserdata(L, rflagpoint, META_MAPTHING); + return 1; + } else if (fastcmp(word, "bflagpoint")) { + LUA_PushUserdata(L, bflagpoint, META_MAPTHING); + return 1; // begin map vars } else if (fastcmp(word,"spstage_start")) { lua_pushinteger(L, spstage_start); From e8256e2b43561254101fb66b2e99703b8b4a4a85 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Aug 2023 13:17:52 +0100 Subject: [PATCH 3/3] allow archiving/unarchiving of skin_t userdata in netgames --- src/lua_script.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lua_script.c b/src/lua_script.c index 6a23c23bd..6a5982006 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -989,6 +989,7 @@ enum ARCH_MAPHEADER, ARCH_SKINCOLOR, ARCH_MOUSE, + ARCH_SKIN, ARCH_TEND=0xFF, }; @@ -1017,6 +1018,7 @@ static const struct { {META_MAPHEADER, ARCH_MAPHEADER}, {META_SKINCOLOR, ARCH_SKINCOLOR}, {META_MOUSE, ARCH_MOUSE}, + {META_SKIN, ARCH_SKIN}, {NULL, ARCH_NULL} }; @@ -1338,6 +1340,13 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) WRITEUINT8(save_p, m == &mouse ? 1 : 2); break; } + case ARCH_SKIN: + { + skin_t *skin = *((skin_t **)lua_touserdata(gL, myindex)); + WRITEUINT8(save_p, ARCH_SKIN); + WRITEUINT8(save_p, skin - skins); // UINT8 because MAXSKINS is only 32 + break; + } default: WRITEUINT8(save_p, ARCH_NULL); return 2; @@ -1584,6 +1593,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX) case ARCH_MOUSE: LUA_PushUserdata(gL, READUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE); break; + case ARCH_SKIN: + LUA_PushUserdata(gL, &skins[READUINT8(save_p)], META_SKIN); + break; case ARCH_TEND: return 1; }