boulder.inc.c (1808B)
1 // boulder.inc.c 2 3 void bhv_big_boulder_init(void) { 4 o->oHomeX = o->oPosX; 5 o->oHomeY = o->oPosY; 6 o->oHomeZ = o->oPosZ; 7 8 o->oGravity = 8.0f; 9 o->oFriction = 0.999f; 10 o->oBuoyancy = 2.0f; 11 } 12 13 void boulder_act_1(void) { 14 s16 collisionFlags = object_step_without_floor_orient(); 15 16 if ((collisionFlags & OBJ_COL_FLAGS_LANDED) == OBJ_COL_FLAG_GROUNDED && o->oVelY > 10.0f) { 17 cur_obj_play_sound_2(SOUND_GENERAL_GRINDEL_ROLL); 18 spawn_mist_particles(); 19 } 20 21 if (o->oForwardVel > 70.0) { 22 o->oForwardVel = 70.0f; 23 } 24 25 if (o->oPosY < -1000.0f) { 26 o->activeFlags = ACTIVE_FLAG_DEACTIVATED; 27 } 28 } 29 30 void bhv_big_boulder_loop(void) { 31 cur_obj_scale(1.5f); 32 33 o->oGraphYOffset = 270.0f; 34 35 switch (o->oAction) { 36 case 0: 37 o->oForwardVel = 40.0f; 38 o->oAction = 1; 39 break; 40 41 case 1: 42 boulder_act_1(); 43 adjust_rolling_face_pitch(1.5f); 44 cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2); 45 break; 46 } 47 48 set_rolling_sphere_hitbox(); 49 } 50 51 void bhv_big_boulder_generator_loop(void) { 52 struct Object *sp1C; 53 54 if (o->oTimer >= 256) { 55 o->oTimer = 0; 56 } 57 58 if (!current_mario_room_check(4) 59 || is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 1500)) { 60 return; 61 } 62 63 if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) { 64 if (!(o->oTimer & 0x3F)) { 65 sp1C = spawn_object(o, MODEL_HMC_ROLLING_ROCK, bhvBigBoulder); 66 sp1C->oMoveAngleYaw = random_float() * 4096.0f; 67 } 68 } else { 69 if (!(o->oTimer & 0x7F)) { 70 sp1C = spawn_object(o, MODEL_HMC_ROLLING_ROCK, bhvBigBoulder); 71 sp1C->oMoveAngleYaw = random_float() * 4096.0f; 72 } 73 } 74 }