-
Notifications
You must be signed in to change notification settings - Fork 2
/
Earth2150_MSH.bt
232 lines (210 loc) · 4.1 KB
/
Earth2150_MSH.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
//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
// File: Earth2150_MSH.bt
// Author: arkezar
// Version: 0.2
// Purpose: Template for Earth 2150 msh files
// Category: Game
// File Mask: *.msh
// ID Bytes: 4D 45 53 48 01 00 00 00 //MESH1
// History:
// 0.1 2021-06-16 arkezar: Initial version
// 0.2 2021-11-03 arkezar: Add model descriptors section
// 0.3 2022-04-18 arkezar: Complete vertex list deserialization
//------------------------------------------------
typedef struct {
float X;
FSkip(12);
float Y;
FSkip(12);
float Z;
FSkip(12);
float NormalX;
FSkip(12);
float NormalY;
FSkip(12);
float NormalZ;
FSkip(12);
float U;
FSkip(12);
float V;
} Vertex;
typedef struct {
Vertex vertex;
FSkip(-(sizeof(vertex)-4));
Vertex vertex;
FSkip(-(sizeof(vertex)-4));
Vertex vertex;
FSkip(-(sizeof(vertex)-4));
Vertex vertex;
byte EMPTY[16];
short NormalIdx[4] <bgcolor=0xFFAA00>;
short PositionIdx[4] <bgcolor=0xAAAA00>;
} VertexBlock;
typedef struct {
int Length <bgcolor=0xFFAA00>;
int Blocks;
VertexBlock vertexBlocks[Blocks];
} VertexList;
typedef struct {
int Length;
char Filename[Length];
} Texture;
typedef struct {
short V1;
short V2;
short V3;
short UNKNOWN;
} Face;
typedef struct {
int Length;
Face faces[Length];
} FacesList;
typedef struct {
float X;
float Y;
float Z;
} Position;
typedef struct {
int length;
Position offset[length];
} TranslationFrames;
typedef struct {
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;
} RotationMatrix;
typedef struct {
int length;
RotationMatrix data[length];
} RotationFrames;
typedef struct {
float X;
float Y;
float Z;
} Offset;
typedef struct {
TranslationFrames unknown;
TranslationFrames movement;
RotationFrames rotation;
} Animation;
typedef struct {
VertexList vertexList;
byte newBranch;
byte type;
byte unknown1[2];
Texture texture;
FacesList faces;
Animation animation;
int AnimationType;
Offset offset;
byte RiseAngleRad;
byte unknownData[4];
} Part;
typedef struct {
float X;
float Y;
float Z;
float R;
float G;
float B;
float Length;
int Direction;
float Width;
float Unknown;
float Tilt;
float Ambience;
} Light;
typedef struct {
float X;
float Y;
float Z;
float R;
float G;
float B;
float Intensity;
} OmniLight;
typedef struct {
float X;
float Y;
float Z;
} MountPoint;
typedef struct {
short X;
short Y;
short Z;
byte Direction;
byte Flag;
} Slot;
typedef struct {
byte Pattern[2];
short Flag;
} TemplateRotation;
typedef struct {
short Row[4];
} TemplateFreeSpaceRotation;
typedef struct {
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;
} Slots;
typedef struct {
int MeshType;
TemplateRotation Template;
ubyte BuildingFrames;
ubyte ActionFrames;
ubyte MoveFrames;
ubyte LoopedFrames;
int EMPTY;
MountPoint mounts[4];
Light lights[4];
OmniLight omnis[4];
short UnitSectionHeights[16];
byte UnitSectionFlags[16];
TemplateRotation UnitTemplateRotations[4];
TemplateFreeSpaceRotation UnitTemplateFreeSpaceRotations[4];
Slots Slots1;
short MaxY;
short MinY;
short MaxX;
short MinX;
int ModelType;
} Descriptor;
typedef struct {
while(!FEof()) {
Part part;
}
} Geometry;
FSeek(FindFirst("MESH"));
char FileIdentifier[8];
Descriptor ModelDescriptor;
Geometry ModelGeometry;