sm64

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

lll_hexagonal_ring.inc.c (1675B)


      1 // lll_hexagonal_ring.inc.c
      2 
      3 void hexagonal_ring_spawn_flames(void) {
      4     struct Object *sp1C = spawn_object(o, MODEL_RED_FLAME, bhvVolcanoFlames);
      5     f32 size;
      6 
      7     sp1C->oPosY += 550.0f;
      8     sp1C->oMoveAngleYaw = (s16) random_u16();
      9     sp1C->oForwardVel = random_float() * 40.0f + 20.0f;
     10     sp1C->oVelY = random_float() * 50.0f + 10.0f;
     11 
     12     size = random_float() * 6.0 + 3.0;
     13 
     14     obj_scale_xyz(sp1C, size, size, size);
     15 
     16     if (random_float() < 0.1) {
     17         cur_obj_play_sound_2(SOUND_GENERAL_VOLCANO_EXPLOSION);
     18     }
     19 }
     20 
     21 void bhv_lll_rotating_hexagonal_ring_loop(void) {
     22     UNUSED u8 filler[4];
     23 
     24     o->oCollisionDistance = 4000.0f;
     25     o->oDrawingDistance = 8000.0f;
     26 
     27     switch (o->oAction) {
     28         case 0:
     29             if (gMarioObject->platform == o) {
     30                 o->oAction++;
     31             }
     32 
     33             o->oAngleVelYaw = 0x100;
     34             break;
     35 
     36         case 1:
     37             o->oAngleVelYaw = 256.0f - sins(o->oTimer * 128) * 256.0f;
     38 
     39             if (o->oTimer > 128) {
     40                 o->oAction++;
     41             }
     42             break;
     43 
     44         case 2:
     45             if (gMarioObject->platform != o) {
     46                 o->oAction++;
     47             }
     48 
     49             if (o->oTimer > 128) {
     50                 o->oAction++;
     51             }
     52 
     53             o->oAngleVelYaw = 0;
     54             hexagonal_ring_spawn_flames();
     55             break;
     56 
     57         case 3:
     58             o->oAngleVelYaw = sins(o->oTimer * 128) * 256.0f;
     59 
     60             if (o->oTimer > 128) {
     61                 o->oAction = 0;
     62             }
     63             break;
     64 
     65         case 4:
     66             o->oAction = 0;
     67             break;
     68     }
     69 
     70     o->oAngleVelYaw = -o->oAngleVelYaw;
     71     o->oMoveAngleYaw += o->oAngleVelYaw;
     72 }