#ifndef GMS_BLIT_H
#define GMS_BLIT_H TRUE

/*
**    $VER: blit.h V0.7B
**
**    Blitter GPI Definitions
**
**    (C) Copyright 1996-1997 DreamWorld Productions.
**        All Rights Reserved
*/

/***************************************************************************
** Bitmap structure, used for blitting.
*/

#define BMVERSION 1

struct Bitmap {
 WORD  ID;             /* ID */
 WORD  Version;        /* Version */
 LONG  Stats;          /* Private */
 APTR  Data;           /* Pointer to bitmap data area */
 WORD  Width;          /* Width */
 WORD  ByteWidth;      /* ByteWidth */
 WORD  Height;         /* Height */
 WORD  ScrType;        /* Screen type */
 WORD  Planes;         /* Amount of planes */
 LONG  LineModulo;     /* Line differential */
 LONG  PlaneModulo;    /* Plane differential */
};

/***************************************************************************
** Bob Structure.
*/

#define BBVERSION 1
#define MBVERSION 1

struct  FrameList {   /* Framelist layout if pointing to bobs */
  WORD  XCoord;       /*  contained in a Picture structure.   */
  WORD  YCoord;
};

struct   Bob {
  WORD   ID;                     /* ID_BOB */
  WORD   Version;                /* Structure version */
  APTR   Stats;                  /* Private */
  APTR   GfxData;                /* Pointer to graphics source */
  APTR   MaskData;               /* Pointer to mask source */
  UWORD  Frame;                  /* Current frame */
  struct FrameList *GfxCoords;   /* Pointer to graphic frame coordinates */
  WORD   SrcWidth;               /* Source Page Width in bytes */
  UWORD  Width;                  /* Width in pixels */
  UWORD  ByteWidth;              /* Width in bytes */
  UWORD  Height;                 /* Height in pixels */
  WORD   XCoord;                 /* To X pixel */
  WORD   YCoord;                 /* To Y pixel */
  UWORD  ClipLX;                 /* Left X border in bytes (0/8) */
  UWORD  ClipTY;                 /* Top Y border (0) */
  UWORD  ClipRX;                 /* Right X border in bytes (320/8) */
  UWORD  ClipBY;                 /* Bottom Y border (256) */
  UWORD  FPlane;                 /* 1st Plane to blit to (planar only) */
  UWORD  Planes;                 /* Amount of planes */
  ULONG  PlaneSize;              /* Size of source plane (planar only) */
  ULONG  Attrib;                 /* Attributes like CLIP and MASK */
  APTR   PictureTags;            /* Pointer to picture tags */
  UWORD  Empty;                  /* Reserved, in use by MBob */
  UWORD  SrcMaskWidth;           /* Mask page width in bytes */
  struct Picture *Picture;       /* Pointer to picture structure */
  ULONG  *DirectGfx;             /* Pointer to direct frame list */
  UWORD  AmtFrames;              /* Amount of frames in frame/direct list */
  struct GameScreen *Screen;     /* Destination GameScreen */
  struct Bitmap *Bitmap;         /* Destination Bitmap */
  UWORD  Buffers;                /* Relevant only to restore mode */
  struct FrameList *MaskCoords;  /* Pointer to mask frame coordinates */
  UWORD  PropWidth;              /* Expected width of source picture */
  UWORD  PropHeight;             /* Expected height of source picture */
  ULONG  *DirectMasks;           /* */
};

#define BBA_GfxData       (8|TAPTR)
#define BBA_MaskData     (12|TAPTR)
#define BBA_Frame        (16|TWORD)
#define BBA_GfxCoords    (18|TAPTR)
#define BBA_SrcWidth     (22|TWORD)
#define BBA_Width        (24|TWORD)
#define BBA_ByteWidth    (26|TWORD)
#define BBA_Height       (28|TWORD)
#define BBA_XCoord       (30|TWORD)
#define BBA_YCoord       (32|TWORD)
#define BBA_ClipLX       (34|TWORD)
#define BBA_ClipTY       (36|TWORD)
#define BBA_ClipRX       (38|TWORD)
#define BBA_ClipBY       (40|TWORD)
#define BBA_FPlane       (42|TWORD)
#define BBA_Planes       (44|TWORD)
#define BBA_PlaneSize    (46|TLONG)
#define BBA_Attrib       (50|TLONG)
#define BBA_PictureTags  (54|TAPTR)
#define BBA_Empty        (58|TWORD)
#define BBA_SrcMaskWidth (60|TWORD)
#define BBA_Picture      (62|TAPTR)
#define BBA_DirectGfx    (66|TAPTR)
#define BBA_AmtFrames    (70|TWORD)
#define BBA_Screen       (72|TAPTR)
#define BBA_Bitmap       (76|TAPTR)
#define BBA_Buffers      (80|TWORD)
#define BBA_MaskCoords   (82|TAPTR)
#define BBA_PropWidth    (86|TWORD)
#define BBA_PropHeight   (88|TWORD)
#define BBA_DirectMasks  (90|TAPTR)

/***********************************************************************************/

struct MBob {
  WORD   ID;                     /* ID_MBOB */
  WORD   Version;                /* Structure version */
  APTR   Stats;                  /* Private */
  APTR   GfxData;                /* Pointer to graphics source */
  APTR   MaskData;               /* Pointer to mask source */
  WORD   AmtEntries;             /* Amount of entries in the list */
  struct FrameList *FrameList;   /* Pointer to frame list */
  WORD   SrcWidth;               /* Source Page Width in bytes */
  WORD   Width;                  /* Width in pixels (optional) */
  WORD   ByteWidth;              /* Width in bytes */
  WORD   Height;                 /* Height in pixels */
  APTR   EntryList;              /* Pointer to entry list */
  WORD   ClipLX;                 /* Left X border */
  WORD   ClipTY;                 /* Top Y border */
  WORD   ClipRX;                 /* Right X border */
  WORD   ClipBY;                 /* Bottom Y border */
  WORD   FPlane;                 /* 1st Plane to blit to (planar only) */
  WORD   Planes;                 /* Amount of planes */
  LONG   PlaneSize;              /* Size of source plane (planar only) */
  LONG   Attrib;                 /* Attributes like CLIP and MASK */
  APTR   PictureTags;            /* Pointer to picture tags (optional) */
  WORD   EntrySize;              /* Entry size (sizeof(struct MBEntry)) */
  WORD   SrcMaskWidth;           /* Mask page width in bytes */
  struct Picture *Picture;       /* Pointer to picture structure */
  LONG   *DirectGfx;             /* Pointer to direct frame list */
  WORD   AmtFrames;              /* Amount of frames in frame/direct list */
  struct GameScreen *Screen;     /* The MBob's GameScreen */
  struct Bitmap *Bitmap;         /* The MBob's Bitmap */
  WORD   Buffers;                /* */
  struct FrameList *MaskCoords;  /* */
  WORD   PropWidth;              /* Expected width of source picture */
  WORD   PropHeight;             /* Expected height of source picture */
  LONG   *DirectMasks;           /* */
};

#define MBA_GfxData       (8|TAPTR)
#define MBA_MaskData     (12|TAPTR)
#define MBA_AmtEntries   (16|TWORD)
#define MBA_FrameList    (18|TAPTR)
#define MBA_SrcWidth     (22|TWORD)
#define MBA_Width        (24|TWORD)
#define MBA_ByteWidth    (26|TWORD)
#define MBA_Height       (28|TWORD)
#define MBA_EntryList    (30|TWORD)
#define MBA_ClipLX       (34|TWORD)
#define MBA_ClipTY       (36|TWORD)
#define MBA_ClipRX       (38|TWORD)
#define MBA_ClipBY       (40|TWORD)
#define MBA_FPlane       (42|TWORD)
#define MBA_Planes       (44|TWORD)
#define MBA_PlaneSize    (46|TLONG)
#define MBA_Attrib       (50|TLONG)
#define MBA_PictureTags  (54|TAPTR)
#define MBA_EntrySize    (58|TWORD)
#define MBA_SrcMaskWidth (60|TWORD)
#define MBA_Picture      (62|TAPTR)
#define MBA_DirectList   (66|TAPTR)
#define MBA_AmtFrames    (70|TWORD)
#define MBA_Screen       (72|TAPTR)
#define MBA_Bitmap       (76|TAPTR)
#define MBA_Buffers      (80|TWORD)
#define MBA_MaskCoords   (82|TAPTR)
#define MBA_PropWidth    (86|TWORD)
#define MBA_PropHeight   (88|TWORD)
#define MBA_DirectMasks  (90|TAPTR)

struct  MBEntry {        /* MBOB Entry Structure */
  WORD   XCoord;
  WORD   YCoord;
  UWORD  Frame;
};

#define MBE_SIZEOF sizeof(struct BobEntry)

/* Bob Attributes (Bob.Attrib) */

#define CLIP      0x00000001 /* Allow border clipping */
#define MASK      0x00000002 /* Allow masking */
#define STILL     0x00000004 /* This bob is not moving */
#define CLEAR     0x00000008 /* Allow automatic clearing */
#define RESTORE   0x00000010 /* Allow automatic background restore */
/*#define           0x00000020    Using direct graphics and mask pointers */
#define FILLMASK  0x00000040 /* Fill any holes in the mask on generation */
#define GENONLY   0x00000080 /* Create masks but do not use them yet */
#define GENMASKS  0x00000082 /* Create and use masks for drawing this bob */
#define CLRMASK   0x00000100 /* Use masks when clearing */
#define CLRNOMASK 0x00000000 /* Do not use masks when clearing (default) */

#define GENMASK GENMASKS /* Synonym */

#define SKIPIMAGE 32000

/****************************************************************************
** Pixel list structures.
*/

struct PixelEntry {
  WORD  XCoord;
  WORD  YCoord;
  LONG  Colour;
};

struct PixelList {
  UWORD  Entries;
  UWORD  EntrySize;
  struct PixelEntry *EntryList;
};

#define SKIPPIXEL -32000
#define PIXELLIST(a)

/****************************************************************************
** Map structure
*/

#define MPVERSION 1

struct Map {
  WORD  ID;                /* ID_MAP */
  WORD  Version;           /* The structure version, MPV1 */
  LONG  Stats;             /* Private */
  WORD  Buffer;            /* Destination buffer */
  WORD  Number;            /* Map number to access for data */
  APTR  MapList;           /* Pointer to the map datalist */
  WORD  Width;             /* Total width of map */
  WORD  Height;            /* Total height of map */
  WORD  XStart;            /* Get block data starting from X [byte] */
  WORD  YStart;            /* Get block data starting from Y */
  WORD  EntrySize;         /* Byte/Word/Long */
  LONG  EntryMask;         /* For special cases */
  WORD  TileWidth;         /* The width/8 of each tile (bytes) */
  WORD  TileHeight;        /* The height of each tile */
  WORD  Options;           /* Applicable Map options, eg LOCKED */
  struct Picture *Picture; /* Points to the map's graphics picture */
  char  *File;             /* Where to get the map data */
};

#define LOCKED      0x0001 /* Blocks are blitted on 16 pixel boundaries  */
#define ESIZE_BYTE  1      /* Entry size is in bytes */
#define ESIZE_WORD  2      /* Entry size is in words */
#define ESIZE_LONG  3      /* Entry size is in longs */

#endif
