Odamex
Setting the Standard in Multiplayer Doom
common/doomdata.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*- 
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: doomdata.h 1829 2010-09-01 03:20:23Z mike $
00005 //
00006 // Copyright (C) 1993-1996 by id Software, Inc.
00007 // Copyright (C) 2006-2010 by The Odamex Team.
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // DESCRIPTION:
00020 //  all external data is defined here
00021 //  most of the data is loaded into different structures at run time
00022 //  some internal structures shared by many modules are here
00023 //
00024 //-----------------------------------------------------------------------------
00025 
00026 
00027 #ifndef __DOOMDATA__
00028 #define __DOOMDATA__
00029 
00030 // The most basic types we use, portability.
00031 #include "doomtype.h"
00032 
00033 // Some global defines, that configure the game.
00034 #include "doomdef.h"
00035 
00036 
00037 
00038 //
00039 // Map level types.
00040 // The following data structures define the persistent format
00041 // used in the lumps of the WAD files.
00042 //
00043 
00044 // Lump order in a map WAD: each map needs a couple of lumps
00045 // to provide a complete scene geometry description.
00046 enum
00047 {
00048         ML_LABEL,                       // A separator, name, ExMx or MAPxx
00049         ML_THINGS,                      // Monsters, items
00050         ML_LINEDEFS,            // LineDefs, from editing
00051         ML_SIDEDEFS,            // SideDefs, from editing
00052         ML_VERTEXES,            // Vertices, edited and BSP splits generated
00053         ML_SEGS,                        // LineSegs, from LineDefs split by BSP
00054         ML_SSECTORS,            // SubSectors, list of LineSegs
00055         ML_NODES,                       // BSP nodes
00056         ML_SECTORS,                     // Sectors, from editing
00057         ML_REJECT,                      // LUT, sector-sector visibility
00058         ML_BLOCKMAP,                    // LUT, motion clipping, walls/grid element
00059         ML_BEHAVIOR                     // [RH] Hexen-style scripts. If present, THINGS
00060                                                 //              and LINEDEFS are also Hexen-style.      
00061 };
00062 
00063 
00064 // A single Vertex.
00065 typedef struct
00066 {
00067         short           x;
00068         short           y;
00069 } mapvertex_t;
00070 
00071 // A SideDef, defining the visual appearance of a wall,
00072 // by setting textures and offsets.
00073 typedef struct
00074 {
00075         short   textureoffset;
00076         short   rowoffset;
00077         char    toptexture[8];
00078         char    bottomtexture[8];
00079         char    midtexture[8];
00080         short   sector; // Front sector, towards viewer.
00081 } mapsidedef_t;
00082 
00083 // A LineDef, as used for editing, and as input to the BSP builder.
00084 typedef struct
00085 {
00086         unsigned short  v1;
00087         unsigned short  v2;
00088         short   flags;
00089         short   special;
00090         short   tag;
00091         // sidenum[1] will be -1 if one sided
00092         short           sidenum[2];             
00093 } maplinedef_t;
00094 
00095 // A ZDoom style LineDef, from the Doom Wiki.
00096 typedef struct
00097 {
00098         unsigned short  v1;
00099         unsigned short  v2;
00100         short   flags;
00101         byte    special;
00102         byte    args[5];
00103         // sidenum[1] will be -1 if one sided
00104         short           sidenum[2];             
00105 } maplinedef2_t;
00106 
00107 //
00108 // LineDef attributes.
00109 //
00110 
00111 #define ML_BLOCKING                     0x0001  // solid, is an obstacle
00112 #define ML_BLOCKMONSTERS        0x0002  // blocks monsters only
00113 #define ML_TWOSIDED                     0x0004  // backside will not be present at all if not two sided
00114 
00115 // If a texture is pegged, the texture will have
00116 // the end exposed to air held constant at the
00117 // top or bottom of the texture (stairs or pulled
00118 // down things) and will move with a height change
00119 // of one of the neighbor sectors.
00120 // Unpegged textures always have the first row of
00121 // the texture at the top pixel of the line for both
00122 // top and bottom textures (use next to windows).
00123 
00124 
00125 #define ML_DONTPEGTOP           0x0008  // upper texture unpegged
00126 #define ML_DONTPEGBOTTOM        0x0010  // lower texture unpegged
00127 #define ML_SECRET                       0x0020  // don't map as two sided: IT'S A SECRET!
00128 #define ML_SOUNDBLOCK           0x0040  // don't let sound cross two of these
00129 #define ML_DONTDRAW             0x0080  // don't draw on the automap
00130 #define ML_MAPPED                       0x0100  // set if already drawn in automap
00131 #define ML_REPEAT_SPECIAL       0x0200  // special is repeatable
00132 #define ML_SPAC_SHIFT           10
00133 #define ML_SPAC_MASK            0x1c00
00134 #define GET_SPAC(flags)         ((flags&ML_SPAC_MASK)>>ML_SPAC_SHIFT)
00135 
00136 // Special activation types
00137 #define SPAC_CROSS              0       // when player crosses line
00138 #define SPAC_USE                1       // when player uses line
00139 #define SPAC_MCROSS             2       // when monster crosses line
00140 #define SPAC_IMPACT             3       // when projectile hits line
00141 #define SPAC_PUSH               4       // when player/monster pushes line
00142 #define SPAC_PCROSS             5       // when projectile crosses line
00143 #define SPAC_USETHROUGH 6       // SPAC_USE, but passes it through
00144 #define SPAC_CROSSTHROUGH 7 // SPAC_CROSS, but passes it through
00145 
00146 // [RH] Monsters (as well as players) can active the line
00147 #define ML_MONSTERSCANACTIVATE          0x2000
00148 
00149 // [RH] BOOM's ML_PASSUSE flag (conflicts with ML_REPEATSPECIAL)
00150 #define ML_PASSUSE_BOOM                         0x0200
00151 
00152 // [RH] Line blocks everything
00153 #define ML_BLOCKEVERYTHING                      0x8000
00154 
00155 // Sector definition, from editing
00156 typedef struct
00157 {
00158         short   floorheight;
00159         short   ceilingheight;
00160         char    floorpic[8];
00161         char    ceilingpic[8];
00162         short   lightlevel;
00163         short   special;
00164         short   tag;
00165 } mapsector_t;
00166 
00167 // SubSector, as generated by BSP
00168 typedef struct
00169 {
00170         short   numsegs;
00171         short   firstseg;       // index of first one, segs are stored sequentially
00172 } mapsubsector_t;
00173 
00174 
00175 // LineSeg, generated by splitting LineDefs
00176 // using partition lines selected by BSP builder.
00177 typedef struct
00178 {
00179         short   v1;
00180         short   v2;
00181         short   angle;
00182         short   linedef;
00183         short   side;
00184         short   offset;
00185 } mapseg_t;
00186 
00187 
00188 
00189 // BSP node structure.
00190 
00191 // Indicate a leaf.
00192 #define NF_SUBSECTOR    0x8000
00193 
00194 typedef struct
00195 {
00196   // Partition line from (x,y) to x+dx,y+dy)
00197         short           x;
00198         short           y;
00199         short           dx;
00200         short           dy;
00201         
00202   // Bounding box for each child,
00203   // clip against view frustum.
00204         short           bbox[2][4];
00205         
00206   // If NF_SUBSECTOR its a subsector,
00207   // else it's a node of another subtree.
00208         unsigned short  children[2];
00209         
00210 } mapnode_t;
00211 
00212 // Thing definition, position, orientation and type,
00213 // plus skill/visibility flags and attributes.
00214 typedef struct
00215 {
00216         short           x;
00217         short           y;
00218         short           angle;
00219         short           type;
00220         short           options;
00221 } mapthing_t;
00222 
00223 // [RH] Hexen-compatible MapThing.
00224 typedef struct MapThing
00225 {
00226         unsigned short thingid;
00227         short           x;
00228         short           y;
00229         short           z;
00230         short           angle;
00231         short           type;
00232         short           flags;
00233         byte            special;
00234         byte            args[5];
00235 
00236         void Serialize (FArchive &);
00237 } mapthing2_t;
00238 
00239 
00240 // [RH] MapThing flags.
00241 
00242 /*
00243 #define MTF_EASY                        0x0001  // Thing will appear on easy skill setting
00244 #define MTF_MEDIUM                      0x0002  // Thing will appear on medium skill setting
00245 #define MTF_HARD                        0x0004  // Thing will appear on hard skill setting
00246 #define MTF_AMBUSH                      0x0008  // Thing is deaf
00247 */
00248 #define MTF_DORMANT                     0x0010  // Thing is dormant (use Thing_Activate)
00249 #define MTF_SINGLE                      0x0100  // Thing appears in single-player games
00250 #define MTF_COOPERATIVE         0x0200  // Thing appears in cooperative games
00251 #define MTF_DEATHMATCH          0x0400  // Thing appears in deathmatch games
00252 
00253 
00254 // BOOM and DOOM compatible versions of some of the above
00255 
00256 #define BTF_NOTSINGLE           0x0010  // (TF_COOPERATIVE|TF_DEATHMATCH)
00257 #define BTF_NOTDEATHMATCH       0x0020  // (TF_SINGLE|TF_COOPERATIVE)
00258 #define BTF_NOTCOOPERATIVE      0x0040  // (TF_SINGLE|TF_DEATHMATCH)
00259 
00260 //
00261 // Texture definition.
00262 // Each texture is composed of one or more patches,
00263 // with patches being lumps stored in the WAD.
00264 // The lumps are referenced by number, and patched
00265 // into the rectangular texture space using origin
00266 // and possibly other attributes.
00267 //
00268 typedef struct
00269 {
00270         short   originx;
00271         short   originy;
00272         short   patch;
00273         short   stepdir;
00274         short   colormap;
00275 } mappatch_t;
00276 
00277 //
00278 // Texture definition.
00279 // A DOOM wall texture is a list of patches
00280 // which are to be combined in a predefined order.
00281 //
00282 typedef struct
00283 {
00284         char            name[8];
00285         BOOL            masked; 
00286         short           width;
00287         short           height;
00288         byte            columndirectory[4];     // OBSOLETE
00289         short           patchcount;
00290         mappatch_t      patches[1];
00291 } maptexture_t;
00292 
00293 
00294 
00295 
00296 #endif                                  // __DOOMDATA__
00297 
00298 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends