From 96e21e13a1231e8e0268e0f01df8eca5243246b3 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:34:43 -0500 Subject: [PATCH] Add HUD_DISPLAY_CAMERA_STATUS --- autogen/lua_definitions/constants.lua | 3 +++ docs/lua/constants.md | 1 + src/game/hud.c | 4 ++++ src/game/hud.h | 1 + src/pc/lua/smlua_constants_autogen.c | 1 + src/pc/lua/utils/smlua_misc_utils.c | 30 ++++++++++++++------------- src/pc/lua/utils/smlua_misc_utils.h | 3 ++- 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 745e3e11..72f9256b 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -9358,6 +9358,9 @@ HUD_DISPLAY_FLAGS = 5 --- @type HudDisplayValue HUD_DISPLAY_TIMER = 6 +--- @type HudDisplayValue +HUD_DISPLAY_CAMERA_STATUS = 7 + --- @class ModelExtendedId --- @type ModelExtendedId diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 4269c600..08b99a7a 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -3360,6 +3360,7 @@ | HUD_DISPLAY_KEYS | 4 | | HUD_DISPLAY_FLAGS | 5 | | HUD_DISPLAY_TIMER | 6 | +| HUD_DISPLAY_CAMERA_STATUS | 7 | [:arrow_up_small:](#) diff --git a/src/game/hud.c b/src/game/hud.c index 25804d2e..06ac5925 100644 --- a/src/game/hud.c +++ b/src/game/hud.c @@ -545,6 +545,10 @@ void render_hud_timer(void) { gSPDisplayList(gDisplayListHead++, dl_hud_img_end); } +s16 get_hud_camera_status(void) { + return sCameraHUD.status; +} + /** * Sets HUD status camera value depending of the actions * defined in update_camera_status. diff --git a/src/game/hud.h b/src/game/hud.h index 30997a02..2f06a8ab 100644 --- a/src/game/hud.h +++ b/src/game/hud.h @@ -33,6 +33,7 @@ s32 gfx_dimensions_rect_from_right_edge(s32 v); void render_hud_icon(Vtx *vtx, const u8 *texture, u32 fmt, u32 siz, s32 texW, s32 texH, s32 x, s32 y, s32 w, s32 h, s32 tileX, s32 tileY, s32 tileW, s32 tileH); +s16 get_hud_camera_status(void); void set_hud_camera_status(s16 status); void render_hud(void); diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 905cd7e8..0da502ea 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -3309,6 +3309,7 @@ char gSmluaConstants[] = "" "HUD_DISPLAY_KEYS = 4\n" "HUD_DISPLAY_FLAGS = 5\n" "HUD_DISPLAY_TIMER = 6\n" +"HUD_DISPLAY_CAMERA_STATUS = 7\n" "HUD_DISPLAY_FLAGS_NONE = 0x0000\n" "HUD_DISPLAY_FLAGS_LIVES = 0x0001\n" "HUD_DISPLAY_FLAGS_COIN_COUNT = 0x0002\n" diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index c0ed9fde..157c2935 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -149,26 +149,28 @@ bool hud_is_hidden(void) { s32 hud_get_value(enum HudDisplayValue type) { switch (type) { - case HUD_DISPLAY_LIVES: return gHudDisplay.lives; - case HUD_DISPLAY_COINS: return gHudDisplay.coins; - case HUD_DISPLAY_STARS: return gHudDisplay.stars; - case HUD_DISPLAY_WEDGES: return gHudDisplay.wedges; - case HUD_DISPLAY_KEYS: return gHudDisplay.keys; - case HUD_DISPLAY_FLAGS: return gHudDisplay.flags; - case HUD_DISPLAY_TIMER: return gHudDisplay.timer; + case HUD_DISPLAY_LIVES: return gHudDisplay.lives; + case HUD_DISPLAY_COINS: return gHudDisplay.coins; + case HUD_DISPLAY_STARS: return gHudDisplay.stars; + case HUD_DISPLAY_WEDGES: return gHudDisplay.wedges; + case HUD_DISPLAY_KEYS: return gHudDisplay.keys; + case HUD_DISPLAY_FLAGS: return gHudDisplay.flags; + case HUD_DISPLAY_TIMER: return gHudDisplay.timer; + case HUD_DISPLAY_CAMERA_STATUS: return get_hud_camera_status(); } return 0; } void hud_set_value(enum HudDisplayValue type, s32 value) { switch (type) { - case HUD_DISPLAY_LIVES: gHudDisplay.lives = value; break; - case HUD_DISPLAY_COINS: gHudDisplay.coins = value; break; - case HUD_DISPLAY_STARS: gHudDisplay.stars = value; break; - case HUD_DISPLAY_WEDGES: gHudDisplay.wedges = value; break; - case HUD_DISPLAY_KEYS: gHudDisplay.keys = value; break; - case HUD_DISPLAY_FLAGS: gHudDisplay.flags = value; break; - case HUD_DISPLAY_TIMER: gHudDisplay.timer = value; break; + case HUD_DISPLAY_LIVES: gHudDisplay.lives = value; break; + case HUD_DISPLAY_COINS: gHudDisplay.coins = value; break; + case HUD_DISPLAY_STARS: gHudDisplay.stars = value; break; + case HUD_DISPLAY_WEDGES: gHudDisplay.wedges = value; break; + case HUD_DISPLAY_KEYS: gHudDisplay.keys = value; break; + case HUD_DISPLAY_FLAGS: gHudDisplay.flags = value; break; + case HUD_DISPLAY_TIMER: gHudDisplay.timer = value; break; + case HUD_DISPLAY_CAMERA_STATUS: set_hud_camera_status(value); break; } } diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index 08f9016e..25d14c35 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -12,6 +12,7 @@ enum HudDisplayValue { HUD_DISPLAY_KEYS, HUD_DISPLAY_FLAGS, HUD_DISPLAY_TIMER, + HUD_DISPLAY_CAMERA_STATUS }; enum HudDisplayFlags { @@ -25,7 +26,7 @@ enum HudDisplayFlags { HUD_DISPLAY_FLAGS_TIMER = 0x0040, HUD_DISPLAY_FLAGS_CAMERA = 0x0080, HUD_DISPLAY_FLAGS_POWER = 0x0100, - HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000, + HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000 }; struct DateTime {