-
Notifications
You must be signed in to change notification settings - Fork 1
/
3deng.h
266 lines (204 loc) · 4.89 KB
/
3deng.h
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
/********************************************************/
/* 3D ENGINE - Header File 17/01/95 */
/********************************************************/
#ifndef _3DENG_H_
#define _3DENG_H_
/**************/
/* DATA TYPES */
//Data size definitions
//use these as often as possible
typedef signed char byte;
typedef signed short word;
typedef signed int dword;
#ifndef BYTE
typedef unsigned char BYTE;
#endif
// Types used through 3D pipeline
typedef float datapt;
typedef float rotpt;
typedef dword scrpt;
// Word / Byte union
typedef union {
struct {
byte low, hiw;
} d;
word c;
} dchar_u;
// DoubleWord / Word union
typedef union {
struct {
word low, hiw;
} d;
dword dw;
} dword_u;
/**************/
/* MATH TYPES */
// General matrix type
typedef float mat[4][4];
// Rotation matrix type (explicit for speed).
typedef union {
mat arr;
struct {
float r00, r01, r02, r03;
float r10, r11, r12, r13;
float r20, r21, r22, r23;
} e;
} qmat;
/*********************/
/* 3D GEOMETRY TYPES */
// 3D point & point-list types
typedef datapt *pt;
typedef datapt ptlist[];
// Face & face-list types
typedef word *face;
typedef word facelist[];
// Rotated point type
typedef rotpt *rpt;
/*********************/
/* 2D GEOMETRY TYPES */
// Screen point type
typedef struct {
scrpt x, y;
} pnt;
// Gourad screen point type
typedef struct {
scrpt x, y, col;
} ppnt;
// Screen point with z type (Bi-Quadratic mapping)
typedef struct {
scrpt z, x, y;
} zpnt;
// Screen polygon type (with average z for sort)
typedef struct {
rotpt z;
scrpt *pts;
} pols;
/****************/
/* OBJECT TYPES */
// Object type
typedef struct {
pt points;
face faces;
datapt x, y, z;
float crot, srot;
} obj;
// Object list type
typedef struct {
rotpt z;
pols *polys;
short nopols;
} objs;
// Object detail level type
typedef struct {
rotpt zscale; // min z/q for this detail level
pt dpoints;
face dfaces;
} det;
// Object detail level list
typedef det detlist[];
/*****************/
/* SURFACE TYPES */
// Texture type
typedef dword texture[8]; // Assumes 4 pt textures, other nos of pts are padded out
// Polygon filter type
typedef BYTE filter[256];
/************************/
/* MOTION CAPTURE TYPES */
// Specific for players only
#define PLYRPTS 28
typedef datapt capfrm[PLYRPTS * 3 + 1];
typedef struct {
word cappts, capfrms;
} mcap;
/*********************/
/* PLAYER INFO TYPES */
typedef struct {
float x, y, z, crot, srot, frame, fstep;
short type, number, anim, sprite;
BYTE htype, hcol;
} plyrdat;
typedef struct {
datapt *twnfrm;
capfrm twnpts1, twnpts2;
float tween, tstep;
short anim, animto;
} plyrtwdat;
/**************/
/* MISC TYPES */
typedef struct {
short sky;
short stadia;
short pitch;
short players;
short lines;
short shadows;
} detail_info;
// Setup data type
typedef struct {
short M8;
short team_a, team_b;
short team_b_kit;
short stadium;
short vidi_type;
short start_res;
short screen_size;
short verbose;
detail_info detail;
} setup_info;
// Screen buffer info type
typedef struct {
BYTE *buff_start;
scrpt buff_wid, buff_hgt;
scrpt clip_wid, clip_hgt;
float scale_x, scale_y;
void (*dump)(scrpt dispx, scrpt dispy);
} buff_info;
// Extended screen buffer info type
typedef struct {
BYTE *buff_start;
BYTE *clip_end, *clip_endl;
scrpt buff_wid, buff_hgt;
scrpt clip_wid, clip_hgt, clip_widl, clip_hgtl;
scrpt clip_xmid, clip_ymid;
float scale_x, scale_y;
void (*dump)(scrpt dispx, scrpt dispy);
} buff_info_ext;
typedef struct {
int pitchfile, pitchpfile;
char skytypes[2];
int tmdfile;
int sb1file, sb2file;
datapt s1x, s1y, s1z;
int s1pfile, s1ffile;
datapt s2x, s2y, s2z;
int s2pfile, s2ffile;
datapt s3x, s3y, s3z;
int s3pfile, s3ffile;
datapt s4x, s4y, s4z;
int s4pfile, s4ffile;
int st_w, st_l, st_h;
short noloop;
int loop[20];
int vid1x, vid1y, vid1z;
int vid2x, vid2y, vid2z;
int tunlx, tunly, tunlz;
int vmap;
} stad_info;
typedef struct {
int headfile;
int torsofile;
int limbsfile;
int nosfile;
int palfile;
int skinfile;
int homepfile;
int awaypfile;
} teamk_info;
/***********************/
/* FUNCTION PROTOTYPES */
int init3d();
void setscreen();
void end3d();
void render3d(buff_info *buffer, datapt viewx, datapt viewy, datapt viewz, datapt targx, datapt targy,
datapt targz, datapt vdist, plyrdat *plyrtb, datapt *xyz_ptr, word *ref_ptr);
#endif