/*  :ts=8 bk=0
 *
 * marketroid.h:	Data structure definitions for the program.
 *
 * Leo L. Schwab			8709.30		(415) 456-3960
 */
#ifndef GRAPHICS_GFX_H
#include <graphics/gfx.h>
#endif

#ifndef EXEC_LISTS_H
#include <exec/lists.h>
#endif


/*
 * The basic object description structures.  Yes, I could have used the
 * animation/GEL software, but the code to utilize it would have been
 * non-trivial.  [Oh.  And this *IS* trivial?]  Besides, the GEL routines
 * would have made it impossible to perform certain special effects I need,
 * whereas I can perform the necessary rape using BltBitMap() or ClipBlit().
 */
struct object {
	struct BitMap	*bitmap;	/*  Pointer to bitmap with image  */
	WORD		width, height;	/*  Size of figure within bitmap  */
	WORD		nframes;	/*  # of frames for this figure   */
	UBYTE		*animseq;	/*  Animation sequencing array	  */
	WORD		upx, upy,	/*  Offsets into the bitmap for   */
			downx, downy,	/*   the frames of the figure	  */
			leftx, lefty,   /*   when it is walking in the	  */
			rightx, righty;	/*   specified direction.	  */
	WORD		incr;		/*  Suggested movement increment  */
	WORD		framerate;	/*  # of video frames per "cel"	  */
};

struct obcontrol {
	struct Node	node;		/*  For Enqueue()ing		  */
	struct object	*ob;		/*  Pointer to controlled object  */
	UWORD		flags;		/*  Some help			  */
	WORD		xoff, yoff;	/*  Current offset into bitmap	  */
	WORD		x, y;		/*  Current On-screen position	  */
	WORD		dx, dy;		/*  Current X and Y increments	  */
	WORD		dir;		/*  Current direction		  */
	WORD		frame;		/*  Current frame number	  */
	WORD		delay;		/*  Countdown to next frame	  */
};

/*  Directions for obcontrol.dir  */
#define	UP		0
#define	DOWN		1
#define	LEFT		2
#define	RIGHT		3

/*  Definitions for obcontrol.flags  */
#define	OFFSCREEN	1
#define	FREEZE		(1<<1)
#define	EXPLODING	(1<<2)


/*
 * Here is the color cycling command structure.
 */
struct cycle {
	struct Node	node;
	UWORD		type;		/*  Cycle type encoded here	  */
	UWORD		*colors;	/* Table to cycle through 1 entry */
	WORD		ncolors;	/*  # of entries in above table   */
	WORD		start, end;	/*  Start and end color entries   */
	WORD		rate;		/*  # of VBLANKs for one cycle	  */
	WORD		count;		/*  Countdown to next rotation	  */
};

/*
 * Structure used by the color cycling VBLANK routine
 */
struct interdat {
	struct List	cycles;		/*  List of color cycles to do	  */
	void		*vp;		/*  Viewport to affect		  */
	WORD		stop;		/*  If non-zero, don't cycle	  */
	UWORD		*ctab;		/*  Master color table		  */
	UWORD		ncolors;	/*  # of entries in master table  */
};

/*  Various kinds of cycling techniques  */
#define	CYCLE_SIMPLE	0
#define	CYCLE_THROUGH	1
#define	CYCLE_RANDOM	2


/*  Typecasting  */
extern void	*OpenLibrary(), *OpenScreen(), *AllocMem(), *AllocRaster(),
		*RemHead(), *CreatePort(), *CreateStdIO(), *CreateExtIO(),
		*CreateTask(), *FindPort(), *GetMsg(), *OpenDiskFont(),
		*OpenWindow();
extern long	CheckIO(), OpenDevice(), TextLength(), SetSignal();
