home *** CD-ROM | disk | FTP | other *** search
/ Duke Nukem 3D - Kill-A-Ton / Duke_Nukem_3D_Kill-A-Ton_Collection_-_CD1.iso / goodies / build / artform.txt < prev    next >
Text File  |  1996-10-10  |  5KB  |  112 lines

  1. Documentation on Ken's .ART file format                     by Ken Silverman
  2.  
  3.    I am documenting my ART format to allow you to program your own custom
  4. art utilites if you so desire.  I am still planning on writing the script
  5. system.
  6.  
  7.    All art files must have xxxxx###.ART.  When loading an art file you
  8. should keep trying to open new xxxxx###'s, incrementing the number, until
  9. an art file is not found.
  10.  
  11.  
  12. 1. long artversion;
  13.  
  14.       The first 4 bytes in the art format are the version number.  The current
  15.    current art version is now 1.  If artversion is not 1 then either it's the
  16.    wrong art version or something is wrong.
  17.  
  18. 2. long numtiles;
  19.  
  20.       Numtiles is not really used anymore.  I wouldn't trust it.  Actually
  21.    when I originally planning art version 1 many months ago, I thought I
  22.    would need this variable, but it turned it is was unnecessary.  To get
  23.    the number of tiles, you should search all art files, and check the
  24.    localtilestart and localtileend values for each file.
  25.  
  26. 3. long localtilestart;
  27.  
  28.       Localtilestart is the tile number of the first tile in this art file.
  29.  
  30. 4. long localtileend;
  31.  
  32.       Localtileend is the tile number of the last tile in this art file.
  33.       Note:  Localtileend CAN be higher than the last used slot in an art
  34.       file.
  35.  
  36.          Example:  If you chose 256 tiles per art file:
  37.       TILES000.ART -> localtilestart = 0,   localtileend = 255
  38.       TILES001.ART -> localtilestart = 256, localtileend = 511
  39.       TILES002.ART -> localtilestart = 512, localtileend = 767
  40.       TILES003.ART -> localtilestart = 768, localtileend = 1023
  41.  
  42. 5. short tilesizx[localtileend-localtilestart+1];
  43.  
  44.       This is an array of shorts of all the x dimensions of the tiles
  45.    in this art file.  If you chose 256 tiles per art file then
  46.    [localtileend-localtilestart+1] should equal 256.
  47.  
  48. 6. short tilesizy[localtileend-localtilestart+1];
  49.  
  50.       This is an array of shorts of all the y dimensions.
  51.  
  52. 7. long picanm[localtileend-localtilestart+1];
  53.  
  54.       This array of longs stores a few attributes for each tile that you
  55.    can set inside EDITART.  You probably won't be touching this array, but
  56.    I'll document it anyway.
  57.  
  58.    Bit:  │31           24│23           16│15            8│7             0│
  59.          ├───────────────┼───────────────┼───────────────┼───────────────┤
  60.          │ | | | | | | | │ | | | | | | | │ | | | | | | | │ | | | | | | | │
  61.          └───────┬───────┼───────────────┼───────────────┼───┬───────────┤
  62.                  │ Anim. │  Signed char  │  Signed char  │   │  Animate  │
  63.                  │ Speed │   Y-center    │   X-center    │   │   number  │
  64.                  └───────┤    offset     │    offset     │   ├───────────┘
  65.                          └───────────────┴───────────────┤   └──────────┐
  66.                                                          │ Animate type:│
  67.                                                          │ 00 - NoAnm   │
  68.                                                          │ 01 - Oscil   │
  69.                                                          │ 10 - AnmFd   │
  70.                                                          │ 11 - AnmBk   │
  71.                                                          └──────────────┘
  72.           You probably recognize these:
  73.        Animate speed -            EDITART key: 'A', + and - to adjust
  74.        Signed char x&y offset -   EDITART key: '`', Arrows to adjust
  75.        Animate number&type -      EDITART key: +/- on keypad
  76.  
  77. 8. After the picanm's, the rest of the file is straight-forward rectangular
  78.       art data.  You must go through the tilesizx and tilesizy arrays to find
  79.       where the artwork is actually stored in this file.
  80.  
  81.       Note:  The tiles are stored in the opposite coordinate system than
  82.          the screen memory is stored.  Example on a 4*4 file:
  83.  
  84.          Offsets:
  85.          ┌───┬───┬───┬───┐
  86.          │ 0 │ 4 │ 8 │12 │
  87.          ├───┼───┼───┼───┤
  88.          │ 1 │ 5 │ 9 │13 │
  89.          ├───┼───┼───┼───┤
  90.          │ 2 │ 6 │10 │14 │
  91.          ├───┼───┼───┼───┤
  92.          │ 3 │ 7 │11 │15 │
  93.          └───┴───┴───┴───┘
  94.  
  95.  
  96.  
  97. ----------------------------------------------------------------------------
  98.    If you wish to display the artwork, you will also need to load your
  99. palette.  To load the palette, simply read the first 768 bytes of your
  100. palette.dat and write it directly to the video card - like this:
  101.  
  102.    Example:
  103.       long i, fil;
  104.  
  105.       fil = open("palette.dat",O_BINARY|O_RDWR,S_IREAD);
  106.       read(fil,&palette[0],768);
  107.       close(fil);
  108.  
  109.       outp(0x3c8,0);
  110.       for(i=0;i<768;i++)
  111.          outp(0x3c9,palette[i]);
  112.