home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / graphics / gels.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  9.0 KB  |  265 lines

  1. #ifndef GRAPHICS_GELS_H
  2. #define GRAPHICS_GELS_H
  3. /*
  4. **    $Filename: graphics/gels.h $
  5. **    $Release: 1.3 $
  6. **
  7. **    include file for AMIGA GELS (Graphics Elements) 
  8. **
  9. **    (C) Copyright 1985,1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. /* VSprite flags */
  14. /* user-set VSprite flags: */
  15. #define SUSERFLAGS  0x00FF    /* mask of all user-settable VSprite-flags */
  16. #define VSPRITE        0x0001    /* set if VSprite, clear if Bob */
  17. #define SAVEBACK    0x0002    /* set if background is to be saved/restored */
  18. #define OVERLAY        0x0004    /* set to mask image of Bob onto background */
  19. #define MUSTDRAW    0x0008    /* set if VSprite absolutely must be drawn */
  20. /* system-set VSprite flags: */
  21. #define BACKSAVED   0x0100    /* this Bob's background has been saved */
  22. #define BOBUPDATE   0x0200    /* temporary flag, useless to outside world */
  23. #define GELGONE        0x0400    /* set if gel is completely clipped (offscreen) */
  24. #define VSOVERFLOW  0x0800    /* VSprite overflow (if MUSTDRAW set we draw!) */
  25.  
  26. /* Bob flags */
  27. /* these are the user flag bits */
  28. #define BUSERFLAGS  0x00FF    /* mask of all user-settable Bob-flags */
  29. #define SAVEBOB        0x0001    /* set to not erase Bob */
  30. #define BOBISCOMP   0x0002    /* set to identify Bob as AnimComp */
  31. /* these are the system flag bits */
  32. #define BWAITING    0x0100    /* set while Bob is waiting on 'after' */
  33. #define BDRAWN        0x0200    /* set when Bob is drawn this DrawG pass*/
  34. #define BOBSAWAY    0x0400    /* set to initiate removal of Bob */
  35. #define BOBNIX        0x0800    /* set when Bob is completely removed */
  36. #define SAVEPRESERVE 0x1000   /* for back-restore during double-buffer*/
  37. #define OUTSTEP        0x2000    /* for double-clearing if double-buffer */
  38.  
  39. /* defines for the animation procedures */
  40. #define ANFRACSIZE  6
  41. #define ANIMHALF    0x0020
  42. #define RINGTRIGGER 0x0001
  43.  
  44.  
  45. /* UserStuff definitions
  46.  *  the user can define these to be a single variable or a sub-structure
  47.  *  if undefined by the user, the system turns these into innocuous variables
  48.  *  see the manual for a thorough definition of the UserStuff definitions
  49.  *
  50.  */
  51. #ifndef VUserStuff          /* VSprite user stuff */
  52. #define VUserStuff SHORT
  53. #endif
  54.  
  55. #ifndef BUserStuff          /* Bob user stuff */
  56. #define BUserStuff SHORT
  57. #endif
  58.  
  59. #ifndef AUserStuff          /* AnimOb user stuff */
  60. #define AUserStuff SHORT
  61. #endif
  62.  
  63.  
  64.  
  65.  
  66. /*********************** GEL STRUCTURES ***********************************/
  67.  
  68. struct VSprite
  69. {
  70. /* --------------------- SYSTEM VARIABLES ------------------------------- */
  71. /* GEL linked list forward/backward pointers sorted by y,x value */
  72.     struct VSprite   *NextVSprite;
  73.     struct VSprite   *PrevVSprite;
  74.  
  75. /* GEL draw list constructed in the order the Bobs are actually drawn, then
  76.  *  list is copied to clear list
  77.  *  must be here in VSprite for system boundary detection
  78.  */
  79.     struct VSprite   *DrawPath;        /* pointer of overlay drawing */
  80.     struct VSprite   *ClearPath;    /* pointer for overlay clearing */
  81.  
  82. /* the VSprite positions are defined in (y,x) order to make sorting
  83.  *  sorting easier, since (y,x) as a long integer
  84.  */
  85.     WORD OldY, OldX;          /* previous position */
  86.  
  87. /* --------------------- COMMON VARIABLES --------------------------------- */
  88.     WORD Flags;              /* VSprite flags */
  89.  
  90.  
  91. /* --------------------- USER VARIABLES ----------------------------------- */
  92. /* the VSprite positions are defined in (y,x) order to make sorting
  93.  *  sorting easier, since (y,x) as a long integer
  94.  */
  95.     WORD Y, X;              /* screen position */
  96.  
  97.     WORD Height;
  98.     WORD Width;              /* number of words per row of image data */
  99.     WORD Depth;              /* number of planes of data */
  100.  
  101.     WORD MeMask;          /* which types can collide with this VSprite*/
  102.     WORD HitMask;          /* which types this VSprite can collide with*/
  103.  
  104.     WORD *ImageData;          /* pointer to VSprite image */
  105.  
  106. /* borderLine is the one-dimensional logical OR of all
  107.  *  the VSprite bits, used for fast collision detection of edge
  108.  */
  109.     WORD *BorderLine;          /* logical OR of all VSprite bits */
  110.     WORD *CollMask;          /* similar to above except this is a matrix */
  111.  
  112. /* pointer to this VSprite's color definitions (not used by Bobs) */
  113.     WORD *SprColors;
  114.  
  115.     struct Bob *VSBob;          /* points home if this VSprite is part of 
  116.                    a Bob */
  117.  
  118. /* planePick flag:  set bit selects a plane from image, clear bit selects
  119.  *  use of shadow mask for that plane
  120.  * OnOff flag: if using shadow mask to fill plane, this bit (corresponding
  121.  *  to bit in planePick) describes whether to fill with 0's or 1's
  122.  * There are two uses for these flags:
  123.  *    - if this is the VSprite of a Bob, these flags describe how the Bob
  124.  *      is to be drawn into memory
  125.  *    - if this is a simple VSprite and the user intends on setting the
  126.  *      MUSTDRAW flag of the VSprite, these flags must be set too to describe
  127.  *      which color registers the user wants for the image
  128.  */
  129.     BYTE PlanePick;
  130.     BYTE PlaneOnOff;
  131.  
  132.     VUserStuff VUserExt;      /* user definable:  see note above */
  133. };
  134.  
  135. struct Bob
  136. /* blitter-objects */
  137. {
  138. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  139.  
  140. /* --------------------- COMMON VARIABLES --------------------------------- */
  141.     WORD Flags;        /* general purpose flags (see definitions below) */
  142.  
  143. /* --------------------- USER VARIABLES ----------------------------------- */
  144.     WORD *SaveBuffer;    /* pointer to the buffer for background save */
  145.  
  146. /* used by Bobs for "cookie-cutting" and multi-plane masking */
  147.     WORD *ImageShadow;
  148.  
  149. /* pointer to BOBs for sequenced drawing of Bobs
  150.  *  for correct overlaying of multiple component animations
  151.  */
  152.     struct Bob *Before; /* draw this Bob before Bob pointed to by before */
  153.     struct Bob *After;    /* draw this Bob after Bob pointed to by after */
  154.  
  155.     struct VSprite   *BobVSprite;   /* this Bob's VSprite definition */
  156.  
  157.     struct AnimComp  *BobComp;        /* pointer to this Bob's AnimComp def */
  158.  
  159.     struct DBufPacket *DBuffer;        /* pointer to this Bob's dBuf packet */
  160.  
  161.     BUserStuff BUserExt;        /* Bob user extension */
  162. };
  163.  
  164. struct AnimComp
  165. {
  166. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  167.  
  168. /* --------------------- COMMON VARIABLES --------------------------------- */
  169.     WORD Flags;                /* AnimComp flags for system & user */
  170.  
  171. /* timer defines how long to keep this component active:
  172.  *  if set non-zero, timer decrements to zero then switches to nextSeq
  173.  *  if set to zero, AnimComp never switches
  174.  */
  175.     WORD Timer;
  176.  
  177. /* --------------------- USER VARIABLES ----------------------------------- */
  178. /* initial value for timer when the AnimComp is activated by the system */
  179.     WORD TimeSet;
  180.  
  181. /* pointer to next and previous components of animation object */
  182.     struct AnimComp  *NextComp;
  183.     struct AnimComp  *PrevComp;
  184.  
  185. /* pointer to component component definition of next image in sequence */
  186.     struct AnimComp  *NextSeq;
  187.     struct AnimComp  *PrevSeq;
  188.  
  189.     WORD (*AnimCRoutine)(); /* address of special animation procedure */
  190.  
  191.     WORD YTrans;     /* initial y translation (if this is a component) */
  192.     WORD XTrans;     /* initial x translation (if this is a component) */
  193.  
  194.     struct AnimOb    *HeadOb;
  195.  
  196.     struct Bob         *AnimBob;
  197. };
  198.  
  199. struct AnimOb
  200. {
  201. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  202.     struct AnimOb    *NextOb, *PrevOb;
  203.  
  204. /* number of calls to Animate this AnimOb has endured */
  205.     LONG Clock;
  206.  
  207.     WORD AnOldY, AnOldX;        /* old y,x coordinates */
  208.  
  209. /* --------------------- COMMON VARIABLES --------------------------------- */
  210.     WORD AnY, AnX;            /* y,x coordinates of the AnimOb */
  211.  
  212. /* --------------------- USER VARIABLES ----------------------------------- */
  213.     WORD YVel, XVel;            /* velocities of this object */
  214.     WORD YAccel, XAccel;        /* accelerations of this object */
  215.  
  216.     WORD RingYTrans, RingXTrans;    /* ring translation values */
  217.  
  218.     WORD (*AnimORoutine)();        /* address of special animation 
  219.                        procedure */
  220.  
  221.     struct AnimComp  *HeadComp;        /* pointer to first component */
  222.  
  223.     AUserStuff AUserExt;        /* AnimOb user extension */
  224. };
  225.  
  226. /* dBufPacket defines the values needed to be saved across buffer to buffer
  227.  *  when in double-buffer mode
  228.  */
  229. struct DBufPacket
  230. {
  231.     WORD BufY, BufX;            /* save other buffers screen coordinates */
  232.     struct VSprite   *BufPath;        /* carry the draw path over the gap */
  233.  
  234. /* these pointers must be filled in by the user */
  235. /* pointer to other buffer's background save buffer */
  236.     WORD *BufBuffer;
  237. };
  238.  
  239.  
  240.  
  241. /* ************************************************************************ */
  242.  
  243. /* these are GEL functions that are currently simple enough to exist as a
  244.  *  definition.     It should not be assumed that this will always be the case
  245.  */
  246. #define InitAnimate(animKey) {*(animKey) = NULL;}
  247. #define RemBob(b) {(b)->Flags |= BOBSAWAY;}
  248.  
  249.  
  250. /* ************************************************************************ */
  251.  
  252. #define B2NORM        0
  253. #define B2SWAP        1
  254. #define B2BOBBER    2
  255.  
  256. /* ************************************************************************ */
  257.  
  258. /* a structure to contain the 16 collision procedure addresses */
  259. struct collTable
  260. {
  261.     int (*collPtrs[16])();
  262. };
  263.  
  264. #endif    /* GRAPHICS_GELS_H */
  265.