                "Hacking the DOOM.EXE file"

            by Matt Fell (matt.burnett@acebbs.com)
                       June 13, 1994
===========================================================================

  Many of the characteristics of the DOOM environment are determined by the
data in the DOOM.WAD file: the maps data, the picture data, the sounds, etc.
Almost all of this has been explained in the Unofficial DOOM Specs. But 
there is also a host of variables and possibilities in the DOOM.EXE file, 
and in this article I will explain all I know about it. I'll probably 
include a new chapter in the 1.4 specs, to contain this info.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fo.f.fYYe Un.fo.f.fo.0U`DrYiVmT]zKbbL0e3
{8dB[
DhסR////////////////////////////////////////////YYe Q^(a VM//souhe
    ac
"HOCKEY" wad doT]zKt - infusthis hasHACK0/gram/patch doom.exe/.fo.fo/ifi(a/cef.fI once.fooughtRould writ//gram/uheould
en/ easy edVmhispter in"his /"ontscribis ielow, for such cool
effect
/vis/ Baspe`DfloaVmhis/f.fo.f.I/vsodifinish/
I getodistude ad easi/:-),fYYe I juo.flove lhermhisp.f.fo.fo//o.fo.re/work:-)/I free/mix hexDd/im/numb.fo.ielow. Hopeful/youYYetSpecfromfo.f./ext:-) Ao.f.fo.f.foref.fo./.f.regist.fod vssion/2L0
e3
. When//o aT]z/,//neod /^(.f.numb.fo, obviously. S aT/.f.fo.focould  locatis infusthissearch patt.fno, sthce.much if.fodoT]n't^(from vssion/vssion.fo.f.usthis hasde u/numb.fo..fo
///bett.f,fYfoough lhssflexi//By faro.fo.ffo.f.rYiVmT]zo co.fo.fhis /, b.f.I//d
juo.f//fo.fs, ireitbablymy notes, for o atenhss' sake/m o aing{ lio.f.foideasf.fowuheYYe dobilinfpatchthis hasexe,a/eas./ributfo.your.fooughts! Exaa:reduce.f.fomagdobilinffo.ffissles, for lo^(rfodeathmatch battlef.fAnp.f.fsexaa:fo.fs, rmT]zKbbhis / for fodempe`Do/trT]zo coIDENTICALsexcept for bbit/uhemakeso/trT]z
"viso". Supre obilre/cef.f.numb.fo for b"grenffree" with b
numb.fo from b"Baspe"'sfs, ry,D^(.f.visi/bit/enobil
ould have ADDEDDp.f.fsmpe`t.f,fnvisi/Baspe, with/havhis"taken{way".f.origin/non-visoBaspe. Ofocourse,aobilould no lo^(r have 
grenffrees:-) Rould re//like/ / //Dfo.foizespter info.fhis /, r inframes /, Dfo.fopritnameslio., b.f.Ihave looke/for bap/priati.ri/er]zKbv ffo.meobilcould fig.fo..f.fo//AYYe,a/eas.re/or.f/i/eresrmhisresult
gathis inf/a ncs, mhi,{8nfrrorfo.fo.fanks. I'll Tf.fo.fobegie`Dt $6f414 (455700)Do, mhueo./.f.epter ine3

$8db27 (580391) Here'`D overvi/pter ins/tions: I'lstD lhngth wuh I'l6f414  3d30l TEXT STRINGS
73412  1a34  /ous un//no, ////fowith I/O,fo.fo.,smpuse,afo.fo.74bf8 10000  lookslikeclud-co/demath /, for speod?
84bf8   148  fis.fo.84d40 pos82  gammfocorr/tion aT]sagso.84dc2   280 p"o coyousu coyouwa, t/quit" aT]sagso.85042   3a2  MENUS (/game,aloadgame,afo.f)o.853e4   140 p?
85524   36c o,fig.fation optionsDd/fault
,likeKbDEFAULT.CFG
85890 po174 p?
85a04    60 p?
85a64    54 p?
85ab8    c4 p?
85b7c    20 pmaxDmmoDt stD, DDmmopsoung{85b9c    c0 pDmmotypeDframes#o for bweapons{85c5c   188  ANIMATEDWALLSDFLOORS{85de4   258  SWITCH-WALLS{8603c    c0 p?{860fc    d4 p?
861d0 po500  5oloro.fo.for use with bgammfocorr/tion shermhis0-4
866e4    fc  ?
867e0 pos40 pri/er]z/tmacro
,"Green:",afo.fo.86820 pos88 pri/er]z/l/vlname
,usepn Autoo.fo.868a8    d8  s/hemarkcoordin/tes.for e-l/vlscreeno.86980 po5a8  wim/ppatch anim/tionsfor e-l/vlscreeno.86f28   224  SONG NAMES lio.f.fori/er]o.8714c   8b8  SOUND TABLEo.87a04   1a4  SPRITE NAMES lio.f.fori/er]o.87ba8  3800  FRAME TABLEo.8b3a8    20 p?{8b3c8  2368  THING TABLEo.8d730l  3fd p?{'ll For re/d/ lio.hapter inTEXT STRINGS, THING TABLE, FRAME TABLE
SPRITE NAMES, DSOUND TABLE,foees hasdeo a8nmhis(or apeis ielow)o.Qbasic/gramsDEHACK0 Ie`t.aptedistuibutmhisa f/hfo.fod kapterext
e3

,Id/idod /use //grams/uheyouYYe/ /getor insame
lio.haDf//uheIuse. Why Qbasic? Because /vsyobilhoo.f.fdofo.f./D, Difeyoudob'D, you' cosmD enough /writiVt/gramsyourself.'ll Tf/obilpter inungs.I/od f/odbackpn - should I//er ise
mini-/gramsKbb////////? Or should Ijuo.fhave o.fo.ftscriptionsDoffshenumb.fo, ao.ielow?'ll Unlhssnotediffers, ly,"i/e(r" aTansD 4-byte i/e(r. I'l6f414   'll START OF DATA. S/vs/tiaT]z//ref.f/pri/er] Ao.fr iseori/er]o.o coe(r] Adfo.fvalueo.pter iseori/er]/$6f414 Dyou'o.fgetor in
location ofowuh'o.iemhisri/ed /.'ll Note:fo.re'`DYYe UD lhao.f.bilp.f.fs/.fori/er/o.re, with lar(rfovalueo,/uheoeem/pri//a location Kbb/o/, NOT.f.fo.f Rc/fo.f.seo"/o/-ri/er]"for now. //ih'o.a lames erm. I'l6f414   'll TEXT STRINGS/ey//stD on 4-byte b.fo.armT], i.e. hexxxx0/4/8/.f
$00 ef.f.stuing/en.f.next.bilstD`Dt .f.nextb.fo.ary,fo.D 4
byte stuingfollowis inf$00, r in 3 byteo.pterDom jun/, r in .f.next'lstuing/enerst stuing010101, r in "ULTRADIR", Do.pe. Sein
DEHACK1.BASfor a/gram/extude   lio.f.fo//o.ferext stuings,n
DEHACK1.TXT / //72k. I'l73140 p /I unk//f.f.last stuing,"TZ" I'l73144   'll Mis.f stuff.Ihaven'tvesrmgatis. S aTif..f.f/fowith o.fo.Rc/rd'lstuff.DmiceDjoyew cks,nbecause Dt 7384c f"DMXGUS.INI" DDt 74ba8 o.o cori/er]which pri//.f.stuingf"N.bi", "PC_Speaker", "Adlib",afo.fo.o.74bf8'll 64kaptepr/ise/ord.fod numb.fo, which lhafme/ lieve o.fyzo c
/e-c/culatis math /, /speod upfo.mefloaVmhispri/ops/tions
use.fo.focreen draw routmhe.fAnylp.f.fsgueoses?{'l84bfc'll 3ori/er]/.f.episo/e1/2/3erext
,"Ohce.youbea/", "You'vfo.f.bili/", D"enloaVho.meSpidordempe fdha"{'l84c24'll ri/er/.f.stuing "doom.wad"{'l84c74'll ri/er/.f.stuing "d/fault.cfg"{'l84c78'll 8oe(r]: 1, 25,o50, 24,s40, 640, 1280, 320{'l84c98'll 2 /o/-ri/er]{'l84ccc'll 29oe(r], with valueo.like90 D135 D180.fAngles?{'l84d40'll "Gammfocorr/tion OFF", 00
,"Gammfocorr/tion l/vl1",  4. Each
occupmT]z$1a byteo.{'l84dc2'll 8orext aT]sagsuse//ermquit mhi, eachuse]z$50 byteo{'l85042'll MENUS. ////rol]/o.meexts, twhich cs,ufo.fo.fo]zo couse/for which cs,u, b.f.Ihaven'tfig.fodif.fo.f..f.yet.{'l853e4'll 14 ]: 42, 22, 23, 24,s28,s29, 31,s40, zero
{'l8541c'll 256 byteo, valueo.from 00-ff, no twoor insame,"rDom"ord.f.{'l85524'll Tf./fig.fation options. Each f5oe(r]: a ri/er/a stuing,
like"mpuse_sensitivity", D /o/-ri/er, r ind/fault value for Ԑh Ioption, D 0or 1 (1for a/o.fe"key_" options), DD 0.fIheouldbe
/ettynd/nsef/fo8n.fhiswith i
,Iunk.{'l85890/A//117oe(r], with and/finite stuufo.fo, b.f.IYY'tfig.foif Iout,D^hi//a ncs, mhieoeem.f/fop.fing/{'l85a64'll 21 sheo.pte4 byteo: 0, 0, 1, 0, 320, 168,s"33", 0, 1, $(b2 26 26 2e)
$(ff.63 fd ff), D ri/er/uheri/]/.f.$(b2), 0, 1, "ema", 0, 0
1, 0, 1, "xma" Ao.fr iseoo counQ^(afrom vssion0.99fr rough 1.2
except fo.fori/erobviously.{'l85ab8'll I]: 0, -1, -1, 0, 0, 0, 0, 4,s7, 10, 12, 14,s15,s15,s0, 0, 112, 96, 64
176, r in 16/uheo comemb.fo .fo.f.foshe{-65536, -47000, 0, 47000, 65536},fo.f.n 4,s5,s6,s7, 0, 1, 2, 3, 8, 3, 1,s5,s7{'l85b7c'll AMMO AMOUNTS. 8oe(r]: 200, 50, 300, 50, 10, 4,s20, 1/enerst fouro.o co/ximum init/capacitbafor ammo,fohell], cell], Drockheo/e
backpackdou//uiseoompuneo/ens/ofour.o coh/m8nfDmmo//
clip,fohell], rockheo/rockhe,Dell]/ellifem. Boxesfhave 5x ao.much.{'l859bc'll AMMO TABLE. 8osheo.pte6oe(r]:{'lPunQd pos5  4  3l 2 s5  0nd pos'lPio.ol pos0 12 11 1013 17{Shotg/ l 1 20 1918 21 30/Chaing/ l0 34 33 32 35 38'lLaucher  3l42 41s40 43l46'lPlasmfo   2 59 58 57 60 62'lBFGand pos2 66 65 64 67 71/Chainsaw s5 53 52 50 54 p0 I'll Tf.erst numb.f.pteeachshef.f.Dmmotype/ype5/vsorunfo/e
nextr re.numb.fo o co3frames#o (oees hasFRAME TABLE ielow) for bo.f
{dis/y(awf.n movhiswhilcohldthis hheeapon. You//, r in"bobbng{eapon" effect? Fifthf.f.erst framespter in"shoot"shquehce.for Ԑh Ieapon,Dlast f.f.erst framespter in"erng"shquehce/en"erng"
 chao co/.bis/uheo colif.up,fer.mmhisput,fo.fo.o.85c5c'll ANIMATEDWALLSDFLOORS. Each f26 byteo: ne(r, D 8-byte stuing,
$00, D 8-byte stuing,f$00, DD fin/fo.o.0 NUKAGE3l NUKAGE1l 8o.0 FWATER4 pFWATER1l 8o.0 SWATER4 pSWATER1l 8o.0 LAVA4    LAVA1 pos8o.0 BLOOD4   BLOOD1pos8o.1 BLODGR4 pBLODGR1os8o.1 SLADRIP4 SLADRIP1s8o.1 BLODRIP4 BLODRIP1s8o.1 FIREWALL FIREWALAs8o.1 GSTFONT3 GSTFONT1s8o.1 FIRELAVA FIRELAV3s8o.1 FIREBLU2 FIREBLU1s8o.1 ROCKRED3 ROCKRED1s8o.'ll Obviouslyo/0/1 aTansfloor or wa/enerst stuing.f.namesptfo.f.anim/tion cycle'`LAST lio.erext.fo, tens/ostuing.f.FIRST
lio.erext.fo/encycle//.f.m DD/, rmT]zbetwein .f.m in Ihich/vsowad e3
 / effect (IhedoT]n'thave o fo.fo.fo, D wad Iith /TEXTURE1lD2sresourcefworksquit.nicely. /m doingt ayself,/for my l/vls)/enen/08edoT]n'toeem/aTan.much.{'l85dc8'll A -1 r in a bunQdptezero
,myb.fopace.for Dp.f.fsanim/tion cycle?{'l85de4'll SWITCHWALL NAMES. Each f20 byteo: n8-byte stuing,f00, Dp.f.fsstuing,
00, DD 2-byte i/e(r.ereoo co28ositch/so.re, from (SW1BRCOMs'lSW2BRCOMs1)/(SW1WOOD SW2WOOD 2). Whenaositch fpulled, bgame
ch/ck]/oeesiter inwa/oext.foobo.f.folio. ffit f,fit Q^(sfo.f.wa/oext.fo/.f.corr/spondthisalt.fnati.rext.fo/en2-byte i/e(ro.1 or 2etSpe]zKt /look/ ei.f.fsTEXTURE1lofsTEXTURE2.{'l86028'll 20ezero
,agath, room for .bilmore?{'l8603c'll 48oe(r]: 3l0 2 1 3l0 2 0 3 1 2 0 0 0 0 0host of variables2l0 2 1 0 0 0 0 3 1 3l0 0 0 0 0host of variables2l0 3 1 2 1 3 1 2 1 3 0 0 0 0 0ho{860fchost50 e(r], a/o coei.f.fs50or -50.{'l861d0host5osheo.pte256 byteo, each fa COLORMAP, for bgammfocorr/tion
shermhis OFF, 1, 2, 3, 4.{'l866d0host5oe(r]: 1, 0, -1, 0, 0{'l866e4'll 13osheo.pte5 - 10byteo, each sheain thatis infa $FF{'l8675e'll $74 $20{'l86760'll 13ori/er]/.f.stuff.Dt 866e4.fAnoe(r '0'zbetwein each ri/er.{'l867c8'll 6oe(r]: -1, -1, 0, -1, 0, 1{'l867e0'll 10ori/er]/.f.10od/fault tmacro
,.f.n 4ori/er], /"Green:",
"Indtgo:",a"Brown:",a"Red:"{'l86820'll AUTOMAP LEVEL NAMES. 27ori/er]/.f.l/vlname
usepn .f.autoo.f.{'l8689c'll Tf.ascii lherer]"gibr" - .f.keysfor sendthisaT]sagsin.multi/y(r.{'l868a8'll SPLAT MARK COORDINATES. Atowuheocreen coordin/tes./pce .f.WISPLAT
 ct.fopn .f.e-l/vlscreen, for  27ol/vls. 54 e(r], 27oaers.{e1m1 x, e1m1 y, , e3m9 y.{'l86980, 86bb0, 86da8'll END-LEVEL MAP ANIMATIONS. Each f14oe(r] enerst .bilio (0, 11,os'l3, 224,s104, 0, 0, 0, 0, 0, 0, 0, 0, 0). Tf.erst numb.f.0for a/o.f
.bison a.fo.0lD2s(episo/f1lD3), Dih'o.2for m/p1/en11 i]o.olways11 except fo.flao.f.bilpf m/p2.8/en3 aTans3fo.fo.fo]zo c/volve.fo.fanim/tion, e.gWIA00100, WIA00101, DWIA00102. 224 D104o.o co/xDy coordin/tes/ensixth umb.f.p.0for m/p1 - ih'o/from 1./8///rol]/f.wayo/Tow.f.pteMy`t.fy "apears" Ao.fr i
..f.fsnumb.fo o coolways0.{'l86ef8'll T re.e(r], h/m8nfDnim/tionsfor WIMAP0, 1, 2sres/tively.{'l86f04 'll T re.ri/er], /.f.stD`pter inDnim/tionsfor WIMAP0, 1, 2o.res/tively.{'l8714c'll SOUND TABLE. 61lD1/2fo.fo.feo colio.eo.re. Each f9oe(r]: a
ri/er/.f.stuing which .f.o.fo.'o."name", r in a 0or 1, r in{ value r^hi from 32 /128,sr in 0, -1, -1, 0, 0, 0/enname
o c/"pio.ol",a"shotgn",  "hoof",a"metal",a"chg/" Prefix DSor DP Dyou
getor ins, rmT]zKbfo.fo.fo.for bo.fo.Rfo.f en"chg/" .f.1/2f-fo.f.fo'p "DSCHGUN"zKbdoom.wad, Dfo.fs, rydB[
 / /o ate{8nway,flaf this hasa-im/or.a, t0, -1, -1, 0, 0, 0 endthis:-) ereooeemfo.  f/glitch/s.fo.fwayo/o.fo.fewereofit n/.f.whl.focf.me,fo.f/fjuo.fobilpter im. SeinDEHACK5.BASfor h//extude  .f.whl.fo./ Dlio.f.foo.fo.Rname
{'l879ec'll ri/er/stD of SOUND TABLE.{'l879f0'll Ie(r = 150. 150owuhs?{'l87a04'll SPRITE NAME LIST. 105ori/er]/.f.stuingf"TROO",a"SHTG", ,
"SMRT". SeinDEHACK4.BAS/extude  .f.whl.olio.{'l87ba8'll FRAME TABLE. 512ns, rmT], each f28obyteo:{'llo^i/opritnumb.f.0-104, lookup.opritnameslio.ori/er]o.lo^i/opritsubnumb.f, 0 = "A", 1 = "B", .for exaa, SMRTA0.{lo^i/d.fation, h/m8nftiaT]licefuntilif looksfor bnext
of variablesframes.fo.fohquehce/-1 aTansforev(r.{2-byte i/ p?{2-byte i/ p?{lo^i/nextframes.ohquehce/0 aTansp nextframe,shquehce.f.bi.{lo^i/olways0,..f.fp effect{lo^i/olways0o.'ll SeinDEHACK3.BAS/extude  .f.whl.o./{'l8b3a8'll Twooe(r]: 1, 0, r in 6 /o/-ri/er].{'l8b3c8'll THING TABLE. 103ns, rmT], each f88byteo, or 21oe(r] Sei
DEHACK2.BAS/extude  .f../ Here'`Dlio.f.fowuhe
  21o.fdo:'ll 'll 1/hisnumb.f. 3001 fans/,t5o`Dblue keyo.fo.fS aT.f.m Dre
of va-1, e.g.fo.fv.fy erst s, ryd(/y(rs), .f.ereball],  'll 2. Ferst framesnumb.f.ptet inung's framesshquehce, for 'regular'ifems.
of vaFor mpe`t.ff,fit'f.f.erst framespter instndthi-in-pce ohquehce/'ll 3/oughnhss/hiheri/]/'ll 4.f'movhi'erst frames#, mpe`t.ff//y(rfoblyhost5.f'oees/y(r'oo.fo.R#for mpe`t.ff,for 'erst'oo.fo.Rfor proj/tiles.
of vaNoteo/o.fo.feo co1-61,p.0-60/0 indtc/tes.noo.fo..
of6 Aoways8,sexcept for /y(r. WuhedoT]zKt do?'ll 7.f'attaf 'oo.fo.R#, mpe`t.fffobly.
of8/'injury'erst frames#, mpe`t.ff//y(rfobly.
of9. ???. mpe`t.ff//y(rfobly.
of10/'aen'oo.fo.R#, mpe`t.ff//y(rfobly.
of11/'close Dttaf 'oframes#, mpe`t.ff//y(r.
of12. 'distahce.Dttaf 'oframes#, mpe`t.ff//y(r.
of13. 'death'oframes#for mpe`t.ff,f'/o/'oframes#for proj/tiles.
of14.f'/osive death'oframes#,fobly PLAY, POSS, SPOS, TROOao co/ifeweak.
of15. 'death'oo.fo.R#for mpe`t.ff,f'/o/'oo.fo.R#for proj/tiles. 'll 16 Speod pf movecs,  Proj/tiles'speodfeo co* 65536s(or split/ui]o.iablesn/.woo2-byte i/e(rs.
of17. Horiz/lfoizes* 65536
of18 Height* 65536
of19. Pri/value?aNot /cs, e..
of20/Misslefomag.AYYe,aSKUL..f.fa3fo.re, Iepr/sumest/urnssn/ao.iablesproj/tileawf.n Dttaf ing/{l 21.f'act'oo.fo.R#, mpe`t.ff/{l 22. Atributf], c/rollis infbieo/Bit she= c/dVmpn .ru.bie0 =o.iables1/0, bie8= 256/0, bie16= 65536/0, /o.iabbie0 ofget./ ung{iabbie1 on obstac //y(rs.Dmpe`t.fff(b.f.p.proj/tiles){iabbie2 YYe huD (note barrelsfhave o..foshe){iabbie3 ?etSpe/or.fdesrmhation Kffoblyaobilith it she{iabbie4    f'autoo.w ch'.likePUFF, TFOG, BLUD,proj/tiles{iabbie5-7iabunuse?{iabbie8    hfoi from ceing{iabbie9ablesfloaVmhismpe`t.fffDnot-on-gr.fo.Rungs{iabbie10blesproj/tile`Dy(r{iabbie11?e/y(rfoblyhostbbie12-13bunuse?{iabbie14blesfloaVmhismpe`t.ff{iabbie15 iabunuse?{iabbie16lesproj/tile`{iabbi