**
**	$VER: games.i 0.3 (08.09.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

FILTER_OFF =	0
FILTER_ON =	1
OFF =	0
ON =	1

LISTSTART =	"LIST"         ;Used to indicate a list start.

ENDLIST =	0              ;Either one of these will terminate
LISTEND =	0              ;a list.

* --- 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 =	8

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
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.

* --- 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

* --- 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.

   STRUCTURE	GameScreen,0      ;A GameScreen structure
	ULONG	SS_VERSION        ;Vesion - "GSV1"
	APTR	SS_Stats          ;Reserved.
	APTR	SS_MemPtr1        ;Ptr to screen 1
	APTR	SS_MemPtr2        ;Ptr to screen 2 (doubled buffer)
	APTR	SS_MemPtr3        ;Ptr to screen 3 (tripled buffer)
	APTR	SS_ScreenLink     ;Ptr to a linked screen.
	APTR	SS_Palette        ;Ptr to the screen palette.
	APTR	SS_RasterList     ;Ptr to a raster list (or not).
	ULONG	SS_AmtColours     ;The amount of colours on screen.
	UWORD	SS_ScrWidth       ;The width of the visible screen window.
	UWORD	SS_ScrHeight      ;The height of the visible screen window.
	UWORD	SS_PicWidth       ;The width of the complete screen/picture.
	UWORD	SS_PicHeight      ;The height of the complete screen/picture.
	UWORD	SS_Planes         ;The amount of planes in the screen.
	WORD	SS_ScrXOffset     ;Hardware co-ordinate for TOS.
	WORD	SS_ScrYOffset     ;Hardware co-ordinate for LOS.
	WORD	SS_PicXOffset     ;Offset of the horizontal axis.
	WORD	SS_PicYOffset     ;Offset of the vertical axis.
	ULONG	SS_ScrAttrib      ;Special Attributes are?
	UWORD	SS_ScrMode        ;What screen mode is it?
	UBYTE	SS_ScrType        ;Interleaved/Planar/Chunky?
	UBYTE	SS_Displayed      ;Reserved.
	LABEL	GSV1_SIZEOF

* --- Screen types (flags for SS_ScrType).

INTERLEAVED =	0
PLANAR =	1
CHUNKY =	2

* --- 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         ;Reserved.
EXTRAHB =	$0010         ;Set for extra half-brite.
NTSC =		$0020         ;Set if you wrote this game in NTSC.
HAM =		$0040         ;For HAM mode.
COL24BIT =	$0080         ;24 Bit colours (otherwise it's 12Bits).

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

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

BUFFER1 = SS_MemPtr1
BUFFER2 = SS_MemPtr2
BUFFER3 = SS_MemPtr3

* --- 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 failure.
ERR_FILE =   6            ;File error, eg file not found, disk full etc.

* --- Sprite structure

   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_Resolution    ;HIRES/LORES/SHIRES/XLONG
	UWORD	SPR_FieldPriority ;Playfield priority.
	ULONG	SPR_SpriteSize    ;Reserved.
	ULONG	SPR_FrameSize     ;Reserved.
	LABEL	SPV1_SIZEOF

* - Extra stuff for the SPR_Resolution field.

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

* --- BOB structure

   STRUCTURE	BOB,0
	ULONG	BOB_VERSION       ;Structure version - "BBV1"
	APTR	BOB_Stats         ;Reserved.
	UWORD	BOB_Frame         ;Current frame.
	APTR	BOB_FrameList     ;Pointer to frame list.
	WORD	BOB_XPos          ;X position.
	WORD	BOB_YPos          ;Y position.
	UWORD	BOB_Height        ;Height
	UWORD	BOB_Width         ;Width in BYTES
	UWORD	BOB_DestBuffer    ;
	UWORD	BOB_Minterm
	WORD	BOB_ClipLeft      ;"Clip Area" border restrictions.
	WORD	BOB_ClipTop
	WORD	BOB_ClipRight
	WORD	BOB_ClipBottom
	UWORD	BOB_Attrib        ;Mask/Chunky/Planar/Interleaved
	UWORD	BOB_Planes
	UWORD	BOB_SetPlanes     ;Planes to blit - planar only.
	UWORD	BOB_Method
	UWORD	BOB_BackGrndInfo  ;Is a background stored?
	APTR	BOB_BackGrndPtr   ;Where is the background stored?
	LABEL	BOB_SIZEOF

* --- Blit Direct structure.

   STRUCTURE	BlitDirect,0
	ULONG	BD_VERSION       ;Structure version - "BBV1"
	APTR	BD_Source
	APTR	BD_Mask
	APTR	BD_Dest
	UWORD	BD_DestMod
	UWORD	BD_SrcMod
	UWORD	BD_Width
	UWORD	BD_Height
	UWORD	BD_Minterm
	UWORD	BD_Method
	UWORD	BD_Planes
	UWORD	BD_SetPlanes     ;Planes to blit - planar only.
	UWORD	BD_Attrib        ;Mask/Chunky/Planar/Interleaved
	LABEL	BD_SIZEOF

;* --- BOB Drawing Methods

		            ;INTERLEAVED
INTLV_NCNM = 00             ;No clip, no mask  Takes the shortest time
INTLV_NCYM = 01             ;No clip, masked
INTLV_YCNM = 02             ;Clip, no mask
INTLV_YCYM = 03             ;Clip, masked      Takes the longest time

		            ;PLANAR
PLNR_NCNM = 04	            ;No clip, no mask  Takes the shortest time
PLNR_NCYM = 05	            ;No clip, masked
PLNR_YCNM = 06	            ;Clip, no mask
PLNR_YCYM = 07	            ;Clip, masked      Takes the longest time

		            ;CHUNKY
CHNKY_NCNM = 08             ;No clip, no mask  Takes the shortest time
CHNKY_NCYM = 09             ;No clip, masked
CHNKY_YCNM = 10             ;Clip, no mask
CHNKY_YCYM = 11	            ;Clip, masked      Takes the longest time

* --- The picture structure for loading and depacking of pictures.

  STRUCTURE	Picture,0
	ULONG	PIC_VERSION              ;"PCV1"
	APTR	PIC_Stats                ;Reserved.
	APTR	PIC_Data                 ;Source.
	UWORD	PIC_Width                ;Picture Width
	UWORD	PIC_Height               ;Picture Height
	UWORD	PIC_Planes               ;Amount of planes
	ULONG	PIC_AmtColours	;Amount of colours.
	APTR	PIC_Palette              ;Ptr to Palette.
	UWORD	PIC_ScrMode	;Intended screen mode for picture.
	UWORD	PIC_Type                 ;Interleaved/Chunky/Planar
	ULONG	PIC_Attrib               ;GETPALETTE/VIDEOMEM/
	LABEL	PCV1_SIZEOF

* --- The Anim structure for loading and playing of animations.

   STRUCTURE	AnimStruct,00
	ULONG	ANM_VERSION	;"AMV1"
	APTR	ANM_Stats	;Reserved.
	UWORD	ANM_Width	;Anim width
	UWORD	ANM_Height	;Anim height
	UWORD	ANM_Frame	;Current frame/Frame to unpack.
	UWORD	ANM_AmtFrames	;The total amount of frames.
	ULONG	ANM_AmtColours	;The total amount of colours.
	APTR	ANM_Palette	;Pointer to the frame's palette.
	UWORD	ANM_Planes	;Amount of planes if planar.
	ULONG	ANM_Attrib	;Special flags.
	UWORD	ANM_ScrMode	;Expected screen mode for anim.
	UBYTE	ANM_Type	;Interleaved/Chunky/Planar
	APTR	ANM_FileName	;Where this anim comes from.
	LABEL	AMV1_SIZEOF

* --- Picture and Anim attributes (flags for ANM_Attrib and PIC_Attrib)

GETPALETTE =	$00000001          ;Allocate the palette?
MEM_VIDEO =	$00000002          ;Unpack to chipram only?

* --- Choose one of these when calling Set_Interrupt().

INTB_INTEN =	14             ;Master interrupt (enable only )
INTB_EXTER =	13             ;External interrupt
INTB_DSKSYNC =	12             ;Disk re-SYNChronized
INTB_RBF =	11             ;serial port Receive Buffer Full
INTB_AUD3 =	10             ;Audio channel 3 block finished
INTB_AUD2 =	9              ;Audio channel 2 block finished
INTB_AUD1 =	8              ;Audio channel 1 block finished
INTB_AUD0 =	7              ;Audio channel 0 block finished
INTB_BLIT =	6              ;Blitter finished
INTB_VERTB =	5              ;start of Vertical Blank
INTB_COPER =	4              ;Coprocessor
INTB_PORTS =	3              ;I/O Ports and timers
INTB_SOFTINT =	2              ;software interrupt rest
INTB_DSKBLK =	1              ;Disk Block done
INTB_TBE =	0              ;serial port Transmit Buffer Empty

* --- The KeyPress structure, used by Read_Key().

    STRUCTURE	KP,00
	UWORD	KP_ID          ;GMS Identification - ignore.
	UBYTE	KP_Key1        ;Newest Keypress
	UBYTE	KP_Key2        ;...
	UBYTE	KP_Key3        ;...
	UBYTE	KP_Key4        ;Oldest Keypress
	LABEL	KP_SIZEOF

* --- Special Keypresses that can be returned from Read_Key().  All other
*     keys can be considered to be in ASCII format. 

K_SCS =		$80                   ;ScreenSwitch (LEFTAMIGA + M)
K_DEL	=	$81
K_HELP	=	$82

K_LSHIFT =	$83
K_RSHIFT =	$84
K_CAPS =	$85
K_CTRL =	$86
K_LALT =	$87
K_RALT =	$88
K_LAMIGA =	$89
K_RAMIGA =	$8a

K_F1	=	$8b
K_F2	=	$8c
K_F3	=	$8d
K_F4	=	$8e
K_F5	=	$8f
K_F6	=	$90
K_F7	=	$91
K_F8	=	$92
K_F9	=	$93
K_F10	=	$94
K_F11	=	$95
K_F12	=	$96
K_F13	=	$97
K_F14	=	$98
K_F15	=	$99
K_F16	=	$9a
K_F17	=	$9b
K_F18	=	$9c
K_F19	=	$9d
K_F20	=	$9e

C_UP	=	$9f
C_DOWN	=	$a0
C_RIGHT	=	$a1
C_LEFT	=	$a2

K_SRIGHT =	$a3                   ;Special key on right.
K_SLEFT =	$a4                   ;Special key on left.

* --- Special keys that are recognised under ASCII (here for convenience).

K_BAKSPC =	08
K_TAB	=	09
K_ENTER =	10
K_RETURN =	10
K_ESC	=	""


