From 1f1683815e9b534b3f57c3440656929e8bc58985 Mon Sep 17 00:00:00 2001 From: Amy54Desu <69287652+Amy54Desu@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:38:52 +0900 Subject: [PATCH] HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS (#591) --- autogen/lua_definitions/constants.lua | 5 ++++- docs/lua/constants.md | 3 ++- src/game/mario.c | 4 ++++ src/pc/lua/smlua_constants_autogen.c | 3 ++- src/pc/lua/smlua_hooks.h | 2 ++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 2a4208b79..e5a4cdcb1 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -9167,7 +9167,10 @@ HOOK_BEFORE_GEO_PROCESS = 49 HOOK_ON_GEO_PROCESS_CHILDREN = 50 --- @type LuaHookedEventType -HOOK_MAX = 51 +HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS = 51 + +--- @type LuaHookedEventType +HOOK_MAX = 52 --- @class LuaModMenuElementType diff --git a/docs/lua/constants.md b/docs/lua/constants.md index bd8c28bed..ca72a0d5d 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -3338,7 +3338,8 @@ | HOOK_ON_GEO_PROCESS | 48 | | HOOK_BEFORE_GEO_PROCESS | 49 | | HOOK_ON_GEO_PROCESS_CHILDREN | 50 | -| HOOK_MAX | 51 | +| HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS | 51 | +| HOOK_MAX | 52 | ### [enum LuaModMenuElementType](#LuaModMenuElementType) | Identifier | Value | diff --git a/src/game/mario.c b/src/game/mario.c index b8420b430..6a5c53178 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -1509,6 +1509,10 @@ resetGoto:; f32 gasLevel; f32 ceilToFloorDist; + bool allow = true; + smlua_call_event_hooks_mario_param_ret_bool(HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS, m, &allow); + if (!allow) { return; } + f32_find_wall_collision(&m->pos[0], &m->pos[1], &m->pos[2], 60.0f, 50.0f); f32_find_wall_collision(&m->pos[0], &m->pos[1], &m->pos[2], 30.0f, 24.0f); diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 0ea2d3b1c..32f94e76d 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -3205,7 +3205,8 @@ char gSmluaConstants[] = "" "HOOK_ON_GEO_PROCESS = 48\n" "HOOK_BEFORE_GEO_PROCESS = 49\n" "HOOK_ON_GEO_PROCESS_CHILDREN = 50\n" -"HOOK_MAX = 51\n" +"HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS = 51\n" +"HOOK_MAX = 52\n" "ACTION_HOOK_EVERY_FRAME = 0\n" "ACTION_HOOK_GRAVITY = 1\n" "ACTION_HOOK_MAX = 2\n" diff --git a/src/pc/lua/smlua_hooks.h b/src/pc/lua/smlua_hooks.h index aa52c937e..4b88d04c7 100644 --- a/src/pc/lua/smlua_hooks.h +++ b/src/pc/lua/smlua_hooks.h @@ -62,6 +62,7 @@ enum LuaHookedEventType { HOOK_ON_GEO_PROCESS, HOOK_BEFORE_GEO_PROCESS, HOOK_ON_GEO_PROCESS_CHILDREN, + HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS, HOOK_MAX, }; @@ -117,6 +118,7 @@ static const char* LuaHookedEventTypeName[] = { "HOOK_ON_GEO_PROCESS", "HOOK_BEFORE_GEO_PROCESS", "HOOK_ON_GEO_PROCESS_CHILDREN", + "HOOK_MARIO_OVERRIDE_GEOMETRY_INPUTS", "HOOK_MAX" };