home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / msdos / animutil / pvquan / flilib / aafli.h < prev    next >
C/C++ Source or Header  |  1992-11-30  |  3KB  |  105 lines

  1. /* aafli.h  Copyright 1990 Dancing Flame, San Francisco */
  2.  
  3. #ifndef AAFLI_H
  4. #define AAFLI_H
  5.  
  6. #include <stdio.h>
  7. #ifdef __GNUC__
  8. #define cdecl
  9. #define far
  10. #endif
  11.  
  12. #define FLI_MAXFRAMES (4*1000)        /* Max number of frames... */
  13. #define FLIH_MAGIC 0xaf11             /* File header Magic */
  14. #define FLIF_MAGIC 0xf1fa            /* Frame Magic */
  15.  
  16. typedef struct fli_head {
  17.     long size;
  18.     USHORT type;                      /* = FLIH_MAGIC */
  19.     USHORT frame_count;
  20.     USHORT width;
  21.     USHORT height;
  22.     USHORT bits_a_pixel;
  23.     SHORT flags;
  24.     SHORT speed;
  25.     long next_head;
  26.     long frames_in_table;
  27.     SHORT file;            /* used by players.  Contains zeros on disk. */
  28.     long frame1_off;    /* used by players.  Contains zeros on disk. */
  29.     long strokes;        /* how many paint strokes etc. made. */
  30.     long session;         /* stokes since file's been loaded. */
  31.     char reserved[88];    /* all zeroes on disk */
  32. } Fli_head;
  33.  
  34. #define HEAD_SIZE 128
  35.  
  36. /* bit defines for flags field */
  37. #define FLI_FINISHED 1    /* finished writing fli */
  38. #define FLI_LOOPED    2    /* fli has a loop frame */
  39.  
  40. typedef struct fli_frame {
  41.     long size;
  42.     USHORT type;        /* = 0xf1fa FLIF_MAGIC */
  43.     USHORT chunks;
  44.     char pad[8];
  45. } Fli_frame;
  46.  
  47. #define FRAME_SIZE 16
  48.  
  49. typedef struct fli_chunk {
  50.     long size;
  51.     SHORT type;
  52. } Fli_chunk;
  53.  
  54. #define CHUNK_SIZE 6
  55.  
  56. typedef UBYTE Cbuf;        /* compression buffer */
  57.  
  58. /* size of buffer that'll be big enough to hold worst case FLI frame */
  59. #define FLI_CBUF_SIZE (64000U+3*AA_COLORS+2*CHUNK_SIZE+FRAME_SIZE)
  60.  
  61.  
  62. /* types of chunk in a fli_frame */
  63. #define FLI_COLOR 11
  64. #define FLI_LC    12
  65. #define FLI_BLACK 13
  66. #define FLI_BRUN 15
  67. #define FLI_COPY 16
  68.  
  69.  
  70. /** Higher level FLI playing functions */
  71. /* Decompress a single frame that's in RAM */
  72. void fli_uncomp(Vscreen *f, /* the screen to update */
  73.     Fli_frame *frame,        /* Header for this frame */
  74.     Cbuf *cbuf,            /* Compressed data for this frame */
  75.     Boolean see_colors);   /* update the hardware color map? */
  76.  
  77. /* Read in FLI header, verify that it's a FLI file, and return file
  78. handle.  See aaerr.h for negative return values if there are problems. */
  79. FILE *fli_open(char *fliname, Fli_head *fh);
  80.  
  81. /* Read in next frame and uncompress onto screen, optionally updating
  82. hardware color palette */
  83. Errval fli_read_display_frame(FILE *ff, Vscreen *v, Boolean see_colors);
  84.  
  85. /* Read and display next frame onto VGA display */
  86. Errval fli_next_frame(FILE *ff);
  87.  
  88. /* Play FLI, going on forever or until 'until' function returns FALSE.
  89. Until is called with the current frame, the total frame in the FLI,
  90. and how many times have played entire FLI. */
  91. Errval fli_until(char *fliname,     /* name of fli to play */
  92.     int speed,                /* if speed negative, use speed in file */
  93.     AAivec until);        /* function to call to see when to stop */
  94.  
  95. /* The 'until' function we use to construct fli_play */
  96. Boolean fli_until_key(int cur_frame, int frame_count, int cur_loop);
  97.  
  98. /* Play FLI looping forever until any key is hit */
  99. Errval fli_play(char *fliname);
  100.  
  101. /* Play FLI once */
  102. Errval fli_once(char *fliname);
  103.  
  104. #endif /* AAFLI_H */                 
  105.