From 7d269db4cce527cd820fce9d4b5e6af03390f24f Mon Sep 17 00:00:00 2001 From: Sal Date: Wed, 29 Nov 2023 20:07:54 +0000 Subject: [PATCH] Merge branch 'lua-first-freeslot' into 'master' Lua: add S_FIRSTFREESLOT, MT_FIRSTFREESLOT, SPR_FIRSTFREESLOT See merge request KartKrew/Kart!1667 --- src/deh_lua.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/deh_lua.c b/src/deh_lua.c index 20d85eb78..93241839f 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -417,6 +417,11 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) } else if (fastncmp("S_",word,2)) { p = word+2; + if (fastcmp(p, "FIRSTFREESLOT")) + { + lua_pushinteger(L, S_FIRSTFREESLOT); + return 1; + } for (i = 0; i < NUMSTATEFREESLOTS; i++) { if (!FREE_STATES[i]) break; @@ -434,6 +439,11 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) } else if (fastncmp("MT_",word,3)) { p = word+3; + if (fastcmp(p, "FIRSTFREESLOT")) + { + lua_pushinteger(L, MT_FIRSTFREESLOT); + return 1; + } for (i = 0; i < NUMMOBJFREESLOTS; i++) { if (!FREE_MOBJS[i]) break; @@ -451,6 +461,11 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) } else if (fastncmp("SPR_",word,4)) { p = word+4; + if (fastcmp(p, "FIRSTFREESLOT")) + { + lua_pushinteger(L, SPR_FIRSTFREESLOT); + return 1; + } for (i = 0; i < NUMSPRITES; i++) if (!sprnames[i][4] && fastncmp(p,sprnames[i],4)) { // updating overridden sprnames is not implemented for soc parser,