	IFND GMS_GAMES_I
GMS_GAMES_I  SET  1

**
**	$VER: games.i 0.4 (28.10.96)
**	Includes Release xx.xx
**
**	(C) Copyright 1996 DreamWorld Productions.
**	    All Rights Reserved
**

	IFND    EXEC_TYPES_I
	include 'exec/types.i'
	ENDC

	IFND    GMS_SOUND_I
	include 'games/sound.i'
	ENDC

	IFND    GMS_MISC_I
	include 'games/misc.i'
	ENDC

	IFND    GMS_IMAGE_I
	include 'games/image.i'
	ENDC

LISTSTART =	"LIST"      ;Used to indicate a list start.
SKIPENTRY =	0           ;Use this to skip to the next entry.
ENDLIST =	-1          ;Either one of these will terminate
LISTEND =	-1          ;  a list.
TAGEND  =	0

*****************************************************************************
* Universal errorcodes returned by certain functions.

ERR_OK    =    0            ;Function went OK.
ERR_NOMEM =    1            ;Not enough memory available.
ERR_NOPTR =    2            ;Relevant address pointer not present.
ERR_INUSE =    3            ;Previous allocations have not been freed.
ERR_STRUCT =   4            ;Structure version not supported/not found.
ERR_FAILED =   5            ;General/Miscellaneous failure.
ERR_FILE =     6            ;File error, eg file not found, disk full etc.
ERR_DATA =     7            ;There is an error in the given data.
ERR_SEARCH =   8            ;An internal search was performed and it failed.

*****************************************************************************
* Universal JoyBits returned from Read_JoyStick, Sega, JoyPad, etc...

JT_SWITCH =	0
JT_ZBXY =	1

JS_LEFT	=	0           ;X axis
JS_RIGHT =	1
JS_UP =		2           ;Y axis
JS_DOWN	=	3
JS_ZIN =	4           ;Z axis!  Reserved for later...
JS_ZOUT =	5
JS_FIRE1 =	6           ;Standard Fire Button (1).
JS_FIRE2 =	7           ;Standard Fire Button (2).
JS_FIRE3 =	11          ;Standard Fire Button (3).

JS_RED =	6           ;CD32 Fire button (1).
JS_BLUE =	7           ;CD32 Fire button (2).
JS_PLAY =	8           ;Other CD32 buttons here.
JS_RWD =	9
JS_FFW =	10
JS_GREEN =	11          ;CD32 Fire button (3).
JS_YELLOW =	12

;Bits for the ZBXY style return type (analogue joysticks)           

JB_FIRE1 =	16
JB_FIRE2 =	17
JB_FIRE3 =	18

MB_LMB	=	16
MB_RMB	=	17
MB_MMB	=	18

;Joyport names for calling Read_JoyStick/Mouse/JoyPad...()

JPORT1	=	0*2
JPORT2	=	1*2
JPORT3	=	2*2         ;Works for Read_JoyStick() only.
JPORT4	=	3*2         ;Works for Read_JoyStick() only.

*****************************************************************************
* GPI ID numbers.

GPI_SCREENS =	0
GPI_BLITTER =	4
GPI_SOUND =	8
GPI_NETWORK =	12
GPI_VECTORS =	16
GPI_DEBUG =	20
GPI_ANIM =	24
GPI_REKO =	28
GPI_TEXT =	32

*****************************************************************************
* Standard screen structure.

GSV1 =	("GS"<<16)|00

    STRUCTURE	GameScreen,0
	ULONG	GS_VERSION        ;Version, GSV1.
	APTR	GS_Stats          ;Reserved.
	APTR	GS_MemPtr1        ;Ptr to screen 1
	APTR	GS_MemPtr2        ;Ptr to screen 2 (doubled buffer)
	APTR	GS_MemPtr3        ;Ptr to screen 3 (tripled buffer)
	APTR	GS_ScreenLink     ;Ptr to a linked screen.
	APTR	GS_Palette        ;Ptr to the screen palette.
	APTR	GS_RasterList     ;Ptr to a raster list (or not).
	ULONG	GS_AmtColours     ;The amount of colours on screen.
	UWORD	GS_ScrWidth       ;The width of the visible screen window.
	UWORD	GS_ScrHeight      ;The height of the visible screen window.
	UWORD	GS_PicWidth       ;The width of the complete screen/picture.
	UWORD	GS_PicHeight      ;The height of the complete screen/picture.
	UWORD	GS_Planes         ;The amount of planes in the screen.
	WORD	GS_ScrXOffset     ;Hardware co-ordinate for TOS.
	WORD	GS_ScrYOffset     ;Hardware co-ordinate for LOS.
	WORD	GS_PicXOffset     ;Offset of the horizontal axis.
	WORD	GS_PicYOffset     ;Offset of the vertical axis.
	ULONG	GS_ScrAttrib      ;Special Attributes are?
	UWORD	GS_ScrMode        ;What screen mode is it?
	UBYTE	GS_ScrType        ;Interleaved/Planar/Chunky?
	UBYTE	GS_Displayed      ;Reserved.
	LABEL	GSV1_SIZEOF

;Screen Buffer names, these are asked for in the blitter functions.

BUFFER1 = GS_MemPtr1
BUFFER2 = GS_MemPtr2
BUFFER3 = GS_MemPtr3

;Screen types (flags for SS_ScrType).

INTERLEAVED =	1	;Interleaved (2 -> 256 colours)
PLANAR =	2	;Planar (2 -> 256 colours)
CHUNKY =	3	;Chunky (256 colours)
CHUNKY2 =	4	;Chunky (32767 colours)
TRUECOLOUR =	5	;True colour (16 million colours)

;---------------------------------------------------------------------------;
;Screen attributes (flags and bits for SS_ScrAttrib).

DBLBUFFER =	$00000001         ;For double buffering.
TPLBUFFER =	$00000002         ;Triple buffering!!
PLAYFIELD =	$00000004         ;Set if it's part of a playfield.
HSCROLL =	$00000008         ;Gotta set this to do scrolling.
VSCROLL =	$00000010         ;For vertical scrolling.
SPRITES =	$00000020         ;Set this if you want sprites.
HBUFFER =	$00000040         ;Create a scroll buffer for up to 100 screens.
; =		$00000080
BLKBDR =	$00000100         ;Gives a blackborder on AGA machines.
NOSPRBDR =	$00000200         ;For putting sprites in the border.

B_DBLBUFFER =	0
B_TPLBUFFER =	1
B_PLAYFIELD =	2
B_HSCROLL =	3
B_VSCROLL =	4
B_SPRITES =	5
B_HBUFFER =	6
B_BLKBDR =	8
B_BDRSPRITES =	9

;---------------------------------------------------------------------------;
;Screen modes (flags for SS_ScrMode).

LORES =		$0000             ;Low resolution (default).
HIRES =		$0001             ;High resolution.
SHIRES =	$0002             ;Super-High resolution.
INTERLACED =	$0004             ;Interlaced.
; =		$0008
EXTRAHB =	$0010             ;Set for extra half-brite.
; =		$0020
HAM =		$0040             ;For HAM mode.
COL12BIT =	$0080             ;12 bit colour.
COL24BIT =	$0000             ;24 bit colour (default).

B_HIRES =	0
B_SHIRES =	1
B_INTERLACED =	2
B_EXTRAHB =	4
B_HAM =		6
B_COL12BIT =	7
B_COL24BIT =	7

;---------------------------------------------------------------------------;
;Screen Attribute tags.

TBYTE =	0
TWORD =	1<<30
TLONG =	1<<31

GSA_VERSION =	 GS_VERSION|TLONG
GSA_MemPtr1 =    GS_MemPtr1|TLONG
GSA_MemPtr2 =    GS_MemPtr2|TLONG
GSA_MemPtr3 =    GS_MemPtr3|TLONG
GSA_ScreenLink = GS_ScreenLink|TLONG
GSA_Palette =    GS_Palette|TLONG
GSA_RasterList = GS_RasterList|TLONG
GSA_AmtColours = GS_AmtColours|TLONG
GSA_ScrWidth =   GS_ScrWidth|TWORD
GSA_ScrHeight =  GS_ScrHeight|TWORD
GSA_PicWidth =   GS_PicWidth|TWORD
GSA_PicHeight =  GS_PicHeight|TWORD
GSA_Planes =     GS_Planes|TWORD
GSA_ScrXOffset = GS_ScrXOffset|TWORD
GSA_ScrYOffset = GS_ScrYOffset|TWORD
GSA_PicXOffset = GS_PicXOffset|TWORD
GSA_PicYOffset = GS_PicYOffset|TWORD
GSA_ScrAttrib =  GS_ScrAttrib|TLONG
GSA_ScrMode =    GS_ScrMode|TWORD
GSA_ScrType =    GS_ScrType|TBYTE

*****************************************************************************
*
* Raster/Copper commands for RasterLists.
*
* Examples of how to use these commands/macros in a rasterlist:
*
* COL12      <ColourNumber>,<$0RGB>
* COL24      <ColourNumber>,<$00RRGGBB>
* COL12LIST  <StartLine>,<Skip>,<Colour>,<ColourList>
* COL24LIST  <StartLine>,<SKip>,<Colour>,<ColourList>
* SPRITE     <SpriteStruct>
* SCROLL     <Fields>,<PixelOffset 0-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)

COL12Len =	12             ;COL12,Colour,RGB
COL24Len =	16             ;COL24,Colour,RRGGBB
COL12LISTLen =	16             ;COL12LIST,Line,Skip,Colour,RGB
COL24LISTLen =	16             ;COL24LIST,Line,Skip,Colour,RRGGBB
SPRITELen =	12             ;SPRITE,SpriteStruct
SCROLLLen =	8              ;SCROLL,Offset
FSCROLLLen =	16             ;FSCROLL,Offset
FLOODLen =	8              ;FLOOD
REPOINTLen =	12             ;REPOINT,BitPtr
MIRRORLen =	8              ;MIRROR
NEWPALETTELen = 20             ;NEWPALETTE,ColStart,AmtCols,Palette
WAITLINELen =	8              ;WAITLINE,Line

COL12	MACRO   ;<ColourNumber>,<$RGB>
	dc.w	00,\1,\2,0
	dc.l	0
	ENDM

COL24	MACRO   ;<ColourNumber>,<$RRGGBB>
	dc.w	02,0
	dc.l	\1
	dc.l	\2
	dc.l	0
	ENDM

COL12LIST MACRO	;<Line> <Skip> <Colour> <ColourList>
	dc.w	04,\1,\2,\3
	dc.l	\4
	dc.l	0
	ENDM

COL24LIST MACRO	;<Line> <Skip> <Colour> <ColourList>
	dc.w	06,\1,\2,\3
	dc.l	\4
	dc.l	0
	ENDM

SPRITE	MACRO   ;<SpriteStruct>
	dc.w	08,0
	dc.l	\1
	dc.l	0
	ENDM

SCROLL	MACRO   ;<Fields>,<PixelOffset (0..16)>
	dc.w	10,\1,\2,\3
	dc.l	0
	ENDM

FSCROLL	MACRO   ;<Fields>,<PixelOffset (0..16)>,<(0..4)>
	dc.w	12,\1,\2,\3,\4,0
	dc.l	0
	ENDM

FLOOD	MACRO	;<>
	dc.w	14,0
	dc.l	0
	ENDM

REPOINT	MACRO   ;<BitplanePtr>
	dc.w	16,0
	dc.l	\2
	dc.l	0
	ENDM

MIRROR	MACRO	;<>
	dc.w	18,0
	dc.l	0
	ENDM

NEWPALETTE MACRO ;<ColStart>,<AmtCols>,<Palette>
	dc.w	20,0
	dc.l	\1
	dc.l	\2
	dc.l	\3
	dc.l	0
	ENDM

WAITLINE MACRO	;<Line>
	dc.w	22,\1
	dc.l	0
	ENDM

RASTEND	MACRO
	dc.l	-1
	ENDM

*****************************************************************************
* Sprite structure

SPV1 =	("SP"<<16)|00

    STRUCTURE	Sprite,0
	ULONG	SPR_VERSION       ;Structure version, SPV1.
	APTR	SPR_Stats         ;Reserved.
	UWORD	SPR_Number        ;Sprite bank number.
	APTR	SPR_Data          ;Pointer to Sprite graphic.
	WORD	SPR_XPos          ;X position (screen relative).
	WORD	SPR_YPos          ;Y position (screen relative).
	UWORD	SPR_Frame         ;Current frame number.
	UWORD	SPR_Width         ;Width in pixels.
	UWORD	SPR_Height        ;Height in pixels.
	UWORD	SPR_AmtColours    ;4/16
	UWORD	SPR_ColStart      ;000/016/032/064/096/128/160/192/224
	UWORD	SPR_Planes        ;2/4
	UWORD	SPR_ScrMode       ;HIRES/LORES/SHIRES/XLONG
	UWORD	SPR_FieldPri      ;Playfield position/priority.
	UWORD	SPR_Attrib        ;Sprite attributes.
	LABEL	SPV1_SIZEOF

;Extra stuff for the SPR_Resolution field.

XLONG =    $0001                  ;Double the width (uses extra bank). 

*****************************************************************************
* BOB structure for BBV1, also used as a skeleton for BMV1.

BBV1 =	("BB"<<16)|00

    STRUCTURE	BOB,0
	ULONG	BOB_VERSION       ;Structure version, BBV1.
	APTR	BOB_Stats         ;Private.
	UWORD	BOB_Buffer        ;Buffer1/Buffer2/Buffer3
	APTR	BOB_GfxData       ;Pointer to BOB graphics.
	APTR	BOB_MaskData      ;Pointer to BOB masks.
	UWORD	BOB_Frame         ;Current frame.
	APTR	BOB_FrameList     ;Pointer to frame list.
	WORD	BOB_SrcWidth      ;Source Page Width in bytes.
	UWORD	BOB_Width         ;Width in bytes.
	UWORD	BOB_Height        ;Height in pixels.
	WORD	BOB_XPos          ;To X pixel.
	WORD	BOB_YPos          ;To Y pixel.
	UWORD	BOB_ClipLX        ;Left X border in bytes.
	UWORD	BOB_ClipTY        ;Top Y border.
	UWORD	BOB_ClipRX        ;Right X border in bytes.
	UWORD	BOB_ClipBY        ;Bottom Y border.
	UWORD	BOB_FPlane        ;First plane to blit to (planar only)
	UWORD	BOB_Planes        ;Amount of planes
	ULONG	BOB_PlaneSize     ;Size Of Plane Source (planar only)
	UWORD	BOB_Attrib        ;Attributes like CLIP and MASK.
	APTR	BOB_Picture       ;Pointer to a picture struct (bob origin).
	LABEL	BBV1_SIZEOF

	;Multiple BOB's Structure (BMV1)

BOB_Coords =	BOB_XPos          ;BOB_Coords replaces BOB_XPos and BOB_YPos.
BOB_MaxBobs =	BOB_Frame         ;BOB_MaxBobs replaces BOB_Frame.

;---------------------------------------------------------------------------;
;Drawing Methods and Options for both BOB structures (BOB_Attrib).

CLIP =     $0001    ;Allow border clipping.
MASK =     $0002    ;Allow masking.
STILL =    $0004    ;This bob is not moving (use for optimisation).
CLEAR =    $0008    ;Allow automatic clearing.
RESTORE =  $0010    ;Allow automatic background restore.
DIRECT =   $0020    ;Using direct graphics and mask pointers.
ALLOCGMP = $0040    ;Generate Graphics and Mask pointers internally.
CRMASK =   $0082    ;Create and use masks in the drawing for this BOB.

B_CLIP = 	0
B_MASK = 	1
B_STATIC =	2
B_CLEAR =	3
B_RESTORE =	4
B_DIRECT =	5
B_ALLOCGMP =	6
B_CRMASK =	7

*****************************************************************************
* Map structure

MPV1 =	("MP"<<16)|00

    STRUCTURE	MAP,0
	ULONG	MAP_VERSION       ;The structure version, MPV1.
	ULONG	MAP_Stats         ;Private.
	UWORD	MAP_Buffer        ;Destination buffer.
	UWORD	MAP_Number        ;Map number to access for data.
	APTR	MAP_MapList       ;Pointer to the map datalist.
	UWORD	MAP_Width         ;Total width of map.
	UWORD	MAP_Height        ;Total height of map.
	UWORD	MAP_XStart        ;Get block data starting from X [byte].
	UWORD	MAP_YStart        ;Get block data starting from Y.
	UWORD	MAP_EntrySize     ;Byte/Word.
	ULONG	MAP_EntryMask     ;For special masking.
	UWORD	MAP_TileWidth     ;The width/8 of each tile (bytes).
	UWORD	MAP_TileHeight    ;The height of each tile.
	UWORD	MAP_Options       ;Applicable Map options, eg LOCKED.
	APTR	MAP_Picture       ;Points to the map's graphics picture.
	APTR	MAP_File          ;Where to get the map data.
	LABEL	MPV1_SIZEOF

;CLIP =    $0001 ;Blocks are to be clipped on the X/Y axis.
;MASK =    $0002
;XLOCKED = $0004 ;Blocks are blitted on 16 pixel X boundaries.
;YLOCKED = $0008

MAPSZ_BYTE = 1    ;Entry size is in bytes.
MAPSZ_WORD = 2    ;Entry size is in words.
MAPSZ_LONG = 3    ;Entry size is in longs.

  ENDC	;GMS_GAMES_I
