diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua
index 9ce4e5aa..c97a939c 100644
--- a/autogen/lua_definitions/constants.lua
+++ b/autogen/lua_definitions/constants.lua
@@ -3913,6 +3913,12 @@ HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020
--- @type HUDDisplayFlag
HUD_DISPLAY_FLAG_TIMER = 0x0040
+--- @type HUDDisplayFlag
+HUD_DISPLAY_FLAG_CAMERA = 0x0080
+
+--- @type HUDDisplayFlag
+HUD_DISPLAY_FLAG_POWER = 0x0100
+
--- @type HUDDisplayFlag
HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000
@@ -3920,7 +3926,7 @@ HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000
HUD_DISPLAY_NONE = 0x0000
--- @type HUDDisplayFlag
-HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
+HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
--- @class MarioAnimID
@@ -8174,6 +8180,12 @@ HUD_DISPLAY_FLAGS_UNKNOWN_0020 = 0x0020
--- @type HudDisplayFlags
HUD_DISPLAY_FLAGS_TIMER = 0x0040
+--- @type HudDisplayFlags
+HUD_DISPLAY_FLAGS_CAMERA = 0x0080
+
+--- @type HudDisplayFlags
+HUD_DISPLAY_FLAGS_POWER = 0x0100
+
--- @type HudDisplayFlags
HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 8ce36cac..30d53d64 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8214,6 +8214,11 @@ function camera_freeze()
-- ...
end
+--- @return boolean
+function camera_is_frozen()
+ -- ...
+end
+
--- @return nil
function camera_unfreeze()
-- ...
@@ -8300,6 +8305,11 @@ function hud_hide()
-- ...
end
+--- @return boolean
+function hud_is_hidden()
+ -- ...
+end
+
--- @param health integer
--- @param x number
--- @param y number
diff --git a/docs/lua/constants.md b/docs/lua/constants.md
index d4cd3a84..2d421ac3 100644
--- a/docs/lua/constants.md
+++ b/docs/lua/constants.md
@@ -1360,9 +1360,11 @@
| HUD_DISPLAY_FLAG_KEYS | 0x0010 |
| HUD_DISPLAY_FLAG_UNKNOWN_0020 | 0x0020 |
| HUD_DISPLAY_FLAG_TIMER | 0x0040 |
+| HUD_DISPLAY_FLAG_CAMERA | 0x0080 |
+| HUD_DISPLAY_FLAG_POWER | 0x0100 |
| HUD_DISPLAY_FLAG_EMPHASIZE_POWER | 0x8000 |
| HUD_DISPLAY_NONE | 0x0000 |
-| HUD_DISPLAY_DEFAULT | HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 |
+| HUD_DISPLAY_DEFAULT | HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 |
[:arrow_up_small:](#)
@@ -2911,6 +2913,8 @@
| HUD_DISPLAY_FLAGS_KEYS | 0x0010 |
| HUD_DISPLAY_FLAGS_UNKNOWN_0020 | 0x0020 |
| HUD_DISPLAY_FLAGS_TIMER | 0x0040 |
+| HUD_DISPLAY_FLAGS_CAMERA | 0x0080 |
+| HUD_DISPLAY_FLAGS_POWER | 0x0100 |
| HUD_DISPLAY_FLAGS_EMPHASIZE_POWER | 0x8000 |
### [enum HudDisplayValue](#HudDisplayValue)
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index dfe35d88..ffe2aaa1 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -8066,6 +8066,24 @@
+## [camera_is_frozen](#camera_is_frozen)
+
+### Lua Example
+`local booleanValue = camera_is_frozen()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool camera_is_frozen(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [camera_unfreeze](#camera_unfreeze)
### Lua Example
@@ -8355,6 +8373,24 @@
+## [hud_is_hidden](#hud_is_hidden)
+
+### Lua Example
+`local booleanValue = hud_is_hidden()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool hud_is_hidden(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [hud_render_power_meter](#hud_render_power_meter)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 05600f76..cddbb6a0 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1526,6 +1526,7 @@
- [camera_config_set_x_sensitivity](functions-4.md#camera_config_set_x_sensitivity)
- [camera_config_set_y_sensitivity](functions-4.md#camera_config_set_y_sensitivity)
- [camera_freeze](functions-4.md#camera_freeze)
+ - [camera_is_frozen](functions-4.md#camera_is_frozen)
- [camera_unfreeze](functions-4.md#camera_unfreeze)
- [course_is_main_course](functions-4.md#course_is_main_course)
- [deref_s32_pointer](functions-4.md#deref_s32_pointer)
@@ -1541,6 +1542,7 @@
- [get_temp_s32_pointer](functions-4.md#get_temp_s32_pointer)
- [hud_get_value](functions-4.md#hud_get_value)
- [hud_hide](functions-4.md#hud_hide)
+ - [hud_is_hidden](functions-4.md#hud_is_hidden)
- [hud_render_power_meter](functions-4.md#hud_render_power_meter)
- [hud_set_value](functions-4.md#hud_set_value)
- [hud_show](functions-4.md#hud_show)
diff --git a/src/game/hud.c b/src/game/hud.c
index 792401ac..e1a94156 100644
--- a/src/game/hud.c
+++ b/src/game/hud.c
@@ -494,7 +494,7 @@ void render_hud(void) {
bool showHud = (configHUD && !gDjuiInMainMenu && !gOverrideHideHud);
- if (gCurrentArea != NULL && gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
+ if (gCurrentArea != NULL && gCurrentArea->camera != NULL && gCurrentArea->camera->mode == CAMERA_MODE_INSIDE_CANNON) {
render_hud_cannon_reticle();
}
@@ -515,21 +515,24 @@ void render_hud(void) {
}
if (hudDisplayFlags & HUD_DISPLAY_FLAG_CAMERA_AND_POWER && showHud) {
- render_hud_power_meter();
- render_hud_camera_status();
+ if (hudDisplayFlags & HUD_DISPLAY_FLAG_CAMERA && showHud) {
+ render_hud_camera_status();
+ }
+
+ if (hudDisplayFlags & HUD_DISPLAY_FLAG_POWER && showHud) {
+ render_hud_power_meter();
+ }
}
if (hudDisplayFlags & HUD_DISPLAY_FLAG_TIMER && showHud) {
render_hud_timer();
}
- if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_SURFACES)
- {
+ if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_SURFACES) {
print_text(10, 40, "SURFACE POOL FULL");
}
- if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_NODES)
- {
+ if (gSurfacePoolError & NOT_ENOUGH_ROOM_FOR_NODES) {
print_text(10, 60, "SURFACE NODE POOL FULL");
}
diff --git a/src/game/level_update.h b/src/game/level_update.h
index 53c03c60..24c524c6 100644
--- a/src/game/level_update.h
+++ b/src/game/level_update.h
@@ -133,10 +133,12 @@ enum HUDDisplayFlag {
HUD_DISPLAY_FLAG_KEYS = 0x0010,
HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020,
HUD_DISPLAY_FLAG_TIMER = 0x0040,
+ HUD_DISPLAY_FLAG_CAMERA = 0x0080,
+ HUD_DISPLAY_FLAG_POWER = 0x0100,
HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000,
HUD_DISPLAY_NONE = 0x0000,
- HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
+ HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
};
u8 level_control_timer_running(void);
diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c
index 07ce0f3a..77040d4f 100644
--- a/src/pc/lua/smlua_constants_autogen.c
+++ b/src/pc/lua/smlua_constants_autogen.c
@@ -1492,9 +1492,11 @@ char gSmluaConstants[] = ""
"HUD_DISPLAY_FLAG_KEYS = 0x0010\n"
"HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020\n"
"HUD_DISPLAY_FLAG_TIMER = 0x0040\n"
+"HUD_DISPLAY_FLAG_CAMERA = 0x0080\n"
+"HUD_DISPLAY_FLAG_POWER = 0x0100\n"
"HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000\n"
"HUD_DISPLAY_NONE = 0x0000\n"
-"HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020\n"
+"HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020\n"
"MARIO_ANIM_SLOW_LEDGE_GRAB = 0\n"
"MARIO_ANIM_FALL_OVER_BACKWARDS = 1\n"
"MARIO_ANIM_BACKWARD_AIR_KB = 2\n"
@@ -2910,6 +2912,8 @@ char gSmluaConstants[] = ""
"HUD_DISPLAY_FLAGS_KEYS = 0x0010\n"
"HUD_DISPLAY_FLAGS_UNKNOWN_0020 = 0x0020\n"
"HUD_DISPLAY_FLAGS_TIMER = 0x0040\n"
+"HUD_DISPLAY_FLAGS_CAMERA = 0x0080\n"
+"HUD_DISPLAY_FLAGS_POWER = 0x0100\n"
"HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000\n"
"E_MODEL_NONE = 0\n"
"E_MODEL_MARIO = 1\n"
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 508c0813..79431e2e 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -26833,6 +26833,21 @@ int smlua_func_camera_freeze(UNUSED lua_State* L) {
return 1;
}
+int smlua_func_camera_is_frozen(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_is_frozen", 0, top);
+ return 0;
+ }
+
+
+ lua_pushboolean(L, camera_is_frozen());
+
+ return 1;
+}
+
int smlua_func_camera_unfreeze(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -27080,6 +27095,21 @@ int smlua_func_hud_hide(UNUSED lua_State* L) {
return 1;
}
+int smlua_func_hud_is_hidden(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_is_hidden", 0, top);
+ return 0;
+ }
+
+
+ lua_pushboolean(L, hud_is_hidden());
+
+ return 1;
+}
+
int smlua_func_hud_render_power_meter(lua_State* L) {
if (L == NULL) { return 0; }
@@ -30246,6 +30276,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "camera_config_set_x_sensitivity", smlua_func_camera_config_set_x_sensitivity);
smlua_bind_function(L, "camera_config_set_y_sensitivity", smlua_func_camera_config_set_y_sensitivity);
smlua_bind_function(L, "camera_freeze", smlua_func_camera_freeze);
+ smlua_bind_function(L, "camera_is_frozen", smlua_func_camera_is_frozen);
smlua_bind_function(L, "camera_unfreeze", smlua_func_camera_unfreeze);
smlua_bind_function(L, "course_is_main_course", smlua_func_course_is_main_course);
smlua_bind_function(L, "deref_s32_pointer", smlua_func_deref_s32_pointer);
@@ -30261,6 +30292,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_temp_s32_pointer", smlua_func_get_temp_s32_pointer);
smlua_bind_function(L, "hud_get_value", smlua_func_hud_get_value);
smlua_bind_function(L, "hud_hide", smlua_func_hud_hide);
+ smlua_bind_function(L, "hud_is_hidden", smlua_func_hud_is_hidden);
smlua_bind_function(L, "hud_render_power_meter", smlua_func_hud_render_power_meter);
smlua_bind_function(L, "hud_set_value", smlua_func_hud_set_value);
smlua_bind_function(L, "hud_show", smlua_func_hud_show);
diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c
index 3fcfa8c7..57d4adbc 100644
--- a/src/pc/lua/utils/smlua_misc_utils.c
+++ b/src/pc/lua/utils/smlua_misc_utils.c
@@ -49,6 +49,10 @@ void hud_show(void) {
gOverrideHideHud = 0;
}
+bool hud_is_hidden(void) {
+ return gOverrideHideHud;
+}
+
extern u8 gLastCollectedStarOrKey;
s32 get_last_star_or_key(void) {
return gLastCollectedStarOrKey;
@@ -129,6 +133,10 @@ void camera_unfreeze(void) {
gOverrideFreezeCamera = FALSE;
}
+bool camera_is_frozen(void) {
+ return gOverrideFreezeCamera;
+}
+
bool camera_config_is_free_cam_enabled(void) {
#ifdef BETTERCAMERA
return configEnableCamera;
diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h
index 0f1f86d5..42537f40 100644
--- a/src/pc/lua/utils/smlua_misc_utils.h
+++ b/src/pc/lua/utils/smlua_misc_utils.h
@@ -27,17 +27,21 @@ enum HudDisplayFlags {
HUD_DISPLAY_FLAGS_KEYS = 0x0010,
HUD_DISPLAY_FLAGS_UNKNOWN_0020 = 0x0020,
HUD_DISPLAY_FLAGS_TIMER = 0x0040,
+ HUD_DISPLAY_FLAGS_CAMERA = 0x0080,
+ HUD_DISPLAY_FLAGS_POWER = 0x0100,
HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000,
};
void hud_hide(void);
void hud_show(void);
+bool hud_is_hidden(void);
s32 hud_get_value(enum HudDisplayValue type);
void hud_set_value(enum HudDisplayValue type, s32 value);
void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height);
void camera_freeze(void);
void camera_unfreeze(void);
+bool camera_is_frozen(void);
bool camera_config_is_free_cam_enabled(void);
bool camera_config_is_analog_cam_enabled(void);