2019-08-25 00:46:40 -04:00
|
|
|
// boulder.c.inc
|
|
|
|
|
|
|
|
void bhv_big_boulder_init(void) {
|
|
|
|
o->oHomeX = o->oPosX;
|
|
|
|
o->oHomeY = o->oPosY;
|
|
|
|
o->oHomeZ = o->oPosZ;
|
|
|
|
|
|
|
|
o->oGravity = 8.0f;
|
|
|
|
o->oFriction = 0.999f;
|
|
|
|
o->oBuoyancy = 2.0f;
|
|
|
|
}
|
|
|
|
|
2020-03-01 22:42:52 -05:00
|
|
|
void boulder_act_1(void) {
|
2019-08-25 00:46:40 -04:00
|
|
|
s16 sp1E;
|
|
|
|
|
2019-12-01 21:52:53 -05:00
|
|
|
sp1E = object_step_without_floor_orient();
|
2019-08-25 00:46:40 -04:00
|
|
|
if ((sp1E & 0x09) == 0x01 && o->oVelY > 10.0f) {
|
2020-03-01 22:42:52 -05:00
|
|
|
cur_obj_play_sound_2(SOUND_GENERAL_GRINDEL_ROLL);
|
|
|
|
spawn_mist_particles();
|
2019-08-25 00:46:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (o->oForwardVel > 70.0)
|
|
|
|
o->oForwardVel = 70.0f;
|
|
|
|
|
|
|
|
if (o->oPosY < -1000.0f)
|
2020-06-02 12:44:34 -04:00
|
|
|
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
|
2019-08-25 00:46:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_big_boulder_loop(void) {
|
2020-03-01 22:42:52 -05:00
|
|
|
cur_obj_scale(1.5f);
|
2019-08-25 00:46:40 -04:00
|
|
|
o->oGraphYOffset = 270.0f;
|
|
|
|
switch (o->oAction) {
|
|
|
|
case 0:
|
|
|
|
o->oForwardVel = 40.0f;
|
|
|
|
o->oAction = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2020-03-01 22:42:52 -05:00
|
|
|
boulder_act_1();
|
|
|
|
adjust_rolling_face_pitch(1.5f);
|
|
|
|
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
|
2019-08-25 00:46:40 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-03-01 22:42:52 -05:00
|
|
|
set_rolling_sphere_hitbox();
|
2019-08-25 00:46:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void bhv_big_boulder_generator_loop(void) {
|
|
|
|
struct Object *sp1C;
|
|
|
|
if (o->oTimer >= 256) {
|
|
|
|
o->oTimer = 0;
|
|
|
|
}
|
|
|
|
|
2019-12-01 21:52:53 -05:00
|
|
|
if (!current_mario_room_check(4) || is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 1500))
|
2019-08-25 00:46:40 -04:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) {
|
|
|
|
if ((o->oTimer & 0x3F) == 0) {
|
|
|
|
sp1C = spawn_object(o, MODEL_HMC_ROLLING_ROCK, bhvBigBoulder);
|
2020-04-03 14:57:26 -04:00
|
|
|
sp1C->oMoveAngleYaw = random_float() * 4096.0f;
|
2019-08-25 00:46:40 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((o->oTimer & 0x7F) == 0) {
|
|
|
|
sp1C = spawn_object(o, MODEL_HMC_ROLLING_ROCK, bhvBigBoulder);
|
2020-04-03 14:57:26 -04:00
|
|
|
sp1C->oMoveAngleYaw = random_float() * 4096.0f;
|
2019-08-25 00:46:40 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|