From 0e0b3c1862edf9dd6e227f3eb3be20ec0f43de5a Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:32:05 -0400 Subject: [PATCH] Expose gCurrentArea and gCamera to Lua --- autogen/lua_definitions/manual.lua | 9 +++++++++ data/dynos_warps.cpp | 2 +- src/pc/lua/smlua_cobject.c | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/autogen/lua_definitions/manual.lua b/autogen/lua_definitions/manual.lua index 41142265..ca08ed80 100644 --- a/autogen/lua_definitions/manual.lua +++ b/autogen/lua_definitions/manual.lua @@ -87,6 +87,15 @@ gServerSettings = {} --- Struct containing the settings for Nametags gNametagsSettings = {} +--- @type Area +--- Struct containing the current area +gCurrentArea = {} + +--- @type Camera +--- Struct contaning camera fields +--- - This camera is the same as `gMarioStates[i].area.camera` or `gCurrentArea.camera` +gCamera = {} + ----------- -- hooks -- ----------- diff --git a/data/dynos_warps.cpp b/data/dynos_warps.cpp index f1b3cd6f..f90a8e2d 100644 --- a/data/dynos_warps.cpp +++ b/data/dynos_warps.cpp @@ -393,7 +393,7 @@ static void *DynOS_Warp_UpdateExit(void *aCmd, bool aIsLevelInitDone) { init_camera(gCurrentArea->camera); } sDelayedWarpOp = WARP_OP_NONE; - play_transition(WARP_TRANSITION_FADE_FROM_STAR, 15, 0x00, 0x00, 0x00); + play_transition(WARP_TRANSITION_FADE_FROM_STAR, 0x10, 0x00, 0x00, 0x00); play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource); // Set music diff --git a/src/pc/lua/smlua_cobject.c b/src/pc/lua/smlua_cobject.c index 53aaa930..dfa66837 100644 --- a/src/pc/lua/smlua_cobject.c +++ b/src/pc/lua/smlua_cobject.c @@ -640,6 +640,10 @@ void smlua_cobject_init_globals(void) { EXPOSE_GLOBAL(LOT_SERVERSETTINGS, gServerSettings); EXPOSE_GLOBAL(LOT_NAMETAGSSETTINGS, gNametagsSettings); + + EXPOSE_GLOBAL(LOT_AREA, gCurrentArea); + + EXPOSE_GLOBAL(LOT_CAMERA, gCamera); } void smlua_cobject_init_per_file_globals(const char* path) {