sm64

A Super Mario 64 decompilation
Log | Files | Refs | README | LICENSE

lll_rotating_hex_flame.inc.c (1844B)


      1 // lll_rotating_hex_flame.inc.c
      2 
      3 void bhv_lll_rotating_hex_flame_loop(void) {
      4     f32 sp24 = o->oLLLRotatingHexFlameUnkF4;
      5     f32 sp20 = o->oLLLRotatingHexFlameUnkF8;
      6     f32 sp1C = o->oLLLRotatingHexFlameUnkFC;
      7 
      8     cur_obj_set_pos_relative(o->parentObj, sp24, sp20, sp1C);
      9     o->oPosY = o->parentObj->oPosY + 100.0f;
     10 
     11     if (o->parentObj->oAction == 3) {
     12         obj_mark_for_deletion(o);
     13     }
     14 }
     15 
     16 void fire_bar_spawn_flames(s16 a0) {
     17     struct Object *sp2C;
     18     UNUSED u8 filler[4];
     19     s32 i;
     20     s32 sp20;
     21     f32 sp1C = sins(a0) * 200.0f;
     22     f32 sp18 = coss(a0) * 200.0f;
     23 
     24     sp20 = o->oBhvParams2ndByte == 0 ? 4 : 3;
     25 
     26     for (i = 0; i < sp20; i++) {
     27         sp2C = spawn_object(o, MODEL_RED_FLAME, bhvLLLRotatingHexFlame);
     28         sp2C->oLLLRotatingHexFlameUnkF4 += sp1C;
     29         sp2C->oLLLRotatingHexFlameUnkF8 = o->oPosY - 200.0f;
     30         sp2C->oLLLRotatingHexFlameUnkFC += sp18;
     31         obj_scale_xyz(sp2C, 6.0f, 6.0f, 6.0f);
     32         sp1C += sins(a0) * 150.0f;
     33         sp18 += coss(a0) * 150.0f;
     34     }
     35 }
     36 
     37 void fire_bar_act_0(void) {
     38     if (o->oDistanceToMario < 3000.0f) {
     39         o->oAction = 1;
     40     }
     41 }
     42 
     43 void fire_bar_act_1(void) {
     44     fire_bar_spawn_flames(0);
     45     fire_bar_spawn_flames(-0x8000);
     46     o->oAngleVelYaw = 0;
     47     o->oMoveAngleYaw = 0;
     48     o->oAction = 2;
     49 }
     50 
     51 void fire_bar_act_2(void) {
     52     o->oAngleVelYaw = -0x100;
     53     o->oMoveAngleYaw += o->oAngleVelYaw;
     54     if (o->oDistanceToMario > 3200.0f) {
     55         o->oAction = 3;
     56     }
     57 }
     58 
     59 void fire_bar_act_3(void) {
     60     o->oAction = 0;
     61 }
     62 
     63 void (*sRotatingCwFireBarsActions[])(void) = {
     64     fire_bar_act_0,
     65     fire_bar_act_1,
     66     fire_bar_act_2,
     67     fire_bar_act_3,
     68 };
     69 
     70 void bhv_lll_rotating_block_fire_bars_loop(void) {
     71     cur_obj_call_action_function(sRotatingCwFireBarsActions);
     72     if (o->oBhvParams2ndByte == 0) {
     73         load_object_collision_model();
     74     }
     75 }