home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / ANIMFILE.TXT < prev    next >
Text File  |  1996-01-04  |  6KB  |  139 lines

  1. DeluxePaint Animation ".ANM" files consist of a large header and a series of
  2. structures that can be up to 64 KB long each.  The programmer refers to these
  3. structures as "Large Pages".  Large Pages are a format for dividing a file
  4. into 64 KB chunks that can be stored out-of-sequence in the file.  That is,
  5. a large page can be logically inserted into the file, without having to move
  6. all the following data out of the way.
  7.  
  8. Each large page holds one or more "records".  A record represents one frame
  9. of the original animation.  A record is of any length from 0 to almost 64 KB.
  10. The records in a large page are sequential.  However, the first large page
  11. may not contain the first frames of the anim file.  Each large page contains
  12. a sequential set of records but the large pages themselves are not in
  13. sequential order.  It is possible for the first large page in a file to
  14. contain the last few frames of the animation.  When you process the anim file
  15. you must scan the large page structures to find which large page conatins the
  16. frame you wish to display or process next.
  17.  
  18. A DeluxePaint Animation "ANM" ("Anim") file is built on this mechanism,
  19. so that as frames change in size, they can be maintained with a minimum
  20. of extra file i/o, yet without loss of playback performance.
  21. In addition, there is an optional special record which is the delta from
  22. the last frame to the first frame, for smooth playback of looping anims.
  23.  
  24. The following is the structure of a DeluxeAnimate anim file header.
  25. Header size is exactly 2816 bytes.  The first large page structure can be
  26. reached by simply seeking to this location in the file.
  27.  
  28.  ULONG id;        4 character ID == "LPF "
  29.  
  30.  UWORD maxLps;        max # largePages allowed. 256 FOR NOW.  
  31.  
  32.  UWORD nLps;        # largePages in this file.
  33.  
  34.  ULONG nRecords;    # records in this file.  65534 is current limit plus
  35.             one for last-to-first delta for looping the animation
  36.  
  37.  UWORD maxRecsPerLp;    # records permitted in an lp. 256 FOR NOW.  
  38.  
  39.  UWORD lpfTableOffset;    Absolute Seek position of lpfTable.  1280 FOR NOW.
  40.             The lpf Table is an array of 256 large page structures
  41.             that is used to facilitate finding records in an anim
  42.             file without having to seek through all of the Large
  43.             Pages to find which one a specific record lives in.
  44.  
  45.  ULONG contentType;    4 character ID == "ANIM"
  46.  
  47.  UWORD width;        Width of screen in pixels.
  48.  UWORD height;        Height of screen in pixels.
  49.  UBYTE variant;        0==ANIM.
  50.  UBYTE version;        0==frame rate is multiple of 18 cycles/sec.
  51.             1==frame rate is multiple of 70 cycles/sec. 
  52.  
  53.  UBYTE hasLastDelta;    1==Last record is a delta from last-to-first frame.
  54.  
  55.  UBYTE lastDeltaValid;    0==The last-to-first delta (if present) hasn't been
  56.             updated to match the current first&last frames,    so it
  57.             should be ignored.
  58.  
  59.  UBYTE pixelType;    0==256 color.
  60.  
  61.  UBYTE CompressionType;    1==(RunSkipDump) Only one used FOR NOW.
  62.  
  63.  UBYTE otherRecsPerFrm;    0 FOR NOW.
  64.  
  65.  UBYTE bitmaptype;    1==320x200, 256-color.  Only one implemented so far.
  66.  
  67.  UBYTE recordTypes[32];    Not yet implemented.
  68.  
  69.  ULONG nFrames;        In case future version adds other records at end of
  70.             file, we still know how many actual frames.
  71.             NOTE: DOES include last-to-first delta when present.
  72.  
  73.  UWORD framesPerSecond;    Number of frames to play per second.
  74.  
  75.  UWORD pad2[29];    58 bytes of filler to round up to 128 bytes total.
  76.  
  77.  Range cycles[16];    Color cycling info (128 bytes long).
  78.             This is the format of a cycle structure.
  79.             typedef struct {
  80.                     WORD count;
  81.                     WORD rate;
  82.                     WORD flags;
  83.                     UBYTE low, high; /* bounds of range */
  84.                     } Range;
  85.  
  86.  
  87.     total is = 256 bytes.
  88.  
  89.  Following the anim file header is the color palette
  90.  
  91.  ULONG    palette[256]    Color palette arranged as 3 bytes each of Red Green
  92.             & Blue and one unused byte.
  93.  
  94.  Following the palette is an array of structures that are copies of the
  95.  large page headers.  This array is loaded and used to find which large page
  96.  a given frame can be found in.
  97.  
  98.  Large_page LParay[256]    Copies of all the Large Page structures in the anim
  99.             file.  Each Large Page structure is 6 bytes long so
  100.             the total length of this table is 1536 bytes.  Even if
  101.             the file only contains 1 large page there are still
  102.             256 entries of 6 bytes each.
  103.  
  104.  The Large Pages follow the LParray and are in the sequence dictated by
  105.  their order of occurence in the LParray in the anim file header.
  106.  
  107.  The following is the structure of a single Large Page in an anim file.  Each
  108.  Large Page is exactly 64k long in the anim file.  The only exception is the
  109.  last large page wich is truncated to be only as long as necessary.
  110.  
  111.  UWORD baseRecord;    Number of first record in this large page.
  112.  
  113.  UWORD nRecords;    Number of records in lp.
  114.             bit 15 of "nRecords" == "has continuation from previous lp".
  115.                 bit 14 of "nRecords" == "final record continues on next lp".
  116.  
  117.  UWORD nBytes;        Total number of bytes of contents, excluding header.
  118.  
  119.  UWORD BytesContinued;    The number of bytes of the last record of the
  120.             previous large page that extend into this large page.
  121.             This was never implemented and is always 0.
  122.  
  123.  UWORD RecordSizes[nRecords] Array of lengths of each record in the large page.
  124.  
  125.  The actual records start here.  Each record has a variable length header that
  126.  is like the following structure.
  127.  
  128.     typedef struct{
  129.         UBYTE IDnum;        always 66
  130.         UBYTE Flags;        0==no extra bytes field next
  131.  
  132.         UWORD extrabytes;    if Flags is non zero this is # of bytes
  133.                     to skip before compressed data starts
  134.                     extrabytes does not include the size
  135.                     of the 2 previous bytes.  Also make
  136.                     sure you round the final address up to
  137.                     an even byte boundry.
  138.         } record_header;
  139.