sm64

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

bbh_haunted_bookshelf.inc.c (1459B)


      1 
      2 /**
      3  * Behavior for bhvHauntedBookshelf.
      4  * This is the bookshelf that recedes after solving the puzzle of the haunted books.
      5  * Its sole purpose is to recede when its action is set to 1 by a bhvHauntedBookshelfManager.
      6  */
      7 
      8 /**
      9  * Update function for bhvHauntedBookshelf.
     10  */
     11 void bhv_haunted_bookshelf_loop(void) {
     12     // oDistanceToMario is unused by this object.
     13     // This may have been used for revealing the books when Mario comes near,
     14     // but in the final game this is done by bhvHauntedBookshelfManager.
     15     o->oDistanceToMario = dist_between_objects(o, gMarioObject);
     16 
     17     o->oFaceAngleYaw = 0;
     18 
     19     switch (o->oAction) {
     20         case HAUNTED_BOOKSHELF_ACT_IDLE:
     21             // ???
     22             if (o->oTimer == 0) {
     23             }
     24 
     25             // This code never runs, since the action is set to 1 directly
     26             // by bhvHauntedBookshelfManager. Maybe this was
     27             // intended to be used to set the action instead?
     28             if (o->oHauntedBookshelfShouldOpen != FALSE) {
     29                 o->oAction++;
     30             }
     31 
     32             break;
     33 
     34         case HAUNTED_BOOKSHELF_ACT_RECEDE:
     35             // Move the bookshelf and play the sound
     36             o->oPosX += 5.0f;
     37             cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4_2);
     38 
     39             // Delete the object after 102 frames
     40             if (o->oTimer > 101) {
     41                 obj_mark_for_deletion(o);
     42             }
     43 
     44             break;
     45 
     46         default:
     47             break;
     48     }
     49 }