sm64

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

bouncing_fireball.inc.c (1858B)


      1 // bouncing_fireball.inc.c
      2 
      3 void bhv_bouncing_fireball_flame_loop(void) {
      4     o->activeFlags |= ACTIVE_FLAG_UNK10;
      5 
      6     cur_obj_update_floor_and_walls();
      7 
      8     switch (o->oAction) {
      9         case 0:
     10             if (o->oTimer == 0) {
     11                 o->oAnimState = random_float() * 10.0f;
     12                 o->oVelY = 30.0f;
     13             }
     14 
     15             if (o->oMoveFlags & OBJ_MOVE_LANDED) {
     16                 o->oAction++;
     17             }
     18             break;
     19 
     20         case 1:
     21             if (o->oTimer == 0) {
     22                 o->oVelY = 50.0f;
     23                 o->oForwardVel = 30.0f;
     24             }
     25 
     26             if (o->oMoveFlags
     27                 & (OBJ_MOVE_ON_GROUND | OBJ_MOVE_AT_WATER_SURFACE | OBJ_MOVE_UNDERWATER_ON_GROUND)
     28                 && o->oTimer > 100) {
     29                 obj_mark_for_deletion(o);
     30             }
     31             break;
     32     }
     33 
     34     if (o->oTimer > 300) {
     35         obj_mark_for_deletion(o);
     36     }
     37 
     38     cur_obj_move_standard(78);
     39 
     40     o->oInteractStatus = 0;
     41 }
     42 
     43 void bhv_bouncing_fireball_loop(void) {
     44     struct Object *sp2C;
     45     f32 sp28;
     46 
     47     switch (o->oAction) {
     48         case 0:
     49             if (o->oDistanceToMario < 2000.0f) {
     50                 o->oAction = 1;
     51             }
     52             break;
     53 
     54         case 1:
     55             sp2C = spawn_object(o, MODEL_RED_FLAME, bhvBouncingFireballFlame);
     56             sp28 = (10 - o->oTimer) * 0.5;
     57 
     58             obj_scale_xyz(sp2C, sp28, sp28, sp28);
     59 
     60             if (o->oTimer == 0) {
     61                 obj_become_tangible(sp2C);
     62             }
     63 
     64             if (o->oTimer > 10) {
     65                 o->oAction++;
     66             }
     67             break;
     68 
     69         case 2:
     70             if (o->oTimer == 0) {
     71                 o->oBouncingFireBallUnkF4 = random_float() * 100.0f;
     72             }
     73 
     74             if (o->oBouncingFireBallUnkF4 + 100 < o->oTimer) {
     75                 o->oAction = 0;
     76             }
     77             break;
     78     }
     79 }