home *** CD-ROM | disk | FTP | other *** search
/ D!Zone (Collector's Edition) / D_ZONE_CD.ISO / programs / editors / dhtk100 / dhtk.txt < prev    next >
Text File  |  1994-12-06  |  28KB  |  783 lines

  1. *****************************************************************************
  2. *                       The DOOM Hacker's Tool Kit v1.00                    *
  3. *****************************************************************************
  4. * Author:  Joshua Jackson          internet: joshjackson@delphi.com         *
  5. * Release Date: 5/25/94                                                     *
  6. * Language: Borland Pascal 7.0   (Mostly Object Oriented)                   *
  7. *    Destination Platform:  DOS real mode  -OR-  DPMI DOS protected mode    *
  8. *                                                                           *
  9. * The DOOM Hacker's Tool Kit is a product of Jackson Software               *
  10. *****************************************************************************
  11.  
  12. Welcome fellow DOOM hacker!
  13.  
  14.     I have released this source code in hopes that someone out there with a
  15.     bit more brains than I have can put it to good use.  I am also making
  16.     a request that anyone willing to trade source code and ideas, please
  17.     email me at the above address.  I am mostly interested in 3D rendering
  18.     code, but am looking for anything that is not contained in this tool kit,
  19.     or improves upon it.
  20.  
  21.     I am also considering setting up a DOOM Hacker's BBS.  If you are
  22.     interested in such a BBS, please let me know so.  It will be setup on
  23.     a File Point system with no ratio required for Long Distance callers.
  24.     I would also accept UUENCODED source over the internet, which would
  25.     then be placed onto the BBS.
  26.  
  27.     NOTE: This BBS would be for programs that include the SOURCE CODE only!
  28.             I will also have a section for technical FAQs and the like...
  29.             similiar to DMSPEC13.TXT
  30.             All Languages would be accepted.
  31.  
  32.     This is a rather extensive set of utilities that I hacked up to access
  33.     just about everything in the WAD file.  Resource utilities include:
  34.  
  35.         Sprite Viewer
  36.         Map Viewer (With object recognition/sprite viewing)
  37.         Floor/Ceiling Texture Viewer
  38.         Wall Texture Viewier
  39.         Sound Player
  40.         Resource Extractor
  41.         Object Caching
  42.  
  43. In addition, I have also included the source code for the DOOM Front End
  44. v1.31.  The majority of the code here is written in Borland Pascal 7.0 and
  45. is mostly geared toward OOP (Object Oriented Programming).  There is also some
  46. assembly language thrown into it here and there.
  47.  
  48. Comments, Suggestions, Bashing, and Questions are more than welcome!
  49.  
  50. (Please, don't write just to tell me that the code is not fully cleaned up!
  51.  I do realize that there are declared variables that aren't used and things
  52.  of that nature.  This is because I wanted to get this program into your
  53.  hands as soon as possible, and that this code, even though its version 1.0,
  54.  has done some massive evolving since I first began construction of it.  It
  55.  was originally written in staight pascal, no objects that is, and was VERY
  56.  pathetic!  This tool kit has probably under gone several dozen revisions
  57.  since I begin the project about a month ago.)
  58.  
  59. Contacting me:
  60.  
  61. Internet:       joshjackson@delphi.com
  62.  
  63. Snail Mail: Joshua Jackson
  64.                 10506 Bayard Rd.
  65.                 Minerva, OH  44657
  66.  
  67. Phone:      (216) 868-1169
  68.  
  69. !*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*
  70. DISCLAIMER:
  71.  
  72. The author will not accept any resposibility for damage resulting from the
  73. use of these programs, whether it be hardware, software, or mental.
  74.  
  75. COPYING/USE of this code:
  76.  
  77. All of the code in the DOOM Hacker's tool kit is placed in the public domain
  78. with the exception of DFE.  The DFE source has been released simply for
  79. educational purposes only, I would appriciate if you would not modify and
  80. release and versions of this program.
  81. !*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*
  82.  
  83. NOTE: If you plan to compile this tool kit under DPMI, you should use the
  84.         BGI256.BGI or BGI256.OBJ (for linking in the graphics driver).  I
  85.         obtained these drivers off of the official Borland BBS.  Most public
  86.         domain BGI drivers will cause a general protection fault under DPMI,
  87.         BGI256 is designed to be compatible.
  88.  
  89. Well, enough of that, lets get onto the part you probably are interested in
  90. reading.
  91.  
  92. The following are descriptions of all of the Objects/Routines that are
  93. contained in the WAD Hacker's Toolkit.
  94.  
  95. ------------------------------------------------------------------------------
  96. Unit:   WADDECL.PAS
  97. Purpose:        Declarations Unit
  98.  
  99.     There is not much to this unit,  it is simply the type declarations for
  100. many of the different structured variables in the tool kit...  If you can't
  101. understand this unit, you may want to stop here! :)
  102. ------------------------------------------------------------------------------
  103.  
  104. ------------------------------------------------------------------------------
  105. Unit:   WAD.PAS
  106. Purpose:        Accessing a WAD file's directory
  107.  
  108.     This unit is the center of the tool kit.  It contains an object that
  109. loads a given WAD file's directory into memory.  Almost all of the other units
  110. rely on this unit for their access into the WAD files.
  111.  
  112. The object contained in this unit (TWadDirectory) MUST be initialized before
  113. any other units can be  initialized.
  114.  
  115. The following is a listing of the TWadDirectory object declaration:
  116.  
  117. type    PWadDirectory=^TWadDirectory;
  118.         TWadDirectory=object
  119.             WadName         :array[1..9] of char;
  120.             WadFile         :file;
  121.             WadID                   :array[1..4] of char;
  122.             DirEntries      :longint;
  123.             DirStart                :longint;
  124.             DirEntry        :PWADDirList;
  125.             Constructor Init(WadFileName:String);
  126.             Procedure DisplayWadDir;
  127.             Function FindObject(ObjName:ObjNameStr):word;
  128.             Procedure SetWadPalette(PlayPalNum:integer);
  129.             Procedure RestorePalette;
  130.             Destructor Done;
  131.         end;
  132.  
  133. When calling the init constructor, the only needed parameter is the path and
  134. name of the WAD file that you wish to load. The following is an example
  135. program that will load a WAD file directory:
  136.  
  137.     uses Wad;
  138.  
  139.     var     WDir:PWadDirectory;
  140.  
  141.     begin
  142.  
  143.         {Initialize WAD file directory for DOOM.WAD}
  144.         WDir:=New(PWadDirectory, Init('C:\DOOM\DOOM.WAD'));
  145.  
  146.         {Your code goes here}
  147.  
  148.         {Dispose of the WAD file directory}
  149.         Dispose(WDir, Done);
  150.  
  151.     end.
  152.  
  153. You will also notice that I included the call to the object's done destructor
  154. when disposing of the object.  This is mandatory unless you want a ton of
  155. garbage left on the heap.
  156.  
  157. The other methods besides init and done are use mainly by the other units in
  158. the tool kit.  However, if you would like you implement them in your own
  159. programs here is the syntax for them:
  160.  
  161.  
  162. Function FindObject(ObjName:ObjNameStr):word
  163.     Returns the position in the directory array of the given object's name.
  164.     NOTE: you may use use the WildCard value of '?' for any or all letters in
  165.     the name if you want to do a "find first that matches" type search.
  166.  
  167. Procedure DisplayWadDir
  168.     displays the given WAD file's directory to the screen
  169.  
  170. Procedure SetWadPalette(PlayPalNum:integer);
  171.     Sets the current graphics palette to one of the 17 palettes available in
  172.     the WAD file.  The main play palette is 0.
  173.  
  174. Procedure RestorePalette
  175.     Restores the current graphics palette to the original palette before the
  176.     first call to SetWadPalette
  177.  
  178. Finally, the variable fields in this object are defined as follows:
  179.  
  180. WadName         :array[1..9] of char;
  181.     The ASCIIZ name of the WAD file that this object contains the directory to.
  182.     (NOTE: the .WAD extension is not included)
  183.  
  184. WadFile         :file;
  185.     This file identifier used when accessing the WAD file.  This field should
  186.     NEVER be altered.
  187.  
  188. WadID                   :array[1..4] of char;
  189.     Indicated if the loaded file is a 'PWAD' or an 'IWAD'
  190.  
  191. DirEntries      :longint;
  192.     The number of directory entires contained in the WAD file.
  193.  
  194. DirStart                :longint;
  195.     The file offset of the begining of the directory structure.
  196.  
  197. DirEntry        :PWADDirList;
  198.     The directory entries themselves.  The number of entries will vary
  199.     depending on the size of the WAD file.
  200.     NOTE: The number of entries in this array is always equal to DirEntries.
  201.  
  202.     The structure for PWADDirList is contained in the WADDECL unit an