sm64

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

bubble.inc.c (708B)


      1 // bubble.inc.c
      2 
      3 void bhv_object_bubble_init(void) {
      4     o->oPosX += random_float() * 30.0f;
      5     o->oPosY += random_float() * 30.0f;
      6     o->oPosZ += random_float() * 30.0f;
      7 }
      8 
      9 void bhv_object_bubble_loop(void) {
     10     struct Object *bubbleSplash;
     11     f32 waterY = find_water_level(o->oPosX, o->oPosZ);
     12     f32 bubbleY = o->oPosY;
     13 
     14     if (bubbleY > waterY) {
     15         if (gFreeObjectList.next != NULL) {
     16             bubbleSplash = spawn_object_at_origin(o, 0, MODEL_SMALL_WATER_SPLASH, bhvBubbleSplash);
     17             bubbleSplash->oPosX = o->oPosX;
     18             bubbleSplash->oPosY = bubbleY + 5.0f;
     19             bubbleSplash->oPosZ = o->oPosZ;
     20         }
     21 
     22         o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
     23     }
     24 }