home *** CD-ROM | disk | FTP | other *** search
/ DOOM Developers Kit / Doom_Developers_Kit_Vol1.iso / doom_i / text / doom13.spe < prev    next >
Encoding:
Internet Message Format  |  1995-02-01  |  93.0 KB

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