fire_spitter.inc.c (1437B)
1 // fire_spitter.inc.c 2 3 static void fire_spitter_act_idle(void) { 4 approach_f32_ptr(&o->header.gfx.scale[0], 0.2f, 0.002f); 5 6 if (o->oTimer > 150 && o->oDistanceToMario < 800.0f && !(o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER)) { 7 o->oAction = FIRE_SPITTER_ACT_SPIT_FIRE; 8 o->oFireSpitterScaleVel = 0.05f; 9 } 10 } 11 12 static void fire_spitter_act_spit_fire(void) { 13 s32 scaleStatus; 14 15 o->oMoveAngleYaw = o->oAngleToMario; 16 17 // Increase scale by 0.05, 0.04, ..., -0.03. Then wait ~8 frames, then 18 // starting moving scale by 0.05 each frame toward 0.1. The first time 19 // it becomes below 0.15 during this latter portion, shoot fire. 20 scaleStatus = obj_grow_then_shrink(&o->oFireSpitterScaleVel, 0.15f, 0.1f); 21 22 if (scaleStatus != 0) { 23 if (scaleStatus < 0) { 24 o->oAction = FIRE_SPITTER_ACT_IDLE; 25 } else { 26 cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN); 27 obj_spit_fire(0, 0, 0, 5.0f, MODEL_RED_FLAME_SHADOW, 20.0f, 15.0f, 0x1000); 28 } 29 } 30 } 31 32 void bhv_fire_spitter_update(void) { 33 cur_obj_scale(o->header.gfx.scale[0]); 34 o->oGraphYOffset = 40.0f; 35 cur_obj_update_floor_and_walls(); 36 37 switch (o->oAction) { 38 case FIRE_SPITTER_ACT_IDLE: 39 fire_spitter_act_idle(); 40 break; 41 case FIRE_SPITTER_ACT_SPIT_FIRE: 42 fire_spitter_act_spit_fire(); 43 break; 44 } 45 46 cur_obj_move_standard(78); 47 }