diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 3a88390ec..0d5bb1428 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -31,6 +31,7 @@ in_files = [ "src/pc/lua/utils/smlua_audio_utils.h", "src/game/paintings.h", "src/pc/djui/djui_types.h", + "src/game/level_update.h", "src/game/first_person_cam.h", "src/game/player_palette.h", "src/engine/graph_node.h", @@ -155,6 +156,7 @@ override_field_version_excludes = { override_allowed_structs = { "src/pc/network/network.h": [ "ServerSettings", "NametagsSettings" ], "src/pc/djui/djui_types.h": [ "DjuiColor" ], + "src/game/level_update.h": [ "HudDisplay" ], "src/game/player_palette.h": [ "PlayerPalette" ], "src/game/ingame_menu.h" : [ "DialogEntry" ], "include/PR/gbi.h": [ "Gfx", "Vtx" ], diff --git a/autogen/lua_definitions/manual.lua b/autogen/lua_definitions/manual.lua index 2ce161f8a..9339a9886 100644 --- a/autogen/lua_definitions/manual.lua +++ b/autogen/lua_definitions/manual.lua @@ -97,6 +97,10 @@ gServerSettings = {} --- Struct containing the settings for Nametags gNametagsSettings = {} +--- @type HudDisplay +--- Struct containing the flags for the hud display +gHudDisplay = {} + ----------- -- hooks -- ----------- @@ -407,13 +411,13 @@ end --- @param command string --- @vararg integer | string | Gfx | Texture | Vtx Parameters for the command --- Sets a display list command on the display list given. ---- +--- --- If `command` includes parameter specifiers (subsequences beginning with `%`), the additional arguments --- following `command` are converted and inserted in `command` replacing their respective specifiers. ---- +--- --- The number of provided parameters must be equal to the number of specifiers in `command`, --- and the order of parameters must be the same as the specifiers. ---- +--- --- The following specifiers are allowed: --- - `%i` for an `integer` parameter --- - `%s` for a `string` parameter diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 5441e7424..7b5a14828 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -955,6 +955,15 @@ --- @field public translation Vec3s --- @field public rotation Vec3s +--- @class HudDisplay +--- @field public lives integer +--- @field public coins integer +--- @field public stars integer +--- @field public wedges integer +--- @field public keys integer +--- @field public flags integer +--- @field public timer integer + --- @class InstantWarp --- @field public id integer --- @field public area integer diff --git a/docs/lua/globals.md b/docs/lua/globals.md index 20bfacbd1..5819e54f0 100644 --- a/docs/lua/globals.md +++ b/docs/lua/globals.md @@ -102,6 +102,13 @@ __**NOTE**__: The fields in this struct are not synced and are meant to be chang
+## [gHudDisplay](#gHudDisplay) +`gHudDisplay`'s fields are listed in [HudDisplay](structs.md#HudDisplay). + +[:arrow_up_small:](#) + +
+ ## [gLevelValues](#gLevelValues) `gLevelValues`'s fields are listed in [LevelValues](structs.md#LevelValues). diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 79c6d19ff..b31d0dd22 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -53,6 +53,7 @@ - [GraphNodeSwitchCase](#GraphNodeSwitchCase) - [GraphNodeTranslation](#GraphNodeTranslation) - [GraphNodeTranslationRotation](#GraphNodeTranslationRotation) +- [HudDisplay](#HudDisplay) - [InstantWarp](#InstantWarp) - [LakituState](#LakituState) - [LevelValues](#LevelValues) @@ -1426,6 +1427,22 @@
+## [HudDisplay](#HudDisplay) + +| Field | Type | Access | +| ----- | ---- | ------ | +| lives | `integer` | | +| coins | `integer` | | +| stars | `integer` | | +| wedges | `integer` | | +| keys | `integer` | | +| flags | `integer` | | +| timer | `integer` | | + +[:arrow_up_small:](#) + +
+ ## [InstantWarp](#InstantWarp) | Field | Type | Access | diff --git a/src/game/behaviors/door.inc.c b/src/game/behaviors/door.inc.c index 237d63eaf..0e29f9b47 100644 --- a/src/game/behaviors/door.inc.c +++ b/src/game/behaviors/door.inc.c @@ -72,7 +72,7 @@ void play_warp_door_open_noise(void) { void bhv_door_loop(void) { s32 sp1C = 0; - + if (o->oAction != 100) { while (D_8032F300[sp1C].flag != (u32)~0) { if (cur_obj_clear_interact_status_flag(D_8032F300[sp1C].flag)) { diff --git a/src/pc/lua/smlua_cobject.c b/src/pc/lua/smlua_cobject.c index 83f3e1542..10c56da8f 100644 --- a/src/pc/lua/smlua_cobject.c +++ b/src/pc/lua/smlua_cobject.c @@ -785,6 +785,8 @@ void smlua_cobject_init_globals(void) { EXPOSE_GLOBAL(LOT_SERVERSETTINGS, gServerSettings); EXPOSE_GLOBAL(LOT_NAMETAGSSETTINGS, gNametagsSettings); + + EXPOSE_GLOBAL(LOT_HUDDISPLAY, gHudDisplay); } void smlua_cobject_init_per_file_globals(const char* path) { diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 35a3ce52d..f4b02d6e9 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -25,6 +25,7 @@ #include "src/pc/lua/utils/smlua_audio_utils.h" #include "src/game/paintings.h" #include "src/pc/djui/djui_types.h" +#include "src/game/level_update.h" #include "src/game/first_person_cam.h" #include "src/game/player_palette.h" #include "src/engine/graph_node.h" @@ -1228,6 +1229,17 @@ static struct LuaObjectField sGraphNodeTranslationRotationFields[LUA_GRAPH_NODE_ { "translation", LVT_COBJECT, offsetof(struct GraphNodeTranslationRotation, translation), true, LOT_VEC3S, 1, sizeof(Vec3s) }, }; +#define LUA_HUD_DISPLAY_FIELD_COUNT 7 +static struct LuaObjectField sHudDisplayFields[LUA_HUD_DISPLAY_FIELD_COUNT] = { + { "coins", LVT_S16, offsetof(struct HudDisplay, coins), false, LOT_NONE, 1, sizeof(s16) }, + { "flags", LVT_S16, offsetof(struct HudDisplay, flags), false, LOT_NONE, 1, sizeof(s16) }, + { "keys", LVT_S16, offsetof(struct HudDisplay, keys), false, LOT_NONE, 1, sizeof(s16) }, + { "lives", LVT_S16, offsetof(struct HudDisplay, lives), false, LOT_NONE, 1, sizeof(s16) }, + { "stars", LVT_S16, offsetof(struct HudDisplay, stars), false, LOT_NONE, 1, sizeof(s16) }, + { "timer", LVT_U16, offsetof(struct HudDisplay, timer), false, LOT_NONE, 1, sizeof(u16) }, + { "wedges", LVT_S16, offsetof(struct HudDisplay, wedges), false, LOT_NONE, 1, sizeof(s16) }, +}; + #define LUA_INSTANT_WARP_FIELD_COUNT 3 static struct LuaObjectField sInstantWarpFields[LUA_INSTANT_WARP_FIELD_COUNT] = { { "area", LVT_U8, offsetof(struct InstantWarp, area), false, LOT_NONE, 1, sizeof(u8) }, @@ -2724,6 +2736,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] { LOT_GRAPHNODESWITCHCASE, sGraphNodeSwitchCaseFields, LUA_GRAPH_NODE_SWITCH_CASE_FIELD_COUNT }, { LOT_GRAPHNODETRANSLATION, sGraphNodeTranslationFields, LUA_GRAPH_NODE_TRANSLATION_FIELD_COUNT }, { LOT_GRAPHNODETRANSLATIONROTATION, sGraphNodeTranslationRotationFields, LUA_GRAPH_NODE_TRANSLATION_ROTATION_FIELD_COUNT }, + { LOT_HUDDISPLAY, sHudDisplayFields, LUA_HUD_DISPLAY_FIELD_COUNT }, { LOT_INSTANTWARP, sInstantWarpFields, LUA_INSTANT_WARP_FIELD_COUNT }, { LOT_LAKITUSTATE, sLakituStateFields, LUA_LAKITU_STATE_FIELD_COUNT }, { LOT_LEVELVALUES, sLevelValuesFields, LUA_LEVEL_VALUES_FIELD_COUNT }, @@ -2829,6 +2842,7 @@ const char *sLuaLotNames[] = { [LOT_GRAPHNODESWITCHCASE] = "GraphNodeSwitchCase", [LOT_GRAPHNODETRANSLATION] = "GraphNodeTranslation", [LOT_GRAPHNODETRANSLATIONROTATION] = "GraphNodeTranslationRotation", + [LOT_HUDDISPLAY] = "HudDisplay", [LOT_INSTANTWARP] = "InstantWarp", [LOT_LAKITUSTATE] = "LakituState", [LOT_LEVELVALUES] = "LevelValues", diff --git a/src/pc/lua/smlua_cobject_autogen.h b/src/pc/lua/smlua_cobject_autogen.h index d034ce9f7..a053ea8ca 100644 --- a/src/pc/lua/smlua_cobject_autogen.h +++ b/src/pc/lua/smlua_cobject_autogen.h @@ -74,6 +74,7 @@ enum LuaObjectAutogenType { LOT_GRAPHNODESWITCHCASE, LOT_GRAPHNODETRANSLATION, LOT_GRAPHNODETRANSLATIONROTATION, + LOT_HUDDISPLAY, LOT_INSTANTWARP, LOT_LAKITUSTATE, LOT_LEVELVALUES,