1 /* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
5 * PrBoom a Doom port merged with LxDoom and LSDLDoom
6 * based on BOOM, a modified and improved DOOM engine
7 * Copyright (C) 1999 by
8 * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9 * Copyright (C) 1999-2000 by
10 * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 * Refresh/rendering module, shared data struct definitions.
30 *-----------------------------------------------------------------------------*/
38 // Some more or less basic data types
42 // We rely on the thinker data struct
43 // to handle sound origins in sectors.
45 // SECTORS do store MObjs anyway.
52 // Silhouette, needed for clipping Segs (mainly)
53 // and sprites representing things.
59 #define MAXDRAWSEGS 256
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") do.
77 // Each sector has a degenmobj_t in its center for sound origin purposes.
80 thinker_t thinker
; // not used for anything
86 // The SECTORS record, at runtime.
87 // Stores things/mobjs.
93 fixed_t ceilingheight
;
94 int nexttag
,firsttag
; // killough 1/30/98: improves searches for tags.
95 int soundtraversed
; // 0 = untraversed, 1,2 = sndlines-1
96 mobj_t
*soundtarget
; // thing that made a sound (or null)
97 int blockbox
[4]; // mapblock bounding box for height changes
98 degenmobj_t soundorg
; // origin for any sounds played by the sector
99 int validcount
; // if == validcount, already checked
100 mobj_t
*thinglist
; // list of mobjs in sector
102 /* killough 8/28/98: friction is a sector property, not an mobj property.
103 * these fields used to be in mobj_t, but presented performance problems
104 * when processed as mobj properties. Fix is to make them sector properties.
106 int friction
,movefactor
;
108 // thinker_t for reversable actions
109 void *floordata
; // jff 2/22/98 make thinkers on
110 void *ceilingdata
; // floors, ceilings, lighting,
111 void *lightingdata
; // independent of one another
113 // jff 2/26/98 lockout machinery for stairbuilding
114 int stairlock
; // -2 on first locked -1 after thinker done 0 normally
115 int prevsec
; // -1 or number of sector for previous step
116 int nextsec
; // -1 or number of next step sector
118 // killough 3/7/98: support flat heights drawn at another sector's heights
119 int heightsec
; // other sector, or -1 if no other sector
121 int bottommap
, midmap
, topmap
; // killough 4/4/98: dynamic colormaps
123 // list of mobjs that are at least partially in the sector
124 // thinglist is a subset of touching_thinglist
125 struct msecnode_s
*touching_thinglist
; // phares 3/14/98
128 struct line_s
**lines
;
130 // killough 10/98: support skies coming from sidedefs. Allows scrolling
131 // skies and other effects. No "level info" kind of lump is needed,
132 // because you can use an arbitrary number of skies per level with this
133 // method. This field only applies when skyflatnum is used for floorpic
134 // or ceilingpic, because the rest of Doom needs to know which is sky
135 // and which isn't, etc.
139 // killough 3/7/98: floor and ceiling texture offsets
140 fixed_t floor_xoffs
, floor_yoffs
;
141 fixed_t ceiling_xoffs
, ceiling_yoffs
;
143 // killough 4/11/98: support for lightlevels coming from another sector
144 int floorlightsec
, ceilinglightsec
;
150 short oldspecial
; //jff 2/16/98 remembers if sector WAS secret (automap)
161 fixed_t textureoffset
; // add this to the calculated texture column
162 fixed_t rowoffset
; // add this to the calculated texture top
163 short toptexture
; // Texture indices. We do not maintain names here.
166 sector_t
* sector
; // Sector the SideDef is facing.
168 // killough 4/4/98, 4/11/98: highest referencing special linedef's type,
169 // or lump number of special effect. Allows texture names to be overloaded
170 // for other functions.
178 // Move clipping aid for LineDefs.
187 typedef int slopetype_t
;
190 RF_TOP_TILE
= 1, // Upper texture needs tiling
191 RF_MID_TILE
= 2, // Mid texture needs tiling
192 RF_BOT_TILE
= 4, // Lower texture needs tiling
193 RF_IGNORE
= 8, // Renderer can skip this line
194 RF_CLOSED
=16, // Line blocks view
197 typedef struct line_s
199 vertex_t
*v1
, *v2
; // Vertices, from v1 to v2.
200 fixed_t dx
, dy
; // Precalculated v2 - v1 for side checking.
201 short flags
; // Animation related.
204 short sidenum
[2]; // Visual appearance: SideDefs.
205 fixed_t bbox
[4]; // A bounding box, for the linedef's extent
206 slopetype_t slopetype
; // To aid move clipping.
207 sector_t
*frontsector
; // Front and back sector.
208 sector_t
*backsector
;
209 int validcount
; // if == validcount, already checked
210 void *specialdata
; // thinker_t for reversable actions
211 int tranlump
; // killough 4/11/98: translucency filter, -1 == none
212 int firsttag
,nexttag
; // killough 4/17/98: improves searches for tags.
213 int r_validcount
; // cph: if == gametic, r_flags already done
220 // Sector list node showing all sectors an object appears in.
222 // There are two threads that flow through these nodes. The first thread
223 // starts at touching_thinglist in a sector_t and flows through the m_snext
224 // links to find all mobjs that are entirely or partially in the sector.
225 // The second thread starts at touching_sectorlist in an mobj_t and flows
226 // through the m_tnext links to find all sectors a thing touches. This is
227 // useful when applying friction or push effects to sectors. These effects
228 // can be done as thinkers that act upon all objects touching their sectors.
229 // As an mobj moves through the world, these nodes are created and
230 // destroyed, with the links changed appropriately.
232 // For the links, NULL means top or end of list.
234 typedef struct msecnode_s
236 sector_t
*m_sector
; // a sector containing this object
237 struct mobj_s
*m_thing
; // this object
238 struct msecnode_s
*m_tprev
; // prev msecnode_t for this thing
239 struct msecnode_s
*m_tnext
; // next msecnode_t for this thing
240 struct msecnode_s
*m_sprev
; // prev msecnode_t for this sector
241 struct msecnode_s
*m_snext
; // next msecnode_t for this sector
242 boolean visited
; // killough 4/4/98, 4/7/98: used in search algorithms
259 // Sector references.
260 // Could be retrieved from linedef, too
261 // (but that would be slower -- killough)
262 // backsector is NULL for one sided lines
264 sector_t
*frontsector
, *backsector
;
270 // References a Sector.
271 // Basically, this is a list of LineSegs,
272 // indicating the visible walls that define
273 // (all or some) sides of a convex BSP leaf.
276 typedef struct subsector_s
279 unsigned short numlines
, firstline
;
288 fixed_t x
, y
, dx
, dy
; // Partition line.
289 fixed_t bbox
[2][4]; // Bounding box for each child.
290 unsigned short children
[2]; // If NF_SUBSECTOR its a subsector.
294 // posts are runs of non masked source pixels
297 byte topdelta
; // -1 is the last post in a column
298 byte length
; // length data bytes follows
302 // column_t is a list of 0 or more post_t, (byte)-1 terminated
303 typedef post_t column_t
;
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 use even more than 32 levels.
315 typedef byte lighttable_t
;
318 // Masked 2s linedefs
320 typedef struct drawseg_s
324 fixed_t scale1
, scale2
, scalestep
;
325 int silhouette
; // 0=none, 1=bottom, 2=top, 3=both
326 fixed_t bsilheight
; // do not clip sprites above this
327 fixed_t tsilheight
; // do not clip sprites below this
329 // Pointers to lists for sprite clipping,
330 // all three adjusted so [x1] is first value.
331 short *sprtopclip
, *sprbottomclip
, *maskedtexturecol
;
338 // A patch holds one or more columns.
339 // Patches are used for sprites and all masked pictures,
340 // and we compose textures from the TEXTURE1/2 lists
346 short width
, height
; // bounding box size
347 short leftoffset
; // pixels to the left of origin
348 short topoffset
; // pixels below the origin
349 int columnofs
[8]; // only [width] used
353 // proff: Added for OpenGL
357 int leftoffset
,topoffset
;
363 // A vissprite_t is a thing that will be drawn during a refresh.
364 // i.e. a sprite object that is partly visible.
367 typedef struct vissprite_s
370 fixed_t gx
, gy
; // for line side calculation
371 fixed_t gz
, gzt
; // global bottom / top for silhouette clipping
372 fixed_t startfrac
; // horizontal position of x1
374 fixed_t xiscale
; // negative if flipped
379 // for color translation and shadow draw, maxbright frames as well
380 lighttable_t
*colormap
;
382 // killough 3/27/98: height sector for underwater/fake ceiling support
388 // Sprites are patches with a special naming convention
389 // so they can be recognized by R_InitSprites.
390 // The base name is NNNNFx or NNNNFxFx, with
391 // x indicating the rotation, x = 0, 1-7.
392 // The sprite and frame specified by a thing_t
393 // is range checked at run time.
394 // A sprite is a patch_t that is assumed to represent
395 // a three dimensional object and may have multiple
396 // rotations pre drawn.
397 // Horizontal flipping is used to save space,
398 // thus NNNNF2F5 defines a mirrored patch.
399 // Some sprites will only have one picture used
400 // for all views: NNNNF0
404 // If false use 0 for any position.
405 // Note: as eight entries are available,
406 // we might as well insert the same name eight times.
409 // Lump to use for view angles 0-7.
412 // Flip bit (1 = flip) to use for view angles 0-7.
419 // A sprite definition:
420 // a number of animation frames.
426 spriteframe_t
*spriteframes
;
431 // Now what is a visplane, anyway?
433 typedef struct visplane
435 struct visplane
*next
; // Next visplane in hash chain -- killough
436 int picnum
, lightlevel
, minx
, maxx
;
438 fixed_t xoffs
, yoffs
; // killough 2/28/98: Support scrolling flats
439 unsigned short pad1
; // leave pads for [minx-1]/[maxx+1]
440 unsigned short top
[MAX_SCREENWIDTH
];
441 unsigned short pad2
, pad3
; // killough 2/8/98, 4/25/98
442 unsigned short bottom
[MAX_SCREENWIDTH
];