#ifndef GMS_SCREENS_H
#define GMS_SCREENS_H TRUE

/*
**    $VER: screens.h V0.7B
**
**    GMS Screen Definitions
**
**    (C) Copyright 1996-1997 DreamWorld Productions.
**        All Rights Reserved
*/

/****************************************************************************
** Standard screen structure
*/

#define GSVERSION 1

struct GameScreen {
  WORD ID;            /* ID_GAMESCREEN */
  WORD Version;       /* Version */
  APTR Stats;         /* Private */
  APTR MemPtr1;       /* Ptr to screen 1 */
  APTR MemPtr2;       /* Ptr to screen 2 (double buffer) */
  APTR MemPtr3;       /* Ptr to screen 3 (triple buffer) */
  APTR Screenlink;    /* Ptr to a linked screen */
  APTR Palette;       /* Ptr to the screen palette */
  APTR Rasterlist;    /* Ptr to a rasterlist */
  LONG AmtColours;    /* The amount of colours in the palette */
  WORD ScrWidth;      /* The width of the visible screen */
  WORD ScrHeight;     /* The height of the visible screen */
  WORD PicWidth;      /* The width of the picture (pixels) */
  WORD PicByteWidth;  /* The width of the picture (bytes) READ ONLY */
  WORD PicHeight;     /* The height of the entire screen */
  WORD Planes;        /* The amount of planes in da screen */
  WORD ScrXOffset;    /* Hardware co-ordinate for TOS */
  WORD ScrYOffset;    /* Hardware co-ordinate for LOS */
  WORD PicXOffset;    /* Offset of the horizontal axis */
  WORD PicYOffset;    /* Offset of the vertical axis */
  LONG Attrib;        /* Special Attributes are? */
  WORD ScrMode;       /* What screen mode is it? */
  WORD ScrType;       /* Interleaved/Planar/Chunky? */
  APTR Task;          /* R: Task that owns this screen */
  LONG PlaneSize;     /* R: Size of a plane (bytewidth*height) */
  struct Bitmap *Bitmap;
};

/* Screen Buffer names, these are asked for in the blitter functions */

#define BUFFER1  8
#define BUFFER2  12
#define BUFFER3  16

/* SCREEN ATTRIBUTES (Attrib) */

#define DBLBUFFER  0x00000001   /* For double buffering */
#define TPLBUFFER  0x00000002   /* Triple buffering!! */
#define PLAYFIELD  0x00000004   /* Set if it's part of a playfield */
#define HSCROLL    0x00000008   /* Gotta set this to do scrolling */
#define VSCROLL    0x00000010   /* For vertical scrolling */
#define SPRITES    0x00000020   /* Set this if you want sprites */
#define SBUFFER    0x00000040   /* Create a buffer for horiz scrolling */
#define CENTRE     0x00000080   /* Centre the screen (sets XOffset/YOffset) */
#define BLKBDR     0x00000100   /* Gives a blackborder on AGA machines */
#define NOSCRBDR   0x00000200   /* For putting sprites in the border */

/* SCREEN TYPES (ScrType) */

#define INTERLEAVED  1              /* These are numbers, not bits */
#define ILBM         1
#define PLANAR       2
#define CHUNKY8      3
#define CHUNKY16     4
#define TRUECOLOUR   5

/* SCREEN MODES (ScrMode) */

#define HIRES      0x0001       /* High resolution */
#define SHIRES     0x0002       /* Super-High resolution */
#define LACED      0x0004       /* Interlaced */
#define LORES      0x0008       /* Low resolution (default) */
#define EXTRAHB    0x0010       /* Extra Half-Brite */
#define SLACED     0x0020       /* Super-Laced resolution */
#define HAM        0x0040       /* For HAM mode */

/* Screen Attribute tags */

#define GSA_MemPtr1       (8|TAPTR)
#define GSA_MemPtr2      (12|TAPTR)
#define GSA_MemPtr3      (16|TAPTR)
#define GSA_Screenlink   (20|TAPTR)
#define GSA_Palette      (24|TAPTR)
#define GSA_Rasterlist   (28|TAPTR)
#define GSA_AmtColours   (32|TLONG)
#define GSA_ScrWidth     (36|TWORD)
#define GSA_ScrHeight    (38|TWORD)
#define GSA_PicWidth     (40|TWORD)
#define GSA_PicByteWidth (42|TWORD)
#define GSA_PicHeight    (44|TWORD)
#define GSA_Planes       (46|TWORD)
#define GSA_ScrXOffset   (48|TWORD)
#define GSA_ScrYOffset   (50|TWORD)
#define GSA_PicXOffset   (52|TWORD)
#define GSA_PicYOffset   (54|TWORD)
#define GSA_Attrib       (56|TLONG)
#define GSA_ScrMode      (60|TWORD)
#define GSA_ScrType      (62|TWORD)

/****************************************************************************
**                 Raster/Copper commands for RasterLists.
**
**     Example of initialising a colourlist:
**
**     LONG RasterList[] = {
**          COLOURLIST(0,1,0,&Colourlist),
**          RASTEND
**     };
**
** COLOUR     (ColourNumber,0xRRGGBB)
** COLOURLIST (StartLine,SKip,Colour,&Colourlist)
** SPRITE     (Sprite)
** SCROLL     (Fields,PixelOffset0-16,PixelQuarterOffset 1-4)
** FLOOD      ()
** REPOINT    (&BitplanePtr)
** MIRROR     ()
** NEWPALETTE (ColStart,AmtCols,&Palette)
** WAITLINE   (Line)
** RASTEND    ()
**
** Warn: With colour related commands you must use the same amount of colour
** bits as specified in your GameScreen structure (COL12BIT or COL24BIT)
*/

#define WAITLINE(a)         (00<<16)|(a),0
#define COLOUR(a,b)         (02<<16),(a),(b),0
#define NEWPALETTE(a,b,c)   (04<<16),(a),(b),(LONG)(c),0
#define COLOURLIST(a,b,c,d) (06<<16)|(a),(b<<16)|(c),(LONG)(d),0
#define SPRITE(a)           (08<<16),(a),0
#define SCROLL(a,b,c)       (10<<16)|(a),(b<<16)|(c),0
#define FSCROLL(a,b,c,d)    (12<<16)|(a),(b<<16)|(c),(d<<16),0
#define FLOOD               (14<<16),0
#define REPOINT(a)          (16<<16),(LONG)(a),0
#define MIRROR              (18<<16),0
#define RASTEND             0xffffffff

/***************************************************************************
** Sprite Structure.
*/

#define SPVERSION 1

struct Sprite {
  WORD ID;          /* ID_SPRITE */
  WORD Version;     /* Version */
  APTR Stats;       /* Private */
  WORD Number;      /* Bank number to access */
  APTR Data;        /* Pointer to Sprite graphic */
  WORD XPos;        /* X position */
  WORD YPos;        /* Y position */
  WORD Frame;       /* Frame number */
  WORD Width;       /* Width in pixels */
  WORD Height;      /* Height in pixels */
  WORD AmtColours;  /* 4 or 16 */
  WORD ColStart;    /* Colour bank to access, increments of 16 */
  WORD Planes;      /* Amount of planes per bank */
  WORD ScrMode;     /* HiRes/LoRes/SHiRes */
  WORD FieldPri;    /* Field position in relation to playfields */
  WORD Attrib;      /* Attributes (XLONG) */
};

#define SPA_Number     (8|TWORD)
#define SPA_Data       (10|TAPTR)
#define SPA_XCoord     (14|TWORD)
#define SPA_YCoord     (16|TWORD)
#define SPA_Frame      (18|TWORD)
#define SPA_Width      (20|TWORD)
#define SPA_Height     (22|TWORD)
#define SPA_AmtColours (24|TWORD)
#define SPA_ColStart   (26|TWORD)
#define SPA_Planes     (28|TWORD)
#define SPA_ScrMode    (30|TWORD)
#define SPA_FieldPri   (32|TWORD)
#define SPA_Attrib     (34|TWORD)

#define XLONG   0x0001

#endif
