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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
#ifndef _chnktype_hpp
#define _chnktype_hpp 1
#include "3dc.h"
#include "list_tem.hpp"
struct ChunkVectorInt;
struct ChunkVectorFloat;
struct ChunkVector
{
double x;
double y;
double z;
ChunkVector friend operator+(const ChunkVector&, const ChunkVector&);
ChunkVector friend operator-(const ChunkVector&, const ChunkVector&);
ChunkVector& operator+=(const ChunkVector&);
ChunkVector& operator-=(const ChunkVector&);
ChunkVector friend operator*(const ChunkVector&, const double);
ChunkVector friend operator/(const ChunkVector&, const double);
ChunkVector friend operator*(const ChunkVector&, const ChunkVector&); //cross prod
operator VECTORCH () const;
operator ChunkVectorInt () const;
operator ChunkVectorFloat () const;
friend double dot(const ChunkVector&, const ChunkVector&);//dot product
friend double mod(const ChunkVector&);//magnitude of vector
int norm(); //normalize
};
struct ChunkVectorInt
{
int x;
int y;
int z;
ChunkVectorInt friend operator+(const ChunkVectorInt&, const ChunkVectorInt&);
ChunkVectorInt friend operator-(const ChunkVectorInt&, const ChunkVectorInt&);
ChunkVectorInt& operator+=(const ChunkVectorInt&);
ChunkVectorInt& operator-=(const ChunkVectorInt&);
ChunkVectorInt friend operator*(const ChunkVectorInt&, const double);
ChunkVectorInt friend operator/(const ChunkVectorInt&, const double);
//ChunkVectorInt friend operator*(const ChunkVectorInt&, const ChunkVectorInt&); //cross prod
operator VECTORCH () const;
//friend double dot(const ChunkVector&, const ChunkVector&);//dot product
friend double mod(const ChunkVectorInt&);//magnitude of vector
int norm(); //normalize to 65536
};
struct ChunkVectorFloat
{
float x;
float y;
float z;
ChunkVectorFloat friend operator+(const ChunkVectorFloat&, const ChunkVectorFloat&);
ChunkVectorFloat friend operator-(const ChunkVectorFloat&, const ChunkVectorFloat&);
ChunkVectorFloat& operator+=(const ChunkVectorFloat&);
ChunkVectorFloat& operator-=(const ChunkVectorFloat&);
ChunkVectorFloat friend operator*(const ChunkVectorFloat&, const double);
ChunkVectorFloat friend operator/(const ChunkVectorFloat&, const double);
//ChunkVectorInt friend operator*(const ChunkVectorInt&, const ChunkVectorInt&); //cross prod
operator VECTORCH () const;
//friend double dot(const ChunkVector&, const ChunkVector&);//dot product
friend double mod(const ChunkVectorFloat&);//magnitude of vector
int norm(); //normalize to 1
};
struct ChunkUV
{
float u;
float v;
};
// in integers I suppose
struct ChunkMatrix
{
int mat11;
int mat12;
int mat13;
int mat21;
int mat22;
int mat23;
int mat31;
int mat32;
int mat33;
};
struct ChunkUV_List
{
int num_verts;
ChunkUV vert[4];
// for list iterator
friend BOOL operator== (const ChunkUV_List &, const ChunkUV_List &);
friend BOOL operator!= (const ChunkUV_List &, const ChunkUV_List &);
};
class ChunkPoly
{
public:
int engine_type;
int normal_index;
int flags;
unsigned int colour;
int num_verts;
int vert_ind[4];
//functions for gettings and setting texture and uv indeces in the colour
unsigned int GetUVIndex();
unsigned int GetTextureIndex();
void SetUVIndex(unsigned int uv_index);
void SetTextureIndex(unsigned int texture_index);
};
struct ChunkShape
{
ChunkShape();
~ChunkShape();
ChunkShape (const ChunkShape &);
ChunkShape& operator=(const ChunkShape &);
float radius; //radius of points about 0,0,0
ChunkVectorInt max;
ChunkVectorInt min;
ChunkVectorInt centre; //average of min and max
float radius_about_centre;
int num_verts;
ChunkVectorInt * v_list;
//int num_vert_normals; //I don't think num_vert_normals is ever used
ChunkVectorFloat * v_normal_list;
int num_polys;
ChunkPoly * poly_list;
ChunkVectorFloat * p_normal_list;
int num_uvs;
ChunkUV_List * uv_list;
int num_texfiles;
char ** texture_fns;
void rescale (double);
};
struct ChunkQuat
{
float x,y,z,w;
};
struct ObjectID
{
int id1;
int id2;
friend BOOL operator== (const ObjectID &, const ObjectID &);
friend BOOL operator!= (const ObjectID &, const ObjectID &);
friend ObjectID Minimum(const ObjectID &,const ObjectID &);
};
struct ChunkObject
{
ChunkVectorInt location;
ChunkQuat orientation;
BOOL is_base_object;
char o_name[50];
int index_num; //this won't get changed by update_my_chunkobject
ObjectID ID;
};
struct VMod_Arr_Item
{
VMod_Arr_Item();
~VMod_Arr_Item();
VMod_Arr_Item(const VMod_Arr_Item & vma);
VMod_Arr_Item & operator=(const VMod_Arr_Item & vma);
int branch_no;
int flags;
int spare;
int object_index;
friend BOOL operator==(const VMod_Arr_Item &, const VMod_Arr_Item &);
friend BOOL operator!=(const VMod_Arr_Item &, const VMod_Arr_Item &);
};
struct Adjacent_Module
{
Adjacent_Module();
~Adjacent_Module();
Adjacent_Module(const Adjacent_Module & vma);
Adjacent_Module & operator=(const Adjacent_Module & vma);
int flags;
ChunkVectorInt entry_point;
int object_index;
friend BOOL operator==(const Adjacent_Module & am1, const Adjacent_Module & am2);
friend BOOL operator!=(const Adjacent_Module & am1, const Adjacent_Module & am2);
};
class Shape_Chunk;
class Shape_Sub_Shape_Chunk;
struct a_frame
{
a_frame()
: shape1a (0), shape1b(0), shape2a(0), shape2b(0)
{}
Shape_Sub_Shape_Chunk * shape1a;
Shape_Chunk * shape1b;
Shape_Sub_Shape_Chunk * shape2a;
Shape_Chunk * shape2b;
int spare;
};
// Data structures for bits and pieces
struct obinfile
{
int filepos;
char name[50];
size_t length;
friend BOOL operator==(const obinfile &o1, const obinfile &o2);
friend BOOL operator!=(const obinfile &o1, const obinfile &o2);
};
struct shpinfile
{
int filepos;
int id;
size_t length;
friend BOOL operator==(const shpinfile &s1, const shpinfile &s2);
friend BOOL operator!=(const shpinfile &s1, const shpinfile &s2);
};
struct poly_change_info
{
int poly_num;
int vert_num_before;
int vert_num_after;
friend BOOL operator==(poly_change_info const &f1, poly_change_info const &f2);
friend BOOL operator!=(poly_change_info const &f1, poly_change_info const &f2);
};
#define animframeflag_not_in_psx 0x00000001
#define animframeflag_not_in_saturn 0x00000002
#define animframeflag_interpolated_frame 0x00000004
struct ChunkAnimFrame
{
ChunkAnimFrame();
~ChunkAnimFrame();
ChunkAnimFrame(const ChunkAnimFrame &);
//constructor for interpolated frame
//ChunkAnimFrame(ChunkAnimFrame* startframe,ChunkAnimFrame* endframe,int startwt,int endwt,ChunkShape const *cs);
ChunkAnimFrame& operator=(const ChunkAnimFrame &);
char* name;
int num_polys;
int num_verts;
ChunkVectorInt * v_list;
ChunkVectorFloat * p_normal_list;
int flags;
int num_interp_frames;
int pad3,pad4;
};
#define animseqflag_not_in_psx 0x00000001
#define animseqflag_not_in_saturn 0x00000002
struct ChunkAnimSequence
{
ChunkAnimSequence();
~ChunkAnimSequence();
ChunkAnimSequence (const ChunkAnimSequence &);
ChunkAnimSequence& operator=(const ChunkAnimSequence &);
void DeleteInterpolatedFrames();
void GenerateInterpolatedFrames(ChunkShape const *cs);
void UpdateNormalsAndExtents(ChunkShape const *cs,List<int>* poly_not_in_bb=0);
int SequenceNum;
char* name;
int NumFrames;
ChunkAnimFrame** Frames;
int flags;
int pad2,pad3,pad4;
ChunkVectorInt min;
ChunkVectorInt max;
float radius;
int num_verts;
ChunkVectorFloat* v_normal_list;
};
#endif
|