diff --git a/actors/mario/geo2.inc.c b/actors/mario/geo2.inc.c index 9ea0cf0c..884bf5a5 100644 --- a/actors/mario/geo2.inc.c +++ b/actors/mario/geo2.inc.c @@ -81,11 +81,11 @@ const GeoLayout luigi_geo_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_OPAQUE, mario_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_peace), // here we go hand GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_cap), @@ -200,11 +200,11 @@ const GeoLayout luigi_geo_medium_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_OPAQUE, mario_medium_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_peace), // here we go hand GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_cap), @@ -367,11 +367,11 @@ const GeoLayout luigi_geo_low_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_OPAQUE, mario_low_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_peace), // here we go hand GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_cap), @@ -536,11 +536,11 @@ const GeoLayout luigi_vanish_geo_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_TRANSPARENT, mario_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_peace), // here we go hand GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_cap), @@ -655,11 +655,11 @@ const GeoLayout luigi_vanish_geo_medium_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_TRANSPARENT, mario_medium_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_peace), // here we go hand GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_cap), @@ -822,11 +822,11 @@ const GeoLayout luigi_vanish_geo_low_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_TRANSPARENT, mario_low_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_peace), // here we go hand GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_cap), @@ -971,11 +971,11 @@ const GeoLayout luigi_metal_geo_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_OPAQUE, mario_metal_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_metal_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_peace_shared_dl), // here we go hand GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_metal_right_hand_cap_shared_dl), @@ -1090,11 +1090,11 @@ const GeoLayout luigi_metal_geo_medium_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_OPAQUE, mario_metal_medium_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_metal_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_peace_shared_dl), // here we go hand GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_metal_right_hand_cap_shared_dl), @@ -1237,11 +1237,11 @@ const GeoLayout luigi_metal_geo_low_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_OPAQUE, mario_metal_low_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_metal_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_right_hand_peace_shared_dl), // here we go hand GEO_ANIMATED_PART(LAYER_OPAQUE, 60, 0, 0, mario_metal_right_hand_cap_shared_dl), @@ -1386,11 +1386,11 @@ const GeoLayout luigi_metal_vanish_geo_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_TRANSPARENT, mario_metal_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_metal_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_peace_shared_dl), // here we go hand GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_metal_right_hand_cap_shared_dl), @@ -1505,11 +1505,11 @@ const GeoLayout luigi_metal_vanish_geo_medium_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_TRANSPARENT, mario_metal_medium_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_metal_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_peace_shared_dl), // here we go hand GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_metal_right_hand_cap_shared_dl), @@ -1655,11 +1655,11 @@ const GeoLayout luigi_metal_vanish_geo_low_poly_right_hand[] = { GEO_OPEN_NODE(), GEO_DISPLAY_LIST(LAYER_TRANSPARENT, mario_metal_low_poly_right_hand_closed), GEO_CLOSE_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_metal_right_hand_open), GEO_OPEN_NODE(), - GEO_HELD_OBJECT(0x00, 0, 0, 0, geo_switch_mario_hand_grab_pos), + GEO_HELD_OBJECT(0x01, 0, 0, 0, geo_switch_mario_hand_grab_pos), GEO_CLOSE_NODE(), GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_right_hand_peace_shared_dl), // here we go hand GEO_ANIMATED_PART(LAYER_TRANSPARENT, 60, 0, 0, mario_metal_right_hand_cap_shared_dl), diff --git a/levels/castle_grounds/script.c b/levels/castle_grounds/script.c index 4b5c2ef1..e3862438 100644 --- a/levels/castle_grounds/script.c +++ b/levels/castle_grounds/script.c @@ -89,6 +89,8 @@ static const LevelScript script_func_local_4[] = { OBJECT(/*model*/ MODEL_BUTTERFLY, /*pos*/ -1504, 326, 3196, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvButterfly), OBJECT(/*model*/ MODEL_BUTTERFLY, /*pos*/ -1204, 326, 3296, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvButterfly), OBJECT(/*model*/ MODEL_YOSHI, /*pos*/ 0, 3174, -5625, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvYoshi), + // TESTING BELOW + OBJECT(/*model*/ MODEL_BLACK_BOBOMB, /*pos*/ -2028, 260, 4664, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvBobomb), RETURN(), }; diff --git a/src/game/behaviors/bobomb.inc.c b/src/game/behaviors/bobomb.inc.c index 4d10d978..5c52f5c2 100644 --- a/src/game/behaviors/bobomb.inc.c +++ b/src/game/behaviors/bobomb.inc.c @@ -48,7 +48,8 @@ void bobomb_check_interactions(void) { { if ((o->oInteractStatus & INT_STATUS_MARIO_UNK1) != 0) { - o->oMoveAngleYaw = gMarioObject->header.gfx.angle[1]; + struct Object* player = nearest_player_object(o->oPosX, o->oPosY, o->oPosZ); + o->oMoveAngleYaw = player->header.gfx.angle[1]; o->oForwardVel = 25.0; o->oVelY = 30.0; o->oAction = BOBOMB_ACT_LAUNCHED; @@ -73,8 +74,9 @@ void bobomb_act_patrol(void) { o->oForwardVel = 5.0; collisionFlags = object_step(); + struct Object* player = nearest_player_object(o->oPosX, o->oPosY, o->oPosZ); if ((obj_return_home_if_safe(o, o->oHomeX, o->oHomeY, o->oHomeZ, 400) == 1) - && (obj_check_if_facing_toward_angle(o->oMoveAngleYaw, o->oAngleToMario, 0x2000) == 1)) { + && (obj_check_if_facing_toward_angle(o->oMoveAngleYaw, obj_angle_to_object(o, player), 0x2000) == 1)) { o->oBobombFuseLit = 1; o->oAction = BOBOMB_ACT_CHASE_MARIO; } @@ -93,7 +95,8 @@ void bobomb_act_chase_mario(void) { if (sp1a == 5 || sp1a == 16) cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK); - obj_turn_toward_object(o, gMarioObject, 16, 0x800); + struct Object* player = nearest_player_object(o->oPosX, o->oPosY, o->oPosZ); + obj_turn_toward_object(o, player, 16, 0x800); obj_check_floor_death(collisionFlags, sObjFloor); } @@ -176,14 +179,15 @@ void bobomb_free_loop(void) { void bobomb_held_loop(void) { o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; cur_obj_init_animation(1); - cur_obj_set_pos_relative(gMarioObject, 0, 60.0f, 100.0); + struct Object* player = nearest_player_object(o->oPosX, o->oPosY, o->oPosZ); + cur_obj_set_pos_relative(player, 0, 60.0f, 100.0); o->oBobombFuseLit = 1; if (o->oBobombFuseTimer >= 151) { //! Although the Bob-omb's action is set to explode when the fuse timer expires, // bobomb_act_explode() will not execute until the bob-omb's held state changes. // This allows the Bob-omb to be regrabbed indefinitely. - gMarioObject->oInteractStatus |= INT_STATUS_MARIO_DROP_OBJECT; + player->oInteractStatus |= INT_STATUS_MARIO_DROP_OBJECT; o->oAction = BOBOMB_ACT_EXPLODE; } } @@ -298,8 +302,9 @@ void bobomb_buddy_act_idle(void) { if ((sp1a == 5) || (sp1a == 16)) cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK); - if (o->oDistanceToMario < 1000.0f) - o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, 0x140); + struct Object* player = nearest_player_object(o->oPosX, o->oPosY, o->oPosZ); + if (dist_between_objects(o, player) < 1000.0f) + o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, obj_angle_to_object(o, player), 0x140); if (o->oInteractStatus == INT_STATUS_INTERACTED) o->oAction = BOBOMB_BUDDY_ACT_TURN_TO_TALK; @@ -387,8 +392,10 @@ void bobomb_buddy_act_turn_to_talk(void) { if ((sp1e == 5) || (sp1e == 16)) cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK); - o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, 0x1000); - if ((s16) o->oMoveAngleYaw == (s16) o->oAngleToMario) + struct Object* player = nearest_player_object(o->oPosX, o->oPosY, o->oPosZ); + int angleToPlayer = obj_angle_to_object(o, player); + o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, angleToPlayer, 0x1000); + if ((s16) o->oMoveAngleYaw == (s16) angleToPlayer) o->oAction = BOBOMB_BUDDY_ACT_TALK; cur_obj_play_sound_2(SOUND_ACTION_READ_SIGN);