area.h (5140B)
1 #ifndef AREA_H 2 #define AREA_H 3 4 #include <PR/ultratypes.h> 5 6 #include "types.h" 7 #include "camera.h" 8 #include "engine/graph_node.h" 9 10 struct WarpNode { 11 /*00*/ u8 id; 12 /*01*/ u8 destLevel; 13 /*02*/ u8 destArea; 14 /*03*/ u8 destNode; 15 }; 16 17 struct ObjectWarpNode { 18 /*0x00*/ struct WarpNode node; 19 /*0x04*/ struct Object *object; 20 /*0x08*/ struct ObjectWarpNode *next; 21 }; 22 23 // From Surface 0x1B to 0x1E 24 #define INSTANT_WARP_INDEX_START 0x00 // Equal and greater than Surface 0x1B 25 #define INSTANT_WARP_INDEX_STOP 0x04 // Less than Surface 0x1F 26 27 struct InstantWarp { 28 /*0x00*/ u8 id; // 0 = 0x1B / 1 = 0x1C / 2 = 0x1D / 3 = 0x1E 29 /*0x01*/ u8 area; 30 /*0x02*/ Vec3s displacement; 31 }; 32 33 struct SpawnInfo { 34 /*0x00*/ Vec3s startPos; 35 /*0x06*/ Vec3s startAngle; 36 /*0x0C*/ s8 areaIndex; 37 /*0x0D*/ s8 activeAreaIndex; 38 /*0x10*/ u32 behaviorArg; 39 /*0x14*/ void *behaviorScript; 40 /*0x18*/ struct GraphNode *model; 41 /*0x1C*/ struct SpawnInfo *next; 42 }; 43 44 struct UnusedArea28 { 45 /*0x00*/ s16 unk00; 46 /*0x02*/ s16 unk02; 47 /*0x04*/ s16 unk04; 48 /*0x06*/ s16 unk06; 49 /*0x08*/ s16 unk08; 50 }; 51 52 struct Whirlpool { 53 /*0x00*/ Vec3s pos; 54 /*0x03*/ s16 strength; 55 }; 56 57 struct Area { 58 /*0x00*/ s8 index; 59 /*0x01*/ s8 flags; // Only has 1 flag: 0x01 = Is this the active area? 60 /*0x02*/ u16 terrainType; // default terrain of the level (set from level script cmd 0x31) 61 /*0x04*/ struct GraphNodeRoot *unk04; // geometry layout data 62 /*0x08*/ TerrainData *terrainData; // collision data (set from level script cmd 0x2E) 63 /*0x0C*/ RoomData *surfaceRooms; // (set from level script cmd 0x2F) 64 /*0x10*/ s16 *macroObjects; // Macro Objects Ptr (set from level script cmd 0x39) 65 /*0x14*/ struct ObjectWarpNode *warpNodes; 66 /*0x18*/ struct WarpNode *paintingWarpNodes; 67 /*0x1C*/ struct InstantWarp *instantWarps; 68 /*0x20*/ struct SpawnInfo *objectSpawnInfos; 69 /*0x24*/ struct Camera *camera; 70 /*0x28*/ struct UnusedArea28 *unused; // Filled by level script 0x3A, but is unused. 71 /*0x2C*/ struct Whirlpool *whirlpools[2]; 72 /*0x34*/ u8 dialog[2]; // Level start dialog number (set by level script cmd 0x30) 73 /*0x36*/ u16 musicParam; 74 /*0x38*/ u16 musicParam2; 75 }; 76 77 // All the transition data to be used in screen_transition.c 78 struct WarpTransitionData { 79 /*0x00*/ u8 red; 80 /*0x01*/ u8 green; 81 /*0x02*/ u8 blue; 82 83 /*0x04*/ s16 startTexRadius; 84 /*0x06*/ s16 endTexRadius; 85 /*0x08*/ s16 startTexX; 86 /*0x0A*/ s16 startTexY; 87 /*0x0C*/ s16 endTexX; 88 /*0x0E*/ s16 endTexY; 89 90 /*0x10*/ s16 texTimer; // always 0, does seems to affect transition when disabled 91 }; 92 93 #define WARP_TRANSITION_FADE_FROM_COLOR 0x00 94 #define WARP_TRANSITION_FADE_INTO_COLOR 0x01 95 #define WARP_TRANSITION_FADE_FROM_STAR 0x08 96 #define WARP_TRANSITION_FADE_INTO_STAR 0x09 97 #define WARP_TRANSITION_FADE_FROM_CIRCLE 0x0A 98 #define WARP_TRANSITION_FADE_INTO_CIRCLE 0x0B 99 #define WARP_TRANSITION_FADE_FROM_MARIO 0x10 100 #define WARP_TRANSITION_FADE_INTO_MARIO 0x11 101 #define WARP_TRANSITION_FADE_FROM_BOWSER 0x12 102 #define WARP_TRANSITION_FADE_INTO_BOWSER 0x13 103 104 struct WarpTransition { 105 /*0x00*/ u8 isActive; // Is the transition active. (either TRUE or FALSE) 106 /*0x01*/ u8 type; // Determines the type of transition to use (circle, star, etc.) 107 /*0x02*/ u8 time; // Amount of time to complete the transition (in frames) 108 /*0x03*/ u8 pauseRendering; // Should the game stop rendering. (either TRUE or FALSE) 109 /*0x04*/ struct WarpTransitionData data; 110 }; 111 112 enum MenuOption { 113 MENU_OPT_NONE, 114 MENU_OPT_1, 115 MENU_OPT_2, 116 MENU_OPT_3, 117 MENU_OPT_DEFAULT = MENU_OPT_1, 118 119 // Course Pause Menu 120 MENU_OPT_CONTINUE = MENU_OPT_1, 121 MENU_OPT_EXIT_COURSE = MENU_OPT_2, 122 MENU_OPT_CAMERA_ANGLE_R = MENU_OPT_3, 123 124 // Save Menu 125 MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1, 126 MENU_OPT_SAVE_AND_QUIT = MENU_OPT_2, 127 MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3 128 }; 129 130 extern struct GraphNode **gLoadedGraphNodes; 131 extern struct SpawnInfo gPlayerSpawnInfos[]; 132 extern struct GraphNode *D_8033A160[]; 133 extern struct Area gAreaData[]; 134 extern struct WarpTransition gWarpTransition; 135 extern s16 gCurrCourseNum; 136 extern s16 gCurrActNum; 137 extern s16 gCurrAreaIndex; 138 extern s16 gSavedCourseNum; 139 extern s16 gMenuOptSelectIndex; 140 extern s16 gSaveOptSelectIndex; 141 142 extern struct SpawnInfo *gMarioSpawnInfo; 143 144 extern struct Area *gAreas; 145 extern struct Area *gCurrentArea; 146 147 extern s16 gCurrSaveFileNum; 148 extern s16 gCurrLevelNum; 149 150 151 void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e); 152 void print_intro_text(void); 153 u32 get_mario_spawn_type(struct Object *o); 154 struct ObjectWarpNode *area_get_warp_node(u8 id); 155 void clear_areas(void); 156 void clear_area_graph_nodes(void); 157 void load_area(s32 index); 158 void unload_area(void); 159 void load_mario_area(void); 160 void unload_mario_area(void); 161 void change_area(s32 index); 162 void area_update_objects(void); 163 void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue); 164 void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 blue, s16 delay); 165 void render_game(void); 166 167 #endif // AREA_H