1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
#ifndef __DCOURSE_H
#define __DCOURSE_H
// Proper headers for Course, not the old shit
class dCourse_c {
public:
virtual ~dCourse_c();
void loadFromFile(int courseID);
struct tilesets_s {
char name0[32];
char name1[32];
char name2[32];
char name3[32];
};
struct settings_s {
u64 defaultFlags;
s16 courseFlag;
s16 timeLimit;
u8 _[4];
u8 startEntrance;
u8 __[3];
};
struct bounding_s {
s32 yBoundNormalTop;
s32 yBoundNormalBottom;
s32 yBoundSpecialTop;
s32 yBoundSpecialBottom;
u16 entryID;
u16 lockToBottom;
u32 unknown;
};
struct unk_s {
u16 unk1;
u16 unk2;
u16 unk3;
u16 unk4;
};
struct bg_s {
u16 entryID;
u16 xScrollRate;
u16 yScrollRate;
u16 yPosOffset;
u16 xPosOffset;
u16 fileID1;
u16 fileID2;
u16 fileID3;
u16 unk1;
u16 scale;
u32 unk2;
};
struct nextGoto_s {
enum Flag {
NO_ENTRY = 0x80,
CONNECTED_PIPE = 8,
LINK_FORWARD = 4,
CONNECTED_REVERSE = 1,
};
s16 xPos;
s16 yPos;
s16 cameraXPos;
s16 cameraYPos;
u8 entryID;
u8 destArea;
u8 destEntrance;
u8 type;
u8 unk1;
u8 zoneID;
u8 layerID;
u8 pathID;
u16 flags;
u16 unk2;
};
struct sprite_s {
u16 type;
s16 xPos;
s16 yPos;
u16 eventIDs;
u32 settings;
u8 zoneID;
u8 layerID;
u16 unused;
};
struct load_s {
u16 type;
u16 unused;
};
struct zone_s {
s16 xPos;
s16 yPos;
s16 xSize;
s16 ySize;
u16 modelShading;
u16 terrainShading;
u8 entryID;
u8 boundingID;
u8 scrollMode;
u8 zoomMode;
u8 unk10;
u8 visibility;
u8 fgID;
u8 bgID;
u8 mpBias;
u8 unk3;
u8 music;
u8 audioModifier;
};
struct rect_s {
s16 xPos;
s16 yPos;
s16 xSize;
s16 ySize;
u8 entryID;
u8 unused[3];
};
struct cameraFlag_s {
u32 unk1;
u32 unk2;
u32 unk3;
u8 unk4;
u8 scrollMode;
u8 zoomMode;
u8 unk5;
u16 unk6;
u8 eventID;
u8 unk7;
};
struct rail_s {
enum Flag {
LOOP = 2,
};
u8 entryID;
u8 unknown;
u16 startNode;
u16 nodeCount;
u16 flags;
};
struct railNode_s {
u16 xPos;
u16 yPos;
float speed;
float accel;
short unk1;
short unk2;
};
int areaNum;
union {
struct {
tilesets_s *tilesets;
settings_s *settings;
bounding_s *bounding;
unk_s *unk;
bg_s *topBG;
bg_s *bottomBG;
nextGoto_s *nextGoto;
sprite_s *sprite;
load_s *load;
zone_s *zone;
rect_s *rect;
cameraFlag_s *cameraFlag;
rail_s *rail;
railNode_s *railNode;
};
void *blocks[14];
};
union {
struct {
int tilesetsSize, settingsSize, boundingSize, unkSize;
int topBGSize, bottomBGSize, nextGotoSize, spriteSize;
int loadSize, zoneSize, rectSize, cameraFlagSize;
int railSize, railNodeSize;
};
int blockSizes[14];
};
union {
struct {
int tilesetsCount, settingsCount, boundingCount, unkCount;
int topBGCount, bottomBGCount, nextGotoCount, spriteCount;
int loadCount, zoneCount, rectCount, cameraFlagCount;
int railCount, railNodeCount;
};
int blockCounts[14];
};
sprite_s *zoneFirstSprite[64];
int zoneSpriteCount[64];
int zoneFirstSpriteIdx[64];
bounding_s *getBoundingByID(u8 id);
bg_s *getTopBGByID(u16 id);
bg_s *getBottomBGByID(u16 id);
nextGoto_s *getNextGotoByID(u8 id);
zone_s *getZoneByID(u8 id, mRect *output = 0);
u8 getZoneID(u8 id);
u8 getBoundingIDForZone(u8 id);
u8 getScrollForZone(u8 id);
u8 getZoomForZone(u8 id);
u8 getUnk10ForZone(u8 id);
u8 getMusicForZone(u8 id);
u8 getAudioModifierForZone(u8 id);
u8 getVisibilityForZone(u8 id);
u8 getTopBGIDForZone(u8 id);
u8 getBottomBGIDForZone(u8 id);
u16 getModelShadingForZone(u8 id);
u16 getTerrainShadingForZone(u8 id);
u8 getMPBiasForZone(u8 id);
u16 getWidthForZone(u8 id);
rect_s *getRectByID(u8 id, mRect *output = 0);
u8 getZoneIDContainingPosition(Vec *pos);
u8 getZoneIDContainingRect(mRect16 *rect);
bool doesZoneContainPosition(Vec *pos, zone_s *zone);
bool doesZoneContainRect(mRect16 *rect, zone_s *zone);
};
class dCourseFull_c {
public:
dCourse_c courses[4];
void loadFromFile();
dCourse_c *get(int id) {
if (courses[id].zone)
return &courses[id];
else
return 0;
}
static dCourseFull_c *instance;
static void createOnHeap(/*EGG::Heap*/void *heap);
static void deleteInstance();
// might not be part of this class, dunno
static void generateLevelFilename(int world, int level, char *outBuffer);
static char levelFilename[10];
};
#endif
|