DOOMDATA.H 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. // DoomData.h
  2. // all external data is defined here
  3. // most of the data is loaded into different structures at run time
  4. #ifndef __DOOMDATA__
  5. #define __DOOMDATA__
  6. #ifndef __BYTEBOOL__
  7. #define __BYTEBOOL__
  8. typedef enum {false, true} boolean;
  9. typedef unsigned char byte;
  10. #endif
  11. /*
  12. ===============================================================================
  13. map level types
  14. ===============================================================================
  15. */
  16. // lump order in a map wad
  17. enum {ML_LABEL, ML_THINGS, ML_LINEDEFS, ML_SIDEDEFS, ML_VERTEXES, ML_SEGS,
  18. ML_SSECTORS, ML_NODES, ML_SECTORS , ML_REJECT, ML_BLOCKMAP};
  19. typedef struct
  20. {
  21. short x,y;
  22. } mapvertex_t;
  23. typedef struct
  24. {
  25. short textureoffset;
  26. short rowoffset;
  27. char toptexture[8], bottomtexture[8], midtexture[8];
  28. short sector; // on viewer's side
  29. } mapsidedef_t;
  30. typedef struct
  31. {
  32. short v1, v2;
  33. short flags;
  34. short special, tag;
  35. short sidenum[2]; // sidenum[1] will be -1 if one sided
  36. } maplinedef_t;
  37. #define ML_BLOCKING 1
  38. #define ML_BLOCKMONSTERS 2
  39. #define ML_TWOSIDED 4 // backside will not be present at all
  40. // if not two sided
  41. // if a texture is pegged, the texture will have the end exposed to air held
  42. // constant at the top or bottom of the texture (stairs or pulled down things)
  43. // and will move with a height change of one of the neighbor sectors
  44. // Unpegged textures allways have the first row of the texture at the top
  45. // pixel of the line for both top and bottom textures (windows)
  46. #define ML_DONTPEGTOP 8
  47. #define ML_DONTPEGBOTTOM 16
  48. #define ML_SECRET 32 // don't map as two sided: IT'S A SECRET!
  49. #define ML_SOUNDBLOCK 64 // don't let sound cross two of these
  50. #define ML_DONTDRAW 128 // don't draw on the automap
  51. #define ML_MAPPED 256 // set if allready drawn in automap
  52. typedef struct
  53. {
  54. short floorheight, ceilingheight;
  55. char floorpic[8], ceilingpic[8];
  56. short lightlevel;
  57. short special, tag;
  58. } mapsector_t;
  59. typedef struct
  60. {
  61. short numsegs;
  62. short firstseg; // segs are stored sequentially
  63. } mapsubsector_t;
  64. typedef struct
  65. {
  66. short v1, v2;
  67. short angle;
  68. short linedef, side;
  69. short offset;
  70. } mapseg_t;
  71. enum {BOXTOP,BOXBOTTOM,BOXLEFT,BOXRIGHT}; // bbox coordinates
  72. #define NF_SUBSECTOR 0x8000
  73. typedef struct
  74. {
  75. short x,y,dx,dy; // partition line
  76. short bbox[2][4]; // bounding box for each child
  77. unsigned short children[2]; // if NF_SUBSECTOR its a subsector
  78. } mapnode_t;
  79. typedef struct
  80. {
  81. short x,y;
  82. short angle;
  83. short type;
  84. short options;
  85. } mapthing_t;
  86. #define MTF_EASY 1
  87. #define MTF_NORMAL 2
  88. #define MTF_HARD 4
  89. #define MTF_AMBUSH 8
  90. /*
  91. ===============================================================================
  92. texture definition
  93. ===============================================================================
  94. */
  95. typedef struct
  96. {
  97. short originx;
  98. short originy;
  99. short patch;
  100. short stepdir;
  101. short colormap;
  102. } mappatch_t;
  103. typedef struct
  104. {
  105. char name[8];
  106. boolean masked;
  107. short width;
  108. short height;
  109. void **columndirectory; // OBSOLETE
  110. short patchcount;
  111. mappatch_t patches[1];
  112. } maptexture_t;
  113. /*
  114. ===============================================================================
  115. graphics
  116. ===============================================================================
  117. */
  118. // posts are runs of non masked source pixels
  119. typedef struct
  120. {
  121. byte topdelta; // -1 is the last post in a column
  122. byte length;
  123. // length data bytes follows
  124. } post_t;
  125. // column_t is a list of 0 or more post_t, (byte)-1 terminated
  126. typedef post_t column_t;
  127. // a patch holds one or more columns
  128. // patches are used for sprites and all masked pictures
  129. typedef struct
  130. {
  131. short width; // bounding box size
  132. short height;
  133. short leftoffset; // pixels to the left of origin
  134. short topoffset; // pixels below the origin
  135. int columnofs[8]; // only [width] used
  136. // the [0] is &columnofs[width]
  137. } patch_t;
  138. // a pic is an unmasked block of pixels
  139. typedef struct
  140. {
  141. byte width,height;
  142. byte data;
  143. } pic_t;
  144. /*
  145. ===============================================================================
  146. status
  147. ===============================================================================
  148. */
  149. #endif // __DOOMDATA__