diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 9027ef196..f7576d7cc 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -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 = { diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index ffe5fef42..b44d4c528 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -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` diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 8e71c536b..7e69bb97d 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -3360,6 +3360,32 @@ Gets a language `key` from a `section`
+--- +# functions from djui_panel_menu.c + +
+ + +## [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:](#) + +
+ --- # functions from djui_popup.h diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 0d3951f35..8582f594a 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -781,6 +781,11 @@
+- djui_panel_menu.c + - [djui_menu_get_rainbow_string_color](functions-3.md#djui_menu_get_rainbow_string_color) + +
+ - djui_popup.h - [djui_popup_create](functions-3.md#djui_popup_create) diff --git a/src/pc/djui/djui_panel_menu.c b/src/pc/djui/djui_panel_menu.c index 552cba5b3..387a6d995 100644 --- a/src/pc/djui/djui_panel_menu.c +++ b/src/pc/djui/djui_panel_menu.c @@ -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(); } diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 516da63d8..8b688e936 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -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);