Properly sync BITS ferris wheel platforms

This commit is contained in:
Agent X 2024-06-13 19:22:20 -04:00
parent 61e53a948f
commit e780b74d1b
9 changed files with 55 additions and 0 deletions

View file

@ -797,6 +797,10 @@ function bhv_ferris_wheel_axle_init()
-- ...
end
function bhv_ferris_wheel_platform_init()
-- ...
end
function bhv_ferris_wheel_platform_update()
-- ...
end

View file

@ -5663,6 +5663,7 @@ const BehaviorScript bhvFerrisWheelPlatform[] = {
BEGIN(OBJ_LIST_SURFACE),
ID(id_bhvFerrisWheelPlatform),
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
CALL_NATIVE(bhv_ferris_wheel_platform_init),
BEGIN_LOOP(),
CALL_NATIVE(bhv_ferris_wheel_platform_update),
CALL_NATIVE(load_object_collision_model),

View file

@ -1974,6 +1974,7 @@ static const void* sDynosBuiltinFuncs[] = {
define_builtin(bhv_blue_coin_switch_init),
define_builtin(bhv_star_number_loop),
define_builtin(spawn_star_number),
define_builtin(bhv_ferris_wheel_platform_init),
};
const void* DynOS_Builtin_Func_GetFromName(const char* aDataName) {

View file

@ -3526,6 +3526,24 @@
<br />
## [bhv_ferris_wheel_platform_init](#bhv_ferris_wheel_platform_init)
### Lua Example
`bhv_ferris_wheel_platform_init()`
### Parameters
- None
### Returns
- None
### C Prototype
`void bhv_ferris_wheel_platform_init(void);`
[:arrow_up_small:](#)
<br />
## [bhv_ferris_wheel_platform_update](#bhv_ferris_wheel_platform_update)
### Lua Example

View file

@ -229,6 +229,7 @@
- [bhv_falling_pillar_init](functions-2.md#bhv_falling_pillar_init)
- [bhv_falling_pillar_loop](functions-2.md#bhv_falling_pillar_loop)
- [bhv_ferris_wheel_axle_init](functions-2.md#bhv_ferris_wheel_axle_init)
- [bhv_ferris_wheel_platform_init](functions-2.md#bhv_ferris_wheel_platform_init)
- [bhv_ferris_wheel_platform_update](functions-2.md#bhv_ferris_wheel_platform_update)
- [bhv_fire_piranha_plant_init](functions-2.md#bhv_fire_piranha_plant_init)
- [bhv_fire_piranha_plant_update](functions-2.md#bhv_fire_piranha_plant_update)

View file

@ -486,6 +486,7 @@ void bhv_track_ball_update(void);
void bhv_seesaw_platform_init(void);
void bhv_seesaw_platform_update(void);
void bhv_ferris_wheel_axle_init(void);
void bhv_ferris_wheel_platform_init(void);
void bhv_ferris_wheel_platform_update(void);
void bhv_water_bomb_spawner_update(void);
void bhv_water_bomb_update(void);

View file

@ -56,6 +56,17 @@ void bhv_ferris_wheel_axle_init(void) {
}
}
void bhv_ferris_wheel_platform_init(void) {
struct SyncObject* so = sync_object_init(o, 2000.0f);
if (so) {
so->hasStandardFields = FALSE;
so->maxUpdateRate = 5.0f;
sync_object_init_field(o, &o->oPosX);
sync_object_init_field(o, &o->oPosY);
sync_object_init_field(o, &o->oPosZ);
}
}
/**
* Update function for bhvFerrisWheelPlatform.
* Position self relative to parent using the parent's roll.

View file

@ -53,6 +53,7 @@ void bhv_track_ball_update(void);
void bhv_seesaw_platform_init(void);
void bhv_seesaw_platform_update(void);
void bhv_ferris_wheel_axle_init(void);
void bhv_ferris_wheel_platform_init(void);
void bhv_ferris_wheel_platform_update(void);
void bhv_water_bomb_spawner_update(void);
void bhv_water_bomb_update(void);

View file

@ -3230,6 +3230,22 @@ int smlua_func_bhv_ferris_wheel_axle_init(UNUSED lua_State* L) {
return 1;
}
int smlua_func_bhv_ferris_wheel_platform_init(UNUSED lua_State* L) {
if (!gCurrentObject) { return 0; }
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ferris_wheel_platform_init", 0, top);
return 0;
}
bhv_ferris_wheel_platform_init();
return 1;
}
int smlua_func_bhv_ferris_wheel_platform_update(UNUSED lua_State* L) {
if (!gCurrentObject) { return 0; }
if (L == NULL) { return 0; }
@ -32826,6 +32842,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "bhv_falling_pillar_init", smlua_func_bhv_falling_pillar_init);
smlua_bind_function(L, "bhv_falling_pillar_loop", smlua_func_bhv_falling_pillar_loop);
smlua_bind_function(L, "bhv_ferris_wheel_axle_init", smlua_func_bhv_ferris_wheel_axle_init);
smlua_bind_function(L, "bhv_ferris_wheel_platform_init", smlua_func_bhv_ferris_wheel_platform_init);
smlua_bind_function(L, "bhv_ferris_wheel_platform_update", smlua_func_bhv_ferris_wheel_platform_update);
smlua_bind_function(L, "bhv_fire_piranha_plant_init", smlua_func_bhv_fire_piranha_plant_init);
smlua_bind_function(L, "bhv_fire_piranha_plant_update", smlua_func_bhv_fire_piranha_plant_update);