diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua
index dff574bc3..9a03b12ba 100644
--- a/autogen/lua_definitions/constants.lua
+++ b/autogen/lua_definitions/constants.lua
@@ -8209,6 +8209,25 @@ HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000 --- @type HudDisplayFlags
--- | `HUD_DISPLAY_FLAGS_POWER`
--- | `HUD_DISPLAY_FLAGS_EMPHASIZE_POWER`
+ACT_SELECT_HUD_SCORE = 1 << 0 --- @type ActSelectHudPart
+ACT_SELECT_HUD_LEVEL_NAME = 1 << 1 --- @type ActSelectHudPart
+ACT_SELECT_HUD_COURSE_NUM = 1 << 2 --- @type ActSelectHudPart
+ACT_SELECT_HUD_ACT_NAME = 1 << 3 --- @type ActSelectHudPart
+ACT_SELECT_HUD_STAR_NUM = 1 << 4 --- @type ActSelectHudPart
+ACT_SELECT_HUD_PLAYERS_IN_LEVEL = 1 << 5 --- @type ActSelectHudPart
+ACT_SELECT_HUD_NONE = 0 --- @type ActSelectHudPart
+ACT_SELECT_HUD_ALL = ACT_SELECT_HUD_SCORE | ACT_SELECT_HUD_LEVEL_NAME | ACT_SELECT_HUD_COURSE_NUM | ACT_SELECT_HUD_ACT_NAME |ACT_SELECT_HUD_STAR_NUM | ACT_SELECT_HUD_PLAYERS_IN_LEVEL --- @type ActSelectHudPart
+
+--- @alias ActSelectHudPart
+--- | `ACT_SELECT_HUD_SCORE`
+--- | `ACT_SELECT_HUD_LEVEL_NAME`
+--- | `ACT_SELECT_HUD_COURSE_NUM`
+--- | `ACT_SELECT_HUD_ACT_NAME`
+--- | `ACT_SELECT_HUD_STAR_NUM`
+--- | `ACT_SELECT_HUD_PLAYERS_IN_LEVEL`
+--- | `ACT_SELECT_HUD_NONE`
+--- | `ACT_SELECT_HUD_ALL`
+
E_MODEL_NONE = 0 --- @type ModelExtendedId
E_MODEL_MARIO = 1 --- @type ModelExtendedId
E_MODEL_SMOKE = 2 --- @type ModelExtendedId
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 7308ff48f..b69be8e75 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -11160,6 +11160,25 @@ function hud_set_flash(value)
-- ...
end
+--- @param part ActSelectHudPart
+--- Hides part of the Act Select HUD
+function act_select_hud_hide(part)
+ -- ...
+end
+
+--- @param part ActSelectHudPart
+--- Shows part of the Act Select HUD
+function act_select_hud_show(part)
+ -- ...
+end
+
+--- @param part ActSelectHudPart
+--- @return boolean
+--- Checks if part of the Act Select HUD is hidden
+function act_select_hud_is_hidden(part)
+ -- ...
+end
+
--- @return boolean
--- Checks if the game is paused
function is_game_paused()
diff --git a/docs/lua/constants.md b/docs/lua/constants.md
index c29f4c80d..39eb819da 100644
--- a/docs/lua/constants.md
+++ b/docs/lua/constants.md
@@ -86,6 +86,7 @@
- [smlua_misc_utils.h](#smlua_misc_utilsh)
- [enum HudDisplayValue](#enum-HudDisplayValue)
- [enum HudDisplayFlags](#enum-HudDisplayFlags)
+ - [enum ActSelectHudPart](#enum-ActSelectHudPart)
- [smlua_model_utils.h](#smlua_model_utilsh)
- [enum ModelExtendedId](#enum-ModelExtendedId)
- [sounds.h](#soundsh)
@@ -3549,6 +3550,18 @@
| HUD_DISPLAY_FLAGS_POWER | 0x0100 |
| HUD_DISPLAY_FLAGS_EMPHASIZE_POWER | 0x8000 |
+### [enum ActSelectHudPart](#ActSelectHudPart)
+| Identifier | Value |
+| :--------- | :---- |
+| ACT_SELECT_HUD_SCORE | 1 << 0 |
+| ACT_SELECT_HUD_LEVEL_NAME | 1 << 1 |
+| ACT_SELECT_HUD_COURSE_NUM | 1 << 2 |
+| ACT_SELECT_HUD_ACT_NAME | 1 << 3 |
+| ACT_SELECT_HUD_STAR_NUM | 1 << 4 |
+| ACT_SELECT_HUD_PLAYERS_IN_LEVEL | 1 << 5 |
+| ACT_SELECT_HUD_NONE | 0 |
+| ACT_SELECT_HUD_ALL | ACT_SELECT_HUD_SCORE | ACT_SELECT_HUD_LEVEL_NAME | ACT_SELECT_HUD_COURSE_NUM | ACT_SELECT_HUD_ACT_NAME |ACT_SELECT_HUD_STAR_NUM | ACT_SELECT_HUD_PLAYERS_IN_LEVEL |
+
[:arrow_up_small:](#)
diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md
index 7bb215c22..4ee1939ac 100644
--- a/docs/lua/functions-6.md
+++ b/docs/lua/functions-6.md
@@ -4881,6 +4881,75 @@ Sets if the star counter on the HUD should flash
+## [act_select_hud_hide](#act_select_hud_hide)
+
+### Description
+Hides part of the Act Select HUD
+
+### Lua Example
+`act_select_hud_hide(part)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| part | [enum ActSelectHudPart](constants.md#enum-ActSelectHudPart) |
+
+### Returns
+- None
+
+### C Prototype
+`void act_select_hud_hide(enum ActSelectHudPart part);`
+
+[:arrow_up_small:](#)
+
+
+
+## [act_select_hud_show](#act_select_hud_show)
+
+### Description
+Shows part of the Act Select HUD
+
+### Lua Example
+`act_select_hud_show(part)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| part | [enum ActSelectHudPart](constants.md#enum-ActSelectHudPart) |
+
+### Returns
+- None
+
+### C Prototype
+`void act_select_hud_show(enum ActSelectHudPart part);`
+
+[:arrow_up_small:](#)
+
+
+
+## [act_select_hud_is_hidden](#act_select_hud_is_hidden)
+
+### Description
+Checks if part of the Act Select HUD is hidden
+
+### Lua Example
+`local booleanValue = act_select_hud_is_hidden(part)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| part | [enum ActSelectHudPart](constants.md#enum-ActSelectHudPart) |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool act_select_hud_is_hidden(enum ActSelectHudPart part);`
+
+[:arrow_up_small:](#)
+
+
+
## [is_game_paused](#is_game_paused)
### Description
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 3d72afb7a..2d4ac051d 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1998,6 +1998,9 @@
- [hud_render_power_meter_interpolated](functions-6.md#hud_render_power_meter_interpolated)
- [hud_get_flash](functions-6.md#hud_get_flash)
- [hud_set_flash](functions-6.md#hud_set_flash)
+ - [act_select_hud_hide](functions-6.md#act_select_hud_hide)
+ - [act_select_hud_show](functions-6.md#act_select_hud_show)
+ - [act_select_hud_is_hidden](functions-6.md#act_select_hud_is_hidden)
- [is_game_paused](functions-6.md#is_game_paused)
- [is_transition_playing](functions-6.md#is_transition_playing)
- [allocate_mario_action](functions-6.md#allocate_mario_action)
diff --git a/mods/character-select-coop/n-hud.lua b/mods/character-select-coop/n-hud.lua
index 96f5dc8d2..57f1aa4cc 100644
--- a/mods/character-select-coop/n-hud.lua
+++ b/mods/character-select-coop/n-hud.lua
@@ -587,7 +587,7 @@ end
-- Act Select Hud --
local function render_act_select_hud()
local course = gNetworkPlayers[0].currCourseNum
- if gServerSettings.enablePlayersInLevelDisplay == 0 or course == 0 or obj_get_first_with_behavior_id(id_bhvActSelector) == nil then return end
+ if gServerSettings.enablePlayersInLevelDisplay == 0 or course == 0 or obj_get_first_with_behavior_id(id_bhvActSelector) == nil or act_select_hud_is_hidden(ACT_SELECT_HUD_PLAYERS_IN_LEVEL) then return end
local starBhvCount = count_objects_with_behavior(get_behavior_from_id(id_bhvActSelectorStarType))
local sVisibleStars = starBhvCount < 6 and starBhvCount or 6
diff --git a/src/menu/star_select.c b/src/menu/star_select.c
index 57b32ab14..f3f651e2f 100644
--- a/src/menu/star_select.c
+++ b/src/menu/star_select.c
@@ -22,6 +22,7 @@
#include "star_select.h"
#include "prevent_bss_reordering.h"
#include "pc/network/network.h"
+#include "pc/lua/utils/smlua_misc_utils.h"
#include "engine/math_util.h"
#include "game/print.h"
#include "game/level_info.h"
@@ -35,6 +36,9 @@
* strings, act values, and star selector model rendering if a star is collected or not.
*/
+// Which parts of the HUD have been hidden.
+u8 gOverrideHideActSelectHud;
+
// Star Selector count models printed in the act selector menu.
static struct Object *sStarSelectorModels[8] = { 0 };
@@ -225,7 +229,6 @@ void print_course_number(s16 language) {
void print_course_number(void) {
#endif
u8 courseNum[4];
-
create_dl_translation_matrix(MENU_MTX_PUSH, 158.0f, 81.0f, 0.0f);
// Full wood texture in JP & US, lower part of it on EU
@@ -292,17 +295,17 @@ void print_act_selector_strings(void) {
#endif
create_dl_ortho_matrix();
-
- // Print the coin highscore.
- gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
- gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
- print_hud_my_score_coins(1, gCurrSaveFileNum - 1, gCurrCourseNum - 1, 155, 106);
- gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
-
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_SCORE) == 0) {
+ // Print the coin highscore.
+ gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
+ gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
+ print_hud_my_score_coins(1, gCurrSaveFileNum - 1, gCurrCourseNum - 1, 155, 106);
+ gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
+ }
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
// Print the "MY SCORE" text if the coin score is more than 0
- if (save_file_get_course_coin_score(gCurrSaveFileNum - 1, gCurrCourseNum - 1) != 0) {
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_SCORE) == 0 && save_file_get_course_coin_score(gCurrSaveFileNum - 1, gCurrCourseNum - 1) != 0) {
#ifdef VERSION_EU
print_generic_string(95, 118, myScore[language]);
#else
@@ -310,7 +313,7 @@ void print_act_selector_strings(void) {
#endif
}
- if (currLevelName != NULL) {
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_LEVEL_NAME) == 0 && currLevelName != NULL) {
#ifdef VERSION_EU
print_generic_string(get_str_x_pos_from_center(160, (u8*) currLevelName + 3, 10.0f), 33, currLevelName + 3);
#else
@@ -320,17 +323,18 @@ void print_act_selector_strings(void) {
}
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
-
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_COURSE_NUM) == 0) {
#ifdef VERSION_EU
- print_course_number(language);
+ print_course_number(language);
#else
- print_course_number();
+ print_course_number();
#endif
+ }
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_begin);
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
// Print the name of the selected act.
- if (sVisibleStars != 0) {
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_ACT_NAME) == 0 && sVisibleStars != 0) {
#ifdef VERSION_EU
print_menu_generic_string(get_str_x_pos_from_center(ACT_NAME_X, (u8*) selectedActName, 8.0f), 81, selectedActName);
#else
@@ -345,13 +349,17 @@ void print_act_selector_strings(void) {
s16 x = 0;
#ifdef VERSION_EU
x = 143 - sVisibleStars * 15 + i * 30;
- print_menu_generic_string(x, 38, starNumbers);
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_STAR_NUM) == 0) {
+ print_menu_generic_string(x, 38, starNumbers);
+ }
#else
x = 139 - sVisibleStars * 17 + i * 34;
- print_menu_generic_string(x, 38, starNumbers);
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_STAR_NUM) == 0) {
+ print_menu_generic_string(x, 38, starNumbers);
+ }
#endif
// display player HUD head if they're in that act
- if (gServerSettings.enablePlayersInLevelDisplay) {
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_PLAYERS_IN_LEVEL) == 0 && gServerSettings.enablePlayersInLevelDisplay) {
for (int j = 0; j < MAX_PLAYERS; j++) {
struct NetworkPlayer* np = &gNetworkPlayers[j];
if (np == NULL || !np->connected) { continue; }
@@ -366,7 +374,7 @@ void print_act_selector_strings(void) {
}
// print the number of players in the selected act
- if (sVisibleStars > 0) {
+ if ((gOverrideHideActSelectHud & ACT_SELECT_HUD_PLAYERS_IN_LEVEL) == 0 && sVisibleStars > 0) {
u8 playersInAct = 0;
for (int j = 0; j < MAX_PLAYERS; j++) {
struct NetworkPlayer* np = &gNetworkPlayers[j];
@@ -402,7 +410,7 @@ void print_act_selector_strings(void) {
}
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
- }
+}
/**
* Geo function that Print act selector strings.
diff --git a/src/menu/star_select.h b/src/menu/star_select.h
index 6388b3f69..da7245ec2 100644
--- a/src/menu/star_select.h
+++ b/src/menu/star_select.h
@@ -13,6 +13,8 @@ enum StarSelectorTypes
STAR_SELECTOR_100_COINS
};
+extern u8 gOverrideHideActSelectHud;
+
#ifdef AVOID_UB
Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node, UNUSED void *context);
#else
diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c
index aeb969169..e594393fe 100644
--- a/src/pc/lua/smlua_constants_autogen.c
+++ b/src/pc/lua/smlua_constants_autogen.c
@@ -3499,6 +3499,13 @@ char gSmluaConstants[] = ""
"HUD_DISPLAY_FLAGS_CAMERA=0x0080\n"
"HUD_DISPLAY_FLAGS_POWER=0x0100\n"
"HUD_DISPLAY_FLAGS_EMPHASIZE_POWER=0x8000\n"
+"ACT_SELECT_HUD_ALL=1 << 0\n"
+"ACT_SELECT_HUD_SCORE=1 << 1\n"
+"ACT_SELECT_HUD_LEVEL_NAME=1 << 2\n"
+"ACT_SELECT_HUD_COURSE_NUM=1 << 3\n"
+"ACT_SELECT_HUD_ACT_NAME=1 << 4\n"
+"ACT_SELECT_HUD_STAR_NUM=1 << 5\n"
+"ACT_SELECT_HUD_PLAYERS_IN_LEVEL=1 << 6\n"
"E_MODEL_NONE=0\n"
"E_MODEL_MARIO=1\n"
"E_MODEL_SMOKE=2\n"
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 5816f9b32..8a9cfe646 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -33443,6 +33443,57 @@ int smlua_func_hud_set_flash(lua_State* L) {
return 1;
}
+int smlua_func_act_select_hud_hide(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 1) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "act_select_hud_hide", 1, top);
+ return 0;
+ }
+
+ int part = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "act_select_hud_hide"); return 0; }
+
+ act_select_hud_hide(part);
+
+ return 1;
+}
+
+int smlua_func_act_select_hud_show(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 1) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "act_select_hud_show", 1, top);
+ return 0;
+ }
+
+ int part = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "act_select_hud_show"); return 0; }
+
+ act_select_hud_show(part);
+
+ return 1;
+}
+
+int smlua_func_act_select_hud_is_hidden(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 1) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "act_select_hud_is_hidden", 1, top);
+ return 0;
+ }
+
+ int part = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "act_select_hud_is_hidden"); return 0; }
+
+ lua_pushboolean(L, act_select_hud_is_hidden(part));
+
+ return 1;
+}
+
int smlua_func_is_game_paused(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -38206,6 +38257,9 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "hud_render_power_meter_interpolated", smlua_func_hud_render_power_meter_interpolated);
smlua_bind_function(L, "hud_get_flash", smlua_func_hud_get_flash);
smlua_bind_function(L, "hud_set_flash", smlua_func_hud_set_flash);
+ smlua_bind_function(L, "act_select_hud_hide", smlua_func_act_select_hud_hide);
+ smlua_bind_function(L, "act_select_hud_show", smlua_func_act_select_hud_show);
+ smlua_bind_function(L, "act_select_hud_is_hidden", smlua_func_act_select_hud_is_hidden);
smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused);
smlua_bind_function(L, "is_transition_playing", smlua_func_is_transition_playing);
smlua_bind_function(L, "allocate_mario_action", smlua_func_allocate_mario_action);
diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c
index 5fe69642c..58a9af095 100644
--- a/src/pc/lua/utils/smlua_misc_utils.c
+++ b/src/pc/lua/utils/smlua_misc_utils.c
@@ -8,6 +8,7 @@
#include "game/camera.h"
#include "game/hardcoded.h"
#include "game/hud.h"
+#include "menu/star_select.h"
#include "pc/lua/smlua.h"
#include "smlua_misc_utils.h"
#include "pc/debuglog.h"
@@ -212,6 +213,18 @@ void hud_set_value(enum HudDisplayValue type, s32 value) {
}
}
+void act_select_hud_hide(enum ActSelectHudPart part) {
+ gOverrideHideActSelectHud |= part;
+}
+
+void act_select_hud_show(enum ActSelectHudPart part) {
+ gOverrideHideActSelectHud &= ~part;
+}
+
+bool act_select_hud_is_hidden(enum ActSelectHudPart part) {
+ return (gOverrideHideActSelectHud & part) != 0;
+}
+
extern const u8 texture_power_meter_left_side[];
extern const u8 texture_power_meter_right_side[];
extern const u8 texture_power_meter_full[];
diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h
index 401467a6e..9c65320d7 100644
--- a/src/pc/lua/utils/smlua_misc_utils.h
+++ b/src/pc/lua/utils/smlua_misc_utils.h
@@ -29,6 +29,18 @@ enum HudDisplayFlags {
HUD_DISPLAY_FLAGS_EMPHASIZE_POWER = 0x8000
};
+enum ActSelectHudPart {
+ ACT_SELECT_HUD_SCORE = 1 << 0,
+ ACT_SELECT_HUD_LEVEL_NAME = 1 << 1,
+ ACT_SELECT_HUD_COURSE_NUM = 1 << 2,
+ ACT_SELECT_HUD_ACT_NAME = 1 << 3,
+ ACT_SELECT_HUD_STAR_NUM = 1 << 4,
+ ACT_SELECT_HUD_PLAYERS_IN_LEVEL = 1 << 5,
+
+ ACT_SELECT_HUD_NONE = 0,
+ ACT_SELECT_HUD_ALL = ACT_SELECT_HUD_SCORE | ACT_SELECT_HUD_LEVEL_NAME | ACT_SELECT_HUD_COURSE_NUM | ACT_SELECT_HUD_ACT_NAME |ACT_SELECT_HUD_STAR_NUM | ACT_SELECT_HUD_PLAYERS_IN_LEVEL
+};
+
struct DateTime {
s32 year;
s32 month;
@@ -113,6 +125,13 @@ s8 hud_get_flash(void);
/* |description|Sets if the star counter on the HUD should flash|descriptionEnd| */
void hud_set_flash(s8 value);
+/* |description|Hides part of the Act Select HUD|descriptionEnd| */
+void act_select_hud_hide(enum ActSelectHudPart part);
+/* |description|Shows part of the Act Select HUD|descriptionEnd| */
+void act_select_hud_show(enum ActSelectHudPart part);
+/* |description|Checks if part of the Act Select HUD is hidden|descriptionEnd| */
+bool act_select_hud_is_hidden(enum ActSelectHudPart part);
+
/* |description|Checks if the game is paused|descriptionEnd| */
bool is_game_paused(void);
/* |description|Checks if a screen transition is playing|descriptionEnd| */
diff --git a/src/pc/network/network.c b/src/pc/network/network.c
index ef6ec3ec1..320f5d62c 100644
--- a/src/pc/network/network.c
+++ b/src/pc/network/network.c
@@ -110,6 +110,7 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
// reset override hide hud
extern u8 gOverrideHideHud;
gOverrideHideHud = 0;
+ act_select_hud_show(ACT_SELECT_HUD_ALL);
gNetworkStartupTimer = 5 * 30;
// sanity check network system