This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
NVM.bt
122 lines (102 loc) · 2.97 KB
/
NVM.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
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File: NVM.bt
// Authors: TKGP
// Version: 1.0
// Purpose: DeS/DS1 navmesh
// Category: Dark Souls
// File Mask: *.nvm
// ID Bytes:
// History:
//------------------------------------------------
#include "Util.bt"
LittleEndian();
if (ReadInt() == 0x1000000)
BigEndian();
//------------------------------------------------
typedef struct {
int unk00; Assert(unk00 == 1);
int vertexCount;
int vertexOffset <format=hex>; Assert(vertexOffset == 0x80);
int triCount;
int triOffset <format=hex>;
int rootRecPrismOffset <format=hex>;
int unk18; Assert(unk18 == 0);
int entityCount;
int entityOffset <format=hex>;
local int i <hidden=true>;
for (i = 0; i < 23; i++) {
int zero <fgcolor=cLtRed, hidden=true>; Assert(zero == 0);
}
} Header <bgcolor=cLtRed>;
typedef struct {
int vertexIndex1;
int vertexIndex2;
int vertexIndex3;
int v1v2EdgeIndex;
int v2v3EdgeIndex;
int v1v3EdgeIndex;
int obstacleCountAndFlags;
// Obstacle count = (obstacleCountAndFlags >> 2) & 0x3FFF
// Flags = obstacleCountAndFlags >> 16
} Triangle <bgcolor=cLtGreen>;
struct RecPrism;
typedef struct {
Vector3 corner1;
int triCount;
Vector3 corner2;
int triOffset <format=hex>;
int prismOffset1 <format=hex>;
int prismOffset2 <format=hex>;
int prismOffset3 <format=hex>;
int prismOffset4 <format=hex>;
int unk30 <hidden=true>; Assert(unk30 == 0);
int unk34 <hidden=true>; Assert(unk34 == 0);
int unk38 <hidden=true>; Assert(unk38 == 0);
int unk3C <hidden=true>; Assert(unk3C == 0);
local quad pos <hidden=true> = FTell();
if (triCount > 0) {
FSeek(triOffset);
int triangleIndices[triCount];
}
if (prismOffset1 != 0) {
FSeek(prismOffset1);
RecPrism childPrism1;
}
if (prismOffset2 != 0) {
FSeek(prismOffset2);
RecPrism childPrism2;
}
if (prismOffset3 != 0) {
FSeek(prismOffset3);
RecPrism childPrism3;
}
if (prismOffset4 != 0) {
FSeek(prismOffset4);
RecPrism childPrism4;
}
FSeek(pos);
} RecPrism <bgcolor=cSilver>;
typedef struct {
int entityID;
int triangleIndexOffset <format=hex>;
int triangleIndexCount;
int unk0C <hidden=true>; Assert(unk0C == 0);
local quad pos <hidden=true> = FTell();
FSeek(triangleIndexOffset);
int triangleIndices[triangleIndexCount] <bgcolor=cLtPurple>;
FSeek(pos);
} Entity <bgcolor=cPurple, optimize=false>;
//------------------------------------------------
Header header;
FSeek(header.vertexOffset);
Vector3 vertices[header.vertexCount] <bgcolor=cLtBlue>;
FSeek(header.triOffset);
Triangle triangles[header.triCount];
FSeek(header.rootRecPrismOffset);
RecPrism rootPrism;
if (header.entityCount > 0) {
FSeek(header.entityOffset);
struct { Entity entities[header.entityCount]; } entities;
}