Expose gHudDisplay

This commit is contained in:
EmeraldLockdown 2026-03-21 10:16:54 -05:00
parent e645aa7cef
commit 7d171b82d8
9 changed files with 165 additions and 4 deletions

View file

@ -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",

View file

@ -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

View file

@ -515,6 +515,13 @@
--- @field public buttonPressed integer
--- @field public buttonReleased integer
--- @class CreditsEntry
--- @field public levelNum integer
--- @field public areaIndex integer
--- @field public unk02 integer
--- @field public marioAngle integer
--- @field public marioPos Vec3s
--- @class CustomLevelInfo
--- @field public script Pointer_LevelScript
--- @field public scriptEntryName string
@ -955,6 +962,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
@ -2152,6 +2168,14 @@
--- @field public zoomedOutHeight integer
--- @field public modsOnly integer
--- @class SavedWarpValues
--- @field public received integer
--- @field public warpDest WarpDest
--- @field public inWarpCheckpoint integer
--- @field public ttcSpeedSetting integer
--- @field public D_80339EE0 integer
--- @field public paintingMarioYEntry number
--- @class ServerSettings
--- @field public playerInteractions PlayerInteractions
--- @field public bouncyLevelBounds BouncyLevelBounds
@ -2284,6 +2308,13 @@
--- @field public normalAddition Vec3f
--- @field public normalCount integer
--- @class WarpDest
--- @field public type integer
--- @field public levelNum integer
--- @field public areaIdx integer
--- @field public nodeId integer
--- @field public arg integer
--- @class WarpNode
--- @field public id integer
--- @field public destLevel integer

View file

@ -102,6 +102,13 @@ __**NOTE**__: The fields in this struct are not synced and are meant to be chang
<br />
## [gHudDisplay](#gHudDisplay)
`gHudDisplay`'s fields are listed in [HudDisplay](structs.md#HudDisplay).
[:arrow_up_small:](#)
<br />
## [gLevelValues](#gLevelValues)
`gLevelValues`'s fields are listed in [LevelValues](structs.md#LevelValues).

View file

@ -12,6 +12,7 @@
- [Character](#Character)
- [Color](#Color)
- [Controller](#Controller)
- [CreditsEntry](#CreditsEntry)
- [CustomLevelInfo](#CustomLevelInfo)
- [DateTime](#DateTime)
- [DialogEntry](#DialogEntry)
@ -53,6 +54,7 @@
- [GraphNodeSwitchCase](#GraphNodeSwitchCase)
- [GraphNodeTranslation](#GraphNodeTranslation)
- [GraphNodeTranslationRotation](#GraphNodeTranslationRotation)
- [HudDisplay](#HudDisplay)
- [InstantWarp](#InstantWarp)
- [LakituState](#LakituState)
- [LevelValues](#LevelValues)
@ -76,6 +78,7 @@
- [PlayerPalette](#PlayerPalette)
- [RayIntersectionInfo](#RayIntersectionInfo)
- [RomhackCameraSettings](#RomhackCameraSettings)
- [SavedWarpValues](#SavedWarpValues)
- [ServerSettings](#ServerSettings)
- [SpawnInfo](#SpawnInfo)
- [SpawnParticlesInfo](#SpawnParticlesInfo)
@ -95,6 +98,7 @@
- [Vec4s](#Vec4s)
- [Vtx](#Vtx)
- [WallCollisionData](#WallCollisionData)
- [WarpDest](#WarpDest)
- [WarpNode](#WarpNode)
- [WaterDropletParams](#WaterDropletParams)
- [Waypoint](#Waypoint)
@ -699,6 +703,20 @@
<br />
## [CreditsEntry](#CreditsEntry)
| Field | Type | Access |
| ----- | ---- | ------ |
| levelNum | `integer` | |
| areaIndex | `integer` | |
| unk02 | `integer` | |
| marioAngle | `integer` | |
| marioPos | [Vec3s](structs.md#Vec3s) | read-only |
[:arrow_up_small:](#)
<br />
## [CustomLevelInfo](#CustomLevelInfo)
| Field | Type | Access |
@ -1426,6 +1444,22 @@
<br />
## [HudDisplay](#HudDisplay)
| Field | Type | Access |
| ----- | ---- | ------ |
| lives | `integer` | |
| coins | `integer` | |
| stars | `integer` | |
| wedges | `integer` | |
| keys | `integer` | |
| flags | `integer` | |
| timer | `integer` | |
[:arrow_up_small:](#)
<br />
## [InstantWarp](#InstantWarp)
| Field | Type | Access |
@ -2817,6 +2851,21 @@
<br />
## [SavedWarpValues](#SavedWarpValues)
| Field | Type | Access |
| ----- | ---- | ------ |
| received | `integer` | |
| warpDest | [WarpDest](structs.md#WarpDest) | read-only |
| inWarpCheckpoint | `integer` | |
| ttcSpeedSetting | `integer` | |
| D_80339EE0 | `integer` | |
| paintingMarioYEntry | `number` | |
[:arrow_up_small:](#)
<br />
## [ServerSettings](#ServerSettings)
| Field | Type | Access |
@ -3127,6 +3176,20 @@
<br />
## [WarpDest](#WarpDest)
| Field | Type | Access |
| ----- | ---- | ------ |
| type | `integer` | |
| levelNum | `integer` | |
| areaIdx | `integer` | |
| nodeId | `integer` | |
| arg | `integer` | |
[:arrow_up_small:](#)
<br />
## [WarpNode](#WarpNode)
| Field | Type | Access |

View file

@ -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)) {

View file

@ -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) {

View file

@ -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"
@ -701,6 +702,16 @@ static struct LuaObjectField sControllerFields[LUA_CONTROLLER_FIELD_COUNT] = {
{ "stickY", LVT_F32, offsetof(struct Controller, stickY), false, LOT_NONE, 1, sizeof(f32) },
};
#define LUA_CREDITS_ENTRY_FIELD_COUNT 5
static struct LuaObjectField sCreditsEntryFields[LUA_CREDITS_ENTRY_FIELD_COUNT] = {
{ "areaIndex", LVT_U8, offsetof(struct CreditsEntry, areaIndex), false, LOT_NONE, 1, sizeof(u8) },
{ "levelNum", LVT_U8, offsetof(struct CreditsEntry, levelNum), false, LOT_NONE, 1, sizeof(u8) },
{ "marioAngle", LVT_S8, offsetof(struct CreditsEntry, marioAngle), false, LOT_NONE, 1, sizeof(s8) },
{ "marioPos", LVT_COBJECT, offsetof(struct CreditsEntry, marioPos), true, LOT_VEC3S, 1, sizeof(Vec3s) },
{ "unk02", LVT_U8, offsetof(struct CreditsEntry, unk02), false, LOT_NONE, 1, sizeof(u8) },
// { "unk0C", LVT_???, offsetof(struct CreditsEntry, unk0C), true, LOT_???, 1, sizeof(const char **) }, <--- UNIMPLEMENTED
};
#define LUA_CUSTOM_LEVEL_INFO_FIELD_COUNT 12
static struct LuaObjectField sCustomLevelInfoFields[LUA_CUSTOM_LEVEL_INFO_FIELD_COUNT] = {
{ "acousticReach", LVT_U32, offsetof(struct CustomLevelInfo, acousticReach), false, LOT_NONE, 1, sizeof(u32) },
@ -1228,6 +1239,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) },
@ -2484,6 +2506,16 @@ static struct LuaObjectField sRomhackCameraSettingsFields[LUA_ROMHACK_CAMERA_SET
{ "zoomedOutHeight", LVT_U32, offsetof(struct RomhackCameraSettings, zoomedOutHeight), false, LOT_NONE, 1, sizeof(u32) },
};
#define LUA_SAVED_WARP_VALUES_FIELD_COUNT 6
static struct LuaObjectField sSavedWarpValuesFields[LUA_SAVED_WARP_VALUES_FIELD_COUNT] = {
{ "D_80339EE0", LVT_S16, offsetof(struct SavedWarpValues, D_80339EE0), false, LOT_NONE, 1, sizeof(s16) },
{ "inWarpCheckpoint", LVT_S8, offsetof(struct SavedWarpValues, inWarpCheckpoint), false, LOT_NONE, 1, sizeof(s8) },
{ "paintingMarioYEntry", LVT_F32, offsetof(struct SavedWarpValues, paintingMarioYEntry), false, LOT_NONE, 1, sizeof(f32) },
{ "received", LVT_U8, offsetof(struct SavedWarpValues, received), false, LOT_NONE, 1, sizeof(u8) },
{ "ttcSpeedSetting", LVT_S16, offsetof(struct SavedWarpValues, ttcSpeedSetting), false, LOT_NONE, 1, sizeof(s16) },
{ "warpDest", LVT_COBJECT, offsetof(struct SavedWarpValues, warpDest), true, LOT_WARPDEST, 1, sizeof(struct WarpDest) },
};
#define LUA_SERVER_SETTINGS_FIELD_COUNT 13
static struct LuaObjectField sServerSettingsFields[LUA_SERVER_SETTINGS_FIELD_COUNT] = {
{ "bouncyLevelBounds", LVT_S32, offsetof(struct ServerSettings, bouncyLevelBounds), false, LOT_NONE, 1, sizeof(enum BouncyLevelBounds) },
@ -2637,6 +2669,15 @@ static struct LuaObjectField sWallCollisionDataFields[LUA_WALL_COLLISION_DATA_FI
{ "z", LVT_F32, offsetof(struct WallCollisionData, z), false, LOT_NONE, 1, sizeof(f32) },
};
#define LUA_WARP_DEST_FIELD_COUNT 5
static struct LuaObjectField sWarpDestFields[LUA_WARP_DEST_FIELD_COUNT] = {
{ "areaIdx", LVT_U8, offsetof(struct WarpDest, areaIdx), false, LOT_NONE, 1, sizeof(u8) },
{ "arg", LVT_U32, offsetof(struct WarpDest, arg), false, LOT_NONE, 1, sizeof(u32) },
{ "levelNum", LVT_S16, offsetof(struct WarpDest, levelNum), false, LOT_NONE, 1, sizeof(s16) },
{ "nodeId", LVT_U8, offsetof(struct WarpDest, nodeId), false, LOT_NONE, 1, sizeof(u8) },
{ "type", LVT_U8, offsetof(struct WarpDest, type), false, LOT_NONE, 1, sizeof(u8) },
};
#define LUA_WARP_NODE_FIELD_COUNT 4
static struct LuaObjectField sWarpNodeFields[LUA_WARP_NODE_FIELD_COUNT] = {
{ "destArea", LVT_U8, offsetof(struct WarpNode, destArea), false, LOT_NONE, 1, sizeof(u8) },
@ -2683,6 +2724,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
{ LOT_CHAINSEGMENT, sChainSegmentFields, LUA_CHAIN_SEGMENT_FIELD_COUNT },
{ LOT_CHARACTER, sCharacterFields, LUA_CHARACTER_FIELD_COUNT },
{ LOT_CONTROLLER, sControllerFields, LUA_CONTROLLER_FIELD_COUNT },
{ LOT_CREDITSENTRY, sCreditsEntryFields, LUA_CREDITS_ENTRY_FIELD_COUNT },
{ LOT_CUSTOMLEVELINFO, sCustomLevelInfoFields, LUA_CUSTOM_LEVEL_INFO_FIELD_COUNT },
{ LOT_DATETIME, sDateTimeFields, LUA_DATE_TIME_FIELD_COUNT },
{ LOT_DIALOGENTRY, sDialogEntryFields, LUA_DIALOG_ENTRY_FIELD_COUNT },
@ -2724,6 +2766,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 },
@ -2746,6 +2789,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
{ LOT_PLAYERPALETTE, sPlayerPaletteFields, LUA_PLAYER_PALETTE_FIELD_COUNT },
{ LOT_RAYINTERSECTIONINFO, sRayIntersectionInfoFields, LUA_RAY_INTERSECTION_INFO_FIELD_COUNT },
{ LOT_ROMHACKCAMERASETTINGS, sRomhackCameraSettingsFields, LUA_ROMHACK_CAMERA_SETTINGS_FIELD_COUNT },
{ LOT_SAVEDWARPVALUES, sSavedWarpValuesFields, LUA_SAVED_WARP_VALUES_FIELD_COUNT },
{ LOT_SERVERSETTINGS, sServerSettingsFields, LUA_SERVER_SETTINGS_FIELD_COUNT },
{ LOT_SPAWNINFO, sSpawnInfoFields, LUA_SPAWN_INFO_FIELD_COUNT },
{ LOT_SPAWNPARTICLESINFO, sSpawnParticlesInfoFields, LUA_SPAWN_PARTICLES_INFO_FIELD_COUNT },
@ -2756,6 +2800,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
{ LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT },
{ LOT_VTX, sVtxFields, LUA_VTX_FIELD_COUNT },
{ LOT_WALLCOLLISIONDATA, sWallCollisionDataFields, LUA_WALL_COLLISION_DATA_FIELD_COUNT },
{ LOT_WARPDEST, sWarpDestFields, LUA_WARP_DEST_FIELD_COUNT },
{ LOT_WARPNODE, sWarpNodeFields, LUA_WARP_NODE_FIELD_COUNT },
{ LOT_WATERDROPLETPARAMS, sWaterDropletParamsFields, LUA_WATER_DROPLET_PARAMS_FIELD_COUNT },
{ LOT_WAYPOINT, sWaypointFields, LUA_WAYPOINT_FIELD_COUNT },
@ -2788,6 +2833,7 @@ const char *sLuaLotNames[] = {
[LOT_CHAINSEGMENT] = "ChainSegment",
[LOT_CHARACTER] = "Character",
[LOT_CONTROLLER] = "Controller",
[LOT_CREDITSENTRY] = "CreditsEntry",
[LOT_CUSTOMLEVELINFO] = "CustomLevelInfo",
[LOT_DATETIME] = "DateTime",
[LOT_DIALOGENTRY] = "DialogEntry",
@ -2829,6 +2875,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",
@ -2851,6 +2898,7 @@ const char *sLuaLotNames[] = {
[LOT_PLAYERPALETTE] = "PlayerPalette",
[LOT_RAYINTERSECTIONINFO] = "RayIntersectionInfo",
[LOT_ROMHACKCAMERASETTINGS] = "RomhackCameraSettings",
[LOT_SAVEDWARPVALUES] = "SavedWarpValues",
[LOT_SERVERSETTINGS] = "ServerSettings",
[LOT_SPAWNINFO] = "SpawnInfo",
[LOT_SPAWNPARTICLESINFO] = "SpawnParticlesInfo",
@ -2861,6 +2909,7 @@ const char *sLuaLotNames[] = {
[LOT_TEXTUREINFO] = "TextureInfo",
[LOT_VTX] = "Vtx",
[LOT_WALLCOLLISIONDATA] = "WallCollisionData",
[LOT_WARPDEST] = "WarpDest",
[LOT_WARPNODE] = "WarpNode",
[LOT_WATERDROPLETPARAMS] = "WaterDropletParams",
[LOT_WAYPOINT] = "Waypoint",

View file

@ -33,6 +33,7 @@ enum LuaObjectAutogenType {
LOT_CHAINSEGMENT,
LOT_CHARACTER,
LOT_CONTROLLER,
LOT_CREDITSENTRY,
LOT_CUSTOMLEVELINFO,
LOT_DATETIME,
LOT_DIALOGENTRY,
@ -74,6 +75,7 @@ enum LuaObjectAutogenType {
LOT_GRAPHNODESWITCHCASE,
LOT_GRAPHNODETRANSLATION,
LOT_GRAPHNODETRANSLATIONROTATION,
LOT_HUDDISPLAY,
LOT_INSTANTWARP,
LOT_LAKITUSTATE,
LOT_LEVELVALUES,
@ -96,6 +98,7 @@ enum LuaObjectAutogenType {
LOT_PLAYERPALETTE,
LOT_RAYINTERSECTIONINFO,
LOT_ROMHACKCAMERASETTINGS,
LOT_SAVEDWARPVALUES,
LOT_SERVERSETTINGS,
LOT_SPAWNINFO,
LOT_SPAWNPARTICLESINFO,
@ -106,6 +109,7 @@ enum LuaObjectAutogenType {
LOT_TEXTUREINFO,
LOT_VTX,
LOT_WALLCOLLISIONDATA,
LOT_WARPDEST,
LOT_WARPNODE,
LOT_WATERDROPLETPARAMS,
LOT_WAYPOINT,