2019-08-25 04:46:40 +00:00
|
|
|
// exclamation_box.c.inc
|
|
|
|
|
|
|
|
struct ObjectHitbox sExclamationBoxHitbox = {
|
|
|
|
/* interactType: */ INTERACT_BREAKABLE,
|
|
|
|
/* downOffset: */ 5,
|
|
|
|
/* damageOrCoinValue: */ 0,
|
|
|
|
/* health: */ 1,
|
|
|
|
/* numLootCoins: */ 0,
|
|
|
|
/* radius: */ 40,
|
|
|
|
/* height: */ 30,
|
|
|
|
/* hurtboxRadius: */ 40,
|
|
|
|
/* hurtboxHeight: */ 30,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Struct802C0DF0 sExclamationBoxContents[] = { { 0, 0, 0, MODEL_MARIOS_WING_CAP, bhvWingCap },
|
|
|
|
{ 1, 0, 0, MODEL_MARIOS_METAL_CAP, bhvMetalCap },
|
|
|
|
{ 2, 0, 0, MODEL_MARIOS_CAP, bhvVanishCap },
|
|
|
|
{ 3, 0, 0, MODEL_KOOPA_SHELL, bhvKoopaShell },
|
|
|
|
{ 4, 0, 0, MODEL_YELLOW_COIN,
|
|
|
|
bhvSingleCoinGetsSpawned },
|
|
|
|
{ 5, 0, 0, MODEL_NONE, bhvThreeCoinsSpawn },
|
|
|
|
{ 6, 0, 0, MODEL_NONE, bhvTenCoinsSpawn },
|
|
|
|
{ 7, 0, 0, MODEL_1UP, bhv1upWalking },
|
|
|
|
{ 8, 0, 0, MODEL_STAR, bhvSpawnedStar },
|
|
|
|
{ 9, 0, 0, MODEL_1UP, bhv1upRunningAway },
|
|
|
|
{ 10, 0, 1, MODEL_STAR, bhvSpawnedStar },
|
|
|
|
{ 11, 0, 2, MODEL_STAR, bhvSpawnedStar },
|
|
|
|
{ 12, 0, 3, MODEL_STAR, bhvSpawnedStar },
|
|
|
|
{ 13, 0, 4, MODEL_STAR, bhvSpawnedStar },
|
|
|
|
{ 14, 0, 5, MODEL_STAR, bhvSpawnedStar },
|
|
|
|
{ 99, 0, 0, 0, NULL } };
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void bhv_rotating_exclamation_box_loop(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->parentObj->oAction != 1)
|
2020-03-02 03:42:52 +00:00
|
|
|
obj_mark_for_deletion(o);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_act_0(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oBehParams2ndByte < 3) {
|
|
|
|
o->oAnimState = o->oBehParams2ndByte;
|
|
|
|
if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte])
|
|
|
|
|| ((o->oBehParams >> 24) & 0xFF) != 0)
|
|
|
|
o->oAction = 2;
|
|
|
|
else
|
|
|
|
o->oAction = 1;
|
|
|
|
} else {
|
|
|
|
o->oAnimState = 3;
|
|
|
|
o->oAction = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_act_1(void) {
|
|
|
|
cur_obj_become_intangible();
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer == 0) {
|
|
|
|
spawn_object(o, MODEL_EXCLAMATION_POINT, bhvRotatingExclamationMark);
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_set_model(MODEL_EXCLAMATION_BOX_OUTLINE);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte])
|
|
|
|
|| ((o->oBehParams >> 24) & 0xFF) != 0) {
|
|
|
|
o->oAction = 2;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_set_model(MODEL_EXCLAMATION_BOX);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_act_2(void) {
|
|
|
|
obj_set_hitbox(o, &sExclamationBoxHitbox);
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer == 0) {
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_unhide();
|
|
|
|
cur_obj_become_tangible();
|
2019-08-25 04:46:40 +00:00
|
|
|
o->oInteractStatus = 0;
|
|
|
|
o->oPosY = o->oHomeY;
|
|
|
|
o->oGraphYOffset = 0.0f;
|
|
|
|
}
|
2020-08-14 01:34:27 +00:00
|
|
|
if (o->oExclamationBoxForce || nearest_mario_state_to_object(o) == &gMarioStates[0]) {
|
|
|
|
if (o->oExclamationBoxForce || o->oExclamationBoxUnkFC == 0x4000 || cur_obj_was_attacked_or_ground_pounded()) {
|
|
|
|
cur_obj_become_intangible();
|
|
|
|
o->oExclamationBoxUnkFC = 0x4000;
|
|
|
|
o->oVelY = 30.0f;
|
|
|
|
o->oGravity = -8.0f;
|
|
|
|
o->oFloorHeight = o->oPosY;
|
|
|
|
o->oAction = 3;
|
2020-08-14 01:49:24 +00:00
|
|
|
queue_rumble_data_object(o, 5, 80);
|
2020-08-14 01:34:27 +00:00
|
|
|
}
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
load_object_collision_model();
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_act_3(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
UNUSED s32 unused;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_move_using_fvel_and_gravity();
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oVelY < 0.0f) {
|
|
|
|
o->oVelY = 0.0f;
|
|
|
|
o->oGravity = 0.0f;
|
|
|
|
}
|
|
|
|
o->oExclamationBoxUnkF8 = (sins(o->oExclamationBoxUnkFC) + 1.0) * 0.3 + 0.0;
|
|
|
|
o->oExclamationBoxUnkF4 = (-sins(o->oExclamationBoxUnkFC) + 1.0) * 0.5 + 1.0;
|
|
|
|
o->oGraphYOffset = (-sins(o->oExclamationBoxUnkFC) + 1.0) * 26.0;
|
|
|
|
o->oExclamationBoxUnkFC += 0x1000;
|
|
|
|
o->header.gfx.scale[0] = o->oExclamationBoxUnkF4 * 2.0f;
|
|
|
|
o->header.gfx.scale[1] = o->oExclamationBoxUnkF8 * 2.0f;
|
|
|
|
o->header.gfx.scale[2] = o->oExclamationBoxUnkF4 * 2.0f;
|
|
|
|
if (o->oTimer == 7)
|
|
|
|
o->oAction = 4;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
|
2019-08-25 04:46:40 +00:00
|
|
|
struct Object *sp1C = NULL;
|
|
|
|
|
2020-08-11 05:59:11 +00:00
|
|
|
if (o->oExclamationBoxForce) {
|
|
|
|
o->oExclamationBoxForce = FALSE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
o->oExclamationBoxForce = TRUE;
|
|
|
|
network_send_object(o);
|
|
|
|
o->oExclamationBoxForce = FALSE;
|
|
|
|
|
2019-08-25 04:46:40 +00:00
|
|
|
while (a0->unk0 != 99) {
|
|
|
|
if (a1 == a0->unk0) {
|
|
|
|
sp1C = spawn_object(o, a0->model, a0->behavior);
|
|
|
|
sp1C->oVelY = 20.0f;
|
|
|
|
sp1C->oForwardVel = 3.0f;
|
|
|
|
sp1C->oMoveAngleYaw = gMarioObject->oMoveAngleYaw;
|
|
|
|
o->oBehParams |= a0->unk2 << 24;
|
|
|
|
if (a0->model == 122)
|
|
|
|
o->oFlags |= 0x4000;
|
2020-08-11 05:59:11 +00:00
|
|
|
|
|
|
|
struct Object* spawn_objects[] = { sp1C };
|
|
|
|
u32 models[] = { a0->model };
|
|
|
|
network_send_spawn_objects(spawn_objects, models, 1);
|
2019-08-25 04:46:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
a0++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_act_4(void) {
|
|
|
|
exclamation_box_spawn_contents(sExclamationBoxContents, o->oBehParams2ndByte);
|
|
|
|
spawn_mist_particles_variable(0, 0, 46.0f);
|
2019-08-25 04:46:40 +00:00
|
|
|
spawn_triangle_break_particles(20, 139, 0.3f, o->oAnimState);
|
2019-10-05 19:08:05 +00:00
|
|
|
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oBehParams2ndByte < 3) {
|
|
|
|
o->oAction = 5;
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_hide();
|
2019-08-25 04:46:40 +00:00
|
|
|
} else
|
2020-03-02 03:42:52 +00:00
|
|
|
obj_mark_for_deletion(o);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void exclamation_box_act_5(void) {
|
2020-08-14 01:34:27 +00:00
|
|
|
o->oExclamationBoxForce = FALSE;
|
2019-08-25 04:46:40 +00:00
|
|
|
if (o->oTimer > 300)
|
|
|
|
o->oAction = 2;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void (*sExclamationBoxActions[])(void) = { exclamation_box_act_0, exclamation_box_act_1,
|
|
|
|
exclamation_box_act_2, exclamation_box_act_3,
|
|
|
|
exclamation_box_act_4, exclamation_box_act_5 };
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
void bhv_exclamation_box_loop(void) {
|
2020-08-09 15:07:32 +00:00
|
|
|
if (o->oSyncID == 0) {
|
|
|
|
network_init_object(o, SYNC_DISTANCE_ONLY_EVENTS);
|
2020-08-11 05:59:11 +00:00
|
|
|
network_init_object_field(o, &o->oExclamationBoxForce);
|
2020-08-09 15:07:32 +00:00
|
|
|
}
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_scale(2.0f);
|
|
|
|
cur_obj_call_action_function(sExclamationBoxActions);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|