water_bomb_cannon.inc.c (2975B)
1 // water_bomb_cannon.inc.c 2 3 void bhv_bubble_cannon_barrel_loop(void) { 4 if (o->parentObj->oAction == 2) { 5 obj_mark_for_deletion(o); 6 } else { 7 o->oMoveAngleYaw = o->parentObj->oFaceAngleYaw; 8 o->oMoveAnglePitch = o->parentObj->oMoveAnglePitch + 0x4000; 9 o->oFaceAnglePitch = o->parentObj->oMoveAnglePitch; 10 11 if ((o->oCannonBarrelBubblesUnkF4 += o->oForwardVel) > 0.0f) { 12 cur_obj_set_pos_via_transform(); 13 obj_forward_vel_approach(-5.0f, 18.0f); 14 } else { 15 o->oCannonBarrelBubblesUnkF4 = 0.0f; 16 obj_copy_pos(o, o->parentObj); 17 18 // check this 19 if (o->parentObj->oWaterCannonUnkF4 != 0) { 20 if (o->oForwardVel == 0.0f) { 21 struct Object *waterBomb; 22 23 o->oForwardVel = 35.0f; 24 25 waterBomb = spawn_object(o, MODEL_WATER_BOMB, bhvWaterBomb); 26 if (waterBomb != NULL) { 27 waterBomb->oForwardVel = -100.0f; 28 waterBomb->header.gfx.scale[1] = 1.7f; 29 } 30 31 set_camera_shake_from_point(SHAKE_POS_MEDIUM, o->oPosX, o->oPosY, o->oPosZ); 32 } 33 } else { 34 o->oForwardVel = 0.0f; 35 } 36 } 37 } 38 } 39 40 void water_bomb_cannon_act_0(void) { 41 if (o->oDistanceToMario < 2000.0f) { 42 spawn_object(o, MODEL_CANNON_BARREL, bhvCannonBarrelBubbles); 43 cur_obj_unhide(); 44 45 o->oAction = 1; 46 o->oMoveAnglePitch = o->oWaterCannonUnkFC = 0x1C00; 47 } 48 } 49 50 void water_bomb_cannon_act_1(void) { 51 if (o->oDistanceToMario > 2500.0f) { 52 o->oAction = 2; 53 } else if (o->oBhvParams2ndByte == 0) { 54 if (o->oWaterCannonUnkF4 != 0) { 55 o->oWaterCannonUnkF4--; 56 } else { 57 obj_move_pitch_approach(o->oWaterCannonUnkFC, 0x80); 58 obj_face_yaw_approach(o->oWaterCannonUnk100, 0x100); 59 60 if ((s16) o->oFaceAngleYaw == (s16) o->oWaterCannonUnk100) { 61 if (o->oWaterCannonUnkF8 != 0) { 62 o->oWaterCannonUnkF8--; 63 } else { 64 cur_obj_play_sound_2(SOUND_OBJ_CANNON4); 65 o->oWaterCannonUnkF4 = 70; 66 o->oWaterCannonUnkFC = 0x1000 + 0x400 * (random_u16() & 0x03); 67 o->oWaterCannonUnk100 = -0x2000 + o->oMoveAngleYaw + 0x1000 * (random_u16() % 5); 68 o->oWaterCannonUnkF8 = 60; 69 } 70 } 71 } 72 } 73 } 74 75 void water_bomb_cannon_act_2(void) { 76 cur_obj_hide(); 77 o->oAction = 0; 78 } 79 80 void bhv_water_bomb_cannon_loop(void) { 81 cur_obj_push_mario_away_from_cylinder(220.0f, 300.0f); 82 83 switch (o->oAction) { 84 case 0: 85 water_bomb_cannon_act_0(); 86 break; 87 case 1: 88 water_bomb_cannon_act_1(); 89 break; 90 case 2: 91 water_bomb_cannon_act_2(); 92 break; 93 } 94 }