sm64

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

corkbox.inc.c (2087B)


      1 // corkbox.inc.c
      2 // TODO: This split seems weird. Investigate further?
      3 
      4 void bhv_bobomb_bully_death_smoke_init(void) {
      5     o->oPosY -= 300.0f;
      6 
      7     cur_obj_scale(10.0f);
      8 }
      9 
     10 void bhv_bobomb_explosion_bubble_init(void) {
     11     obj_scale_xyz(o, 2.0f, 2.0f, 1.0f);
     12 
     13     o->oBobombExpBubGfxExpRateX = (s32)(random_float() * 2048.0f) + 0x800;
     14     o->oBobombExpBubGfxExpRateY = (s32)(random_float() * 2048.0f) + 0x800;
     15     o->oTimer = random_float() * 10.0f;
     16     o->oVelY = (s32)(random_float() * 4.0f) + 4;
     17 }
     18 
     19 void bhv_bobomb_explosion_bubble_loop(void) {
     20     f32 waterY = gMarioStates[0].waterLevel;
     21 
     22     o->header.gfx.scale[0] = sins(o->oBobombExpBubGfxScaleFacX) * 0.5 + 2.0;
     23     o->oBobombExpBubGfxScaleFacX += o->oBobombExpBubGfxExpRateX;
     24 
     25     o->header.gfx.scale[1] = sins(o->oBobombExpBubGfxScaleFacY) * 0.5 + 2.0;
     26     o->oBobombExpBubGfxScaleFacY += o->oBobombExpBubGfxExpRateY;
     27 
     28     if (o->oPosY > waterY) {
     29         o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
     30         o->oPosY += 5.0f;
     31         spawn_object(o, MODEL_SMALL_WATER_SPLASH, bhvObjectWaterSplash);
     32     }
     33 
     34     if (o->oTimer > 60) {
     35         o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
     36     }
     37 
     38     o->oPosY += o->oVelY;
     39     o->oTimer++;
     40 }
     41 
     42 void bhv_respawner_loop(void) {
     43     if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, o->oRespawnerMinSpawnDist)) {
     44         struct Object *spawnedObject = spawn_object(o, o->oRespawnerModelToRespawn,
     45                                                     o->oRespawnerBehaviorToRespawn);
     46         spawnedObject->oBhvParams = o->oBhvParams;
     47         o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
     48     }
     49 }
     50 
     51 void create_respawner(s32 model, const BehaviorScript *behToSpawn, s32 minSpawnDist) {
     52     struct Object *respawner = spawn_object_abs_with_rot(o, 0, MODEL_NONE, bhvRespawner, o->oHomeX,
     53                                                          o->oHomeY, o->oHomeZ, 0, 0, 0);
     54     respawner->oBhvParams = o->oBhvParams;
     55     respawner->oRespawnerModelToRespawn = model;
     56     respawner->oRespawnerMinSpawnDist = minSpawnDist;
     57     respawner->oRespawnerBehaviorToRespawn = behToSpawn;
     58 }