diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 531e26c45..05bef7ae1 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -13,6 +13,7 @@ in_files = [ "src/engine/surface_collision.h", "src/pc/network/network_player.h", "src/pc/djui/djui_hud_utils.h", + "src/pc/djui/djui_theme.h", "src/game/object_helpers.h", "src/game/mario_step.h", "src/pc/lua/utils/smlua_anim_utils.h", diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 8ca6ce3e9..a8dd00122 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8294,6 +8294,11 @@ function djui_menu_get_font() -- ... end +--- @return DjuiTheme +function djui_menu_get_theme() + -- ... +end + --- @param message string --- @param lines integer function djui_popup_create_global(message, lines) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 4ee642e49..23d9c295b 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -590,6 +590,29 @@ --- @field public g integer --- @field public r integer +--- @class DjuiInteractableTheme +--- @field public cursorDownBorderColor DjuiColor +--- @field public cursorDownRectColor DjuiColor +--- @field public defaultBorderColor DjuiColor +--- @field public defaultRectColor DjuiColor +--- @field public hoveredBorderColor DjuiColor +--- @field public hoveredRectColor DjuiColor +--- @field public textColor DjuiColor + +--- @class DjuiPanelTheme +--- @field public hudFontHeader boolean + +--- @class DjuiTheme +--- @field public id string +--- @field public interactables DjuiInteractableTheme +--- @field public name string +--- @field public panels DjuiPanelTheme +--- @field public threePanels DjuiThreePanelTheme + +--- @class DjuiThreePanelTheme +--- @field public borderColor DjuiColor +--- @field public rectColor DjuiColor + --- @class ExclamationBoxContent --- @field public behavior BehaviorId --- @field public firstByte integer diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 72295de8f..71e08040c 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -2099,6 +2099,24 @@
+## [djui_menu_get_theme](#djui_menu_get_theme) + +### Lua Example +`local DjuiThemeValue = djui_menu_get_theme()` + +### Parameters +- None + +### Returns +[DjuiTheme](structs.md#DjuiTheme) + +### C Prototype +`struct DjuiTheme* djui_menu_get_theme(void);` + +[:arrow_up_small:](#) + +
+ ## [djui_popup_create_global](#djui_popup_create_global) ### Lua Example @@ -5168,6 +5186,26 @@
+## [surface_has_force](#surface_has_force) + +### Lua Example +`local booleanValue = surface_has_force(surfaceType)` + +### Parameters +| Field | Type | +| ----- | ---- | +| surfaceType | `integer` | + +### Returns +- `boolean` + +### C Prototype +`bool surface_has_force(s16 surfaceType);` + +[:arrow_up_small:](#) + +
+ --- [< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5] diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 9f28fc269..dd455b84d 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1739,6 +1739,7 @@ - [djui_is_playerlist_open](functions-5.md#djui_is_playerlist_open) - [djui_is_popup_disabled](functions-5.md#djui_is_popup_disabled) - [djui_menu_get_font](functions-5.md#djui_menu_get_font) + - [djui_menu_get_theme](functions-5.md#djui_menu_get_theme) - [djui_popup_create_global](functions-5.md#djui_popup_create_global) - [djui_reset_popup_disabled_override](functions-5.md#djui_reset_popup_disabled_override) - [djui_set_popup_disabled_override](functions-5.md#djui_set_popup_disabled_override) @@ -1917,6 +1918,7 @@ - [load_area_terrain](functions-5.md#load_area_terrain) - [load_object_collision_model](functions-5.md#load_object_collision_model) - [obj_get_surface_from_index](functions-5.md#obj_get_surface_from_index) + - [surface_has_force](functions-5.md#surface_has_force)
diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 1bbadc3fc..c5777631e 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -24,6 +24,10 @@ - [CutsceneVariable](#CutsceneVariable) - [DateTime](#DateTime) - [DjuiColor](#DjuiColor) +- [DjuiInteractableTheme](#DjuiInteractableTheme) +- [DjuiPanelTheme](#DjuiPanelTheme) +- [DjuiTheme](#DjuiTheme) +- [DjuiThreePanelTheme](#DjuiThreePanelTheme) - [ExclamationBoxContent](#ExclamationBoxContent) - [FirstPersonCamera](#FirstPersonCamera) - [FloorGeometry](#FloorGeometry) @@ -845,6 +849,53 @@
+## [DjuiInteractableTheme](#DjuiInteractableTheme) + +| Field | Type | Access | +| ----- | ---- | ------ | +| cursorDownBorderColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| cursorDownRectColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| defaultBorderColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| defaultRectColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| hoveredBorderColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| hoveredRectColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| textColor | [DjuiColor](structs.md#DjuiColor) | read-only | + +[:arrow_up_small:](#) + +
+ +## [DjuiPanelTheme](#DjuiPanelTheme) + +| Field | Type | Access | +| ----- | ---- | ------ | +| hudFontHeader | `boolean` | | + +[:arrow_up_small:](#) + +
+ +## [DjuiTheme](#DjuiTheme) + +| Field | Type | Access | +| ----- | ---- | ------ | +| id | `string` | read-only | +| interactables | [DjuiInteractableTheme](structs.md#DjuiInteractableTheme) | read-only | +| name | `string` | read-only | +| panels | [DjuiPanelTheme](structs.md#DjuiPanelTheme) | read-only | +| threePanels | [DjuiThreePanelTheme](structs.md#DjuiThreePanelTheme) | read-only | + +[:arrow_up_small:](#) + +
+ +## [DjuiThreePanelTheme](#DjuiThreePanelTheme) + +| Field | Type | Access | +| ----- | ---- | ------ | +| borderColor | [DjuiColor](structs.md#DjuiColor) | read-only | +| rectColor | [DjuiColor](structs.md#DjuiColor) | read-only | +======= ## [ExclamationBoxContent](#ExclamationBoxContent) | Field | Type | Access | diff --git a/src/pc/djui/djui_panel_menu_options.c b/src/pc/djui/djui_panel_menu_options.c index e6b887eab..faacdccf6 100644 --- a/src/pc/djui/djui_panel_menu_options.c +++ b/src/pc/djui/djui_panel_menu_options.c @@ -7,6 +7,8 @@ #include "djui_panel_misc.h" #include "djui_panel_pause.h" #include "djui_panel_menu_options.h" +#include "djui_panel_modlist.h" +#include "djui_panel_playerlist.h" #include "djui_hud_utils.h" #include "pc/utils/misc.h" #include "pc/configfile.h" @@ -66,12 +68,16 @@ static void djui_panel_menu_options_djui_setting_change(UNUSED struct DjuiBase* if (gDjuiInMainMenu) { djui_panel_shutdown(); gDjuiInMainMenu = true; + djui_panel_playerlist_create(NULL); + djui_panel_modlist_create(NULL); djui_panel_main_create(NULL); djui_panel_options_create(NULL); djui_panel_misc_create(NULL); djui_panel_main_menu_create(NULL); } else if (gDjuiPanelPauseCreated) { djui_panel_shutdown(); + djui_panel_playerlist_create(NULL); + djui_panel_modlist_create(NULL); djui_panel_pause_create(NULL); djui_panel_options_create(NULL); djui_panel_misc_create(NULL); diff --git a/src/pc/djui/djui_panel_playerlist.c b/src/pc/djui/djui_panel_playerlist.c index 25c90f829..a18256b66 100644 --- a/src/pc/djui/djui_panel_playerlist.c +++ b/src/pc/djui/djui_panel_playerlist.c @@ -87,6 +87,12 @@ void djui_panel_playerlist_on_render_pre(UNUSED struct DjuiBase* base, UNUSED bo void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) { f32 bodyHeight = (sPlayerListSize * 32) + (sPlayerListSize - 1) * 4; + // delete old player list + if (gDjuiPlayerList != NULL) { + djui_base_destroy(&gDjuiPlayerList->base); + gDjuiPlayerList= NULL; + } + struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER_LIST, PLAYERS), false); djui_three_panel_set_body_size(panel, bodyHeight); gDjuiPlayerList = panel; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 678eb53de..7a86fc457 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -8,6 +8,7 @@ #include "src/engine/surface_collision.h" #include "src/pc/network/network_player.h" #include "src/pc/djui/djui_hud_utils.h" +#include "src/pc/djui/djui_theme.h" #include "src/game/object_helpers.h" #include "src/game/mario_step.h" #include "src/pc/lua/utils/smlua_anim_utils.h" @@ -677,6 +678,37 @@ static struct LuaObjectField sDjuiColorFields[LUA_DJUI_COLOR_FIELD_COUNT] = { { "r", LVT_U8, offsetof(struct DjuiColor, r), false, LOT_NONE }, }; +#define LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT 7 +static struct LuaObjectField sDjuiInteractableThemeFields[LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT] = { + { "cursorDownBorderColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, cursorDownBorderColor), true, LOT_DJUICOLOR }, + { "cursorDownRectColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, cursorDownRectColor), true, LOT_DJUICOLOR }, + { "defaultBorderColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, defaultBorderColor), true, LOT_DJUICOLOR }, + { "defaultRectColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, defaultRectColor), true, LOT_DJUICOLOR }, + { "hoveredBorderColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, hoveredBorderColor), true, LOT_DJUICOLOR }, + { "hoveredRectColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, hoveredRectColor), true, LOT_DJUICOLOR }, + { "textColor", LVT_COBJECT, offsetof(struct DjuiInteractableTheme, textColor), true, LOT_DJUICOLOR }, +}; + +#define LUA_DJUI_PANEL_THEME_FIELD_COUNT 1 +static struct LuaObjectField sDjuiPanelThemeFields[LUA_DJUI_PANEL_THEME_FIELD_COUNT] = { + { "hudFontHeader", LVT_BOOL, offsetof(struct DjuiPanelTheme, hudFontHeader), false, LOT_NONE }, +}; + +#define LUA_DJUI_THEME_FIELD_COUNT 5 +static struct LuaObjectField sDjuiThemeFields[LUA_DJUI_THEME_FIELD_COUNT] = { + { "id", LVT_STRING_P, offsetof(struct DjuiTheme, id), true, LOT_NONE }, + { "interactables", LVT_COBJECT, offsetof(struct DjuiTheme, interactables), true, LOT_DJUIINTERACTABLETHEME }, + { "name", LVT_STRING_P, offsetof(struct DjuiTheme, name), true, LOT_NONE }, + { "panels", LVT_COBJECT, offsetof(struct DjuiTheme, panels), true, LOT_DJUIPANELTHEME }, + { "threePanels", LVT_COBJECT, offsetof(struct DjuiTheme, threePanels), true, LOT_DJUITHREEPANELTHEME }, +}; + +#define LUA_DJUI_THREE_PANEL_THEME_FIELD_COUNT 2 +static struct LuaObjectField sDjuiThreePanelThemeFields[LUA_DJUI_THREE_PANEL_THEME_FIELD_COUNT] = { + { "borderColor", LVT_COBJECT, offsetof(struct DjuiThreePanelTheme, borderColor), true, LOT_DJUICOLOR }, + { "rectColor", LVT_COBJECT, offsetof(struct DjuiThreePanelTheme, rectColor), true, LOT_DJUICOLOR }, +}; + #define LUA_EXCLAMATION_BOX_CONTENT_FIELD_COUNT 5 static struct LuaObjectField sExclamationBoxContentFields[LUA_EXCLAMATION_BOX_CONTENT_FIELD_COUNT] = { { "behavior", LVT_S32, offsetof(struct ExclamationBoxContent, behavior), false, LOT_NONE }, @@ -2470,6 +2502,10 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] { LOT_CUTSCENEVARIABLE, sCutsceneVariableFields, LUA_CUTSCENE_VARIABLE_FIELD_COUNT }, { LOT_DATETIME, sDateTimeFields, LUA_DATE_TIME_FIELD_COUNT }, { LOT_DJUICOLOR, sDjuiColorFields, LUA_DJUI_COLOR_FIELD_COUNT }, + { LOT_DJUIINTERACTABLETHEME, sDjuiInteractableThemeFields, LUA_DJUI_INTERACTABLE_THEME_FIELD_COUNT }, + { LOT_DJUIPANELTHEME, sDjuiPanelThemeFields, LUA_DJUI_PANEL_THEME_FIELD_COUNT }, + { LOT_DJUITHEME, sDjuiThemeFields, LUA_DJUI_THEME_FIELD_COUNT }, + { LOT_DJUITHREEPANELTHEME, sDjuiThreePanelThemeFields, LUA_DJUI_THREE_PANEL_THEME_FIELD_COUNT }, { LOT_EXCLAMATIONBOXCONTENT, sExclamationBoxContentFields, LUA_EXCLAMATION_BOX_CONTENT_FIELD_COUNT }, { LOT_FIRSTPERSONCAMERA, sFirstPersonCameraFields, LUA_FIRST_PERSON_CAMERA_FIELD_COUNT }, { LOT_FLOORGEOMETRY, sFloorGeometryFields, LUA_FLOOR_GEOMETRY_FIELD_COUNT }, diff --git a/src/pc/lua/smlua_cobject_autogen.h b/src/pc/lua/smlua_cobject_autogen.h index f08674bfa..b3fbbc238 100644 --- a/src/pc/lua/smlua_cobject_autogen.h +++ b/src/pc/lua/smlua_cobject_autogen.h @@ -27,6 +27,10 @@ enum LuaObjectAutogenType { LOT_CUTSCENEVARIABLE, LOT_DATETIME, LOT_DJUICOLOR, + LOT_DJUIINTERACTABLETHEME, + LOT_DJUIPANELTHEME, + LOT_DJUITHEME, + LOT_DJUITHREEPANELTHEME, LOT_EXCLAMATIONBOXCONTENT, LOT_FIRSTPERSONCAMERA, LOT_FLOORGEOMETRY, diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index ea51eec11..b40da2f7e 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -30484,6 +30484,21 @@ int smlua_func_djui_menu_get_font(UNUSED lua_State* L) { return 1; } +int smlua_func_djui_menu_get_theme(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", "djui_menu_get_theme", 0, top); + return 0; + } + + + smlua_push_object(L, LOT_DJUITHEME, djui_menu_get_theme()); + + return 1; +} + int smlua_func_djui_popup_create_global(lua_State* L) { if (L == NULL) { return 0; } @@ -34992,6 +35007,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "djui_is_playerlist_open", smlua_func_djui_is_playerlist_open); smlua_bind_function(L, "djui_is_popup_disabled", smlua_func_djui_is_popup_disabled); smlua_bind_function(L, "djui_menu_get_font", smlua_func_djui_menu_get_font); + smlua_bind_function(L, "djui_menu_get_theme", smlua_func_djui_menu_get_theme); smlua_bind_function(L, "djui_popup_create_global", smlua_func_djui_popup_create_global); smlua_bind_function(L, "djui_reset_popup_disabled_override", smlua_func_djui_reset_popup_disabled_override); smlua_bind_function(L, "djui_set_popup_disabled_override", smlua_func_djui_set_popup_disabled_override); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index 0af4bd1c5..53079000e 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -20,6 +20,7 @@ #include "pc/djui/djui_console.h" #include "pc/djui/djui_hud_utils.h" #include "pc/djui/djui_panel_playerlist.h" +#include "pc/djui/djui_theme.h" #include "game/skybox.h" #include "pc/gfx/gfx_pc.h" #include "include/course_table.h" @@ -103,6 +104,10 @@ enum DjuiFontType djui_menu_get_font(void) { return configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED; } +struct DjuiTheme* djui_menu_get_theme(void) { + return gDjuiThemes[configDjuiTheme]; +} + /// extern s8 gDialogBoxState; diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index b9a11d2eb..22847c9a6 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -52,6 +52,7 @@ void djui_reset_popup_disabled_override(void); bool djui_is_playerlist_open(void); bool djui_attempting_to_open_playerlist(void); enum DjuiFontType djui_menu_get_font(void); +struct DjuiTheme* djui_menu_get_theme(void); s8 get_dialog_box_state(void); s16 get_dialog_id(void);