-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_common_gtlayer.bt
1476 lines (1242 loc) · 42.8 KB
/
_common_gtlayer.bt
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//------------------------------------------------
//--- 010 Editor Binary Template
//
// File: GTChunk/Zone Layer Parsing
// Authors: freakbyte, FallenAvatar, Arkii, Xsear
// Category: Firefall
// File Mask:
// ID Bytes:
//------------------------------------------------
#include "_common_types.bt"
#ifndef FF_COMMON_GTLAYER
#define FF_COMMON_GTLAYER 1
local uint64 NODE_TAG_MAGIC<hidden=true> = 0x12ED5A12ED5B12ED;
typedef enum <uint32> {
// Hack
NO_PARENT = 0xFFFFFFFF,
// Zone
ZONE = 0x30000,
ZONE_SKYBOX = 0x20000,
ZONE_DEFAULT_ENVIRONMENT = 0x20100,
DEFAULT_ENVIRONMENT_10000 = 0x02710, // Two vec3s. For some (indoor?) zones, they are the same. Older versions (1710) have only one.
ZONE_MELDING = 0x20200,
MELDING_PERIMITER = 5,
ZONE_WATER = 0x20300,
WATER_CHILD = 4, // Legacy
ZONE_CHUNK_INFO = 0x20400,
CHUNK_INFO_RANGE = 0x10000,
CHUNK_INFO_REF2 = 0x10100,
CHUNK_INFO_REF = 0x10101,
ZONE_MELDING_HEIGHT_MAP_DATA = 0x20700,
ZONE_PATH = 0x20800,
ZONE_WORLD_CHUNK_IMPORT = 0x20900,
ZONE_135168 = 0x21000, // Bounds but for what, hey are bottom left and top right of zone though not all the way to the edge.
ZONE_PROP_ENCOUNTER_NAME_REGISTRY = 0x21200,
ZONE_PROP = 0x21400,
ZONE_CAMERA_SEQUENCE = 0x21500,
ZONE_TRANSFER_BOUNDS = 0x21600,
ZONE_SUBZONE_REGION = 0x21700,
// GTChunk Index
CHUNK = 0x40000,
CHUNK_LOD = 0x40001,
CHUNK_SUBCHUNK = 0x40002,
// GTChunk Payload
CHUNK_TERRAIN = 0x40100, // parent, children are "terrain chunk layer"
TERRAIN_T0 = 0, // meta, init?
TERRAIN_MATERIALS = 1, // parent, children are "terrain chunk material layer"
TERRAIN_MATERIAL = 5,
TERRAIN_QUADTREE = 2, // has data and children, children are "terrain chunk quadtree layer"
TERRAIN_QUADTREE_BLENDWEIGHT = 8, // children are "terrain blend weight layer"
TERRAIN_QUADTREE_BLENDWEIGHT_0 = 0,
TERRAIN_QUADTREE_BLENDWEIGHT_2 = 2,
TERRAIN_QUADTREE_T9 = 9,
TERRAIN_QUADTREE_T11 = 11,
TERRAIN_QUADTREE_QQ1 = 0x55555555,
TERRAIN_QUADTREE_QQ2 = 0x575FFFF8,
TERRAIN_QUADTREE_QQ3 = 0xA0A0A0A0,
TERRAIN_QUADTREE_QQ4 = 0xAA2A2A0A,
TERRAIN_QUADTREE_QQ5 = 0xEFFFDFD7,
TERRAIN_QUADTREE_QQ6 = 0xF77F7F97,
TERRAIN_T3 = 3, // list of terrain materials to load
TERRAIN_T4 = 4, // shape data?
CHUNK_COLLISION1 = 0x40101, // main collision data
CHUNK_SUBZONEGRID = 0x40102,
CHUNK_COLLISION3 = 0x40103, // blocking volumes?
CHUNK_PROP_ENCOUNTER_NAME_REGISTRY2 = 0x40104,
CHUNK_COLLISION2 = 0x40105, // water volumes?
CHUNK_PROP = 0x40200,
CHUNK_GEOMETRY2 = 0x40203,
CHUNK_PROP_ENCOUNTER_NAME_REGISTRY = 0x40204,
CHUNK_VEGETATION = 0x40205,
CHUNK_OVERLAY = 0x40206,
CHUNK_SECTORS = 0x40207,
CHUNK_WATER = 0x40208,
CHUNK_VEGETATION2 = 0x40209,
CHUNK_GEOMETRY = 0x40210,
PROP_DOODAD = 0x50000,
PROP_ENVIRONMENT = 0x50001,
ENVIRONMENT_0031 = 0x0001F,
ENVIRONMENT_0032 = 0x00020,
ENVIRONMENT_0033 = 0x00021,
ENVIRONMENT_0034 = 0x00022,
ENVIRONMENT_0202 = 0x000CA,
ENVIRONMENT_0203 = 0x000CB,
ENVIRONMENT_0302 = 0x0012E,
ENVIRONMENT_0303 = 0x0012F,
ENVIRONMENT_0304 = 0x00130,
ENVIRONMENT_0400 = 0x00190,
ENVIRONMENT_0401 = 0x00191,
ENVIRONMENT_0501 = 0x001F5,
ENVIRONMENT_0600 = 0x00258,
ENVIRONMENT_0601 = 0x00259,
ENVIRONMENT_0700 = 0x002BC,
ENVIRONMENT_0800 = 0x00320,
ENVIRONMENT_0900 = 0x00384,
ENVIRONMENT_1000 = 0x003E8,
ENVIRONMENT_1100 = 0x0044C,
ENVIRONMENT_1200 = 0x004B0,
ENVIRONMENT_1300 = 0x00514,
ENVIRONMENT_1400 = 0x00578,
PROP_PROBEDATA = 0x50006,
PROP_DECALINSTANCES1 = 0x50008,
PROP_PARTICLEDATA = 0x5000D,
PROP_LIGHTDATA = 0x50011,
PROP_SECTOR = 0x50013, // Child of CHUNK_SECTORS
PROP_AUDIOVOLUME = 0x50014,
PROP_MONSTER = 0x50017,
PROP_DECALINSTANCES2 = 0x50018,
} LayerType;
struct DataUnkBytes(int dataSize) {
byte data[dataSize]<name="Bytes">;
};
// CHUNK
struct ChunkRootLayerData {
uint version;
uint64 timestamp;
uint numLods;
};
// CHUNK_LOD
struct ChunkLodLayerData {
uint lodIdx;
uint numSubChunks <read=ReadNumSubChunks, comment="">;
uint dataOffset<comment="Bytes after root node until we find this data">;
uint compressedSize<comment="Size of the data including type and compression headers">;
uint uncompressedSize<comment="Size of the decompressed payload">;
};
string ReadNumSubChunks(uint numSubChunks)
{
local uint numSubChunksCount = 1 << 2 * numSubChunks;
local string count;
SPrintf(count, "%i", numSubChunksCount);
return count;
}
// CHUNK_SUBCHUNK
struct ChunkSubChunkLayerData {
uint dataOffset<comment="Bytes after root node until we find this data">;
uint compressedSize<comment="Size of the data including type and compression headers">;
uint uncompressedSize<comment="Size of the decompressed payload">;
Vec3f boundsMin<read=Vec3fDisplay, comment="">;
Vec3f boundsMax<read=Vec3fDisplay, comment="">;
};
// CHUNK_WATER
// ZONE_WATER
struct unk_WaterFlagData {
float a;
uint b;
};
struct WaterLayerData {
Vec3f position <comment="Origin">;
uint unk2 <comment="0, 2 observed. doesn't seem to be a count.">;
uint always_1 <comment="No other values than 1 observed.">;
uint flags <comment="Usage of first 3 bits observed, affects the amount of unk_flagdata present.">;
if (flags & 0x01)
{
unk_WaterFlagData fd_1;
}
if (flags & 0x02)
{
unk_WaterFlagData fd_2[2];
}
if (flags & 0x04)
{
// 0.25, 0.5, 0.75, 1
unk_WaterFlagData fd_3[4];
}
Vec3f textureScale <comment="Texture scaling related">;
uint waterdesc_sdb_id;
uint always_zero <comment="No other values than 0 observed.">;
uint data1_count;
Vec3f data1[data1_count] <read=Vec3fDisplay>;
uint data2_count;
Vec2f data2[data2_count] <read=Vec2fDisplay>;
uint data3_count;
uint data3[data3_count];
uint data4_count;
uint data4[data4_count];
uint data5_count;
uint data5[data5_count] <comment="Some indexing or mapping data">;
byte moreData <comment="Seems to be a bool">;
if (moreData > 0x00) {
int count6 <comment="Some x?">;
uint count7 <comment="Some y?">;
float f2[5];
uint data6[count6*count7] <comment="X*Y data">;
}
Vec4f last1 <comment="Not sure">;
Vec4f last2 <comment="Not sure">;
};
// WATER_CHILD (Legacy)
struct WaterChildLayerData(uint64 endOffset) {
Vec3f position <comment="Origin">;
uint unk2 <comment="0, 2 observed. doesn't seem to be a count.">;
uint always_1 <comment="No other values than 1 observed.">;
uint flags <comment="Usage of first 3 bits observed, affects the amount of unk_flagdata present.">;
if (flags & 0x01)
{
unk_WaterFlagData fd_1;
}
if (flags & 0x02)
{
unk_WaterFlagData fd_2[2];
}
if (flags & 0x04)
{
// 0.25, 0.5, 0.75, 1
unk_WaterFlagData fd_3[4];
}
Vec3f textureScale <comment="Texture scaling related">;
uint data1_count;
Vec3f data1[data1_count] <read=Vec3fDisplay>;
uint data2_count;
Vec2f data2[data2_count] <read=Vec2fDisplay>;
uint data3_count;
uint data3[data3_count];
uint data4_count;
uint data4[data4_count];
uint data5_count;
uint data5[data5_count] <comment="Some indexing or mapping data">;
uint waterdesc_sdb_id;
byte moreData <comment="Seems to be a bool">;
if (moreData > 0x00) {
int count6 <comment="Some x?">;
uint count7 <comment="Some y?">;
float f2[5];
uint data6[count6*count7] <comment="X*Y data">;
}
if (FTell() < endOffset) {
// Not present in 1710
uint always_zero <comment="No other values than 0 observed.">;
}
};
// CHUNK_INFO_RANGE
struct ChunkZoneRangeLayerData {
uint32 cubeface;
uint32 min_chunk_x;
uint32 max_chunk_x;
uint32 min_chunk_y;
uint32 max_chunk_y;
};
// CHUNK_INFO_REF
struct ChunkRefLayerData {
uint32 chunk_x;
uint32 chunk_y;
uint32 chunk_record_id;
};
// CHUNK_INFO_REF2
struct ChunkRef2LayerData {
uint32 chunk_x;
uint32 chunk_y;
};
// MELDING_PERIMITER
struct MeldingPerimiterSetLayerData {
uint32 nameLen<hidden=true>;
char name[nameLen];
uint32 controlPoints;
uint32 bitfieldBitLength;
byte bitfield[Ceil(bitfieldBitLength/8.0)];
uint32 unk1;
uint32 perimiterCount<hidden=true>;
LengthDefinedString perimiters[perimiterCount] <optimize=false>;
byte unk2;
if (unk2 != 0) {
//DataUnkBytes data(8)<name="UnknownData3">;
}
};
// ZONE_MELDING_HEIGHT_MAP_DATA
struct ZoneMeldingHeightMapData(uint64 layerDataEndPos) {
int32 size_x_1;
int32 size_x_2;
int32 size_y_1;
int32 size_y_2;
float unk5;
float unk6;
float unk7;
// map, offset, scale?
// Failure check here
local uint32 mSizeX = ((size_x_2 - size_x_1) + 1); // >= 2
local uint32 mSizeY = ((size_y_2 - size_y_1) + 1); // >= 2
local uint32 size = mSizeY * mSizeX;
local uint32 doubled = size * 2;
local uint32 quadrupled = size * 4;
local uint64 remaining = layerDataEndPos - FTell();
if (remaining == doubled) {
byte data[doubled];
} else {
byte data[quadrupled];
}
};
// ZONE_135168
// Bounds but what for?
struct Zone_135168_LayerData {
Vec3f min;
Vec3f max;
};
// ZONE_SKYBOX
struct SkyBoxRecordLayerData {
uint skybox_record_id;
};
// ZONE_PATH
struct PathStep {
Vec3f position;
Vec4f orientation;
uint actionLen<hidden=true>;
if (actionLen > 0) {
char action[actionLen];
}
};
struct PathLayerData {
uint cce_id;
uint unk1;
uint stepsCount<hidden=true>;
PathStep steps[stepsCount] <optimize=false>;
};
// ZONE_PROP_ENCOUNTER_NAME_REGISTRY
// Does it also go for Chunk?
struct PropEncounterNameRegistryLayerData {
uint32 propCount<hidden=true>;
LengthDefinedString propNames[propCount] <optimize=false>;
};
// ZONE_CAMERA_SEQUENCE
struct CameraSequenceLayerData {
// WIP
uint cce_id;
byte unk1;
uint nameLen<hidden=true>;
char name[nameLen];
Vec3f vec1;
Vec3f vec2;
Vec3f vec3;
Vec3f vec4;
ushort cameraNodesCount;
ushort cameraShotsCount;
ushort cameraShakesCount;
ushort cameraFadesCount;
ushort colorGradingsCount;
ushort npcsCount;
ushort dialogScriptsCount;
ushort soundEventsCount;
ushort pfxsCount;
ushort lightsCount;
struct CameraNode {
uint nameLen<hidden=true>;
if (nameLen > 0)
char name[nameLen];
Vec3f vec1;
Vec3f vec2;
Vec3f vec3;
Vec3f vec4;
uint unk1;
if (unk1 == 5) {
uint targetBone1Len<hidden=true>;
char targetBone1[targetBone1Len]; // guess
DataUnkBytes data(18)<name="UnknownDataCameraNode_1">;
uint targetBone2Len<hidden=true>;
char targetBone2[targetBone2Len]; // guess
DataUnkBytes data(30)<name="UnknownDataCameraNode_2">;
}
else {
DataUnkBytes data(56)<name="UnknownDataCameraNode">;
}
};
if (cameraNodesCount > 0)
CameraNode cameraNodes[cameraNodesCount] <optimize=false>;
struct CameraShot {
uint nameLen<hidden=true>;
char name[nameLen];
DataUnkBytes data(33)<name="UnknownDataCameraShot">;
};
if (cameraShotsCount > 0)
CameraShot cameraShots[cameraShotsCount] <optimize=false>;
struct CameraShake {
uint nameLen<hidden=true>;
char name[nameLen];
DataUnkBytes data(46)<name="UnknownDataCameraShake">;
};
if (cameraShakesCount > 0)
CameraShake cameraShakes[cameraShakesCount] <optimize=false>;
struct CameraFade {
uint nameLen<hidden=true>;
char name[nameLen];
DataUnkBytes data(34)<name="UnknownDataCameraFade">;
};
if (cameraFadesCount > 0)
CameraFade cameraFades[cameraFadesCount] <optimize=false>;
// TODO: ColorGrading
// WIP: NPC
/*
struct NPC {
uint nameLen<hidden=true>;
char name[nameLen];
uint unk1;
// not that sure about these vecs, mostly just stepping forward
Vec3f vec1;
Vec3f vec2;
Vec3f vec3;
Vec3f vec4;
ushort unk2_MeshComponentRefCount;
struct unk_MeshComponentRef {
uint str1Len<hidden=true>;
char str1[str1Len];
DataUnkBytes data(4)<name="UnknownDataMeshComponentRef">;
};
unk_MeshComponentRef unk_MeshComponentRefs[unk2_MeshComponentRefCount] <optimize=false>;
ushort unk3_MaybeContentFlags; // actions or something?
if (unk3_MaybeContentFlags > 0) {
if (unk3_MaybeContentFlags == 2) {
uint unk4;
ushort unk5;
ushort unk6;
ushort unk7;
ushort unk7_2;
float unk8;
ushort unk9;
uint str10Len;
char str10[str10Len];
}
else if (unk3_MaybeContentFlags == 4) {
uint unk4;
ushort unk5;
ushort unk6;
ushort unk7;
float unk8;
ushort unk9;
uint str10Len;
char str10[str10Len];
}
}
};
if (npcsCount > 0) {
NPC npcs[npcsCount] <optimize=false>;
}
*/
// TODO: DialogEvents
// TODO: SoundEvents
// TODO: PFXs
// TODO: Lights
};
// ZONE_TRANSFER_BOUNDS
struct ZoneTransferBoundsLayerData {
// WIP
uint32 zoneID;
uint32 unk1;
// ...
};
// COLLISION
//============================
struct GeoVertData {
uint vertCount;
Vec3f verts[vertCount] <read=Vec3fDisplay>;
};
struct indiceType1 {
ushort a;
ushort b;
ushort c;
};
struct indiceType2 {
byte a;
byte b;
byte c;
};
struct indiceBlock {
uint count;
uint indiceType;
if (indiceType == 393218) {
indiceType1 indices[count];
}
else if (indiceType == 196609) {
indiceType2 indices[count];
}
};
struct matsDataBlock {
uint count;
uint id; // Might be type as well?
byte data[count];
};
struct moppDataBlock {
float floats[4];
uint size;
byte data[size];
byte unk1;
ushort unk2;
uint numShorts;
ushort shorts[numShorts];
};
// CHUNK_COLLISION
struct CollisionGeometryLayerData(uint nodeSize) {
local uint startPos = FTell();
uint magic;
ushort version; // ? should be 3
ushort revision; // ? checked if less than 5
uint id; // seems like a unique id
uint numPhysicsMatIds;
uint physicsMatIds[numPhysicsMatIds];
if (revision == 2) {
struct GeoBlockStorage {
uint numVertBlocks;
if (numVertBlocks > 0)
GeoVertData vertBlocks[numVertBlocks] <optimize=false>;
uint numIndiceBlocks;
if (numIndiceBlocks > 0)
indiceBlock indiceBlocks[numIndiceBlocks] <optimize=false>;
uint numMatItems;
if (numMatItems > 0)
matsDataBlock matBlocks[numMatItems] <optimize=false>;
uint numMoppBlocks;
if (numMoppBlocks > 0)
moppDataBlock moppBlocks[numMoppBlocks] <optimize=false>;
} store <read=GeoStoreDisplay>;
}
local uint endPos = FTell();
local uint remaining = nodeSize - (endPos - startPos);
byte embeddedHavokBinaryTagfile[remaining]<comment="Use AssetCc2 to convert this to .xml">;
};
string GeoStoreDisplay(GeoBlockStorage &store)
{
string s;
SPrintf( s, "Vert: %i, Indice: %i, Mat: %i, Mopp: %i", store.numVertBlocks, store.numIndiceBlocks, store.numMatItems, store.numMoppBlocks);
return s;
}
//============================
// CHUNK_SUBZONEGRID
struct SubZoneGridData {
uint unk1; // maybe some sort of flags
uint unk2_gridsize; // 64
uint subzone_ids_count;
uint subzone_ids[subzone_ids_count];
uint unk4_gridcount;
byte grid_data[(unk2_gridsize*unk2_gridsize) * unk4_gridcount];
};
// CHUNK_VEGETATION2
struct VegationChunk2Data {
Vec3f a;
uint unk1;
uint unk2;
struct unkVegData1 {
uint i;
float f;
};
unkVegData1 unk3[unk1];
Vec3f b[unk1];
};
// CHUNK_GEOMETRY
// CHUNK_GEOMETRY2
struct GeometryTreeBlock(uint32 type) {
ushort count_entries; // Tied to chunk sections, eg high lod sub chunks have fewer entries per instance
ushort const1; // "3"
uint const2; // "8"
uint const3; // "64"
struct GeometryTreeEntry(uint32 type) {
uint idx; // chunk node index
uint count1; // cpu nodes?
if (count1 > 0) {
struct count1Data(uint32 type) {
Vec3f min<read=Vec3fDisplay>;
Vec3f max<read=Vec3fDisplay>;
if (type == CHUNK_GEOMETRY) {
uint64 unkLong<format=hex>; // ?
}
uint count_inner;
if (count_inner > 0) {
struct innerData(uint32 type) {
uint materialId : 24; // 3 lowest bytes, .tmlt
uint errorIfZero: 8; // 4th byte must not be zero
uint textureId1; // optional .r5tex
uint textureId2; // optional .r5tex
uint textureId3; // optional .r5tex
if (type == CHUNK_GEOMETRY2) {
Vec3f center<read=Vec3fDisplay>; // ?
float extrafloat; // ?
}
Vec3f min<read=Vec3fDisplay>;
Vec3f max<read=Vec3fDisplay>;
ushort unk1_1;
ushort unk1_2; // node/leaf count of some form
uint unk2; // ? might ref count 2 data
uint transformCount;
Matrix4x4 transform[transformCount]<optimize=false>;
uint lz77_data1_num;
uint lz77_data1_compressedSize;
byte lz77_data1_uniqueIdx[lz77_data1_compressedSize]<comment="compressed">; // vgeo page/vert ref
uint lz77_data2_num;
uint lz77_data2_compressedSize;
byte lz77_data2_xformIdx[lz77_data2_compressedSize]<comment="compressed">; // specifies which transform to use for a vertice
if (unk1_2 == 8) {
uint lz77_data6_num;
uint lz77_data6_compressedSize;
byte lz77_data6[lz77_data6_compressedSize]<comment="compressed">; // maybe xformN
}
uint num; // 3*tris
short lz77_data3_offset;
uint lz77_data3_num;
uint lz77_data3_compressedSize;
if (lz77_data3_num > 0)
byte lz77_data3_repeatIdx[lz77_data3_compressedSize]<comment="compressed">;
uint lz77_data4_num;
uint lz77_data4_compressedSize;
byte lz77_data4_vertIndex[lz77_data4_compressedSize]<comment="compressed">;
uint lz77_data5_repTblNum; // num/3
uint lz77_data5_compressedSize;
byte lz77_data5_triangles[lz77_data5_compressedSize]<comment="compressed">; // specifies how to form triangles from vertices
uint unk10; // ? might ref count 2 data
};
innerData inner_data(type)[count_inner]<optimize=false>;
}
};
count1Data c1data(type)[count1]<optimize=false>;
}
uint count2; // gpu nodes?
if (count2 > 0) {
struct count2Data(uint32 type) {
float endtenfloats[10];
if (type == CHUNK_GEOMETRY) {
uint64 unkLong<format=hex>; // ?
}
int unk1;
int unk2;
};
count2Data c2data(type)[count2]<optimize=false>;
}
};
GeometryTreeEntry entries(type)[count_entries]<optimize=false>;
};
// TERRAIN
//============================
// CHUNK_TERRAIN
struct TerrainChunk_type0 {
uint unk1;
uint unk2;
uint unk3;
Vec3f vec;
};
struct TerrainChunk_type3 {
uint count;
uint data[count];
};
struct TerrainChunk_type4(uint nodeSize) {
uint nodeCount;
struct T4Node {
uint nodeIndex; // node index within a level
uint nodeLevel; // node.mLevel <= cTerrainMaxChunkNodeLevel
uint unk3; // flags?
Vec3f matrix[3] <read=Vec3fDisplay>;
float unk7;
Vec3f boundsMin <read=Vec3fDisplay>;
Vec3f boundsMax <read=Vec3fDisplay>;
uint unk9; // Number of vertices?
if (unk9 > 0) {
byte unk10[16]; // ?
uint unk11; // (unk15 * 3)
ushort unk12;
uint unk14_count;
if (unk14_count != 0xffffffff) { // when node level is not 0?
ushort unk14[unk14_count];
}
uint unk15; // Number of patch triangles?
}
byte haveMoreData;
if (haveMoreData > 0) {
uint materials[6]; // refmap?
uint unk18_size; // client will attempt to allocate this number of bytes
}
};
T4Node nodes[nodeCount] <read=T4NodeDisplay, optimize=false>;
// this consumes all the bytes, but the divied up sections dont quite seem right when the count isn't 1
struct T4NodeData_1(uint unk9, uint unk11) {
byte sculpt_data[ 8 * (2 * unk9) ];
byte lighting_data[ 6 * (unk9) ];
byte data3[ (unk11 - 1) ];
byte data4[ (unk11 - 1) ];
};
struct T4NodeData_2(uint unk18_size) {
byte texturing_data[ unk18_size ];
};
local uint i;
for (i = 0; i < nodeCount; i++) {
if (nodes[i].unk9 > 0) {
T4NodeData_1 t4nd1(nodes[i].unk9, nodes[i].unk11) <optimize=false>;
}
if (exists(nodes[i].unk18_size)) {
T4NodeData_2 t4nd2(nodes[i].unk18_size) <optimize=false>;
}
}
};
string T4NodeDisplay(T4Node &node)
{
string s;
SPrintf( s, "Index: %i, Level: %i", node.nodeIndex, node.nodeLevel);
return s;
}
struct TerrainChunk_QuadTreeData(uint nodeSize) {
byte unk[8];
};
//============================
// PROP_DOODAD
struct DoodadLayerData {
uint32 prop_record_id;
Vec4f transform[4];
uint32 unk3;
uint32 unk4;
int32 unk5;
int32 unk6;
int32 unk7;
int32 unk8;
float unk9[5];
};
// PROP_LIGHTDATA
struct PropNodeEntry_LightData {
byte header[64];
uint unk1;
float unk2[6];
uint unk4;
};
// PROP_AUDIOVOLUME
struct PropNodeEntry_AudioVolume {
Vec4f floats1<read=Vec4fDisplay>;
Vec4f floats2<read=Vec4fDisplay>;
Vec4f floats3<read=Vec4fDisplay>;
uint unk1;
Vec4f floats4<read=Vec4fDisplay>;
byte last[9];
};
// PROP_DECALINSTANCES2
struct PropNodeEntry_DecalInstances2 {
uint decal_id;
Matrix3x4 transform;
byte last[3];
};
// PROP_PARTICLEDATA
struct PropNodeEntry_ParticleData {
uint unk1;
Vec4f a<read=Vec4fDisplay>;
Vec4f b<read=Vec4fDisplay>;
Vec4f c<read=Vec4fDisplay>;
Vec4f b<read=Vec4fDisplay>;
uint unk2;
byte last[20];
};
// ENVIRONMENT
//============================
struct CommonEnvStruct1 { // FUN_0170b5f0
uint haveData;
if (haveData == 1) {
uint count;
// some init condition here
float unk3[2*count]; // do while here
};
};
struct CommonEnvStruct2(char param3, byte param4) { // FUN_017009e0
struct TypeZero {
float unk3;
ubyte argb[4]; // Guessing this is color as ARGB looks to fit
};
struct TypeOther {
float unk3;
byte unk5[3];
float unk6;
};
uint haveData;
if (haveData == 1) { // some additional check here
uint count;
if (param4 == 0) {
TypeZero data[count];
} else {
TypeOther data[count];
}
};
};
struct CommonEnvShared3 {
CommonEnvStruct1 unk1;
CommonEnvStruct2 unk2('\0',0);
CommonEnvStruct1 unk3;
CommonEnvStruct1 unk4;
CommonEnvStruct1 unk5;
};
// DEFAULT_ENVIRONMENT_10000
struct DefaultEnvironment_10000_LayerData(uint64 layerDataEndPos) {
Vec3f unk1;
if (FTell() < layerDataEndPos) {
Vec3f unk2;
}
};
// ENVIRONMENT_0031
struct Environment_0031_LayerData {
CommonEnvStruct2 unk1('\0',0);
CommonEnvShared3 unk4;
};
// ENVIRONMENT_0032
struct Environment_0032_LayerData {
CommonEnvStruct2 unk1('\0',0);
CommonEnvStruct1 unk2;
CommonEnvStruct1 unk3;
CommonEnvShared3 unk4;
};
// ENVIRONMENT_0033
struct Environment_0033_LayerData(uint64 layerDataEndPos) {
CommonEnvStruct2 unk1('\x01',0);
CommonEnvStruct1 unk2;
CommonEnvStruct1 unk3;
CommonEnvStruct1 unk4;
CommonEnvStruct2 unk5('\x01',0);
CommonEnvStruct1 unk6;
CommonEnvStruct1 unk7;
CommonEnvStruct1 unk8;
if (FTell() < layerDataEndPos) {
CommonEnvStruct1 unk9;
CommonEnvStruct1 unk10;
CommonEnvStruct1 unk11;
}
if (FTell() < layerDataEndPos) {
CommonEnvStruct1 unk12;
CommonEnvStruct1 unk13;
}
};
// ENVIRONMENT_0034
struct Environment_0034_LayerData {
CommonEnvStruct2 unk1('\x01',1);
CommonEnvStruct1 unk2;
CommonEnvStruct2 unk3('\x01',1);
CommonEnvStruct1 unk4;
CommonEnvStruct2 unk5('\x01',1);
CommonEnvStruct1 unk6;
CommonEnvStruct1 unk7;
CommonEnvStruct1 unk8;
CommonEnvStruct1 unk9;
CommonEnvStruct2 unk10('\x01',0);
CommonEnvStruct1 unk11;
CommonEnvStruct1 unk12;
CommonEnvStruct1 unk13;
CommonEnvStruct1 unk14;
CommonEnvStruct1 unk15;
CommonEnvStruct1 unk16;
CommonEnvStruct1 unk17;
};
// ENVIRONMENT_0202
struct Environment_0202_LayerData {
CommonEnvStruct2 unk1('\0',0);
CommonEnvStruct2 unk2('\0',0);
};
// ENVIRONMENT_0203
struct Environment_0203_LayerData {
CommonEnvStruct2 unk1('\x01',0);
CommonEnvStruct2 unk2('\x01',0);
CommonEnvStruct1 unk3;
};
// ENVIRONMENT_0302
struct Environment_0302_LayerData {
CommonEnvStruct1 unk1;
CommonEnvStruct2 unk2('\0',0);
CommonEnvStruct2 unk2('\0',0);
};