[docs] Replace cyrillic 'с' with latin 'c' in register names
[kolibrios.git] / contrib / other / sdldoom-1.10 / r_defs.h
blob6c842a5194c35f0241dfd35bc180539e20322efa
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
62 // INTERNAL MAP TYPES
63 // used by play and refresh
67 // Your plain vanilla vertex.
68 // Note: transformed values not buffered locally,
69 // like some DOOM-alikes ("wt", "WebView") did.
71 typedef struct
73 fixed_t x;
74 fixed_t y;
76 } vertex_t;
79 // Forward of LineDefs, for Sectors.
80 struct line_s;
82 // Each sector has a degenmobj_t in its center
83 // for sound origin purposes.
84 // I suppose this does not handle sound from
85 // moving objects (doppler), because
86 // position is prolly just buffered, not
87 // updated.
88 typedef struct
90 thinker_t thinker; // not used for anything
91 fixed_t x;
92 fixed_t y;
93 fixed_t z;
95 } degenmobj_t;
98 // The SECTORS record, at runtime.
99 // Stores things/mobjs.
101 typedef struct
103 fixed_t floorheight;
104 fixed_t ceilingheight;
105 short floorpic;
106 short ceilingpic;
107 short lightlevel;
108 short special;
109 short tag;
111 // 0 = untraversed, 1,2 = sndlines -1
112 int soundtraversed;
114 // thing that made a sound (or null)
115 mobj_t* soundtarget;
117 // mapblock bounding box for height changes
118 int blockbox[4];
120 // origin for any sounds played by the sector
121 degenmobj_t soundorg;
123 // if == validcount, already checked
124 int validcount;
126 // list of mobjs in sector
127 mobj_t* thinglist;
129 // thinker_t for reversable actions
130 void* specialdata;
132 int linecount;
133 struct line_s** lines; // [linecount] size
135 } sector_t;
141 // The SideDef.
144 typedef struct
146 // add this to the calculated texture column
147 fixed_t textureoffset;
149 // add this to the calculated texture top
150 fixed_t rowoffset;
152 // Texture indices.
153 // We do not maintain names here.
154 short toptexture;
155 short bottomtexture;
156 short midtexture;
158 // Sector the SideDef is facing.
159 sector_t* sector;
161 } side_t;
166 // Move clipping aid for LineDefs.
168 typedef enum
170 ST_HORIZONTAL,
171 ST_VERTICAL,
172 ST_POSITIVE,
173 ST_NEGATIVE
175 } slopetype_t;
179 typedef struct line_s
181 // Vertices, from v1 to v2.
182 vertex_t* v1;
183 vertex_t* v2;
185 // Precalculated v2 - v1 for side checking.
186 fixed_t dx;
187 fixed_t dy;
189 // Animation related.
190 short flags;
191 short special;
192 short tag;
194 // Visual appearance: SideDefs.
195 // sidenum[1] will be -1 if one sided
196 short sidenum[2];
198 // Neat. Another bounding box, for the extent
199 // of the LineDef.
200 fixed_t bbox[4];
202 // To aid move clipping.
203 slopetype_t slopetype;
205 // Front and back sector.
206 // Note: redundant? Can be retrieved from SideDefs.
207 sector_t* frontsector;
208 sector_t* backsector;
210 // if == validcount, already checked
211 int validcount;
213 // thinker_t for reversable actions
214 void* specialdata;
215 } line_t;
221 // A SubSector.
222 // References a Sector.
223 // Basically, this is a list of LineSegs,
224 // indicating the visible walls that define
225 // (all or some) sides of a convex BSP leaf.
227 typedef struct subsector_s
229 sector_t* sector;
230 short numlines;
231 short firstline;
233 } subsector_t;
238 // The LineSeg.
240 typedef struct
242 vertex_t* v1;
243 vertex_t* v2;
245 fixed_t offset;
247 angle_t angle;
249 side_t* sidedef;
250 line_t* linedef;
252 // Sector references.
253 // Could be retrieved from linedef, too.
254 // backsector is NULL for one sided lines
255 sector_t* frontsector;
256 sector_t* backsector;
258 } seg_t;
263 // BSP node.
265 typedef struct
267 // Partition line.
268 fixed_t x;
269 fixed_t y;
270 fixed_t dx;
271 fixed_t dy;
273 // Bounding box for each child.
274 fixed_t bbox[2][4];
276 // If NF_SUBSECTOR its a subsector.
277 unsigned short children[2];
279 } node_t;
284 // posts are runs of non masked source pixels
285 typedef struct
287 byte topdelta; // -1 is the last post in a column
288 byte length; // length data bytes follows
289 } post_t;
291 // column_t is a list of 0 or more post_t, (byte)-1 terminated
292 typedef post_t column_t;
296 // PC direct to screen pointers
297 //B UNUSED - keep till detailshift in r_draw.c resolved
298 //extern byte* destview;
299 //extern byte* destscreen;
306 // OTHER TYPES
309 // This could be wider for >8 bit display.
310 // Indeed, true color support is posibble
311 // precalculating 24bpp lightmap/colormap LUT.
312 // from darkening PLAYPAL to all black.
313 // Could even us emore than 32 levels.
314 typedef byte lighttable_t;
320 // ?
322 typedef struct drawseg_s
324 seg_t* curline;
325 int x1;
326 int x2;
328 fixed_t scale1;
329 fixed_t scale2;
330 fixed_t scalestep;
332 // 0=none, 1=bottom, 2=top, 3=both
333 int silhouette;
335 // do not clip sprites above this
336 fixed_t bsilheight;
338 // do not clip sprites below this
339 fixed_t tsilheight;
341 // Pointers to lists for sprite clipping,
342 // all three adjusted so [x1] is first value.
343 short* sprtopclip;
344 short* sprbottomclip;
345 short* maskedtexturecol;
347 } drawseg_t;
351 // Patches.
352 // A patch holds one or more columns.
353 // Patches are used for sprites and all masked pictures,
354 // and we compose textures from the TEXTURE1/2 lists
355 // of patches.
356 typedef struct
358 short width; // bounding box size
359 short height;
360 short leftoffset; // pixels to the left of origin
361 short topoffset; // pixels below the origin
362 int columnofs[8]; // only [width] used
363 // the [0] is &columnofs[width]
364 } patch_t;
372 // A vissprite_t is a thing
373 // that will be drawn during a refresh.
374 // I.e. a sprite object that is partly visible.
375 typedef struct vissprite_s
377 // Doubly linked list.
378 struct vissprite_s* prev;
379 struct vissprite_s* next;
381 int x1;
382 int x2;
384 // for line side calculation
385 fixed_t gx;
386 fixed_t gy;
388 // global bottom / top for silhouette clipping
389 fixed_t gz;
390 fixed_t gzt;
392 // horizontal position of x1
393 fixed_t startfrac;
395 fixed_t scale;
397 // negative if flipped
398 fixed_t xiscale;
400 fixed_t texturemid;
401 int patch;
403 // for color translation and shadow draw,
404 // maxbright frames as well
405 lighttable_t* colormap;
407 int mobjflags;
409 } vissprite_t;
413 // Sprites are patches with a special naming convention
414 // so they can be recognized by R_InitSprites.
415 // The base name is NNNNFx or NNNNFxFx, with
416 // x indicating the rotation, x = 0, 1-7.
417 // The sprite and frame specified by a thing_t
418 // is range checked at run time.
419 // A sprite is a patch_t that is assumed to represent
420 // a three dimensional object and may have multiple
421 // rotations pre drawn.
422 // Horizontal flipping is used to save space,
423 // thus NNNNF2F5 defines a mirrored patch.
424 // Some sprites will only have one picture used
425 // for all views: NNNNF0
427 typedef struct
429 // If false use 0 for any position.
430 // Note: as eight entries are available,
431 // we might as well insert the same name eight times.
432 boolean rotate;
434 // Lump to use for view angles 0-7.
435 short lump[8];
437 // Flip bit (1 = flip) to use for view angles 0-7.
438 byte flip[8];
440 } spriteframe_t;
445 // A sprite definition:
446 // a number of animation frames.
448 typedef struct
450 int numframes;
451 spriteframe_t* spriteframes;
453 } spritedef_t;
458 // Now what is a visplane, anyway?
460 typedef struct
462 fixed_t height;
463 int picnum;
464 int lightlevel;
465 int minx;
466 int maxx;
468 // leave pads for [minx-1]/[maxx+1]
470 byte pad1;
471 // Here lies the rub for all
472 // dynamic resize/change of resolution.
473 byte top[SCREENWIDTH];
474 byte pad2;
475 byte pad3;
476 // See above.
477 byte bottom[SCREENWIDTH];
478 byte pad4;
480 } visplane_t;
485 #endif
486 //-----------------------------------------------------------------------------
488 // $Log:$
490 //-----------------------------------------------------------------------------