sm64

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

sl_snowman_wind.inc.c (1963B)


      1 // sl_snowman_wind.inc.c
      2 
      3 void bhv_sl_snowman_wind_loop(void) {
      4     UNUSED s32 unused = 0;
      5     s16 marioAngleFromWindSource;
      6     Vec3f tempPos;
      7 
      8     if (o->oTimer == 0) {
      9         o->oSLSnowmanWindOriginalYaw = o->oMoveAngleYaw;
     10     }
     11 
     12     // Waiting for Mario to approach.
     13     if (o->oSubAction == SL_SNOWMAN_WIND_ACT_IDLE) {
     14         o->oDistanceToMario = 0;
     15 
     16         // Check if Mario is within 1000 units of the center of the bridge, and ready to speak.
     17         vec3f_copy_2(tempPos, &o->oPosX);
     18         obj_set_pos(o, 1100, 3328, 1164); // Position is in the middle of the ice bridge
     19         if (cur_obj_can_mario_activate_textbox(1000.0f, 30.0f, 0x7FFF)) {
     20             o->oSubAction++;
     21         }
     22         vec3f_copy_2(&o->oPosX, tempPos);
     23 
     24     // Mario has come close, begin dialog.
     25     } else if (o->oSubAction == SL_SNOWMAN_WIND_ACT_TALKING) {
     26         if (cur_obj_update_dialog(MARIO_DIALOG_LOOK_UP, DIALOG_FLAG_TEXT_DEFAULT, DIALOG_153, 0)) {
     27             o->oSubAction++;
     28         }
     29 
     30     // Blowing, spawn wind particles (SL_SNOWMAN_WIND_ACT_BLOWING)
     31     } else if (o->oDistanceToMario < 1500.0f && absf(gMarioObject->oPosY - o->oHomeY) < 500.0f) {
     32         // Point towards Mario, but only within 0x1500 angle units of the original angle.
     33         if ((marioAngleFromWindSource = o->oAngleToMario - o->oSLSnowmanWindOriginalYaw) > 0) {
     34             if (marioAngleFromWindSource < 0x1500) {
     35                 o->oMoveAngleYaw = o->oAngleToMario;
     36             } else {
     37                 o->oMoveAngleYaw = o->oSLSnowmanWindOriginalYaw + 0x1500;
     38             }
     39         } else {
     40             if (marioAngleFromWindSource > -0x1500) {
     41                 o->oMoveAngleYaw = o->oAngleToMario;
     42             } else {
     43                 o->oMoveAngleYaw = o->oSLSnowmanWindOriginalYaw - 0x1500;
     44             }
     45         }
     46         // Spawn wind and play wind sound
     47         cur_obj_spawn_strong_wind_particles(12, 3.0f, 0, 0, 0);
     48         cur_obj_play_sound_1(SOUND_AIR_BLOW_WIND);
     49     }
     50 }