From ad2e84ed306fe07c7f1f9ed4d2d53e7d7e96d95b Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Mon, 8 Jul 2024 22:13:41 -0400 Subject: [PATCH] Expose get_mario_cap_flag() --- autogen/lua_definitions/functions.lua | 6 ++++++ docs/lua/functions-3.md | 20 ++++++++++++++++++++ docs/lua/functions.md | 1 + src/game/interaction.h | 1 + src/pc/lua/smlua_functions_autogen.c | 18 ++++++++++++++++++ 5 files changed, 46 insertions(+) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 264464f5..aa41ed12 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -3487,6 +3487,12 @@ function get_door_save_file_flag(door) -- ... end +--- @param capObject Object +--- @return integer +function get_mario_cap_flag(capObject) + -- ... +end + --- @param m MarioState --- @param interactType integer --- @param o Object diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 4771eb4b..31f26e04 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -3676,6 +3676,26 @@
+## [get_mario_cap_flag](#get_mario_cap_flag) + +### Lua Example +`local integerValue = get_mario_cap_flag(capObject)` + +### Parameters +| Field | Type | +| ----- | ---- | +| capObject | [Object](structs.md#Object) | + +### Returns +- `integer` + +### C Prototype +`u32 get_mario_cap_flag(struct Object *capObject);` + +[:arrow_up_small:](#) + +
+ ## [interact_bbh_entrance](#interact_bbh_entrance) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 69926a57..69dfcf8a 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -842,6 +842,7 @@ - [determine_interaction](functions-3.md#determine_interaction) - [does_mario_have_normal_cap_on_head](functions-3.md#does_mario_have_normal_cap_on_head) - [get_door_save_file_flag](functions-3.md#get_door_save_file_flag) + - [get_mario_cap_flag](functions-3.md#get_mario_cap_flag) - [interact_bbh_entrance](functions-3.md#interact_bbh_entrance) - [interact_bounce_top](functions-3.md#interact_bounce_top) - [interact_breakable](functions-3.md#interact_breakable) diff --git a/src/game/interaction.h b/src/game/interaction.h index 5485fcf5..9f5526c2 100644 --- a/src/game/interaction.h +++ b/src/game/interaction.h @@ -170,6 +170,7 @@ void mario_handle_special_floors(struct MarioState *m); u8 passes_pvp_interaction_checks(struct MarioState* attacker, struct MarioState* victim); u32 should_push_or_pull_door(struct MarioState *m, struct Object *o); u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o); +u32 get_mario_cap_flag(struct Object *capObject); u32 determine_interaction(struct MarioState *m, struct Object *o); u32 process_interaction(struct MarioState *m, u32 interactType, struct Object *o, u32 (*interact_function)(struct MarioState *, u32 interactType, struct Object *)); diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index bce10dc9..9312bfa5 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -13670,6 +13670,23 @@ int smlua_func_get_door_save_file_flag(lua_State* L) { return 1; } +int smlua_func_get_mario_cap_flag(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", "get_mario_cap_flag", 1, top); + return 0; + } + + struct Object* capObject = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_mario_cap_flag"); return 0; } + + lua_pushinteger(L, get_mario_cap_flag(capObject)); + + return 1; +} + int smlua_func_interact_bbh_entrance(lua_State* L) { if (L == NULL) { return 0; } @@ -33680,6 +33697,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "determine_interaction", smlua_func_determine_interaction); smlua_bind_function(L, "does_mario_have_normal_cap_on_head", smlua_func_does_mario_have_normal_cap_on_head); smlua_bind_function(L, "get_door_save_file_flag", smlua_func_get_door_save_file_flag); + smlua_bind_function(L, "get_mario_cap_flag", smlua_func_get_mario_cap_flag); smlua_bind_function(L, "interact_bbh_entrance", smlua_func_interact_bbh_entrance); smlua_bind_function(L, "interact_bounce_top", smlua_func_interact_bounce_top); smlua_bind_function(L, "interact_breakable", smlua_func_interact_breakable);