Expose gCurrentArea and gCamera to Lua

This commit is contained in:
Agent X 2024-06-10 11:32:05 -04:00
parent 2506c1e64d
commit 0e0b3c1862
3 changed files with 14 additions and 1 deletions

View file

@ -87,6 +87,15 @@ gServerSettings = {}
--- Struct containing the settings for Nametags --- Struct containing the settings for Nametags
gNametagsSettings = {} 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 -- -- hooks --
----------- -----------

View file

@ -393,7 +393,7 @@ static void *DynOS_Warp_UpdateExit(void *aCmd, bool aIsLevelInitDone) {
init_camera(gCurrentArea->camera); init_camera(gCurrentArea->camera);
} }
sDelayedWarpOp = WARP_OP_NONE; 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); play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource);
// Set music // Set music

View file

@ -640,6 +640,10 @@ void smlua_cobject_init_globals(void) {
EXPOSE_GLOBAL(LOT_SERVERSETTINGS, gServerSettings); EXPOSE_GLOBAL(LOT_SERVERSETTINGS, gServerSettings);
EXPOSE_GLOBAL(LOT_NAMETAGSSETTINGS, gNametagsSettings); 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) { void smlua_cobject_init_per_file_globals(const char* path) {