-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathNOZ.bt
278 lines (245 loc) · 6.36 KB
/
NOZ.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
//------------------------------------------------
//--- 010 Editor v7.0 Binary Template
//
// File: QOB(rsp).bt
// Authors: Alexander Evdokimov
// Version: 0.7
// Purpose: Freedom First Resistance NOZ file
// File Mask: *.qob
//
// History:
//
// 2018.15 0.7 initial release
//------------------------------------------------
string readCString()
{
local uint Length;
local string Name;
Length = ReadInt(FTell());
FSkip(4);
Name = ReadString(FTell());
FSkip(-4);
return Name;
};
typedef struct {
FLOAT Red;
FLOAT Green;
FLOAT Blue;
FLOAT Alpha;
} COLOR;
typedef enum <ubyte> {
no = 0,
yes = 1
} BOOL; // bool data type
typedef struct {
UINT Length;
char Text[Length];
} CSTRING;
typedef struct {
UINT SectionSize;
UINT ID;
if (readCString() == "Version")
{
struct {
CSTRING Name <name="Version">;
UINT Value;
} VERSION;
}
CSTRING Name <name="Name">;
} SECTION_HEADER <name="Header">;
typedef enum <uint> {
Opaque = 0,
unknown = 1,
LookupCXP = 3
} ALPHA_METHOD;
typedef struct {
UINT16 x;
UINT16 y;
UINT16 z;
} VECTOR_SHORT;
typedef struct {
FLOAT x;
FLOAT y;
FLOAT z;
} VECTOR3;
typedef struct {
FLOAT x;
FLOAT y;
FLOAT z;
FLOAT w;
} VECTOR4;
typedef struct {
FLOAT x;
FLOAT y;
} POINT2;
// BeginModel token
CSTRING BeginModel <name="BeginModel token">;
//--------------------
// MaterialList
// --------------------
typedef struct {
SECTION_HEADER Header;
struct {
FLOAT Opacity;
ALPHA_METHOD alpha; // 0 - Opaque, 1 - unknown, 3 - Lookup CXP or opaque
COLOR Ambient;
COLOR Diffuse;
COLOR Specular;
FLOAT SpecularLevel; //o.o5
BOOL twoSided;
} MATERIAL_PROPERTIES;
} MATERIAL <name=MaterialName>;
typedef struct {
SECTION_HEADER Header;
CSTRING Name <name="Texture .rsb file name">;
struct {
UINT TransparencyType; // 0 2 3
UINT IsTiled; // 1 - u-tile, 2 - v-tile, 3 - both none
FLOAT SelfIllumination; // 0
} PARAMETERS;
} TEXTURE <name=TextureName>;
string MaterialName(MATERIAL &material) {
return "Name: " + material.Header.Name.Text;
}
string TextureName(TEXTURE &texture) {
return "FileName: " + texture.Name.Text;
}
struct {
SECTION_HEADER Header;
UINT Count <name="Number of materials">;
if (Count > 0)
{
typedef struct (int arraySize) {
MATERIAL array[arraySize] <optimize=false>;
} MATERIALS;
MATERIALS Materials(Count) <name="Materials">;
UINT Count <name="Number of textures">;
if (Count > 0)
{
typedef struct (int arraySize) {
TEXTURE array[arraySize] <optimize=false>;
} TEXTURES;
TEXTURES TextureArray(Count) <name="Textures">;
};
};
} MATERIAL_LIST <name="Material List">;
//--------------------
// GeometryList
// --------------------
struct {
SECTION_HEADER Header;
UINT Count <name="Number of models">;
typedef struct {
SECTION_HEADER Header;
struct {
UINT Count <name="Number of vertexes">;
typedef struct (int arraySize) {
VECTOR3 array[arraySize];
} VERTEXES;
VERTEXES Vertexes(Count) <name="Vertexes">;
} VERTEXES_SECTION <name="Vertex section">;
UINT Count <name="Number of meshes">;
typedef struct {
struct {
INT MaterialIndex;
if (Header.VERSION.Value > 2)
{
UINT isTextured;
if (isTextured > 0)
UINT TextureIndex;
struct {
INT Unknown;
if (Header.VERSION.Value > 4)
{
INT SelfIlluminationMap;
INT SpecularMap;
INT BumpMap;
INT ReflectionMap;
INT MapCount;
};
} MAPPING;
};
} TEXTURE_PARAMETERS;
struct {
UINT Count <name="Number of faces">;
typedef struct (int arraySize) {
VECTOR4 array[arraySize];
} NORMALS1;
NORMALS1 Normals(Count) <name="Normals??">;
typedef struct (int arraySize) {
VECTOR_SHORT array[arraySize];
} FACE_INDEXES;
FACE_INDEXES FaceIndexes(Count) <name="Face Indexes">;
typedef struct (int arraySize) {
VECTOR_SHORT array[arraySize];
} TEXTURE_INDEXES;
TEXTURE_INDEXES TextureIndexes(Count) <name="UV Indexes">;
UINT VertexCount;
if (Header.VERSION.Value > 2)
UINT TextureCount;
typedef struct (int arraySize) {
VECTOR3 array[arraySize];
} NORMALS2;
NORMALS2 Normals(VertexCount) <name="Normals">;
typedef struct (int arraySize) {
POINT2 array[arraySize];
} UVs;
if (Header.VERSION.Value > 2)
UVs TextureCoordinates(VertexCount*TextureCount) <name="Texture coordinates">;
else
UVs TextureCoordinates(VertexCount) <name="Texture coordinates">;
typedef struct (int arraySize) {
COLOR array[arraySize] <optimize=false>;
} FACE_COLOR;
FACE_COLOR FaceColor(VertexCount) <name="Faces colors">;
} FACE_PARAMETERS;
} MESH <name="Mesh">;
typedef struct (int arraySize) {
MESH array[arraySize] <optimize=false>;
} MESHES;
MESHES Meshes(Count) <name="Meshes">;
} OBJECT;
typedef struct (int arraySize) {
OBJECT array[arraySize] <optimize=false>;
} OBJECTS;
OBJECTS Objects(Count) <name="Meshes">;
if (ReadInt() == 0)
UINT Unknown;
} GEOMETRY_LIST <name="Geometry List">;
// EndModel token
CSTRING EndModel <name="EndModel token">;
//--------------------
// SKELETON
// --------------------
typedef struct {
struct {
UINT ID; // 37
struct {
CSTRING Name <name="Version">;
UINT value; // 1
} VERSION_STRING;
CSTRING Name <name="Bone name">;
} BONE_HEADER;
VECTOR3 Position;
VECTOR4 Rotation;
UINT Count;
UINT Data[Count];
UINT Count;
if (Count > 0)
struct {
Bone(Count);
} CHILDREN;
} SKELETON_BONE <name=getBoneName>;
// BoneName function
string getBoneName(SKELETON_BONE &bone) {
return "Name: " + bone.BONE_HEADER.Name.Text;
}
void Bone(uint count)
{
local uint i;
for (i = 0; i < count; ++i)
SKELETON_BONE bone;
};
struct {
Bone(1);
} SKELETON <name="Skeleton">;