| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 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 |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* Refresh/rendering module, shared data struct definitions. |
| 31 |
* |
| 32 |
*-----------------------------------------------------------------------------*/ |
| 33 |
|
| 34 |
#ifndef __R_DEFS__ |
| 35 |
#define __R_DEFS__ |
| 36 |
|
| 37 |
// Screenwidth. |
| 38 |
#include "doomdef.h" |
| 39 |
|
| 40 |
// Some more or less basic data types |
| 41 |
// we depend on. |
| 42 |
#include "m_fixed.h" |
| 43 |
|
| 44 |
// We rely on the thinker data struct |
| 45 |
// to handle sound origins in sectors. |
| 46 |
#include "d_think.h" |
| 47 |
|
| 48 |
// SECTORS do store MObjs anyway. |
| 49 |
#include "p_mobj.h" |
| 50 |
|
| 51 |
// Silhouette, needed for clipping Segs (mainly) |
| 52 |
// and sprites representing things. |
| 53 |
#define SIL_NONE 0 |
| 54 |
#define SIL_BOTTOM 1 |
| 55 |
#define SIL_TOP 2 |
| 56 |
#define SIL_BOTH 3 |
| 57 |
|
| 58 |
#define MAXDRAWSEGS 256 |
| 59 |
|
| 60 |
// |
| 61 |
// INTERNAL MAP TYPES |
| 62 |
// used by play and refresh |
| 63 |
// |
| 64 |
|
| 65 |
// |
| 66 |
// Your plain vanilla vertex. |
| 67 |
// Note: transformed values not buffered locally, |
| 68 |
// like some DOOM-alikes ("wt", "WebView") do. |
| 69 |
// |
| 70 |
typedef struct |
| 71 |
{ |
| 72 |
fixed_t x, y; |
| 73 |
// [crispy] remove slime trails |
| 74 |
// pseudovertexes are dummies that have their coordinates modified to get |
| 75 |
// moved towards the linedef associated with their seg by projecting them |
| 76 |
// using the law of cosines in p_setup.c:P_RemoveSlimeTrails(); |
| 77 |
// they are *only* used in rendering |
| 78 |
fixed_t px; |
| 79 |
fixed_t py; |
| 80 |
} vertex_t; |
| 81 |
|
| 82 |
// Each sector has a degenmobj_t in its center for sound origin purposes. |
| 83 |
typedef struct |
| 84 |
{ |
| 85 |
thinker_t thinker; // not used for anything |
| 86 |
fixed_t x, y, z; |
| 87 |
} degenmobj_t; |
| 88 |
|
| 89 |
// |
| 90 |
// The SECTORS record, at runtime. |
| 91 |
// Stores things/mobjs. |
| 92 |
// |
| 93 |
|
| 94 |
#define NO_TOPTEXTURES 0x00000001 |
| 95 |
#define NO_BOTTOMTEXTURES 0x00000002 |
| 96 |
#define SECTOR_IS_CLOSED 0x00000004 |
| 97 |
#define NULL_SECTOR 0x00000008 |
| 98 |
#define MISSING_TOPTEXTURES 0x00000010 |
| 99 |
#define MISSING_BOTTOMTEXTURES 0x00000020 |
| 100 |
#define SECF_SECRET 0x00000040 |
| 101 |
#define SECF_WASSECRET 0x00000080 |
| 102 |
#define SECF_HIDDEN 0x00000100 |
| 103 |
#define SECF_ENDGODMODE 0x00000200 |
| 104 |
#define SECF_ENDLEVEL 0x00000400 |
| 105 |
#define SECF_DMGTERRAINFX 0x00000800 |
| 106 |
#define SECF_HAZARD 0x00001000 |
| 107 |
#define SECF_DMGUNBLOCKABLE 0x00002000 |
| 108 |
#define SECF_FRICTION 0x00004000 |
| 109 |
#define SECF_PUSH 0x00008000 |
| 110 |
#define SECF_NOATTACK 0x00010000 |
| 111 |
#define SECF_SILENT 0x00020000 |
| 112 |
#define SECF_LIGHTFLOORABSOLUTE 0x00040000 |
| 113 |
#define SECF_LIGHTCEILINGABSOLUTE 0x00080000 |
| 114 |
#define SECF_DAMAGEFLAGS (SECF_ENDGODMODE|SECF_ENDLEVEL|SECF_DMGTERRAINFX|SECF_HAZARD|SECF_DMGUNBLOCKABLE) |
| 115 |
#define SECF_TRANSFERMASK (SECF_SECRET|SECF_WASSECRET|SECF_DAMAGEFLAGS|SECF_FRICTION|SECF_PUSH) |
| 116 |
|
| 117 |
typedef struct |
| 118 |
{ |
| 119 |
short amount; |
| 120 |
byte leakrate; |
| 121 |
byte interval; |
| 122 |
} damage_t; |
| 123 |
|
| 124 |
typedef struct sector_s |
| 125 |
{ |
| 126 |
int iSectorID; // proff 04/05/2000: needed for OpenGL and used in debugmode by the HUD to draw sectornum |
| 127 |
unsigned int flags; //e6y: instead of .no_toptextures and .no_bottomtextures |
| 128 |
fixed_t floorheight; |
| 129 |
fixed_t ceilingheight; |
| 130 |
byte soundtraversed; // 0 = untraversed, 1,2 = sndlines-1 |
| 131 |
mobj_t *soundtarget; // thing that made a sound (or null) |
| 132 |
int blockbox[4]; // mapblock bounding box for height changes |
| 133 |
int bbox[4]; // bounding box in map units |
| 134 |
degenmobj_t soundorg; // origin for any sounds played by the sector |
| 135 |
int validcount; // if == validcount, already checked |
| 136 |
// Needed by GL path to register flats in sector for rendering only once |
| 137 |
int gl_validcount; |
| 138 |
mobj_t *thinglist; // list of mobjs in sector |
| 139 |
|
| 140 |
/* killough 8/28/98: friction is a sector property, not an mobj property. |
| 141 |
* these fields used to be in mobj_t, but presented performance problems |
| 142 |
* when processed as mobj properties. Fix is to make them sector properties. |
| 143 |
*/ |
| 144 |
int friction,movefactor; |
| 145 |
|
| 146 |
// thinker_t for reversable actions |
| 147 |
void *floordata; // jff 2/22/98 make thinkers on |
| 148 |
void *ceilingdata; // floors, ceilings, and lights independent |
| 149 |
void *lightingdata; |
| 150 |
|
| 151 |
// jff 2/26/98 lockout machinery for stairbuilding |
| 152 |
signed char stairlock; // -2 on first locked -1 after thinker done 0 normally |
| 153 |
int prevsec; // -1 or number of sector for previous step |
| 154 |
int nextsec; // -1 or number of next step sector |
| 155 |
|
| 156 |
// killough 3/7/98: support flat heights drawn at another sector's heights |
| 157 |
int heightsec; // other sector, or -1 if no other sector |
| 158 |
|
| 159 |
// killough 4/4/98: dynamic colormaps |
| 160 |
short bottommap; |
| 161 |
short midmap; |
| 162 |
short topmap; |
| 163 |
short colormap; |
| 164 |
|
| 165 |
// list of mobjs that are at least partially in the sector |
| 166 |
// thinglist is a subset of touching_thinglist |
| 167 |
struct msecnode_s *touching_thinglist; // phares 3/14/98 |
| 168 |
|
| 169 |
int linecount; |
| 170 |
struct line_s **lines; |
| 171 |
|
| 172 |
int floorsky; |
| 173 |
int ceilingsky; |
| 174 |
|
| 175 |
// killough 3/7/98: floor and ceiling texture offsets |
| 176 |
fixed_t floor_xoffs, floor_yoffs; |
| 177 |
fixed_t ceiling_xoffs, ceiling_yoffs; |
| 178 |
|
| 179 |
// killough 4/11/98: support for lightlevels coming from another sector |
| 180 |
int floorlightsec, ceilinglightsec; |
| 181 |
|
| 182 |
short floorpic; |
| 183 |
short ceilingpic; |
| 184 |
short lightlevel; |
| 185 |
short special; |
| 186 |
short tag; |
| 187 |
|
| 188 |
// [kb] For R_FixWiggle |
| 189 |
int cachedheight; |
| 190 |
int scaleindex; |
| 191 |
|
| 192 |
//e6y |
| 193 |
int INTERP_SectorFloor; |
| 194 |
int INTERP_SectorCeiling; |
| 195 |
int INTERP_FloorPanning; |
| 196 |
int INTERP_CeilingPanning; |
| 197 |
int fakegroup[2]; |
| 198 |
|
| 199 |
// hexen |
| 200 |
seqtype_t seqType; // stone, metal, heavy, etc... |
| 201 |
|
| 202 |
// zdoom |
| 203 |
fixed_t gravity; |
| 204 |
damage_t damage; |
| 205 |
short lightlevel_floor; |
| 206 |
short lightlevel_ceiling; |
| 207 |
angle_t floor_rotation; |
| 208 |
angle_t ceiling_rotation; |
| 209 |
fixed_t floor_xscale; |
| 210 |
fixed_t floor_yscale; |
| 211 |
fixed_t ceiling_xscale; |
| 212 |
fixed_t ceiling_yscale; |
| 213 |
} sector_t; |
| 214 |
|
| 215 |
// |
| 216 |
// The SideDef. |
| 217 |
// |
| 218 |
|
| 219 |
#define SF_LIGHTABSOLUTE 0x0001 |
| 220 |
// #define SF_LIGHTFOG 0x0002 |
| 221 |
#define SF_NOFAKECONTRAST 0x0004 |
| 222 |
#define SF_SMOOTHLIGHTING 0x0008 |
| 223 |
#define SF_CLIPMIDTEX 0x0010 |
| 224 |
#define SF_WRAPMIDTEX 0x0020 |
| 225 |
// #define SF_NODECALS 0x0040 |
| 226 |
#define SF_LIGHTABSOLUTETOP 0x0080 |
| 227 |
#define SF_LIGHTABSOLUTEMID 0x0100 |
| 228 |
#define SF_LIGHTABSOLUTEBOTTOM 0x0200 |
| 229 |
|
| 230 |
typedef struct |
| 231 |
{ |
| 232 |
fixed_t textureoffset; // add this to the calculated texture column |
| 233 |
fixed_t rowoffset; // add this to the calculated texture top |
| 234 |
short toptexture; // Texture indices. We do not maintain names here. |
| 235 |
short bottomtexture; |
| 236 |
short midtexture; |
| 237 |
sector_t* sector; // Sector the SideDef is facing. |
| 238 |
|
| 239 |
// killough 4/4/98, 4/11/98: highest referencing special linedef's type, |
| 240 |
// or lump number of special effect. Allows texture names to be overloaded |
| 241 |
// for other functions. |
| 242 |
|
| 243 |
int special; |
| 244 |
|
| 245 |
int INTERP_WallPanning; |
| 246 |
|
| 247 |
fixed_t textureoffset_top; |
| 248 |
fixed_t textureoffset_mid; |
| 249 |
fixed_t textureoffset_bottom; |
| 250 |
fixed_t rowoffset_top; |
| 251 |
fixed_t rowoffset_mid; |
| 252 |
fixed_t rowoffset_bottom; |
| 253 |
|
| 254 |
fixed_t scalex_top; |
| 255 |
fixed_t scaley_top; |
| 256 |
fixed_t scalex_mid; |
| 257 |
fixed_t scaley_mid; |
| 258 |
fixed_t scalex_bottom; |
| 259 |
fixed_t scaley_bottom; |
| 260 |
|
| 261 |
int lightlevel; |
| 262 |
int lightlevel_top; |
| 263 |
int lightlevel_mid; |
| 264 |
int lightlevel_bottom; |
| 265 |
unsigned short flags; |
| 266 |
} side_t; |
| 267 |
|
| 268 |
// |
| 269 |
// Move clipping aid for LineDefs. |
| 270 |
// |
| 271 |
typedef enum |
| 272 |
{ |
| 273 |
ST_HORIZONTAL, |
| 274 |
ST_VERTICAL, |
| 275 |
ST_POSITIVE, |
| 276 |
ST_NEGATIVE |
| 277 |
} slopetype_t; |
| 278 |
|
| 279 |
typedef byte r_flags_t; |
| 280 |
#define RF_TOP_TILE 0x01 // Upper texture needs tiling |
| 281 |
#define RF_MID_TILE 0x02 // Mid texture needs tiling |
| 282 |
#define RF_BOT_TILE 0x04 // Lower texture needs tiling |
| 283 |
#define RF_IGNORE 0x08 // Renderer can skip this line |
| 284 |
#define RF_CLOSED 0x10 // Line blocks view |
| 285 |
#define RF_ISOLATED 0x20 // Isolated line |
| 286 |
|
| 287 |
typedef enum |
| 288 |
{ |
| 289 |
ams_default, |
| 290 |
ams_one_sided, |
| 291 |
ams_two_sided, |
| 292 |
ams_floor_diff, |
| 293 |
ams_ceiling_diff, |
| 294 |
ams_extra_floor, |
| 295 |
ams_special, |
| 296 |
ams_secret, |
| 297 |
ams_unseen, |
| 298 |
ams_locked, |
| 299 |
ams_teleport, |
| 300 |
ams_exit, |
| 301 |
ams_exit_secret, |
| 302 |
ams_unseen_secret, |
| 303 |
ams_portal, |
| 304 |
|
| 305 |
ams_invisible, |
| 306 |
ams_revealed_secret, |
| 307 |
ams_closed_door, |
| 308 |
} automap_style_t; |
| 309 |
|
| 310 |
typedef unsigned short line_activation_t; |
| 311 |
typedef unsigned int line_flags_t; |
| 312 |
|
| 313 |
typedef struct line_s |
| 314 |
{ |
| 315 |
int iLineID; // proff 04/05/2000: needed for OpenGL |
| 316 |
vertex_t *v1, *v2; // Vertices, from v1 to v2. |
| 317 |
fixed_t dx, dy; // Precalculated v2 - v1 for side checking. |
| 318 |
float texel_length; |
| 319 |
line_flags_t flags; // Animation related. |
| 320 |
short special; |
| 321 |
short tag; |
| 322 |
unsigned short sidenum[2]; // Visual appearance: SideDefs. |
| 323 |
fixed_t bbox[4]; // A bounding box, for the linedef's extent |
| 324 |
slopetype_t slopetype; // To aid move clipping. |
| 325 |
sector_t *frontsector; // Front and back sector. |
| 326 |
sector_t *backsector; |
| 327 |
int validcount; // if == validcount, already checked |
| 328 |
int validcount2; |
| 329 |
void *specialdata; // thinker_t for reversable actions |
| 330 |
int r_validcount; // cph: if == gametic, r_flags already done |
| 331 |
r_flags_t r_flags; // cph |
| 332 |
degenmobj_t soundorg; // sound origin for switches/buttons |
| 333 |
|
| 334 |
// dsda |
| 335 |
byte player_activations; |
| 336 |
|
| 337 |
// hexen |
| 338 |
int special_args[5]; |
| 339 |
|
| 340 |
// zdoom |
| 341 |
line_activation_t activation; |
| 342 |
byte locknumber; |
| 343 |
automap_style_t automap_style; |
| 344 |
int health; |
| 345 |
int healthgroup; |
| 346 |
const byte* tranmap; |
| 347 |
float alpha; |
| 348 |
} line_t; |
| 349 |
|
| 350 |
#define LINE_ARG_COUNT 5 |
| 351 |
#define SPECIAL_ARGS_SIZE (5 * sizeof(int)) |
| 352 |
#define COLLAPSE_SPECIAL_ARGS(dest, source) { dest[0] = source[0]; \ |
| 353 |
dest[1] = source[1]; \ |
| 354 |
dest[2] = source[2]; \ |
| 355 |
dest[3] = source[3]; \ |
| 356 |
dest[4] = source[4]; } |
| 357 |
|
| 358 |
// phares 3/14/98 |
| 359 |
// |
| 360 |
// Sector list node showing all sectors an object appears in. |
| 361 |
// |
| 362 |
// There are two threads that flow through these nodes. The first thread |
| 363 |
// starts at touching_thinglist in a sector_t and flows through the m_snext |
| 364 |
// links to find all mobjs that are entirely or partially in the sector. |
| 365 |
// The second thread starts at touching_sectorlist in an mobj_t and flows |
| 366 |
// through the m_tnext links to find all sectors a thing touches. This is |
| 367 |
// useful when applying friction or push effects to sectors. These effects |
| 368 |
// can be done as thinkers that act upon all objects touching their sectors. |
| 369 |
// As an mobj moves through the world, these nodes are created and |
| 370 |
// destroyed, with the links changed appropriately. |
| 371 |
// |
| 372 |
// For the links, NULL means top or end of list. |
| 373 |
|
| 374 |
typedef struct msecnode_s |
| 375 |
{ |
| 376 |
sector_t *m_sector; // a sector containing this object |
| 377 |
struct mobj_s *m_thing; // this object |
| 378 |
struct msecnode_s *m_tprev; // prev msecnode_t for this thing |
| 379 |
struct msecnode_s *m_tnext; // next msecnode_t for this thing |
| 380 |
struct msecnode_s *m_sprev; // prev msecnode_t for this sector |
| 381 |
struct msecnode_s *m_snext; // next msecnode_t for this sector |
| 382 |
dboolean visited; // killough 4/4/98, 4/7/98: used in search algorithms |
| 383 |
} msecnode_t; |
| 384 |
|
| 385 |
// |
| 386 |
// The LineSeg. |
| 387 |
// |
| 388 |
typedef struct |
| 389 |
{ |
| 390 |
vertex_t *v1, *v2; |
| 391 |
side_t* sidedef; |
| 392 |
line_t* linedef; |
| 393 |
// Sector references. |
| 394 |
// Could be retrieved from linedef, too |
| 395 |
// (but that would be slower -- killough) |
| 396 |
// backsector is NULL for one sided lines |
| 397 |
sector_t *frontsector, *backsector; |
| 398 |
fixed_t offset; |
| 399 |
angle_t angle; |
| 400 |
angle_t pangle; // re-calculated angle used for rendering |
| 401 |
uint32_t halflength; // fix long wall wobble |
| 402 |
} seg_t; |
| 403 |
|
| 404 |
typedef struct ssline_s |
| 405 |
{ |
| 406 |
seg_t *seg; |
| 407 |
line_t *linedef; |
| 408 |
fixed_t x1, y1; |
| 409 |
fixed_t x2, y2; |
| 410 |
fixed_t bbox[4]; |
| 411 |
} ssline_t; |
| 412 |
|
| 413 |
// |
| 414 |
// A SubSector. |
| 415 |
// References a Sector. |
| 416 |
// Basically, this is a list of LineSegs, |
| 417 |
// indicating the visible walls that define |
| 418 |
// (all or some) sides of a convex BSP leaf. |
| 419 |
// |
| 420 |
|
| 421 |
struct polyobj_s; |
| 422 |
|
| 423 |
typedef struct subsector_s |
| 424 |
{ |
| 425 |
sector_t *sector; |
| 426 |
// e6y: support for extended nodes |
| 427 |
// 'int' instead of 'short' |
| 428 |
int numlines, firstline; |
| 429 |
|
| 430 |
// hexen |
| 431 |
struct polyobj_s *poly; |
| 432 |
} subsector_t; |
| 433 |
|
| 434 |
|
| 435 |
// |
| 436 |
// BSP node. |
| 437 |
// |
| 438 |
typedef struct |
| 439 |
{ |
| 440 |
fixed_t x, y, dx, dy; // Partition line. |
| 441 |
fixed_t bbox[2][4]; // Bounding box for each child. |
| 442 |
//unsigned short children[2]; // If NF_SUBSECTOR its a subsector. |
| 443 |
int children[2]; // If NF_SUBSECTOR its a subsector. |
| 444 |
} node_t; |
| 445 |
|
| 446 |
// |
| 447 |
// OTHER TYPES |
| 448 |
// |
| 449 |
|
| 450 |
// This could be wider for >8 bit display. |
| 451 |
// Indeed, true color support is posibble |
| 452 |
// precalculating 24bpp lightmap/colormap LUT. |
| 453 |
// from darkening PLAYPAL to all black. |
| 454 |
// Could use even more than 32 levels. |
| 455 |
|
| 456 |
typedef byte lighttable_t; |
| 457 |
|
| 458 |
// |
| 459 |
// Masked 2s linedefs |
| 460 |
// |
| 461 |
|
| 462 |
typedef struct drawseg_s |
| 463 |
{ |
| 464 |
seg_t *curline; |
| 465 |
short x1, x2; |
| 466 |
fixed_t scale1, scale2, scalestep; |
| 467 |
int silhouette; // 0=none, 1=bottom, 2=top, 3=both |
| 468 |
fixed_t bsilheight; // do not clip sprites above this |
| 469 |
fixed_t tsilheight; // do not clip sprites below this |
| 470 |
|
| 471 |
// Pointers to lists for sprite clipping, |
| 472 |
// all three adjusted so [x1] is first value. |
| 473 |
|
| 474 |
int *sprtopclip, *sprbottomclip, *maskedtexturecol; // dropoff overflow |
| 475 |
} drawseg_t; |
| 476 |
|
| 477 |
// proff: Added for OpenGL |
| 478 |
typedef struct |
| 479 |
{ |
| 480 |
int width,height; |
| 481 |
int leftoffset,topoffset; |
| 482 |
int lumpnum; |
| 483 |
} patchnum_t; |
| 484 |
|
| 485 |
// |
| 486 |
// A vissprite_t is a thing that will be drawn during a refresh. |
| 487 |
// i.e. a sprite object that is partly visible. |
| 488 |
// |
| 489 |
|
| 490 |
typedef struct vissprite_s |
| 491 |
{ |
| 492 |
short x1, x2; |
| 493 |
fixed_t gx, gy; // for line side calculation |
| 494 |
fixed_t gz, gzt; // global bottom / top for silhouette clipping |
| 495 |
fixed_t startfrac; // horizontal position of x1 |
| 496 |
fixed_t scale; |
| 497 |
fixed_t xiscale; // negative if flipped |
| 498 |
fixed_t texturemid; |
| 499 |
int patch; |
| 500 |
uint64_t mobjflags; |
| 501 |
|
| 502 |
// for color translation and shadow draw, maxbright frames as well |
| 503 |
const lighttable_t *colormap; |
| 504 |
|
| 505 |
// killough 3/27/98: height sector for underwater/fake ceiling support |
| 506 |
int heightsec; |
| 507 |
|
| 508 |
// hexen |
| 509 |
int pclass; // player class (used in translation) |
| 510 |
fixed_t floorclip; |
| 511 |
|
| 512 |
// zdoom |
| 513 |
const byte* tranmap; |
| 514 |
|
| 515 |
// misc |
| 516 |
int color; |
| 517 |
} vissprite_t; |
| 518 |
|
| 519 |
// |
| 520 |
// Sprites are patches with a special naming convention |
| 521 |
// so they can be recognized by R_InitSprites. |
| 522 |
// The base name is NNNNFx or NNNNFxFx, with |
| 523 |
// x indicating the rotation, x = 0, 1-7. |
| 524 |
// The sprite and frame specified by a thing_t |
| 525 |
// is range checked at run time. |
| 526 |
// A sprite is a patch_t that is assumed to represent |
| 527 |
// a three dimensional object and may have multiple |
| 528 |
// rotations pre drawn. |
| 529 |
// Horizontal flipping is used to save space, |
| 530 |
// thus NNNNF2F5 defines a mirrored patch. |
| 531 |
// Some sprites will only have one picture used |
| 532 |
// for all views: NNNNF0 |
| 533 |
// |
| 534 |
|
| 535 |
typedef struct |
| 536 |
{ |
| 537 |
// If false use 0 for any position. |
| 538 |
// Note: as eight entries are available, |
| 539 |
// we might as well insert the same name eight times. |
| 540 |
int rotate; |
| 541 |
|
| 542 |
// Lump to use for view angles 0-7. |
| 543 |
short lump[16]; |
| 544 |
|
| 545 |
// Flip bit (1 = flip) to use for view angles 0-15. |
| 546 |
unsigned short flip; |
| 547 |
|
| 548 |
} spriteframe_t; |
| 549 |
|
| 550 |
// |
| 551 |
// A sprite definition: |
| 552 |
// a number of animation frames. |
| 553 |
// |
| 554 |
|
| 555 |
typedef struct |
| 556 |
{ |
| 557 |
int numframes; |
| 558 |
spriteframe_t *spriteframes; |
| 559 |
} spritedef_t; |
| 560 |
|
| 561 |
// |
| 562 |
// Now what is a visplane, anyway? |
| 563 |
// |
| 564 |
// Go to http://classicgaming.com/doom/editing/ to find out -- killough |
| 565 |
// |
| 566 |
|
| 567 |
typedef struct visplane |
| 568 |
{ |
| 569 |
struct visplane *next; // Next visplane in hash chain -- killough |
| 570 |
int picnum, lightlevel, minx, maxx; |
| 571 |
int special; // heretic |
| 572 |
fixed_t height; |
| 573 |
fixed_t xoffs, yoffs; // killough 2/28/98: Support scrolling flats |
| 574 |
angle_t rotation; |
| 575 |
fixed_t xscale; |
| 576 |
fixed_t yscale; |
| 577 |
// e6y: resolution limitation is removed |
| 578 |
// bottom and top arrays are dynamically |
| 579 |
// allocated immediately after the visplane |
| 580 |
unsigned short *bottom; |
| 581 |
unsigned short pad1; // leave pads for [minx-1]/[maxx+1] |
| 582 |
unsigned short top[3]; |
| 583 |
|
| 584 |
// NEW FIELDS MUST BE ADDED **ABOVE** `unsigned short *bottom;` |
| 585 |
|
| 586 |
} visplane_t; |
| 587 |
|
| 588 |
// hexen |
| 589 |
|
| 590 |
typedef struct polyobj_s |
| 591 |
{ |
| 592 |
int numsegs; |
| 593 |
seg_t **segs; |
| 594 |
degenmobj_t startSpot; |
| 595 |
vertex_t *originalPts; // used as the base for the rotations |
| 596 |
vertex_t *prevPts; // use to restore the old point values |
| 597 |
angle_t angle; |
| 598 |
int tag; // reference tag assigned in HereticEd |
| 599 |
int bbox[4]; |
| 600 |
int validcount; |
| 601 |
int validcount2; |
| 602 |
dboolean crush; // should the polyobj attempt to crush mobjs? |
| 603 |
dboolean hurt; |
| 604 |
int seqType; |
| 605 |
fixed_t size; // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT) |
| 606 |
void *specialdata; // pointer a thinker, if the poly is moving |
| 607 |
subsector_t *subsector; |
| 608 |
} polyobj_t; |
| 609 |
|
| 610 |
typedef struct polyblock_s |
| 611 |
{ |
| 612 |
polyobj_t *polyobj; |
| 613 |
struct polyblock_s *prev; |
| 614 |
struct polyblock_s *next; |
| 615 |
} polyblock_t; |
| 616 |
|
| 617 |
#define PO_LINE_START 1 // polyobj line start special |
| 618 |
#define PO_LINE_EXPLICIT 5 |
| 619 |
|
| 620 |
extern polyobj_t *polyobjs; // list of all poly-objects on the level |
| 621 |
extern int po_NumPolyobjs; |
| 622 |
|
| 623 |
extern int Sky1Texture; |
| 624 |
extern int Sky2Texture; |
| 625 |
extern fixed_t Sky1ColumnOffset; |
| 626 |
extern fixed_t Sky2ColumnOffset; |
| 627 |
extern dboolean DoubleSky; |
| 628 |
|
| 629 |
#endif |