custom animations no dynos (#371)

Load animations with smlua_anim_util_register_animation and set them with smlua_anim_util_set_animation.
This commit is contained in:
PeachyPeach 2023-04-29 06:00:17 +02:00 committed by GitHub
parent 08d31b8255
commit 2aa6e1aa08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1664 additions and 1350 deletions

View File

@ -47,6 +47,7 @@ in_files = [
"src/pc/lua/utils/smlua_text_utils.h",
"src/pc/lua/utils/smlua_audio_utils.h",
"src/pc/lua/utils/smlua_level_utils.h",
"src/pc/lua/utils/smlua_anim_utils.h",
"src/pc/lua/utils/smlua_deprecated.h",
"src/game/object_helpers.c",
"src/game/obj_behaviors.c",
@ -104,6 +105,7 @@ override_disallowed_functions = {
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown"],
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw", "djui_hud_render_texture_tile", "djui_hud_render_texture_tile_raw" ],
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear", "lag_compensation_store" ],
}

View File

@ -7868,6 +7868,19 @@ function save_file_set_star_flags(fileIndex, courseIndex, starFlags)
-- ...
end
--- @param obj Object
--- @return string
function smlua_anim_util_get_current_animation_name(obj)
-- ...
end
--- @param obj Object
--- @param name string
--- @return nil
function smlua_anim_util_set_animation(obj, name)
-- ...
end
--- @param audio BassAudio
--- @return nil
function audio_sample_destroy(audio)

View File

@ -222,6 +222,19 @@ function djui_hud_render_texture_tile_interpolated(texInfo, prevX, prevY, prevSc
-- ...
end
--- @param name string
--- @param flags integer
--- @param animYTransDivisor integer
--- @param startFrame integer
--- @param loopStart integer
--- @param loopEnd integer
--- @param values table
--- @param index table
--- @return nil
function smlua_anim_util_register_animation(name, flags, animYTransDivisor, startFrame, loopStart, loopEnd, values, index)
-- ...
end
--- @param levelNum number
--- @param func fun(areaIndex:number, bhvData:table, macroBhvIds:table, macroBhvArgs:table)
--- @return nil

View File

@ -4,6 +4,7 @@ extern "C" {
#include "game/level_update.h"
#include "game/object_list_processor.h"
#include "pc/configfile.h"
#include "pc/lua/utils/smlua_anim_utils.h"
}
//
@ -25,7 +26,7 @@ static s32 RetrieveCurrentMarioAnimationIndex(u32 aPlayerIndex) {
// Retrieve the current animation index
// As we don't know the length of the table, let's hope that we'll always find the animation...
static s32 RetrieveCurrentAnimationIndex(struct Object *aObject) {
if (!aObject->oAnimations || !aObject->header.gfx.animInfo.curAnim) {
if (!aObject->oAnimations || !aObject->header.gfx.animInfo.curAnim || smlua_anim_util_get_current_animation_name(aObject)) {
return -1;
}
for (s32 i = 0; aObject->oAnimations[i] != NULL; ++i) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1459,6 +1459,12 @@
<br />
- smlua_anim_utils.h
- [smlua_anim_util_get_current_animation_name](functions-4.md#smlua_anim_util_get_current_animation_name)
- [smlua_anim_util_set_animation](functions-4.md#smlua_anim_util_set_animation)
<br />
- smlua_audio_utils.h
- [audio_sample_destroy](functions-4.md#audio_sample_destroy)
- [audio_sample_load](functions-4.md#audio_sample_load)
@ -1524,75 +1530,75 @@
<br />
- smlua_misc_utils.h
- [add_scroll_target](functions-4.md#add_scroll_target)
- [allocate_mario_action](functions-4.md#allocate_mario_action)
- [camera_config_enable_analog_cam](functions-4.md#camera_config_enable_analog_cam)
- [camera_config_enable_free_cam](functions-4.md#camera_config_enable_free_cam)
- [camera_config_enable_mouse_look](functions-4.md#camera_config_enable_mouse_look)
- [camera_config_get_aggression](functions-4.md#camera_config_get_aggression)
- [camera_config_get_deceleration](functions-4.md#camera_config_get_deceleration)
- [camera_config_get_pan_level](functions-4.md#camera_config_get_pan_level)
- [camera_config_get_x_sensitivity](functions-4.md#camera_config_get_x_sensitivity)
- [camera_config_get_y_sensitivity](functions-4.md#camera_config_get_y_sensitivity)
- [camera_config_invert_x](functions-4.md#camera_config_invert_x)
- [camera_config_invert_y](functions-4.md#camera_config_invert_y)
- [camera_config_is_analog_cam_enabled](functions-4.md#camera_config_is_analog_cam_enabled)
- [camera_config_is_free_cam_enabled](functions-4.md#camera_config_is_free_cam_enabled)
- [camera_config_is_mouse_look_enabled](functions-4.md#camera_config_is_mouse_look_enabled)
- [camera_config_is_x_inverted](functions-4.md#camera_config_is_x_inverted)
- [camera_config_is_y_inverted](functions-4.md#camera_config_is_y_inverted)
- [camera_config_set_aggression](functions-4.md#camera_config_set_aggression)
- [camera_config_set_deceleration](functions-4.md#camera_config_set_deceleration)
- [camera_config_set_pan_level](functions-4.md#camera_config_set_pan_level)
- [camera_config_set_x_sensitivity](functions-4.md#camera_config_set_x_sensitivity)
- [camera_config_set_y_sensitivity](functions-4.md#camera_config_set_y_sensitivity)
- [camera_freeze](functions-4.md#camera_freeze)
- [camera_is_frozen](functions-4.md#camera_is_frozen)
- [camera_unfreeze](functions-4.md#camera_unfreeze)
- [course_is_main_course](functions-4.md#course_is_main_course)
- [deref_s32_pointer](functions-4.md#deref_s32_pointer)
- [get_current_save_file_num](functions-4.md#get_current_save_file_num)
- [get_dialog_box_state](functions-4.md#get_dialog_box_state)
- [get_dialog_id](functions-4.md#get_dialog_id)
- [get_envfx](functions-4.md#get_envfx)
- [get_environment_region](functions-4.md#get_environment_region)
- [get_hand_foot_pos_x](functions-4.md#get_hand_foot_pos_x)
- [get_hand_foot_pos_y](functions-4.md#get_hand_foot_pos_y)
- [get_hand_foot_pos_z](functions-4.md#get_hand_foot_pos_z)
- [get_last_star_or_key](functions-4.md#get_last_star_or_key)
- [get_lighting_dir](functions-4.md#get_lighting_dir)
- [get_network_area_timer](functions-4.md#get_network_area_timer)
- [get_os_name](functions-4.md#get_os_name)
- [get_skybox](functions-4.md#get_skybox)
- [get_temp_s32_pointer](functions-4.md#get_temp_s32_pointer)
- [get_time](functions-4.md#get_time)
- [get_ttc_speed_setting](functions-4.md#get_ttc_speed_setting)
- [hud_get_value](functions-4.md#hud_get_value)
- [hud_hide](functions-4.md#hud_hide)
- [hud_is_hidden](functions-4.md#hud_is_hidden)
- [hud_render_power_meter](functions-4.md#hud_render_power_meter)
- [hud_render_power_meter_interpolated](functions-4.md#hud_render_power_meter_interpolated)
- [hud_set_value](functions-4.md#hud_set_value)
- [hud_show](functions-4.md#hud_show)
- [is_game_paused](functions-4.md#is_game_paused)
- [is_transition_playing](functions-4.md#is_transition_playing)
- [movtexqc_register](functions-4.md#movtexqc_register)
- [play_transition](functions-4.md#play_transition)
- [save_file_set_using_backup_slot](functions-4.md#save_file_set_using_backup_slot)
- [set_environment_region](functions-4.md#set_environment_region)
- [set_last_star_or_key](functions-4.md#set_last_star_or_key)
- [set_lighting_dir](functions-4.md#set_lighting_dir)
- [set_override_envfx](functions-4.md#set_override_envfx)
- [set_override_far](functions-4.md#set_override_far)
- [set_override_fov](functions-4.md#set_override_fov)
- [set_override_near](functions-4.md#set_override_near)
- [set_override_skybox](functions-4.md#set_override_skybox)
- [set_ttc_speed_setting](functions-4.md#set_ttc_speed_setting)
- [add_scroll_target](functions-5.md#add_scroll_target)
- [allocate_mario_action](functions-5.md#allocate_mario_action)
- [camera_config_enable_analog_cam](functions-5.md#camera_config_enable_analog_cam)
- [camera_config_enable_free_cam](functions-5.md#camera_config_enable_free_cam)
- [camera_config_enable_mouse_look](functions-5.md#camera_config_enable_mouse_look)
- [camera_config_get_aggression](functions-5.md#camera_config_get_aggression)
- [camera_config_get_deceleration](functions-5.md#camera_config_get_deceleration)
- [camera_config_get_pan_level](functions-5.md#camera_config_get_pan_level)
- [camera_config_get_x_sensitivity](functions-5.md#camera_config_get_x_sensitivity)
- [camera_config_get_y_sensitivity](functions-5.md#camera_config_get_y_sensitivity)
- [camera_config_invert_x](functions-5.md#camera_config_invert_x)
- [camera_config_invert_y](functions-5.md#camera_config_invert_y)
- [camera_config_is_analog_cam_enabled](functions-5.md#camera_config_is_analog_cam_enabled)
- [camera_config_is_free_cam_enabled](functions-5.md#camera_config_is_free_cam_enabled)
- [camera_config_is_mouse_look_enabled](functions-5.md#camera_config_is_mouse_look_enabled)
- [camera_config_is_x_inverted](functions-5.md#camera_config_is_x_inverted)
- [camera_config_is_y_inverted](functions-5.md#camera_config_is_y_inverted)
- [camera_config_set_aggression](functions-5.md#camera_config_set_aggression)
- [camera_config_set_deceleration](functions-5.md#camera_config_set_deceleration)
- [camera_config_set_pan_level](functions-5.md#camera_config_set_pan_level)
- [camera_config_set_x_sensitivity](functions-5.md#camera_config_set_x_sensitivity)
- [camera_config_set_y_sensitivity](functions-5.md#camera_config_set_y_sensitivity)
- [camera_freeze](functions-5.md#camera_freeze)
- [camera_is_frozen](functions-5.md#camera_is_frozen)
- [camera_unfreeze](functions-5.md#camera_unfreeze)
- [course_is_main_course](functions-5.md#course_is_main_course)
- [deref_s32_pointer](functions-5.md#deref_s32_pointer)
- [get_current_save_file_num](functions-5.md#get_current_save_file_num)
- [get_dialog_box_state](functions-5.md#get_dialog_box_state)
- [get_dialog_id](functions-5.md#get_dialog_id)
- [get_envfx](functions-5.md#get_envfx)
- [get_environment_region](functions-5.md#get_environment_region)
- [get_hand_foot_pos_x](functions-5.md#get_hand_foot_pos_x)
- [get_hand_foot_pos_y](functions-5.md#get_hand_foot_pos_y)
- [get_hand_foot_pos_z](functions-5.md#get_hand_foot_pos_z)
- [get_last_star_or_key](functions-5.md#get_last_star_or_key)
- [get_lighting_dir](functions-5.md#get_lighting_dir)
- [get_network_area_timer](functions-5.md#get_network_area_timer)
- [get_os_name](functions-5.md#get_os_name)
- [get_skybox](functions-5.md#get_skybox)
- [get_temp_s32_pointer](functions-5.md#get_temp_s32_pointer)
- [get_time](functions-5.md#get_time)
- [get_ttc_speed_setting](functions-5.md#get_ttc_speed_setting)
- [hud_get_value](functions-5.md#hud_get_value)
- [hud_hide](functions-5.md#hud_hide)
- [hud_is_hidden](functions-5.md#hud_is_hidden)
- [hud_render_power_meter](functions-5.md#hud_render_power_meter)
- [hud_render_power_meter_interpolated](functions-5.md#hud_render_power_meter_interpolated)
- [hud_set_value](functions-5.md#hud_set_value)
- [hud_show](functions-5.md#hud_show)
- [is_game_paused](functions-5.md#is_game_paused)
- [is_transition_playing](functions-5.md#is_transition_playing)
- [movtexqc_register](functions-5.md#movtexqc_register)
- [play_transition](functions-5.md#play_transition)
- [save_file_set_using_backup_slot](functions-5.md#save_file_set_using_backup_slot)
- [set_environment_region](functions-5.md#set_environment_region)
- [set_last_star_or_key](functions-5.md#set_last_star_or_key)
- [set_lighting_dir](functions-5.md#set_lighting_dir)
- [set_override_envfx](functions-5.md#set_override_envfx)
- [set_override_far](functions-5.md#set_override_far)
- [set_override_fov](functions-5.md#set_override_fov)
- [set_override_near](functions-5.md#set_override_near)
- [set_override_skybox](functions-5.md#set_override_skybox)
- [set_ttc_speed_setting](functions-5.md#set_ttc_speed_setting)
<br />
- smlua_model_utils.h
- [smlua_model_util_get_id](functions-4.md#smlua_model_util_get_id)
- [smlua_model_util_get_id](functions-5.md#smlua_model_util_get_id)
<br />

View File

@ -7,6 +7,7 @@
#include "pc/lua/utils/smlua_audio_utils.h"
#include "pc/lua/utils/smlua_model_utils.h"
#include "pc/lua/utils/smlua_level_utils.h"
#include "pc/lua/utils/smlua_anim_utils.h"
#include "pc/djui/djui.h"
lua_State* gLuaState = NULL;
@ -198,6 +199,7 @@ void smlua_shutdown(void) {
smlua_clear_hooks();
smlua_model_util_reset();
smlua_level_util_reset();
smlua_anim_util_reset();
lua_State* L = gLuaState;
if (L != NULL) {
lua_close(L);

View File

@ -13,6 +13,7 @@
#include "pc/djui/djui_hud_utils.h"
#include "include/level_misc_macros.h"
#include "include/macro_presets.h"
#include "utils/smlua_anim_utils.h"
bool smlua_functions_valid_param_count(lua_State* L, int expected) {
int top = lua_gettop(L);
@ -647,6 +648,69 @@ void smlua_func_level_script_parse(lua_State* L) {
gLevelScriptModIndex = currModIndex;
}
///////////////////////
// custom animations //
///////////////////////
static u16 *smlua_to_u16_list(lua_State* L, int index) {
// Get number of values
s32 length = lua_rawlen(L, index);
if (!length) { LOG_LUA("smlua_to_u16_list: Table must not be empty"); return NULL; }
u16 *values = calloc(length, sizeof(u16));
// Retrieve values
lua_pushnil(L);
s32 top = lua_gettop(L);
while (lua_next(L, index) != 0) {
int indexKey = lua_gettop(L) - 1;
int indexValue = lua_gettop(L) - 0;
s32 key = smlua_to_integer(L, indexKey);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_to_u16_list: Failed to convert table key"); return 0; }
u16 value = smlua_to_integer(L, indexValue);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_to_u16_list: Failed to convert table value"); return 0; }
values[key - 1] = value;
lua_settop(L, top);
}
lua_settop(L, top);
return values;
}
int smlua_func_smlua_anim_util_register_animation(lua_State* L) {
if (!smlua_functions_valid_param_count(L, 8)) { return 0; }
const char *name = smlua_to_string(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'name'"); return 0; }
s16 flags = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'flags'"); return 0; }
s16 animYTransDivisor = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'animYTransDivisor'"); return 0; }
s16 startFrame = smlua_to_integer(L, 4);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'startFrame'"); return 0; }
s16 loopStart = smlua_to_integer(L, 5);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'loopStart'"); return 0; }
s16 loopEnd = smlua_to_integer(L, 6);
if (!gSmLuaConvertSuccess) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'loopEnd'"); return 0; }
s16 *values = (s16 *) smlua_to_u16_list(L, 7);
if (!values) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'values'"); return 0; }
u16 *index = (u16 *) smlua_to_u16_list(L, 8);
if (!index) { LOG_LUA("smlua_anim_util_register_animation: Failed to convert parameter 'index'"); return 0; }
smlua_anim_util_register_animation(name, flags, animYTransDivisor, startFrame, loopStart, loopEnd, values, index);
return 1;
}
//////////
// bind //
//////////
@ -671,4 +735,5 @@ void smlua_bind_functions(void) {
smlua_bind_function(L, "djui_hud_render_texture_interpolated", smlua_func_djui_hud_render_texture_interpolated);
smlua_bind_function(L, "djui_hud_render_texture_tile_interpolated", smlua_func_djui_hud_render_texture_tile_interpolated);
smlua_bind_function(L, "level_script_parse", smlua_func_level_script_parse);
smlua_bind_function(L, "smlua_anim_util_register_animation", smlua_func_smlua_anim_util_register_animation);
}

View File

@ -30,6 +30,7 @@
#include "src/pc/lua/utils/smlua_text_utils.h"
#include "src/pc/lua/utils/smlua_audio_utils.h"
#include "src/pc/lua/utils/smlua_level_utils.h"
#include "src/pc/lua/utils/smlua_anim_utils.h"
#include "src/pc/lua/utils/smlua_deprecated.h"
#include "src/game/object_list_processor.h"
#include "src/game/behavior_actions.h"
@ -25850,6 +25851,46 @@ int smlua_func_save_file_set_star_flags(lua_State* L) {
return 1;
}
////////////////////////
// smlua_anim_utils.h //
////////////////////////
int smlua_func_smlua_anim_util_get_current_animation_name(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", "smlua_anim_util_get_current_animation_name", 1, top);
return 0;
}
struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_anim_util_get_current_animation_name"); return 0; }
lua_pushstring(L, smlua_anim_util_get_current_animation_name(obj));
return 1;
}
int smlua_func_smlua_anim_util_set_animation(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", "smlua_anim_util_set_animation", 2, top);
return 0;
}
struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_anim_util_set_animation"); return 0; }
const char* name = smlua_to_string(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "smlua_anim_util_set_animation"); return 0; }
smlua_anim_util_set_animation(obj, name);
return 1;
}
/////////////////////////
// smlua_audio_utils.h //
/////////////////////////
@ -30705,6 +30746,10 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "save_file_set_flags", smlua_func_save_file_set_flags);
smlua_bind_function(L, "save_file_set_star_flags", smlua_func_save_file_set_star_flags);
// smlua_anim_utils.h
smlua_bind_function(L, "smlua_anim_util_get_current_animation_name", smlua_func_smlua_anim_util_get_current_animation_name);
smlua_bind_function(L, "smlua_anim_util_set_animation", smlua_func_smlua_anim_util_set_animation);
// smlua_audio_utils.h
smlua_bind_function(L, "audio_sample_destroy", smlua_func_audio_sample_destroy);
smlua_bind_function(L, "audio_sample_load", smlua_func_audio_sample_load);

View File

@ -87,3 +87,116 @@ struct GlobalObjectAnimations gGlobalObjectAnimations = {
.wiggler_seg5_anims_0500EC8C = (struct Animation**) wiggler_seg5_anims_0500EC8C,
.yoshi_seg5_anims_05024100 = (struct Animation**) yoshi_seg5_anims_05024100,
};
///////////////////////
// custom animations //
///////////////////////
struct CustomAnimation {
const char *name;
struct Animation *anim;
struct CustomAnimation *next;
};
struct CustomAnimation* sCustomAnimationHead = NULL;
static struct CustomAnimation *get_custom_animation_node(const char *name) {
for (struct CustomAnimation *node = sCustomAnimationHead; node; node = node->next) {
if (node->name && strcmp(node->name, name) == 0) {
return node;
}
}
return NULL;
}
void smlua_anim_util_reset() {
for (struct CustomAnimation *node = sCustomAnimationHead; node;) {
struct CustomAnimation *next = node->next;
if (node->name) {
free((void *) node->name);
}
if (node->anim) {
if (node->anim->index) {
free((void *) node->anim->index);
}
if (node->anim->values) {
free((void *) node->anim->values);
}
}
free(node);
node = next;
}
sCustomAnimationHead = NULL;
}
void smlua_anim_util_register_animation(const char *name, s16 flags, s16 animYTransDivisor, s16 startFrame, s16 loopStart, s16 loopEnd, const s16 *values, const u16 *index) {
// NULL-checks
if (!name) {
LOG_LUA_LINE("smlua_anim_util_register_animation: Parameter 'name' is NULL");
return;
}
// Check if the name is not already taken
if (get_custom_animation_node(name)) {
LOG_LUA_LINE("smlua_anim_util_register_animation: An animation named '%s' already exists", name);
return;
}
// Create a new node
struct CustomAnimation *node = calloc(1, sizeof(struct CustomAnimation));
node->name = strdup(name);
node->anim = calloc(1, sizeof(struct Animation));
node->anim->flags = flags;
node->anim->animYTransDivisor = animYTransDivisor;
node->anim->startFrame = startFrame;
node->anim->loopStart = loopStart;
node->anim->loopEnd = loopEnd;
node->anim->unusedBoneCount = 0;
node->anim->values = values;
node->anim->index = index;
node->anim->length = 0;
node->next = sCustomAnimationHead;
sCustomAnimationHead = node;
LOG_INFO("Registered custom animation: %s", name);
}
void smlua_anim_util_set_animation(struct Object *obj, const char *name) {
// NULL-checks
if (!obj) {
LOG_LUA_LINE("smlua_anim_util_set_animation: Parameter 'obj' is NULL");
return;
}
if (!name) {
LOG_LUA_LINE("smlua_anim_util_set_animation: Parameter 'name' is NULL");
return;
}
// Check if the animation exists
struct CustomAnimation *node = get_custom_animation_node(name);
if (!node) {
LOG_LUA_LINE("smlua_anim_util_set_animation: Animation '%s' doesn't exist", name);
return;
}
// Set animation
obj->header.gfx.animInfo.curAnim = node->anim;
}
const char *smlua_anim_util_get_current_animation_name(struct Object *obj) {
// NULL-checks
if (!obj) {
LOG_LUA_LINE("smlua_anim_util_set_animation: Parameter 'obj' is NULL");
return NULL;
}
// Check the animations
for (struct CustomAnimation *node = sCustomAnimationHead; node; node = node->next) {
if (node->anim == obj->header.gfx.animInfo.curAnim) {
return node->name;
}
}
return NULL;
}

View File

@ -1,6 +1,8 @@
#ifndef SMLUA_ANIM_UTILS_H
#define SMLUA_ANIM_UTILS_H
#include "types.h"
typedef struct Animation* ObjectAnimPointer;
struct GlobalObjectAnimations {
@ -64,4 +66,9 @@ struct GlobalObjectAnimations {
extern struct GlobalObjectAnimations gGlobalObjectAnimations;
void smlua_anim_util_reset();
void smlua_anim_util_register_animation(const char *name, s16 flags, s16 animYTransDivisor, s16 startFrame, s16 loopStart, s16 loopEnd, const s16 *values, const u16 *index);
void smlua_anim_util_set_animation(struct Object *obj, const char *name);
const char *smlua_anim_util_get_current_animation_name(struct Object *obj);
#endif