home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / GameSmith1-Hisoft-System.DMS / in.adf / GDS_System.lha / include / graphics / anim.h next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  8.7 KB  |  166 lines

  1. #ifndef GS_ANIM
  2. #define GS_ANIM
  3.  
  4. /* Custom blitter & collision detection structures: */
  5.  
  6. struct coll_bg_struct    /* object to background collision struct */
  7.   {
  8.   unsigned int mask;     /* collision enable mask */
  9.   unsigned int area;     /* collision area number */
  10.   unsigned short x1;     /* x coord to check */
  11.   unsigned short y1;     /* y coord to check */
  12.   struct coll_bg_struct *next;   /* ptr to next coll_bg_struct for image */
  13.   };
  14.  
  15. struct collision_struct  /* object to object collision struct */
  16.   {
  17.   unsigned int type;     /* type of collision area */
  18.   unsigned int mask;     /* collision enable mask */
  19.   unsigned int area;     /* collision area number */
  20.   unsigned short x1;     /* left edge of area */
  21.   unsigned short y1;     /* top edge of area */
  22.   unsigned short x2;     /* right edge of area */
  23.   unsigned short y2;     /* bottom edge of area */
  24.   struct collision_struct *next;  /* ptr to next collision struct for image */
  25.   };
  26.  
  27. struct blit_struct
  28.   {
  29.   unsigned short *data;  /* pointer to blitter image data */
  30.   unsigned short *mask;  /* pointer to mask image */
  31.   unsigned short *save;  /* pointer to image save area */
  32.   int depth;             /* number of bit planes in image */
  33.   int planes;            /* defines which planes to draw into */
  34.   int width;             /* width of data image (in words) */
  35.   int height;            /* height of data image (scan lines) */
  36.   int image_size;        /* size (in bytes) of image (width * height) */
  37.   int x_off;             /* X offset from left edge of image for placement */
  38.   int y_off;             /* Y offset from top edge of image for placement */
  39.   int flags;             /* blitter flags (see below) */
  40.                          /* collision list ptr (null if no collision detect) */
  41.                          /* for background gfx */
  42.   struct coll_bg_struct *coll_bg;
  43.                          /* collision list ptr (null if no collision detect) */
  44.                          /* for anim object area detect */
  45.   struct collision_struct *collision;
  46.   struct blit_struct *prev; /* ptr to previous image in an animation sequence */
  47.   struct blit_struct *next; /* ptr to the next image in an animation sequence */
  48.   int reserved[2];       /* reserved work/storage area for blitter routines */
  49.   };
  50.  
  51. /* the blitter flags */
  52.  
  53. #define BLIT_MERGE          0x01000000  /* don't clear unaffected planes */
  54. #define BLIT_1SHOT_FORWARD  0x02000000  /* anim does not repeat when played forward */
  55. #define BLIT_1SHOT_BACKWARD 0x04000000  /* anim does not repeat when played backward */
  56. #define BLIT_DATACOPY       0x08000000  /* data is a copy area, don't free (internal use) */
  57. #define BLIT_CPUBLIT        0x10000000  /* use CPU to blit image instead of blitter */
  58.  
  59. /* animation structures: */
  60.  
  61. struct anim_cplx
  62.   {
  63.   unsigned short cnt;        /* number of anim sequences in the complex */
  64.   unsigned short seq;        /* current anim sequence number (0 - n) */
  65.   unsigned short width;      /* maximum width of complex (in bytes) */
  66.   unsigned short height;     /* maximum height of complex (scan lines */
  67.   unsigned short array_num;  /* array element number for duplicate complexes in an array */
  68.   unsigned short label;      /* User label field/ID (actually a number) */
  69.   struct anim_struct *list;  /* ptr to list of anim sequences */
  70.   struct anim_struct *anim;  /* ptr to current anim obj on screen */
  71.   };
  72.  
  73. struct anim_struct
  74.   {
  75.   struct blit_struct *list;  /* Ptr to 1st image in anim sequence */
  76.   struct blit_struct *img;   /* Ptr to current image on screen */
  77.   struct anim_struct *attach; /* Ptr to next attached anim */
  78.   unsigned short array_num;  /* array element number for duplicate anims in an array */
  79.   unsigned short label;      /* User label field/ID (actually a number) */
  80.   unsigned short count;      /* number of images in the anim sequence */
  81.   short x;                   /* Current X coord of image on screen */
  82.   short y;                   /* Current Y coord of image on screen */
  83.   short xa;                  /* Attached anim X offset from parent */
  84.   short ya;                  /* Attached anim Y offset from parent */
  85.   unsigned short width;      /* Maximum width of image (in bytes) */
  86.   unsigned short height;     /* Maximum height of image (in scan lines) */
  87.   unsigned short cell;       /* Current cell number on screen (0 - nn) */
  88.   unsigned short prio;       /* Image display priority */
  89.   unsigned long flags;       /* Anim flags (see below) */
  90.          /* --------internal use-------- */
  91.   unsigned short shift1;     /* Save area for blitter shift value */
  92.   unsigned short shift2;     /* Save area for blitter shift value */
  93.   void *save1;               /* Ptr to 1st background save area */
  94.   void *save2;               /* Ptr to 2nd background save area */
  95.   unsigned int offset1;      /* Screen offset for save area 1 */
  96.   unsigned int offset2;      /* Screen offset for save area 2 */
  97.   unsigned int savsiz;       /* Size of save area (number of bytes) */
  98.   struct blit_struct *image1; /* Ptr to image displayed in area 1 */
  99.   struct blit_struct *image2; /* Ptr to image displayed in area 2 */
  100.   struct anim_struct *collide; /* Ptr to colliding anim */
  101.   struct anim_struct *prev;  /* Ptr to previous anim obj in animation system */
  102.   struct anim_struct *next;  /* Ptr to next anim obj in animation system */
  103.   struct anim_struct *cplx_next; /* Ptr to next anim obj in anim complex */
  104.   struct anim_cplx *cplx;    /* Ptr to anim_cplx that this obj belongs to */
  105.   };
  106.  
  107. /* The anim flags: */
  108.  
  109. #define ANIM_SAVE_BG   0x01000000 /* Flag: save background before blitting image */
  110. #define ANIM_COLLISION 0x02000000 /* Flag: Obj to obj collision detection enable */
  111. #define ANIM_ACTIVE    0x20000000 /* Anim is active in a display system */
  112. #define ANIM_INVISIBLE 0x40000000 /* Flag: made invisible by clear_anim */
  113. #define ANIM_ONSCREEN  0x80000000 /* Anim is displayed on screen */
  114. #define ANIM_CLEAR     0x00010000 /* Flag: if NOT ANIM_SAVE_BG, clear blitter */
  115.                                   /*       image before blitting image */
  116. #define ANIM_COPY      0x00020000 /* Flag: use blit_copy instead of blit_image */
  117. #define ANIM_REVERSE   0x00040000 /* Anim is running in reverse */
  118. #define ANIM_PARENT    0x00080000 /* Flag: Anim is a parent with attached anims */
  119. #define ANIM_MERGE     0x00100000 /* Flag: Merge image data with that on screen */
  120. #define ANIM_FLICKER   0x00200000 /* Flag: Display object only on 1st bitmap */
  121. #define ANIM_COLLISION_BG 0x00400000 /* Flag: Obj to background collision enable */
  122. #define ANIM_IMGCOPY   0x00800000 /* Flag: anim uses copy of images, don't free (internal use) */
  123. #define ANIM_BOUNDS_X1 0x00000100 /* anim obj tried to move past left edge of bounds */
  124. #define ANIM_BOUNDS_Y1 0x00000200 /* anim obj tried to move past top edge of bounds */
  125. #define ANIM_BOUNDS_X2 0x00000400 /* anim obj tried to move past right edge of bounds */
  126. #define ANIM_BOUNDS_Y2 0x00000800 /* anim obj tried to move past bottom edge of bounds */
  127. #define ANIM_CPUBLIT   0x00001000 /* CPU used to blit images in this anim */
  128. #define ANIM_VSPACE    0x00002000 /* object lies in virtual space */
  129. #define ANIM_VCOLLIDE  0x00004000 /* allow object-to-object collisions in virtual space */
  130.  
  131. struct anim_attach            /* undefined until next release */
  132.   {
  133.   int dummy;
  134.   };
  135.  
  136. struct anim_load_struct       /* structure for loading binary anim objects from disk */
  137.   {
  138.   char *filename;             /* pointer to ASCIIZ string of file to load (user defined) */
  139.   union
  140.     {
  141.     struct anim_struct *anim; /* pointer to anim struct if file is a simple anim (filled) */
  142.     struct anim_cplx *cplx;   /* pointer to an anim cplx struct if file is a complex anim (filled) */
  143.     } anim_ptr;
  144.   struct anim_attach *attach; /* ptr to attachment array specification (filled) */
  145.   unsigned long *cmap;        /* pointer to an array of color map entries (filled) */
  146.   int cmap_entries;           /* number of color table entries (filled) */
  147.   int cmap_size;              /* number of bits per color value (4 or 8) (user defined) */
  148.   int type;                   /* type 0 = anim, type 1 = complex anim (filled) */
  149.   int array_elements;         /* size of array to create from loaded object (1 - n) (user defined) */
  150.   unsigned long flags;        /* load flags.  Set ONLY user bits.  Some used by CITAS */
  151.   };
  152.  
  153. /* The user anim load bits */
  154.  
  155. #define ANIMLOAD_NOCOLOR   0x00000001    /* don't load color table */
  156. #define ANIMLOAD_FASTRAM   0x00000002    /* load anim to Fast RAM if available */
  157. #define ANIMLOAD_NOFASTRAM 0x00000004    /* don't use Fast RAM even if flagged in file */
  158. #define ANIMLOAD_LOCKCHECK 0x00000008    /* produce an error return if file NOT locked */
  159.  
  160. /* save area allocation flags */
  161.  
  162. #define SINGLE_BUFF  0x00  /* object will be used in a single buffered display */
  163. #define DOUBLE_BUFF  0x01  /* object will be used in a double buffered display */
  164.  
  165. #endif
  166.