mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-03 14:42:39 +00:00
Fixed the playerlist and modlist not updating their themes and added djui_menu_get_theme() (#519)
* Fixed the playerlist and modlist not updating their theme instantly * Added djui_menu_get_theme() * Removed text * Fixed syntax error
This commit is contained in:
parent
620f555200
commit
e4fd83bec7
13 changed files with 194 additions and 0 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2099,6 +2099,24 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [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:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [djui_popup_create_global](#djui_popup_create_global)
|
||||
|
||||
### Lua Example
|
||||
|
|
@ -5168,6 +5186,26 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [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:](#)
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
|
||||
[< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
<br />
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [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:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [DjuiPanelTheme](#DjuiPanelTheme)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| hudFontHeader | `boolean` | |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [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:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [DjuiThreePanelTheme](#DjuiThreePanelTheme)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| borderColor | [DjuiColor](structs.md#DjuiColor) | read-only |
|
||||
| rectColor | [DjuiColor](structs.md#DjuiColor) | read-only |
|
||||
=======
|
||||
## [ExclamationBoxContent](#ExclamationBoxContent)
|
||||
|
||||
| Field | Type | Access |
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue