diff --git a/src/game/behaviors/drawbridge.inc.c b/src/game/behaviors/drawbridge.inc.c index 61c6019e2..075866c2e 100644 --- a/src/game/behaviors/drawbridge.inc.c +++ b/src/game/behaviors/drawbridge.inc.c @@ -17,6 +17,7 @@ void bhv_lll_drawbridge_spawner_init(void) { drawbridge[1]->oPosZ += sins(o->oMoveAngleYaw) * -640.0f; } + // syncing is done using a standard distance-based system if (!sync_object_is_initialized(o->oSyncID)) { sync_object_init(o, 3000.0f); for (s32 i = 0; i < 2; i++) { diff --git a/src/game/behaviors/elevator.inc.c b/src/game/behaviors/elevator.inc.c index 47190e840..a930f61b3 100644 --- a/src/game/behaviors/elevator.inc.c +++ b/src/game/behaviors/elevator.inc.c @@ -1,13 +1,16 @@ // elevator.c.inc +static s16 sElevatorHeights[] = { -51, 0, 0, -461, 0, 0, -512, 0, 0, -2611, 0, + 0, -2360, 0, 0, 214, 0, 0, -50, 1945, 1, 0 }; + void elevator_starting_shake(void) { cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1); cur_obj_shake_screen(SHAKE_POS_SMALL); } void elevator_act_0(void) { - struct MarioState* marioState = nearest_mario_state_to_object(o); - struct Object* player = marioState ? marioState->marioObj : NULL; + struct MarioState *marioState = nearest_mario_state_to_object(o); + struct Object *player = marioState ? marioState->marioObj : NULL; u8 onPlatform = FALSE; for (s32 i = 0; i < MAX_PLAYERS; i++) { @@ -40,8 +43,8 @@ void elevator_act_0(void) { } void elevator_act_1(void) { - struct MarioState* marioState = nearest_mario_state_to_object(o); - struct Object* player = marioState ? marioState->marioObj : NULL; + struct MarioState *marioState = nearest_mario_state_to_object(o); + struct Object *player = marioState ? marioState->marioObj : NULL; cur_obj_play_sound_1(SOUND_ENV_ELEVATOR1); if (o->oTimer == 0 && cur_obj_is_any_player_on_platform()) { @@ -64,8 +67,8 @@ void elevator_act_1(void) { } void elevator_act_2(void) { // Pretty similar code to action 1 - struct MarioState* marioState = nearest_mario_state_to_object(o); - struct Object* player = marioState ? marioState->marioObj : NULL; + struct MarioState *marioState = nearest_mario_state_to_object(o); + struct Object *player = marioState ? marioState->marioObj : NULL; cur_obj_play_sound_1(SOUND_ENV_ELEVATOR1); if (o->oTimer == 0 && cur_obj_is_any_player_on_platform()) { @@ -91,7 +94,7 @@ void elevator_act_2(void) { // Pretty similar code to action 1 } void elevator_act_4(void) { - struct MarioState* marioState = nearest_mario_state_to_object(o); + struct MarioState *marioState = nearest_mario_state_to_object(o); o->oVelY = 0; if (o->oTimer == 0) { @@ -105,9 +108,8 @@ void elevator_act_4(void) { if (marioState && marioState->playerIndex == 0 && o->oAction != 4) { network_send_object(o); } } -void elevator_act_3(void) // nearly identical to action 2 -{ - struct MarioState* marioState = nearest_mario_state_to_object(o); +void elevator_act_3(void) { // nearly identical to action 2 + struct MarioState *marioState = nearest_mario_state_to_object(o); o->oVelY = 0; if (o->oTimer == 0) { @@ -122,15 +124,15 @@ void elevator_act_3(void) // nearly identical to action 2 } void bhv_elevator_init(void) { - s32 sp1C = BHV_ARR(D_8032F38C, o->oBehParams2ndByte * 3 + 2, s16); - if (sp1C == 0) { - o->oElevatorUnkF4 = BHV_ARR(D_8032F38C, o->oBehParams2ndByte * 3, s16); + s32 index = BHV_ARR(sElevatorHeights, o->oBehParams2ndByte * 3 + 2, s16); + if (index == 0) { + o->oElevatorUnkF4 = BHV_ARR(sElevatorHeights, o->oBehParams2ndByte * 3, s16); o->oElevatorUnkF8 = o->oHomeY; o->oElevatorUnkFC = (o->oElevatorUnkF4 + o->oElevatorUnkF8) / 2; o->oElevatorUnk100 = cur_obj_has_behavior(bhvRrElevatorPlatform); } else { - o->oElevatorUnkF4 = BHV_ARR(D_8032F38C, o->oBehParams2ndByte * 3, s16); - o->oElevatorUnkF8 = BHV_ARR(D_8032F38C, o->oBehParams2ndByte * 3 + 1, s16); + o->oElevatorUnkF4 = BHV_ARR(sElevatorHeights, o->oBehParams2ndByte * 3, s16); + o->oElevatorUnkF8 = BHV_ARR(sElevatorHeights, o->oBehParams2ndByte * 3 + 1, s16); o->oElevatorUnkFC = (o->oElevatorUnkF4 + o->oElevatorUnkF8) / 2; o->oElevatorUnk100 = 2; } @@ -144,15 +146,6 @@ void bhv_elevator_init(void) { void (*sElevatorActions[])(void) = { elevator_act_0, elevator_act_1, elevator_act_2, elevator_act_3, elevator_act_4 }; -struct SpawnParticlesInfo D_8032F3CC = { 3, 20, MODEL_MIST, 20, 10, 5, 0, 0, 0, 30, 30.0f, 1.5f }; - -struct SpawnParticlesInfo D_8032F3E0 = { 0, 5, MODEL_SAND_DUST, 0, 0, 20, 20, 0, 252, 30, 5.0f, 2.0f }; - -s16 D_8032F3F4[] = { 2, -8, 1, 4 }; - -struct SpawnParticlesInfo D_8032F3FC = { 0, 5, MODEL_WHITE_PARTICLE_DL, 0, 0, 20, 20, 0, 252, 30, - 2.0f, 2.0f }; - void bhv_elevator_loop(void) { CUR_OBJ_CALL_ACTION_FUNCTION(sElevatorActions); diff --git a/src/game/behaviors/end_birds_1.inc.c b/src/game/behaviors/end_birds_1.inc.c index 532c27280..025994026 100644 --- a/src/game/behaviors/end_birds_1.inc.c +++ b/src/game/behaviors/end_birds_1.inc.c @@ -1,8 +1,7 @@ // end_birds_1.inc.c void bhv_end_birds_1_loop(void) { - Vec3f sp34; - UNUSED f32 sp30 = random_float(); + Vec3f pos; switch (gCurrentObject->oAction) { case 0: @@ -13,15 +12,18 @@ void bhv_end_birds_1_loop(void) { gCurrentObject->oAction += 1; break; case 1: - vec3f_set(sp34, gCurrentObject->oIntroLakituUnk110, gCurrentObject->oIntroLakituUnk10C, + vec3f_set(pos, gCurrentObject->oIntroLakituUnk110, gCurrentObject->oIntroLakituUnk10C, gCurrentObject->oIntroLakituUnk108); - if (gCurrentObject->oTimer < 100) - obj_rotate_towards_point(gCurrentObject, sp34, 0, 0, 0x20, 0x20); - if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0)) + if (gCurrentObject->oTimer < 100) { + obj_rotate_towards_point(gCurrentObject, pos, 0, 0, 0x20, 0x20); + } + if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0)) { cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY); - if (gCutsceneTimer == 0) + } + if (gCutsceneTimer == 0) { obj_mark_for_deletion(gCurrentObject); + } break; } diff --git a/src/game/behaviors/end_birds_2.inc.c b/src/game/behaviors/end_birds_2.inc.c index 9526448ea..9fd4f1759 100644 --- a/src/game/behaviors/end_birds_2.inc.c +++ b/src/game/behaviors/end_birds_2.inc.c @@ -1,12 +1,10 @@ // end_birds_2.inc.c void bhv_end_birds_2_loop(void) { - Vec3f sp3C; - UNUSED f32 sp38; - f32 sp34; - s16 sp32, sp30; + Vec3f pos; + f32 dist; + s16 pitch, yaw; - sp38 = random_float(); gCurrentObject->oForwardVel = (random_float() * 10.f) + 25.f; switch (gCurrentObject->oAction) { @@ -15,15 +13,15 @@ void bhv_end_birds_2_loop(void) { gCurrentObject->oAction += 1; break; case 1: - vec3f_get_dist_and_angle(gCamera->pos, gCamera->focus, &sp34, &sp32, - &sp30); - sp30 += 0x1000; - sp32 += 0; // nice work, Nintendo - vec3f_set_dist_and_angle(gCamera->pos, sp3C, 14000.f, sp32, sp30); - obj_rotate_towards_point(gCurrentObject, sp3C, 0, 0, 8, 8); + vec3f_get_dist_and_angle(gCamera->pos, gCamera->focus, &dist, &pitch, &yaw); + yaw += 0x1000; + pitch += 0; // nice work, Nintendo + vec3f_set_dist_and_angle(gCamera->pos, pos, 14000.f, pitch, yaw); + obj_rotate_towards_point(gCurrentObject, pos, 0, 0, 8, 8); - if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0)) + if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0)) { cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY); + } break; } diff --git a/src/game/behaviors/ground_particles.inc.c b/src/game/behaviors/ground_particles.inc.c index 64056347e..a6f21a085 100644 --- a/src/game/behaviors/ground_particles.inc.c +++ b/src/game/behaviors/ground_particles.inc.c @@ -1,26 +1,35 @@ // ground_particles.c.inc +struct SpawnParticlesInfo sMistParticles = { 3, 20, MODEL_MIST, 20, 10, 5, 0, 0, 0, 30, 30.0f, 1.5f }; + +struct SpawnParticlesInfo sSandParticles = { 0, 5, MODEL_SAND_DUST, 0, 0, 20, 20, 0, 252, 30, 5.0f, 2.0f }; + +static s16 sSmokeMovementParams[] = { 2, -8, 1, 4 }; + +struct SpawnParticlesInfo sSnowParticles = { 0, 5, MODEL_WHITE_PARTICLE_DL, 0, 0, 20, 20, 0, 252, 30, + 2.0f, 2.0f }; + void bhv_pound_white_puffs_init(void) { clear_particle_flags(0x8000); spawn_mist_from_global(); } void spawn_mist_from_global(void) { - cur_obj_spawn_particles(&D_8032F3CC); + cur_obj_spawn_particles(&sMistParticles); } void bhv_ground_sand_init(void) { clear_particle_flags(0x4000); - cur_obj_spawn_particles(&D_8032F3E0); + cur_obj_spawn_particles(&sSandParticles); } void spawn_smoke_with_velocity(void) { struct Object *smoke = spawn_object_with_scale(o, MODEL_SMOKE, bhvWhitePuffSmoke2, 1.0f); if (smoke == NULL) { return; } - smoke->oForwardVel = D_8032F3F4[0]; - smoke->oVelY = D_8032F3F4[1]; - smoke->oGravity = D_8032F3F4[2]; - obj_translate_xyz_random(smoke, D_8032F3F4[3]); + smoke->oForwardVel = sSmokeMovementParams[0]; + smoke->oVelY = sSmokeMovementParams[1]; + smoke->oGravity = sSmokeMovementParams[2]; + obj_translate_xyz_random(smoke, sSmokeMovementParams[3]); } // TODO Fix name @@ -32,5 +41,5 @@ void clear_particle_flags(u32 flags) { void bhv_ground_snow_init(void) { clear_particle_flags(1 << 16); - cur_obj_spawn_particles(&D_8032F3FC); + cur_obj_spawn_particles(&sSnowParticles); } diff --git a/src/game/behaviors/tumbling_bridge.inc.c b/src/game/behaviors/tumbling_bridge.inc.c index b90368657..96cf0b9bd 100644 --- a/src/game/behaviors/tumbling_bridge.inc.c +++ b/src/game/behaviors/tumbling_bridge.inc.c @@ -154,9 +154,6 @@ void tumbling_bridge_act_0(void) { void (*sTumblingBridgeActions[])(void) = { tumbling_bridge_act_0, tumbling_bridge_act_1, tumbling_bridge_act_2, tumbling_bridge_act_3 }; -s16 D_8032F38C[] = { -51, 0, 0, -461, 0, 0, -512, 0, 0, -2611, 0, - 0, -2360, 0, 0, 214, 0, 0, -50, 1945, 1, 0 }; - void bhv_tumbling_bridge_loop(void) { if (!sync_object_is_initialized(o->oSyncID)) { struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);