home *** CD-ROM | disk | FTP | other *** search
/ WADS of WADS / WadsOfWads.1994.zip / TEXT / DMSPEC13.TXT < prev    next >
Text File  |  1994-08-29  |  94KB  |  1,817 lines

  1. ------------------------------------------------------------------------------
  2.                            T H E   U N O F F I C I A L
  3. =================     ===============     ===============   ========  ========
  4. \\ . . . . . . .\\   //. . . . . . .\\   //. . . . . . .\\  \\. . .\\// . . //
  5. ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
  6. || . .||   ||. . || || . .||   ||. . || || . .||   ||. . || ||. . . . . . . ||
  7. ||. . ||   || . .|| ||. . ||   || . .|| ||. . ||   || . .|| || . | . . . . .||
  8. || . .||   ||. _-|| ||-_ .||   ||. . || || . .||   ||. _-|| ||-_.|\ . . . . ||
  9. ||. . ||   ||-'  || ||  `-||   || . .|| ||. . ||   ||-'  || ||  `|\_ . .|. .||
  10. || . _||   ||    || ||    ||   ||_ . || || . _||   ||    || ||   |\ `-_/| . ||
  11. ||_-' ||  .|/    || ||    \|.  || `-_|| ||_-' ||  .|/    || ||   | \  / |-_.||
  12. ||    ||_-'      || ||      `-_||    || ||    ||_-'      || ||   | \  / |  `||
  13. ||    `'         || ||         `'    || ||    `'         || ||   | \  / |   ||
  14. ||            .===' `===.         .==='.`===.         .===' /==. |  \/  |   ||
  15. ||         .=='   \_|-_ `===. .==='   _|_   `===. .===' _-|/   `==  \/  |   ||
  16. ||      .=='    _-'    `-_  `='    _-'   `-_    `='  _-'   `-_  /|  \/  |   ||
  17. ||   .=='    _-'          `-__\._-'         `-_./__-'         `' |. /|  |   ||
  18. ||.=='    _-'                                                     `' |  /==.||
  19. =='    _-'         S         P         E         C         S          \/   `==
  20. \   _-'                                                                `-_   /
  21.  `''                                                                      ``'
  22.                         Release v1.3 - April 13, 1994 EST
  23.                  Written by: Matt Fell (matt.burnett@acebbs.com)
  24.            Distributed by: Hank Leukart (ap641@cleveland.freenet.edu)
  25.             "DOOM: Where hackers gnaw the bones left from the banquet
  26.                  of data prepared by the mighty wizards of id."
  27.            "The poets talk about love, but what I talk about is DOOM,
  28.                   because in the end, DOOM is all that counts."
  29.             - Alex Machine/George Stark/Stephen King, _The Dark Half_
  30. -----------------------------------------------------------------------------
  31.  
  32. ----------
  33. DISCLAIMER
  34. ----------
  35.  
  36.         These specs are to aid in informing the public about the game DOOM,
  37. by id Software.  In no way should this promote your killing yourself, killing
  38. others, or killing in any other fashion.  Additionally, neither Hank Leukart
  39. nor Matt Fell claim ANY responsibility regarding ANY illegal activity
  40. concerning this file, or indirectly related to this file.  The information
  41. contained in this file only reflects id Software indirectly, and questioning
  42. id Software regarding any information in this file is not recommended.
  43.  
  44. ----------------
  45. COPYRIGHT NOTICE
  46. ----------------
  47.  
  48. This article is Copyright 1993, 1994 by Hank Leukart.  All rights reserved.
  49. You are granted the following rights:
  50.  
  51. I.  To make copies of this work in original form, so long as
  52.       (a) the copies are exact and complete;
  53.       (b) the copies include the copyright notice and these paragraphs
  54.           in their entirety;
  55.       (c) the copies give obvious credit to the author, Matt Fell;
  56.       (d) the copies are in electronic form.
  57. II. To distribute this work, or copies made under the provisions
  58.     above, so long as
  59.       (a) this is the original work and not a derivative form;
  60.       (b) you do not charge a fee for copying or for distribution;
  61.       (c) you ensure that the distributed form includes the copyright
  62.           notice, this paragraph, the disclaimer of warranty in
  63.           their entirety and credit to the author;
  64.       (d) the distributed form is not in an electronic magazine or
  65.           within computer software (prior explicit permission may be
  66.           obtained from Hank Leukart);
  67.       (e) the distributed form is the NEWEST version of the article to
  68.           the best of the knowledge of the distributor;
  69.       (f) the distributed form is electronic.
  70.  
  71.         You may not distribute this work by any non-electronic media,
  72. including but not limited to books, newsletters, magazines, manuals,
  73. catalogs, and speech.  You may not distribute this work in electronic
  74. magazines or within computer software without prior written explicit
  75. permission.  These rights are temporary and revocable upon written, oral,
  76. or other notice by Hank Leukart. This copyright notice shall be governed
  77. by the laws of the state of Ohio.
  78.         If you would like additional rights beyond those granted above,
  79. write to the distributor at "ap641@cleveland.freenet.edu" on the Internet.
  80.  
  81. ------------------------------
  82. INTRODUCTION FROM HANK LEUKART
  83. ------------------------------
  84.  
  85.         Here are the long awaited unofficial specs for DOOM.  These specs
  86. should be used for creating add-on software for the game. I would like to
  87. request that these specs be used in making utilities that ONLY work on the
  88. registered version of DOOM.
  89.         I did not write these specs.  I am handling the distribution so
  90. Matt Fell is not bombarded with E-mail with requests for the specs, etc.
  91. If you would like a copy of the specs, E-mail Hank Leukart at
  92. "ap641@cleveland.freenet.edu" on the Internet.  If you would like to ask
  93. technical questions or give technical suggestions about the specs, please
  94. write to Matt Fell at "matt.burnett@acebbs.com".
  95.  
  96.         Literature also written/distributed by Hank Leukart:
  97.  
  98.         - The "Official" DOOM FAQ:  A comprehensive guide to DOOM
  99.         - DOOM iNsAnItY: A humorous look at DOOM and its players
  100.  
  101. --------
  102. CONTENTS
  103. --------
  104.  
  105. [1] Author's Notes
  106.         [1-1] id Software's Copyright
  107.         [1-2] What's New in the 1.3 Specs
  108.         [1-3] Acknowledgments
  109. [2] Basics
  110. [3] Directory Overview
  111. [4] The Maps, The Levels
  112.         [4-1] ExMy
  113.         [4-2] THINGS
  114.                 [4-2-1] Thing Types
  115.                 [4-2-2] Thing Attributes
  116.         [4-3] LINEDEFS
  117.                 [4-3-1] Linedef Attributes
  118.                 [4-3-2] Linedef Types
  119.         [4-4] SIDEDEFS
  120.         [4-5] VERTEXES
  121.         [4-6] SEGS
  122.         [4-7] SSECTORS
  123.         [4-8] NODES
  124.         [4-9] SECTORS
  125.                 [4-9-1] Special Sector Types
  126.         [4-10] REJECT
  127.         [4-11] BLOCKMAP
  128.                 [4-11-1] Automatically Generating the BLOCKMAP
  129. [5] Pictures
  130.         [5-1] Headers
  131.         [5-2] Pointers
  132.         [5-3] Pixel Data
  133. [6] Floor and Ceiling Textures
  134.         [6-1] Animated floors, see [8-4-1]
  135. [7] Songs and Sounds
  136.         [7-1] Songs
  137.         [7-2] Sounds
  138. [8] Some Important Non-Picture Resources
  139.         [8-1] PLAYPAL
  140.         [8-2] COLORMAP
  141.         [8-3] DEMOs
  142.         [8-4] TEXTURE1 and TEXTURE2
  143.                 [8-4-1] Animated Walls
  144.         [8-5] PNAMES
  145.  
  146. ---------------------------
  147. CHAPTER [1]: Author's Notes
  148. ---------------------------
  149.  
  150. [1-1]: id Software's Copyright and the Shareware Version
  151. ========================================================
  152.  
  153. The LICENSE.DOC says:
  154.  
  155.        `You may not:  rent, lease, modify, translate, disassemble, decompile,
  156.         reverse engineer, or create derivative works based upon the Software.
  157.         Notwithstanding the foregoing, you may create a map editor, modify
  158.         maps and make your own maps (collectively referenced as the "Permitted
  159.         Derivative Works") for the Software. You may not sell or distribute
  160.         any Permitted Derivative Works but you may exchange the Permitted
  161.         Derivative Works at no charge amongst other end-users.'
  162.  
  163.        `(except for backup purposes) You may not otherwise reproduce, copy or
  164.         disclose to others, in whole or in any part, the Software.'
  165.  
  166.         I think it is clear that you may not distribute a wad file that
  167. contains any of the original data resources from DOOM.WAD. A level that only
  168. has new things should be distributed as a pwad with only two entries in its
  169. directory (explained below, in chapter [2]) - e.g. E3M1 and THINGS. And the
  170. THINGS resource in the pwad should be substantially different from the
  171. original one in DOOM.WAD. You should not distribute any pwad files that
  172. contain episode one maps. Here's an excerpt from README.EXE:
  173.  
  174.        `id Software respectfully requests that you do not modify the levels
  175.         for the shareware version of DOOM.  We feel that the distribution of
  176.         new levels that work with the shareware version of DOOM will lessen a
  177.         potential user's incentive to purchase the registered version.
  178.  
  179.        `If you would like to work with modified levels of DOOM, we encourage
  180.         you to purchase the registered version of the game.'
  181.  
  182.         Recently, Jay Wilbur of id Software announced the formulation of a
  183. policy on third-party additions to the game. You can find the announcement on
  184. alt.games.doom, and probably lots of other places too. Or you can send me
  185. mail asking for a copy of the announcement. Basically, they are preparing a
  186. document, and if it was done, then I could tell you more, but it isn't
  187. finished at the time I'm writing this.
  188.         If you're making add-ons, plan on them not working on the shareware
  189. game, and plan on including statements about the trademarks and copyrights
  190. that id Software owns, as well as disclaimers that they won't support your
  191. add-on product, nor will they support DOOM after it has been modified.
  192.  
  193. [1-2]: What's New in the 1.3 Specs
  194. ==================================
  195.  
  196.         The main reason for this release of the specs, 1.3, is of course the
  197. explanation of the NODES structure. I've been delaying a little bit, because
  198. I wanted to see if it would be feasible to include a good algorithm herein.
  199. Also, I wanted to wait and see if someone could actually implement "node
  200. theory" in a level editor, thereby verifying it.
  201.         Now the theory HAS been verified. However, the actual implementation
  202. is still being worked on (debugged) as I'm writing this. Also, I don't want
  203. to steal anyone's hard work outright. This means that there is NOT a node
  204. creation algorithm here, but I do outline how one can be done. I have tried
  205. to come up with one on my own, but it is too difficult for me, especially
  206. with all the other things I'm simultaneously doing.
  207.         Where you WILL find pseudo-code is in the BLOCKMAP section. I
  208. borrowed an excellent idea from a contributor, and code based on the
  209. algorithm given here should be very fast. Even huge levels should
  210. recalculate in seconds.
  211.         Another new section completely explains the REJECT resource.
  212.         This entire document has been re-formatted, and there have been
  213. several other additions, and hopefully the last of the typos has been rooted
  214. out. I consider these specs to be at least 95% complete. There are only minor
  215. gaps in the information now. If the promised "official specifications" were
  216. released today, I expect this would compare favorably with them (although
  217. I know exactly what parts of it I would look to first).
  218.         I've been notified of something very disappointing, and after a
  219. couple weeks of trying there seems to be no way around it. The pictures that
  220. are used for sprites (things like barrels, demons, and the player's pistol)
  221. all have to be listed together in one .WAD file. This means that they don't
  222. work from pwad files. The same thing goes for the floor pictures. Luckily,
  223. the walls are done in a more flexible way, so they work in pwads. All this is
  224. explained in chapter [5].
  225.  
  226. [1-3]: Acknowledgments
  227. ======================
  228.  
  229.         I have received much assistance from the following people. They
  230. either brought mistakes to my attention, or provided additional information
  231. that I've incorporated into these specs:
  232.  
  233. Ted Vessenes (tedv@geom.umn.ed)
  234.         I had the THING angles wrong in the original specs.
  235. Matt Tagliaferri (matt.tagliaferri@pcohio.com)
  236.         The author of the DOOMVB40 editor (aka DOOMCAD). I forgot to describe
  237.         the TEXTURE1/2 pointer table in the 1.1 specs. Also, helped with
  238.         linedef types, and provided a good BLOCKMAP algorithm.
  239. Raphael Quinet (quinet@montefiore.ulg.ac.be)
  240.         The author of the NEWDEU editor, now DEU 5, the first editor that can
  241.         actually do the nodes. Go get it. Gave me lots of rigorous
  242.         contributions on linedef types and special sectors.
  243. Robert Fenske (rfenske@swri.edu)
  244.         Part of the team that created the VERDA editor. Gave me a great list
  245.         of the linedef attributes; also helped with linedef types, a blockmap
  246.         list, special sectors, and general tips and suggestions.
  247. John A. Matzen (jamatzen@cs.twsu.edu)
  248.         Instrument names in GENMIDI.
  249. Jeff Bird (jeff@wench.ece.jcu.edu.au)
  250.         Good ideas and suggestions about the NODES, and a blockmap algorithm.
  251. Alistair Brown (A.D.Brown@bradford.ac.uk)
  252.         Helped me understand the NODES; and told me how REJECT works.
  253. Robert D. Potter (potter@bronze.lcs.mit.edu)
  254.         Good theory about what BLOCKMAP is for and how the engine uses it.
  255. Joel Lucsy (jjlucsy@mtu.edu)
  256.         Info on COLORMAP and PLAYPAL.
  257. Tom Nettleship (mastn@midge.bath.ac.uk)
  258.         I learned about BSP trees from his comp.graphics.algorithms messages.
  259. Colin Reed (dyl@cix.compulink.co.uk)
  260.         I had the x upper and lower bounds for node bounding boxes backwards.
  261. Frans P. de Vries (fpdevries@hgl.signaal.nl)
  262.         Thanks for the cool ASCII DOOM logo used for the header.
  263.  
  264.         Thanks for all the help! Sorry if I left anyone out. If you have
  265. any comments or questions, have spotted any errors, or have any possible
  266. additions, please send me e-mail.
  267.  
  268. -------------------
  269. CHAPTER [2]: Basics
  270. -------------------
  271.  
  272.         There are two types of "wad" files. The original DOOM.WAD file is an
  273. "IWAD", or "Internal wad", meaning it contains all of the data necessary to
  274. play. The other type is the "PWAD" file, "Patch wad", an external file which
  275. has the same structure, but with far fewer entries in the directory
  276. (explained below). The data in a pwad is substituted for the original data in
  277. the DOOM.WAD, thus allowing for much easier distribution of new levels. Only
  278. those resources listed in the pwad's directory are changed, everything else
  279. stays the same.
  280.         A typical pwad might contain new data for a single level, in which
  281. case in would contain the 11 entries necessary to define the level. Pwad
  282. files need to have the extension .WAD, and the filename needs to be at least
  283. four characters: X.WAD won't work, but rename it XMEN.WAD, and it will work.
  284. Most of the levels available now are called something like E2L4BOB.WAD,
  285. meaning episode 2, level 4, by "Bob". I think a better scheme is the one just
  286. starting to be used now, two digits for the episode and level, then up to six
  287. letters for the level's name, or its creator's name. For example, if Neil
  288. Peart were to create a new level 6 for episode 3, he might call it
  289. 36NEILP.WAD.
  290.         To use this level instead of the original e3m6 level, a player would
  291. type DOOM -FILE 36NEILP.WAD at the command line, along with any other
  292. parameters. More than one external file can be added at the same time, thus
  293. in general:
  294.  
  295. DOOM -FILE [pwad_filename] [pwad_filename] [pwad_filename] ...
  296.  
  297.         When the game loads, a "modified game" message will appear if there
  298. are any pwads involved, reminding the player that id Software will not give
  299. technical support or answer questions regarding modified levels.
  300.         A pwad file may contain more than one level or parts of levels, in
  301. fact there is apparently no limit to how many entries may be in a pwad. The
  302. original doom levels are pretty complicated, and they are from 50-200
  303. kilobytes in size, uncompressed. Simple prototype levels are just a few k.
  304.         The first twelve bytes of a wad file are as follows:
  305.  
  306. Bytes 0 to 3    must contain the ASCII letters "IWAD" or "PWAD"
  307. Bytes 4 to 7    contain a long integer which is the number of entries in the
  308.                 "directory"
  309. Bytes 8 to 11   contain a pointer to the first byte of the "directory"
  310.  
  311.         Bytes 12 to the start of the directory contain resource data. The
  312. directory referred to is a list, located at the end of the wad file, which
  313. contains the pointers, lengths, and names of all the resources in the wad
  314. file. The resources in the wad include item pictures, monster's pictures for
  315. animation, wall patches, floor and ceiling textures, songs, sound effects,
  316. map data, and many others.
  317.         As an example, the first 12 bytes of the DOOM.WAD file might be
  318. "49 57 41 44 d4 05 00 00 c9 fd 6c 00" (in hexadecimal). This is "IWAD", then
  319. 5d4 hex (=1492 decimal) for the number of directory entries, then 6cfdc9 hex
  320. (=7142857 decimal) for the first byte of the directory.
  321.         Each directory entry is 16 bytes long, arranged this way:
  322.  
  323. First four bytes:       pointer to start of resource (a long integer)
  324. Next four bytes:        length of resource (another long integer)
  325. Last eight bytes:       name of resource, in ASCII letters, ending with
  326.                         00s if less than eight bytes.
  327.  
  328. -------------------------------
  329. CHAPTER [3]: Directory Overview
  330. -------------------------------
  331.  
  332.         This is a list of most of the directory entries. It would take 2000
  333. lines to list every single entry, and that would be silly. All the ST entries
  334. are for status bar pictures, so why list every one? And the naming convention
  335. for the 700 sprites is easy (see chapter [5]), so there's no need to list
  336. them all individually.
  337.  
  338. PLAYPAL   contains fourteen 256 color palettes, used while playing Doom.
  339. COLORMAP  maps colors in the palette down to darker ones, for areas of less
  340.             than maximum brightness (quite a few of these places, huh?).
  341. ENDOOM    is the text message displayed when you exit to DOS.
  342. DEMOx     x=1-3, are the demos which will play if you just sit and watch.
  343. E1M1      etc, to E3M9, along with its 10 subsequent entries, defines the
  344.           map data for a single level or mission.
  345. TEXTURE1  is a list of wall type names used in the SIDEDEF portion of each
  346.             level , and their composition data, i.e. what wall patches make
  347.             up each texture.
  348. TEXTURE2  contains the walls that are only in the registered version.
  349. PNAMES    is the list of wall patches, which are referenced by number in the
  350.             TEXTURE1/2 resources.
  351. GENMIDI   has the names of every General Midi standard instrument in order
  352.             from 0-127. Anyone know more...?
  353. DMXGUS    obviously has to do with Gravis Ultra Sound. It's a text file, easy
  354.             to read. Just extract it (WadTool works nicely).
  355. D_ExMy    is the music for episode x level y.
  356. D_INTER   is the music played on the summary screen between levels.
  357. D_INTRO   is the 4 second music played when the game starts.
  358. D_INTROA  is also introductory music.
  359. D_VICTOR  is the music played on the victory text-screen after an episode.
  360. D_BUNNY   is music for while a certain rabbit has his story told...
  361. DP_xxxxx  DP and DS come in pairs and are the sound effects. DP_ are the PC
  362. DS_xxxxx    speaker sounds, DS_ are the sound card sounds.
  363.  
  364.         All the remaining entries in the directory, except the floor textures
  365. at the end, and the "separators" like S_START, refer to resources which are
  366. pictures, in the doom/wad picture format described in chapter [5]. The floor
  367. textures are also pictures, but in a raw format described in chapter [6].
  368.         The next seven are full screen (320 by 200 pixel) pictures:
  369.  
  370. HELP1     The ad-screen that says Register!, with some screen shots.
  371. HELP2     The actual help, all the controls explained.
  372. TITLEPIC  Maybe this is the title screen? Gee, I dunno...
  373. CREDIT    The credits, the people at id Software who created this great game.
  374. VICTORY2  The screen shown after a victorious end to episode 2.
  375. PFUB1     A nice little rabbit minding his own peas and queues...
  376. PFUB2     ...maybe a hint of what's waiting in Doom Commercial version.
  377. ENDx      x=0-6, "THE END" text, with (x) bullet holes.
  378. AMMNUMx   x=0-9, are the gray digits used in the status bar for ammo count.
  379. STxxxxxx  are small pictures and text used on the status bar.
  380. M_xxxxxx  are text messages (yes, in picture format) used in the menus.
  381. BRDR_xxx  are tiny two pixel wide pictures use to frame the viewing window
  382.             when it is not full screen.
  383. WIxxxxxx  are pictures and messages used on the summary screen after
  384.             the completion of a level.
  385. WIMAPx    x=0-2, are the summary-screen maps used by each episode.
  386. S_START   has 0 length and is right before the item/monster "sprite" section.
  387.             See chapter [5] for the naming convention used here.
  388. S_END     is immediately after the last sprite.
  389. P_START   marks the beginning of the wall patches.
  390. P1_START    before the first of the shareware wall patches.
  391. P1_END      after the last of the shareware wall patches.
  392. P2_START    before the first of the registered wall patches.
  393. P2_END      before the first of the registered wall patches.
  394. P_END     marks the end of the wall patches.
  395. F_START   marks the beginning of the floors.
  396. F1_START    before the first shareware floor texture.
  397. F1_END      after the last shareware floor texture.
  398. F2_START    before the first registered floor texture.
  399. F2_END      after the last registered floor texture.
  400. F_END     marks the end of the floors.
  401.  
  402.         And that's the end of the directory.
  403.  
  404.         It is possible to include other entries and resources in a wad file,
  405. e.g. an entry called CLOWNS could point to a resource that includes the
  406. level creator's name, date of completion, or a million other things. None of
  407. these non-standard entries will be used by DOOM, nor will they cause it
  408. problems. Some of the map editors currently out add extra entries. There is
  409. a debate going on right now as to the merits of these extras. Since they are
  410. all non-standard, and potentially confusing, for now I'm in favor of not
  411. using any extra entries, and instead passing along a text file with a pwad.
  412. However, I can see some possible advantages, and I might change my mind...
  413.  
  414. ---------------------------------
  415. CHAPTER [4]: The Maps, The Levels
  416. ---------------------------------
  417.  
  418.         Each level needs eleven resources/directory entries: E[x]M[y],
  419. THINGS, LINEDEFS, SIDEDEFS, VERTEXES, SEGS, SSECTORS, NODES, SECTORS,
  420. REJECT, and BLOCKMAP.
  421.         In the DOOM.WAD file, all of these entries are present for every
  422. level. In a pwad external file, they don't all need to be present. Whichever
  423. entries are in a pwad will be substituted for the originals. For example, a
  424. pwad with just two entries, E3M1 and THINGS, would use all the walls and such
  425. from the original E3M1, but could have a completely different set of THINGS.
  426.         A note on the coordinates: the coordinate system used for the
  427. vertices and the heights of the sectors corresponds to pixels, for purposes of
  428. texture- mapping. So a sector that's 128 high, or a multiple of 128, is pretty
  429. typical, since many wall textures are 128 pixels high.
  430.  
  431. [4-1]: ExMy
  432. ===========
  433.  
  434.         x is a single digit 1-3 for the episode number and y is 1-9 for the
  435. mission/level number.
  436.         This is just the name resource for a (single) level, and has zero
  437. length. It marks any map-data resources that follow it in the directory list
  438. as being components of that level. The assignment of resources to this level
  439. stops with either the next ExMy entry, or with a non-map entry like TEXTURE1.
  440.  
  441. [4-2]: THINGS
  442. =============
  443.  
  444.         Each thing is ten bytes, consisting of five (integer) fields:
  445.  
  446. (1) X coordinate of thing
  447. (2) Y coordinate of thing
  448. (3) Angle the thing faces. On the automap, 0 is east, 90 is north, 180 is
  449.     west, 270 is south. This value is only used for monsters, player
  450.     starts, deathmatch random starts, and teleporter incoming spots.  Others
  451.     look the same from all directions. Values are rounded to the nearest 45
  452.     degree angle, so if the value is 80, it will actually face 90 - north.
  453. (4) Type of thing, see next subsection, [4-2-1]
  454. (5) Attributes of thing, see [4-2-2]
  455.  
  456. [4-2-1]: Thing Types
  457. --------------------
  458.  
  459.         Bytes 6-7 of each thing are an integer which specifies its kind:
  460.  
  461. Dec/Hex The thing's number
  462. Sprite  The sprite name associated with this thing. This is the first four
  463.           letters of the directory entries that are pictures of this thing.
  464. seq.    The sequence of frames displayed. "-" means it displays nothing.
  465.           Unanimated things will have just an "a" here, e.g. a backpack's
  466.           only sprite can be found in the wad under BPAKA0. Animated things
  467.           will show the order that their frames are displayed (they cycle
  468.           back after the last one). So the blue key uses BKEYA0 then BKEYB0,
  469.           etc. The soulsphere uses SOULA0-SOULB0-C0-D0-C0-B0 then repeats.
  470.  
  471.           Thing 15, a dead player, is PLAYN0.
  472. +       Monsters and players and barrels. They can be hurt, and they have
  473.           a more complicated sprite arrangement. See chapter [5].
  474. CAPITAL Monsters, counts toward the KILL ratio at the end of a level.
  475. *       An obstacle, players and monsters can't move through it.
  476. ^       Hangs from the ceiling, or floats (if a monster).
  477. $       A regular item that players may get.
  478. !       An artifact item; counts toward the ITEM ratio at level's end.
  479.  
  480. Dec. Hex Sprite seq.    Thing is:
  481.  
  482. 0    0000 ---- -        (nothing)
  483. 1    0001 PLAY +        Player 1 start (Player 1 start is needed even on)
  484. 2    0002 PLAY +        Player 2 start (levels intended for deathmatch only.)
  485. 3    0003 PLAY +        Player 3 start (Player starts 2-4 are only needed
  486. for)
  487. 4    0004 PLAY +        Player 4 start (cooperative mode multiplayer games.)
  488. 5    0005 BKEY ab     $ Blue keycard
  489. 6    0006 YKEY ab     $ Yellow keycard
  490. 7    0007 SPID +      * SPIDER DEMON: giant walking brain boss
  491. 8    0008 BPAK a      $ Backpack
  492. 9    0009 SPOS +      * FORMER HUMAN SERGEANT: black armor shotgunners
  493. 10   000a PLAY w        Bloody mess (an exploded player)
  494. 11   000b ---- -        Deathmatch start positions. Must be at least 4/level.
  495. 12   000c PLAY w        Bloody mess, this thing is exactly the same as 10
  496. 13   000d RKEY ab     $ Red Keycard
  497. 14   000e ---- -        Marks the spot where a player (or monster) lands when
  498.                         they teleport to the SECTOR that contains this thing.
  499. 15   000f PLAY n        Dead player
  500. 16   0010 CYBR +      * CYBER-DEMON: robo-boss, rocket launcher
  501. 17   0011 CELP a      $ Cell charge pack
  502. 18   0012 POSS a        Dead former human
  503. 19   0013 SPOS a        Dead former sergeant
  504. 20   0014 TROO a        Dead imp
  505. 21   0015 SARG a        Dead demon
  506. 22   0016 HEAD a        Dead cacodemon
  507. 23   0017 SKUL a        Dead lost soul, invisible (they blow up when killed)
  508. 24   0018 POL5 a        Pool of blood
  509. 25   0019 POL1 a      * Impaled human
  510. 26   001a POL6 ab     * Twitching impaled human
  511. 27   001b POL4 a      * Skull on a pole
  512. 28   001c POL2 a      * 5 skulls shish kebob
  513. 29   001d POL3 ab     * Pile of skulls and candles
  514. 30   001e COL1 a      * Tall green pillar
  515. 31   001f COL2 a      * Short green pillar
  516. 32   0020 COL3 a      * Tall red pillar
  517. 33   0021 COL4 a      * Short red pillar
  518. 34   0022 CAND a        Candle
  519. 35   0023 CBRA a      * Candelabra
  520. 36   0024 COL5 ab     * Short green pillar with beating heart
  521. 37   0025 COL6 a      * Short red pillar with skull
  522. 38   0026 RSKU ab     $ Red skullkey
  523. 39   0027 YSKU ab     $ Yellow skullkey
  524. 40   0028 BSKU ab     $ Blue skullkey
  525. 41   0029 CEYE abcb   * Eye in symbol
  526. 42   002a FSKU abc    * Flaming skull-rock
  527. 43   002b TRE1 a      * Gray tree
  528. 44   002c TBLU abcd   * Tall blue firestick
  529. 45   002d TGRE abcd   * Tall green firestick
  530. 46   002e TRED abcd   * Tall red firestick
  531. 47   002f SMIT a      * Small brown scrub
  532. 48   0030 ELEC a      * Tall, techno column
  533. 49   0031 GOR1 abcb   *^Hanging victim, swaying, legs gone
  534. 50   0032 GOR2 a      *^Hanging victim, arms out
  535. 51   0033 GOR3 a      *^Hanging victim, 1-legged
  536. 52   0034 GOR4 a      *^Hanging victim, upside-down, upper body gone
  537. 53   0035 GOR5 a      *^Hanging severed leg
  538. 54   0036 TRE2 a      * Large brown tree
  539. 55   0037 SMBT abcd   * Short blue firestick
  540. 56   0038 SMGT abcd   * Short green firestick
  541. 57   0039 SMRT abcd   * Short red firestick
  542. 58   003a SARG +      * SPECTRE: invisible version of the DEMON
  543. 59   003b GOR2 a       ^Hanging victim, arms out
  544. 60   003c GOR4 a       ^Hanging victim, upside-down, upper body gone
  545. 61   003d GOR3 a       ^Hanging victim, 1-legged
  546. 62   003e GOR5 a       ^Hanging severed leg
  547. 63   003f GOR1 abcb    ^Hanging victim, swaying, legs gone
  548. 2001 07d1 SHOT a      $ Shotgun
  549. 2002 07d2 MGUN a      $ Chaingun, gatling gun, mini-gun, whatever
  550. 2003 07d3 LAUN a      $ Rocket launcher
  551. 2004 07d4 PLAS a      $ Plasma gun
  552. 2005 07d5 CSAW a      $ Chainsaw
  553. 2006 07d6 BFUG a      $ BFG9000
  554. 2007 07d7 CLIP a      $ Ammo clip
  555. 2008 07d8 SHEL a      $ 4 shotgun shells
  556. 2010 07da ROCK a      $ 1 rocket
  557. 2011 07db STIM a      $ Stimpak
  558. 2012 07dc MEDI a      $ Medikit
  559. 2013 07dd SOUL abcdcb ! Soulsphere, Supercharge, +100% health
  560. 2014 07de BON1 abcdcb ! Health bonus
  561. 2015 07df BON2 abcdcb ! Armor bonus
  562. 2018 07e2 ARM1 ab     $ Green armor 100%
  563. 2019 07e3 ARM2 ab     $ Blue armor 200%
  564. 2022 07e6 PINV abcd   ! Invulnerability
  565. 2023 07e7 PSTR a      ! Berserk Strength
  566. 2024 07e8 PINS abcd   ! Invisibility
  567. 2025 07e9 SUIT a      ! Radiation suit
  568. 2026 07ea PMAP abcdcb ! Computer map
  569. 2028 07ec COLU a      * Floor lamp
  570. 2035 07f3 BAR1 ab+    * Barrel; blown up (BEXP sprite) no longer an obstacle.
  571. 2045 07fd PVIS ab     ! Lite goggles
  572. 2046 07fe BROK a      $ Box of Rockets
  573. 2047 07ff CELL a      $ Cell charge
  574. 2048 0800 AMMO a      $ Box of Ammo
  575. 2049 0801 SBOX a      $ Box of Shells
  576. 3001 0bb9 TROO +      * IMP: brown fireball hurlers
  577. 3002 0bba SARG +      * DEMON: pink bull-like chewers
  578. 3003 0bbb BOSS +      * BARON OF HELL: cloven hooved minotaur boss
  579. 3004 0bbc POSS +      * FORMER HUMAN: regular pistol shooting slimy human
  580. 3005 0bbd HEAD +      *^CACODEMON: red one-eyed floating heads. Behold...
  581. 3006 0bbe SKUL +      *^LOST SOUL: flying flaming skulls, they really bite
  582.  
  583.         I couldn't figure out a way to squeeze the following information into
  584. the above table. RAD is the thing's radius, they're all circular for
  585. collision purposes. HT is its height, for purposes of crushing ceilings and
  586. testing if monsters or players are too tall to enter a sector. SPD is a
  587. monster's speed. So now you know that a player is 56 units tall. Even though
  588. this table implies that they're 16*2 wide, players can't enter a corridor
  589. that's 32 wide. It must be at least 34 units wide (48 is the lowest width
  590. divisible by 16). Although obstacles and monsters have heights, they are
  591. infinitely tall for purposes of a player trying to go through them.
  592.  
  593. Dec. Hex   RAD   HT  SPD       Thing or class of things:
  594.  
  595. -       -   16   56    -       Player
  596. 7    0007  128  100   12       Spider-demon
  597. 9    0009   20   56    8       Former sergeant
  598. 16   0010   40  110   16       Cyber-demon
  599. 58   003a   30   56    8       Spectre
  600. 3001 0bb9   20   56    8       Imp
  601. 3002 0bba   30   56    8       Demon
  602. 3003 0bbb   24   64    8       Baron of Hell
  603. 3004 0bbc   20   56    8       Former human
  604. 3005 0bbd   31   56    8       Cacodemon
  605. 3006 0bbe   16   56    8       Lost soul
  606. 2035 07f3   10   42            barrel
  607.             20   16            all gettable things
  608.             16   16            most obstacles
  609. 54   0036   32   16            large brown tree
  610.  
  611. [4-2-2]: Thing attributes
  612. -------------------------
  613.  
  614.         The last two bytes of a THING control a few attributes, according to
  615. which bits are set:
  616.  
  617. bit 0   the THING is present at skill 1 and 2
  618. bit 1   the THING is present at skill 3 (hurt me plenty)
  619. bit 2   the THING is present at skill 4 and 5 (ultra-violence, nightmare)
  620. bit 3   indicates a deaf guard.
  621. bit 4   means the THING only appears in multiplayer mode.
  622. bits 5-15 have no effect.
  623.  
  624.         The skill settings are most used with the monsters, of course...the
  625. most common skill level settings are hex 07/0f (on all skills), 06/0e (on
  626. skill 3-4-5), and 04/0c (only on skill 4-5).
  627.         "deaf guard" only has meaning for monsters, who will not attack until
  628. they see a player if they are deaf. Otherwise, they will activate when they
  629. hear gunshots, etc (including the punch!). Sound does not travel through
  630. solid walls (walls that are solid at the time of the noise). Also, lines can
  631. be set so that sound does not pass through them (see [4-3-1] bit 6). This
  632. attribute is also known as the "ambush" attribute.
  633.  
  634. [4-3]: LINEDEFS
  635. ===============
  636.  
  637.         Each linedef represents a line from one of the VERTEXES to another,
  638. and each is 14 bytes, containing 7 (integer) fields:
  639.  
  640. (1) from the VERTEX with this number (the first vertex is 0).
  641. (2) to the VERTEX with this number (31 is the 32nd vertex).
  642. (3) attributes, see [4-3-1] below.
  643. (4) types, see [4-3-2] below.
  644. (5) is a "trigger" or "tag" number which ties this line's effect type to all
  645.       SECTORS that have the same trigger number in their last field.
  646. (6) "right" SIDEDEF, indexed number.
  647. (7) "left" SIDEDEF, if this line adjoins 2 SECTORS. Otherwise, it is equal
  648.       to -1 (FFFF hex).
  649.  
  650.         "right" and "left" are based on the direction of the linedef as
  651. indicated by the "from" and "to" VERTEXES. This attempt at a sketch should
  652. make it clear what I mean:
  653.  
  654.             left side              right side
  655.     from -----------------> to <----------------- from
  656.             right side             left side
  657.  
  658.         IMPORTANT: All lines must have a right side. If it is a one-sided
  659. line, then it must go the proper direction, so its single side is facing
  660. the sector it is part of.
  661.  
  662. [4-3-1]: Linedef Attributes
  663. ---------------------------
  664.  
  665.         The third field of each linedef is an integer which controls that
  666. line's attributes with bits, as follows:
  667.  
  668. bit #  condition if it is set (=1)
  669.  
  670. bit 0   Impassable. Players and monsters cannot cross this line, and
  671.           projectiles explode or end if they hit this line. Note, however,
  672.           that if there is no sector on the other side, things can't go
  673.           through this line anyway.
  674. bit 1   Monster-blocker. Monsters cannot cross this line.
  675. bit 2   Two-sided. If this bit is set, then the linedef's two sidedefs can
  676.           have "-" as a texture, which means "transparent". If this bit is not
  677.           set, the sidedefs can't be transparent: if "-" is viewed, it will
  678.           result in the hall of mirrors effect. However, the linedef CAN have
  679.           two non-transparent sidedefs, even if this bit is not set, if it is
  680.           between two sectors.
  681.         Another side effect of this bit is that if it is set, then
  682.           projectiles and gunfire (pistol, etc.) can go through it if there
  683.           is a sector on the other side, even if bit 0 is set.
  684.         Also, monsters see through these lines, regardless of the line's
  685.           other attribute settings and its textures ("-" or not doesn't matter).
  686. bit 3   Upper texture is "unpegged". This is usually done at windows.
  687.           "Pegged" textures move up and down when the neighbor sector moves
  688.           up or down. For example, if a ceiling comes down, then a pegged
  689.           texture on its side will move down with it so that it looks right.
  690.           If the side isn't pegged, it just sits there, the new material is
  691.           spontaneously created. The best way to get an idea of this is to
  692.           change a linedef on an elevator or door, which are always pegged,
  693.           and observe the result.
  694. bit 4   Lower texture is unpegged.
  695. bit 5   Secret. The automap will draw this line like a normal solid line that
  696.           doesn't have anything on the other side, thus protecting the secret
  697.           until it is opened. This bit is NOT what determines the SECRET
  698.           ratio at the end of a level, that is done by special sectors (#9).
  699. bit 6   Blocks sound. Sound cannot cross a line that has this bit set.
  700.           Sound normally travels from sector to sector, so long as the floor
  701.           and ceiling heights allow it (e.g. sound wouldn't go from a sector
  702.           with 0/64 floor/ceiling height to one with 72/128, but sound WOULD
  703.           go from a sector with 0/64 to one with 56/128).
  704. bit 7   Not on map. The line is not shown on the regular automap, not even if
  705.           the computer all-map power up is gained.
  706. bit 8   Already on map. When the level is begun, this line is already on the
  707.           automap, even though it hasn't been seen (in the display) yet.
  708.  
  709. bits 9-15 are unused, EXCEPT for a large section of e2m7, where every
  710. wall on the border of the section has bits 9-15 set, so they have values like
  711. 1111111000000000 (-511) and 1111111000010000 (-495). This area of e2m7 is
  712. also the only place in all 27 levels where there is a linedef 4 value of -1. But
  713. the linedef isn't a switch. These unique values either do nothing, or
  714. something that is as yet unknown. The currently prevailing opinion is that
  715. they do nothing.
  716.         Another rare value used in some of the linedef's attribute fields is
  717. ZERO. It occurs only on one-sided walls, where it makes no difference whether
  718. or not the impassibility bit (bit 0) is set. Still, it seems to indicate a
  719. minor glitch in the DOOM-CAD editor (on the NExT), I suppose.
  720.  
  721. [4-3-2]: Linedef Types
  722. ----------------------
  723.  
  724.         The integers in field 4 of a linedef control various special effects,
  725. mostly to do with what happens to a triggered SECTOR when the line is crossed
  726. or activated by a player.
  727.         Except for the ones marked DOOR, the end-level switches, and the
  728. special type 48 (hex 30), all these effects need trigger/tag numbers. Then
  729. any and all sectors whose last field contains the same trigger number are
  730. affected when the linedef's function is activated.
  731.         All functions are only performed from the RIGHT side of a linedef.
  732. Thus switches and doors can only be activated from the right side, and
  733. teleporter lines only work when crossed from the right side.
  734.         What the letters in the ACT column mean:
  735.  
  736. W means the function happens when a player WALKS across the linedef.
  737. S means a player must push SPACEBAR near the linedef to activate it (doors
  738.     and switches).
  739. G means a player or monster must shoot the linedef with a pistol or shotgun.
  740. 1 means it works once only.
  741. R means it is a repeatable function.
  742.  
  743.         Some functions that appear to work only once can actually be made to
  744. work again if the conditions are reset. E.g. a sector ceiling rises, opening
  745. a little room with baddies in it. Usually, that's it. But perhaps if some
  746. other linedef triggered that sector ceiling to come down again, then the
  747. original trigger could make it go up, etc...
  748.         Doors make a different noise when activated than the platform type
  749. (floor lowers and rises), the ones that exhibit the door-noise are so called
  750. in the EFFECT column. But only the ones marked DOOR in capitals don't need
  751. trigger numbers.
  752.  
  753. Dec/Hex   ACT   EFFECT
  754.  
  755. -1 ffff   ? ?   None? Only once in whole game, on e2m7, (960,768)-(928,768)
  756. 0    00   - -   nothing
  757. 1    01   S R   DOOR. Sector on the other side of this line has its
  758.                 ceiling rise to 8 below the first neighbor ceiling on the
  759.                 way up, then comes back down after 6 seconds.
  760. 2    02   W 1   Open door (stays open)
  761. 3    03   W 1   Close door
  762. 5    05   W 1   Floor rises to match highest neighbor's floor height.
  763. 7    07   S 1   Staircase rises up from floor in appropriate sectors.
  764. 8    08   W 1   Stairs
  765.  
  766. Note: The stairs function requires special handling. An even number of steps
  767. will be raised, starting with the first sector that has the same trigger
  768. number as this linedef. Then the step sector's trigger number alternates
  769. between 0 and any other value. The original maps use either 99 or 999, and
  770. this is wise. The steps don't all have to start at the same altitude. All the
  771. steps rise up 8, then all but the first rise another 8, etc. If a step hits
  772. a ceiling, it stops. Some interesting effects are possible with steps that
  773. aren't the same size or shape as previous steps, but in general, the most
  774. reliable stairways will be just like the originals, congruent rectangles.
  775.  
  776. 9    09   S 1   Floor lowers; neighbor sector's floor rises and changes
  777.                 TEXTURE and sector type to match surrounding neighbor.
  778. 10   0a   W 1   Floor lowers for 3 seconds, then rises
  779. 11   0b   S -   End level. Go to next level.
  780. 13   0d   W 1   Brightness goes to 255
  781. 14   0e   S 1   Floor rises to 64 above neighbor sector's floor
  782. 16   10   W 1   Close door for 30 seconds, then opens.
  783. 18   12   S 1   Floor rises to equal first neighbor floor
  784. 19   13   W 1   Floor lowers to equal neighboring sector's floor
  785. 20   14   S 1   Floor rises, texture and sector type change also.
  786. 21   15   S 1   Floor lowers to equal neighbor for 3 seconds, then rises back
  787.                 up to stop 8 below neighbor's ceiling height
  788. 22   16   W 1   Floor rises, texture and sector type change also
  789. 23   17   S 1   Floor lowers to match lowest neighbor sector
  790. 26   1a   S R   DOOR. Need blue key to open. Closes after 6 seconds.
  791. 27   1b   S R   DOOR. Yellow key.
  792. 28   1c   S R   DOOR. Red key.
  793. 29   1d   S 1   Open door, closes after 6 seconds
  794. 30   1e   W 1   Floor rises to 128 above neighbor's floor
  795. 31   1f   S 1   DOOR. Stays open.
  796. 32   20   S 1   DOOR. Blue key. Stays open.
  797. 33   21   S 1   DOOR. Yellow key. Stays open.
  798. 34   22   S 1   DOOR. Red key. Stays open.
  799. 35   23   W 1   Brightness goes to 0.
  800. 36   24   W 1   Floor lowers to 8 above next lowest neighbor
  801. 37   25   W 1   Floor lowers, change floor texture and sector type
  802. 38   26   W 1   Floor lowers to match neighbor
  803. 39   27   W 1   Teleport to sector. Only ONE sector can have the same tag #
  804. 40   28   W 1   Ceiling rises to match neighbor ceiling
  805. 41   29   S 1   Ceiling lowers to floor
  806. 42   2a   S R   Closes door
  807. 44   2c   W 1   Ceiling lowers to 8 above floor
  808. 46   2e   G 1   Opens door (stays open)
  809. 48   30   - -   Animated, horizontally scrolling wall.
  810. 51   33   S -   End level. Go to secret level 9.
  811. 52   34   W -   End level. Go to next level
  812. 56   38   W 1   Crushing floor rises to 8 below neighbor ceiling
  813. 58   3a   W 1   Floor rises 32
  814. 59   3b   W 1   Floor rises 8, texture and sector type change also
  815. 61   3d   S R   Opens door
  816. 62   3e   S R   Floor lowers for 3 seconds, then rises
  817. 63   3f   S R   Open door, closes after 6 seconds
  818. 70   46   S R   Sector floor drops quickly to 8 above neighbor
  819. 73   49   W R   Start crushing ceiling, slow crush but fast damage
  820. 74   4a   W R   Stops crushing ceiling
  821. 75   4b   W R   Close door
  822. 76   4c   W R   Close door for 30 seconds
  823. 77   4d   W R   Start crushing ceiling, fast crush but slow damage
  824. 80   50   W R   Brightness to maximum neighbor light level
  825. 82   52   W R   Floor lowers to equal neighbor
  826. 86   56   W R   Open door (stays open)
  827. 87   57   W R   Start moving floor (up/down every 5 seconds)
  828. 88   58   W R   Floor lowers quickly for 3 seconds, then rises
  829. 89   59   W R   Stops the up/down syndrome started by #87
  830. 90   5a   W R   Open door, closes after 6 seconds
  831. 91   5b   W R   Floor rises to 8 below neighbor ceiling
  832. 97   61   W R   Teleport to sector. Only ONE sector can have the same tag #
  833. 98   62   W R   Floor lowers to 8 above neighbor
  834. 102  66   S 1   Floor lowers to equal neighbor
  835.  
  836. 103  67   S 1   Opens door (stays open)
  837. 104  68   W 1   Light drops to lowest light level amongst neighbor sectors
  838.  
  839. [4-4]: SIDEDEFS
  840. ===============
  841.  
  842.         A sidedef is a definition of what wall texture to draw along a
  843. LINEDEF, and a group of sidedefs define a SECTOR.
  844.         There will be one sidedef for a line that borders only one sector,
  845. since it is not necessary to define what the doom player would see from the
  846. other side of that line because the doom player can't go there. The doom
  847. player can only go where there is a sector.
  848.         Each sidedef is 30 bytes, comprising 2 (integer) fields, then 3
  849. (8-byte string) fields, then a final (integer) field:
  850.  
  851. (1) X offset for pasting the appropriate wall texture onto the wall's
  852.       "space": positive offset moves into the texture, so the left portion
  853.       gets cut off (# of columns off left side = offset). Negative offset
  854.       moves texture farther right, in the wall's space
  855. (2) Y offset: analogous to the X, for vertical.
  856. (3) "upper" texture name: the part above the juncture with a lower ceiling
  857.       of an adjacent sector.
  858. (4) "lower" texture name: the part below a juncture with a higher floored
  859.       adjacent sector.
  860. (5) "full" texture name: the regular part of the wall
  861. (6) SECTOR that this sidedef faces or helps to surround
  862.  
  863.         The texture names are from the TEXTURE1/2 resources. 00s fill the
  864. space after a wall name that is less than 8 characters. The names of wall
  865. patches in the directory are not directly used, they are referenced through
  866. the PNAMES.
  867.         Simple sidedefs have no upper or lower texture, and so they will have
  868. "-" instead of a texture name. Also, two-sided lines can be transparent, in
  869. which case "-" means transparent (no texture).
  870.         If the wall is wider than the texture to be pasted onto it, then the
  871. texture is tiled horizontally. A 64-wide texture will be pasted at 0, 64,
  872. 128, etc. If the wall is taller than the texture, than the same thing is
  873. done, it is vertically tiled, with one very important difference: it starts new
  874. ones ONLY at 128, 256, 384, etc. So if the texture is less than 128 high,
  875. there will be junk filling the undefined areas, and it looks ugly.
  876.  
  877. [4-5]: VERTEXES
  878. ===============
  879.  
  880.         These are the beginnings and ends for LINEDEFS and SEGS, each is 4
  881. bytes, 2 (integer) fields:
  882.  
  883. (1) X coordinate
  884. (2) Y coordinate
  885.  
  886.         On the automap within the game, with the grid on (press 'G'), the
  887. lines are hex 80 (decimal 128) apart, two lines = hex 100, dec 256.
  888.  
  889. [4-6]: SEGS
  890. ===========
  891.  
  892.         The SEGS are in a sequential order determined by the SSECTORS, which
  893. are part of the NODES recursive tree. Each seg is 12 bytes, having 6
  894. (integer)
  895. fields:
  896.  
  897. (1) from VERTEX with this number
  898. (2) to VERTEX
  899. (3) angle: 0= east, 16384=north, -16384=south, -32768=west.
  900.       In hex, it's 0000=east, 4000=north, 8000=west, c000=south.
  901.       This is also know as BAMS for Binary Angle Measurement.
  902. (4) LINEDEF that this seg goes along
  903. (5) 0 = this seg is on the right SIDEDEF of the linedef.
  904.     1 = this seg is on the left SIDEDEF.
  905.       This could also be thought of as direction: 0 if the seg goes the same
  906.       direction as the linedef it's on, 1 if it goes the opposite direction.
  907. (6) Offset distance along the linedef to the start of this seg (the vertex in
  908.       field 1). The offset is in the same direction as the seg. If field 5 is
  909.       0, then the distance is from the "from" vertex of the linedef to the
  910.       "from" vertex of the seg. If feild 5 is 1, it is from the "to" vertex
  911. of the linedef to the "from" vertex of the seg. So if the seg begins at
  912. one of the two endpoints of the linedef, this will be 0.
  913.  
  914.         For diagonal segs, the offset distance can be obtained from the
  915. formula DISTANCE = SQR((x2 - x1)^2 + (y2 - y1)^2). The angle can be
  916. calculated from the inverse tangent of the dx and dy in the vertices, multiplied
  917. to convert PI/2 radians (90 degrees) to 16384. And since most arctan functions
  918. return a value between -(pi/2) and (pi/2), you'll have to do some tweaking
  919. based on the sign of (x2-x1), to account for segs that go "west".
  920.  
  921. [4-7]: SSECTORS
  922. ===============
  923.  
  924.         SSECTOR stands for sub-sector. These divide up all the SECTORS into
  925. convex polygons. They are then referenced through the NODES resources. There
  926. will be (number of nodes) + 1 ssectors. Each ssector is 4 bytes, having 2
  927. (integer) fields:
  928.  
  929. (1) This many SEGS are in this SSECTOR...
  930. (2) ...starting with this SEG number
  931.  
  932. [4-8]: NODES
  933. ============
  934.  
  935.         The full explanation of the nodes follows this list of a node's
  936. structure in the wad file. Each node is 28 bytes, composed of 14 (integer)
  937. fields:
  938.  
  939. (1)  X coordinate of partition line's start
  940. (2)  Y coordinate of partition line's start
  941. (3)  DX, change in X to end of partition line
  942. (4)  DY, change in Y to end of partition line
  943.        64, 128, -64, -64 would be a partition line from (64,128) to (0,64)
  944. (5)  Y upper bound for right bounding-box.\
  945. (6)  Y lower bound                         All SEGS in right child of node
  946. (7)  X lower bound                         must be within this box.
  947. (8)  X upper bound                        /
  948. (9)  Y upper bound for left bounding box. \
  949. (10) Y lower bound                         All SEGS in left child of node
  950. (11) X lower bound                         must be within this box.
  951. (12) X upper bound                        /
  952. (13) a NODE or SSECTOR number for the right child. If bit 15 is set, then the
  953.        rest of the number represents the child SSECTOR. If not, the child is
  954.        a recursed node.
  955. (14) a NODE or SSECTOR number for the left child.
  956.  
  957.         The NODES resource is by far the most difficult to understand of all
  958. the data structures in DOOM. A new level won't display right without a valid
  959. set of precalculated nodes, ssectors, and segs. This is why so much time has
  960. passed without a fully functional map-editor, even though many people are
  961. working on them.
  962.         Here I will explain what the nodes are for, and how they can be
  963. generated automatically from the set of linedefs, sidedefs, and vertices. I
  964. do NOT have a pseudo-code algorithm. There are many reasons for this. I'm not
  965. actually programming a level editor myself, so I have no way of testing and
  966. debugging a fully elaborated algorithm. Also, it is a very complicated
  967. process, and heavily commented code would be very long. I'm not going to put
  968. any language-specific code in here either, since it would be of limited
  969. value. Finally, there are some implementations of automatic node generation
  970. out there, but they are still being worked on, i.e. they still exhibit some
  971. minot bugs.
  972.         The NODES are branches in a binary space partition (BSP) that divides
  973. up the level and is used to determine which walls are in front of others, a
  974. process know as hidden-surface removal. The SSECTORS (sub-sectors) and SEGS
  975. (segments) resources are necessary parts of the structure.
  976.         A BSP tree is normally used in 3d space, but DOOM uses a simplified
  977. 2d version of the scheme. Basically, the idea is to keep dividing the map into
  978. smaller spaces until each of the smallest spaces contains only wall segments
  979. which cannot possibly occlude (block from view) other walls in its own space.
  980. The smallest, undivided spaces will become SSECTORS. Each wall segment is
  981. part or all of a linedef (and thus a straight line), and becomes a SEG. All
  982. of the divisions are kept track of in a binary tree structure, which is used
  983. to greatly speed the rendering process (drawing what is seen).
  984.         Only the SECTORS need to be divided. The parts of the levels that are
  985. "outside" sectors are ignored. Also, only the walls need to be kept track of.
  986. The sides of any created ssectors which are not parts of linedefs do not
  987. become segs.
  988.         Some sectors do not require any dividing. Consider a square sector.
  989. All the walls are orthogonal to the floor (the walls are all straight up and
  990. down), so from any viewpoint inside the square, none of its four walls can
  991. possibly block the view of any of the others. Now imagine a sector shaped
  992. like this drawing:
  993.  
  994. +---------------.------+    The * is the viewpoint, looking ->, east. The
  995. |                .     |    diagonal wall marked @ @ can't be seen at all,
  996. |                /\    |@   and the vertical wall marked @@@ is partially
  997. |   *->        /   @\  |@   occluded by the other diagonal wall. This sector
  998. |            /       @\|@   needs to be divided. Suppose the diagonal wall
  999. +----------/                is extended, as shown by the two dots (..):
  1000.  
  1001. now each of the two resulting sub-sectors are sufficient, because while in
  1002. either one, no wall that is part of that sub-sector blocks any other.
  1003.         In general, being a convex polygon is the goal of a ssector. Convex
  1004. means a line connecting any two points that are inside the polygon will be
  1005. completely contained in the polygon. All triangles and rectangles are convex,
  1006. but not all quadrilaterals. In doom's simple Euclidean space, convex also
  1007. means that all the interior angles of the polygon are <= 180 degrees.
  1008.         Now, an additional complication arises because of the two-sided
  1009. linedef. Its two sides are in different sectors, so they will end up in
  1010. different ssectors too. Thus every two-sided linedef becomes two segs (or
  1011. more), or you could say that every sidedef becomes a seg. Creating segs from
  1012. sidedefs is a good idea, because the seg can then be associated with a
  1013. sector.  Two segs that aren't part of the same sector cannot possibly be in
  1014. the same ssector, so further division is required of any set of segs that
  1015. aren't all from the same sector.
  1016.         Whenever a division needs to be made, a SEG is picked, somewhat
  1017. arbitrarily, which along with its imaginary extensions, forms a "knife" that
  1018. divides the remaining space in two (thus binary). This seg is the partition
  1019. line of a node, and the remaining spaces on either side of the partition line
  1020. become the right and left CHILDREN of the node. All partition lines have a
  1021. direction, and the space on the "right" side of the partition is the right
  1022. child of the node; the space on the "left" is the left child (there's a cute
  1023. sketch in [4-3]: LINEDEFS that shows how right and left relate to the start
  1024. and end of a line). Note that if there does not exist a seg in the remaining
  1025. space which can serve as a partition line, then there is no need for a
  1026. further partition, i.e. it's a ssector and a "leaf" on the node tree.
  1027.         If the "knife" passes through any lines/segs (but not at vertices),
  1028. they are split at the intersection, with one part going to each child. A two
  1029. sided linedef, which is two segs, when split results in four segs. A two
  1030. sider that lies along an extension of the partition line has each of its two
  1031. segs go to opposite sides of the partition line. This is the eventual fate of
  1032. ALL segs on two-sided linedefs.
  1033.         As the partition lines are picked and the nodes created, a strict
  1034. ordering must be maintained. The node tree is created from the "top" down.
  1035. After the first division is made, then the left child is divided, then its
  1036. left child, and so on, until a node's child is a ssector. Then you move back
  1037. up the tree one branch, and divide the right child, then its left, etc.
  1038. ALWAYS left first, on the way down.
  1039.         Since there will be splits along the way, there is no way to know
  1040. ahead of time how many nodes and ssectors there will be at the end. And the
  1041. top of the tree, the node that is created first, is given the highest number.
  1042. So as nodes and ssectors are created, they are simply numbered in order from
  1043. 0 on up, and when it's all done, nothing's left but ssectors, then ALL the
  1044. numbers, for nodes and ssectors, are reversed. If there's 485 nodes, then 485
  1045. becomes 0 and 0 becomes 485.
  1046.         Here is another fabulous drawing which will explain everything. + is
  1047. a vertex, - and | indicate linedefs, the . . indicates an extension of a
  1048. partition line. The <, >, and ^ symbols indicate the directions of partition
  1049. lines. All the space within the drawing is actual level space, i.e. sectors.
  1050.  
  1051.       +-----+-------+-------+            0                     (5)
  1052.       |     |       |       |         /     \      ==>       /     \
  1053.       |  e  |^  f   |^  g   |       1         4           (4)       (1)
  1054.       |     |4      |5      |     /   \      / \         /   \      / \
  1055. +---- + . . +-------+-------+    2     3    e   5      (3)   (2)   2  (0)
  1056. |     |           < 0       |   / \   / \      / \     / \   / \      / \
  1057. |  a  |       b             |  a   b c   d    f   g   6   5 4   3    1   0
  1058. |     |^                    |
  1059. | . . |2. . . . . +---------+ The order in which      How the elements are
  1060. |     |           |1 >        the node tree's         numbered when it's
  1061. |  c  |^    d     |           elements get made.      finished.
  1062. |     |3          |           0 = node, a = ssector   (5) = node, 6 = ssector
  1063. +-----+-----------+
  1064.  
  1065.         1. Make segs from all the linedefs. There are 5 two-sided lines here.
  1066.         2. Pick the vertex at 0 and go west (left). This is the first
  1067.         partition line. Note the . . extension line.
  1068.         3. Pick the vertex at 1, going east. The backwards extension . . cuts
  1069.         the line 3>2>, and the unlabeled left edge line. The left edge was
  1070.         one seg, it becomes two. The 3>2> line was two segs, it becomes four.
  1071.         New vertices are created at the intersection points to do this.
  1072.         4. Pick the (newly created) vertex at 2. Now the REMAINING spaces on
  1073.         both sides of the partition line are suitable for ssectors. The left
  1074.         one is first, it becomes a, the right b. Note that ssector a has 3
  1075.         segs, and ssector b has 5 segs. The . . imaginary lines are NOT segs.
  1076.         5. Back up the tree, and take 1's right branch. Pick 3. Once again,
  1077.         we can make 2 ssectors, c and d, 3 segs each. Back up the tree to 0.
  1078.         6. Pick 4. Now the left side is a ssector, it becomes e. But the
  1079.         right side is not, it needs one more node. Pick 5, make f and g.
  1080.         7. All done, so reverse all the ordination of the nodes and the
  1081.         ssectors. Ssector 0's segs become segs 0-2, ssector 1's segs become
  1082.         segs 3-7, etc. The segs are written sequentially according to the
  1083.         ssector numbering.
  1084.  
  1085.         If we want to create an algorithm to do the nodes automatically, it
  1086. needs to be able to pick partition lines automatically. From studying the
  1087. original maps, it appears that they usually choose a linedef which divides
  1088. the child's space roughly in "half". This is restricted by the availability of
  1089. a seg in a good location, with a good angle. Also, the "half" refers to the
  1090. total number of ssectors in any particular child, which we have no way of
  1091. knowing when we start! Optimization methods are probably used, or maybe brute
  1092. force, trying every candidate seg until the "best" one is found.
  1093.         What is the best possible choice for a partition line? Well, there
  1094. are apparently two goals when creating a BSP tree, which are partially
  1095. exclusive. One is to have a balanced tree, i.e. for any node, there are about
  1096. the same total number of sub-nodes on either side of it. The other goal is to
  1097. minimize the number of "splits" necessary, in this case, the number of seg
  1098. splits needed, along with the accompanying new vertexes and extra segs. Only
  1099. a very primitive and specially constructed set of linedefs could avoid having
  1100. any splits, so they are inevitable. It's just that with some choices of
  1101. partition lines, there end up being fewer splits. For example,
  1102.  
  1103. +--------------+       If a and b are chosen as partition lines, there will
  1104. |              |       be four extra vertices needed, and this shape becomes
  1105. +---+      +---+ < A   five ssectors and 16 segs. If A and B are chosen,
  1106.     |^    ^|           however, there are no extra vertices, and only three
  1107. +---+a    b+---+ < B   ssectors and 12 segs.
  1108. |              |
  1109. +--------------+
  1110.  
  1111.         I've read that for a "small" number of polygons (less than 1000?),
  1112. which is what we're dealing with in a doom level, one should definitely try
  1113. to minimize splits, and not worry about balancing the tree. I can't say for
  1114. sure, but it does appear that the original levels strive for this. Their
  1115. trees are not totally unbalanced, but there are some parts where many successive
  1116. nodes each have a node and a ssector as children (this is unbalanced). And
  1117. there are a lot of examples to prove that the number of extra segs and
  1118. vertices they create is very low compared to what it could be. I think the
  1119. algorithm that id Software used tried to optimize both, but with fewer splits
  1120. being more important.
  1121.  
  1122. [4-9]: SECTORS
  1123. ==============
  1124.  
  1125.         A SECTOR is a horizontal (east-west and north-south) area of the map
  1126. where a floor height and ceiling height is defined. It can have any shape.
  1127. Any change in floor or ceiling height or texture requires a new sector (and
  1128. therefore separating linedefs and sidedefs).
  1129.         Each is 26 bytes, comprising 2 (integer) fields, then 2 (8-byte
  1130. string) fields, then 3 (integer) fields:
  1131.  
  1132. (1) Floor is at this height for this sector
  1133. (2) Ceiling height
  1134.       A difference of 24 between the floor heights of two adjacent sectors
  1135.       is passable (upwards), but a difference of 25 is "too high". The player
  1136.       may fall any amount.
  1137. (3) name of floor texture, from the directory.
  1138. (4) name of ceiling texture, from directory.
  1139.       All the pictures in the directory between F_START and F_END work as
  1140.       either floors or ceilings. F_SKY1 is used as a ceiling to indicate that
  1141.       it is transparent to the sky above/behind.
  1142. (5) brightness of this sector: 0 = total dark, 255 (ff) = maximum light
  1143. (6) special sector: see [4-9-1] immediately below.
  1144. (7) is a "trigger" number corresponding to a certain LINEDEF with the same
  1145.       trigger number. When that linedef is crossed, something happens to this
  1146.       sector - it goes up or down, etc...
  1147.  
  1148. [4-9-1]: Special Sector Types
  1149. -----------------------------
  1150.  
  1151.         These numbers control the way the lighting changes, and whether or
  1152. not a player gets hurt while standing in the sector. -10/20% means that the
  1153. player takes 20% damage at the end of every second that they are in the
  1154. sector, except at skill 1, they take 10% damage. If the player has armor,
  1155. then the damage is split between health and armor.
  1156.         For all the lighting effects, the brightness levels alternates
  1157. between the value given for this sector, and the lowest value amongst all the
  1158. sector's neighbors. Neighbor means a linedef has a side in each sector. If no
  1159. neighbor sector has a lower light value, then there is no lighting effect.
  1160. "blink off" means the light goes to the lower value for just a moment. "blink
  1161. on" means the light is usually at the neighbor value, then jumps up to the
  1162. normal value for a moment. "oscillate" means that the light level goes
  1163. smoothly from one value to the other; it takes about 2 seconds to go from
  1164. maximum to minimum and back (255 to 0 to 255).
  1165.  
  1166. Dec Hex Condition or effect
  1167.  
  1168. 0   00  is normal, no special characteristic.
  1169. 1   01  light blinks off at random times.
  1170. 2   02  light blinks on every 0.5 second
  1171. 3   03  light blinks on every 1.0 second
  1172. 4   04  -10/20% health AND light blinks on every 0.5 second
  1173. 5   05  -5/10% health
  1174. 7   07  -2/5% health, this is the usual NUKAGE acid-floor.
  1175. 8   08  light oscillates
  1176. 9   09  SECRET: player must move into this sector to get credit for finding
  1177.         this secret. Counts toward the ratio at the end of the level.
  1178. 10  0a  ?, ceiling comes down 30 seconds after level is begun
  1179. 11  0b  -10/20% health. When player's HEALTH <= 10%, then the level ends. If
  1180.         it is a level 8, then the episode ends.
  1181. 12  0c  light blinks on every 1.0 second
  1182. 13  0d  light blinks on every 0.5 second
  1183. 14  0e  ??? Seems to do nothing
  1184. 16  10  -10/20% health
  1185.  
  1186.         All other values cause an error and exit to DOS.
  1187.  
  1188. [4-10]: REJECT
  1189. ==============
  1190.  
  1191.         The REJECT resource is optional. Its purpose in the original maps is
  1192. to help speed the process of calculating when monsters detect the player(s).
  1193. It can also be used for some special effects.
  1194.         The size of a REJECT in bytes is (number of SECTORS ^ 2) / 8, rounded
  1195. up. It is an array of bits, with each bit controlling whether monsters in a
  1196. given sector can detect players in another sector.
  1197.         Make a table of sectors vs. sectors, like this:
  1198.  
  1199.          sector that the player is in
  1200.               0  1  2  3  4
  1201.             +---------------
  1202. sector    0 | 0  1  0  0  0
  1203. that      1 | 1  0  1  1  0
  1204. the       2 | 0  1  0  1  0
  1205. monster   3 | 0  1  1  1  0
  1206. is in     4 | 0  0  1  0  0
  1207.  
  1208.         A 1 means the monster cannot become activated by seeing a player, nor
  1209. can it attack the player. A 0 means there is no restriction. All non-deaf
  1210. monsters still become activated by weapon sounds that they hear (including
  1211. the bare fist!). And activated monsters will still pursue the player, but they
  1212. will not attack if their current sector vs. sector bit is "1". So a REJECT
  1213. that's set to all 1s gives a bunch of pacifist monsters who will follow the
  1214. player around and look menacing, but never actually attack.
  1215.         How the table turns into the REJECT resource:
  1216.         Reading left-to-right, then top-to-bottom, like a page, the first bit
  1217. in the table becomes bit 0 of byte 0, the 2nd bit is bit 1 of byte 0, the 9th
  1218. bit is bit 0 of byte 1, etc. So if the above table represented a level with
  1219. only 5 sectors, its REJECT would be 4 bytes:
  1220.  
  1221. 10100010 00101001 01000111 xxxxxxx0 (hex A2 29 47 00, decimal 162 41 71 0)
  1222.  
  1223.         In other words, the REJECT is a long string of bits which are read
  1224. from least significant bit to most significant bit, according to the
  1225. multi-byte storage scheme used in a certain "x86" family of CPUs.
  1226.         Usually, if a monster in sector A can't detect a player in sector B,
  1227. then the reverse is true too, thus if 0/1 is set, 1/0 will be set also. Same
  1228. sector prohibitions, e.g. 0/0, 3/3, etc. are very rarely set, only in tiny
  1229. sectors that monsters can't get to anyway. If a large sector with monsters
  1230. in it has this assignment, they'll exhibit the pacifist syndrome.
  1231.         I think the array was designed to help speed the monster-detection
  1232. process. If a sector pair is prohibited, the game engine doesn't even bother
  1233. checking line-of-sight feasibility for the monster to "see" the player and
  1234. thus become active. I suppose it can save some calculations if there are lots
  1235. of monsters.
  1236.         It is possible to automatically generate some reject pairs, but to
  1237. calculate whether or not one sector can "see" another can be very complicated.
  1238. You can't judge line-of-sight just by the two dimensions of the map, you also
  1239. have to account for the floor and ceiling heights. And to verify that every
  1240. point in the 3d volume of one sector is out of sight of every point in the
  1241. other sector...whew! The easy way is to just leave them all 0, or have a user
  1242. interface which allows them to use their brains to determine which reject
  1243. pairs should be set.
  1244.  
  1245. [4-11]: BLOCKMAP
  1246. ================
  1247.  
  1248.         The BLOCKMAP is a pre-calculated structure that the game engine uses
  1249. to simplify collision-detection between moving things and walls. Below I'll
  1250. give a pseudo-code algorithm that will automatically construct a blockmap
  1251. from the set of LINEDEFS and their vertices.
  1252.         If a level doesn't have a blockmap, it can display fine, but
  1253. everybody walks through walls, and no one can hurt anyone else.
  1254.         The whole level is cut into "blocks", each is a 128 (hex 80) wide
  1255. square (the grid lines in the automap correspond to these blocks).
  1256.         All of the blockmap's fields are integers.
  1257.         The first two integers are XORIGIN and YORIGIN, which specify the
  1258. coordinates of the bottom-left corner of the bottom-left (southwest) block.
  1259. These two numbers are usually equal to 8 less than the minimum values of x
  1260. and y achieved in any vertex on the level.
  1261.         Then come COLUMNS and ROWS, which specify how many "blocks" there are
  1262. in the X and Y directions. COLUMNS is the number of blocks in the x
  1263. direction.
  1264.         For a normal level, the number of blocks must be large enough to contain
  1265. every linedef on the level. If there are linedefs outside the blockmap, they
  1266. will not be able to prevent monsters or players from crossing them, which can
  1267. cause problems, including the hall of mirrors effect.
  1268.         Then come (ROWS * COLUMNS) integers which are pointers to the offset
  1269. within the blockmap resource for that "block". These "offsets" refer to the
  1270. INTEGER number, NOT the byte number, where to find the block's list. The
  1271. blocks go right (east) and then up (north). The first block is at row 0,
  1272. column 0; the next at row 0, column 1; if there are 34 columns, the 35th
  1273. block is row 1, column 0, etc.
  1274.         After all the pointers, come the block lists. Each blocklist
  1275. describes the numbers of all the LINEDEFS which are partially or wholly "in"
  1276. that block. Note that lines and points which seem to be on the "border"
  1277. between two blocks are actually only in one. For example, if the origin of
  1278. the blockmap is at (0,0), the first column is from 0 to 127 inclusive, the
  1279. second column is from 128 to 255 inclusive, etc. So a vertical line with x
  1280. coordinate 128 which might seem to be on the border is actually in the
  1281. easternmost/rightmost column only. Likewise for the rows - the north/upper
  1282. rows contain the border lines.
  1283.         An "empty" block's blocklist consists of two integers: 0 and then -1.
  1284. A non-empty block will go something like: 0 330 331 333 -1. This means that
  1285. linedefs 330, 331, and 333 are "in" that block. Part of each of those line
  1286. segments lies within the (hex 80 by 80) boundaries of that block. What about
  1287. the block that has linedef 0? It goes: 0 0 ... etc ... -1.
  1288.         Here's another way of describing blockmap as a list of the integers,
  1289. in order:
  1290.  
  1291.         Coordinate of block-grid X origin
  1292.         Coordinate of block-grid Y origin
  1293.         # of columns (blocks in X direction)
  1294.         # of rows (blocks in Y direction)
  1295.         Block 0 offset from start of BLOCKMAP, in integers
  1296.           .
  1297.           .
  1298.         Block N-1 offset (N = number of columns * number of rows)
  1299.         Block 0 list: 0, numbers of every LINEDEF in block 0, -1 (ffff)
  1300.           .
  1301.           .
  1302.         Block N-1 list: 0, numbers of every LINEDEF in block N-1, -1 (ffff)
  1303.  
  1304. [4-11-1]: How to automatically generate the BLOCKMAP
  1305. ----------------------------------------------------
  1306.  
  1307.         Here is an algorithm that can create a blockmap from the set of
  1308. linedefs and their vertices' coordinates. For reasons of space and different
  1309. programming tastes, I won't include every little detail here, nor is the
  1310. algorithm in any particular language. The pseudocode below is like BASIC or
  1311. PASCAL, sort of. I'm not being very formal about variable declarations and
  1312. such, since that's such a pain.
  1313.         There are basically two ways that the blockmap can be automatically
  1314. generated. The slow way is to do every block in order, and check every
  1315. linedef to see if part of the linedef is in the block. This method is slow
  1316. because it has to perform (number of blocks) * (number of linedefs)
  1317. iterations, and in most iterations it will have to do at least one fairly
  1318. complicated formula do determine an intersection. With the number of blocks
  1319. at 500-2500 for a typical level, and linedefs at 500-1500, this can really
  1320. bog down on a big level.
  1321.         The better way is to do the linedefs in order, keeping a dynamic list
  1322. for every block, and adding the linedef number to the end of the blocklist
  1323. for every block it passes through. We won't have to test every block to see if
  1324. the line passes through it; in fact, we won't be testing ANY blocks, we'll be
  1325. calculating exactly which blocks it goes through based on its coordinates and
  1326. slope. This method will have to go through one cycle for each linedef, with
  1327. very few calculations needed for most cycles, since most linedefs are in only
  1328. one or two blocks.
  1329.  
  1330. ' Pseudo-code algorithm to generate a BLOCKMAP. The goal is speed. If you
  1331. ' can top this approach, I'd be surprised.
  1332. ' Most variables are of type integer, except slope and its pals, see below.
  1333. ' Some of the ideas here are borrowed from Matt Tagliaferri.
  1334. ' x_minimum is the minimum x value in the set of vertices, etc.
  1335. ' the -8 is to make the blockmaps just like the original ones.
  1336.  
  1337.   x_origin = -8 + x_minimum
  1338.   y_origin = -8 + y_minimum
  1339.   Columns = ((x_maximum - x_origin) DIV 128) + 1
  1340.   Rows = ((y_maximum - y_origin) DIV 128) + 1
  1341.  
  1342. ' DIV is whatever function performs integer division, e.g. 15 DIV 4 is 3.
  1343.  
  1344.   number_of_blocks = Rows * Columns
  1345.   INITIALIZE Block_string(number_of_blocks - 1)
  1346.   FOR count = 0 to number_of_blocks DO
  1347.     Block_string(count) = STRING(0)
  1348.   NEXT count
  1349.  
  1350. ' STRING is whatever function or typecast will change the integer "int"
  1351. ' to its two-byte string format. Here we set up an array to hold all the
  1352. ' blocklists. All blocklists start with the integer 0, and end with -1;
  1353. ' we'll add the -1s at the end.
  1354. ' A string array is best, because we need to haphazardly add to the
  1355. ' blocklists. line 0 might be in blocks 34, 155, and 276, for instance.
  1356. ' And string's lengths are easily determined, which we'll need at the end.
  1357. ' To save on memory requirements, the size of each array element can be
  1358. ' limited to c. 200 bytes = 100 integers, since what is the maximum number
  1359. ' of linedefs which will be in a single block? Certainly less than 100.
  1360.  
  1361.   FOR line = 0 TO Number_Of_Linedefs DO
  1362.     x0 = (x coordinate of that linedef's vertex 0) - x_origin
  1363.     y0 = (y coordinate of vertex 0) - y_origin
  1364.     x1 = (x coordinate of vertex 1) - x_origin
  1365.     y1 = (y coordinate of vertex 1) - y_origin
  1366.  
  1367. ' subtracting the origins shifts the axes and makes calculations simpler.
  1368.  
  1369.     blocknum = (y0 DIV 128) * COLUMNS + (x0 DIV 128)
  1370.     Block_string(blocknum) = Block_string(blocknum) + STRING(line)
  1371.  
  1372.     boolean_column = ((x0 DIV 128)=(x1 DIV 128))
  1373.     boolean_row = ((y0 DIV 128)=(y1 DIV 128))
  1374.  
  1375. ' This is meant to assign boolean values for whether or not the linedef's
  1376. ' two vertices are in the same column and/or row. I'm assuming that the
  1377. ' expressions will be evaluated as 1 if "true" and 0 if "false".
  1378. ' So if both vertices are in the same block, both of these booleans will be
  1379. ' true and we can go to the next linedef, because it's only in one block.
  1380. ' If a line is horizontal or vertical, it is easy to calculate exactly which
  1381. ' blocks it occupies. Since many, if not most, lines are orthogonal and
  1382. ' short, that is where this algorithm gets most of its speed.
  1383.  
  1384.     CASE (boolean_column * 2 + boolean_row):
  1385.       CASE 3: NEXT line
  1386.       CASE 2: block_step = SIGN(y1-y0) * Columns
  1387.               FOR count = 1 TO ABS((y1 DIV 128) - (y0 DIV 128)) DO
  1388.                 blocknum = blocknum + block_step
  1389.                 Block_string(blocknum) = Block_string(blocknum) +
  1390. STRING(line)
  1391.               NEXT count
  1392.               NEXT line
  1393.       CASE 1: block_step = SIGN(x1-x0)
  1394.               count = 1 TO ABS((x1 DIV 128) - (x0 DIV 128)) DO
  1395.                 blocknum = blocknum + block_step
  1396.                 Block_string(blocknum) = Block_string(blocknum) +
  1397. STRING(line)
  1398.               NEXT count
  1399.               NEXT line
  1400.     END CASE
  1401.  
  1402. ' now to take care of the longer, diagonal lines...
  1403.  
  1404.     y_sign = SIGN(y1-y0)
  1405.     x_sign = SIGN(x1-x0)
  1406.  
  1407. ' Important: the variables "slope", "x_jump", "next_x" and "this_x" need to
  1408. ' be of type REAL, not integer, to maintain the accuracy. "slope" will not
  1409. ' be 0 or undefined, these situations were weeded out by CASE 1 and 2 above.
  1410. ' An alternative was pointed out to me, but I haven't implemented it in this
  1411. ' algorithm. If you scale these numbers by 1000, then 32 bit integer
  1412. ' arithmetic will be precise enough, you won't need sloppy and slow real #s.
  1413.  
  1414.     slope = (y1-y0)/(x1-x0)
  1415.     x_jump = (128/slope) * y_sign
  1416.     CASE (y_sign):
  1417.       CASE -1: next_x = x0 + ((y0 DIV 128) * 128 - 1 - y0)/slope
  1418.       CASE 1: next_x = x0 + ((y0 DIV 128) * 128 + 128 - y0)/slope
  1419.     END CASE
  1420.  
  1421. ' Suppose the linedef heads northeast from its start to its end. We'll
  1422. ' first calculate all the blocks in the start row, which will all be
  1423. ' successively to the right of the first block (blocknum). Then we'll move
  1424. ' up to the next row, set the block, and go right, then the next row, etc.
  1425. ' until we've passed the second/end vertex. (the three other directions
  1426. ' NW SE SW are taken care of too, all by proper use of sign)
  1427.  
  1428. ' x_jump is how far x goes right or left when y goes up/down 128.
  1429. ' next_x will be the x coordinate of the next intercept with a "critical"
  1430. ' y value. When the line goes up, the critical values are equal to 128, 256,
  1431. ' etc, the first y-values in a new block. If the line goes down, then the
  1432. ' intercepts occur when y equals 255, 127, etc. Remember, all this is in the
  1433. ' "shifted" coord system.
  1434.  
  1435. ' INT is whatever function will discard the decimal part of a real number,
  1436. ' converting it to an integer. It doesn't matter which way it rounds
  1437. ' negatives, since next_x and this_x are always positive.
  1438.  
  1439.     last_block = INT(next_x/128) - (x0 DIV 128) + blocknum
  1440.     IF last_block > blocknum THEN
  1441.       FOR count = (blocknum + x_sign) TO last_block STEP x_sign DO
  1442.         Block_string(count) = Block_string(count) + STRING(line)
  1443.       NEXT count
  1444.  
  1445.     REPEAT
  1446.       this_x = next_x
  1447.  
  1448.       next_x = this_x + x_jump
  1449.       IF (x_sign * next_x) > (x_sign * x1) THEN next_x = x1
  1450.       first_block = last_block + y_sign * Columns
  1451.       last_block = first_block + INT(next_x/128) - INT(this_x/128)
  1452.       FOR count = first_block TO last_block STEP x_sign DO
  1453.         Block_string(count) = Block_string(count) + STRING(line)
  1454.       NEXT count
  1455.     UNTIL INT(next_x) = x1
  1456.  
  1457.  
  1458.   NEXT line
  1459.  
  1460. ' That's it. Now all we have to do is write the BLOCKMAP to wherever.
  1461.  
  1462.   WRITE Blockmap, AT OFFSET 0, x_origin
  1463.   WRITE Blockmap, AT OFFSET 2, y_origin
  1464.   WRITE Blockmap, AT OFFSET 4, Columns
  1465.   WRITE Blockmap, AT OFFSET 6, Rows
  1466.  
  1467.   pointer_offset = 8
  1468.   blocklist_offset = 8 + 2 * number_of_blocks
  1469.   FOR count = 0 TO number_of_blocks - 1 DO
  1470.      WRITE Blockmap, AT OFFSET pointer_offset, blocklist_offset / 2
  1471.      WRITE Blockmap, AT OFFSET blocklist_offset, Block_string(count)
  1472.      blocklist_offset = blocklist_offset + LENGTH(Block_string(count)) + 2
  1473.      WRITE Blockmap, AT OFFSET (blocklist_offset - 2), STRING(-1)
  1474.      pointer_offset = pointer_offset + 2
  1475.   NEXT count
  1476.  
  1477. ' Done! blocklist_offset will equal the total size of the BLOCKMAP, when
  1478. ' this last loop is finished
  1479.  
  1480. ----------------------------
  1481. CHAPTER [5]: Pictures' Format
  1482. -----------------------------
  1483.  
  1484.         The great majority of the entries if the directory reference
  1485. resources that are in a special picture format. The same format is used for
  1486. the sprites (monsters, items), the wall patches, and various miscellaneous
  1487. pictures for the status bar, menu text, inter-level map, etc. The floor and
  1488. ceiling textures are NOT in this format, they are raw data; see chapter [6].
  1489.         After much experimenting, it seems that sprites and floors cannot be
  1490. added or replaced via pwad files. However, wall patches can (whew!). This is
  1491. apparently because all the sprites' entries must be in one "lump", in the
  1492. IWAD file, between the S_START and S_END entries. And all the floors have to
  1493. be listed between F_START and F_END. If you use those entries in pwads,
  1494. either nothing will happen, or an error will occur. There are also P_START
  1495. and P_END entries in the directory, which flank the wall patch names, so how
  1496. come they work in pwads? I think it is somehow because of the PNAMES
  1497. resource, which lists all the wall patch names that are to be used. Too bad
  1498. there aren't SNAMES and FNAMES resources!
  1499.         It is still possible to change and manipulate the sprites and floors,
  1500. its just more difficult to do, and very difficult to figure out a scheme for
  1501. potential distribution of changes. The DOOM.WAD file must be changed, and
  1502. that is a pain.
  1503.         All the sprites follow a naming scheme. The first four letters are
  1504. the sprite's name, or and abbreviation. TROO is for imps, BKEY is for the
  1505. blue key, etc. See [4-2-1] for a list of them.
  1506.         For most things, the unanimated ones, the next two characters of the
  1507. sprite's name are A0, like SUITA0, the radiation suit. For simple animated
  1508. things, there will be a few more sprites, e.g. PINVA0, PINVB0, PINVC0, and
  1509. PINVD0 are the four sprites for the Invulnerability power-up. Monsters are
  1510. the most complicated. They have several different sequences, for walking,
  1511. firing, dying, etc, and they have different sprites for different angles.
  1512. PLAYA1, PLAYA2A8, PLAYA3A7, PLAYA4A6, and PLAYA5 are all for the first frame
  1513. of the sequence used to display a walking (or running) player. 1 is the view
  1514. from the front, 2 and 8 mean from front-right and front-left (the same sprite
  1515. is used, and mirrored appropriately), 3 and 7 the side, 5 the back.
  1516.         Each picture has three sections, basically. First, a four-integer
  1517. header. Then a number of long-integer pointers. Then the picture pixel color
  1518. data.
  1519.  
  1520. [5-1]: Header
  1521. =============
  1522.  
  1523.         The header has four fields:
  1524.  
  1525. (1) Width. The number of columns of picture data.
  1526. (2) Height. The number of rows.
  1527. (3) Left offset. The number of pixels to the left of the center; where the
  1528.       first column gets drawn.
  1529. (4) Top offset. The number of pixels above the origin; where the top row is.
  1530.  
  1531.         The width and height define a rectangular space or limits for drawing
  1532. a picture within. To be "centered", (3) is usually about half of the total
  1533. width. If the picture had 30 columns, and (3) was 10, then it would be
  1534. off-center to the right, especially when the player is standing right in
  1535. front of it, looking at it. If a picture has 30 rows, and (4) is 60, it will
  1536. appear to "float" like a blue soul-sphere. If (4) equals the number of rows,
  1537. it will appear to rest on the ground. If (4) is less than that for an object,
  1538. the bottom part of the picture looks awkward.
  1539.         With walls patches, (3) is always (columns/2)-1, and (4) is always
  1540. (rows)-5. This is because the walls are drawn consistently within their own
  1541. space (There are two integers in each SIDEDEF which can offset the beginning
  1542. of a wall's texture).
  1543.         Finally, if (3) and (4) are NEGATIVE integers, then they are the
  1544. absolute coordinates from the top-left corner of the screen, to begin drawing
  1545. the picture, assuming the VIEW is FULL-SCREEN (the full 320x200). This is
  1546. only done with the picture of the doom player's current weapon - fist,
  1547. chainsaw, bfg9000, etc. The game engine scales the picture down appropriately
  1548. if the view is less than full-screen.
  1549.  
  1550. [5-2]: Pointers
  1551. ===============
  1552.  
  1553.         After the header, there are N = (# of columns) long integers (4 bytes
  1554. each). These are pointers to the data for each COLUMN. The value of the
  1555. pointer represents the offset in bytes from the first byte of the picture
  1556. resource.
  1557.  
  1558. [5-3]: Pixel Data
  1559. =================
  1560.  
  1561.         Each column is composed of some number of BYTES (NOT integers),
  1562. arranged in "posts":
  1563.         The first byte is the row to begin drawing this post at. 0 means
  1564. whatever height the header (4) upwards-offset describes, larger numbers move
  1565. correspondingly down.
  1566.         The second byte is how many colored pixels (non-transparent) to draw,
  1567. going downwards.
  1568.         Then follow (# of pixels) + 2 bytes, which define what color each
  1569. pixel is, using the game palette. The first and last bytes AREN'T drawn, and
  1570. I don't know why they are there. Probably just leftovers from the creation
  1571. process on the NExT machines. Only the middle (# of pixels in this post) are
  1572. drawn, starting at the row specified in byte 1 of the post.
  1573.         After the last byte of a post, either the column ends, or there is
  1574. another post, which will start as stated above.
  1575.         255 (hex FF) ends the column, so a column that starts this way is a
  1576. null column, all "transparent". Goes to the next column.
  1577.         Thus, transparent areas can be defined for either items or walls.
  1578.  
  1579. ---------------------------------------
  1580. CHAPTER [6]: Floor and Ceiling Textures
  1581. ---------------------------------------
  1582.  
  1583.         All the names for these textures are in the directory between the
  1584. F_START and F_END entries. There is no look-up or meta-structure as with the
  1585. walls. Each texture is 4096 raw bytes, making a square 64 by 64 pixels, which
  1586. is pasted onto a floor or ceiling, with the same orientation as the automap
  1587. would imply, i.e. the first byte is the color at the NW corner, etc. The
  1588. blocks in the grid are 128 by 128, so four floor tiles will fit in each
  1589. block.
  1590.         The data in F_SKY1 isn't even used since the game engine interprets
  1591. that special ceiling as see-through to the SKY texture beyond. So the F_SKY1
  1592. entry can have zero length.
  1593.         As discussed in chapter [5], replacement and/or new-name floors don't
  1594. work right from pwad files, only in the main IWAD.
  1595.         You can change all the floors and ceilings you want by constructing a
  1596. new DOOM.WAD, but you have to make sure no floor or ceiling uses an entry
  1597. name which isn't in your F_ section. And you have to include these four entries,
  1598. although you can change their contents (pictures): FLOOR4_8, SFLR6_1,
  1599. MFLR8_4, and FLOOR7_2. The first three are needed as backgrounds for the
  1600. episode end texts. The last is what is displayed "outside" the display window
  1601. if the display is not full-screen.
  1602.  
  1603. [6-1]: Animated floors
  1604. ----------------------
  1605.  
  1606.         See Chapter [8-4-1] for a discussion of how the animated walls and
  1607. floors work. Unfortunately, the fact that the floors all need to be lumped
  1608. together in one wad file means that its not possible to change the animations
  1609. via a pwad file, unless it contains ALL the floors, which amounts to several
  1610. hundred k. Plus you can't distribute the original data, so if you want to
  1611. pass your modification around, it must either have all the floors all-new,
  1612. or you must create some sort of program which will construct the wad from
  1613. the original DOOM.WAD plus your additions.
  1614.  
  1615. -----------------------------
  1616. CHAPTER [7]: Sounds and Songs
  1617. -----------------------------
  1618.  
  1619. [7-1]: D_[xxxxxx]
  1620. =================
  1621.  
  1622.         Songs.  What format are they? Apparently the MUS format, which I have
  1623. absolutely no knowledge of. But it's obvious what each song is for, from
  1624. their names.
  1625.  
  1626. [7-2]: DP[xxxxxx] and DS[xxxxxx]
  1627. ================================
  1628.  
  1629.         These are the sound effects. They come in pairs - DP for pc speaker
  1630. sounds, DS for sound cards.
  1631.         The DS sounds are in RAW format: they have a four integer header,
  1632. then the sound samples (each is 1 byte since they are 8-bit samples).
  1633.         The headers' four (unsigned) integers are: 3, then 11025 (the sample
  1634. rate), then the number of samples, then 0. Since the maximum number of
  1635. samples is 65535, that means a little less than 6 seconds is the longest
  1636. possible sound effect.
  1637.  
  1638. -------------------------------------------------
  1639. CHAPTER [8]: Some Important Non-picture Resources
  1640. -------------------------------------------------
  1641.  
  1642. [8-1]: PLAYPAL
  1643. ==============
  1644.  
  1645.         There are 14 palettes here, each is 768 bytes = 256 rgb triples. That
  1646. is, the first three bytes of a palette are the red, green, and blue portions
  1647. of color 0. And so on.
  1648.         Note that standard VGA boards whose palettes only encompass 262,144
  1649. colors only accept values of 0-63 for each channel (rgb), so the values would
  1650. need to be divided by 4.
  1651.         Palette 0 is the one that is used for almost everything.
  1652.         Palettes 10-12 are used (briefly) when an item is picked up, the more
  1653. items that are picked up in quick succession, the brighter it gets, palette
  1654. 12 being the brightest.
  1655.         Palette 13 is used while wearing a radiation suit.
  1656.         Palettes 3, 2, then 0 again are used after getting berserk strength.
  1657.         If the player is hurt, then the palette shifts up to X, then comes
  1658. "down" one every half second or so, to palette 2, then palette 0 (normal)
  1659. again. What X is depends on how badly the player got hurt: Over 100% damage
  1660. (add health loss and armor loss), X=8. 93%, X=7. 81%, X=6. 55%, X=5. 35%,
  1661. X=4. 16%, X=2.
  1662.  
  1663. [8-2]: COLORMAP
  1664. ===============
  1665.  
  1666.         This contains 34 sets of 256 bytes, which "map" the colors "down" in
  1667. brightness. Brightness varies from sector to sector. At very low brightness,
  1668. almost all the colors are mapped to black, the darkest gray, etc. At the
  1669. highest brightness levels, most colors are mapped to their own values,
  1670. i.e. they don't change.
  1671.         In each set of 256 bytes, byte 0 will have the number of the palette
  1672. color to which original color 0 gets mapped.
  1673.         The colormaps are numbered 0-33. Colormaps 0-31 are for the different
  1674. brightness levels, 0 being the brightest (light level 248-255), 31 being the
  1675. darkest (light level 0-7).
  1676.         Colormap 32 is used for every pixel in the display window (but not
  1677. the status bar), regardless of sector brightness, when the player is under the
  1678. effect of the "Invulnerability" power-up. This map is all whites/greys.
  1679.         Colormap 33 is all black for some reason.
  1680.  
  1681. [8-3]: DEMO[1-3]
  1682. ================
  1683.  
  1684.         These are the demos that will be shown if you start doom, and do
  1685. nothing else. Demos can be created using the devparm parameter:
  1686.  
  1687. DOOM -devparm -record DEMONAME
  1688.  
  1689.         The extension .LMP is automatically added to the DEMONAME. Other
  1690. parameters may be used simultaneously, such as -skill [1-5], -warp [1-3]
  1691. [1-9], -file [pwad_filename], etc. The demos in the WAD are in exactly the
  1692. same format as these LMP files, so a LMP file may be simply pasted or
  1693. assembled into a WAD, and if its length and pointer directory entries are
  1694. correct, it will work.
  1695.         This is assuming the same version of the game, however. For some
  1696. illogical reason, demos made with 1.1 doom don't work in 1.2 doom, and vice
  1697. versa. If I had a pressing need to convert an old demo, I might try to
  1698. figure out why, but I don't.
  1699.         The game only accesses DEMO1, DEMO2, and DEMO3, so having more than
  1700. that in a pwad file is pointless.
  1701.  
  1702. [8-4]: TEXTURE1 and TEXTURE2
  1703. ============================
  1704.  
  1705.         These resources contains a list of the wall names used in the various
  1706. SIDEDEFS sections of the level data. Each wall name actually references a
  1707. meta-structure, defined in this list. TEXTURE2 has all the walls that are
  1708. only in the registered version.
  1709.         First is a table of pointers to the start of the entries. There is a
  1710. long integer (say, N) which is the number of entries in the TEXTURE resource.
  1711. Then follow N long integers which are the offsets in bytes from the beginning
  1712. of the TEXTURE resource to the start of that texture's definition entry.
  1713.         Then follow N texture entries, which each consist of a 8-byte name
  1714. field and then a variable number of 2-byte integer fields:
  1715.  
  1716. (1) The name of the texture, used in SIDEDEFS, e.g. "STARTAN3".
  1717. (2) always 0.
  1718. (3) always 0.
  1719. (4) total width of texture
  1720. (5) total height of texture
  1721.  
  1722.         The fourth and fifth fields define a "space" (usually 128 by 128 or
  1723. 64 by 72 or etc...) in which individual wall patches are placed to form the
  1724. overall picture. This is done because there are some wall patches that are
  1725. used in several different walls, like computer screens, etc. Note that to
  1726. tile properly in the vertical direction on a very tall wall, a texture has to
  1727. have height 128, the maximum. The maximum width is 256. The sum of the sizes
  1728. of all the wall patches used in a single texture must be <= 64k.
  1729.  
  1730. (6) always 0.
  1731. (7) always 0.
  1732. (8) Number of 5-field patch descriptors that follow. This is why each texture
  1733.     entry has variable length. Many entries have just 1 patch, one has 64!
  1734.  
  1735.         1. x offset from top-left corner of texture space defined in field
  1736.            4/5 to start placement of this patch
  1737.         2. y offset
  1738.         3. number, from 0 to whatever, of the entry in the PNAMES resource,
  1739.            which contains the name from the directory, of the wall patch to
  1740.            use...
  1741.         4. always 1, is for something called "stepdir"...
  1742.         5. always 0, is for "colormap"...
  1743.  
  1744.         The texture's entry ends after the last of its patch descriptors.
  1745.         Note that patches can have transparent parts, since they are in the
  1746. same picture format as everything else. Thus there can be (and are)
  1747. transparent wall textures. These should only be used on a border between two
  1748. sectors, to avoid the "displaying nothing" problems.
  1749.         Here is how one can add walls, while still retaining any of the
  1750. original ones it came with: in a pwad, have replacement entries for PNAMES
  1751. and TEXTURE2. These will be the same as the originals, but with more entries,
  1752. for the wall patches and assembled textures that you're adding. Then have
  1753. entries for every new name in PNAMES, as well as old names which you want to
  1754. associate to new pictures. You don't need to use the P_START and P_END
  1755. entries.
  1756.  
  1757. [8-4-1]: Animated walls
  1758. -----------------------
  1759.  
  1760.         It is possible to change the walls and floors that are animated, like
  1761. the green blocks with a sewer-like grate that's spewing green slime
  1762. (SLADRIPx). The game engine sets up as many as 8 animation cycles for walls
  1763. based on the entries in the TEXTURE resources, and up to 5 based on what's
  1764. between F_START and F_END. The entries in FirstTexture and LastTexture,
  1765. below, and all the entries between them (in the order that they occur in a
  1766. TEXTURE list), are linked. If one of them is called by a sidedef, that sidedef
  1767. will change texture to the next in the cycle about 5 times a second , going back
  1768. to First after Last. Note that the entries between First and Last need not
  1769. be the same in number as in the original, nor do they have to follow the same
  1770. naming pattern, though that would probably be wise. E.g. one could set up
  1771. ROCKRED1, ROCKREDA, ROCKREDB, ROCKREDC, ROCKREDD, ROCKREDE, ROCKRED3 for
  1772. a 7-frame animated wall!
  1773.         If First and Last aren't in either TEXTURE, no problem. Then that
  1774. cycle isn't used. But if First is, and Last either isn't or is listed
  1775. BEFORE First, then an error occurs.
  1776.  
  1777. FirstTexture    LastTexture     Normal # of frames
  1778.  
  1779. BLODGR1         BLODGR4         4
  1780. BLODRIP1        BLODRIP4        4
  1781. FIREBLU1        FIREBLU2        2
  1782. FIRELAV3        FIRELAVA        2
  1783. FIREMAG1        FIREMAG3        3
  1784. FIREWALA        FIREWALL        3
  1785. GSTFONT1        GSTFONT3        3
  1786. ROCKRED1        ROCKRED3        3
  1787. SLADRIP1        SLADRIP3        3
  1788.  
  1789.  
  1790. (floor/ceiling animations) -
  1791.  
  1792. NUKAGE1         NUKAGE3         3
  1793. FWATER1         FWATER3         3
  1794. SWATER1         SWATER4         4
  1795. LAVA1           LAVA4           4
  1796. BLOOD1          BLOOD3          3
  1797.  
  1798.         Note that the SWATER entries aren't in the regular DOOM.WAD.
  1799.  
  1800. [8-5]: PNAMES
  1801. =============
  1802.  
  1803.         This is a lookup table for the numbers in TEXTURE[1 or 2] to
  1804. reference to an actual entry in the directory which is a wall patch (in the
  1805. picture format described in chapter [5]).
  1806.         The first two bytes of the PNAMES resource is an integer P which is
  1807. how many entries there are in the list.
  1808.         Then come P 8-byte names, each of which duplicates an entry in the
  1809. directory. If a patch name can't be found in the directory (including the
  1810. external pwad's directories), an error will occur. This naming of resources
  1811. is apparently not case-sensitive, lowercase letters will match uppercase.
  1812.         The middle integer of each 5-integer "set" of a TEXTURE1 entry is
  1813. something from 0 to whatever. Number 0 means the first entry in this PNAMES
  1814. list, 1 is the second, etc...
  1815.  
  1816.         Thanks for reading the "Official" DOOM Specs!
  1817.