sm64

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

script.c (8784B)


      1 #include <ultra64.h>
      2 #include "sm64.h"
      3 #include "behavior_data.h"
      4 #include "model_ids.h"
      5 #include "seq_ids.h"
      6 #include "segment_symbols.h"
      7 #include "level_commands.h"
      8 
      9 #include "game/level_update.h"
     10 
     11 #include "levels/scripts.h"
     12 
     13 #include "actors/common1.h"
     14 
     15 #include "make_const_nonconst.h"
     16 #include "levels/bits/header.h"
     17 
     18 static const LevelScript script_func_local_1[] = {
     19     OBJECT(/*model*/ MODEL_BITS_SLIDING_PLATFORM,       /*pos*/ -2370, -4525,     0, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM2(0x10), /*bhv*/ bhvSlidingPlatform2),
     20     OBJECT(/*model*/ MODEL_BITS_TWIN_SLIDING_PLATFORMS, /*pos*/ -2611,  3544,  -904, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM2(0xCF), /*bhv*/ bhvSlidingPlatform2),
     21     OBJECT(/*model*/ MODEL_BITS_TWIN_SLIDING_PLATFORMS, /*pos*/ -4700,  3544,  -904, /*angle*/ 0, 180, 0, /*bhvParam*/ BPARAM2(0x8F), /*bhv*/ bhvSlidingPlatform2),
     22     OBJECT(/*model*/ MODEL_BITS_OCTAGONAL_PLATFORM,     /*pos*/  4139, -1740, -1831, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM1(0x02), /*bhv*/ bhvOctagonalPlatformRotating),
     23     OBJECT(/*model*/ MODEL_BITS_OCTAGONAL_PLATFORM,     /*pos*/ -6459,  1732,  -904, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvOctagonalPlatformRotating),
     24     OBJECT(/*model*/ MODEL_BITS_OCTAGONAL_PLATFORM,     /*pos*/ -4770,  1732,  -904, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM1(0x02), /*bhv*/ bhvOctagonalPlatformRotating),
     25     OBJECT(/*model*/ MODEL_BITS_FERRIS_WHEEL_AXLE,      /*pos*/ -1748, -1330, -1094, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFerrisWheelAxle),
     26     OBJECT(/*model*/ MODEL_BITS_FERRIS_WHEEL_AXLE,      /*pos*/  2275,  5628, -1315, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFerrisWheelAxle),
     27     OBJECT(/*model*/ MODEL_BITS_FERRIS_WHEEL_AXLE,      /*pos*/  3114,  4701, -1320, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFerrisWheelAxle),
     28     OBJECT(/*model*/ MODEL_BITS_ARROW_PLATFORM,         /*pos*/  2793,  2325,  -904, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM1(ACTIVATED_BF_PLAT_TYPE_BITS_ARROW_PLAT) | BPARAM2(97), /*bhv*/ bhvActivatedBackAndForthPlatform),
     29     OBJECT(/*model*/ MODEL_BITS_SEESAW_PLATFORM,        /*pos*/    27, -1555,  -713, /*angle*/ 0, 90, 0,  /*bhvParam*/ BPARAM2(0x01), /*bhv*/ bhvSeesawPlatform),
     30     OBJECT(/*model*/ MODEL_BITS_TILTING_W_PLATFORM,     /*pos*/  -306, -4300,     0, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM2(0x02), /*bhv*/ bhvSeesawPlatform),
     31     OBJECT(/*model*/ MODEL_BITS_STAIRCASE,              /*pos*/  1769,  -234,  -899, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvAnimatesOnFloorSwitchPress),
     32     OBJECT(/*model*/ MODEL_PURPLE_SWITCH,               /*pos*/  -279,  -234,  -900, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFloorSwitchAnimatesObject),
     33     OBJECT(/*model*/ MODEL_NONE,                        /*pos*/ -6460,  2039,  -905, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM2(207),  /*bhv*/ bhvPoleGrabbing),
     34     OBJECT(/*model*/ MODEL_NONE,                        /*pos*/ -3326,  3227,  -905, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM2(77),   /*bhv*/ bhvPoleGrabbing),
     35     OBJECT(/*model*/ MODEL_NONE,                        /*pos*/  5518,  3184, -4019, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFlamethrower),
     36     OBJECT(/*model*/ MODEL_NONE,                        /*pos*/  6465,  3731, -1915, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFlamethrower),
     37     OBJECT(/*model*/ MODEL_NONE,                        /*pos*/  5915,  3718, -4019, /*angle*/ 0, 0, 0,   /*bhvParam*/ 0, /*bhv*/ bhvFlamethrower),
     38     RETURN(),
     39 };
     40 
     41 static const LevelScript script_func_local_2[] = {
     42     OBJECT(/*model*/ MODEL_NONE, /*pos*/ 350, 6800, -6800, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(STAR_INDEX_ACT_1), /*bhv*/ bhvBowserCourseRedCoinStar),
     43     RETURN(),
     44 };
     45 
     46 const LevelScript level_bits_entry[] = {
     47     INIT_LEVEL(),
     48     LOAD_MIO0        (/*seg*/ 0x07, _bits_segment_7SegmentRomStart, _bits_segment_7SegmentRomEnd),
     49     LOAD_MIO0        (/*seg*/ 0x0A, _bits_skybox_mio0SegmentRomStart, _bits_skybox_mio0SegmentRomEnd),
     50     LOAD_MIO0_TEXTURE(/*seg*/ 0x09, _sky_mio0SegmentRomStart, _sky_mio0SegmentRomEnd),
     51     LOAD_MIO0        (/*seg*/ 0x06, _group14_mio0SegmentRomStart, _group14_mio0SegmentRomEnd),
     52     LOAD_RAW         (/*seg*/ 0x0D, _group14_geoSegmentRomStart,  _group14_geoSegmentRomEnd),
     53     LOAD_MIO0        (/*seg*/ 0x08, _common0_mio0SegmentRomStart, _common0_mio0SegmentRomEnd),
     54     LOAD_RAW         (/*seg*/ 0x0F, _common0_geoSegmentRomStart,  _common0_geoSegmentRomEnd),
     55     ALLOC_LEVEL_POOL(),
     56     MARIO(/*model*/ MODEL_MARIO, /*bhvParam*/ BPARAM4(0x01), /*bhv*/ bhvMario),
     57     JUMP_LINK(script_func_global_15),
     58     JUMP_LINK(script_func_global_1),
     59     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_03,           bits_geo_000430),
     60     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_04,           bits_geo_000448),
     61     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_05,           bits_geo_000460),
     62     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_06,           bits_geo_000478),
     63     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_07,           bits_geo_000490),
     64     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_08,           bits_geo_0004A8),
     65     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_09,           bits_geo_0004C0),
     66     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0A,           bits_geo_0004D8),
     67     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0B,           bits_geo_0004F0),
     68     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0C,           bits_geo_000508),
     69     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0D,           bits_geo_000520),
     70     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0E,           bits_geo_000538),
     71     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_0F,           bits_geo_000550),
     72     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_10,           bits_geo_000568),
     73     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_11,           bits_geo_000580),
     74     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_12,           bits_geo_000598),
     75     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_13,           bits_geo_0005B0),
     76     LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_14,           bits_geo_0005C8),
     77     LOAD_MODEL_FROM_GEO(MODEL_BITS_SLIDING_PLATFORM,       bits_geo_0005E0),
     78     LOAD_MODEL_FROM_GEO(MODEL_BITS_TWIN_SLIDING_PLATFORMS, bits_geo_0005F8),
     79     LOAD_MODEL_FROM_GEO(MODEL_BITS_OCTAGONAL_PLATFORM,     bits_geo_000610),
     80     LOAD_MODEL_FROM_GEO(MODEL_BITS_BLUE_PLATFORM,          bits_geo_000628),
     81     LOAD_MODEL_FROM_GEO(MODEL_BITS_FERRIS_WHEEL_AXLE,      bits_geo_000640),
     82     LOAD_MODEL_FROM_GEO(MODEL_BITS_ARROW_PLATFORM,         bits_geo_000658),
     83     LOAD_MODEL_FROM_GEO(MODEL_BITS_SEESAW_PLATFORM,        bits_geo_000670),
     84     LOAD_MODEL_FROM_GEO(MODEL_BITS_TILTING_W_PLATFORM,     bits_geo_000688),
     85     LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE,              bits_geo_0006A0),
     86     LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME1,       bits_geo_0006B8),
     87     LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME2,       bits_geo_0006D0),
     88     LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME3,       bits_geo_0006E8),
     89     LOAD_MODEL_FROM_GEO(MODEL_BITS_STAIRCASE_FRAME4,       bits_geo_000700),
     90     LOAD_MODEL_FROM_GEO(MODEL_BITS_WARP_PIPE,              warp_pipe_geo),
     91 
     92     AREA(/*index*/ 1, bits_geo_000718),
     93         OBJECT(/*model*/ MODEL_NONE,           /*pos*/ -7039, -3812,     4, /*angle*/ 0, 90, 0,  /*bhvParam*/ BPARAM2(WARP_NODE_0A), /*bhv*/ bhvAirborneWarp),
     94         OBJECT(/*model*/ MODEL_BITS_WARP_PIPE, /*pos*/   351,  6652, -6030, /*angle*/ 0, 0, 0,   /*bhvParam*/ BPARAM2(WARP_NODE_0B), /*bhv*/ bhvWarpPipe),
     95         OBJECT(/*model*/ MODEL_NONE,           /*pos*/   351,  6800, -3900, /*angle*/ 0, 180, 0, /*bhvParam*/ BPARAM2(WARP_NODE_0C), /*bhv*/ bhvDeathWarp),
     96         WARP_NODE(/*id*/ WARP_NODE_0A,    /*destLevel*/ LEVEL_BITS,     /*destArea*/ 1, /*destNode*/ WARP_NODE_0A, /*flags*/ WARP_NO_CHECKPOINT),
     97         WARP_NODE(/*id*/ WARP_NODE_0B,    /*destLevel*/ LEVEL_BOWSER_3, /*destArea*/ 1, /*destNode*/ WARP_NODE_0A, /*flags*/ WARP_NO_CHECKPOINT),
     98         WARP_NODE(/*id*/ WARP_NODE_0C,    /*destLevel*/ LEVEL_BITS,     /*destArea*/ 1, /*destNode*/ WARP_NODE_0C, /*flags*/ WARP_NO_CHECKPOINT),
     99         WARP_NODE(/*id*/ WARP_NODE_DEATH, /*destLevel*/ LEVEL_CASTLE,   /*destArea*/ 2, /*destNode*/ WARP_NODE_6B, /*flags*/ WARP_NO_CHECKPOINT),
    100         JUMP_LINK(script_func_local_1),
    101         JUMP_LINK(script_func_local_2),
    102         TERRAIN(/*terrainData*/ bits_seg7_collision_level),
    103         MACRO_OBJECTS(/*objList*/ bits_seg7_macro_objs),
    104         SET_BACKGROUND_MUSIC(/*settingsPreset*/ 0x0000, /*seq*/ SEQ_LEVEL_KOOPA_ROAD),
    105         TERRAIN_TYPE(/*terrainType*/ TERRAIN_STONE),
    106     END_AREA(),
    107 
    108     FREE_LEVEL_POOL(),
    109     MARIO_POS(/*area*/ 1, /*yaw*/ 90, /*pos*/ -7039, -4812, 4),
    110     CALL(/*arg*/ 0, /*func*/ lvl_init_or_update),
    111     CALL_LOOP(/*arg*/ 1, /*func*/ lvl_init_or_update),
    112     CLEAR_LEVEL(),
    113     SLEEP_BEFORE_EXIT(/*frames*/ 1),
    114     EXIT(),
    115 };