2019-08-25 04:46:40 +00:00
|
|
|
// whirlpool.c.inc
|
|
|
|
|
|
|
|
static struct ObjectHitbox sWhirlpoolHitbox = {
|
|
|
|
/* interactType: */ INTERACT_WHIRLPOOL,
|
|
|
|
/* downOffset: */ 0,
|
|
|
|
/* damageOrCoinValue: */ 0,
|
|
|
|
/* health: */ 0,
|
|
|
|
/* numLootCoins: */ 0,
|
|
|
|
/* radius: */ 200,
|
|
|
|
/* height: */ 500,
|
|
|
|
/* hurtboxRadius: */ 0,
|
|
|
|
/* hurtboxHeight: */ 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
void bhv_whirlpool_init(void) {
|
|
|
|
o->oWhirlpoolInitFacePitch = o->oFaceAnglePitch;
|
|
|
|
o->oWhirlpoolInitFaceRoll = o->oFaceAngleRoll;
|
|
|
|
o->oFaceAnglePitch = 0;
|
|
|
|
o->oFaceAngleRoll = 0;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void whirlpool_set_hitbox(void) {
|
|
|
|
obj_set_hitbox(o, &sWhirlpoolHitbox);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
void whirpool_orient_graph(void) {
|
2019-08-25 04:46:40 +00:00
|
|
|
f32 cosPitch = coss(o->oFaceAnglePitch);
|
|
|
|
f32 sinPitch = sins(o->oFaceAnglePitch);
|
|
|
|
f32 cosRoll = coss(o->oFaceAngleRoll);
|
|
|
|
f32 sinRoll = sins(o->oFaceAngleRoll);
|
|
|
|
f32 normalX = sinRoll * cosPitch;
|
|
|
|
f32 normalY = cosPitch * cosRoll;
|
|
|
|
f32 normalZ = sinPitch;
|
2019-12-02 02:52:53 +00:00
|
|
|
obj_orient_graph(o, normalX, normalY, normalZ);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_whirlpool_loop(void) {
|
|
|
|
if (o->oDistanceToMario < 5000.0f) {
|
2020-04-03 18:57:26 +00:00
|
|
|
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
// not sure if actually an array
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_PARTICLECOUNT] = 60;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_SRC_X] = o->oPosX;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_SRC_Z] = o->oPosZ;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_DEST_X] = o->oPosX;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_DEST_Y] = o->oPosY;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_DEST_Z] = o->oPosZ;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_SRC_Y] = o->oPosY + 800.0f;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_PITCH] = o->oWhirlpoolInitFacePitch;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_YAW] = o->oWhirlpoolInitFaceRoll;
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
whirpool_orient_graph();
|
2019-08-25 04:46:40 +00:00
|
|
|
|
|
|
|
o->oFaceAngleYaw += 0x1F40;
|
|
|
|
} else {
|
2020-04-03 18:57:26 +00:00
|
|
|
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
2019-08-25 04:46:40 +00:00
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_PARTICLECOUNT] = 0;
|
|
|
|
}
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_1(SOUND_ENV_WATER);
|
2019-08-25 04:46:40 +00:00
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
whirlpool_set_hitbox();
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_jet_stream_loop(void) {
|
|
|
|
if (o->oDistanceToMario < 5000.0f) {
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_PARTICLECOUNT] = 60;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_SRC_X] = o->oPosX;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_SRC_Y] = o->oPosY;
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_SRC_Z] = o->oPosZ;
|
|
|
|
} else
|
|
|
|
gEnvFxBubbleConfig[ENVFX_STATE_PARTICLECOUNT] = 0;
|
|
|
|
|
2020-03-02 03:42:52 +00:00
|
|
|
cur_obj_play_sound_1(SOUND_ENV_WATER);
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|