sm64

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

recovery_heart.inc.c (1158B)


      1 // recovery_heart.inc.c
      2 
      3 struct ObjectHitbox sRecoveryHeartHitbox = {
      4     /* interactType:      */ 0,
      5     /* downOffset:        */ 0,
      6     /* damageOrCoinValue: */ 0,
      7     /* health:            */ 0,
      8     /* numLootCoins:      */ 0,
      9     /* radius:            */ 50,
     10     /* height:            */ 50,
     11     /* hurtboxRadius:     */ 50,
     12     /* hurtboxHeight:     */ 50,
     13 };
     14 
     15 void bhv_recovery_heart_loop(void) {
     16     obj_set_hitbox(o, &sRecoveryHeartHitbox);
     17     if (obj_check_if_collided_with_object(o, gMarioObject)) {
     18         if (o->oSpinningHeartPlayedSound == 0) {
     19             cur_obj_play_sound_2(SOUND_GENERAL_HEART_SPIN);
     20             o->oSpinningHeartPlayedSound++;
     21         }
     22 
     23         o->oAngleVelYaw = (s32)(200.0f * gMarioStates[0].forwardVel) + 1000;
     24     } else {
     25         o->oSpinningHeartPlayedSound = 0;
     26 
     27         if ((o->oAngleVelYaw -= 50) < 400) {
     28             o->oAngleVelYaw = 400;
     29             o->oSpinningHeartTotalSpin = 0;
     30         }
     31     }
     32 
     33     if ((o->oSpinningHeartTotalSpin += o->oAngleVelYaw) >= 0x10000) {
     34         gMarioStates[0].healCounter += 4;
     35         o->oSpinningHeartTotalSpin -= 0x10000;
     36     }
     37 
     38     o->oFaceAngleYaw += o->oAngleVelYaw;
     39 }