From 8151f3864c35e168897c578e0bfa546edfbce969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20R=C3=A1=C4=8Dek?= Date: Thu, 21 Aug 2025 21:26:13 +0200 Subject: [PATCH] Added ways to set/clear the active flag on gameobjects from Lua --- compile_flags.txt | 22 --------------------- output.bin | Bin 433272 -> 433332 bytes src/lua.cpp | 48 +++++++++++++++++++++++++++++++++------------- 3 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 compile_flags.txt diff --git a/compile_flags.txt b/compile_flags.txt deleted file mode 100644 index 624f052..0000000 --- a/compile_flags.txt +++ /dev/null @@ -1,22 +0,0 @@ --I third_party/nugget/psyqo-lua/../third_party/psxlua/src --D LUA_TARGET_PSX --I third_party/nugget/psyqo/../third_party/EASTL/include --I third_party/nugget/psyqo/../third_party/EABase/include/Common --I third_party/nugget/ --ffunction-sections --fdata-sections --fomit-frame-pointer --fno-builtin --fno-strict-aliasing --Wno-attributes --march=mips1 --EL --fno-pic --fno-stack-protector --nostdlib --ffreestanding --g --Os --std=c++20 --fno-exceptions --fno-rtti \ No newline at end of file diff --git a/output.bin b/output.bin index f0d2372bb20ed1ad86df38666ca1d0650552b04d..19705c88b119a99ee28f23ac2cbf4b3853ed470e 100644 GIT binary patch delta 263 zcmeydLu$)TsR=5)2N@X{elRgGY-V6!SToVknlWZ#u66wy5k`h0W(I~W6Brp97#J8G zfU34kU;?ubfZ5CtaiGpE6IdYPU^Xj69ITfOXyyl?ZlIb;AofQHdkTpC3BsNRVtlD%Yh7O;!pKm>%)n4Ffsvtsfq~Hh zsH$QD6PSGf%w~p&19etRV1bB(*{l$8uwFKxnIC|(1); + + L.newTable(); + L.pushNumber(go->position.x.raw()); + L.setField(2, "x"); + L.pushNumber(go->position.y.raw()); + L.setField(2, "y"); + L.pushNumber(go->position.z.raw()); + L.setField(2, "z"); + + return 1; + +} + static int gameobjectSetPosition(psyqo::Lua L) { auto go = L.toUserdata(1); @@ -55,22 +76,17 @@ static int gameobjectSetPosition(psyqo::Lua L) { } - - -static int gameobjectGetPosition(psyqo::Lua L) { - +static int gamobjectGetActive(psyqo::Lua L) { auto go = L.toUserdata(1); - - L.newTable(); - L.pushNumber(go->position.x.raw()); - L.setField(2, "x"); - L.pushNumber(go->position.y.raw()); - L.setField(2, "y"); - L.pushNumber(go->position.z.raw()); - L.setField(2, "z"); - + L.push(go->isActive()); return 1; +} +static int gamobjectSetActive(psyqo::Lua L) { + auto go = L.toUserdata(1); + bool active = L.toBoolean(2); + go->setActive(active); + return 0; } void psxsplash::Lua::Init() { @@ -87,6 +103,12 @@ void psxsplash::Lua::Init() { L.push(gameobjectSetPosition); L.setField(-2, "set_position"); + L.push(gamobjectGetActive); + L.setField(-2, "get_active"); + + L.push(gamobjectSetActive); + L.setField(-2, "set_active"); + L.copy(-1); m_metatableReference = L.ref();