XenevaOS
Loading...
Searching...
No Matches
r_defs.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16// Refresh/rendering module, shared data struct definitions.
17//
18
19
20#ifndef __R_DEFS__
21#define __R_DEFS__
22
23
24// Screenwidth.
25#include "doomdef.h"
26
27// Some more or less basic data types
28// we depend on.
29#include "m_fixed.h"
30
31// We rely on the thinker data struct
32// to handle sound origins in sectors.
33#include "d_think.h"
34// SECTORS do store MObjs anyway.
35#include "p_mobj.h"
36
37#include "i_video.h"
38
39#include "v_patch.h"
40
41
42
43
44// Silhouette, needed for clipping Segs (mainly)
45// and sprites representing things.
46#define SIL_NONE 0
47#define SIL_BOTTOM 1
48#define SIL_TOP 2
49#define SIL_BOTH 3
50
51#define MAXDRAWSEGS 256
52
53
54
55
56
57//
58// INTERNAL MAP TYPES
59// used by play and refresh
60//
61
62//
63// Your plain vanilla vertex.
64// Note: transformed values not buffered locally,
65// like some DOOM-alikes ("wt", "WebView") did.
66//
67typedef struct
68{
71
72} vertex_t;
73
74
75// Forward of LineDefs, for Sectors.
76struct line_s;
77
78// Each sector has a degenmobj_t in its center
79// for sound origin purposes.
80// I suppose this does not handle sound from
81// moving objects (doppler), because
82// position is prolly just buffered, not
83// updated.
84typedef struct
85{
86 thinker_t thinker; // not used for anything
90
92
93//
94// The SECTORS record, at runtime.
95// Stores things/mobjs.
96//
97typedef struct
98{
101 short floorpic;
104 short special;
105 short tag;
106
107 // 0 = untraversed, 1,2 = sndlines -1
109
110 // thing that made a sound (or null)
112
113 // mapblock bounding box for height changes
114 int blockbox[4];
115
116 // origin for any sounds played by the sector
118
119 // if == validcount, already checked
121
122 // list of mobjs in sector
124
125 // thinker_t for reversable actions
127
129 struct line_s** lines; // [linecount] size
130
131} sector_t;
132
133
134
135
136//
137// The SideDef.
138//
139
140typedef struct
141{
142 // add this to the calculated texture column
144
145 // add this to the calculated texture top
147
148 // Texture indices.
149 // We do not maintain names here.
153
154 // Sector the SideDef is facing.
156
157} side_t;
158
159
160
161//
162// Move clipping aid for LineDefs.
163//
172
173
174
175typedef struct line_s
176{
177 // Vertices, from v1 to v2.
180
181 // Precalculated v2 - v1 for side checking.
184
185 // Animation related.
186 short flags;
187 short special;
188 short tag;
189
190 // Visual appearance: SideDefs.
191 // sidenum[1] will be -1 if one sided
192 short sidenum[2];
193
194 // Neat. Another bounding box, for the extent
195 // of the LineDef.
197
198 // To aid move clipping.
200
201 // Front and back sector.
202 // Note: redundant? Can be retrieved from SideDefs.
205
206 // if == validcount, already checked
208
209 // thinker_t for reversable actions
212
213
214
215
216//
217// A SubSector.
218// References a Sector.
219// Basically, this is a list of LineSegs,
220// indicating the visible walls that define
221// (all or some) sides of a convex BSP leaf.
222//
230
231
232
233//
234// The LineSeg.
235//
236typedef struct
237{
240
242
244
247
248 // Sector references.
249 // Could be retrieved from linedef, too.
250 // backsector is NULL for one sided lines
253
254} seg_t;
255
256
257
258//
259// BSP node.
260//
261typedef struct
262{
263 // Partition line.
268
269 // Bounding box for each child.
270 fixed_t bbox[2][4];
271
272 // If NF_SUBSECTOR its a subsector.
273 unsigned short children[2];
274
275} node_t;
276
277
278
279
280// PC direct to screen pointers
281//B UNUSED - keep till detailshift in r_draw.c resolved
282//extern byte* destview;
283//extern byte* destscreen;
284
285
286
287
288
289//
290// OTHER TYPES
291//
292
293// This could be wider for >8 bit display.
294// Indeed, true color support is posibble
295// precalculating 24bpp lightmap/colormap LUT.
296// from darkening PLAYPAL to all black.
297// Could even us emore than 32 levels.
298typedef byte lighttable_t;
299
300
301
302
303//
304// ?
305//
306typedef struct drawseg_s
307{
309 int x1;
310 int x2;
311
315
316 // 0=none, 1=bottom, 2=top, 3=both
318
319 // do not clip sprites above this
321
322 // do not clip sprites below this
324
325 // Pointers to lists for sprite clipping,
326 // all three adjusted so [x1] is first value.
327 short* sprtopclip;
330
332
333
334
335// A vissprite_t is a thing
336// that will be drawn during a refresh.
337// I.e. a sprite object that is partly visible.
338typedef struct vissprite_s
339{
340 // Doubly linked list.
343
344 int x1;
345 int x2;
346
347 // for line side calculation
350
351 // global bottom / top for silhouette clipping
354
355 // horizontal position of x1
357
359
360 // negative if flipped
362
364 int patch;
365
366 // for color translation and shadow draw,
367 // maxbright frames as well
369
371
373
374
375//
376// Sprites are patches with a special naming convention
377// so they can be recognized by R_InitSprites.
378// The base name is NNNNFx or NNNNFxFx, with
379// x indicating the rotation, x = 0, 1-7.
380// The sprite and frame specified by a thing_t
381// is range checked at run time.
382// A sprite is a patch_t that is assumed to represent
383// a three dimensional object and may have multiple
384// rotations pre drawn.
385// Horizontal flipping is used to save space,
386// thus NNNNF2F5 defines a mirrored patch.
387// Some sprites will only have one picture used
388// for all views: NNNNF0
389//
390typedef struct
391{
392 // If false use 0 for any position.
393 // Note: as eight entries are available,
394 // we might as well insert the same name eight times.
395 boolean rotate;
396
397 // Lump to use for view angles 0-7.
398 short lump[8];
399
400 // Flip bit (1 = flip) to use for view angles 0-7.
401 byte flip[8];
402
404
405
406
407//
408// A sprite definition:
409// a number of animation frames.
410//
411typedef struct
412{
415
417
418
419
420//
421// Now what is a visplane, anyway?
422//
423typedef struct
424{
428 int minx;
429 int maxx;
430
431 // leave pads for [minx-1]/[maxx+1]
432
433 byte pad1;
434 // Here lies the rub for all
435 // dynamic resize/change of resolution.
437 byte pad2;
438 byte pad3;
439 // See above.
441 byte pad4;
442
443} visplane_t;
444
445
446
447
448#endif
#define SCREENWIDTH
Definition i_video.h:27
int fixed_t
Definition m_fixed.h:32
@ top
Definition p_spec.h:217
@ bottom
Definition p_spec.h:219
byte lighttable_t
Definition r_defs.h:298
struct subsector_s subsector_t
struct vissprite_s vissprite_t
struct drawseg_s drawseg_t
struct line_s line_t
slopetype_t
Definition r_defs.h:165
@ ST_NEGATIVE
Definition r_defs.h:169
@ ST_VERTICAL
Definition r_defs.h:167
@ ST_HORIZONTAL
Definition r_defs.h:166
@ ST_POSITIVE
Definition r_defs.h:168
Definition r_defs.h:85
thinker_t thinker
Definition r_defs.h:86
fixed_t z
Definition r_defs.h:89
fixed_t x
Definition r_defs.h:87
fixed_t y
Definition r_defs.h:88
Definition r_defs.h:307
fixed_t scale1
Definition r_defs.h:312
fixed_t bsilheight
Definition r_defs.h:320
seg_t * curline
Definition r_defs.h:308
short * sprtopclip
Definition r_defs.h:327
int x2
Definition r_defs.h:310
int x1
Definition r_defs.h:309
fixed_t scalestep
Definition r_defs.h:314
short * sprbottomclip
Definition r_defs.h:328
int silhouette
Definition r_defs.h:317
fixed_t scale2
Definition r_defs.h:313
short * maskedtexturecol
Definition r_defs.h:329
fixed_t tsilheight
Definition r_defs.h:323
Definition r_defs.h:176
short flags
Definition r_defs.h:186
short special
Definition r_defs.h:187
fixed_t dx
Definition r_defs.h:182
vertex_t * v1
Definition r_defs.h:178
void * specialdata
Definition r_defs.h:210
short tag
Definition r_defs.h:188
fixed_t bbox[4]
Definition r_defs.h:196
slopetype_t slopetype
Definition r_defs.h:199
fixed_t dy
Definition r_defs.h:183
int validcount
Definition r_defs.h:207
sector_t * backsector
Definition r_defs.h:204
vertex_t * v2
Definition r_defs.h:179
sector_t * frontsector
Definition r_defs.h:203
short sidenum[2]
Definition r_defs.h:192
Definition p_mobj.h:202
Definition r_defs.h:262
fixed_t dy
Definition r_defs.h:267
fixed_t dx
Definition r_defs.h:266
fixed_t y
Definition r_defs.h:265
fixed_t x
Definition r_defs.h:264
Definition r_defs.h:98
fixed_t ceilingheight
Definition r_defs.h:100
short lightlevel
Definition r_defs.h:103
short tag
Definition r_defs.h:105
short floorpic
Definition r_defs.h:101
void * specialdata
Definition r_defs.h:126
int linecount
Definition r_defs.h:128
struct line_s ** lines
Definition r_defs.h:129
int validcount
Definition r_defs.h:120
fixed_t floorheight
Definition r_defs.h:99
mobj_t * soundtarget
Definition r_defs.h:111
int soundtraversed
Definition r_defs.h:108
short special
Definition r_defs.h:104
mobj_t * thinglist
Definition r_defs.h:123
degenmobj_t soundorg
Definition r_defs.h:117
short ceilingpic
Definition r_defs.h:102
Definition r_defs.h:237
sector_t * backsector
Definition r_defs.h:252
sector_t * frontsector
Definition r_defs.h:251
line_t * linedef
Definition r_defs.h:246
side_t * sidedef
Definition r_defs.h:245
vertex_t * v1
Definition r_defs.h:238
fixed_t offset
Definition r_defs.h:241
vertex_t * v2
Definition r_defs.h:239
angle_t angle
Definition r_defs.h:243
Definition r_defs.h:141
short toptexture
Definition r_defs.h:150
sector_t * sector
Definition r_defs.h:155
fixed_t textureoffset
Definition r_defs.h:143
short bottomtexture
Definition r_defs.h:151
short midtexture
Definition r_defs.h:152
fixed_t rowoffset
Definition r_defs.h:146
Definition r_defs.h:412
spriteframe_t * spriteframes
Definition r_defs.h:414
int numframes
Definition r_defs.h:413
Definition r_defs.h:391
boolean rotate
Definition r_defs.h:395
Definition r_defs.h:224
short numlines
Definition r_defs.h:226
sector_t * sector
Definition r_defs.h:225
short firstline
Definition r_defs.h:227
Definition d_think.h:59
Definition r_defs.h:68
fixed_t x
Definition r_defs.h:69
fixed_t y
Definition r_defs.h:70
Definition r_defs.h:424
byte pad2
Definition r_defs.h:437
int lightlevel
Definition r_defs.h:427
fixed_t height
Definition r_defs.h:425
byte pad3
Definition r_defs.h:438
int minx
Definition r_defs.h:428
int maxx
Definition r_defs.h:429
byte pad4
Definition r_defs.h:441
byte pad1
Definition r_defs.h:433
int picnum
Definition r_defs.h:426
Definition r_defs.h:339
fixed_t xiscale
Definition r_defs.h:361
struct vissprite_s * prev
Definition r_defs.h:341
int mobjflags
Definition r_defs.h:370
lighttable_t * colormap
Definition r_defs.h:368
struct vissprite_s * next
Definition r_defs.h:342
fixed_t gz
Definition r_defs.h:352
fixed_t texturemid
Definition r_defs.h:363
int x2
Definition r_defs.h:345
fixed_t gy
Definition r_defs.h:349
fixed_t gx
Definition r_defs.h:348
int patch
Definition r_defs.h:364
fixed_t gzt
Definition r_defs.h:353
fixed_t scale
Definition r_defs.h:358
fixed_t startfrac
Definition r_defs.h:356
int x1
Definition r_defs.h:344
unsigned angle_t
Definition tables.h:81