diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 744aaa7ff..06794286b 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5200,7 +5200,7 @@ function set_anim_to_frame(m, animFrame) end --- @param m MarioState ---- @param targetAnimID integer +--- @param targetAnimID CharacterAnimID --- @param accel integer --- @return integer --- Sets a character-specific animation where the animation speed is adjusted by `accel`. Useful for varying animation speeds based on context or dynamic conditions (e.g., slow-motion) @@ -5209,7 +5209,7 @@ function set_character_anim_with_accel(m, targetAnimID, accel) end --- @param m MarioState ---- @param targetAnimID integer +--- @param targetAnimID CharacterAnimID --- @return integer --- Sets the character-specific animation at its default rate (no acceleration) function set_character_animation(m, targetAnimID) diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 9c5d15548..db52c20f1 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -929,14 +929,14 @@ Sets a character-specific animation where the animation speed is adjusted by `ac | Field | Type | | ----- | ---- | | m | [MarioState](structs.md#MarioState) | -| targetAnimID | `integer` | +| targetAnimID | [enum CharacterAnimID](constants.md#enum-CharacterAnimID) | | accel | `integer` | ### Returns - `integer` ### C Prototype -`s16 set_character_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel);` +`s16 set_character_anim_with_accel(struct MarioState *m, enum CharacterAnimID targetAnimID, s32 accel);` [:arrow_up_small:](#) @@ -954,13 +954,13 @@ Sets the character-specific animation at its default rate (no acceleration) | Field | Type | | ----- | ---- | | m | [MarioState](structs.md#MarioState) | -| targetAnimID | `integer` | +| targetAnimID | [enum CharacterAnimID](constants.md#enum-CharacterAnimID) | ### Returns - `integer` ### C Prototype -`s16 set_character_animation(struct MarioState *m, s32 targetAnimID);` +`s16 set_character_animation(struct MarioState *m, enum CharacterAnimID targetAnimID);` [:arrow_up_small:](#) diff --git a/src/game/mario.c b/src/game/mario.c index 6a5c53178..683c32a4b 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -117,13 +117,6 @@ s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) { return mario_set_animation_internal(m, targetAnimID, 0x10000); } -/** - * Sets the character specific animation without any acceleration, running at its default rate. - */ -s16 set_character_animation(struct MarioState *m, s32 targetAnimID) { - return mario_set_animation_internal(m, get_character_anim(m, targetAnimID), 0x10000); -} - /** * Sets Mario's animation where the animation is sped up or * slowed down via acceleration. @@ -132,11 +125,18 @@ s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) return mario_set_animation_internal(m, targetAnimID, accel); } +/** + * Sets the character specific animation without any acceleration, running at its default rate. + */ +s16 set_character_animation(struct MarioState *m, enum CharacterAnimID targetAnimID) { + return mario_set_animation_internal(m, get_character_anim(m, targetAnimID), 0x10000); +} + /** * Sets character specific animation where the animation is sped up or * slowed down via acceleration. */ -s16 set_character_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) { +s16 set_character_anim_with_accel(struct MarioState *m, enum CharacterAnimID targetAnimID, s32 accel) { return mario_set_animation_internal(m, get_character_anim(m, targetAnimID), accel); } diff --git a/src/game/mario.h b/src/game/mario.h index a774656e7..e6245cfde 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -35,13 +35,13 @@ s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) /* |description| Sets the character-specific animation at its default rate (no acceleration) |descriptionEnd| */ -s16 set_character_animation(struct MarioState *m, s32 targetAnimID); +s16 set_character_animation(struct MarioState *m, enum CharacterAnimID targetAnimID); /* |description| Sets a character-specific animation where the animation speed is adjusted by `accel`. Useful for varying animation speeds based on context or dynamic conditions (e.g., slow-motion) |descriptionEnd| */ -s16 set_character_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel); +s16 set_character_anim_with_accel(struct MarioState *m, enum CharacterAnimID targetAnimID, s32 accel); /* |description| Sets the current animation frame to a specific `animFrame` diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 5db342f22..ec19820b2 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15915,7 +15915,7 @@ int smlua_func_set_character_anim_with_accel(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_character_anim_with_accel"); return 0; } - s32 targetAnimID = smlua_to_integer(L, 2); + int targetAnimID = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_character_anim_with_accel"); return 0; } s32 accel = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_character_anim_with_accel"); return 0; } @@ -15936,7 +15936,7 @@ int smlua_func_set_character_animation(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_character_animation"); return 0; } - s32 targetAnimID = smlua_to_integer(L, 2); + int targetAnimID = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_character_animation"); return 0; } lua_pushinteger(L, set_character_animation(m, targetAnimID)); diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 5c78ff57b..1c5cedf1c 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -33,6 +33,7 @@ #include "game/ingame_menu.h" #include "game/first_person_cam.h" #include "game/envfx_snow.h" +#include "game/mario.h" #include "engine/math_util.h" #include "engine/lighting_engine.h"