home *** CD-ROM | disk | FTP | other *** search
/ Deathday Collection / dday.bin / edit / dfe / waddecl.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-26  |  3KB  |  129 lines

  1. {****************************************************************************
  2. *                      The DOOM Hacker's Tool Kit                           *
  3. *****************************************************************************
  4. * Unit:       WADDECL                                                          *
  5. * Purpose: WAD File type declarations                                       *
  6. * Date:    4/28/94                                                          *
  7. * Author:  Joshua Jackson        Internet: joshjackson@delphi.com           *
  8. ****************************************************************************}
  9.  
  10. {$O+,F+}
  11. unit WadDecl;
  12.  
  13. interface
  14.  
  15. const MaxEntries=4095;                                {64k worth}
  16.  
  17. type  BA=array[0..65528] of byte;
  18.         BAP=^BA;
  19.         PCoOrds=^TCoOrds;
  20.         PWADDirEntry=^TWADDirEntry;
  21.         PWADDirList=^TWADDirList;
  22.         PPictureBuff=^TPictureBuff;
  23.         PSoundBuff=^TSoundBuff;
  24.         ObjNameStr=array[1..8] of char;
  25.         PLevelEntries=^TLevelEntries;
  26.         PThing=^TThing;
  27.         PLineDef=^TLineDef;
  28.         PVertext=^TVertex;
  29.         PThingList=^TThingList;
  30.         PVertexList=^TVertexList;
  31.         PLineDefList=^TLineDefList;
  32.         PFloorBuff=^TFloorBuff;
  33.         TCoOrds=record
  34.             x    :integer;
  35.             y    :integer;
  36.             z    :integer;
  37.         end;
  38.         TWADDirEntry=record
  39.             ObjStart    :longint;
  40.             ObjLength:longint;
  41.             ObjName    :array[1..8] of char;
  42.         end;
  43.         TWADDirList=array[1..MaxEntries] of TWADDirEntry;
  44.         TPictureBuff=record
  45.             x        :integer;
  46.             y        :integer;
  47.             xofs    :integer;
  48.             yofs    :integer;
  49.             Name    :array[1..8] of char;
  50.             Image    :^BA;
  51.         end;
  52.         TSoundBuff=record
  53.           Junk1            :integer;
  54.             SampleRate    :integer;
  55.             Samples        :integer;
  56.          Junk2            :integer;
  57.             Sound            :BAP;
  58.         end;
  59.         TLevelEntries=record
  60.             MapID            :TWadDirEntry;
  61.             Things        :TWadDirEntry;
  62.             LineDefs        :TWadDirEntry;
  63.             SideDefs        :TWadDirEntry;
  64.             Vertexes        :TWadDirEntry;
  65.             Segs          :TWadDirEntry;
  66.             SSectors     :TWadDirEntry;
  67.             Nodes        :TWadDirEntry;
  68.             Sectors        :TWadDirEntry;
  69.             Reject        :TWadDirEntry;
  70.             Blockmap        :TWadDirEntry;
  71.         end;
  72.         TThing=record
  73.             x                :integer;
  74.             y                :integer;
  75.             Angle            :integer;
  76.             ThingType    :word;
  77.             Attributes  :word;
  78.         end;
  79.         TLineDef=record
  80.             StartVertex    :integer;
  81.             EndVertex    :integer;
  82.             Attributes    :word;
  83.             LineDefType    :word;
  84.             Tag            :integer;
  85.             RightSideDef:integer;
  86.             LeftSideDef    :integer;
  87.         end;
  88.         TVertex=record
  89.             x                :integer;
  90.             y                :integer;
  91.         end;
  92.         TThingList=Array[0..6551] of TThing;
  93.         TVertexList=Array[0..16381] of TVertex;
  94.         TLineDefList=Array[0..4679] of TLineDef;
  95.         TFloorBuff=record
  96.             Name            :array[1..8] of char;
  97.             Image            :^BA;
  98.         end;
  99.  
  100. Function Hex_String(Number: Longint): String;
  101.  
  102. implementation
  103.  
  104. Function Hex_String(Number: Longint): String;
  105.  
  106.     Function Hex_Char(Number: Word): Char;
  107.         Begin
  108.             If Number<10 then
  109.                 Hex_Char:=Char(Number+48)
  110.             else
  111.                 Hex_Char:=Char(Number+55);
  112.         end; { Function Hex_Char }
  113.  
  114.     Var
  115.         S: String;
  116.     Begin
  117.         S:='';
  118.         S:=Hex_Char((Number and $F0000000) shr 28);
  119.         S:=S+Hex_Char((Number and $0F000000) shr 24);
  120.         S:=S+Hex_Char((Number and $00F00000) shr 20);
  121.         S:=S+Hex_Char((Number and $000F0000) shr 16);
  122.         S:=S+Hex_Char((Number and $0000F000) shr 12);
  123.         S:=S+Hex_Char((Number and $00000F00) shr 8);
  124.         S:=S+Hex_Char((Number and $000000F0) shr 4);
  125.         S:=S+Hex_Char(Number and $0000000F);
  126.         Hex_String:='0x'+S;
  127.     end; { Function Hex_String }
  128.  
  129. end.