sm64

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

script.c (7279B)


      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/sl/header.h"
     17 
     18 
     19 static const LevelScript script_func_local_1[] = {
     20     OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/  700, 4500,  690, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(STAR_INDEX_ACT_1), /*bhv*/ bhvStar,                 /*acts*/ ALL_ACTS),
     21     OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/ 4350, 1350, 4350, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(STAR_INDEX_ACT_3), /*bhv*/ bhvStar,                 /*acts*/ ALL_ACTS),
     22     OBJECT_WITH_ACTS(/*model*/ MODEL_NONE, /*pos*/ 5000, 1200,    0, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(STAR_INDEX_ACT_5), /*bhv*/ bhvHiddenRedCoinStar, /*acts*/ ALL_ACTS),
     23     RETURN(),
     24 };
     25 
     26 static const LevelScript script_func_local_2[] = {
     27     OBJECT(/*model*/ MODEL_NONE, /*pos*/  977, 1024, 2075, /*angle*/ 0, 0, 0, /*bhvParam*/ 0, /*bhv*/ bhvSnowMoundSpawn),
     28     RETURN(),
     29 };
     30 
     31 static const LevelScript script_func_local_3[] = {
     32     OBJECT(/*model*/ MODEL_PENGUIN,            /*pos*/ 1715, 3328,   518, /*angle*/ 0, -51, 0, /*bhvParam*/ 0, /*bhv*/ bhvSLWalkingPenguin),
     33     OBJECT(/*model*/ MODEL_NONE,               /*pos*/  700, 3428,   700, /*angle*/ 0,  30, 0, /*bhvParam*/ 0, /*bhv*/ bhvSLSnowmanWind),
     34     OBJECT(/*model*/ MODEL_NONE,               /*pos*/  480, 2300,  1370, /*angle*/ 0,   0, 0, /*bhvParam*/ 0, /*bhv*/ bhvIgloo),
     35     OBJECT(/*model*/ MODEL_BIG_CHILL_BULLY,    /*pos*/  315, 1331, -4852, /*angle*/ 0,   0, 0, /*bhvParam*/ BPARAM1(STAR_INDEX_ACT_2), /*bhv*/ bhvBigChillBully),
     36     OBJECT(/*model*/ MODEL_MR_BLIZZARD_HIDDEN, /*pos*/ 2954,  970,   750, /*angle*/ 0,   0, 0, /*bhvParam*/ BPARAM2(MR_BLIZZARD_STYPE_CAP), /*bhv*/ bhvMrBlizzard),
     37     RETURN(),
     38 };
     39 
     40 static const LevelScript script_func_local_4[] = {
     41     OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/ 0, 500, 1000, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(STAR_INDEX_ACT_6), /*bhv*/ bhvStar, /*acts*/ ALL_ACTS),
     42     RETURN(),
     43 };
     44 
     45 const LevelScript level_sl_entry[] = {
     46     INIT_LEVEL(),
     47     LOAD_MIO0        (/*seg*/ 0x07, _sl_segment_7SegmentRomStart, _sl_segment_7SegmentRomEnd),
     48     LOAD_MIO0_TEXTURE(/*seg*/ 0x09, _snow_mio0SegmentRomStart, _snow_mio0SegmentRomEnd),
     49     LOAD_MIO0        (/*seg*/ 0x0B, _effect_mio0SegmentRomStart, _effect_mio0SegmentRomEnd),
     50     LOAD_MIO0        (/*seg*/ 0x0A, _ccm_skybox_mio0SegmentRomStart, _ccm_skybox_mio0SegmentRomEnd),
     51     LOAD_MIO0        (/*seg*/ 0x05, _group7_mio0SegmentRomStart, _group7_mio0SegmentRomEnd),
     52     LOAD_RAW         (/*seg*/ 0x0C, _group7_geoSegmentRomStart,  _group7_geoSegmentRomEnd),
     53     LOAD_MIO0        (/*seg*/ 0x06, _group16_mio0SegmentRomStart, _group16_mio0SegmentRomEnd),
     54     LOAD_RAW         (/*seg*/ 0x0D, _group16_geoSegmentRomStart,  _group16_geoSegmentRomEnd),
     55     LOAD_MIO0        (/*seg*/ 0x08, _common0_mio0SegmentRomStart, _common0_mio0SegmentRomEnd),
     56     LOAD_RAW         (/*seg*/ 0x0F, _common0_geoSegmentRomStart,  _common0_geoSegmentRomEnd),
     57     ALLOC_LEVEL_POOL(),
     58     MARIO(/*model*/ MODEL_MARIO, /*bhvParam*/ BPARAM4(0x01), /*bhv*/ bhvMario),
     59     JUMP_LINK(script_func_global_1),
     60     JUMP_LINK(script_func_global_8),
     61     JUMP_LINK(script_func_global_17),
     62     LOAD_MODEL_FROM_GEO(MODEL_SL_SNOW_TRIANGLE,     sl_geo_000390),
     63     LOAD_MODEL_FROM_GEO(MODEL_SL_CRACKED_ICE,       sl_geo_000360),
     64     LOAD_MODEL_FROM_GEO(MODEL_SL_CRACKED_ICE_CHUNK, sl_geo_000378),
     65     LOAD_MODEL_FROM_GEO(MODEL_SL_SNOW_TREE,         snow_tree_geo),
     66 
     67     AREA(/*index*/ 1, sl_geo_0003A8),
     68         OBJECT(/*model*/ MODEL_NONE, /*pos*/  5541, 2024,   443, /*angle*/ 0, 270, 0, /*bhvParam*/ BPARAM2(WARP_NODE_0A), /*bhv*/ bhvSpinAirborneWarp),
     69         OBJECT(/*model*/ MODEL_NONE, /*pos*/   257, 2150,  1399, /*angle*/ 0, 290, 0, /*bhvParam*/ BPARAM2(WARP_NODE_0B), /*bhv*/ bhvInstantActiveWarp),
     70         OBJECT(/*model*/ MODEL_NONE, /*pos*/   569, 2150,  1336, /*angle*/ 0,   0, 0, /*bhvParam*/ BPARAM1(6) | BPARAM2(WARP_NODE_0C), /*bhv*/ bhvWarp),
     71         OBJECT(/*model*/ MODEL_NONE, /*pos*/  5468, 1056, -5400, /*angle*/ 0, -20, 0, /*bhvParam*/ BPARAM2(WARP_NODE_0D), /*bhv*/ bhvFadingWarp),
     72         OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3698, 1024, -1237, /*angle*/ 0,   6, 0, /*bhvParam*/ BPARAM2(WARP_NODE_0E), /*bhv*/ bhvFadingWarp),
     73         WARP_NODE(/*id*/ WARP_NODE_0A, /*destLevel*/ LEVEL_SL, /*destArea*/ 1, /*destNode*/ WARP_NODE_0A, /*flags*/ WARP_NO_CHECKPOINT),
     74         WARP_NODE(/*id*/ WARP_NODE_0B, /*destLevel*/ LEVEL_SL, /*destArea*/ 1, /*destNode*/ WARP_NODE_0B, /*flags*/ WARP_NO_CHECKPOINT),
     75         WARP_NODE(/*id*/ WARP_NODE_0C, /*destLevel*/ LEVEL_SL, /*destArea*/ 2, /*destNode*/ WARP_NODE_0A, /*flags*/ WARP_NO_CHECKPOINT),
     76         WARP_NODE(/*id*/ WARP_NODE_0D, /*destLevel*/ LEVEL_SL, /*destArea*/ 1, /*destNode*/ WARP_NODE_0E, /*flags*/ WARP_NO_CHECKPOINT),
     77         WARP_NODE(/*id*/ WARP_NODE_0E, /*destLevel*/ LEVEL_SL, /*destArea*/ 1, /*destNode*/ WARP_NODE_0D, /*flags*/ WARP_NO_CHECKPOINT),
     78         JUMP_LINK(script_func_local_1),
     79         JUMP_LINK(script_func_local_2),
     80         JUMP_LINK(script_func_local_3),
     81         WARP_NODE(/*id*/ WARP_NODE_SUCCESS,    /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 2, /*destNode*/ WARP_NODE_36, /*flags*/ WARP_NO_CHECKPOINT),
     82         WARP_NODE(/*id*/ WARP_NODE_DEATH, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 2, /*destNode*/ WARP_NODE_68, /*flags*/ WARP_NO_CHECKPOINT),
     83         TERRAIN(/*terrainData*/ sl_seg7_area_1_collision),
     84         MACRO_OBJECTS(/*objList*/ sl_seg7_area_1_macro_objs),
     85         SET_BACKGROUND_MUSIC(/*settingsPreset*/ 0x0000, /*seq*/ SEQ_LEVEL_SNOW),
     86         TERRAIN_TYPE(/*terrainType*/ TERRAIN_SNOW),
     87     END_AREA(),
     88 
     89     AREA(/*index*/ 2, sl_geo_000484),
     90         OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 0, 2867, /*angle*/ 0, 180, 0, /*bhvParam*/ BPARAM2(WARP_NODE_0A), /*bhv*/ bhvInstantActiveWarp),
     91         OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 0, 3277, /*angle*/ 0,   0, 0, /*bhvParam*/ BPARAM1(20) | BPARAM2(WARP_NODE_0B), /*bhv*/ bhvWarp),
     92         WARP_NODE(/*id*/ WARP_NODE_0A, /*destLevel*/ LEVEL_SL, /*destArea*/ 2, /*destNode*/ WARP_NODE_0A, /*flags*/ WARP_NO_CHECKPOINT),
     93         WARP_NODE(/*id*/ WARP_NODE_0B, /*destLevel*/ LEVEL_SL, /*destArea*/ 1, /*destNode*/ WARP_NODE_0B, /*flags*/ WARP_NO_CHECKPOINT),
     94         JUMP_LINK(script_func_local_4),
     95         WARP_NODE(/*id*/ WARP_NODE_SUCCESS,    /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 2, /*destNode*/ WARP_NODE_36, /*flags*/ WARP_NO_CHECKPOINT),
     96         WARP_NODE(/*id*/ WARP_NODE_DEATH, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 2, /*destNode*/ WARP_NODE_68, /*flags*/ WARP_NO_CHECKPOINT),
     97         TERRAIN(/*terrainData*/ sl_seg7_area_2_collision),
     98         MACRO_OBJECTS(/*objList*/ sl_seg7_area_2_macro_objs),
     99         SET_BACKGROUND_MUSIC(/*settingsPreset*/ 0x0004, /*seq*/ SEQ_LEVEL_UNDERGROUND),
    100         TERRAIN_TYPE(/*terrainType*/ TERRAIN_SNOW),
    101     END_AREA(),
    102 
    103     FREE_LEVEL_POOL(),
    104     MARIO_POS(/*area*/ 1, /*yaw*/ 270, /*pos*/ 5541, 1024, 443),
    105     CALL(/*arg*/ 0, /*func*/ lvl_init_or_update),
    106     CALL_LOOP(/*arg*/ 1, /*func*/ lvl_init_or_update),
    107     CLEAR_LEVEL(),
    108     SLEEP_BEFORE_EXIT(/*frames*/ 1),
    109     EXIT(),
    110 };