From 1f3af25805ffb8f2f03773ab36d2f3b631242c4a Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Sun, 19 May 2024 12:42:24 -0400 Subject: [PATCH] Expose fade_into_special_warp --- autogen/convert_functions.py | 2 +- autogen/lua_definitions/functions.lua | 7 +++++++ docs/lua/functions-3.md | 21 +++++++++++++++++++++ docs/lua/functions.md | 1 + src/game/level_update.c | 2 +- src/pc/lua/smlua_functions_autogen.c | 20 ++++++++++++++++++++ 6 files changed, 51 insertions(+), 2 deletions(-) diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 213c7a7a..6aaf9811 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -75,7 +75,7 @@ override_allowed_functions = { "src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ], "src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ], "src/pc/utils/misc.h": [ "update_all_mario_stars" ], - "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running" ], + "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running", "fade_into_special_warp" ], "src/game/area.h": [ "area_get_warp_node" ], "src/engine/level_script.h": [ "area_create_warp_node" ], "src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "close_dialog_box", ] diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 316b7453..9734fb4a 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -4503,6 +4503,13 @@ function area_create_warp_node(id, destLevel, destArea, destNode, checkpoint, o) -- ... end +--- @param arg integer +--- @param color integer +--- @return nil +function fade_into_special_warp(arg, color) + -- ... +end + --- @return WarpNode function get_painting_warp_node() -- ... diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 81038747..1e99c6be 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -4766,6 +4766,27 @@
+## [fade_into_special_warp](#fade_into_special_warp) + +### Lua Example +`fade_into_special_warp(arg, color)` + +### Parameters +| Field | Type | +| ----- | ---- | +| arg | `integer` | +| color | `integer` | + +### Returns +- None + +### C Prototype +`void fade_into_special_warp(u32 arg, u32 color);` + +[:arrow_up_small:](#) + +
+ ## [get_painting_warp_node](#get_painting_warp_node) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index fb203006..82ed69d7 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -893,6 +893,7 @@
- level_update.h + - [fade_into_special_warp](functions-3.md#fade_into_special_warp) - [get_painting_warp_node](functions-3.md#get_painting_warp_node) - [initiate_painting_warp](functions-3.md#initiate_painting_warp) - [level_control_timer_running](functions-3.md#level_control_timer_running) diff --git a/src/game/level_update.c b/src/game/level_update.c index 3a326401..214e3c72 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -270,7 +270,7 @@ void set_play_mode(s16 playMode) { } void warp_special(s32 arg) { - if (arg != SPECIAL_WARP_CAKE && arg != SPECIAL_WARP_GODDARD && arg != SPECIAL_WARP_GODDARD_GAMEOVER && arg != SPECIAL_WARP_TITLE && arg != SPECIAL_WARP_LEVEL_SELECT) { + if (arg != 0 && arg != SPECIAL_WARP_CAKE && arg != SPECIAL_WARP_GODDARD && arg != SPECIAL_WARP_GODDARD_GAMEOVER && arg != SPECIAL_WARP_TITLE && arg != SPECIAL_WARP_LEVEL_SELECT) { LOG_ERROR("Invalid parameter value for warp_special: Expected SPECIAL_WARP_CAKE, SPECIAL_WARP_GODDARD, SPECIAL_WARP_GODDARD_GAMEOVER, SPECIAL_WARP_TITLE, or SPECIAL_WARP_LEVEL_SELECT"); return; } diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 5edf2f72..1fda6548 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -14559,6 +14559,25 @@ int smlua_func_area_create_warp_node(lua_State* L) { // level_update.h // //////////////////// +int smlua_func_fade_into_special_warp(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "fade_into_special_warp", 2, top); + return 0; + } + + u32 arg = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fade_into_special_warp"); return 0; } + u32 color = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fade_into_special_warp"); return 0; } + + fade_into_special_warp(arg, color); + + return 1; +} + int smlua_func_get_painting_warp_node(UNUSED lua_State* L) { if (L == NULL) { return 0; } @@ -33289,6 +33308,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "area_create_warp_node", smlua_func_area_create_warp_node); // level_update.h + smlua_bind_function(L, "fade_into_special_warp", smlua_func_fade_into_special_warp); smlua_bind_function(L, "get_painting_warp_node", smlua_func_get_painting_warp_node); smlua_bind_function(L, "initiate_painting_warp", smlua_func_initiate_painting_warp); smlua_bind_function(L, "level_control_timer_running", smlua_func_level_control_timer_running);