00001 /* 00002 * PROJECT: FLI/FLC animation play routines V2.4 00003 * 00004 * AUTHOR: Ivo Bosticky 00005 * 00006 * ABOUT: Well when I started working on this I decided to create my 00007 * own fli header to reference the individual fli/flc files 00008 * that are being played. The reason being that the original 00009 * fli files had a huge and ugly file header i didn't feel like 00010 * keeping in memory, later on this made it easier for flcs. 00011 * So the header is the link you have to the fli/flc file once 00012 * it is loaded, it has all the info about the fli file you 00013 * need. The various structures and functions that wflilib 00014 * supports are described below. 00015 */ 00016 00017 #ifndef flilib_h 00018 #define flilib_h 00019 00020 struct fli 00021 { 00022 unsigned short int frames; 00023 unsigned short int width; 00024 unsigned short int height; 00025 unsigned short int speed; 00026 unsigned short int current; 00027 unsigned long crntoff; 00028 unsigned short int handle; 00029 unsigned char *palette; 00030 bool paletteChange; 00031 }; 00032 00033 /* description of a fli structure 00034 Any of these variables can be used directly, by fliptr->variable 00035 where fliptr is the pointer returned by the load_fli function. 00036 To go to the first frame execute the following code: 00037 fliptr->current=0; 00038 fliptr->crntoff=(long)sizeof(fli); 00039 (this only works if all of the fli was loaded into the ram) 00040 00041 The data can only be used if the fli was loaded with the FLI_RAM 00042 or possibly the FLI_AUTO option. 00043 00044 Handle is equal to 0 if all of the fli was loaded into the ram. 00045 00046 byte offset size name meaning 00047 0 2 frames Number of frames in fly, a maximum of 4000 00048 2 2 width Screen width (320) 00049 4 2 height Screen height (200) 00050 6 2 speed Number of video ticks between frames 00051 8 2 current Current frame (=0 initilly) 00052 10 4 crntoff offset from begining to current frame (=14 initially) 00053 14 2 handle handle of the file if playing from disk 00054 16 ? data data for the frames (only if handle>1) 00055 00056 */ 00057 00058 enum fli_source { FLI_RAM, FLI_DISK, FLI_AUTO }; 00059 // FLI_RAM forces load_fli to load the entire fli to memory and play it from ram 00060 // FLI_DISK forces play from disk, (uses from 128 bytes up to just over 64Kb of ram) 00061 // FLI_AUTO first tries to load file into memory then tries the disk option 00062 00063 fli * load_fli(char *filename,fli_source playtype); 00064 // returns pointer to the fli in memory 00065 // or returns NULL if it didn't find the file or out of memory 00066 // the file can be either a fli or flc 00067 00068 short int play_frame(fli *fliptr,char *dest,short int sizex); 00069 // plays a single frame and if it is the last frame, automatically 00070 // sets the current and crntoff to the first frame 00071 // fliptr is the pointer that load_fli returns 00072 // dest is the memory buffer to play into, can be the screen of mode 0x13 00073 // sizex is the width of the memory buffer (320) 00074 00075 void close_fli(fli *fliptr); 00076 // closes the handle used if playing from DISK 00077 // frees up all the memory used by the fli 00078 00079 00080 #endif //flilib_H 00081