home *** CD-ROM | disk | FTP | other *** search
/ Doom Fever / Doom_Fever-1995_Maple_Media.iso / dmmaped / mde10.zip / DMSPCS12.TXT next >
Text File  |  1994-03-10  |  60KB  |  1,362 lines

  1. -----------------------------------------------------------------------------
  2.        T H E   U N O F F I C I A L   *-D-*-*-O-*-*-O-*-*-M-*   S P E C S
  3.                        Release v1.2 - March 6, 1994 EST
  4.                   Written by: Matt Fell (matt.burnett@acebbs.com)
  5.               Released by: Hank Leukart (ap641@cleveland.freenet.edu)
  6.           "DOOM: Where hackers gnaw the bones left from the banquet
  7.                  of data prepared by the mighty wizards of id."
  8.            "The poets talk about love, but what I talk about is DOOM,
  9.                  because in the end, DOOM is all that counts."
  10.            - Alex Machine/George Stark/Stephen King, _The Dark Half_
  11. -----------------------------------------------------------------------------
  12.  
  13. ----------
  14. DISCLAIMER
  15. ----------
  16.  
  17.         These specs are to aid in informing the public about the game DOOM,
  18. by id Software.  In no way should this promote your killing yourself, killing
  19. others, or killing in any other fashion.  Additionally, neither Hank Leukart
  20. nor Matt Fell claim ANY responsibility regarding ANY illegal activity
  21. concerning this file, or indirectly related to this file.  The information
  22. contained in this file only reflects id Software indirectly, and questioning
  23. id Software regarding any information in this file is not recommended.
  24.  
  25. ---------
  26. COPYRIGHT
  27. ---------
  28.  
  29.         You may NOT distribute this work by any non-electronic media,
  30. including but not limited to books, newsletters, magazines, manuals,
  31. catalogs, and speech.  You may NOT distribute this work in electronic
  32. magazines, or within computer software without prior written explicit
  33. permission.  These rights are temporary and revocable upon written, oral,
  34. or other notice by Hank Leukart.  This copyright notice shall be governed
  35. by the laws of the state of Ohio.
  36.         If you would like additional rights beyond those granted above,
  37. write to the distributor at "ap641@cleveland.freenet.edu" on the Internet.
  38.  
  39. ------------
  40. INTRODUCTION
  41. ------------
  42.  
  43.         Here are the long awaited unofficial specs for DOOM.  These specs
  44. should be used for creating add-on software for the game. I would like to
  45. request that these specs be used in making utilities that ONLY work on the
  46. registered version of DOOM.
  47.         I do not understand much of what is contained in this file, so if
  48. you have any questions about the information, write to Matt Fell at
  49. "matt.burnett@acebbs.com" on the Internet.  If you would like to request a
  50. copy of this file, or have any questions about its distribution, write to me,
  51. Hank Leukart, at "ap641@cleveland.freenet.edu" on the Internet.
  52.  
  53. --------
  54. CONTENTS
  55. --------
  56.  
  57. [1] Author's Notes
  58.         [1-1] Acknowledgements
  59. [2] Basics
  60. [3] Directory Overview
  61. [4] The Maps, The Levels
  62.         [4-1] ExMy
  63.         [4-2] THINGS
  64.                 [4-2-1] Thing Types
  65.         [4-3] LINEDEFS
  66.                 [4-3-1] Linedef Attributes
  67.                 [4-3-2] Linedef Types
  68.         [4-4] SIDEDEFS
  69.         [4-5] VERTEXES
  70.         [4-6] SEGS
  71.         [4-7] SSECTORS
  72.         [4-8] NODES
  73.         [4-9] SECTORS
  74.         [4-10] REJECT
  75.         [4-11] BLOCKMAP
  76. [5] Pictures' Format
  77.         [5-1] Headers
  78.         [5-2] Pointers
  79.         [5-3] Pixel Data
  80. [6] Floor and Ceiling Textures
  81.         [6-1] Animated floors
  82. [7] Songs and Sounds
  83.         [7-1] Songs
  84.         [7-2] Sounds
  85. [8] Miscellaneous Non-Picture Resources
  86.         [8-1] PLAYPAL
  87.         [8-2] COLORMAP
  88.         [8-3] DEMOs
  89.         [8-4] TEXTURE1 and TEXTURE2
  90.                 [8-4-1] Animated walls
  91.         [8-5] PNAMES
  92.  
  93. ---------------------------
  94. CHAPTER [1]: Author's Notes
  95. ---------------------------
  96.  
  97. I didn't want to release another incomplete version of the specs, but
  98. the NODES structure is so much more difficult than all of the other stuff,
  99. I'm not sure how much longer it will be until either I or someone
  100. helping me can figure it out. Since I have almost complete information
  101. on everything else, I felt I should go ahead and release this now.
  102.  
  103. Without knowing how to do the NODES, we still can't create levels from
  104. scratch. So these specs will have to undergo another revision. I've heard
  105. rumors of the hint book, with the official specs, being released "soon";
  106. if anyone knows more about this, or if they get the book, please contact me.
  107.  
  108. I haven't kept track of all the minor revisions that have been made since
  109. 1.1, sorry. You can get rid of the 1.1 specs, as this has everything it
  110. had except the errors :-)
  111.  
  112. id SOFTWARE'S COPYRIGHT AND THE SHAREWARE VERSION:
  113.  
  114. I'm moving the location of the soapbox I had in the 1.1 Specs to here. I'm
  115. certainly not an official spokesman for id. I have made some inquiries to
  116. them regarding specific questions on third-party additions. Until they
  117. respond, though, I'll just make a couple excerpts from the official
  118. documents we have at this time:
  119.  
  120.  
  121. The LICENSE.DOC says
  122.  
  123.        "You may not:  rent, lease, modify, translate, disassemble,
  124.         decompile, reverse engineer, or create derivative works based
  125.         upon the Software. Notwithstanding the foregoing, you may create
  126.         a map editor, modify maps and make your own maps (collectively
  127.         referenced as the "Permitted Derivative Works") for the Software.
  128.         You may not sell or distribute any Permitted Derivative Works but
  129.         you may exchange the Permitted Derivative Works at no charge
  130.         amongst other end-users."
  131.  
  132. It also says
  133.  
  134.         (except for backup purposes) "You may not otherwise reproduce,
  135.         copy or disclose to others, in whole or in any part, the Software."
  136.  
  137. I think this is clear. You may not distribute a WAD file that contains
  138. any of the original entries from DOOM.WAD.
  139.  
  140. Then how can you just make a new set of THINGS for a level? Simple. Have
  141. a pwad file that has only two entries - E3M1 for example, and THINGS.
  142.  
  143. The README.EXE says
  144.  
  145.        "id Software respectfully requests that you do not modify the
  146.         levels for the shareware version of DOOM.  We feel that the
  147.         distribution of new levels that work with the shareware version
  148.         of DOOM will lessen a potential user's incentive to purchase the
  149.         registered version.
  150.  
  151.        "If you would like to work with modified levels of DOOM, we
  152.         encourage you to purchase the registered version of the game."
  153.  
  154. I feel that this is also pretty clear: if you distribute levels, they should
  155. not work with the shareware version. This is easily accomplished: do
  156. not distribute ANY episode one maps! The shareware version cannot work
  157. with episode 2 or 3 pwads, but it can work with episode 1 pwads (they
  158. should have disabled the -file feature in the shareware).
  159.  
  160. If you are writing a utility that will operate on DOOM, have it first check
  161. the WAD file for the existence of an "E3M1" entry in the directory (explained
  162. below), or some other entry that will only be in the registered version.
  163. If it's not there, the program should quit. You should not be making
  164. programs that will work on the shareware version.
  165.  
  166. The point is that the regular shareware players shouldn't be able to exceed
  167. their rights. They are getting a complete game as it is!
  168.  
  169. [1-1]: Acknowledgements
  170. =======================
  171.  
  172. I have received much assistance lately from the following people. They
  173. either brought mistakes to my attention, or provided additional information
  174. that I've incorporated into these specs:
  175.  
  176. Ted (tedv@geom.umn.ed) - I had the THING angles wrong. Unforgivable.
  177. Matt Tagliaferri (matt.tagliaferri@pcohio.com) - I forgot to describe the
  178.         TEXTURE1/2 pointer table. Also, gave lots of help with linedef types.
  179. Raphael Quinet (quinet@montefiore.ulg.ac.be) - The author of the NEWDEU
  180.         editor; new info on linedef types and attributes, special sectors.
  181. Robert Fenske (fenske@swri.edu) - part of the VERDA team, gave lots of help
  182.         on linedef attributes and types, blockmap list, special sectors,
  183.         and other stuff
  184. John A. Matzen (jamatzen@cs.twsu.edu) - instrument names in GENMIDI.
  185. Jeff Bird (jeff@wench.ece.jcu.edu.au) - good ideas and suggestions about
  186.         the nodes.
  187.  
  188. Sorry if I left anyone out. Thanks for all the help!
  189.  
  190. If you have any comments, have spotted any errors, or have any possible
  191. additions, please send me e-mail. Questions will be gladly answered also,
  192. no matter how trivial, unless I get too many, which I doubt. Please note,
  193. however, that if it's not in here, I'm either working on it or I just don't
  194. know it. If YOU know "it", tell me!
  195.  
  196. -------------------
  197. CHAPTER [2]: Basics
  198. -------------------
  199.  
  200. Don't make episode 1 maps! Don't make utilities that work on the shareware
  201. version!  For more information on this, see Chapter [1].
  202.  
  203. There are two types of WAD files. The original DOOM.WAD file is an "IWAD",
  204. meaning it contains all of the data necessary to play. The other type is the
  205. "PWAD" file, an external file which has the same structure, but with far
  206. fewer entries in the directory (explained below). The data in a PWAD is
  207. substituted for the original data in the DOOM.WAD, thus allowing for much
  208. easier distribution of new levels. Only what the PWAD wants to change is
  209. changed, everything else stays the same. Most PWADs will contain the 11
  210. entries necessary to define a single level. For example, if Bill Clinton
  211. were to create a new level 7 for episode 3, he might call it BILLC-37.WAD
  212.  
  213. To use this level instead of the original E3M7 level, a player would type
  214.  
  215. DOOM -FILE BILLC-37.WAD
  216.  
  217. at the command line, along with any other parameters. More than one can be
  218. done at the same time, thus in general
  219.  
  220. DOOM -FILE [pwad_filename] [pwad_filename] [pwad_filename] ...
  221.  
  222. When the game loads, a "modified game" message will appear if there are any
  223. PWADs involved, reminding the player that id Software will not give technical
  224. support or answer questions regarding modified levels.
  225.  
  226. Note that PWAD files must have the .WAD extension to work - I've tried
  227. extensions like .PWD and .37 and they don't work.
  228.  
  229. The original doom levels are pretty complicated, and they are from 50-200
  230. kilobytes in size, uncompressed. My simple prototype levels are just a
  231. few kbytes. I'm estimating that my first epsiode 2 with 9 complete levels
  232. plus a few other things, will be about 1 megabyte uncompressed, about 300k
  233. in a ZIP file.
  234.  
  235. The first twelve bytes of a WAD file are as follows:
  236.  
  237. Bytes 0 to 3 - must contain the ASCII letters "IWAD" or "PWAD"
  238.  
  239. Bytes 4 to 7 - contain a long integer which is the number of entries in the
  240.                "directory"
  241.  
  242. Bytes 8 to 11 - contain a pointer to the first byte of the "directory"
  243.  
  244. (Bytes 12 to the start of the directory contain resource data)
  245.  
  246. The directory referred to is a list, located at the end of the WAD file,
  247. which contains the pointers, lengths, and names of all the resources in the
  248. WAD file. The resources in the wad include item pictures, monster's pictures
  249. for animation, wall patches, floor and ceiling textures, songs, sound
  250. effects, map data, and many others.
  251.  
  252. Specifically, the first 12 bytes of the DOOM.WAD file in version 1.2, which
  253. I am working with, are (in hexadecimal):
  254.  
  255. 49 57 41 44 fd 07 00 00 84 2e 9e 00
  256.  
  257. This is "IWAD", then 7fd hex (=2045 decimal) for the number of directory
  258. entries, then 9e2e84 (=10366596 decimal) for the first byte of the directory.
  259.  
  260. Each directory entry is 16 bytes long, arranged this way:
  261.  
  262. First four bytes:       pointer to start of resource (a long integer)
  263. Next four bytes:        length of resource (another long integer)
  264. Last eight bytes:       name of resource, in ASCII letters, ending with
  265.                         00s if less than eight bytes.
  266.  
  267. -------------------------------
  268. CHAPTER [3]: Directory Overview
  269. -------------------------------
  270.  
  271. This is a list of most of the directory entries.
  272.  
  273. PLAYPAL   contains fourteen 256 color palettes, used while playing Doom.
  274. COLORMAP  maps colors in the palette down to darker ones, for areas of less
  275.           than maximum brightness (quite a few of these places, huh?).
  276. ENDOOM    is the text message displayed when you exit to DOS.
  277. DEMOx     x=1-3, are the demos which will play if you just sit and watch.
  278.  
  279. E1M1      etc, to E3M9, along with its 10 subsequent entries, defines the
  280.           map data for a single level or mission.
  281.  
  282. TEXTURE1  is a list of wall type names used in the SIDEDEF portion of each
  283.           level's data, and their composition data, i.e. what wall patches
  284.           make up each "meta-wall".
  285. TEXTURE2  contains the walls that are only in the registered version.
  286. PNAMES    is the list of wall patches, which are referenced by number in
  287.           the TEXTURE1/2 resources.
  288.  
  289. GENMIDI   has the names of every General Midi standard instrument in order
  290.           from 0-127. Anyone know more...?
  291. DMXGUS    obviously has to do with Gravis Ultra Sound...
  292.  
  293. D_ExMy    is the music for episode x level y.
  294. D_INTER   is the music played on the summary screen between levels.
  295. D_INTRO   is the the 4 second music played when the game starts.
  296. D_INTROA  is also intoductory music.
  297. D_VICTOR  is the music played on the victory text-screen after an episode.
  298. D_BUNNY   is music for while a certain rabbit has his story told...
  299.  
  300. DP_xxxxx  DP and DS come in pairs and are the sound effects.
  301. DS_xxxxx     DP_ are the PC speaker sounds, DS_ are the sound card sounds.
  302.  
  303. all the remaining entries in the directory, except the floor textures at the
  304. end, and the "separators" like S_START, refer to resources which are pictures
  305. in the doom/wad picture format described in chapter [4].
  306.  
  307. The next seven are full screen (320 by 200 pixel) pictures:
  308.  
  309. HELP1     The ad-screen that says Register!, with some screen shots
  310. HELP2     The actual help, all the controls explained
  311. TITLEPIC  Maybe this is the title screen? Gee, I dunno...
  312. CREDIT    The credits, the people at id Software who created this great game
  313. VICTORY2  The screen shown after a victorious end to episode 2
  314. PFUB1     A nice little rabbit minding his own peas and queues...
  315. PFUB2     ...maybe a hint of what's waiting in Doom Commercial version.
  316.  
  317. ENDx      x=0-6, "THE END" text, with (x) bullet holes.
  318.  
  319. AMMNUMx   x=0-9, are the grey digits used in the status bar for ammo count.
  320. STxxxxxx  are small pictures and text used on the status bar.
  321. M_xxxxxx  are text messages (yes, in picture format) used in the menus.
  322. BRDR_xxx  are tiny two pixel wide pictures use to frame the viewing window
  323.           when it is not full screen.
  324. WIxxxxxx  are pictures and messages used on the summary screen after
  325.           the completion of a level.
  326. WIMAPx    x=0-2, are the summary-screen maps used by each episode.
  327.  
  328. S_START   has 0 length and is right before the item/enemy section
  329. S_END     is immediately after the last "sprite"
  330. P_START   marks the beginning of the wall patches
  331. P1_START      before the first of the shareware wall patches
  332. P1_END        after the last of the shareware wall patches
  333. P2_START      before the first of the registered wall patches
  334. P2_END        before the first of the registered wall patches
  335. P_END     marks the end of the wall patches
  336. F_START   marks the beginnning of the floors
  337. F1_START      before the first shareware floor texture
  338. F1_END        after the last shareware floor texture
  339. F2_START      before the first registered floor texture
  340. F2_END        after the last registered floor texture
  341. F_END     marks the end of the floors
  342.  
  343. And that's the end of the directory. Detailed info on specific resources
  344. follows...
  345.  
  346. ---------------------------------
  347. CHAPTER [4]: The Maps, The Levels
  348. ---------------------------------
  349.  
  350. Each level needs eleven resources/directory entries: E[x]M[y] (where x is a
  351. single digit 1-3 for the episode number and y is 1-9 for the mission/level
  352. #), THINGS, LINEDEFS, SIDEDEFS, VERTEXES, SEGS, SSECTORS, NODES, SECTORS,
  353. REJECT, BLOCKMAP.
  354.  
  355. [4-1]: ExMy
  356. ===========
  357.  
  358. This is just the name resource for a (single) level, and has zero length.
  359. In the DOOM.WAD file, each is followed by all ten of the component resources
  360. for that level. In a pwad external file, they don't all need to be present.
  361. Whichever entries are in a pwad will be substituted for the originals.
  362. For example, a pwad with just two entries, E3M1 and THINGS, would use all
  363. the walls and such from the original E3M1, but could have a completely
  364. different set of THINGS on it.
  365.  
  366. [4-2]: THINGS
  367. =============
  368.  
  369. Each thing is ten bytes, consisting of five (integer) fields:
  370.  
  371. (1) X coordinate of thing
  372. (2) Y coordinate of thing
  373.  
  374. Each level has a different "range" to its coordinates. On E1M1, X ranges
  375. from (c.) -288 to +3440, and Y ranges from (c.) -4832 to -2144.
  376. On the automap within the game, with the grid on (press 'G'), the lines are
  377. hex 80 (decimal 128) apart, two lines = hex 100, dec 256.
  378.  
  379. (3) Angle the thing faces. On the automap, 0 is east, 90 is north, 180 is
  380.     west, 270 is south.
  381.  
  382. This value is only used for enemies, player starts, deathmatch random starts,
  383. and teleporter incoming spots. Other things look the same from all
  384. directions. Values are rounded to the nearest 45 degree angle, so if the
  385. value is 80, it will actually face 90 - north.
  386.  
  387. (4) Type of thing, see next subsection
  388. (5) Attributes of thing, which are set by bits:
  389.  
  390. bit 0   is set if the THING is present at skill 1 and 2
  391. bit 1   is set if the THING is on skill 3 (hurt me plenty)
  392. bit 2   is set if the THING is on skill 4 and 5 (ultra-violence, nightmare)
  393.  
  394.         The skill settings are most used with the ENEMIES, of course...the
  395.         most common skill level settings are hex 07/0f (on all skills),
  396.         06/0e (on skill 3-4-5), and 04/0c (only on skill 4-5).
  397. bit 3   is set to indicate a deaf guard. This only has meaning for enemies,
  398.  
  399.         who will not attack until they see a player if they are "deaf".
  400.         Otherwise, they will activate when they hear gunshots, etc. Sound
  401.         does not travel through solid walls (walls that are solid at the
  402.         time of the noise). Also, lines can be set so that sound does not
  403.         pass through them (see [3-3-1] bit 6). This attribute is also
  404.         known as the "ambush" attribute.
  405.  
  406. bit 4   makes the THING only appear in multiplayer mode.
  407.  
  408. bits 5-15 have no effect.
  409.  
  410. [4-2-1]: Thing Types
  411. --------------------
  412.  
  413. Bytes 6-7 of each thing are an integer which specifies what kind it is.
  414.  
  415. Symbol  means
  416.  
  417. CAPITAL It's a monster; counts towards KILL ratio at end of level.
  418. $       A regular item that you can get.
  419.  
  420. !       An artifact item whose acquisition counts towards the ITEM ratio
  421.         at the end of a level
  422. *       An obstacle, something that players and monsters can't move through.
  423. 2,3,4   Indicates number of different frames for animated things, except
  424.         monsters
  425.  
  426. Decimal Hex     Thing is:
  427.  
  428. 0       0000    (nothing?)
  429. 1       0001    Player 1 start
  430. 2       0002    Player 2 start for cooperative mode multiplayer games.
  431. 3       0003    Player 3 start          "                "
  432. 4       0004    Player 4 start          "                "
  433. 5       0005 2$ Blue keycard
  434. 6       0006 2$ Yellow keycard
  435. 7       0007  * SPIDER DEMON: giant walking brain boss (SPID)
  436. 8       0008 2$ Backpack
  437. 9       0009  * FORMER HUMAN SERGEANT: black armor shotgunners (SPOS)
  438. 10      000a    Bloody mess (an exploded player)
  439. 11      000b    Deathmatch start positions. Must be at least 4 per level.
  440. 12      000c    Bloody mess, exactly the same as 10
  441. 13      000d 2$ Red Keycard
  442. 14      000e    Marks the spot where a player (or enemy) lands when
  443.                 they teleport to the SECTOR that contains this thing.
  444. 15      000f    Dead player
  445. 16      0010  * CYBER-DEMON: robo-boss, rocket launcher (CYBR)
  446. 17      0011  $ Cell charge pack
  447. 18      0012    Dead former human
  448. 19      0013    Dead former sargeant
  449. 20      0014    Dead imp
  450. 21      0015    Dead demon
  451. 22      0016    Dead cacodemon
  452. 23      0017    Dead lost soul, invisible since they blow up when killed
  453. 24      0018    Pool of blood
  454. 25      0019  * Impaled human
  455. 26      001a 2* Twitching impaled human
  456. 27      001b  * Skull on a pole
  457. 28      001c  * 5 skulls shishkebob
  458. 29      001d 2* Pile of skulls and candles
  459. 30      001e  * Tall green pillar
  460. 31      001f  * Short green pillar
  461. 32      0020  * Tall red pillar
  462. 33      0021  * Short red pillar
  463. 34      0022    Candle
  464. 35      0023  * Candelabra
  465. 36      0024 2* Short green pillar with beating heart
  466. 37      0025  * Short red pillar with skull
  467. 38      0026 2$ Red skullkey
  468. 39      0027 2$ Yellow skullkey
  469. 40      0028 2$ Blue skullkey
  470. 41      0029 3* Eye in symbol
  471. 42      002a 3* Flaming skull-rock
  472. 43      002b  * Grey tree
  473. 44      002c 4* Tall blue firestick
  474. 45      002d 4* Tall green firestick
  475. 46      002e 4* Tall red firestick
  476. 47      002f  * Small brown scrub
  477. 48      0030  * Tall, techno column
  478. 49      0031 3* Hanging victim, swaying, legs gone
  479. 50      0032  * Hanging victim, arms out
  480. 51      0033  * Hanging victim, 1-legged
  481. 52      0034  * Hanging victim, upside-down, upper body gone
  482. 53      0035  * Hanging severed leg
  483. 54      0036  * Large brown tree
  484. 55      0037 4* Short blue firestick
  485. 56      0038 4* Short green firestick
  486. 57      0039 4* Short red firestick
  487. 58      003a  * SPECTRE: invisible version of the DEMON (SARG)
  488. 59      003b    Hanging victim, arms out
  489. 60      003c    Hanging victim, upside-down, upper body gone
  490. 61      003d    Hanging victim, 1-legged
  491. 62      003e    Hanging severed leg
  492. 63      003f 3  Hanging victim, swaying, legs gone
  493.  
  494. 2001    07d1  $ Shotgun
  495. 2002    07d2  $ Chaingun, gatling gun, mini-gun, whatever
  496. 2003    07d3  $ Rocket launcher
  497. 2004    07d4  $ Plasma gun
  498. 2005    07d5  $ Chainsaw
  499.  
  500. 2006    07d6  $ BFG9000
  501. 2007    07d7  $ Ammo clip
  502. 2008    07d8  $ 4 shotgun shells
  503. 2010    07da  $ 1 rocket
  504. 2011    07db  $ Stimpak
  505. 2012    07dc  $ Medikit
  506. 2013    07dd 4! Soulsphere, Supercharge, +100% health
  507. 2014    07de 4! Health bonus
  508. 2015    07df 4! Armor bonus
  509. 2018    07e2 2$ Green armor 100%
  510. 2019    07e3 2$ Blue armor 200%
  511. 2022    07e6 4! Invulnerability
  512. 2023    07e7  ! Berserk Strength
  513. 2024    07e8 4! Invisibility
  514. 2025    07e9  ! Radiation suit
  515. 2026    07ea 4! Computer map
  516. 2028    07ec  * Floor lamp
  517. 2035    07f3 2* Barrel - if blown up, doesn't block way anymore.
  518. 2045    07fd 2! Lite goggles
  519. 2046    07fe  $ Box of Rockets
  520. 2047    07ff  $ Cell charge
  521. 2048    0800  $ Box of Ammo
  522. 2049    0801  $ Box of Shells
  523.  
  524. 3001    0bb9  * IMP: brown fireball hurlers (TROO)
  525. 3002    0bba  * DEMON: pink bull-like chewers (SARG)
  526. 3003    0bbb  * BARON OF HELL: cloven hooved boss (BOSS)
  527. 3004    0bbc  * FORMER HUMAN: regular pistol shooting slimy human (POSS)
  528. 3005    0bbd  * CACODEMON: red one-eyed floating heads. Behold... (HEAD)
  529. 3006    0bbe  * LOST SOUL: flying flaming skulls, like to bite (SKUL)
  530.  
  531. [4-3]: LINEDEFS
  532. ===============
  533.  
  534. Each linedef represents a line from one of the VERTEXES to another, and each
  535. is 14 bytes, containing 7 (integer) fields:
  536.  
  537. (1) from the VERTEX with this number (the first vertex is 0).
  538. (2) to the VERTEX with this number (31 is the 32nd vertex).
  539. (3) attributes, see [3-3-1] below.
  540. (4) types, see [3-3-2] below.
  541. (5) is a "trigger" or "tag" number which ties this line's "effect" type to
  542.     all SECTORS that have the same "trigger" number in their last field.
  543. (6) "right" SIDEDEF, indexed number.
  544. (7) "left" SIDEDEF, if this line adjoins 2 SECTORS. Otherwise, it is equal
  545.     to -1 (FFFF hex).
  546.  
  547. "right" and "left" are based on the direction of the linedef as indicated
  548. by the "from" and "to" VERTEXES. This attempt at a sketch should make it
  549. clear what I mean:
  550.  
  551.         "left" side            "right" side
  552.  FROM -----------------> TO <----------------- FROM
  553.         "right" side           "left" side
  554.  
  555. In the original episodes, a line with a single side ALWAYS has that side
  556. as the "right" side. So it would probably be best to follow the convention.
  557.  
  558. [4-3-1]: Linedef Attributes
  559. ---------------------------
  560.  
  561. The third field of each linedef is an integer which controls that line's
  562. attributes with bits, as follows:
  563.  
  564. bit #   condition if it is set (=1)
  565.  
  566. bit 0   Impassibile. Players and monsters cannot cross this line, and
  567.         projectiles explode or "end" if they hit this line. Note, however,
  568.         that if there is no sector on the other side, beings can't go through
  569.         this line anyway. Important: if bit 2 is also set, projectiles CAN go
  570.         through the line, and if there is no sector on the other side, they
  571.         can go "forever", usually causing a CRASH.
  572.  
  573. bit 1   Monster-blocker. Monsters cannot cross this line.
  574.  
  575. bit 2   Two-sided. If this bit is set, then the linedef's two sidedefs can
  576.         have "-" as a texture, which means "transparent". If this bit is not
  577.         set, the sidedefs can't be transparent: if "-" is viewed, it will
  578.         result in the same hyper-junk that you see when you use the walk-
  579.         thru-walls cheat to go outside into nowhere. However, the linedef CAN
  580.         have two non-transparent sidedefs, even if this bit is not set, if it
  581.         is between two sectors.
  582.  
  583.         Another side effect of this bit is that if it is set, then
  584.         projectiles can go through it no matter what, and gunfire (pistol,
  585.         etc.) can go through it if there is a sector on the other side.
  586.  
  587. bit 3   Upper texture is "unpegged". This is usually done at windows.
  588.         "Pegged" textures move up and down when the neighbor sector moves up
  589.         or down. For example, if a ceiling comes down, then a pegged texture
  590.         on its side will move down with it so that it looks right. If the
  591.         side isn't pegged, it just sits there, the new material is
  592.         spontaneously created. The best way to get an idea of this is to
  593.         change a linedef on an elevator or door, which are always pegged,
  594.         and observe the result.
  595.  
  596. bit 4   Lower texture is unpegged.
  597.  
  598. bit 5   Secret. The automap will draw this line like a normal solid line that
  599.         doesn't have anything on the other side, thus protecting the secret
  600.         until it is opened. This bit is NOT what determines the SECRET ratio
  601.         at the end of a level, that is done by special sectors (#9).
  602.  
  603. bit 6   Blocks sound. Sound cannot cross a line that has this bit set.
  604.  
  605.         Sound normally travels from sector to sector, so long as the floor
  606.         and ceiling heights allow it (e.g. sound wouldn't go from a sector
  607.         with 0/64 floor/ceiling height to one with 72/128, but sound WOULD
  608.         go from a sector with 0/64 to one with 56/128).
  609.  
  610. bit 7   Not on map. The line is not shown on the regular automap, not even if
  611.         the computer all-map power up is gained. All lines show up on the
  612.         cheater's map, however (Booooo! I wish there were no cheat codes!)
  613.  
  614. bit 8   Already on map. When the level is begun, this line is already on the
  615.         automap, even if it hasn't been "seen" yet.
  616.  
  617. bits 9-15 are unused, EXCEPT for a large section of e2m7, where every wall
  618.         on the border of the section has bits 9-15 set, so they have values
  619.         like 1111111000000000 (-511) and 1111111000010000 (-495). This area
  620.         of e2m7 is also the only place in all 27 levels where there is a
  621.         linedef 4 value of -1. But the linedef isn't a switch. These unique
  622.         values either do nothing, or something that is as yet unknown. The
  623.         currently prevailing opinion is that they do nothing.
  624.  
  625. [4-3-2]: Linedef Types
  626. ----------------------
  627.  
  628. The integers in field 4 of a linedef control various special characteristics,
  629. mostly to do with what happens to a "triggered" SECTOR when the line is
  630. crossed or activated by a player.
  631.  
  632. Except for "Doors", the end-level switches, and the special type 48 (hex 30),
  633. all these effects need "trigger" or "tag" numbers. Then any and all sectors
  634. whose last field contains the same trigger number are affected when the
  635. linedef's function is activated.
  636.  
  637. What the letters in the ACT column mean:
  638.  
  639. W means the function happens when a player WALKS across the linedef. S means
  640. a player must push SPACEBAR near the linedef to activate it (doors and
  641. switches). G means a player must shoot the linedef (GUN).
  642.  
  643. 1 means it works once only. R means it is a repeatable function. This is
  644. tentative, because some functions that appear to work only once might
  645. actually work again if the conditions were reset. E.g. a sector ceiling
  646. rises, opening a little room with baddies in it. Usually, that's it. But
  647. perhaps if some other linedef triggered that sector ceiling to come down
  648. again, then the original trigger could make it go up, etc...
  649.  
  650. Dec/Hex   ACT   EFFECT
  651.  
  652. -1 ffff   ? ?   None? Only once in whole game, on e2m7, (960,768)-(928,768)
  653. 0    00   - -   nothing
  654. 1    01   S R   Door. Sector on the other "side" of this line has its
  655.                 ceiling rise c. 96 in altitude, then comes back down
  656.                 after c. 5 seconds.
  657. 2    02   W 1   ceiling rises like door
  658. 3    03   W 1   ceiling lowers
  659. 5    05   W 1   floor rises to match neighbor sector floor height.
  660. 7    07   S 1   staircase rises up from floor in appropriate sectors.
  661. 8    08   W 1   stairs
  662.  
  663. Note: The stairs function requires special handling. In the original
  664. episodes,
  665. an even number of steps get raised up; the first step and every other one
  666. thereafter are sectors which have the "trigger" number that the control
  667. linedef has, OR they (the sectors/steps) will have 999 or 99 as their
  668. trigger number. I can't figure out why the game uses the 999 thing, since
  669. just using the original trigger number works fine. Also, I don't know yet
  670. if all the steps must be the same size/shape, as they always are in real-map
  671. examples.
  672.  
  673. 9    09   S 1   floor lowers; neighbor sector's floor rises and changes
  674.                 TEXTURE to match yet another neighbor, and sector special
  675.                 type changes to 0.
  676. 10   0a   W 1   floor lowers, wait 3 seconds, rises
  677. 11   0b   S -   End level. Go to next level.
  678. 13   0d   W 1   brightness goes to 255
  679. 14   0e   S 1   floor rises to c. 64 above neighbor sector's floor
  680. 16   10   W 1   ceiling closes, opens after c. 30 seconds.
  681. 18   12   S 1   floor rises to equal first neighbor "on the way up"
  682. 19   13   W 1   floor lowers to equal the highest of the neighboring
  683.                 sector's floors
  684. 20   14   S 1   floor rises, TEXTURE change also.
  685. 21   15   S 1   floor lowers to equal, for c. 3 seconds, then rises back
  686.                 up to stop 8 below neighbor's ceiling height
  687. 22   16   W 1   floor rises, TEXTURE change also
  688. 23   17   S 1   floor lowers to match LOWEST neighbor sector?
  689. 26   1a   S R   Door. Need blue key to open. Closes after 5 seconds.
  690. 27   1b   S R   Door. Yellow key.
  691. 28   1c   S R   Door. Red key.
  692. 29   1d   S 1   ceiling rises, closes after c. 6 seconds?
  693. 30   1e   W 1   floor rises to c. 100-128 above neighbor's floor?
  694. 31   1f   S 1   Door. Stays open.
  695. 32   20   S 1   Door. Blue key. Stays open.
  696. 33   21   S 1   Door. Yellow key. Stays open.
  697. 34   22   S 1   Door. Red key. Stays open.
  698. 35   23   W ?   brightness goes to 0.
  699. 36   24   W ?   lower floor to 8 above neighbor.
  700.  
  701. 37   25   W 1   floor lowers, change floor to acid (special sector 7).
  702. 38   26   W 1   floor lowers
  703. 39   27   W 1   teleport to sector. make sure only one sector has the same
  704.                 trigger number as a line with this effect!
  705. 40   28   W 1   ceiling raises, like 2?
  706. 41   29   S 1   ceiling lowers to floor
  707. 42   2a   S R   ceiling closes like door
  708. 44   2c   W 1?  ceiling lowers to 8 above floor
  709. 46   2e   G 1   Shoot this line, then sector ceiling rises like a door
  710. 48   30   - -   Animated, horizontally scrolling wall.
  711. 51   33   S -   End level. Go to secret level 9.
  712. 52   34   W -   End level. Go to next level
  713. 56   38   W ?   crushing floor rises to 8 below ceiling
  714. 58   3a   W 1   floor rises c. 24-48
  715. 59   3b   W 1   floor rises 8, TEXTURE change to neighbor also
  716. 61   3d   S R   ceiling rises like door
  717. 62   3e   S R   floor lowers, rises after c. 3 seconds
  718. 63   3f   S R?  ceiling rises, lowers after c. 3 seconds
  719. 70   46   S R   sector floor drops quickly to 8 above neighbor
  720. 73   49   W R   start crushing ceiling, slow crush but fast damage
  721. 74   4a   W R   stops crushing ceiling
  722. 75   4b   W R   ceiling closes, and ?
  723. 76   4c   W ?   ceiling closes like door, opens after c. 10 seconds
  724. 77   4d   W R   start crushing ceiling, fast crush but slow damage
  725. 80   50   W 1?  brightness to 255
  726. 82   52   W R   floor lowers to equal neighbor
  727. 86   56   W R   ceiling rises, closes after c. 5 seconds
  728. 87   57   W R?  floor rises and lowers every 5 seconds
  729. 88   58   W R   floor lowers quickly, rises back up after c. 3 seconds
  730. 89   59   W R?  stops the up/down syndrome started by #87
  731. 90   5a   W R   ceiling rises, wait 5 seconds, comes down
  732. 91   5b   W R   floor rises to (neighbor ceiling - 8)
  733. 97   61   W R   teleport to sector. make sure only one sector has the same
  734.                 trigger number as a line with this effect!
  735. 98   62   W R   floor lowers to 8 above neighbor
  736. 102  66   S ?   floor lowers to equal neighbor
  737. 103  67   S 1?  ceiling rises like door, stays open
  738. 104  68   S 1   light drops to lowest light level amongst neighbor sectors
  739.  
  740. [4-4]: SIDEDEFS
  741. ===============
  742.  
  743. A sidedef is a definition of what wall meta-textures to draw along a LINEDEF,
  744. and a group of sidedefs define a SECTOR.
  745.  
  746. There will be one sidedef for a line that borders only one sector, since it
  747. is not necessary to define what the doom player would see from the "other"
  748. side of that line because the doom player can't go there. The doom player
  749. can only "go" where there is a sector (unless you use the no clipping cheat,
  750. which will cause the screen to freak out if you go "outside" to a non-sector
  751. area).
  752.  
  753. Each SIDEDEF is 30 bytes, comprising 2 (integer) fields, then 3 (8-byte
  754. string) fields, then a final (integer) field:
  755.  
  756. (1) X offset for pasting the appropriate wall texture onto the wall's
  757.     "space": positive offset moves "into" the texture, so the left portion
  758.     gets cut off (# of columns off left side = offset). Negative offset moves
  759. texture
  760.     farther right, in the wall's "space"
  761. (2) Y offset: analogous to the X, for vertical.
  762.  
  763. (3) "upper" texture name: the part "above" the juncture with a lower ceiling
  764.     of an adjacent SECTOR.
  765. (4) "lower" texture name: the part "below" a juncture with a higher floored
  766.     adjacent SECTOR.
  767. (5) "full" texture name: the regular part of the wall
  768.  
  769.     The texture names are from the TEXTURE1/2 resources. The names of wall
  770.     patches in the DIRECTORY are not directly used, they are referenced
  771.     through PNAMES.
  772.  
  773.     Simple sidedefs have no upper or lower texture, and so they will have
  774.     "-" instead of a texture name. Also, two-sided lines can be transparent,
  775.     in which case "-" means transparent (no texture)
  776.  
  777.     00s fill the space after a wall name that is less than 8 characters.
  778.  
  779. (6) SECTOR that this sidedef "helps to surround" or "faces"
  780.  
  781. [4-5]: VERTEXES
  782. ===============
  783.  
  784. These are the beginnings and ends for LINEDEFS and SEGS, each is 4 bytes,
  785. 2 (integer) fields:
  786.  
  787. (1) X coordinate
  788. (2) Y coordinate
  789.  
  790. [4-6]: SEGS
  791. ===========
  792.  
  793. The SEGS are in a sequential order determined by the SSECTORS, which are
  794. part of the NODES recursive tree.
  795.  
  796. Each SEG is 12 bytes, having 6 (integer) fields:
  797.  
  798. (1) from VERTEX with this number
  799. (2) to VERTEX
  800.  
  801. (3) angle: 0= east, 16384=north, -16384=south, -32768=west.
  802.     In hex, it's 0000=east, 4000=north, 8000=west, c000=south.
  803.  
  804. (4) LINEDEF that this seg goes along
  805. (5) 0 = this seg is on the front "side" of the linedef.
  806.     1 = this seg is on the back "side" of the linedef.
  807.  
  808.     This could also be thought of as direction: 0 if the seg goes the same
  809.     direction as the linedef it's on, 1 if it goes the opposite direction.
  810.  
  811. (6) Is the distance along the linedef that the seg begins. If the seg begins
  812.     at one of the two endpoints of the linedef, this will be 0. If the seg
  813.     and linedef are a "diagonal" line, the length will be according to the
  814.     distance in the coordinate plane of the vertexes, i.e.
  815.  
  816.     SQR((X2 - X1)^2 + (Y2 - Y1)^2).
  817.  
  818.     Actually, it seems to be off by 1 or 2 from what it should be, like they
  819.     are using ABS(X2 - X1) values that are 1 less than the "real" value
  820.     should be.
  821.  
  822. [4-7]: SSECTORS
  823. ===============
  824.  
  825. Each SSECTOR is 4 bytes, having 2 (integer) fields
  826.  
  827. (1) This many SEGS are in this SSECTOR...
  828. (2) ...starting with this SEG number
  829.  
  830. Ssector stands for sub-sector. These divide up all the SECTORS into
  831. non-convex polygons. They are then referenced through the NODES resources.
  832.  
  833. [4-8]: NODES
  834. ============
  835.  
  836. This is what we need to figure out!
  837.  
  838. The nodes are branches in a binary space partition that divides up the level
  839. and is used to determine which walls and floors are in front of others, thus
  840. "clipping" the walls behind from the virtual view. The nodes/ssectors/segs
  841. resources are used exclusively for these display purposes, and seem to be
  842. precalculated to ease the burden on the game engine.
  843.  
  844. There are ((number of SSECTORS) - 1) NODES. Each NODE has 14 (integer)
  845. fields:
  846.  
  847. (1)  X coordinate of partition line's start
  848. (2)  Y coordinate of partition line's start
  849. (3)  DX, change in X to end of partion line
  850. (4)  DY, change in Y to end of partion line
  851.  
  852.      thus 64, 128, -64, -64 would be a partition line from (64,128) to (0,64)
  853.  
  854. (5)  Y upper bound for the first bounding-box
  855. (6)  Y lower bound
  856. (7)  X upper bound
  857. (8)  X lower bound
  858.  
  859. (9)  Y upper bound for the second bounding box
  860. (10) Y lower bound
  861. (11) X upper bound
  862. (12) X lower bound
  863.  
  864.      Each node has two "children", each of which is either a node or a
  865.      ssector. The bounding box is just big enough to contain whatever is
  866.      in the "child", e.g. if the child is a ssector with 1 seg, then the
  867.      bounding box will be just big enough to contain the extents of the
  868.      seg (and thus a bounding "box" can have zero width, for a horizontal
  869.      or verical seg)
  870.  
  871.      If the child is a node, the bounding box will be just big enough to
  872.      hold both of its children.
  873.  
  874. (13) a NODE or SSECTOR number for the first bounding box. If bit 15 is set,
  875.      then the rest of the number represents the child SSECTOR. If not, the
  876.      child is a recursed node.
  877. (14) a NODE or SSECTOR number for the second bounding box.
  878.  
  879. So there is a heavy iterative aspect to this structure. The final NODE is
  880. always the size of the entire level.
  881.  
  882. I am optimistic that a valid set of nodes/ssectors/segs can be generated
  883. from a set of vertices and lines by some automatic algorithm, but so far it
  884. isn't happening. Once this problem is solved, we will be able to create
  885. levels from scratch!
  886.  
  887. [4-9]: SECTORS
  888. ==============
  889.  
  890. A SECTOR is a horiontal (east-west and north-south) area of the map where a
  891. floor height and ceiling height is defined, so a doom player may go there.
  892. Any change in floor or ceiling "altitude" or texture requires a new SECTOR
  893. (and therefore separating LINEDEF(s) and SIDEDEF(s)).
  894.  
  895. Each is 26 bytes, comprising 2 (integer) fields, then 2 (8-byte string)
  896. fields, then 3 (integer) fields:
  897.  
  898. (1) Floor is at this "altitude" for this sector
  899. (2) Ceiling altitude
  900.  
  901.     The altitudes can probably range from about -500 to 500. A difference
  902.     of 30 between the floor heights of two adjacent sectors is passable
  903.     (upwards), but a difference of 32 is "too high". The player may fall
  904.     any amount.
  905.  
  906. (3) name of floor texture, from the DIRECTORY
  907. (4) name of ceiling texture, from DIRECTORY
  908.  
  909.     All the "floor" pictures in the DIRECTORY work as either floors or
  910.     ceilings. F_SKY1 is used as a ceiling to indicate that it is transparent
  911.     to the sky above/behind.
  912.  
  913. (5) brightness of this sector: 0 = total dark, 255 (ff) = maximum light
  914.  
  915. (6) special sector:
  916.  
  917. 0   00  is normal, no special characteristic.
  918. 1   01  light level goes to 0 for a fraction of a second, at random times.
  919. 2   02  light pulsates abruptly for 0.5 second
  920. 3   03  light pulsates abruptly for 1.0 second
  921. 4   04  -10/20% health AND lights on/off every 0.5 seconds
  922. 5   05  -5/10% health (-5% at skill 1, -10% at higher skills)
  923. 7   07  -2/5% health, this is the usual NUKAGE acid-floor.
  924. 8   08  light oscillates from 255 (this sector's brightness) to whatever
  925.         light level is lowest amongst all the adjacent sectors.
  926. 9   09  SECRET (a player must walk into this sector to get credit for
  927.         discovering this "secret")
  928. 10  0a  Still undetermined: This is a strange one. 30 seconds after a level
  929.         is begun, the ceiling of any sector with this number will come down
  930.         to the floor. If it hits a player's head, it stops (without crushing).
  931.         Also the ceiling seems to be blocked by a barrel, but is not blocked
  932.         by many other objects. And sometimes the ceiling will take off UP,
  933.         never stopping. Definately a mystery, this one.
  934. 11  0b  -10/20% health; when player's HEALTH <= 10%, then the level ends.
  935.         If it is a level 8, then the episode ends.
  936. 12  0c  light smoothly oscillates between value in (5) and 0.
  937. 13  0d  light on/off every 0.25 seconds
  938. 14  0e  ?
  939. 16  10  -10/20% health
  940.  
  941. All other values cause an "UNKOWN SPECIAL SECTOR" error - exit to DOS.
  942.  
  943. (7) is a "trigger" number corresponding to a certain LINEDEF with the same
  944.     "trigger" number. When that LINEDEF is crossed, something happens to this
  945.     SECTOR - it goes up or down, etc...
  946.  
  947.     There are a few unusual trigger numbers. 99 and 999 can be used in
  948.     staircases, see [3-3-2] under linedef types 7 and 8. 666 is used on e1m8,
  949.     any sector with that trigger number has it's floor go all the way down
  950.     to equal the height of the lowest neighbor floor. This happens when
  951.     the last Baron of Hell on the level is killed. The function does not
  952.     work on any other level, including e2m8 and e3m8, and it only applies
  953.     to the Barons, not the other bosses. Are there any other special
  954.     trigger events?
  955.  
  956. [4-10]: REJECT
  957. ==============
  958.  
  959. Reject is an array of bits. It's size in bytes is
  960.  
  961. (number of SECTORS ^ 2) / 8, rounded up.
  962.  
  963. "It is used for optimization and all the bits may be set to 0" -
  964. this is a quote from John Carmack at id software.
  965.  
  966. In fact, the length of the object may be made 0 (same as making it all 0s),
  967. and I can't detect any difference.
  968.  
  969. [4-11]: BLOCKMAP
  970. ================
  971.  
  972. The BLOCKMAP is a pre-calculated structure that the game engine uses to
  973. simplify collision-detection between moving things and walls. It is possible
  974. to make an algorithm that generates the BLOCKMAP, given the locations of all
  975. the LINEDEFS. For reasons of space, and the fact that I haven't made one,
  976. the algorithm is not included here.
  977.  
  978. If you don't have a BLOCKMAP, the level displays fine, but everybody walks
  979. through walls, and no one can hurt anyone else with their gunfire.
  980.  
  981. All of BLOCKMAP's fields are integers.
  982.  
  983. The whole level is cut into "blocks", each is a 128 (hex 80) wide square (the
  984. grid lines in the automap correspond to these blocks).
  985.  
  986. The first two integers are XORIGIN and YORIGIN, which specify the coordinates
  987. of the bottom-left corner of the bottom-left (southwest) block.
  988.  
  989. Then come XBLOCKS and YBLOCKS, which specify how many "blocks" there are in
  990. the X and Y directions. XBLOCKS is the number of COLUMNS, YBLOCKS is the
  991. number of ROWS.
  992.  
  993. Then come (ROWS * COLUMNS) integers which are pointers to the offset within
  994. the BLOCKMAP resource for that "block". These "offsets" refer to the INTEGER
  995. number, NOT the byte number, where to find the block's list. The blocks go
  996. right (east) and up (north). The first block is at row 0, column 0; the next
  997. at row 0, column 1; if there are 34 columns like on e1m1, the 35th block is
  998. row 1, column 0, etc.
  999.  
  1000. After all the pointers, come the block lists. Each blocklist describes the
  1001. numbers of all the LINEDEFS which are partially or wholly "in" that block.
  1002.  
  1003. An "empty" block is two integers: 0 and then -1.
  1004.  
  1005. A non-empty block will go something like: 0 330 331 333 -1. This means that
  1006. LINEDEFS 330, 331, and 333 are "in" that block. Part of each of those line
  1007. segments lies within the (hex 80 by 80) boundaries of that block.
  1008.  
  1009. What about the block that has LINEDEF 0? It goes: 0 0 ... etc ... -1.
  1010.  
  1011. Here's another way of describing BLOCKMAP as a list of the integers, in
  1012. order:
  1013.  
  1014.         Coordinate of block-grid X origin
  1015.         Coordinate of block-grid Y origin
  1016.         # of columns (blocks in X direction)
  1017.         # of rows (blocks in Y direction)
  1018.         Block 0 offset from start of BLOCKMAP, in integers
  1019.           .
  1020.           .
  1021.         Block N-1 offset (N = number of columns * number of rows)
  1022.         Block 0 list: 0, numbers of every LINEDEF in block 0, -1 (ffff)
  1023.           .
  1024.           .
  1025.         Block N-1 list: 0, numbers of every LINEDEF in block N-1, -1 (ffff)
  1026.  
  1027. -----------------------------
  1028. CHAPTER [5]: Pictures' Format
  1029. -----------------------------
  1030.  
  1031. The great majority of the entries if the directory reference resources that
  1032. are in a special "picture" format. The same format is used for the pictures
  1033. of items (like medikits), the sprites for the enemies (like imps), the
  1034. wall patches, and various miscellaneous pictures for the status bar, menu
  1035. text, inter-level map, and etc. The floor and ceiling textures are NOT in
  1036. this format, they are raw data; see chapter 5.
  1037.  
  1038. Each picture has three sections, basically. First, a four-integer header.
  1039. Then a number of long-integer pointers. Then the picture pixel color data.
  1040.  
  1041. [5-1]: Header
  1042. =============
  1043.  
  1044. The header has four fields:
  1045.  
  1046. (1) Width. The number of columns of picture data.
  1047. (2) Height. The number of rows.
  1048.  
  1049.     This defines a rectangular space or limits for drawing a picture within.
  1050.  
  1051. (3) Left offset. The number of pixels to the left of the center; where the
  1052.     first column gets drawn.
  1053. (4) Top offset. The number of pixels above the origin; where the top row is.
  1054.  
  1055.     To be "centered", (3) is usually about half of the total width. If the
  1056.     picture had 30 columns, and (3) was 10, then it would be off-center to
  1057.     the right, especially when the player is standing right in front of it,
  1058.     looking at it. If a picture has 30 rows, and (4) is 60, it will appear
  1059.     to "float" like a blue soul-sphere. If (4) equals the number of rows,
  1060.     it will appear to rest on the ground. If (4) is less than that for an
  1061.     object, the bottom part of the picture looks awkward.
  1062.  
  1063.     With walls patches, (3) is always (columns/2)-1, and (4) is always
  1064.     (rows)-5. This is because the walls are drawn consistently within their
  1065.     own space (There are two integers in each SIDEDEF which can offset the
  1066.     beginning of a wall's texture).
  1067.  
  1068.     Finally, if (3) and (4) are NEGATIVE integers, then they are the absolute
  1069.     coordinates from the top-left corner of the screen, to begin drawing the
  1070.     picture, assuming the VIEW is FULL-SCREEN (the full 320x200). This is
  1071.     only done with the picture of the doom player's current weapon - fist,
  1072.     chainsaw, bfg9000, etc. The game engine scales the picture down
  1073.     appropriately if the view is less than full-screen.
  1074.  
  1075. [5-2]: Pointers
  1076. ===============
  1077.  
  1078. After the header, there are N = (# of columns) long integers (4 bytes each).
  1079. These are pointers to the data for each COLUMN. The value of the pointer
  1080. represents the offset in bytes from the first byte of the picture resource.
  1081.  
  1082. [5-3]: Pixel Data
  1083. =================
  1084.  
  1085. Each column is composed of some number of BYTES (NOT integers), arranged in
  1086. "posts":
  1087.  
  1088. The first byte is the row to begin drawing this post at. 0 means whatever
  1089. height the header (4) upwards-offset describes, larger numbers move
  1090. correspondingly down.
  1091.  
  1092. The second byte is how many colored pixels (non-transparent) to draw, going
  1093. downwards.
  1094.  
  1095. Then follow (# of pixels) + 2 bytes, which define what color each pixel is,
  1096. using the game palette. The first and last bytes AREN'T drawn, and I don't
  1097. know why they are there. Probably just leftovers from the creation process on
  1098. the NExT machines. Only the middle (# of pixels in this post) are drawn,
  1099. starting at the row specified in byte 1 of the post.
  1100.  
  1101. After the last byte of a post, either the column ends, or there is another
  1102. post, which will start as stated above.
  1103.  
  1104. 255 (hex FF) ends the column, so a column that starts this way is a null
  1105. column, all "transparent". Goes to the next column.
  1106.  
  1107. Thus, transparent areas can be defined for either items or walls.
  1108.  
  1109. Note that all the item and enemy sprites' names are in the DIRECTORY between
  1110. the S_START and S_END entries, and all the wall patches are between the
  1111. P_START and P_END entries.
  1112.  
  1113. ---------------------------------------
  1114. CHAPTER [6]: Floor and Ceiling Textures
  1115. ---------------------------------------
  1116.  
  1117. All the names for these textures are in the DIRECTORY between the F_START and
  1118. F_END entries. There is no look-up or meta-structure as with the walls.
  1119.  
  1120. Each texture is 4096 raw bytes, making a square 64 by 64 pixels, which is
  1121. pasted onto a BLOCK's floor or ceiling, with the same orientation as the
  1122. automap would imply, i.e. the first byte is the color at the NW corner, the
  1123. 64th is the color at the NE, etc.
  1124.  
  1125. The data in F_SKY1 isn't even used since the game engine interprets that
  1126. "special" ceiling as see-thru to the SKY texture beyond. So the F_SKY1 entry
  1127. can have zero length.
  1128.  
  1129. [6-1]: Animated floors
  1130. ----------------------
  1131.  
  1132. See Chapter [8-4-1] for a discussion of how the animated floors and walls
  1133. work.
  1134.  
  1135. -----------------------------
  1136. CHAPTER [7]: Sounds and Songs
  1137. -----------------------------
  1138.  
  1139. Not much detail here, and I'm just guessing at the song format anyway.
  1140.  
  1141. [7-1]: D_[xxxxxx]
  1142. =================
  1143.  
  1144. Songs.  What format are they? Somewhere I read that they are in the MUS
  1145. format, which I have absolutely no knowledge of. But it's obvious what each
  1146. song is for, from their names.
  1147.  
  1148. [7-2]: DP[xxxxxx] and DS[xxxxxx]
  1149. ================================
  1150.  
  1151. These are the sound effects. They come in pairs - DP for pc speaker sounds,
  1152. DS for sound cards.
  1153.  
  1154.  
  1155. The DS sounds are in RAW format: they have a four integer header, then the
  1156. sound samples (each is 1 byte since they are 8-bit samples).
  1157.  
  1158. The headers' four integers are: 3, then 11025 (the sample rate), then the
  1159. # of samples, then 0.
  1160.  
  1161. ------------------------------------------------
  1162. CHAPTER [8]: Miscellaneous Non-picture Resources
  1163. ------------------------------------------------
  1164.  
  1165. [8-1]: PLAYPAL
  1166. ==============
  1167.  
  1168. There are 14 palettes here, each is 768 bytes = 256 rgb triples. That is, the
  1169. first three bytes of a palette are the red, green, and blue portions of
  1170. color 0. And so on.
  1171.  
  1172. Palette 0 is the one that is used for almost everything.
  1173.  
  1174. Palettes 10-12 are used (briefly) when an item is picked up, the more items
  1175. that are picked up in quick succession, the brighter it gets, palette 12
  1176. being the brightest.
  1177.  
  1178. Palette 13 is used while wearing a radiation suit.
  1179.  
  1180. Palettes 3, then 2, then 1 again are used after getting beserk strength.
  1181.  
  1182. If the player is hurt, then the palette shifts up to X, then comes "down" one
  1183. every half second or so, to palette 2, then palette 0 (normal) again. What X
  1184. is depends on how badly the player got hurt: Over 100% damage (add health
  1185. loss and armor loss), X=8. 93%, X=7. 81%, X=6. 55%, X=5. 35%, X=4. 16%, X=2.
  1186.  
  1187. Palettes 1 and 9 contain the secret codes which allow you to play
  1188. Commercial Doom eight months before it gets released. Just kidding!
  1189. Maybe F_SKY1 has that data in it. Let's get outta here!
  1190.  
  1191. [8-2]: COLORMAP
  1192. ===============
  1193.  
  1194. This resource contains 34 sets of 256 bytes, which "map" the colors "down" in
  1195. brightness. (Brightness is controlled by the 5th field in the SECTORS, see
  1196. Chapter 4-9 above). E.g. at very low brightness, almost all the colors are
  1197. "mapped" to black, the darkest grey, green, blue, etc. In each set of 256
  1198. bytes, byte 0 will have the number of the palette color to which original
  1199. color 0 gets mapped. Etc. Which set of 34 corresponds to which exact
  1200. brightness level is something I haven't bothered to figure out. Better things
  1201. to do...like the maps.
  1202.  
  1203. [8-3]: DEMOs
  1204. ==============
  1205.  
  1206. These are the demos that will be shown if you start doom, but don't play an
  1207. episode. Each has a record of the keystrokes. Didn't bother to figure the
  1208. formats out, since demos can be created using the devparm parameter:
  1209.  
  1210. DOOM -devparm -record DEMONAME
  1211.  
  1212. The extension .LMP is automatically added to the DEMONAME. Other parameters
  1213. may be used simultaneously, such as -skill [1-5], -warp [1-3] [1-9]. The
  1214. demos in the WAD are in exactly the same format as these LMP files, so a LMP
  1215. file may be simply pasted or assembled into a WAD, and if its length and
  1216. pointer directory entries are correct, it will work.
  1217.  
  1218. I've read that someone is collecting LMP files which show truly heroic feats,
  1219. like slaughtering boss guys with just a pistol, killing a whole level of bad
  1220. guys with just beserk punch, while at 1% health, etc. By the time you read
  1221. this, it's probably too late to join in the fun (i.e. submit a good one), but
  1222. who knows. At this moment, I don't know who to contact, please send me any
  1223. information you have.
  1224.  
  1225. I've also read that some are worried that if the .LMP formats are cracked,
  1226. cheaters will make bogus demos and destroy the whole point of distributing
  1227. .LMPs to prove how great a player one is. I think it would be a ridiculously
  1228. difficult feat to make a fake demo, but out of deference to paranoia, I'll
  1229. never even attempt to crack the structure, nor distribute info on it.
  1230.  
  1231. [8-4]: TEXTURE1 and TEXTURE2
  1232. ============================
  1233.  
  1234. These resources contains a list of the wall names used in the various
  1235. SIDEDEFS sections of the level data. Each wall name actually references a
  1236. meta-structure, defined in this list. TEXTURE2 has all the walls that are
  1237. only in the registered version.
  1238.  
  1239. First is a table of pointers to the start of the entries. There is a long
  1240. integer (say, N) which is the number of entries in the TEXTURE resource.
  1241.  
  1242. Then follow N long integers which are the offsets in bytes from the beginning
  1243. of the TEXTURE resource to the start of that texture's definition entry.
  1244.  
  1245. Then follow N texture entries, which each consist of a 8-byte name field and
  1246. then a variable number of 2-byte integer fields:
  1247.  
  1248. (1) The name of the texture, like STARTAN3, is the name that is used in a
  1249.     SIDEDEFS resource.
  1250. (2) always 0. Purpose unkown.
  1251. (3) always 0. Purpose unkown.
  1252.  
  1253. (4) total width of texture
  1254. (5) total height of texture
  1255.  
  1256. The fourth and fifth fields define a "space" (usually 32 by 128 or 64 by 72
  1257. or etc...) in which individual wall patches are "placed" to form the overall
  1258. picture. This is done because there are some wall patches that are used in
  1259. several different walls, like computer screens, etc.
  1260.  
  1261. (6) always 0. Purpose unkown.
  1262. (7) always 0. Purpose unkown.
  1263.  
  1264. (8) Number of 5-field patches that follow. This is why each texture entry
  1265.     has variable length. Many entries have just 1 patch, one has 64 patches!
  1266.  
  1267.         1. x offset from top-left corner of texture space defined in field
  1268.            4/5 to start placement of this patch
  1269.         2. y offset
  1270.         3. number, from 0 to whatever, of the entry in the PNAMES resource,
  1271.            which contains the name from the DIRECTORY, of the wall patch to
  1272.            use...
  1273.         4. always 1, is for something called "stepdir"...
  1274.         5. always 0, is for "colormap"...
  1275.  
  1276. Note that patches can have transparent parts, since they are in the same
  1277. picture format as everything else. Thus there can be (and are) transparent
  1278. wall textures. These should only be used on a border between two sectors, to
  1279. avoid the "displaying nothing" problems discussed earlier.
  1280.  
  1281. Here is how one can "add" walls, while still retaining all the original ones
  1282. it came with: in a pwad, have replacement entries for PNAMES and TEXTURE2.
  1283. These will be the same as the originals, but with more entries, for the wall
  1284. patches and assembled textures that you're adding. Then have P_START,
  1285. P2_START, ...,  P2_END, and P_END entries, with the ... representing however
  1286. many entries are needed for the number of new wall patches you have.
  1287.  
  1288. Note you must be careful with naming the entries. If the name duplicates an
  1289. entry in the main DOOM.WAD, the one in the pwad will replace the original,
  1290. and if they aren't the same size in pixel dimensions, problems could occur
  1291. in the display (no crashes, probably, just ugly walls to look at because
  1292. of the random junk).
  1293.  
  1294. So names like "WALL66_6" or "W119_24" whatever are probably not a good idea,
  1295. unless you are using some great program that indexes and keeps track of all
  1296. the wall names in the universe (If you have such a program, please send it
  1297. to me!). Names like "JS_W12_3" and "JOEWALL2" are better.
  1298.  
  1299. [8-4-1]: Animated walls
  1300. -----------------------
  1301.  
  1302. It is possible to change the walls and floors that are animated, like the
  1303. green blocks with a sewer-like grate that's spewing green slime (SLADRIPx).
  1304. The game engine sets up as many as 8 animation cycles for walls and 5
  1305. for floors based on the entries in the TEXTURE resources. The entries in
  1306. "First" and "Last", and all the entries between them (in the order that they
  1307. occur in a TEXTURE list), are linked. If one of them is called by a SIDEDEF,
  1308. that SIDEDEF will change texture to the next in the cycle about 5 times a
  1309. second (?), going back to "First" after "Last". Note that the entries between
  1310. First and Last need not be the same in number as in the original, nor do they
  1311. have to follow the same naming pattern, though that would probaly be wise.
  1312. E.g. one could set up ROCKRED1, ROCKREDA, ROCKREDB, ROCKREDC, ROCKREDD,
  1313. ROCKREDE, ROCKRED3 for a 7-frame animated wall!
  1314.  
  1315. If "First" and "Last" aren't in either TEXTURE, no problem. Then that cycle
  1316. isn't used. But if "First" is, and "Last" either isn't or is listed BEFORE
  1317. "First", then an error occurs.
  1318.  
  1319. First           Last            Normal # of frames
  1320.  
  1321. BLODGR1         BLODGR4         4
  1322. BLODRIP1        BLODRIP4        4
  1323. FIREBLU1        FIREBLU2        2
  1324. FIRELAV3        FIRELAVA        2
  1325. FIREMAG1        FIREMAG3        3
  1326. FIREWALA        FIREWALL        3
  1327. GSTFONT1        GSTFONT3        3
  1328. ROCKRED1        ROCKRED3        3
  1329. SLADRIP1        SLADRIP3        3
  1330.  
  1331. (floor/ceiling animations) -
  1332.  
  1333. NUKAGE1         NUKAGE3         3
  1334. FWATER1         FWATER3         3
  1335. SWATER1         SWATER4         4?
  1336. LAVA1           LAVA4           4
  1337. BLOOD1          BLOOD3          3
  1338.  
  1339. Note that the SWATER entries aren't in the regular DOOM.WAD, so there's your
  1340. easy opportunity to put in a custom floor animation without taking away any
  1341. originals...
  1342.  
  1343. [8-5]: PNAMES
  1344. =============
  1345.  
  1346. This is a lookup table for the numbers in TEXTURE[1 or 2] to reference to an
  1347. actual entry in the DIRECTORY which is a wall patch (in the picture format
  1348. described in chapter 4).
  1349.  
  1350. The first two bytes of the PNAMES resource is an integer P which is how
  1351. many entries there are in the list.
  1352.  
  1353. Then come P 8-byte names, each of which duplicates an entry in the DIRECTORY.
  1354. If a patch name can't be found in the directory (including the external
  1355. pwad's directories), an error will occur. This naming of resources is
  1356. apparently not case-sensitive, lowercase letters will match uppercase.
  1357.  
  1358. The middle integer of each 5-integer "set" of a TEXTURE1 entry is something
  1359.  
  1360. from 0 to whatever. Number 0 means the first entry in this PNAMES list, 1 is
  1361. the second, etc...
  1362.