2019-08-25 04:46:40 +00:00
|
|
|
// bobomb.c.inc
|
|
|
|
|
|
|
|
static struct ObjectHitbox sBobombHitbox = {
|
|
|
|
/* interactType: */ INTERACT_GRABBABLE,
|
|
|
|
/* downOffset: */ 0,
|
|
|
|
/* damageOrCoinValue: */ 0,
|
|
|
|
/* health: */ 0,
|
|
|
|
/* numLootCoins: */ 0,
|
|
|
|
/* radius: */ 65,
|
|
|
|
/* height: */ 113,
|
|
|
|
/* hurtboxRadius: */ 0,
|
|
|
|
/* hurtboxHeight: */ 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
void bhv_bobomb_init(void) {
|
|
|
|
o->oGravity = 2.5;
|
|
|
|
o->oFriction = 0.8;
|
|
|
|
o->oBuoyancy = 1.3;
|
2019-09-01 19:50:50 +00:00
|
|
|
o->oInteractionSubtype = INT_SUBTYPE_KICKABLE;
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_spawn_coin(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (((o->oBehParams >> 8) & 0x1) == 0) {
|
2019-12-02 02:52:53 +00:00
|
|
|
obj_spawn_yellow_coins(o, 1);
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oBehParams = 0x100;
|
|
|
|
set_object_respawn_info_bits(o, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_act_explode(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
struct Object *explosion;
|
|
|
|
if (o->oTimer < 5)
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_scale(1.0 + (f32) o->oTimer / 5.0);
|
2019-08-25 04:46:40 +00:00
|
|
|
else {
|
|
|
|
explosion = spawn_object(o, MODEL_EXPLOSION, bhvExplosion);
|
|
|
|
explosion->oGraphYOffset += 100.0f;
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_spawn_coin();
|
2019-08-25 04:46:40 +00:00
|
|
|
create_respawner(MODEL_BLACK_BOBOMB, bhvBobomb, 3000);
|
|
|
|
o->activeFlags = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
|
|
|
|
void bobomb_check_interactions(void) {
|
|
|
|
obj_set_hitbox(o, &sBobombHitbox);
|
2020-04-03 18:57:26 +00:00
|
|
|
if ((o->oInteractStatus & INT_STATUS_INTERACTED) != 0)
|
2019-08-25 04:46:40 +00:00
|
|
|
{
|
2020-04-03 18:57:26 +00:00
|
|
|
if ((o->oInteractStatus & INT_STATUS_MARIO_UNK1) != 0)
|
2019-08-25 04:46:40 +00:00
|
|
|
{
|
|
|
|
o->oMoveAngleYaw = gMarioObject->header.gfx.angle[1];
|
|
|
|
o->oForwardVel = 25.0;
|
|
|
|
o->oVelY = 30.0;
|
|
|
|
o->oAction = BOBOMB_ACT_LAUNCHED;
|
|
|
|
}
|
|
|
|
|
2020-04-03 18:57:26 +00:00
|
|
|
if ((o->oInteractStatus & INT_STATUS_TOUCHED_BOB_OMB) != 0)
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAction = BOBOMB_ACT_EXPLODE;
|
|
|
|
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
if (obj_attack_collided_from_other_object(o) == 1)
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAction = BOBOMB_ACT_EXPLODE;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_act_patrol(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
UNUSED s8 filler[4];
|
|
|
|
UNUSED s16 sp22;
|
|
|
|
s16 collisionFlags;
|
|
|
|
|
|
|
|
sp22 = o->header.gfx.unk38.animFrame;
|
|
|
|
o->oForwardVel = 5.0;
|
|
|
|
|
2019-12-02 02:52:53 +00:00
|
|
|
collisionFlags = object_step();
|
|
|
|
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)) {
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oBobombFuseLit = 1;
|
|
|
|
o->oAction = BOBOMB_ACT_CHASE_MARIO;
|
|
|
|
}
|
2019-12-02 02:52:53 +00:00
|
|
|
obj_check_floor_death(collisionFlags, sObjFloor);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_act_chase_mario(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
UNUSED u8 filler[4];
|
|
|
|
s16 sp1a, collisionFlags;
|
|
|
|
|
|
|
|
sp1a = ++o->header.gfx.unk38.animFrame;
|
|
|
|
o->oForwardVel = 20.0;
|
|
|
|
|
2019-12-02 02:52:53 +00:00
|
|
|
collisionFlags = object_step();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
if (sp1a == 5 || sp1a == 16)
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
obj_turn_toward_object(o, gMarioObject, 16, 0x800);
|
2019-12-02 02:52:53 +00:00
|
|
|
obj_check_floor_death(collisionFlags, sObjFloor);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_act_launched(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
s16 collisionFlags = 0;
|
2019-12-02 02:52:53 +00:00
|
|
|
collisionFlags = object_step();
|
2020-02-03 05:51:26 +00:00
|
|
|
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == OBJ_COL_FLAG_GROUNDED)
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAction = BOBOMB_ACT_EXPLODE; /* bit 0 */
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void generic_bobomb_free_loop(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
switch (o->oAction) {
|
|
|
|
case BOBOMB_ACT_PATROL:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_act_patrol();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_LAUNCHED:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_act_launched();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_CHASE_MARIO:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_act_chase_mario();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_EXPLODE:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_act_explode();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_LAVA_DEATH:
|
2019-12-02 02:52:53 +00:00
|
|
|
if (obj_lava_death() == 1)
|
2019-08-25 04:46:40 +00:00
|
|
|
create_respawner(MODEL_BLACK_BOBOMB, bhvBobomb, 3000);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_DEATH_PLANE_DEATH:
|
|
|
|
o->activeFlags = 0;
|
|
|
|
create_respawner(MODEL_BLACK_BOBOMB, bhvBobomb, 3000);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_check_interactions();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
if (o->oBobombFuseTimer >= 151)
|
|
|
|
o->oAction = 3;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void stationary_bobomb_free_loop(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
switch (o->oAction) {
|
|
|
|
case BOBOMB_ACT_LAUNCHED:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_act_launched();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_EXPLODE:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_act_explode();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_LAVA_DEATH:
|
2019-12-02 02:52:53 +00:00
|
|
|
if (obj_lava_death() == 1)
|
2019-08-25 04:46:40 +00:00
|
|
|
create_respawner(MODEL_BLACK_BOBOMB, bhvBobomb, 3000);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_ACT_DEATH_PLANE_DEATH:
|
|
|
|
o->activeFlags = 0;
|
|
|
|
create_respawner(MODEL_BLACK_BOBOMB, bhvBobomb, 3000);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_check_interactions();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
if (o->oBobombFuseTimer >= 151)
|
|
|
|
o->oAction = 3;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_free_loop(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oBehParams2ndByte == BOBOMB_BP_STYPE_GENERIC)
|
2020-03-02 03:42:52 +00:00
|
|
|
generic_bobomb_free_loop();
|
2019-08-25 04:46:40 +00:00
|
|
|
else
|
2020-03-02 03:42:52 +00:00
|
|
|
stationary_bobomb_free_loop();
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_held_loop(void) {
|
2020-04-03 18:57:26 +00:00
|
|
|
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_init_animation(1);
|
|
|
|
cur_obj_set_pos_relative(gMarioObject, 0, 60.0f, 100.0);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
o->oBobombFuseLit = 1;
|
|
|
|
if (o->oBobombFuseTimer >= 151) {
|
|
|
|
//! Although the Bob-omb's action is set to explode when the fuse timer expires,
|
2020-03-02 03:42:52 +00:00
|
|
|
// bobomb_act_explode() will not execute until the bob-omb's held state changes.
|
2019-08-25 04:46:40 +00:00
|
|
|
// This allows the Bob-omb to be regrabbed indefinitely.
|
2020-04-03 18:57:26 +00:00
|
|
|
gMarioObject->oInteractStatus |= INT_STATUS_MARIO_DROP_OBJECT;
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAction = BOBOMB_ACT_EXPLODE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_dropped_loop(void) {
|
|
|
|
cur_obj_get_dropped();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
2020-04-03 18:57:26 +00:00
|
|
|
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_init_animation(0);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
o->oHeldState = 0;
|
|
|
|
o->oAction = BOBOMB_ACT_PATROL;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_thrown_loop(void) {
|
|
|
|
cur_obj_enable_rendering_2();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
2020-04-03 18:57:26 +00:00
|
|
|
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oHeldState = 0;
|
|
|
|
o->oFlags &= ~0x8; /* bit 3 */
|
|
|
|
o->oForwardVel = 25.0;
|
|
|
|
o->oVelY = 20.0;
|
|
|
|
o->oAction = BOBOMB_ACT_LAUNCHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
// sp18 = blinkTimer
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void curr_obj_random_blink(s32 *blinkTimer) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (*blinkTimer == 0) {
|
2020-04-03 18:57:26 +00:00
|
|
|
if ((s16)(random_float() * 100.0f) == 0) {
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oAnimState = 1;
|
|
|
|
*blinkTimer = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
(*blinkTimer)++;
|
|
|
|
if (*blinkTimer >= 6)
|
|
|
|
o->oAnimState = 0;
|
|
|
|
if (*blinkTimer >= 11)
|
|
|
|
o->oAnimState = 1;
|
|
|
|
if (*blinkTimer >= 16) {
|
|
|
|
o->oAnimState = 0;
|
|
|
|
*blinkTimer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_bobomb_loop(void) {
|
|
|
|
s8 dustPeriodMinus1;
|
|
|
|
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 4000) != 0) {
|
|
|
|
switch (o->oHeldState) {
|
|
|
|
case HELD_FREE:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_free_loop();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HELD_HELD:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_held_loop();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HELD_THROWN:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_thrown_loop();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HELD_DROPPED:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_dropped_loop();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
curr_obj_random_blink(&o->oBobombBlinkTimer);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
if (o->oBobombFuseLit == 1) {
|
|
|
|
if (o->oBobombFuseTimer >= 121)
|
|
|
|
dustPeriodMinus1 = 1;
|
|
|
|
else
|
|
|
|
dustPeriodMinus1 = 7;
|
|
|
|
|
|
|
|
if ((dustPeriodMinus1 & o->oBobombFuseTimer)
|
|
|
|
== 0) /* oBobombFuseTimer % 2 or oBobombFuseTimer % 8 */
|
|
|
|
spawn_object(o, MODEL_SMOKE, bhvBobombFuseSmoke);
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_1(SOUND_AIR_BOBOMB_LIT_FUSE);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
o->oBobombFuseTimer++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_bobomb_fuse_smoke_init(void) {
|
2020-04-03 18:57:26 +00:00
|
|
|
o->oPosX += (s32)(random_float() * 80.0f) - 40;
|
|
|
|
o->oPosY += (s32)(random_float() * 80.0f) + 60;
|
|
|
|
o->oPosZ += (s32)(random_float() * 80.0f) - 40;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_scale(1.2f);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_bobomb_buddy_init(void) {
|
|
|
|
o->oGravity = 2.5;
|
|
|
|
o->oFriction = 0.8;
|
|
|
|
o->oBuoyancy = 1.3;
|
2019-09-01 19:50:50 +00:00
|
|
|
o->oInteractionSubtype = INT_SUBTYPE_NPC;
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_buddy_act_idle(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
UNUSED u8 filler[4];
|
|
|
|
s16 sp1a = o->header.gfx.unk38.animFrame;
|
|
|
|
UNUSED s16 collisionFlags = 0;
|
|
|
|
|
|
|
|
o->oBobombBuddyPosXCopy = o->oPosX;
|
|
|
|
o->oBobombBuddyPosYCopy = o->oPosY;
|
|
|
|
o->oBobombBuddyPosZCopy = o->oPosZ;
|
|
|
|
|
2019-12-02 02:52:53 +00:00
|
|
|
collisionFlags = object_step();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
if ((sp1a == 5) || (sp1a == 16))
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
if (o->oDistanceToMario < 1000.0f)
|
|
|
|
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, 0x140);
|
|
|
|
|
|
|
|
if (o->oInteractStatus == INT_STATUS_INTERACTED)
|
|
|
|
o->oAction = BOBOMB_BUDDY_ACT_TURN_TO_TALK;
|
|
|
|
}
|
|
|
|
|
2019-10-05 19:08:05 +00:00
|
|
|
/**
|
|
|
|
* Function for the Bob-omb Buddy cannon guy.
|
2020-02-03 05:51:26 +00:00
|
|
|
* dialogFirstText is the first dialogID called when Bob-omb Buddy
|
2019-10-05 19:08:05 +00:00
|
|
|
* starts to talk to Mario to prepare the cannon(s) for him.
|
|
|
|
* Then the camera goes to the nearest cannon, to play the "prepare cannon" cutscene
|
|
|
|
* dialogSecondText is called after Bob-omb Buddy has the cannon(s) ready and
|
|
|
|
* then tells Mario that is "Ready for blastoff".
|
|
|
|
*/
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_buddy_cannon_dialog(s16 dialogFirstText, s16 dialogSecondText) {
|
2019-10-05 19:08:05 +00:00
|
|
|
struct Object *cannonClosed;
|
|
|
|
s16 buddyText, cutscene;
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
switch (o->oBobombBuddyCannonStatus) {
|
|
|
|
case BOBOMB_BUDDY_CANNON_UNOPENED:
|
2020-01-03 15:38:57 +00:00
|
|
|
buddyText = cutscene_object_with_dialog(CUTSCENE_DIALOG, o, dialogFirstText);
|
2019-10-05 19:08:05 +00:00
|
|
|
if (buddyText != 0) {
|
2019-08-25 04:46:40 +00:00
|
|
|
save_file_set_cannon_unlocked();
|
2020-03-02 03:42:52 +00:00
|
|
|
cannonClosed = cur_obj_nearest_object_with_behavior(bhvCannonClosed);
|
2019-10-05 19:08:05 +00:00
|
|
|
if (cannonClosed != 0)
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_OPENING;
|
|
|
|
else
|
|
|
|
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_STOP_TALKING;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_BUDDY_CANNON_OPENING:
|
2020-03-02 03:42:52 +00:00
|
|
|
cannonClosed = cur_obj_nearest_object_with_behavior(bhvCannonClosed);
|
2019-10-05 19:08:05 +00:00
|
|
|
cutscene = cutscene_object(CUTSCENE_PREPARE_CANNON, cannonClosed);
|
|
|
|
if (cutscene == -1)
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_OPENED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_BUDDY_CANNON_OPENED:
|
2020-01-03 15:38:57 +00:00
|
|
|
buddyText = cutscene_object_with_dialog(CUTSCENE_DIALOG, o, dialogSecondText);
|
2019-10-05 19:08:05 +00:00
|
|
|
if (buddyText != 0)
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_STOP_TALKING;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_BUDDY_CANNON_STOP_TALKING:
|
|
|
|
set_mario_npc_dialog(0);
|
|
|
|
|
|
|
|
o->activeFlags &= ~0x20; /* bit 5 */
|
|
|
|
o->oBobombBuddyHasTalkedToMario = BOBOMB_BUDDY_HAS_TALKED;
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
o->oAction = BOBOMB_BUDDY_ACT_IDLE;
|
|
|
|
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_OPENED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_buddy_act_talk(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (set_mario_npc_dialog(1) == 2) {
|
|
|
|
o->activeFlags |= 0x20; /* bit 5 */
|
|
|
|
|
|
|
|
switch (o->oBobombBuddyRole) {
|
|
|
|
case BOBOMB_BUDDY_ROLE_ADVICE:
|
2020-02-03 05:51:26 +00:00
|
|
|
if (cutscene_object_with_dialog(CUTSCENE_DIALOG, o, o->oBehParams2ndByte)
|
|
|
|
!= BOBOMB_BUDDY_BP_STYPE_GENERIC) {
|
2019-08-25 04:46:40 +00:00
|
|
|
set_mario_npc_dialog(0);
|
|
|
|
|
|
|
|
o->activeFlags &= ~0x20; /* bit 5 */
|
|
|
|
o->oBobombBuddyHasTalkedToMario = BOBOMB_BUDDY_HAS_TALKED;
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
o->oAction = BOBOMB_BUDDY_ACT_IDLE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_BUDDY_ROLE_CANNON:
|
|
|
|
if (gCurrCourseNum == COURSE_BOB)
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_buddy_cannon_dialog(DIALOG_004, DIALOG_105);
|
2019-08-25 04:46:40 +00:00
|
|
|
else
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_buddy_cannon_dialog(DIALOG_047, DIALOG_106);
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_buddy_act_turn_to_talk(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
s16 sp1e = o->header.gfx.unk38.animFrame;
|
|
|
|
if ((sp1e == 5) || (sp1e == 16))
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, 0x1000);
|
|
|
|
if ((s16) o->oMoveAngleYaw == (s16) o->oAngleToMario)
|
|
|
|
o->oAction = BOBOMB_BUDDY_ACT_TALK;
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_2(SOUND_ACTION_READ_SIGN);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bobomb_buddy_actions(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
switch (o->oAction) {
|
|
|
|
case BOBOMB_BUDDY_ACT_IDLE:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_buddy_act_idle();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_BUDDY_ACT_TURN_TO_TALK:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_buddy_act_turn_to_talk();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOBOMB_BUDDY_ACT_TALK:
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_buddy_act_talk();
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-12-02 02:52:53 +00:00
|
|
|
set_object_visibility(o, 3000);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_bobomb_buddy_loop(void) {
|
2020-03-02 03:42:52 +00:00
|
|
|
bobomb_buddy_actions();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
curr_obj_random_blink(&o->oBobombBuddyBlinkTimer);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
o->oInteractStatus = 0;
|
|
|
|
}
|