diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index f486314e..0e4480f9 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -37,6 +37,8 @@ in_files = [
"include/behavior_table.h",
"src/pc/lua/smlua_obj_utils.h",
"src/game/object_helpers.c",
+ "src/game/obj_behaviors.c",
+ "src/game/obj_behaviors_2.c",
]
override_allowed_functions = {
@@ -65,6 +67,8 @@ override_disallowed_functions = {
"src/pc/network/network_utils.h": [ "network_get_player_text_color[^_]" ],
"src/pc/network/network_player.h": [ "_init", "_connected[^_]", "_shutdown", "_disconnected", "_update" ],
"src/game/object_helpers.c": [ "spawn_obj" ],
+ "src/game/obj_behaviors.c": [ "debug_" ],
+ "src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
}
###########################################################
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 2df77d63..56160600 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -299,6 +299,89 @@
+- obj_behaviors.c
+ - [absf_2](#absf_2)
+ - [calc_new_obj_vel_and_pos_y](#calc_new_obj_vel_and_pos_y)
+ - [calc_new_obj_vel_and_pos_y_underwater](#calc_new_obj_vel_and_pos_y_underwater)
+ - [calc_obj_friction](#calc_obj_friction)
+ - [current_mario_room_check](#current_mario_room_check)
+ - [is_player_active](#is_player_active)
+ - [is_point_close_to_object](#is_point_close_to_object)
+ - [is_point_within_radius_of_mario](#is_point_within_radius_of_mario)
+ - [nearest_mario_state_to_object](#nearest_mario_state_to_object)
+ - [nearest_player_to_object](#nearest_player_to_object)
+ - [obj_check_floor_death](#obj_check_floor_death)
+ - [obj_check_if_facing_toward_angle](#obj_check_if_facing_toward_angle)
+ - [obj_find_wall](#obj_find_wall)
+ - [obj_find_wall_displacement](#obj_find_wall_displacement)
+ - [obj_flicker_and_disappear](#obj_flicker_and_disappear)
+ - [obj_lava_death](#obj_lava_death)
+ - [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw)
+ - [obj_orient_graph](#obj_orient_graph)
+ - [obj_return_and_displace_home](#obj_return_and_displace_home)
+ - [obj_return_home_if_safe](#obj_return_home_if_safe)
+ - [obj_spawn_yellow_coins](#obj_spawn_yellow_coins)
+ - [obj_splash](#obj_splash)
+ - [obj_update_pos_vel_xz](#obj_update_pos_vel_xz)
+ - [object_step](#object_step)
+ - [object_step_without_floor_orient](#object_step_without_floor_orient)
+ - [set_object_visibility](#set_object_visibility)
+ - [set_yoshi_as_not_dead](#set_yoshi_as_not_dead)
+ - [spawn_orange_number](#spawn_orange_number)
+ - [turn_obj_away_from_steep_floor](#turn_obj_away_from_steep_floor)
+ - [turn_obj_away_from_surface](#turn_obj_away_from_surface)
+
+
+
+- obj_behaviors_2.c
+ - [approach_f32_ptr](#approach_f32_ptr)
+ - [cur_obj_init_anim_and_check_if_end](#cur_obj_init_anim_and_check_if_end)
+ - [cur_obj_init_anim_check_frame](#cur_obj_init_anim_check_frame)
+ - [cur_obj_init_anim_extend](#cur_obj_init_anim_extend)
+ - [cur_obj_play_sound_at_anim_range](#cur_obj_play_sound_at_anim_range)
+ - [cur_obj_set_anim_if_at_end](#cur_obj_set_anim_if_at_end)
+ - [cur_obj_spin_all_dimensions](#cur_obj_spin_all_dimensions)
+ - [obj_act_knockback](#obj_act_knockback)
+ - [obj_act_squished](#obj_act_squished)
+ - [obj_bounce_off_walls_edges_objects](#obj_bounce_off_walls_edges_objects)
+ - [obj_check_attacks](#obj_check_attacks)
+ - [obj_compute_vel_from_move_pitch](#obj_compute_vel_from_move_pitch)
+ - [obj_die_if_above_lava_and_health_non_positive](#obj_die_if_above_lava_and_health_non_positive)
+ - [obj_die_if_health_non_positive](#obj_die_if_health_non_positive)
+ - [obj_face_pitch_approach](#obj_face_pitch_approach)
+ - [obj_face_roll_approach](#obj_face_roll_approach)
+ - [obj_face_yaw_approach](#obj_face_yaw_approach)
+ - [obj_forward_vel_approach](#obj_forward_vel_approach)
+ - [obj_get_pitch_from_vel](#obj_get_pitch_from_vel)
+ - [obj_get_pitch_to_home](#obj_get_pitch_to_home)
+ - [obj_grow_then_shrink](#obj_grow_then_shrink)
+ - [obj_handle_attacks](#obj_handle_attacks)
+ - [obj_is_near_to_and_facing_mario](#obj_is_near_to_and_facing_mario)
+ - [obj_is_rendering_enabled](#obj_is_rendering_enabled)
+ - [obj_move_for_one_second](#obj_move_for_one_second)
+ - [obj_move_pitch_approach](#obj_move_pitch_approach)
+ - [obj_random_fixed_turn](#obj_random_fixed_turn)
+ - [obj_resolve_collisions_and_turn](#obj_resolve_collisions_and_turn)
+ - [obj_resolve_object_collisions](#obj_resolve_object_collisions)
+ - [obj_roll_to_match_yaw_turn](#obj_roll_to_match_yaw_turn)
+ - [obj_rotate_yaw_and_bounce_off_walls](#obj_rotate_yaw_and_bounce_off_walls)
+ - [obj_set_dist_from_home](#obj_set_dist_from_home)
+ - [obj_set_knockback_action](#obj_set_knockback_action)
+ - [obj_set_squished_action](#obj_set_squished_action)
+ - [obj_smooth_turn](#obj_smooth_turn)
+ - [obj_spit_fire](#obj_spit_fire)
+ - [obj_turn_pitch_toward_mario](#obj_turn_pitch_toward_mario)
+ - [obj_unused_die](#obj_unused_die)
+ - [obj_update_blinking](#obj_update_blinking)
+ - [obj_update_standard_actions](#obj_update_standard_actions)
+ - [obj_y_vel_approach](#obj_y_vel_approach)
+ - [oscillate_toward](#oscillate_toward)
+ - [platform_on_track_update_pos_or_spawn_ball](#platform_on_track_update_pos_or_spawn_ball)
+ - [random_linear_offset](#random_linear_offset)
+ - [random_mod_offset](#random_mod_offset)
+
+
+
- object_helpers.c
- [approach_f32_signed](#approach_f32_signed)
- [approach_f32_symmetric](#approach_f32_symmetric)
@@ -5041,6 +5124,1601 @@
+---
+# functions from obj_behaviors.c
+
+
+
+
+## [absf_2](#absf_2)
+
+### Lua Example
+`local numberValue = absf_2(f)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| f | number |
+
+### Returns
+- number
+
+### C Prototype
+`f32 absf_2(f32 f);`
+
+[:arrow_up_small:](#)
+
+
+
+## [calc_new_obj_vel_and_pos_y](#calc_new_obj_vel_and_pos_y)
+
+### Lua Example
+`calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| objFloor | [Surface](structs.md#Surface) |
+| objFloorY | number |
+| objVelX | number |
+| objVelZ | number |
+
+### Returns
+- None
+
+### C Prototype
+`void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ);`
+
+[:arrow_up_small:](#)
+
+
+
+## [calc_new_obj_vel_and_pos_y_underwater](#calc_new_obj_vel_and_pos_y_underwater)
+
+### Lua Example
+`calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| objFloor | [Surface](structs.md#Surface) |
+| floorY | number |
+| objVelX | number |
+| objVelZ | number |
+| waterY | number |
+
+### Returns
+- None
+
+### C Prototype
+`void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY);`
+
+[:arrow_up_small:](#)
+
+
+
+## [calc_obj_friction](#calc_obj_friction)
+
+### Lua Example
+`calc_obj_friction(objFriction, floor_nY)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| objFriction | Pointer |
+| floor_nY | number |
+
+### Returns
+- None
+
+### C Prototype
+`void calc_obj_friction(f32 *objFriction, f32 floor_nY);`
+
+[:arrow_up_small:](#)
+
+
+
+## [current_mario_room_check](#current_mario_room_check)
+
+### Lua Example
+`local integerValue = current_mario_room_check(room)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| room | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s8 current_mario_room_check(s16 room);`
+
+[:arrow_up_small:](#)
+
+
+
+## [is_player_active](#is_player_active)
+
+### Lua Example
+`local integerValue = is_player_active(m)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| m | [MarioState](structs.md#MarioState) |
+
+### Returns
+- integer
+
+### C Prototype
+`u8 is_player_active(struct MarioState* m);`
+
+[:arrow_up_small:](#)
+
+
+
+## [is_point_close_to_object](#is_point_close_to_object)
+
+### Lua Example
+`local integerValue = is_point_close_to_object(obj, x, y, z, dist)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| x | number |
+| y | number |
+| z | number |
+| dist | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);`
+
+[:arrow_up_small:](#)
+
+
+
+## [is_point_within_radius_of_mario](#is_point_within_radius_of_mario)
+
+### Lua Example
+`local integerValue = is_point_within_radius_of_mario(x, y, z, dist)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| x | number |
+| y | number |
+| z | number |
+| dist | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);`
+
+[:arrow_up_small:](#)
+
+
+
+## [nearest_mario_state_to_object](#nearest_mario_state_to_object)
+
+### Lua Example
+`local MarioStateValue = nearest_mario_state_to_object(obj)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+
+### Returns
+[MarioState](structs.md#MarioState)
+
+### C Prototype
+`struct MarioState* nearest_mario_state_to_object(struct Object *obj);`
+
+[:arrow_up_small:](#)
+
+
+
+## [nearest_player_to_object](#nearest_player_to_object)
+
+### Lua Example
+`local ObjectValue = nearest_player_to_object(obj)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+
+### Returns
+[Object](structs.md#Object)
+
+### C Prototype
+`struct Object* nearest_player_to_object(struct Object *obj);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_check_floor_death](#obj_check_floor_death)
+
+### Lua Example
+`obj_check_floor_death(collisionFlags, floor)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| collisionFlags | integer |
+| floor | [Surface](structs.md#Surface) |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_check_floor_death(s16 collisionFlags, struct Surface *floor);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_check_if_facing_toward_angle](#obj_check_if_facing_toward_angle)
+
+### Lua Example
+`local integerValue = obj_check_if_facing_toward_angle(base, goal, range)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| base | integer |
+| goal | integer |
+| range | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_find_wall](#obj_find_wall)
+
+### Lua Example
+`local integerValue = obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| objNewX | number |
+| objY | number |
+| objNewZ | number |
+| objVelX | number |
+| objVelZ | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_find_wall_displacement](#obj_find_wall_displacement)
+
+### Lua Example
+`local integerValue = obj_find_wall_displacement(dist, x, y, z, radius)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| dist | [Vec3f](structs.md#Vec3f) |
+| x | number |
+| y | number |
+| z | number |
+| radius | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_flicker_and_disappear](#obj_flicker_and_disappear)
+
+### Lua Example
+`local integerValue = obj_flicker_and_disappear(obj, lifeSpan)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| lifeSpan | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_lava_death](#obj_lava_death)
+
+### Lua Example
+`local integerValue = obj_lava_death()`
+
+### Parameters
+- None
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_lava_death(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_move_xyz_using_fvel_and_yaw](#obj_move_xyz_using_fvel_and_yaw)
+
+### Lua Example
+`obj_move_xyz_using_fvel_and_yaw(obj)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_move_xyz_using_fvel_and_yaw(struct Object *obj);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_orient_graph](#obj_orient_graph)
+
+### Lua Example
+`obj_orient_graph(obj, normalX, normalY, normalZ)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| normalX | number |
+| normalY | number |
+| normalZ | number |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_return_and_displace_home](#obj_return_and_displace_home)
+
+### Lua Example
+`obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| homeX | number |
+| homeY | number |
+| homeZ | number |
+| baseDisp | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_return_home_if_safe](#obj_return_home_if_safe)
+
+### Lua Example
+`local integerValue = obj_return_home_if_safe(obj, homeX, y, homeZ, dist)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| homeX | number |
+| y | number |
+| homeZ | number |
+| dist | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_spawn_yellow_coins](#obj_spawn_yellow_coins)
+
+### Lua Example
+`obj_spawn_yellow_coins(obj, nCoins)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| nCoins | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_splash](#obj_splash)
+
+### Lua Example
+`obj_splash(waterY, objY)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| waterY | integer |
+| objY | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_splash(s32 waterY, s32 objY);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_update_pos_vel_xz](#obj_update_pos_vel_xz)
+
+### Lua Example
+`obj_update_pos_vel_xz()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void obj_update_pos_vel_xz(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [object_step](#object_step)
+
+### Lua Example
+`local integerValue = object_step()`
+
+### Parameters
+- None
+
+### Returns
+- integer
+
+### C Prototype
+`s16 object_step(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [object_step_without_floor_orient](#object_step_without_floor_orient)
+
+### Lua Example
+`local integerValue = object_step_without_floor_orient()`
+
+### Parameters
+- None
+
+### Returns
+- integer
+
+### C Prototype
+`s16 object_step_without_floor_orient(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [set_object_visibility](#set_object_visibility)
+
+### Lua Example
+`set_object_visibility(obj, dist)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| obj | [Object](structs.md#Object) |
+| dist | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void set_object_visibility(struct Object *obj, s32 dist);`
+
+[:arrow_up_small:](#)
+
+
+
+## [set_yoshi_as_not_dead](#set_yoshi_as_not_dead)
+
+### Lua Example
+`set_yoshi_as_not_dead()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void set_yoshi_as_not_dead(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [spawn_orange_number](#spawn_orange_number)
+
+### Lua Example
+`spawn_orange_number(behParam, relX, relY, relZ)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| behParam | integer |
+| relX | integer |
+| relY | integer |
+| relZ | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ);`
+
+[:arrow_up_small:](#)
+
+
+
+## [turn_obj_away_from_steep_floor](#turn_obj_away_from_steep_floor)
+
+### Lua Example
+`local integerValue = turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| objFloor | [Surface](structs.md#Surface) |
+| floorY | number |
+| objVelX | number |
+| objVelZ | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);`
+
+[:arrow_up_small:](#)
+
+
+
+## [turn_obj_away_from_surface](#turn_obj_away_from_surface)
+
+### Lua Example
+`turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| velX | number |
+| velZ | number |
+| nX | number |
+| nY | number |
+| nZ | number |
+| objYawX | Pointer |
+| objYawZ | Pointer |
+
+### Returns
+- None
+
+### C Prototype
+`void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ);`
+
+[:arrow_up_small:](#)
+
+
+
+---
+# functions from obj_behaviors_2.c
+
+
+
+
+## [approach_f32_ptr](#approach_f32_ptr)
+
+### Lua Example
+`local integerValue = approach_f32_ptr(px, target, delta)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| px | Pointer |
+| target | number |
+| delta | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 approach_f32_ptr(f32 *px, f32 target, f32 delta);`
+
+[:arrow_up_small:](#)
+
+
+
+## [cur_obj_init_anim_and_check_if_end](#cur_obj_init_anim_and_check_if_end)
+
+### Lua Example
+`local integerValue = cur_obj_init_anim_and_check_if_end(arg0)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 cur_obj_init_anim_and_check_if_end(s32 arg0);`
+
+[:arrow_up_small:](#)
+
+
+
+## [cur_obj_init_anim_check_frame](#cur_obj_init_anim_check_frame)
+
+### Lua Example
+`local integerValue = cur_obj_init_anim_check_frame(arg0, arg1)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | integer |
+| arg1 | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1);`
+
+[:arrow_up_small:](#)
+
+
+
+## [cur_obj_init_anim_extend](#cur_obj_init_anim_extend)
+
+### Lua Example
+`cur_obj_init_anim_extend(arg0)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void cur_obj_init_anim_extend(s32 arg0);`
+
+[:arrow_up_small:](#)
+
+
+
+## [cur_obj_play_sound_at_anim_range](#cur_obj_play_sound_at_anim_range)
+
+### Lua Example
+`local integerValue = cur_obj_play_sound_at_anim_range(arg0, arg1, sound)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | integer |
+| arg1 | integer |
+| sound | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound);`
+
+[:arrow_up_small:](#)
+
+
+
+## [cur_obj_set_anim_if_at_end](#cur_obj_set_anim_if_at_end)
+
+### Lua Example
+`local integerValue = cur_obj_set_anim_if_at_end(arg0)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 cur_obj_set_anim_if_at_end(s32 arg0);`
+
+[:arrow_up_small:](#)
+
+
+
+## [cur_obj_spin_all_dimensions](#cur_obj_spin_all_dimensions)
+
+### Lua Example
+`cur_obj_spin_all_dimensions(arg0, arg1)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| arg0 | number |
+| arg1 | number |
+
+### Returns
+- None
+
+### C Prototype
+`void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_act_knockback](#obj_act_knockback)
+
+### Lua Example
+`obj_act_knockback(baseScale)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| baseScale | number |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_act_knockback(UNUSED f32 baseScale);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_act_squished](#obj_act_squished)
+
+### Lua Example
+`obj_act_squished(baseScale)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| baseScale | number |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_act_squished(f32 baseScale);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_bounce_off_walls_edges_objects](#obj_bounce_off_walls_edges_objects)
+
+### Lua Example
+`local integerValue = obj_bounce_off_walls_edges_objects(targetYaw)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetYaw | Pointer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_check_attacks](#obj_check_attacks)
+
+### Lua Example
+`local integerValue = obj_check_attacks(hitbox, attackedMarioAction)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| hitbox | [ObjectHitbox](structs.md#ObjectHitbox) |
+| attackedMarioAction | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_compute_vel_from_move_pitch](#obj_compute_vel_from_move_pitch)
+
+### Lua Example
+`obj_compute_vel_from_move_pitch(speed)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| speed | number |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_compute_vel_from_move_pitch(f32 speed);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_die_if_above_lava_and_health_non_positive](#obj_die_if_above_lava_and_health_non_positive)
+
+### Lua Example
+`local integerValue = obj_die_if_above_lava_and_health_non_positive()`
+
+### Parameters
+- None
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_die_if_above_lava_and_health_non_positive(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_die_if_health_non_positive](#obj_die_if_health_non_positive)
+
+### Lua Example
+`obj_die_if_health_non_positive()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void obj_die_if_health_non_positive(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_face_pitch_approach](#obj_face_pitch_approach)
+
+### Lua Example
+`local integerValue = obj_face_pitch_approach(targetPitch, deltaPitch)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetPitch | integer |
+| deltaPitch | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_face_roll_approach](#obj_face_roll_approach)
+
+### Lua Example
+`local integerValue = obj_face_roll_approach(targetRoll, deltaRoll)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetRoll | integer |
+| deltaRoll | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_face_yaw_approach](#obj_face_yaw_approach)
+
+### Lua Example
+`local integerValue = obj_face_yaw_approach(targetYaw, deltaYaw)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetYaw | integer |
+| deltaYaw | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_forward_vel_approach](#obj_forward_vel_approach)
+
+### Lua Example
+`local integerValue = obj_forward_vel_approach(target, delta)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| target | number |
+| delta | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_forward_vel_approach(f32 target, f32 delta);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_get_pitch_from_vel](#obj_get_pitch_from_vel)
+
+### Lua Example
+`local integerValue = obj_get_pitch_from_vel()`
+
+### Parameters
+- None
+
+### Returns
+- integer
+
+### C Prototype
+`s16 obj_get_pitch_from_vel(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_get_pitch_to_home](#obj_get_pitch_to_home)
+
+### Lua Example
+`local integerValue = obj_get_pitch_to_home(latDistToHome)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| latDistToHome | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s16 obj_get_pitch_to_home(f32 latDistToHome);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_grow_then_shrink](#obj_grow_then_shrink)
+
+### Lua Example
+`local integerValue = obj_grow_then_shrink(scaleVel, shootFireScale, endScale)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| scaleVel | Pointer |
+| shootFireScale | number |
+| endScale | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_handle_attacks](#obj_handle_attacks)
+
+### Lua Example
+`local integerValue = obj_handle_attacks(hitbox, attackedMarioAction, attackHandlers)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| hitbox | [ObjectHitbox](structs.md#ObjectHitbox) |
+| attackedMarioAction | integer |
+| attackHandlers | Pointer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction, u8 *attackHandlers);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_is_near_to_and_facing_mario](#obj_is_near_to_and_facing_mario)
+
+### Lua Example
+`local integerValue = obj_is_near_to_and_facing_mario(m, maxDist, maxAngleDiff)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| m | [MarioState](structs.md#MarioState) |
+| maxDist | number |
+| maxAngleDiff | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_is_rendering_enabled](#obj_is_rendering_enabled)
+
+### Lua Example
+`local integerValue = obj_is_rendering_enabled()`
+
+### Parameters
+- None
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_is_rendering_enabled(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_move_for_one_second](#obj_move_for_one_second)
+
+### Lua Example
+`local integerValue = obj_move_for_one_second(endAction)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| endAction | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_move_for_one_second(s32 endAction);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_move_pitch_approach](#obj_move_pitch_approach)
+
+### Lua Example
+`local integerValue = obj_move_pitch_approach(target, delta)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| target | integer |
+| delta | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_move_pitch_approach(s16 target, s16 delta);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_random_fixed_turn](#obj_random_fixed_turn)
+
+### Lua Example
+`local integerValue = obj_random_fixed_turn(delta)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| delta | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s16 obj_random_fixed_turn(s16 delta);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_resolve_collisions_and_turn](#obj_resolve_collisions_and_turn)
+
+### Lua Example
+`local integerValue = obj_resolve_collisions_and_turn(targetYaw, turnSpeed)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetYaw | integer |
+| turnSpeed | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_resolve_object_collisions](#obj_resolve_object_collisions)
+
+### Lua Example
+`local integerValue = obj_resolve_object_collisions(targetYaw)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetYaw | Pointer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_resolve_object_collisions(s32 *targetYaw);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_roll_to_match_yaw_turn](#obj_roll_to_match_yaw_turn)
+
+### Lua Example
+`obj_roll_to_match_yaw_turn(targetYaw, maxRoll, rollSpeed)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetYaw | integer |
+| maxRoll | integer |
+| rollSpeed | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_rotate_yaw_and_bounce_off_walls](#obj_rotate_yaw_and_bounce_off_walls)
+
+### Lua Example
+`obj_rotate_yaw_and_bounce_off_walls(targetYaw, turnAmount)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| targetYaw | integer |
+| turnAmount | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_set_dist_from_home](#obj_set_dist_from_home)
+
+### Lua Example
+`obj_set_dist_from_home(distFromHome)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| distFromHome | number |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_set_dist_from_home(f32 distFromHome);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_set_knockback_action](#obj_set_knockback_action)
+
+### Lua Example
+`obj_set_knockback_action(attackType)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| attackType | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_set_knockback_action(s32 attackType);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_set_squished_action](#obj_set_squished_action)
+
+### Lua Example
+`obj_set_squished_action()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void obj_set_squished_action(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_smooth_turn](#obj_smooth_turn)
+
+### Lua Example
+`local integerValue = obj_smooth_turn(angleVel, angle, targetAngle, targetSpeedProportion, accel, minSpeed, maxSpeed)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| angleVel | Pointer |
+| angle | Pointer |
+| targetAngle | integer |
+| targetSpeedProportion | number |
+| accel | integer |
+| minSpeed | integer |
+| maxSpeed | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, s16 accel, s16 minSpeed, s16 maxSpeed);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_spit_fire](#obj_spit_fire)
+
+### Lua Example
+`local ObjectValue = obj_spit_fire(relativePosX, relativePosY, relativePosZ, scale, model, startSpeed, endSpeed, movePitch)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| relativePosX | integer |
+| relativePosY | integer |
+| relativePosZ | integer |
+| scale | number |
+| model | integer |
+| startSpeed | number |
+| endSpeed | number |
+| movePitch | integer |
+
+### Returns
+[Object](structs.md#Object)
+
+### C Prototype
+`struct Object* obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, s32 model, f32 startSpeed, f32 endSpeed, s16 movePitch);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_turn_pitch_toward_mario](#obj_turn_pitch_toward_mario)
+
+### Lua Example
+`local integerValue = obj_turn_pitch_toward_mario(m, targetOffsetY, turnAmount)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| m | [MarioState](structs.md#MarioState) |
+| targetOffsetY | number |
+| turnAmount | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 turnAmount);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_unused_die](#obj_unused_die)
+
+### Lua Example
+`obj_unused_die()`
+
+### Parameters
+- None
+
+### Returns
+- None
+
+### C Prototype
+`void obj_unused_die(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_update_blinking](#obj_update_blinking)
+
+### Lua Example
+`obj_update_blinking(blinkTimer, baseCycleLength, cycleLengthRange, blinkLength)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| blinkTimer | Pointer |
+| baseCycleLength | integer |
+| cycleLengthRange | integer |
+| blinkLength | integer |
+
+### Returns
+- None
+
+### C Prototype
+`void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_update_standard_actions](#obj_update_standard_actions)
+
+### Lua Example
+`local integerValue = obj_update_standard_actions(scale)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| scale | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_update_standard_actions(f32 scale);`
+
+[:arrow_up_small:](#)
+
+
+
+## [obj_y_vel_approach](#obj_y_vel_approach)
+
+### Lua Example
+`local integerValue = obj_y_vel_approach(target, delta)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| target | number |
+| delta | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 obj_y_vel_approach(f32 target, f32 delta);`
+
+[:arrow_up_small:](#)
+
+
+
+## [oscillate_toward](#oscillate_toward)
+
+### Lua Example
+`local integerValue = oscillate_toward(value, vel, target, velCloseToZero, accel, slowdown)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| value | Pointer |
+| vel | Pointer |
+| target | integer |
+| velCloseToZero | number |
+| accel | number |
+| slowdown | number |
+
+### Returns
+- integer
+
+### C Prototype
+`s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown);`
+
+[:arrow_up_small:](#)
+
+
+
+## [platform_on_track_update_pos_or_spawn_ball](#platform_on_track_update_pos_or_spawn_ball)
+
+### Lua Example
+`platform_on_track_update_pos_or_spawn_ball(ballIndex, x, y, z)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| ballIndex | integer |
+| x | number |
+| y | number |
+| z | number |
+
+### Returns
+- None
+
+### C Prototype
+`void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32 z);`
+
+[:arrow_up_small:](#)
+
+
+
+## [random_linear_offset](#random_linear_offset)
+
+### Lua Example
+`local integerValue = random_linear_offset(base, range)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| base | integer |
+| range | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s16 random_linear_offset(s16 base, s16 range);`
+
+[:arrow_up_small:](#)
+
+
+
+## [random_mod_offset](#random_mod_offset)
+
+### Lua Example
+`local integerValue = random_mod_offset(base, step, mod)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| base | integer |
+| step | integer |
+| mod | integer |
+
+### Returns
+- integer
+
+### C Prototype
+`s16 random_mod_offset(s16 base, s16 step, s16 mod);`
+
+[:arrow_up_small:](#)
+
+
+
---
# functions from object_helpers.c
diff --git a/src/game/obj_behaviors_2.c b/src/game/obj_behaviors_2.c
index 5602679f..b154dae2 100644
--- a/src/game/obj_behaviors_2.c
+++ b/src/game/obj_behaviors_2.c
@@ -80,7 +80,7 @@ f32 sObjSavedPosZ;
void wiggler_jumped_on_attack_handler(void);
void huge_goomba_weakly_attacked(void);
-static s32 obj_is_rendering_enabled(void) {
+s32 obj_is_rendering_enabled(void) {
if (o->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
return TRUE;
} else {
@@ -88,7 +88,7 @@ static s32 obj_is_rendering_enabled(void) {
}
}
-static s16 obj_get_pitch_from_vel(void) {
+s16 obj_get_pitch_from_vel(void) {
return -atan2s(o->oForwardVel, o->oVelY);
}
@@ -110,12 +110,12 @@ static s32 obj_update_race_proposition_dialog(struct MarioState* m, s16 dialogID
return dialogResponse;
}
-static void obj_set_dist_from_home(f32 distFromHome) {
+void obj_set_dist_from_home(f32 distFromHome) {
o->oPosX = o->oHomeX + distFromHome * coss(o->oMoveAngleYaw);
o->oPosZ = o->oHomeZ + distFromHome * sins(o->oMoveAngleYaw);
}
-static s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff) {
+s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff) {
struct Object* player = m->marioObj;
int distanceToPlayer = dist_between_objects(o, player);
int angleToPlayer = obj_angle_to_object(o, player);
@@ -150,7 +150,7 @@ static BAD_RETURN(u32) obj_perform_position_op(s32 op) {
}
}
-static void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32 z) {
+void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32 z) {
struct Object *trackBall;
struct Waypoint *initialPrevWaypoint;
struct Waypoint *nextWaypoint;
@@ -246,7 +246,7 @@ static void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32
}
}
-static void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1) {
+void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1) {
f32 val24;
f32 val20;
f32 val1C;
@@ -301,18 +301,18 @@ static void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1) {
}
}
-static void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount) {
+void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount) {
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
targetYaw = cur_obj_reflect_move_angle_off_wall();
}
cur_obj_rotate_yaw_toward(targetYaw, turnAmount);
}
-static s16 obj_get_pitch_to_home(f32 latDistToHome) {
+s16 obj_get_pitch_to_home(f32 latDistToHome) {
return atan2s(latDistToHome, o->oPosY - o->oHomeY);
}
-static void obj_compute_vel_from_move_pitch(f32 speed) {
+void obj_compute_vel_from_move_pitch(f32 speed) {
o->oForwardVel = speed * coss(o->oMoveAnglePitch);
o->oVelY = speed * -sins(o->oMoveAnglePitch);
}
@@ -341,22 +341,22 @@ static s32 clamp_f32(f32 *value, f32 minimum, f32 maximum) {
return TRUE;
}
-static void cur_obj_init_anim_extend(s32 arg0) {
+void cur_obj_init_anim_extend(s32 arg0) {
cur_obj_init_animation_with_sound(arg0);
cur_obj_extend_animation_if_at_end();
}
-static s32 cur_obj_init_anim_and_check_if_end(s32 arg0) {
+s32 cur_obj_init_anim_and_check_if_end(s32 arg0) {
cur_obj_init_animation_with_sound(arg0);
return cur_obj_check_if_near_animation_end();
}
-static s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1) {
+s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1) {
cur_obj_init_animation_with_sound(arg0);
return cur_obj_check_anim_frame(arg1);
}
-static s32 cur_obj_set_anim_if_at_end(s32 arg0) {
+s32 cur_obj_set_anim_if_at_end(s32 arg0) {
if (cur_obj_check_if_at_animation_end()) {
cur_obj_init_animation_with_sound(arg0);
return TRUE;
@@ -364,7 +364,7 @@ static s32 cur_obj_set_anim_if_at_end(s32 arg0) {
return FALSE;
}
-static s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound) {
+s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound) {
s32 val04;
if ((val04 = o->header.gfx.animInfo.animAccel / 0x10000) <= 0) {
@@ -379,7 +379,7 @@ static s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound) {
return FALSE;
}
-static s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 turnAmount) {
+s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 turnAmount) {
s16 targetPitch;
o->oPosY -= targetOffsetY;
@@ -389,7 +389,7 @@ static s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY,
return targetPitch;
}
-static s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) {
+s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) {
if (*px > target) {
delta = -delta;
}
@@ -403,15 +403,15 @@ static s32 approach_f32_ptr(f32 *px, f32 target, f32 delta) {
return FALSE;
}
-static s32 obj_forward_vel_approach(f32 target, f32 delta) {
+s32 obj_forward_vel_approach(f32 target, f32 delta) {
return approach_f32_ptr(&o->oForwardVel, target, delta);
}
-static s32 obj_y_vel_approach(f32 target, f32 delta) {
+s32 obj_y_vel_approach(f32 target, f32 delta) {
return approach_f32_ptr(&o->oVelY, target, delta);
}
-static s32 obj_move_pitch_approach(s16 target, s16 delta) {
+s32 obj_move_pitch_approach(s16 target, s16 delta) {
o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, target, delta);
if ((s16) o->oMoveAnglePitch == target) {
@@ -421,7 +421,7 @@ static s32 obj_move_pitch_approach(s16 target, s16 delta) {
return FALSE;
}
-static s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) {
+s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) {
o->oFaceAnglePitch = approach_s16_symmetric(o->oFaceAnglePitch, targetPitch, deltaPitch);
if ((s16) o->oFaceAnglePitch == targetPitch) {
@@ -431,7 +431,7 @@ static s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch) {
return FALSE;
}
-static s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) {
+s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) {
o->oFaceAngleYaw = approach_s16_symmetric(o->oFaceAngleYaw, targetYaw, deltaYaw);
if ((s16) o->oFaceAngleYaw == targetYaw) {
@@ -441,7 +441,7 @@ static s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw) {
return FALSE;
}
-static s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) {
+s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) {
o->oFaceAngleRoll = approach_s16_symmetric(o->oFaceAngleRoll, targetRoll, deltaRoll);
if ((s16) o->oFaceAngleRoll == targetRoll) {
@@ -451,7 +451,7 @@ static s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll) {
return FALSE;
}
-static s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion,
+s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion,
s16 accel, s16 minSpeed, s16 maxSpeed) {
s16 currentSpeed;
s16 currentAngle = (s16)(*angle);
@@ -466,21 +466,21 @@ static s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targe
return (s16)(*angle) == targetAngle;
}
-static void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed) {
+void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed) {
s16 targetRoll = o->oMoveAngleYaw - targetYaw;
clamp_s16(&targetRoll, -maxRoll, maxRoll);
obj_face_roll_approach(targetRoll, rollSpeed);
}
-static s16 random_linear_offset(s16 base, s16 range) {
+s16 random_linear_offset(s16 base, s16 range) {
return base + (s16)(range * random_float());
}
-static s16 random_mod_offset(s16 base, s16 step, s16 mod) {
+s16 random_mod_offset(s16 base, s16 step, s16 mod) {
return base + step * (random_u16() % mod);
}
-static s16 obj_random_fixed_turn(s16 delta) {
+s16 obj_random_fixed_turn(s16 delta) {
return o->oMoveAngleYaw + (s16) random_sign() * delta;
}
@@ -491,7 +491,7 @@ static s16 obj_random_fixed_turn(s16 delta) {
* shootFireScale during this time, return 1.
* Return -1 once it's reached endScale.
*/
-static s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) {
+s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale) {
if (o->oTimer < 2) {
o->header.gfx.scale[0] += *scaleVel;
@@ -510,7 +510,7 @@ static s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale)
return 0;
}
-static s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel,
+s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel,
f32 slowdown) {
if (value == NULL || vel == NULL) { return FALSE; }
s32 startValue = *value;
@@ -536,7 +536,7 @@ static s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero
return FALSE;
}
-static void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange,
+void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange,
s16 blinkLength) {
if (*blinkTimer != 0) {
*blinkTimer -= 1;
@@ -551,7 +551,7 @@ static void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleL
}
}
-static s32 obj_resolve_object_collisions(s32 *targetYaw) {
+s32 obj_resolve_object_collisions(s32 *targetYaw) {
struct Object *otherObject;
f32 dx;
f32 dz;
@@ -597,7 +597,7 @@ static s32 obj_resolve_object_collisions(s32 *targetYaw) {
return FALSE;
}
-static s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) {
+s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) {
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
*targetYaw = cur_obj_reflect_move_angle_off_wall();
} else if (o->oMoveFlags & OBJ_MOVE_HIT_EDGE) {
@@ -609,7 +609,7 @@ static s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw) {
return TRUE;
}
-static s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) {
+s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) {
obj_resolve_object_collisions(NULL);
if (cur_obj_rotate_yaw_toward(targetYaw, turnSpeed)) {
@@ -619,7 +619,7 @@ static s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed) {
}
}
-static void obj_die_if_health_non_positive(void) {
+void obj_die_if_health_non_positive(void) {
if (o->oHealth <= 0) {
if (o->oDeathSound == 0) {
spawn_mist_particles_with_sound(SOUND_OBJ_DEFAULT_DEATH);
@@ -646,12 +646,12 @@ static void obj_die_if_health_non_positive(void) {
}
}
-static void obj_unused_die(void) {
+void obj_unused_die(void) {
o->oHealth = 0;
obj_die_if_health_non_positive();
}
-static void obj_set_knockback_action(s32 attackType) {
+void obj_set_knockback_action(s32 attackType) {
switch (attackType) {
case ATTACK_KICK_OR_TRIP:
case ATTACK_FAST_ATTACK:
@@ -673,12 +673,12 @@ static void obj_set_knockback_action(s32 attackType) {
o->oMoveAngleYaw = obj_angle_to_object(player, o);
}
-static void obj_set_squished_action(void) {
+void obj_set_squished_action(void) {
cur_obj_play_sound_2(SOUND_OBJ_STOMPED);
o->oAction = OBJ_ACT_SQUISHED;
}
-static s32 obj_die_if_above_lava_and_health_non_positive(void) {
+s32 obj_die_if_above_lava_and_health_non_positive(void) {
if (o->oMoveFlags & OBJ_MOVE_UNDERWATER_ON_GROUND) {
if (o->oGravity + o->oBuoyancy > 0.0f
|| find_water_level(o->oPosX, o->oPosZ) - o->oPosY < 150.0f) {
@@ -699,7 +699,7 @@ static s32 obj_die_if_above_lava_and_health_non_positive(void) {
return TRUE;
}
-static s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction,
+s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction,
u8 *attackHandlers) {
s32 attackType;
@@ -764,7 +764,7 @@ static s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioActi
return 0;
}
-static void obj_act_knockback(UNUSED f32 baseScale) {
+void obj_act_knockback(UNUSED f32 baseScale) {
cur_obj_update_floor_and_walls();
if (o->header.gfx.animInfo.curAnim != NULL) {
@@ -781,7 +781,7 @@ static void obj_act_knockback(UNUSED f32 baseScale) {
cur_obj_move_standard(-78);
}
-static void obj_act_squished(f32 baseScale) {
+void obj_act_squished(f32 baseScale) {
f32 targetScaleY = baseScale * 0.3f;
cur_obj_update_floor_and_walls();
@@ -802,7 +802,7 @@ static void obj_act_squished(f32 baseScale) {
cur_obj_move_standard(-78);
}
-static s32 obj_update_standard_actions(f32 scale) {
+s32 obj_update_standard_actions(f32 scale) {
if (o->oAction < 100) {
return TRUE;
} else {
@@ -823,7 +823,7 @@ static s32 obj_update_standard_actions(f32 scale) {
}
}
-static s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction) {
+s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction) {
s32 attackType;
obj_set_hitbox(o, hitbox);
@@ -849,7 +849,7 @@ static s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioActio
return 0;
}
-static s32 obj_move_for_one_second(s32 endAction) {
+s32 obj_move_for_one_second(s32 endAction) {
cur_obj_update_floor_and_walls();
cur_obj_extend_animation_if_at_end();
@@ -880,7 +880,7 @@ static s32 obj_move_for_one_second(s32 endAction) {
* attack Mario (e.g. fly guy shooting fire or lunging), especially when combined
* with partial updates.
*/
-static void treat_far_home_as_mario(f32 threshold, int* distanceToPlayer, int* angleToPlayer) {
+void treat_far_home_as_mario(f32 threshold, int* distanceToPlayer, int* angleToPlayer) {
f32 dx = o->oHomeX - o->oPosX;
f32 dy = o->oHomeY - o->oPosY;
f32 dz = o->oHomeZ - o->oPosZ;
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 50257c23..5a2885dd 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -3070,6 +3070,1148 @@ int smlua_func_network_local_index_from_global(lua_State* L) {
return 1;
}
+ /////////////////////
+ // obj_behaviors.c //
+/////////////////////
+
+int smlua_func_absf_2(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 f = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern f32 absf_2(f32 f);
+ lua_pushnumber(L, absf_2(f));
+
+ return 1;
+}
+
+int smlua_func_calc_new_obj_vel_and_pos_y(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ struct Surface* objFloor = (struct Surface*)smlua_to_cobject(L, 1, LOT_SURFACE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objFloorY = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelX = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelZ = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void calc_new_obj_vel_and_pos_y(struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ);
+ calc_new_obj_vel_and_pos_y(objFloor, objFloorY, objVelX, objVelZ);
+
+ return 1;
+}
+
+int smlua_func_calc_new_obj_vel_and_pos_y_underwater(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
+
+ struct Surface* objFloor = (struct Surface*)smlua_to_cobject(L, 1, LOT_SURFACE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 floorY = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelX = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelZ = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 waterY = smlua_to_number(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void calc_new_obj_vel_and_pos_y_underwater(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY);
+ calc_new_obj_vel_and_pos_y_underwater(objFloor, floorY, objVelX, objVelZ, waterY);
+
+ return 1;
+}
+
+int smlua_func_calc_obj_friction(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ f32 * objFriction = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 floor_nY = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void calc_obj_friction(f32 *objFriction, f32 floor_nY);
+ calc_obj_friction(objFriction, floor_nY);
+
+ return 1;
+}
+
+int smlua_func_current_mario_room_check(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s16 room = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s8 current_mario_room_check(s16 room);
+ lua_pushinteger(L, current_mario_room_check(room));
+
+ return 1;
+}
+
+/*
+int smlua_func_geo_obj_transparency_something(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ s32 callContext = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ struct GraphNode* node = (struct GraphNode*)smlua_to_cobject(L, 2, LOT_GRAPHNODE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+// Mat4 * mtx = (Mat4 *)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern Gfx UNUSED *geo_obj_transparency_something(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx);
+ UNIMPLEMENTED -->(L, geo_obj_transparency_something(callContext, node, mtx));
+
+ return 1;
+}
+*/
+
+int smlua_func_is_player_active(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern u8 is_player_active(struct MarioState* m);
+ lua_pushinteger(L, is_player_active(m));
+
+ return 1;
+}
+
+int smlua_func_is_point_close_to_object(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 x = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 y = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 z = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 dist = smlua_to_integer(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);
+ lua_pushinteger(L, is_point_close_to_object(obj, x, y, z, dist));
+
+ return 1;
+}
+
+int smlua_func_is_point_within_radius_of_mario(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ f32 x = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 y = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 z = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 dist = smlua_to_integer(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);
+ lua_pushinteger(L, is_point_within_radius_of_mario(x, y, z, dist));
+
+ return 1;
+}
+
+int smlua_func_nearest_mario_state_to_object(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern struct MarioState* nearest_mario_state_to_object(struct Object *obj);
+ smlua_push_object(L, LOT_MARIOSTATE, nearest_mario_state_to_object(obj));
+
+ return 1;
+}
+
+int smlua_func_nearest_player_to_object(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern struct Object* nearest_player_to_object(struct Object *obj);
+ smlua_push_object(L, LOT_OBJECT, nearest_player_to_object(obj));
+
+ return 1;
+}
+
+int smlua_func_obj_check_floor_death(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 collisionFlags = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ struct Surface* floor = (struct Surface*)smlua_to_cobject(L, 2, LOT_SURFACE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_check_floor_death(s16 collisionFlags, struct Surface *floor);
+ obj_check_floor_death(collisionFlags, floor);
+
+ return 1;
+}
+
+int smlua_func_obj_check_if_facing_toward_angle(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ u32 base = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ u32 goal = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 range = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);
+ lua_pushinteger(L, obj_check_if_facing_toward_angle(base, goal, range));
+
+ return 1;
+}
+
+int smlua_func_obj_find_wall(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
+
+ f32 objNewX = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objY = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objNewZ = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelX = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelZ = smlua_to_number(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);
+ lua_pushinteger(L, obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ));
+
+ return 1;
+}
+
+int smlua_func_obj_find_wall_displacement(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
+
+
+ f32* dist = smlua_get_vec3f_from_buffer();
+ dist[0] = smlua_get_number_field(1, "x");
+ if (!gSmLuaConvertSuccess) { return 0; }
+ dist[1] = smlua_get_number_field(1, "y");
+ if (!gSmLuaConvertSuccess) { return 0; }
+ dist[2] = smlua_get_number_field(1, "z");
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 x = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 y = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 z = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 radius = smlua_to_number(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);
+ lua_pushinteger(L, obj_find_wall_displacement(dist, x, y, z, radius));
+
+ smlua_push_number_field(1, "x", dist[0]);
+ smlua_push_number_field(1, "y", dist[1]);
+ smlua_push_number_field(1, "z", dist[2]);
+
+ return 1;
+}
+
+int smlua_func_obj_flicker_and_disappear(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 lifeSpan = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);
+ lua_pushinteger(L, obj_flicker_and_disappear(obj, lifeSpan));
+
+ return 1;
+}
+
+int smlua_func_obj_lava_death(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern s32 obj_lava_death(void);
+ lua_pushinteger(L, obj_lava_death());
+
+ return 1;
+}
+
+int smlua_func_obj_move_xyz_using_fvel_and_yaw(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_move_xyz_using_fvel_and_yaw(struct Object *obj);
+ obj_move_xyz_using_fvel_and_yaw(obj);
+
+ return 1;
+}
+
+int smlua_func_obj_orient_graph(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 normalX = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 normalY = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 normalZ = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_orient_graph(struct Object *obj, f32 normalX, f32 normalY, f32 normalZ);
+ obj_orient_graph(obj, normalX, normalY, normalZ);
+
+ return 1;
+}
+
+int smlua_func_obj_return_and_displace_home(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 homeX = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 homeY = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 homeZ = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 baseDisp = smlua_to_integer(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp);
+ obj_return_and_displace_home(obj, homeX, homeY, homeZ, baseDisp);
+
+ return 1;
+}
+
+int smlua_func_obj_return_home_if_safe(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 5)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 homeX = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 y = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 homeZ = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 dist = smlua_to_integer(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);
+ lua_pushinteger(L, obj_return_home_if_safe(obj, homeX, y, homeZ, dist));
+
+ return 1;
+}
+
+int smlua_func_obj_spawn_yellow_coins(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s8 nCoins = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins);
+ obj_spawn_yellow_coins(obj, nCoins);
+
+ return 1;
+}
+
+int smlua_func_obj_splash(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s32 waterY = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 objY = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_splash(s32 waterY, s32 objY);
+ obj_splash(waterY, objY);
+
+ return 1;
+}
+
+int smlua_func_obj_update_pos_vel_xz(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern void obj_update_pos_vel_xz(void);
+ obj_update_pos_vel_xz();
+
+ return 1;
+}
+
+int smlua_func_object_step(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern s16 object_step(void);
+ lua_pushinteger(L, object_step());
+
+ return 1;
+}
+
+int smlua_func_object_step_without_floor_orient(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern s16 object_step_without_floor_orient(void);
+ lua_pushinteger(L, object_step_without_floor_orient());
+
+ return 1;
+}
+
+int smlua_func_set_object_visibility(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ struct Object* obj = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 dist = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void set_object_visibility(struct Object *obj, s32 dist);
+ set_object_visibility(obj, dist);
+
+ return 1;
+}
+
+int smlua_func_set_yoshi_as_not_dead(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern void set_yoshi_as_not_dead(void);
+ set_yoshi_as_not_dead();
+
+ return 1;
+}
+
+int smlua_func_spawn_orange_number(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ s8 behParam = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 relX = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 relY = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 relZ = smlua_to_integer(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void spawn_orange_number(s8 behParam, s16 relX, s16 relY, s16 relZ);
+ spawn_orange_number(behParam, relX, relY, relZ);
+
+ return 1;
+}
+
+int smlua_func_turn_obj_away_from_steep_floor(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ struct Surface* objFloor = (struct Surface*)smlua_to_cobject(L, 1, LOT_SURFACE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 floorY = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelX = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 objVelZ = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);
+ lua_pushinteger(L, turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ));
+
+ return 1;
+}
+
+int smlua_func_turn_obj_away_from_surface(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 7)) { return 0; }
+
+ f32 velX = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 velZ = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 nX = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 nY = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 nZ = smlua_to_number(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 * objYawX = (f32 *)smlua_to_cpointer(L, 6, LVT_F32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 * objYawZ = (f32 *)smlua_to_cpointer(L, 7, LVT_F32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ);
+ turn_obj_away_from_surface(velX, velZ, nX, nY, nZ, objYawX, objYawZ);
+
+ return 1;
+}
+
+ ///////////////////////
+ // obj_behaviors_2.c //
+///////////////////////
+
+int smlua_func_approach_f32_ptr(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ f32 * px = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 target = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 delta = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 approach_f32_ptr(f32 *px, f32 target, f32 delta);
+ lua_pushinteger(L, approach_f32_ptr(px, target, delta));
+
+ return 1;
+}
+
+int smlua_func_cur_obj_init_anim_and_check_if_end(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 cur_obj_init_anim_and_check_if_end(s32 arg0);
+ lua_pushinteger(L, cur_obj_init_anim_and_check_if_end(arg0));
+
+ return 1;
+}
+
+int smlua_func_cur_obj_init_anim_check_frame(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s32 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 arg1 = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 cur_obj_init_anim_check_frame(s32 arg0, s32 arg1);
+ lua_pushinteger(L, cur_obj_init_anim_check_frame(arg0, arg1));
+
+ return 1;
+}
+
+int smlua_func_cur_obj_init_anim_extend(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void cur_obj_init_anim_extend(s32 arg0);
+ cur_obj_init_anim_extend(arg0);
+
+ return 1;
+}
+
+int smlua_func_cur_obj_play_sound_at_anim_range(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ s8 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s8 arg1 = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ u32 sound = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 cur_obj_play_sound_at_anim_range(s8 arg0, s8 arg1, u32 sound);
+ lua_pushinteger(L, cur_obj_play_sound_at_anim_range(arg0, arg1, sound));
+
+ return 1;
+}
+
+int smlua_func_cur_obj_set_anim_if_at_end(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 arg0 = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 cur_obj_set_anim_if_at_end(s32 arg0);
+ lua_pushinteger(L, cur_obj_set_anim_if_at_end(arg0));
+
+ return 1;
+}
+
+int smlua_func_cur_obj_spin_all_dimensions(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ f32 arg0 = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 arg1 = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void cur_obj_spin_all_dimensions(f32 arg0, f32 arg1);
+ cur_obj_spin_all_dimensions(arg0, arg1);
+
+ return 1;
+}
+
+int smlua_func_obj_act_knockback(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 baseScale = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_act_knockback(UNUSED f32 baseScale);
+ obj_act_knockback(baseScale);
+
+ return 1;
+}
+
+int smlua_func_obj_act_squished(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 baseScale = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_act_squished(f32 baseScale);
+ obj_act_squished(baseScale);
+
+ return 1;
+}
+
+int smlua_func_obj_bounce_off_walls_edges_objects(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 * targetYaw = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_bounce_off_walls_edges_objects(s32 *targetYaw);
+ lua_pushinteger(L, obj_bounce_off_walls_edges_objects(targetYaw));
+
+ return 1;
+}
+
+int smlua_func_obj_check_attacks(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ struct ObjectHitbox* hitbox = (struct ObjectHitbox*)smlua_to_cobject(L, 1, LOT_OBJECTHITBOX);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 attackedMarioAction = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_check_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction);
+ lua_pushinteger(L, obj_check_attacks(hitbox, attackedMarioAction));
+
+ return 1;
+}
+
+int smlua_func_obj_compute_vel_from_move_pitch(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 speed = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_compute_vel_from_move_pitch(f32 speed);
+ obj_compute_vel_from_move_pitch(speed);
+
+ return 1;
+}
+
+int smlua_func_obj_die_if_above_lava_and_health_non_positive(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern s32 obj_die_if_above_lava_and_health_non_positive(void);
+ lua_pushinteger(L, obj_die_if_above_lava_and_health_non_positive());
+
+ return 1;
+}
+
+int smlua_func_obj_die_if_health_non_positive(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern void obj_die_if_health_non_positive(void);
+ obj_die_if_health_non_positive();
+
+ return 1;
+}
+
+int smlua_func_obj_face_pitch_approach(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 targetPitch = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 deltaPitch = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_face_pitch_approach(s16 targetPitch, s16 deltaPitch);
+ lua_pushinteger(L, obj_face_pitch_approach(targetPitch, deltaPitch));
+
+ return 1;
+}
+
+int smlua_func_obj_face_roll_approach(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 targetRoll = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 deltaRoll = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_face_roll_approach(s16 targetRoll, s16 deltaRoll);
+ lua_pushinteger(L, obj_face_roll_approach(targetRoll, deltaRoll));
+
+ return 1;
+}
+
+int smlua_func_obj_face_yaw_approach(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 targetYaw = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 deltaYaw = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_face_yaw_approach(s16 targetYaw, s16 deltaYaw);
+ lua_pushinteger(L, obj_face_yaw_approach(targetYaw, deltaYaw));
+
+ return 1;
+}
+
+int smlua_func_obj_forward_vel_approach(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ f32 target = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 delta = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_forward_vel_approach(f32 target, f32 delta);
+ lua_pushinteger(L, obj_forward_vel_approach(target, delta));
+
+ return 1;
+}
+
+int smlua_func_obj_get_pitch_from_vel(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern s16 obj_get_pitch_from_vel(void);
+ lua_pushinteger(L, obj_get_pitch_from_vel());
+
+ return 1;
+}
+
+int smlua_func_obj_get_pitch_to_home(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 latDistToHome = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s16 obj_get_pitch_to_home(f32 latDistToHome);
+ lua_pushinteger(L, obj_get_pitch_to_home(latDistToHome));
+
+ return 1;
+}
+
+int smlua_func_obj_grow_then_shrink(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ f32 * scaleVel = (f32 *)smlua_to_cpointer(L, 1, LVT_F32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 shootFireScale = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 endScale = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_grow_then_shrink(f32 *scaleVel, f32 shootFireScale, f32 endScale);
+ lua_pushinteger(L, obj_grow_then_shrink(scaleVel, shootFireScale, endScale));
+
+ return 1;
+}
+
+int smlua_func_obj_handle_attacks(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ struct ObjectHitbox* hitbox = (struct ObjectHitbox*)smlua_to_cobject(L, 1, LOT_OBJECTHITBOX);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 attackedMarioAction = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ u8 * attackHandlers = (u8 *)smlua_to_cpointer(L, 3, LVT_U8_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_handle_attacks(struct ObjectHitbox *hitbox, s32 attackedMarioAction, u8 *attackHandlers);
+ lua_pushinteger(L, obj_handle_attacks(hitbox, attackedMarioAction, attackHandlers));
+
+ return 1;
+}
+
+int smlua_func_obj_is_near_to_and_facing_mario(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 maxDist = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 maxAngleDiff = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_is_near_to_and_facing_mario(struct MarioState* m, f32 maxDist, s16 maxAngleDiff);
+ lua_pushinteger(L, obj_is_near_to_and_facing_mario(m, maxDist, maxAngleDiff));
+
+ return 1;
+}
+
+int smlua_func_obj_is_rendering_enabled(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern s32 obj_is_rendering_enabled(void);
+ lua_pushinteger(L, obj_is_rendering_enabled());
+
+ return 1;
+}
+
+int smlua_func_obj_move_for_one_second(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 endAction = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_move_for_one_second(s32 endAction);
+ lua_pushinteger(L, obj_move_for_one_second(endAction));
+
+ return 1;
+}
+
+int smlua_func_obj_move_pitch_approach(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 target = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 delta = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_move_pitch_approach(s16 target, s16 delta);
+ lua_pushinteger(L, obj_move_pitch_approach(target, delta));
+
+ return 1;
+}
+
+int smlua_func_obj_random_fixed_turn(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s16 delta = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s16 obj_random_fixed_turn(s16 delta);
+ lua_pushinteger(L, obj_random_fixed_turn(delta));
+
+ return 1;
+}
+
+int smlua_func_obj_resolve_collisions_and_turn(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 targetYaw = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 turnSpeed = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_resolve_collisions_and_turn(s16 targetYaw, s16 turnSpeed);
+ lua_pushinteger(L, obj_resolve_collisions_and_turn(targetYaw, turnSpeed));
+
+ return 1;
+}
+
+int smlua_func_obj_resolve_object_collisions(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 * targetYaw = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_resolve_object_collisions(s32 *targetYaw);
+ lua_pushinteger(L, obj_resolve_object_collisions(targetYaw));
+
+ return 1;
+}
+
+int smlua_func_obj_roll_to_match_yaw_turn(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ s16 targetYaw = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 maxRoll = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 rollSpeed = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_roll_to_match_yaw_turn(s16 targetYaw, s16 maxRoll, s16 rollSpeed);
+ obj_roll_to_match_yaw_turn(targetYaw, maxRoll, rollSpeed);
+
+ return 1;
+}
+
+int smlua_func_obj_rotate_yaw_and_bounce_off_walls(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 targetYaw = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 turnAmount = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_rotate_yaw_and_bounce_off_walls(s16 targetYaw, s16 turnAmount);
+ obj_rotate_yaw_and_bounce_off_walls(targetYaw, turnAmount);
+
+ return 1;
+}
+
+int smlua_func_obj_set_dist_from_home(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 distFromHome = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_set_dist_from_home(f32 distFromHome);
+ obj_set_dist_from_home(distFromHome);
+
+ return 1;
+}
+
+int smlua_func_obj_set_knockback_action(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ s32 attackType = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_set_knockback_action(s32 attackType);
+ obj_set_knockback_action(attackType);
+
+ return 1;
+}
+
+int smlua_func_obj_set_squished_action(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern void obj_set_squished_action(void);
+ obj_set_squished_action();
+
+ return 1;
+}
+
+int smlua_func_obj_smooth_turn(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 7)) { return 0; }
+
+ s16 * angleVel = (s16 *)smlua_to_cpointer(L, 1, LVT_S16_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 * angle = (s32 *)smlua_to_cpointer(L, 2, LVT_S32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 targetAngle = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 targetSpeedProportion = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 accel = smlua_to_integer(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 minSpeed = smlua_to_integer(L, 6);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 maxSpeed = smlua_to_integer(L, 7);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_smooth_turn(s16 *angleVel, s32 *angle, s16 targetAngle, f32 targetSpeedProportion, s16 accel, s16 minSpeed, s16 maxSpeed);
+ lua_pushinteger(L, obj_smooth_turn(angleVel, angle, targetAngle, targetSpeedProportion, accel, minSpeed, maxSpeed));
+
+ return 1;
+}
+
+int smlua_func_obj_spit_fire(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 8)) { return 0; }
+
+ s16 relativePosX = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 relativePosY = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 relativePosZ = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 scale = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 model = smlua_to_integer(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 startSpeed = smlua_to_number(L, 6);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 endSpeed = smlua_to_number(L, 7);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 movePitch = smlua_to_integer(L, 8);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern struct Object* obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, s32 model, f32 startSpeed, f32 endSpeed, s16 movePitch);
+ smlua_push_object(L, LOT_OBJECT, obj_spit_fire(relativePosX, relativePosY, relativePosZ, scale, model, startSpeed, endSpeed, movePitch));
+
+ return 1;
+}
+
+int smlua_func_obj_turn_pitch_toward_mario(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 targetOffsetY = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 turnAmount = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s16 obj_turn_pitch_toward_mario(struct MarioState* m, f32 targetOffsetY, s16 turnAmount);
+ lua_pushinteger(L, obj_turn_pitch_toward_mario(m, targetOffsetY, turnAmount));
+
+ return 1;
+}
+
+int smlua_func_obj_unused_die(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ extern void obj_unused_die(void);
+ obj_unused_die();
+
+ return 1;
+}
+
+int smlua_func_obj_update_blinking(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ s32 * blinkTimer = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 baseCycleLength = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 cycleLengthRange = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 blinkLength = smlua_to_integer(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void obj_update_blinking(s32 *blinkTimer, s16 baseCycleLength, s16 cycleLengthRange, s16 blinkLength);
+ obj_update_blinking(blinkTimer, baseCycleLength, cycleLengthRange, blinkLength);
+
+ return 1;
+}
+
+int smlua_func_obj_update_standard_actions(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
+
+ f32 scale = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_update_standard_actions(f32 scale);
+ lua_pushinteger(L, obj_update_standard_actions(scale));
+
+ return 1;
+}
+
+int smlua_func_obj_y_vel_approach(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ f32 target = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 delta = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 obj_y_vel_approach(f32 target, f32 delta);
+ lua_pushinteger(L, obj_y_vel_approach(target, delta));
+
+ return 1;
+}
+
+int smlua_func_oscillate_toward(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 6)) { return 0; }
+
+ s32 * value = (s32 *)smlua_to_cpointer(L, 1, LVT_S32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 * vel = (f32 *)smlua_to_cpointer(L, 2, LVT_F32_P);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s32 target = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 velCloseToZero = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 accel = smlua_to_number(L, 5);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 slowdown = smlua_to_number(L, 6);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s32 oscillate_toward(s32 *value, f32 *vel, s32 target, f32 velCloseToZero, f32 accel, f32 slowdown);
+ lua_pushinteger(L, oscillate_toward(value, vel, target, velCloseToZero, accel, slowdown));
+
+ return 1;
+}
+
+int smlua_func_platform_on_track_update_pos_or_spawn_ball(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 4)) { return 0; }
+
+ s32 ballIndex = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 x = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 y = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ f32 z = smlua_to_number(L, 4);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void platform_on_track_update_pos_or_spawn_ball(s32 ballIndex, f32 x, f32 y, f32 z);
+ platform_on_track_update_pos_or_spawn_ball(ballIndex, x, y, z);
+
+ return 1;
+}
+
+int smlua_func_random_linear_offset(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
+
+ s16 base = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 range = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s16 random_linear_offset(s16 base, s16 range);
+ lua_pushinteger(L, random_linear_offset(base, range));
+
+ return 1;
+}
+
+int smlua_func_random_mod_offset(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ s16 base = smlua_to_integer(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 step = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { return 0; }
+ s16 mod = smlua_to_integer(L, 3);
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern s16 random_mod_offset(s16 base, s16 step, s16 mod);
+ lua_pushinteger(L, random_mod_offset(base, step, mod));
+
+ return 1;
+}
+
+/*
+int smlua_func_treat_far_home_as_mario(lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
+
+ f32 threshold = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { return 0; }
+// int* distanceToPlayer = (int*)smlua_to_cobject(L, 2, LOT_???); <--- UNIMPLEMENTED
+ if (!gSmLuaConvertSuccess) { return 0; }
+// int* angleToPlayer = (int*)smlua_to_cobject(L, 3, LOT_???); <--- UNIMPLEMENTED
+ if (!gSmLuaConvertSuccess) { return 0; }
+
+ extern void treat_far_home_as_mario(f32 threshold, int* distanceToPlayer, int* angleToPlayer);
+ treat_far_home_as_mario(threshold, distanceToPlayer, angleToPlayer);
+
+ return 1;
+}
+*/
+
//////////////////////
// object_helpers.c //
//////////////////////
@@ -4818,6 +5960,87 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "network_is_server", smlua_func_network_is_server);
smlua_bind_function(L, "network_local_index_from_global", smlua_func_network_local_index_from_global);
+ // obj_behaviors.c
+ smlua_bind_function(L, "absf_2", smlua_func_absf_2);
+ smlua_bind_function(L, "calc_new_obj_vel_and_pos_y", smlua_func_calc_new_obj_vel_and_pos_y);
+ smlua_bind_function(L, "calc_new_obj_vel_and_pos_y_underwater", smlua_func_calc_new_obj_vel_and_pos_y_underwater);
+ smlua_bind_function(L, "calc_obj_friction", smlua_func_calc_obj_friction);
+ smlua_bind_function(L, "current_mario_room_check", smlua_func_current_mario_room_check);
+ //smlua_bind_function(L, "geo_obj_transparency_something", smlua_func_geo_obj_transparency_something); <--- UNIMPLEMENTED
+ smlua_bind_function(L, "is_player_active", smlua_func_is_player_active);
+ smlua_bind_function(L, "is_point_close_to_object", smlua_func_is_point_close_to_object);
+ smlua_bind_function(L, "is_point_within_radius_of_mario", smlua_func_is_point_within_radius_of_mario);
+ smlua_bind_function(L, "nearest_mario_state_to_object", smlua_func_nearest_mario_state_to_object);
+ smlua_bind_function(L, "nearest_player_to_object", smlua_func_nearest_player_to_object);
+ smlua_bind_function(L, "obj_check_floor_death", smlua_func_obj_check_floor_death);
+ smlua_bind_function(L, "obj_check_if_facing_toward_angle", smlua_func_obj_check_if_facing_toward_angle);
+ smlua_bind_function(L, "obj_find_wall", smlua_func_obj_find_wall);
+ smlua_bind_function(L, "obj_find_wall_displacement", smlua_func_obj_find_wall_displacement);
+ smlua_bind_function(L, "obj_flicker_and_disappear", smlua_func_obj_flicker_and_disappear);
+ smlua_bind_function(L, "obj_lava_death", smlua_func_obj_lava_death);
+ smlua_bind_function(L, "obj_move_xyz_using_fvel_and_yaw", smlua_func_obj_move_xyz_using_fvel_and_yaw);
+ smlua_bind_function(L, "obj_orient_graph", smlua_func_obj_orient_graph);
+ smlua_bind_function(L, "obj_return_and_displace_home", smlua_func_obj_return_and_displace_home);
+ smlua_bind_function(L, "obj_return_home_if_safe", smlua_func_obj_return_home_if_safe);
+ smlua_bind_function(L, "obj_spawn_yellow_coins", smlua_func_obj_spawn_yellow_coins);
+ smlua_bind_function(L, "obj_splash", smlua_func_obj_splash);
+ smlua_bind_function(L, "obj_update_pos_vel_xz", smlua_func_obj_update_pos_vel_xz);
+ smlua_bind_function(L, "object_step", smlua_func_object_step);
+ smlua_bind_function(L, "object_step_without_floor_orient", smlua_func_object_step_without_floor_orient);
+ smlua_bind_function(L, "set_object_visibility", smlua_func_set_object_visibility);
+ smlua_bind_function(L, "set_yoshi_as_not_dead", smlua_func_set_yoshi_as_not_dead);
+ smlua_bind_function(L, "spawn_orange_number", smlua_func_spawn_orange_number);
+ smlua_bind_function(L, "turn_obj_away_from_steep_floor", smlua_func_turn_obj_away_from_steep_floor);
+ smlua_bind_function(L, "turn_obj_away_from_surface", smlua_func_turn_obj_away_from_surface);
+
+ // obj_behaviors_2.c
+ smlua_bind_function(L, "approach_f32_ptr", smlua_func_approach_f32_ptr);
+ smlua_bind_function(L, "cur_obj_init_anim_and_check_if_end", smlua_func_cur_obj_init_anim_and_check_if_end);
+ smlua_bind_function(L, "cur_obj_init_anim_check_frame", smlua_func_cur_obj_init_anim_check_frame);
+ smlua_bind_function(L, "cur_obj_init_anim_extend", smlua_func_cur_obj_init_anim_extend);
+ smlua_bind_function(L, "cur_obj_play_sound_at_anim_range", smlua_func_cur_obj_play_sound_at_anim_range);
+ smlua_bind_function(L, "cur_obj_set_anim_if_at_end", smlua_func_cur_obj_set_anim_if_at_end);
+ smlua_bind_function(L, "cur_obj_spin_all_dimensions", smlua_func_cur_obj_spin_all_dimensions);
+ smlua_bind_function(L, "obj_act_knockback", smlua_func_obj_act_knockback);
+ smlua_bind_function(L, "obj_act_squished", smlua_func_obj_act_squished);
+ smlua_bind_function(L, "obj_bounce_off_walls_edges_objects", smlua_func_obj_bounce_off_walls_edges_objects);
+ smlua_bind_function(L, "obj_check_attacks", smlua_func_obj_check_attacks);
+ smlua_bind_function(L, "obj_compute_vel_from_move_pitch", smlua_func_obj_compute_vel_from_move_pitch);
+ smlua_bind_function(L, "obj_die_if_above_lava_and_health_non_positive", smlua_func_obj_die_if_above_lava_and_health_non_positive);
+ smlua_bind_function(L, "obj_die_if_health_non_positive", smlua_func_obj_die_if_health_non_positive);
+ smlua_bind_function(L, "obj_face_pitch_approach", smlua_func_obj_face_pitch_approach);
+ smlua_bind_function(L, "obj_face_roll_approach", smlua_func_obj_face_roll_approach);
+ smlua_bind_function(L, "obj_face_yaw_approach", smlua_func_obj_face_yaw_approach);
+ smlua_bind_function(L, "obj_forward_vel_approach", smlua_func_obj_forward_vel_approach);
+ smlua_bind_function(L, "obj_get_pitch_from_vel", smlua_func_obj_get_pitch_from_vel);
+ smlua_bind_function(L, "obj_get_pitch_to_home", smlua_func_obj_get_pitch_to_home);
+ smlua_bind_function(L, "obj_grow_then_shrink", smlua_func_obj_grow_then_shrink);
+ smlua_bind_function(L, "obj_handle_attacks", smlua_func_obj_handle_attacks);
+ smlua_bind_function(L, "obj_is_near_to_and_facing_mario", smlua_func_obj_is_near_to_and_facing_mario);
+ smlua_bind_function(L, "obj_is_rendering_enabled", smlua_func_obj_is_rendering_enabled);
+ smlua_bind_function(L, "obj_move_for_one_second", smlua_func_obj_move_for_one_second);
+ smlua_bind_function(L, "obj_move_pitch_approach", smlua_func_obj_move_pitch_approach);
+ smlua_bind_function(L, "obj_random_fixed_turn", smlua_func_obj_random_fixed_turn);
+ smlua_bind_function(L, "obj_resolve_collisions_and_turn", smlua_func_obj_resolve_collisions_and_turn);
+ smlua_bind_function(L, "obj_resolve_object_collisions", smlua_func_obj_resolve_object_collisions);
+ smlua_bind_function(L, "obj_roll_to_match_yaw_turn", smlua_func_obj_roll_to_match_yaw_turn);
+ smlua_bind_function(L, "obj_rotate_yaw_and_bounce_off_walls", smlua_func_obj_rotate_yaw_and_bounce_off_walls);
+ smlua_bind_function(L, "obj_set_dist_from_home", smlua_func_obj_set_dist_from_home);
+ smlua_bind_function(L, "obj_set_knockback_action", smlua_func_obj_set_knockback_action);
+ smlua_bind_function(L, "obj_set_squished_action", smlua_func_obj_set_squished_action);
+ smlua_bind_function(L, "obj_smooth_turn", smlua_func_obj_smooth_turn);
+ smlua_bind_function(L, "obj_spit_fire", smlua_func_obj_spit_fire);
+ smlua_bind_function(L, "obj_turn_pitch_toward_mario", smlua_func_obj_turn_pitch_toward_mario);
+ smlua_bind_function(L, "obj_unused_die", smlua_func_obj_unused_die);
+ smlua_bind_function(L, "obj_update_blinking", smlua_func_obj_update_blinking);
+ smlua_bind_function(L, "obj_update_standard_actions", smlua_func_obj_update_standard_actions);
+ smlua_bind_function(L, "obj_y_vel_approach", smlua_func_obj_y_vel_approach);
+ smlua_bind_function(L, "oscillate_toward", smlua_func_oscillate_toward);
+ smlua_bind_function(L, "platform_on_track_update_pos_or_spawn_ball", smlua_func_platform_on_track_update_pos_or_spawn_ball);
+ smlua_bind_function(L, "random_linear_offset", smlua_func_random_linear_offset);
+ smlua_bind_function(L, "random_mod_offset", smlua_func_random_mod_offset);
+ //smlua_bind_function(L, "treat_far_home_as_mario", smlua_func_treat_far_home_as_mario); <--- UNIMPLEMENTED
+
// object_helpers.c
smlua_bind_function(L, "approach_f32_signed", smlua_func_approach_f32_signed);
smlua_bind_function(L, "approach_f32_symmetric", smlua_func_approach_f32_symmetric);
diff --git a/src/pc/lua/smlua_obj_utils.c b/src/pc/lua/smlua_obj_utils.c
index 02c13841..f6b750f7 100644
--- a/src/pc/lua/smlua_obj_utils.c
+++ b/src/pc/lua/smlua_obj_utils.c
@@ -34,10 +34,15 @@ struct Object* spawn_object_sync(enum BehaviorId behaviorId, enum ModelExtendedI
}
obj->parentObj = obj;
+
obj->oPosX = x;
obj->oPosY = y;
obj->oPosZ = z;
+ obj->oHomeX = x;
+ obj->oHomeY = y;
+ obj->oHomeZ = z;
+
struct SyncObject* so = &gSyncObjects[obj->oSyncID];
so->extendedModelId = modelId;
so->o = obj;