mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Added djui_menu_get_rainbow_string_color() (#536)
* Removed unintentionally exposed function and disallowed it in autogen * Exposed djui_language_get to lua * Added djui_menu_get_rainbow_string_color()
This commit is contained in:
parent
af1e7be9ac
commit
66fb28500b
6 changed files with 70 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ in_files = [
|
|||
"src/game/save_file.h",
|
||||
"src/game/sound_init.h",
|
||||
"src/pc/djui/djui_hud_utils.h",
|
||||
"src/pc/djui/djui_panel_menu.c",
|
||||
"src/pc/network/network_player.h",
|
||||
"src/pc/network/lag_compensation.h",
|
||||
"include/behavior_table.h",
|
||||
|
|
@ -77,6 +78,7 @@ override_allowed_functions = {
|
|||
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
|
||||
"src/pc/djui/djui_popup.h" : [ "create" ],
|
||||
"src/pc/djui/djui_language.h" : [ "djui_language_get" ],
|
||||
"src/pc/djui/djui_panel_menu.c" : [ "djui_menu_get_rainbow_string_color" ],
|
||||
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags", "save_file_erase" ],
|
||||
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
|
||||
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
|
||||
|
|
@ -130,7 +132,7 @@ override_disallowed_functions = {
|
|||
|
||||
override_hide_functions = {
|
||||
"smlua_deprecated.h": [ ".*" ],
|
||||
"network_player.h": [ "network_player_get_palette_color_channel", "network_player_get_override_palette_color_channel" ]
|
||||
"network_player.h": [ "network_player_get_palette_color_channel", "network_player_get_override_palette_color_channel" ]
|
||||
}
|
||||
|
||||
override_function_version_excludes = {
|
||||
|
|
|
|||
|
|
@ -3944,6 +3944,12 @@ function djui_language_get(section, key)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param color integer
|
||||
--- @return string
|
||||
function djui_menu_get_rainbow_string_color(color)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param message string
|
||||
--- @param lines integer
|
||||
--- Creates a popup that says `message` and has `lines`
|
||||
|
|
|
|||
|
|
@ -3360,6 +3360,32 @@ Gets a language `key` from a `section`
|
|||
|
||||
<br />
|
||||
|
||||
---
|
||||
# functions from djui_panel_menu.c
|
||||
|
||||
<br />
|
||||
|
||||
|
||||
## [djui_menu_get_rainbow_string_color](#djui_menu_get_rainbow_string_color)
|
||||
|
||||
### Lua Example
|
||||
`local stringValue = djui_menu_get_rainbow_string_color(color)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| color | `integer` |
|
||||
|
||||
### Returns
|
||||
- `string`
|
||||
|
||||
### C Prototype
|
||||
`char* djui_menu_get_rainbow_string_color(int color);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
---
|
||||
# functions from djui_popup.h
|
||||
|
||||
|
|
|
|||
|
|
@ -781,6 +781,11 @@
|
|||
|
||||
<br />
|
||||
|
||||
- djui_panel_menu.c
|
||||
- [djui_menu_get_rainbow_string_color](functions-3.md#djui_menu_get_rainbow_string_color)
|
||||
|
||||
<br />
|
||||
|
||||
- djui_popup.h
|
||||
- [djui_popup_create](functions-3.md#djui_popup_create)
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@ static void generate_rainbow_text(char* text) {
|
|||
}
|
||||
}
|
||||
|
||||
char* djui_menu_get_rainbow_string_color(int color) {
|
||||
int i = (color >= 0 && color <= 3) ? color : 0;
|
||||
return configExCoopTheme ? sExCoopRainbowColors[i] : sRainbowColors[i];
|
||||
}
|
||||
|
||||
void djui_panel_menu_back(UNUSED struct DjuiBase* base) {
|
||||
djui_panel_back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12796,6 +12796,28 @@ int smlua_func_djui_language_get(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
// djui_panel_menu.c //
|
||||
///////////////////////
|
||||
|
||||
int smlua_func_djui_menu_get_rainbow_string_color(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", "djui_menu_get_rainbow_string_color", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int color = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_menu_get_rainbow_string_color"); return 0; }
|
||||
|
||||
extern char* djui_menu_get_rainbow_string_color(int color);
|
||||
lua_pushstring(L, djui_menu_get_rainbow_string_color(color));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// djui_popup.h //
|
||||
//////////////////
|
||||
|
|
@ -34177,6 +34199,9 @@ void smlua_bind_functions_autogen(void) {
|
|||
// djui_language.h
|
||||
smlua_bind_function(L, "djui_language_get", smlua_func_djui_language_get);
|
||||
|
||||
// djui_panel_menu.c
|
||||
smlua_bind_function(L, "djui_menu_get_rainbow_string_color", smlua_func_djui_menu_get_rainbow_string_color);
|
||||
|
||||
// djui_popup.h
|
||||
smlua_bind_function(L, "djui_popup_create", smlua_func_djui_popup_create);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue