-
Notifications
You must be signed in to change notification settings - Fork 2
/
msh.hexpat
232 lines (202 loc) · 3.13 KB
/
msh.hexpat
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
#pragma pattern_limit 0xF000
#include <std/mem.pat>
enum MeshType : u32 {
Static,
Dynamic
};
enum StaticMeshType : u32 {
Unknown,
Unit,
Building
};
enum DynamicMeshType : u32 {
Unknown
};
struct Template {
u8 pattern[2];
u16 flag;
};
struct FlagRotation {
u16 row[4];
};
struct Position {
float x;
float y;
float z;
};
struct SpotLight : Position {
float r;
float g;
float b;
float length;
u32 direction;
float width;
float unknown;
float tilt;
float ambience;
};
struct OmniLight : Position {
float r;
float g;
float b;
float intensity;
};
struct Slot {
u16 x;
u16 y;
u16 z;
u8 direction;
u8 flag;
};
struct Slots {
Slot slot_sc[4];
Slot slot_mi[4];
Slot slot_ss[4];
Slot slot_hl[4];
Slot slot_om[4];
Slot slot_tr[4];
Slot slot_ht[4];
Slot slot_sm[4];
Slot slot_unk[4];
Slot slot_ch[2];
Slot slot_st[2];
Slot slot_se[2];
Slot slot_sk[2];
Slot slot_in;
Slot slot_ce;
Slot slot_pr;
Slot slot_mv;
Slot slot_ln;
};
struct Boundries {
u16 maxY;
u16 minY;
u16 maxX;
u16 minX;
};
struct Descriptor {
MeshType type;
Template template;
u8 buildingFrames;
u8 actionFrames;
u8 moveFrames;
u8 loopedFrames;
u32 empty;
Position mountPoints[4];
SpotLight spotLights[4];
OmniLight omniLight[4];
u16 heights[16];
u8 flags[16];
Template templateRotations[4];
FlagRotation flagRotations[4];
Slots slots;
Boundries boundries;
if (type == MeshType::Static) {
StaticMeshType subtype;
}
else if (type == MeshType::Dynamic) {
DynamicMeshType subtype;
}
};
struct Vertex {
float x;
padding[12];
float y;
padding[12];
float z;
padding[12];
float normalX;
padding[12];
float normalY;
padding[12];
float normalZ;
padding[12];
float u;
padding[12];
float v;
};
struct VertexBlock {
Vertex vertex1;
$ -= sizeof(vertex1) - 4;
Vertex vertex2;
$ -= sizeof(vertex2) - 4;
Vertex vertex3;
$ -= sizeof(vertex3) - 4;
Vertex vertex4;
u8 empty[16];
u16 normalIdx[4];
u16 positionIdx[4];
};
struct Vertices {
u32 count;
u32 blocks;
VertexBlock vertexBlocks[blocks];
};
struct Texture {
u32 length;
char filename[length];
};
struct Face {
u16 v1;
u16 v2;
u16 v3;
u16 unknown;
};
struct Faces {
u32 length;
Face faces[length];
};
struct TranslationFrames {
u32 length;
Position offsets[length];
};
struct RotationMatrix {
float a11;
float a12;
float a13;
float a14;
float a21;
float a22;
float a23;
float a24;
float a31;
float a32;
float a33;
float a34;
float a41;
float a42;
float a43;
float a44;
};
struct RotationFrames {
u32 length;
RotationMatrix rotations[length];
};
struct Animations {
TranslationFrames unknown;
TranslationFrames movement;
RotationFrames rotation;
};
struct StaticGeometry {
Vertices vertices;
u8 backtrackLevel;
u8 type;
u8 unknown[2];
Texture texture;
Faces faces;
Animations animations;
u32 animationType;
Position offset;
u8 riseAngleRad;
u8 unknownBytes[4];
};
struct Mesh {
char identifier[8];
Descriptor descriptor;
if (descriptor.type == MeshType::Static) {
StaticGeometry geometries[while(!std::mem::eof())];
}
else if (descriptor.type == MeshType::Dynamic) {
}
};
Mesh data @ std::mem::find_sequence(0, 0x4D, 0x45, 0x53, 0x48);