diff --git a/src/game/behaviors/cloud.inc.c b/src/game/behaviors/cloud.inc.c index c91279f52..a019efe1b 100644 --- a/src/game/behaviors/cloud.inc.c +++ b/src/game/behaviors/cloud.inc.c @@ -145,9 +145,9 @@ static void cloud_act_main(void) { } else if (o->oBehParams2ndByte != CLOUD_BP_FWOOSH) { // This code should never run, since a lakitu cloud should always have // a parent - if (o->oDistanceToMario > 1500.0f) { + /*if (o->oDistanceToMario > 1500.0f) { o->oAction = CLOUD_ACT_UNLOAD; - } + }*/ } else { cloud_fwoosh_update(); } diff --git a/src/game/behaviors/koopa.inc.c b/src/game/behaviors/koopa.inc.c index 39012f6ae..8c4362673 100644 --- a/src/game/behaviors/koopa.inc.c +++ b/src/game/behaviors/koopa.inc.c @@ -371,6 +371,10 @@ static void koopa_shelled_update(void) { * action. */ static void koopa_unshelled_act_run(void) { + struct Object* player = nearest_player_to_object(o); + int distanceToPlayer = dist_between_objects(o, player); + int angleToPlayer = obj_angle_to_object(o, player); + f32 distToShell = 99999.0f; struct Object *shell; @@ -380,9 +384,6 @@ static void koopa_unshelled_act_run(void) { if (o->oKoopaTurningAwayFromWall) { o->oKoopaTurningAwayFromWall = obj_resolve_collisions_and_turn(o->oKoopaTargetYaw, 0x600); } else { - struct Object* player = nearest_player_to_object(o); - int distanceToPlayer = dist_between_objects(o, player); - int angleToPlayer = obj_angle_to_object(o, player); // If far from home, then turn toward home if (distanceToPlayer >= 25000.0f) { @@ -413,7 +414,7 @@ static void koopa_unshelled_act_run(void) { cur_obj_rotate_yaw_toward(o->oKoopaTargetYaw, 0x600); } else { // otherwise continue running from mario - cur_obj_rotate_yaw_toward(o->oAngleToMario + 0x8000, 0x600); + cur_obj_rotate_yaw_toward(angleToPlayer + 0x8000, 0x600); } } diff --git a/src/game/behaviors/monty_mole.inc.c b/src/game/behaviors/monty_mole.inc.c index 5f194567e..861fea32b 100644 --- a/src/game/behaviors/monty_mole.inc.c +++ b/src/game/behaviors/monty_mole.inc.c @@ -215,8 +215,11 @@ static void monty_mole_act_select_hole(void) { o->oPosY = o->oFloorHeight = o->oMontyMoleCurrentHole->oPosY; o->oPosZ = o->oMontyMoleCurrentHole->oPosZ; + struct Object* holePlayer = nearest_player_to_object(o->oMontyMoleCurrentHole); + int angleToHolePlayer = obj_angle_to_object(o->oMontyMoleCurrentHole, holePlayer); + o->oFaceAnglePitch = 0; - o->oMoveAngleYaw = o->oMontyMoleCurrentHole->oAngleToMario; + o->oMoveAngleYaw = angleToHolePlayer; struct Object* player = nearest_player_to_object(o); int distanceToPlayer = dist_between_objects(o, player); diff --git a/src/game/behaviors/moving_coin.inc.c b/src/game/behaviors/moving_coin.inc.c index 5073ea48e..a470065cc 100644 --- a/src/game/behaviors/moving_coin.inc.c +++ b/src/game/behaviors/moving_coin.inc.c @@ -149,10 +149,13 @@ void bhv_blue_coin_sliding_jumping_init(void) { } void blue_coin_sliding_away_from_mario(void) { + struct Object* player = nearest_player_to_object(o); + int angleToPlayer = obj_angle_to_object(o, player); + s16 collisionFlags; o->oForwardVel = 15.0; - o->oMoveAngleYaw = o->oAngleToMario + 0x8000; + o->oMoveAngleYaw = angleToPlayer + 0x8000; if (coin_step(&collisionFlags) != 0) o->oVelY += 18.0f; diff --git a/src/game/behaviors/piranha_bubbles.inc.c b/src/game/behaviors/piranha_bubbles.inc.c index 581a4d0e8..0b3806ec8 100644 --- a/src/game/behaviors/piranha_bubbles.inc.c +++ b/src/game/behaviors/piranha_bubbles.inc.c @@ -39,6 +39,9 @@ void bhv_piranha_plant_bubble_loop(void) { cur_obj_set_pos_relative(parent, 0, 72.0f, 180.0f); + struct Object* parentPlayer = nearest_player_to_object(parent); + int distanceToParentPlayer = dist_between_objects(parent, parentPlayer); + switch (o->oAction) { case PIRANHA_PLANT_BUBBLE_ACT_IDLE: cur_obj_disable_rendering(); @@ -50,7 +53,7 @@ void bhv_piranha_plant_bubble_loop(void) { break; case PIRANHA_PLANT_BUBBLE_ACT_GROW_SHRINK_LOOP: - if (parent->oDistanceToMario < parent->oDrawingDistance) { + if (distanceToParentPlayer < parent->oDrawingDistance) { cur_obj_enable_rendering(); if (parent->oAction == PIRANHA_PLANT_ACT_SLEEPING) { diff --git a/src/game/behaviors/scuttlebug.inc.c b/src/game/behaviors/scuttlebug.inc.c index 295ecec22..770369230 100644 --- a/src/game/behaviors/scuttlebug.inc.c +++ b/src/game/behaviors/scuttlebug.inc.c @@ -61,11 +61,11 @@ void bhv_scuttlebug_loop(void) { case 1: o->oForwardVel = 5.0f; if (cur_obj_lateral_dist_from_obj_to_home(player) > 1000.0f) - o->oAngleToMario = angleToPlayer; + angleToPlayer = angleToPlayer; else { if (o->oScuttlebugUnkF8 == 0) { o->oScuttlebugUnkFC = 0; - o->oAngleToMario = obj_angle_to_object(o, player); + angleToPlayer = obj_angle_to_object(o, player); if (abs_angle_diff(angleToPlayer, o->oMoveAngleYaw) < 0x800) { o->oScuttlebugUnkF8 = 1; o->oVelY = 20.0f; @@ -84,11 +84,11 @@ void bhv_scuttlebug_loop(void) { break; case 2: o->oForwardVel = 5.0f; - if ((s16) o->oMoveAngleYaw == (s16) o->oAngleToMario) + if ((s16) o->oMoveAngleYaw == (s16)angleToPlayer) o->oSubAction = 1; if (o->oPosY - o->oHomeY < -200.0f) obj_mark_for_deletion(o); - cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400); + cur_obj_rotate_yaw_toward(angleToPlayer, 0x400); break; case 3: o->oFlags &= ~8; diff --git a/src/game/behaviors/shock_wave.inc.c b/src/game/behaviors/shock_wave.inc.c index 7c12c8038..6e6cd644e 100644 --- a/src/game/behaviors/shock_wave.inc.c +++ b/src/game/behaviors/shock_wave.inc.c @@ -20,7 +20,7 @@ void bhv_bowser_shock_wave_loop(void) { sp20 = o->oBowserShockWaveUnkF4 * D_8032F420[3]; if ((sp2C < o->oDistanceToMario && o->oDistanceToMario < sp28) || (sp24 < o->oDistanceToMario && o->oDistanceToMario < sp20)) - gMarioObject->oInteractStatus |= + gMarioStates[0].marioObj->oInteractStatus |= 0x10; // This is interact_coin, but the name sounds wrong in this behiavor } } diff --git a/src/game/behaviors/spindrift.inc.c b/src/game/behaviors/spindrift.inc.c index 348c12c23..3512677fd 100644 --- a/src/game/behaviors/spindrift.inc.c +++ b/src/game/behaviors/spindrift.inc.c @@ -30,9 +30,9 @@ void bhv_spindrift_loop(void) { case 0: approach_forward_vel(&o->oForwardVel, 4.0f, 1.0f); if (cur_obj_lateral_dist_from_mario_to_home() > 1000.0f) - o->oAngleToMario = cur_obj_angle_to_home(); + angleToPlayer = cur_obj_angle_to_home(); else if (distanceToPlayer > 300.0f) - o->oAngleToMario = angleToPlayer; + angleToPlayer = angleToPlayer; cur_obj_rotate_yaw_toward(angleToPlayer, 0x400); break; case 1: