|
@@ -29,62 +29,29 @@ int LoaderTR2::load(std::string f) {
|
29
|
29
|
}
|
30
|
30
|
|
31
|
31
|
loadPaletteTextiles();
|
32
|
|
- getLog() << "->loaded palette" << Log::endl;
|
33
|
32
|
|
34
|
33
|
file.seek(file.tell() + 4); // Unused value?
|
35
|
34
|
|
36
|
35
|
loadRooms();
|
37
|
|
- getLog() << "->loaded rooms" << Log::endl;
|
38
|
|
-
|
39
|
36
|
loadFloorData();
|
40
|
|
- getLog() << "->loaded floor data" << Log::endl;
|
41
|
|
-
|
42
|
37
|
loadMeshes();
|
43
|
|
- getLog() << "->loaded meshes" << Log::endl;
|
44
|
|
-
|
45
|
38
|
loadMoveables();
|
46
|
|
- getLog() << "->loaded moveables" << Log::endl;
|
47
|
|
-
|
48
|
39
|
loadStaticMeshes();
|
49
|
|
- getLog() << "->loaded static meshes" << Log::endl;
|
50
|
|
-
|
51
|
40
|
loadTextures();
|
52
|
|
- getLog() << "->loaded textures" << Log::endl;
|
53
|
|
-
|
54
|
41
|
loadSprites();
|
55
|
|
- getLog() << "->loaded sprites" << Log::endl;
|
56
|
|
-
|
57
|
42
|
loadCameras();
|
58
|
|
- getLog() << "->loaded cameras" << Log::endl;
|
59
|
|
-
|
60
|
43
|
loadSoundSources();
|
61
|
|
- getLog() << "->loaded sound sources" << Log::endl;
|
62
|
|
-
|
63
|
44
|
loadBoxesOverlapsZones();
|
64
|
|
- getLog() << "->loaded boxes overlaps zones" << Log::endl;
|
65
|
|
-
|
66
|
45
|
loadAnimatedTextures();
|
67
|
|
- getLog() << "->loaded animated textures" << Log::endl;
|
68
|
|
-
|
69
|
46
|
loadItems();
|
70
|
|
- getLog() << "->loaded items" << Log::endl;
|
71
|
47
|
|
72
|
48
|
file.seek(file.tell() + 8192); // Skip Light map, only for 8bit coloring
|
73
|
49
|
|
74
|
50
|
loadCinematicFrames();
|
75
|
|
- getLog() << "->loaded cinematic frames" << Log::endl;
|
76
|
|
-
|
77
|
51
|
loadDemoData();
|
78
|
|
- getLog() << "->loaded demo data" << Log::endl;
|
79
|
|
-
|
80
|
52
|
loadSoundMap();
|
81
|
|
- getLog() << "->loaded sound map" << Log::endl;
|
82
|
|
-
|
83
|
53
|
loadSoundDetails();
|
84
|
|
- getLog() << "->loaded sound details" << Log::endl;
|
85
|
|
-
|
86
|
54
|
loadSampleIndices();
|
87
|
|
- getLog() << "->loaded sample indices" << Log::endl;
|
88
|
55
|
|
89
|
56
|
return 0;
|
90
|
57
|
}
|
|
@@ -116,6 +83,7 @@ void LoaderTR2::loadPaletteTextiles() {
|
116
|
83
|
|
117
|
84
|
void LoaderTR2::loadRooms() {
|
118
|
85
|
uint16_t numRooms = file.readU16();
|
|
86
|
+
|
119
|
87
|
for (unsigned int i = 0; i < numRooms; i++) {
|
120
|
88
|
// Room Header
|
121
|
89
|
int32_t xOffset = file.read32();
|
|
@@ -142,7 +110,7 @@ void LoaderTR2::loadRooms() {
|
142
|
110
|
// 0x0010 - Normal?
|
143
|
111
|
uint16_t attributes = file.readU16();
|
144
|
112
|
|
145
|
|
- int16_t lighting2; // Almost always equal to lighting1
|
|
113
|
+ int16_t lighting2 = file.read16(); // Almost always equal to lighting1
|
146
|
114
|
|
147
|
115
|
// TODO store vertex somewhere
|
148
|
116
|
}
|
|
@@ -205,6 +173,9 @@ void LoaderTR2::loadRooms() {
|
205
|
173
|
int16_t xCorner3 = file.read16();
|
206
|
174
|
int16_t yCorner3 = file.read16();
|
207
|
175
|
int16_t zCorner3 = file.read16();
|
|
176
|
+ int16_t xCorner4 = file.read16();
|
|
177
|
+ int16_t yCorner4 = file.read16();
|
|
178
|
+ int16_t zCorner4 = file.read16();
|
208
|
179
|
|
209
|
180
|
// TODO store portals somewhere
|
210
|
181
|
}
|
|
@@ -293,7 +264,6 @@ void LoaderTR2::loadMeshes() {
|
293
|
264
|
// only afterward we can read the number of meshes
|
294
|
265
|
// in this data block
|
295
|
266
|
uint32_t numMeshData = file.readU32();
|
296
|
|
-
|
297
|
267
|
std::vector<uint16_t> buffer;
|
298
|
268
|
for (unsigned int i = 0; i < numMeshData; i++) {
|
299
|
269
|
buffer.push_back(file.readU16());
|
|
@@ -332,8 +302,8 @@ void LoaderTR2::loadMoveables() {
|
332
|
302
|
uint16_t nextFrame = file.readU16();
|
333
|
303
|
uint16_t numStateChanges = file.readU16();
|
334
|
304
|
uint16_t stateChangeOffset = file.readU16(); // Index into StateChanges[]
|
335
|
|
- uint16_t numAnimCommands; // How many animation commands to use
|
336
|
|
- uint16_t animCommandOffset; // Index into AnimCommand[]
|
|
305
|
+ uint16_t numAnimCommands = file.readU16(); // How many animation commands to use
|
|
306
|
+ uint16_t animCommandOffset = file.readU16(); // Index into AnimCommand[]
|
337
|
307
|
|
338
|
308
|
// TODO store animations somewhere
|
339
|
309
|
}
|
|
@@ -372,10 +342,14 @@ void LoaderTR2::loadMoveables() {
|
372
|
342
|
// reading the stack but not changing it
|
373
|
343
|
uint32_t flags = file.readU32();
|
374
|
344
|
|
|
345
|
+
|
375
|
346
|
// Offset of mesh origin from the parent mesh origin
|
|
347
|
+
|
|
348
|
+ /* Where the hell does this come from?!
|
376
|
349
|
int32_t x = file.read32();
|
377
|
350
|
int32_t y = file.read32();
|
378
|
351
|
int32_t z = file.read32();
|
|
352
|
+ */
|
379
|
353
|
|
380
|
354
|
// TODO store mesh trees somewhere
|
381
|
355
|
}
|