-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDiabloIIResurrected_Model.bt
More file actions
50 lines (47 loc) · 1.93 KB
/
DiabloIIResurrected_Model.bt
File metadata and controls
50 lines (47 loc) · 1.93 KB
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
//--------------------------------------------------------------------------------------------------------------------------//
// Diablo 2 Resurrected Model
// It's basicly rad granny format, with extra data added by blizz
// Template might work on other gr2 files, like Teso/Metin
// Compression seems to always be bitknit2
// 1. Read the data as seen in this template
// 2. Decompress the compressed sections and pointer fixup data
// 3. Transfer pointers based on the descriptions at pointerFixupArrayOffset
// 4. There's also some data that needs to be shifted around, I skip this step,
// based on data at mixedMarshallingFixupArrayOffset
// 5. I merge all the sections into one file that can be parsed,
// the reason why I do it is because there are pointers in one section that refer to another during the pointer fixup stage
//--------------------------------------------------------------------------------------------------------------------------//
#include "Lib/Common.bt"
#include "DiabloIIResurrected/Model/GrannyMagic.bt"
#include "DiabloIIResurrected/Model/Header.bt"
#include "DiabloIIResurrected/Model/Section.bt"
#include "DiabloIIResurrected/Model/FixupData.bt"
GrnMagic gran;
Header header;
FSeek(HeaderStartPos + header.sectionArrayOffset);
Section sections[header.sectionArrayCount];
local int i;
for (i = 0; i < header.sectionArrayCount; i++)
{
if (sections[i].dataSize > 0)
{
FSeek(sections[i].dataOffset);
DATA compressedData(sections[i].dataSize, i)<name = GetSectionName>;
}
}
for (i = 0; i < header.sectionArrayCount; i++)
{
if (sections[i].dataSize > 0)
{
if (sections[i].pointerFixupArrayCount > 0)
{
FSeek(sections[i].pointerFixupArrayOffset);
FixupDATA fixupData;
}
if (sections[i].mixedMarshallingFixupArrayCount > 0)
{
FSeek(sections[i].mixedMarshallingFixupArrayOffset);
FixupDATA marshalData;
}
}
}