fix remapping behavior. Remapping is only necessary if we are rendering on the workbe...
[AROS-Contrib.git] / Games / Doom / r_defs.h
blob3899e8810af674b8b5d37235c59720d18c9ab7dc
1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id$
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 //
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
15 // for more details.
17 // DESCRIPTION:
18 // Refresh/rendering module, shared data struct definitions.
20 //-----------------------------------------------------------------------------
23 #ifndef __R_DEFS__
24 #define __R_DEFS__
27 // Screenwidth.
28 #include "doomdef.h"
30 // Some more or less basic data types
31 // we depend on.
32 #include "m_fixed.h"
34 // We rely on the thinker data struct
35 // to handle sound origins in sectors.
36 #include "d_think.h"
37 // SECTORS do store MObjs anyway.
38 #include "p_mobj.h"
42 #ifdef __GNUG__
43 #pragma interface
44 #endif
48 // Silhouette, needed for clipping Segs (mainly)
49 // and sprites representing things.
50 #define SIL_NONE 0
51 #define SIL_BOTTOM 1
52 #define SIL_TOP 2
53 #define SIL_BOTH 3
55 //#define MAXDRAWSEGS 256
56 #define MAXDRAWSEGS 512
61 // INTERNAL MAP TYPES
62 // used by play and refresh
66 // Your plain vanilla vertex.
67 // Note: transformed values not buffered locally,
68 // like some DOOM-alikes ("wt", "WebView") did.
70 typedef struct
72 fixed_t x;
73 fixed_t y;
75 } vertex_t;
78 // Forward of LineDefs, for Sectors.
79 struct line_s;
81 // Each sector has a degenmobj_t in its center
82 // for sound origin purposes.
83 // I suppose this does not handle sound from
84 // moving objects (doppler), because
85 // position is prolly just buffered, not
86 // updated.
87 typedef struct
89 thinker_t thinker; // not used for anything
90 fixed_t x;
91 fixed_t y;
92 fixed_t z;
94 } degenmobj_t;
97 // The SECTORS record, at runtime.
98 // Stores things/mobjs.
100 typedef struct
102 fixed_t floorheight;
103 fixed_t ceilingheight;
104 short floorpic;
105 short ceilingpic;
106 short lightlevel;
107 short special;
108 short tag;
110 // 0 = untraversed, 1,2 = sndlines -1
111 int soundtraversed;
113 // thing that made a sound (or null)
114 mobj_t* soundtarget;
116 // mapblock bounding box for height changes
117 int blockbox[4];
119 // origin for any sounds played by the sector
120 degenmobj_t soundorg;
122 // if == validcount, already checked
123 int validcount;
125 // list of mobjs in sector
126 mobj_t* thinglist;
128 // thinker_t for reversable actions
129 void* specialdata;
131 int linecount;
132 struct line_s** lines; // [linecount] size
134 } sector_t;
140 // The SideDef.
143 typedef struct
145 // add this to the calculated texture column
146 fixed_t textureoffset;
148 // add this to the calculated texture top
149 fixed_t rowoffset;
151 // Texture indices.
152 // We do not maintain names here.
153 short toptexture;
154 short bottomtexture;
155 short midtexture;
157 // Sector the SideDef is facing.
158 sector_t* sector;
160 } side_t;
165 // Move clipping aid for LineDefs.
167 typedef enum
169 ST_HORIZONTAL,
170 ST_VERTICAL,
171 ST_POSITIVE,
172 ST_NEGATIVE
174 } slopetype_t;
178 typedef struct line_s
180 // Vertices, from v1 to v2.
181 vertex_t* v1;
182 vertex_t* v2;
184 // Precalculated v2 - v1 for side checking.
185 fixed_t dx;
186 fixed_t dy;
188 // Animation related.
189 short flags;
190 short special;
191 short tag;
193 // Visual appearance: SideDefs.
194 // sidenum[1] will be -1 if one sided
195 short sidenum[2];
197 // Neat. Another bounding box, for the extent
198 // of the LineDef.
199 fixed_t bbox[4];
201 // To aid move clipping.
202 slopetype_t slopetype;
204 // Front and back sector.
205 // Note: redundant? Can be retrieved from SideDefs.
206 sector_t* frontsector;
207 sector_t* backsector;
209 // if == validcount, already checked
210 int validcount;
212 // thinker_t for reversable actions
213 void* specialdata;
214 } line_t;
220 // A SubSector.
221 // References a Sector.
222 // Basically, this is a list of LineSegs,
223 // indicating the visible walls that define
224 // (all or some) sides of a convex BSP leaf.
226 typedef struct subsector_s
228 sector_t* sector;
229 short numlines;
230 short firstline;
232 } subsector_t;
237 // The LineSeg.
239 typedef struct
241 vertex_t* v1;
242 vertex_t* v2;
244 fixed_t offset;
246 angle_t angle;
248 side_t* sidedef;
249 line_t* linedef;
251 // Sector references.
252 // Could be retrieved from linedef, too.
253 // backsector is NULL for one sided lines
254 sector_t* frontsector;
255 sector_t* backsector;
257 } seg_t;
262 // BSP node.
264 typedef struct
266 // Partition line.
267 fixed_t x;
268 fixed_t y;
269 fixed_t dx;
270 fixed_t dy;
272 // Bounding box for each child.
273 fixed_t bbox[2][4];
275 // If NF_SUBSECTOR its a subsector.
276 unsigned short children[2];
278 } node_t;
283 // posts are runs of non masked source pixels
284 typedef struct
286 byte topdelta; // -1 is the last post in a column
287 byte length; // length data bytes follows
288 } post_t;
290 // column_t is a list of 0 or more post_t, (byte)-1 terminated
291 typedef post_t column_t;
295 // PC direct to screen pointers
296 //B UNUSED - keep till detailshift in r_draw.c resolved
297 //extern byte* destview;
298 //extern byte* destscreen;
305 // OTHER TYPES
308 // This could be wider for >8 bit display.
309 // Indeed, true color support is posibble
310 // precalculating 24bpp lightmap/colormap LUT.
311 // from darkening PLAYPAL to all black.
312 // Could even us emore than 32 levels.
313 typedef byte lighttable_t;
319 // ?
321 typedef struct drawseg_s
323 seg_t* curline;
324 int x1;
325 int x2;
327 fixed_t scale1;
328 fixed_t scale2;
329 fixed_t scalestep;
331 // 0=none, 1=bottom, 2=top, 3=both
332 int silhouette;
334 // do not clip sprites above this
335 fixed_t bsilheight;
337 // do not clip sprites below this
338 fixed_t tsilheight;
340 // Pointers to lists for sprite clipping,
341 // all three adjusted so [x1] is first value.
342 short* sprtopclip;
343 short* sprbottomclip;
344 short* maskedtexturecol;
346 } drawseg_t;
350 // Patches.
351 // A patch holds one or more columns.
352 // Patches are used for sprites and all masked pictures,
353 // and we compose textures from the TEXTURE1/2 lists
354 // of patches.
355 typedef struct
357 short width; // bounding box size
358 short height;
359 short leftoffset; // pixels to the left of origin
360 short topoffset; // pixels below the origin
361 int columnofs[8]; // only [width] used
362 // the [0] is &columnofs[width]
363 } patch_t;
371 // A vissprite_t is a thing
372 // that will be drawn during a refresh.
373 // I.e. a sprite object that is partly visible.
374 typedef struct vissprite_s
376 // Doubly linked list.
377 struct vissprite_s* prev;
378 struct vissprite_s* next;
380 int x1;
381 int x2;
383 // for line side calculation
384 fixed_t gx;
385 fixed_t gy;
387 // global bottom / top for silhouette clipping
388 fixed_t gz;
389 fixed_t gzt;
391 // horizontal position of x1
392 fixed_t startfrac;
394 fixed_t scale;
396 // negative if flipped
397 fixed_t xiscale;
399 fixed_t texturemid;
400 int patch;
402 // for color translation and shadow draw,
403 // maxbright frames as well
404 lighttable_t* colormap;
406 int mobjflags;
408 } vissprite_t;
412 // Sprites are patches with a special naming convention
413 // so they can be recognized by R_InitSprites.
414 // The base name is NNNNFx or NNNNFxFx, with
415 // x indicating the rotation, x = 0, 1-7.
416 // The sprite and frame specified by a thing_t
417 // is range checked at run time.
418 // A sprite is a patch_t that is assumed to represent
419 // a three dimensional object and may have multiple
420 // rotations pre drawn.
421 // Horizontal flipping is used to save space,
422 // thus NNNNF2F5 defines a mirrored patch.
423 // Some sprites will only have one picture used
424 // for all views: NNNNF0
426 typedef struct
428 // If false use 0 for any position.
429 // Note: as eight entries are available,
430 // we might as well insert the same name eight times.
431 boolean rotate;
433 // Lump to use for view angles 0-7.
434 short lump[8];
436 // Flip bit (1 = flip) to use for view angles 0-7.
437 byte flip[8];
439 } spriteframe_t;
444 // A sprite definition:
445 // a number of animation frames.
447 typedef struct
449 int numframes;
450 spriteframe_t* spriteframes;
452 } spritedef_t;
457 // Now what is a visplane, anyway?
459 typedef struct
461 fixed_t height;
462 int picnum;
463 int lightlevel;
464 int minx;
465 int maxx;
467 unsigned short *top;
468 unsigned short *bottom;
469 // leave pads for [minx-1]/[maxx+1]
471 byte pad1;
472 // Here lies the rub for all
473 // dynamic resize/change of resolution.
474 byte top[SCREENWIDTH];
475 byte pad2;
476 byte pad3;
477 // See above.
478 byte bottom[SCREENWIDTH];
479 byte pad4;
482 } visplane_t;
487 #endif
488 //-----------------------------------------------------------------------------
490 // $Log$
491 // Revision 1.1 2000/02/29 18:21:06 stegerg
492 // Doom port based on ADoomPPC. Read README.AROS!
495 //-----------------------------------------------------------------------------