sm64

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

level_update.h (5289B)


      1 #ifndef LEVEL_UPDATE_H
      2 #define LEVEL_UPDATE_H
      3 
      4 #include <PR/ultratypes.h>
      5 
      6 #include "types.h"
      7 
      8 
      9 #define TIMER_CONTROL_SHOW  0
     10 #define TIMER_CONTROL_START 1
     11 #define TIMER_CONTROL_STOP  2
     12 #define TIMER_CONTROL_HIDE  3
     13 
     14 #define WARP_OP_NONE          0x00
     15 #define WARP_OP_UNKNOWN_01    0x01
     16 #define WARP_OP_UNKNOWN_02    0x02
     17 #define WARP_OP_WARP_DOOR     0x03
     18 #define WARP_OP_WARP_OBJECT   0x04
     19 #define WARP_OP_TELEPORT      0x05
     20 #define WARP_OP_STAR_EXIT     0x11
     21 #define WARP_OP_DEATH         0x12
     22 #define WARP_OP_WARP_FLOOR    0x13
     23 #define WARP_OP_GAME_OVER     0x14
     24 #define WARP_OP_CREDITS_END   0x15
     25 #define WARP_OP_DEMO_NEXT     0x16
     26 #define WARP_OP_CREDITS_START 0x17
     27 #define WARP_OP_CREDITS_NEXT  0x18
     28 #define WARP_OP_DEMO_END      0x19
     29 
     30 #define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10
     31 
     32 #define MARIO_SPAWN_DOOR_WARP             0x01
     33 #define MARIO_SPAWN_UNKNOWN_02            0x02
     34 #define MARIO_SPAWN_UNKNOWN_03            0x03
     35 #define MARIO_SPAWN_TELEPORT              0x04
     36 #define MARIO_SPAWN_INSTANT_ACTIVE        0x10
     37 #define MARIO_SPAWN_SWIMMING              0x11
     38 #define MARIO_SPAWN_AIRBORNE              0x12
     39 #define MARIO_SPAWN_HARD_AIR_KNOCKBACK    0x13
     40 #define MARIO_SPAWN_SPIN_AIRBORNE_CIRCLE  0x14
     41 #define MARIO_SPAWN_DEATH                 0x15
     42 #define MARIO_SPAWN_SPIN_AIRBORNE         0x16
     43 #define MARIO_SPAWN_FLYING                0x17
     44 #define MARIO_SPAWN_PAINTING_STAR_COLLECT 0x20
     45 #define MARIO_SPAWN_PAINTING_DEATH        0x21
     46 #define MARIO_SPAWN_AIRBORNE_STAR_COLLECT 0x22
     47 #define MARIO_SPAWN_AIRBORNE_DEATH        0x23
     48 #define MARIO_SPAWN_LAUNCH_STAR_COLLECT   0x24
     49 #define MARIO_SPAWN_LAUNCH_DEATH          0x25
     50 #define MARIO_SPAWN_UNKNOWN_27            0x27
     51 
     52 enum WarpNodes {
     53     WARP_NODE_00,
     54     WARP_NODE_01,
     55     WARP_NODE_02,
     56     WARP_NODE_03,
     57     WARP_NODE_04,
     58     WARP_NODE_05,
     59     WARP_NODE_06,
     60     WARP_NODE_07,
     61     WARP_NODE_08,
     62     WARP_NODE_09,
     63     WARP_NODE_0A,
     64     WARP_NODE_0B,
     65     WARP_NODE_0C,
     66     WARP_NODE_0D,
     67     WARP_NODE_0E,
     68     WARP_NODE_0F,
     69     WARP_NODE_10,
     70     WARP_NODE_11,
     71     WARP_NODE_14 = 0x14,
     72     WARP_NODE_15,
     73     WARP_NODE_16,
     74     WARP_NODE_17,
     75     WARP_NODE_18,
     76     WARP_NODE_19,
     77     WARP_NODE_1A,
     78     WARP_NODE_1B,
     79     WARP_NODE_1C,
     80     WARP_NODE_1D,
     81     WARP_NODE_1E,
     82     WARP_NODE_1F,
     83     WARP_NODE_20,
     84     WARP_NODE_21,
     85     WARP_NODE_22,
     86     WARP_NODE_23,
     87     WARP_NODE_24,
     88     WARP_NODE_25,
     89     WARP_NODE_26,
     90     WARP_NODE_27,
     91     WARP_NODE_28,
     92     WARP_NODE_29,
     93     WARP_NODE_2A,
     94     WARP_NODE_32 = 0x32,
     95     WARP_NODE_33,
     96     WARP_NODE_34,
     97     WARP_NODE_35,
     98     WARP_NODE_36,
     99     WARP_NODE_37,
    100     WARP_NODE_38,
    101     WARP_NODE_3A = 0x3A,
    102     WARP_NODE_64 = 0x64,
    103     WARP_NODE_65,
    104     WARP_NODE_66,
    105     WARP_NODE_67,
    106     WARP_NODE_68,
    107     WARP_NODE_69,
    108     WARP_NODE_6B = 0x6B,
    109     WARP_NODE_6C,
    110     WARP_NODE_6D,
    111 
    112     // Special Warps
    113     WARP_NODE_SUCCESS = 0xF0,
    114     WARP_NODE_DEATH = 0xF1,
    115     WARP_NODE_TOTWC = 0xF2,
    116     WARP_NODE_WARP_FLOOR = 0xF3,
    117     WARP_NODE_CREDITS_START = 0xF8,
    118     WARP_NODE_CREDITS_MIN = WARP_NODE_CREDITS_START,
    119     WARP_NODE_CREDITS_NEXT = 0xF9,
    120     WARP_NODE_CREDITS_END = 0xFA
    121 };
    122 
    123 
    124 struct CreditsEntry {
    125     /*0x00*/ u8 levelNum;
    126     /*0x01*/ u8 areaIndex;
    127     /*0x02*/ u8 unk02;
    128     /*0x03*/ s8 marioAngle;
    129     /*0x04*/ Vec3s marioPos;
    130     /*0x0C*/ const char **unk0C;
    131 };
    132 
    133 extern struct CreditsEntry *gCurrCreditsEntry;
    134 
    135 extern struct MarioState gMarioStates[];
    136 extern struct MarioState *gMarioState;
    137 
    138 extern s16 sCurrPlayMode;
    139 extern u16 D_80339ECA;
    140 extern s16 sTransitionTimer;
    141 extern void (*sTransitionUpdate)(s16 *);
    142 extern u8 unused2[4];
    143 
    144 struct WarpDest {
    145     u8 type;
    146     u8 levelNum;
    147     u8 areaIdx;
    148     u8 nodeId;
    149     u32 arg;
    150 };
    151 
    152 extern struct WarpDest sWarpDest;
    153 
    154 extern s16 D_80339EE0;
    155 extern s16 sDelayedWarpOp;
    156 extern s16 sDelayedWarpTimer;
    157 extern s16 sSourceWarpNodeId;
    158 extern s32 sDelayedWarpArg;
    159 extern s16 sUnusedLevelUpdateBss;
    160 extern s8 sTimerRunning;
    161 
    162 struct HudDisplay {
    163     /*0x00*/ s16 lives;
    164     /*0x02*/ s16 coins;
    165     /*0x04*/ s16 stars;
    166     /*0x06*/ s16 wedges;
    167     /*0x08*/ s16 keys;
    168     /*0x0A*/ s16 flags;
    169     /*0x0C*/ u16 timer;
    170 };
    171 
    172 extern struct HudDisplay gHudDisplay;
    173 extern s8 gNeverEnteredCastle;
    174 
    175 enum HUDDisplayFlag {
    176     HUD_DISPLAY_FLAG_LIVES = 0x0001,
    177     HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002,
    178     HUD_DISPLAY_FLAG_STAR_COUNT = 0x0004,
    179     HUD_DISPLAY_FLAG_CAMERA_AND_POWER = 0x0008,
    180     HUD_DISPLAY_FLAG_KEYS = 0x0010,
    181     HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020,
    182     HUD_DISPLAY_FLAG_TIMER = 0x0040,
    183     HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000,
    184 
    185     HUD_DISPLAY_NONE = 0x0000,
    186     HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
    187 };
    188 
    189 
    190 u16 level_control_timer(s32 timerOp);
    191 void fade_into_special_warp(u32 arg, u32 color);
    192 void load_level_init_text(u32 arg);
    193 s16 level_trigger_warp(struct MarioState *m, s32 warpOp);
    194 void level_set_transition(s16 length, void (*updateFunction)(s16 *));
    195 
    196 s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused);
    197 s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum);
    198 s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);
    199 s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1);
    200 void basic_update(UNUSED s16 *arg);
    201 
    202 #endif // LEVEL_UPDATE_H