Synchronized metal boxes
This commit is contained in:
parent
baaa84d14c
commit
bd7d03975e
|
@ -25,14 +25,22 @@ s32 check_if_moving_over_floor(f32 a0, f32 a1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void bhv_pushable_loop(void) {
|
void bhv_pushable_loop(void) {
|
||||||
|
if (!network_sync_object_initialized(o)) {
|
||||||
|
network_init_object(o, 1000.0f);
|
||||||
|
network_init_object_field(o, &o->oMoveAngleYaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||||
|
struct Object* player = marioState->marioObj;
|
||||||
|
|
||||||
UNUSED s16 unused;
|
UNUSED s16 unused;
|
||||||
s16 sp1C;
|
s16 sp1C;
|
||||||
obj_set_hitbox(o, &sMetalBoxHitbox);
|
obj_set_hitbox(o, &sMetalBoxHitbox);
|
||||||
o->oForwardVel = 0.0f;
|
o->oForwardVel = 0.0f;
|
||||||
if (obj_check_if_collided_with_object(o, gMarioObject) && gMarioStates->flags & 0x80000000) {
|
if (obj_check_if_collided_with_object(o, player) && marioState->flags & 0x80000000) {
|
||||||
sp1C = obj_angle_to_object(o, gMarioObject);
|
sp1C = obj_angle_to_object(o, player);
|
||||||
if (abs_angle_diff(sp1C, gMarioObject->oMoveAngleYaw) > 0x4000) {
|
if (abs_angle_diff(sp1C, player->oMoveAngleYaw) > 0x4000) {
|
||||||
o->oMoveAngleYaw = (s16)((gMarioObject->oMoveAngleYaw + 0x2000) & 0xc000);
|
o->oMoveAngleYaw = (s16)((player->oMoveAngleYaw + 0x2000) & 0xc000);
|
||||||
if (check_if_moving_over_floor(8.0f, 150.0f)) {
|
if (check_if_moving_over_floor(8.0f, 150.0f)) {
|
||||||
o->oForwardVel = 4.0f;
|
o->oForwardVel = 4.0f;
|
||||||
cur_obj_play_sound_1(SOUND_ENV_METAL_BOX_PUSH);
|
cur_obj_play_sound_1(SOUND_ENV_METAL_BOX_PUSH);
|
||||||
|
|
Loading…
Reference in New Issue