sm64

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

pyramid_wall.inc.c (1359B)


      1 
      2 /**
      3  * Behavior for bhvSSLMovingPyramidWall.
      4  *
      5  * This controls the moving walls found within Shifting Sand Land's pyramid.
      6  * Each wall starts at an initial position and moves up or down at a constant
      7  * speed.
      8  */
      9 
     10 /**
     11  * Initialize the moving wall to be at one of three possible initial starting
     12  * positions.
     13  */
     14 void bhv_ssl_moving_pyramid_wall_init(void) {
     15     switch (o->oBhvParams2ndByte) {
     16         case PYRAMID_WALL_BP_POSITION_HIGH:
     17             break;
     18 
     19         case PYRAMID_WALL_BP_POSITION_MIDDLE:
     20             o->oPosY -= 256.0f;
     21             o->oTimer += 50;
     22             break;
     23 
     24         case PYRAMID_WALL_BP_POSITION_LOW:
     25             o->oPosY -= 512.0f;
     26             o->oAction = PYRAMID_WALL_ACT_MOVING_UP;
     27             break;
     28     }
     29 }
     30 
     31 /**
     32  * Move up or down at a constant velocity for a period of time, then switch to
     33  * do the other.
     34  */
     35 void bhv_ssl_moving_pyramid_wall_loop(void) {
     36     switch (o->oAction) {
     37         case PYRAMID_WALL_ACT_MOVING_DOWN:
     38             o->oVelY = -5.12f;
     39             if (o->oTimer == 100) {
     40                 o->oAction = PYRAMID_WALL_ACT_MOVING_UP;
     41             }
     42             break;
     43 
     44         case PYRAMID_WALL_ACT_MOVING_UP:
     45             o->oVelY = 5.12f;
     46             if (o->oTimer == 100) {
     47                 o->oAction = PYRAMID_WALL_ACT_MOVING_DOWN;
     48             }
     49             break;
     50     }
     51 
     52     o->oPosY += o->oVelY;
     53 }