home *** CD-ROM | disk | FTP | other *** search
- #ifndef GAMES_GMS_H
- #define GAMES_GMS_H TRUE
-
- /*
- ** $VER: games.h 0.5 (15.02.97)
- **
- ** General include file for programs using the Games Master System.
- **
- ** (C) Copyright 1996-1997 DreamWorld Productions.
- ** All Rights Reserved
- */
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
-
- #ifndef UTILITY_TAGITEM_H
- #include <utility/tagitem.h>
- #endif
-
- #ifndef GMS_SOUND_H
- #include <games/sound.h>
- #endif
-
- #ifndef GMS_MISC_H
- #include <games/misc.h>
- #endif
-
- #ifndef GMS_IMAGE_H
- #include <games/image.h>
- #endif
-
- /***************************************************************************/
-
- #define LIST 0x4C495354
- #define OBJECTLIST 0x4F4C5354
- #define SKIPENTRY 0
- #define LISTEND -1
- #define ENDLIST -1
- #define TAGEND 0
-
- /****************************************************************************
- ** Helpful macros and structures.
- */
-
- struct PixelEntry {
- WORD XCoord;
- WORD YCoord;
- LONG Colour;
- };
-
- #define SKIPPIXEL -32000
- #define PIXELLIST(a) struct PixelList { WORD Entries; UWORD EntrySize; struct PixelEntry Entry[(a)]; } PixelList
-
- #define GetX(a) (BYTE)((a)>>8) /* Decompress ZBXY format */
- #define GetY(a) (BYTE)(a)
-
- /****************************************************************************
- **
- ** Universal errorcodes returned by certain functions.
- **
- */
-
- #define ERR_OK 0 /* Function went OK (also NULL) */
- #define ERR_NOMEM 1 /* Not enough memory available */
- #define ERR_NOPTR 2 /* Required pointer not present */
- #define ERR_INUSE 3 /* Previous allocations have not been freed */
- #define ERR_NOVER 4 /* Structure version not supported or not found */
- #define ERR_FAILED 5 /* General failure */
- #define ERR_FILE 6 /* File error, eg file not found */
- #define ERR_DATA 7 /* There is an error in the given data */
- #define ERR_SEARCH 8 /* A search routine in this function failed */
- #define ERR_SCRTYPE 9 /* Screen type not recognised */
- #define ERR_GPI 10 /* Trouble initialising/using a GPI */
-
- /****************************************************************************
- ** Memory types used by AllocMemBlock(). This is generally identical to the
- ** exec definitions but CHIP is renamed to VIDEO (displayable memory) and
- ** there is an addition of BLIT and SOUND specific memory.
- */
-
- #define MEM_ANY 0
- #define MEM_CLEAR 0
- #define MEM_VIDEO (1L<<1)
- #define MEM_BLIT (1L<<2)
- #define MEM_SOUND (1L<<3)
-
- /****************************************************************************
- **
- ** Universal joystick status bits returned from Read_Joystick, Sega,
- ** JoyPad, etc...
- **
- */
-
- #define JT_SWITCH 0
- #define JT_ZBXY 1
-
- #define JS_LEFT (1L<<0) /* X axis */
- #define JS_RIGHT (1L<<1)
- #define JS_UP (1L<<2) /* Y axis */
- #define JS_DOWN (1L<<3)
- #define JS_ZIN (1L<<4) /* Z axis! Reserved for later... */
- #define JS_ZOUT (1L<<5)
- #define JS_FIRE1 (1L<<6) /* Fire Buttons */
- #define JS_FIRE2 (1L<<7) /* For 2 button joysticks */
- #define JS_FIRE3 (1L<<11) /* For 3 button joysticks */
-
- #define JS_RED (1L<<6) /* CD32 buttons here */
- #define JS_BLUE (1L<<7)
- #define JS_PLAY (1L<<8)
- #define JS_RWD (1L<<9)
- #define JS_FFW (1L<<10)
- #define JS_GREEN (1L<<11)
- #define JS_YELLOW (1L<<12)
-
- #define JB_FIRE1 (1L<<16) /* For the ZBXY style return type */
- #define JB_FIRE2 (1L<<17) /* (analog joysticks) */
- #define JB_FIRE3 (1L<<18)
-
- #define MB_LMB (1L<<16) /* Mouse button flags returned from */
- #define MB_RMB (1L<<17) /* Read_Mouse(), in ZBXY format */
- #define MB_MMB (1L<<18)
-
- /* Joyport specifications for calling Read_JoyStick/Mouse/JoyPad...() */
-
- #define JPORT1 0*2
- #define JPORT2 1*2
- #define JPORT3 2*2
- #define JPORT4 3*2
-
- /****************************************************************************
- ** GPI ID numbers
- */
-
- #define GPI_SCREENS 0
- #define GPI_BLITTER 4
- #define GPI_SOUND 8
- #define GPI_NETWORK 12
- #define GPI_VECTORS 16
- #define GPI_DEBUG 20
- #define GPI_ANIM 24
- #define GPI_REKO 28
- #define GPI_TEXT 32
- #define GPI_OBJECTS 38
-
- /****************************************************************************
- ** Standard screen structure
- */
-
- #define GSV1 0x47530000,0
-
- struct GameScreen
- {
- ULONG VERSION; /* Structure 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 */
- ULONG AmtColours; /* The amount of colours in the palette */
- UWORD ScrWidth; /* The width of the visible screen */
- UWORD ScrHeight; /* The height of the visible screen */
- UWORD PicWidth; /* The width of the picture (pixels) */
- UWORD PicByteWidth; /* The width of the picture (bytes) */
- UWORD PicHeight; /* The height of the entire screen */
- UWORD Planes; /* The amount of planes in da screen */
- WORD ScrXOffset; /* Hardware co-ordinate for TOS */
- WORD ScrYOffset; /* Hardware co-ordinate for LOS */
- UWORD PicXOffset; /* Offset of the horizontal axis */
- UWORD PicYOffset; /* Offset of the vertical axis */
- ULONG Attrib; /* Special Attributes are? */
- UWORD ScrMode; /* What screen mode is it? */
- UWORD ScrType; /* Interleaved/Planar/Chunky? */
- };
-
- /* 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 LORES 0x0000 /* Low resolution (default) */
- #define HIRES 0x0001 /* High resolution */
- #define SHIRES 0x0002 /* Super-High resolution */
- #define LACED 0x0004 /* Interlaced */
- #define EXTRAHB 0x0010 /* Extra Half-Brite */
- #define HAM 0x0040 /* For HAM mode */
- #define COL12BIT 0x0080 /* 12 Bit colours */
- #define COL24BIT 0x0000 /* 24 Bit colours (default) */
-
- /* Screen Attribute tags */
-
- #define TAGS 0x54414753
-
- #define TBYTE 0
- #define TWORD (1L<<30)
- #define TLONG (1L<<31)
- #define TAPTR (1L<<30)|TLONG
-
- #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 24 bit colourlist:
- **
- ** LONG RasterList[] = {
- ** COL24LIST(0,1,0,&ColourList),
- ** RASTEND
- ** };
- **
- ** COL12 (ColourNumber,0xRGB)
- ** COL24 (ColourNumber,0xRRGGBB)
- ** COL12LIST (StartLine,Skip,Colour,&ColourList)
- ** COL24LIST (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 COL12(a,b) (00<<16)|(a),(b<<16),0
- #define COL24(a,b) (02<<16),(a),(b),0
- #define COL12LIST(a,b,c,d) (04<<16)|(a),(b<<16)|(c),(LONG)(d),0
- #define COL24LIST(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 NEWPALETTE(a,b,c) (20<<16),(a),(b),(LONG)(c),0
- #define WAITLINE(a) (22<<16)|(a),0
- #define RASTEND 0xffffffff
-
- /***************************************************************************
- ** Sprite Structure.
- */
-
- #define SPV1 0x53500000,0
-
- struct Sprite
- {
- ULONG VERSION; /* Structure version */
- APTR Stats; /* Private */
- UWORD Number; /* Bank number to access */
- APTR Data; /* Pointer to Sprite graphic */
- WORD XPos; /* X position */
- WORD YPos; /* Y position */
- UWORD Frame; /* Frame number */
- UWORD Width; /* Width in pixels */
- UWORD Height; /* Height in pixels */
- UWORD AmtColours; /* 4 or 16 */
- UWORD ColStart; /* Colour bank to access, increments of 16 */
- UWORD Planes; /* Amount of planes per bank */
- UWORD ScrMode; /* HiRes/LoRes/SHiRes */
- UWORD FieldPri; /* Field position in relation to playfields */
- UWORD Attrib; /* Attributes (XLONG) */
- };
-
- #define XLONG 0x0001
-
- /***************************************************************************
- ** BOB Structure.
- */
-
- #define BBV1 0x42420000,0
- #define MBV1 0x424D0000,0
-
- struct FrameList { /* Standard FrameList layout if pointing to BOBs */
- WORD GFX_XCoord; /* contained in a Picture structure. */
- WORD GFX_YCoord;
- WORD MSK_XCoord;
- WORD MSK_YCoord;
- };
-
- struct DirectList { /* Special FrameList layout for pointing directly */
- APTR Graphic; /* to the raw address of a BOB (use DIRECT flag). */
- APTR Mask;
- };
-
- struct BOB
- {
- ULONG VERSION; /* Structure version */
- APTR Stats; /* Private */
- APTR GfxData; /* Pointer to graphics source */
- APTR MaskData; /* Pointer to mask source */
- UWORD Frame; /* Current frame */
- APTR FrameList; /* Pointer to frame list */
- 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 */
- struct Picture *Picture; /* Pointer to a picture struct */
- };
-
- #define BBA_GfxData (8|TAPTR)
- #define BBA_MaskData (12|TAPTR)
- #define BBA_Frame (16|TWORD)
- #define BBA_FrameList (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|TLONG)
- #define BBA_Planes (46|TWORD)
- #define BBA_PlaneSize (48|TLONG)
- #define BBA_Attrib (52|TWORD)
- #define BBA_Picture (56|TAPTR)
-
- struct MBOB
- {
- ULONG VERSION; /* Structure version */
- APTR Stats; /* Private */
- APTR GfxData; /* Pointer to graphics source */
- APTR MaskData; /* Pointer to mask source */
- UWORD AmtEntries; /* Amount of entries in the list */
- APTR FrameList; /* Pointer to frame list */
- WORD SrcWidth; /* Source Page Width in bytes */
- UWORD Width; /* Width in pixels (optional) */
- UWORD ByteWidth; /* Width in bytes */
- UWORD Height; /* Height in pixels */
- APTR EntryList; /* Pointer to entry list */
- 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 */
- struct Picture *Picture; /* Pointer to picture origin (optional) */
- UWORD EntrySize; /* Entry size (sizeof(struct MBOBEntry)) */
- };
-
- struct MBOBEntry /* MBOB Entry Structure */
- {
- WORD XCoord;
- WORD YCoord;
- UWORD Frame;
- };
-
- #define BE_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 DIRECT 0x00000020 /* Using direct graphics and mask pointers */
- #define FILLMASK 0x00000040 /* Fill any holes in the mask on generation */
- #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
-
- /****************************************************************************
- ** Map structure
- */
-
- #define MPV1 'M','P',0,0,0
-
- struct Map
- {
- ULONG VERSION; /* The structure version, MPV1 */
- ULONG Stats; /* Private */
- UWORD Buffer; /* Destination buffer */
- UWORD Number; /* Map number to access for data */
- APTR MapList; /* Pointer to the map datalist */
- UWORD Width; /* Total width of map */
- UWORD Height; /* Total height of map */
- UWORD XStart; /* Get block data starting from X [byte] */
- UWORD YStart; /* Get block data starting from Y */
- UWORD EntrySize; /* Byte/Word/Long */
- ULONG EntryMask; /* For special cases */
- UWORD TileWidth; /* The width/8 of each tile (bytes) */
- UWORD TileHeight; /* The height of each tile */
- UWORD 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
-