forked from Sparagas/Silent-Hill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SH2 (PS2) map.bt
276 lines (243 loc) · 6.57 KB
/
SH2 (PS2) map.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
//------------------------------------------------
//--- 010 Editor v13.0.2 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
local int IsLittleEndian = IsLittleEndian();
//------------------------------------------------
// simple structures (this is defining - not reading)
//------------------------------------------------
struct FileHead // sh2gfw_BLOCK_HEAD
{
char magic[4]; // block_id
uint32 ofs_global_block; // toGlobaldef
uint32 ofs_local_block; // toLocaldef
uint32 ofs_raw_block_data_parms; // toRawblockdataParms
uint32 ofs_local_tex_index[3]; // toLocalTex[3]
uint32 ofs_local_tex_pal[3]; // toLocalcluts[3]
uint32 num_local_tex; // texnum
ubyte num_global_tex; // globaltexnum
ubyte num_trans_tex; // transtexnum
ubyte unk_div_flg; // divflg
ubyte pad; // padc
};
struct RawBlockDataParms
{
float matrix_col[16];
struct Float4 bbox[4];
};
struct Float4 {
float x;
float y;
float z;
float w;
};
struct GlobalBlockHead // sh2gfw_BLOCKGLOBAL_HEAD
{
uint32 unk_gsregsamount; // gsregsamount
uint32 unk_transamount; // transamount
ubyte unk_gtexnum; // gtexnum
ubyte unk_gtransnum; // gtransnum
ubyte pad[6]; // pads / pad2
};
struct LocalBlockHead // sh2gfw_BLOCKLOCAL_HEAD
{
uint16 unk_gsregsamount[3]; // gsregsamount[3]
uint16 unk_transamount[3]; // transamount[3]
ubyte num_mesh; // ltexnum
ubyte pad[3]; // pads
};
struct LocalBlockBody
{
for (i=0; i<local_block_head.num_mesh; i++)
{
struct Mesh mesh;
if (mesh.mesh_head.ofs_next_mesh > 0)
FSeek(mesh.mesh_head.ofs_next_mesh);
};
};
struct Mesh
{
struct MeshHead mesh_head;
struct MeshBody mesh_body;
};
struct MeshHead // sh2gfw_GSREGS_HEAD
{
uint32 len_mesh; // clutslen
uint32 ofs_next_mesh; // toNextDATA
uint32 ofs_tex_data; // toTexHead
ubyte num_vert; // clutamount
ubyte num_trans; // transamount
ubyte unk_eop_flg; // eop_flg
ubyte unk_tr_flg; // tr_flg
ubyte unk_fmt[16]; // fmt[16]
ubyte unk_trans[16]; // ransparency[16]
};
struct MeshBody
{
local int i;
for (i=0; i<mesh_head.num_vert; i++)
{
struct Vert vert;
if (vert.vert_head.ofs_next_vert > 0)
FSeek(vert.vert_head.ofs_next_vert);
};
};
struct Vert
{
struct VertHead vert_head;
LittleEndian();
struct VertBody vert_body[vert_head.num_vert];
if (IsLittleEndian == 0)
BigEndian();
};
struct VertHead // sh2gfw_GIFTAG_HEAD
{
uint16 num_unk_gsregs; // gsregs_amount
ubyte unk_trans_flg; // trans_flg
ubyte unk_eop_flg; // eop_flg
uint32 ofs_next_vert; // toNextGIFHEAD
uint16 vert_index; // id
ubyte unk_tcc; // tcc
ubyte unk_tfx; // tfx
ubyte unk_abe; // abe
ubyte pad[3]; // pad1 / pad2 / pad3
//it ends here in debug
float unkF;
float unkF;
uint32 unk;
uint32 unk;
uint32 unk;
ubyte unk;
ubyte unk;
ubyte unk;
ubyte unk;
uint32 len_plus144;
uint32 unk;
uint16 num_vert;
uint16 unk;
uint32 len_plus112;
uint32 unk;
uint16 unk;
uint16 unk;
char pad_0[96];
};
struct VertBody
{
int16 vp_x;
int16 vp_y;
int16 vp_z;
int16 vn_vcol_x;
int16 vt_u;
int16 vt_v;
int16 vn_vcol_y;
int16 vn_vcol_z;
};
struct ImgIndexHead // sh2gfw_TEX_HEAD
{
uint32 tex_id; // texture_no
uint16 unk_x; // x
uint16 unk_y; // y
uint16 width; // w
uint16 height; // h
ubyte unk_color; // color
ubyte len_pad; // padbyte
uint16 unk_importance; // importance
uint32 body_len; // datalen
uint32 all_len; // alllen
ubyte unk_sendpsm; // sendpsm
ubyte unk_drawpsm; // drawpsm
ubyte unk_bitshift; // bitshift
ubyte unk_tagpoint; // tagpoint
ubyte unk_bitw; // bitw
ubyte unk_bith; // bith
uint16 unk_check; // check
char unk_giftag[16]; // ???? Q_WORDDATA giftag; ????
};
struct ImgPalHead // sh2gfw_CLUTS_HEAD
{
uint32 body_len; // clutslen
uint32 unk_GSREGS_ofs; // toGSREGS
uint32 unk_Raw_clut_ofs; // toRawClut
ubyte pal_num; // clutamount
ubyte unk_transcluts; // transcluts
ubyte unk_clw; // clw
ubyte unk_clh; // clh
ubyte unk_fmt[16]; // fmt[16]
ubyte unk_trans[16]; // transparency[16]
};
struct RGBA
{
uint32 red;
uint32 green;
uint32 blue;
uint32 alpha;
};
//------------------------------------------------
// complex structures (this is defining - not reading)
//------------------------------------------------
struct ImgIndex
{
struct ImgIndexHead img_index_head;
ubyte pad[img_index_head.len_pad];
ubyte img_index_body[img_index_head.body_len];
};
struct ImgPal
{
struct ImgPalHead img_pal_head;
struct PalPage pal_page[img_pal_head.pal_num];
};
struct PalPart
{
ubyte pal_0[64];
ubyte pal_1[64];
ubyte pal_2[64];
ubyte pal_3[64];
};
struct PalPage
{
struct PalPart pal_part[4];
};
//------------------------------------------------
// local variables (used for parsing, and are not part of file format)
//------------------------------------------------
local ubyte i;
//------------------------------------------------
// parsing sequance (the acutal reading of a file)
//------------------------------------------------
struct FileHead file_head;
FSeek(file_head.ofs_raw_block_data_parms);
struct RawBlockDataParms raw_block_data_parms;
if (file_head.ofs_global_block != 0)
{
FSeek(file_head.ofs_global_block);
struct GlobalBlockHead global_block_head;
struct Mesh global_mesh;
};
if (file_head.ofs_local_block != 0)
{
FSeek(file_head.ofs_local_block);
struct LocalBlockHead local_block_head;
struct LocalBlockBody local_block_body;
};
LittleEndian();
for (i=0; i<file_head.num_local_tex; i++)
{
if (file_head.ofs_local_tex_index[i] != 0)
{
FSeek(file_head.ofs_local_tex_index[i]);
struct ImgIndex img_index;
};
if (file_head.ofs_local_tex_pal[i] != 0)
{
FSeek(file_head.ofs_local_tex_pal[i]);
struct ImgPal img_pal;
};
};