/* $Filename:       WormWars/Source/ww.h $
 * $VER:            WormWars 4.0 (1.11.98) $
 * $Description:    #defines and structure templates $
 *
 * © Copyright 1993-1998 James R. Jacobs of Amigan Software.
 * Freely distributable.
 *
 * Development version.
 *
 * This file contains #definitions, structure templates and function
 * prototypes for Worm Wars, and is #included with every module.
 *
 * Recommended tab size: 4.

There are some assumptions made in the code about the values and
arrangements of certain constants. You should check carefully when
modifying those values.

#INCLUDES -------------------------------------------------------------- */

#include <exec/types.h>
#include <libraries/gadtools.h>
#include <devices/gameport.h>

/* #DEFINES ---------------------------------------------------------------

version embedding */

#define VERSION				"$VER: Worm Wars 4.0 (1.11.98)"

// miscellaneous

#define ALTJUMP				 5
#define BOMBADD				 5	// in squares radius
#define BOMBRAND			25
#define CAUSEWAIT			80
#define DEFAULTLEVELS		 5
#define HISCOREDISTANCE		13
#define HISCORES			 4
#define MAXLEVELS			30	// 2K per level. don't set >99!
#define MENUENTRIES			18
#define NAMELENGTH			22	// 0..21 are TEXT, 22 is NULL
#define NOSE				 2	// don't set >PROTECTORS if you want one
#define NOSEDISTANCE		 4
#define PATIENCE			20
#define RESTFULNESS          5	// must be non-0
#define SENTINEL			 2	// not -1, 0 or 1
#define TIMEOUT				20

#define MOVE				 0	// not AMMO, TRAINER, ONEHUMAN or PANIC
#define TRAINER				 2	// not MOVE, AMMO, ONEHUMAN or PANIC
#define ONEHUMAN			 3	// not MOVE, AMMO, TRAINER or PANIC
#define PANIC				 4	// not MOVE, AMMO, TRAINER or ONEHUMAN

#define ILLEGAL				((APTR) 0xA9A9)		// debugging value
#define WORMWARSMAGIC		'~'

#define KILLERBLOOD		1
#define ORBBLOOD		1

// samples

#define FXKILLERFIRE	 0
#define FXPROTECTORBORN	 1
#define FXTIMEBOMBTICK	 2
#define FXGETGROWER		 3
#define FXMISSILEACTIVE	 4
#define FXFILEABOUT		 5
#define FXGETPOWERUP	 6
#define FXUSETELEPORT	 7
#define FXWORMDEATH		 8
#define FXGETAMMO		 9
#define FXEXPLODE		10
#define FXKILLERBORN	11
#define FXORBBORN		12
#define FXPAIN			13
#define FXSHOOT			14
#define FXTITLESCREEN	15
#define FXVICTORY		16
#define FXFILENEW		17
#define FXFILEOPEN		18
#define FXFILESAVE		19
#define FXBOMBBLAST		20
#define FXDEFEAT		21
#define FXENDOFLEVEL	22
#define FXCLICK			23
#define FXUSEARMOUR		24
#define FXGETOBJECT		25
#define FXTIMEALERT		26
#define FXORBSPLIT		27
#define FXORBDEATH      28
#define FXFILESAVEAS	29
#define FXFX			30
#define FXGETNITRO		31
#define FXJUMP			32
#define FX_C			33
#define FX_O			34
#define FX_M			35
#define FX_P			36
#define FX_L			37
#define FX_E			38
#define FX_T			39
#define FXHISCORE		40
#define FXTHUD			41
#define FXKILLERDEATH	42
#define FXGETSKULL		43
#define FXUSETONGUE		44
#define SAMPLES         44

#define FXSTAMPED		FXBOMBBLAST
#define FXUSEPROTECTOR  FXPROTECTORBORN

/* constant strings

screen/window titles */

#define ASLOPENHAIL     	"Open Fieldset"
#define ASLSAVEHAIL			"Save Fieldset"
#define TITLEBAR        	"Worm Wars 4.0"

// pathnames

#define DEFAULTSET			"WormWars.fset"
#define MEDMODULE			"WormWars.MED"
#define PATTERN				"(#?.fset)"

// alerts (fatal errors) used multiple times

#define ALERTTIMERVALUE         "\0\20\20Worm Wars: Can't allocate timer value structure!\0"
#define ALERTMENUCREATE			"\0\20\20Worm Wars: Can't create menus!\0"
#define ALERTMENULAYOUT			"\0\20\20Worm Wars: Can't lay out menus!\0"

// say() arguments (hidden messages)

#define  FIRSTLISA              "Lisa is gorgeous!"
#define SECONDLISA              "My beloved! :-)"

// statistics text

#define STATSINGLE              "Single"
#define STATTRIPLE              "Triple"
#define STATQUINTUPLE           "Quint."
#define STATSEPTUPLE            "Sept. "
#define STATFAST                "Fast  "
#define STATNORMAL              "Normal"
#define STATSLOW                "Slow  "
#define STATVERYFAST            "V.Fast"
#define STATVERYSLOW            "V.Slow"

// dimensions

#define FONTX					  8
#define FONTY					  8
#define SQUAREX					  9
#define SQUAREY					  6
#define FIELDX					 52
#define FIELDY					 38
#define STARTXPIXEL				 83
#define STARTYPIXEL				 11
#define SCREENXPIXEL			639
#define SCREENYPIXEL			245
#define ENDXPIXEL				((STARTXPIXEL + SQUAREX * (FIELDX + 1)) - 1)
#define ENDYPIXEL				((STARTYPIXEL + SQUAREY * (FIELDY + 1)) - 1)
#define SAYLIMIT				((ENDXPIXEL - STARTXPIXEL) / FONTX)

// microsecond time units

#define DELAY					 16000L
#define DELAYPERLEVEL			  1000L
#define JOYDELAY        		 50000L		// 1,000,000 / JOYDELAY = movement in squares per second

// frequencies

#define KILLERFREQSTART		120
#define KILLERFREQMOD	 	  5
#define KILLERFREQEND		 20
#define ORBFREQSTART		220
#define ORBFREQMOD			 10
#define ORBFREQEND			 20
#define TELFREQ				240
#define KILLERFIREFREQ		 10

// population limits

#define KILLERS				7		// don't set >(ORBS + 1)!
#define ORBS				6
#define PROTECTORS			2		// don't set >4!
#define TIMEBOMBS			3

// speeds

#define VERYFAST    	         1
#define FAST        	         2
#define NORMAL      	         4
#define SLOW        	         8
#define VERYSLOW                16      // must be non-0
#define FRAGSPEED			NORMAL
#define FRAGINCLEVELS            1      // must be non-0
#define ORBSPEED			  SLOW
#define ORBINCLEVELS             2      // must be non-0
#define KILLERSPEED			  SLOW
#define KILLERINCLEVELS          2      // must be non-0
#define TIMEBOMBSPEED		     4
#define FASTESTLEVEL		    10
#define MISSILESPEED		  FAST

// jump distances

#define VERYFASTDISTANCE	6
#define FASTDISTANCE		5
#define NORMALDISTANCE		4
#define SLOWDISTANCE		3
#define VERYSLOWDISTANCE	2

/* The constant NORMAL is used for several purposes:
	a)	as a speed (therefore must not be VERYFAST, FAST, SLOW
			or VERYSLOW);
	b)	as a blitmode (therefore must not be BLACK or WHITE); and
	c)	as a pointer (therefore must not be GOLD, SILVER, EMPTY,
			WOOD or STONE).

introduction levels */

#define KILLERLEVEL		1
#define ORBLEVEL		1
#define TIMEBOMBLEVEL	1

// stats

#define AMMOLIMIT	   100
#define BIASLIMIT	   100
#define STARTLIVES	   100
#define LIVESLIMIT	   200
#define MODELIMIT	   100
#define MULTILIMIT       8      // don't set >8!
#define POWERLIMIT	     6
#define SCORELIMIT	999999L

/* field values

FIRSTHARD <= hard barriers <= LASTHARD < softer barriers <= LASTSOFT

Any 'coloured' value (eg. BLUEHEAD) is part of a consecutive set for
all the worms; eg. GREENHEAD, REDHEAD, BLUEHEAD, YELLOWHEAD, and thus
can be indexed by, eg. FIRSTFIRE + <worm number>. */

#define AFFIXER			 0
#define AMMO			 1
#define ARMOUR			 2
#define BIAS			 3
#define BOMB			 4
#define BONUS			 5
#define GROWER			 6
#define ICE				 7
#define LIFE			 8
#define MISSILE			 9
#define MULTIPLIER		10
#define NITRO			11
#define POWER			12
#define PROTECTOR		13
#define SLAYER			14
#define SWITCHER		15
#define TONGUE			16
#define TREASURE		17
#define LASTOBJECT		TREASURE				// 17

#define EMPTY			18
#define SILVER			19
#define GOLD			20
#define FIRSTEMPTY		EMPTY					// 18
#define LASTEMPTY		GOLD					// 20
#define TELEPORT		21
#define  GREEN_C		22
#define    RED_O		23
#define   BLUE_M		24
#define YELLOW_P		25
#define  GREEN_L		26
#define    RED_E		27
#define   BLUE_T		28
#define YELLOW_E		29
#define FIRSTLETTER		GREEN_C
#define LASTLETTER		YELLOW_E
#define LETTERS			(LASTLETTER - FIRSTLETTER)

#define SKULL			30
#define FIRSTPROTECTOR	31
#define LASTPROTECTOR	34
#define FRAGMENT		35
#define STONE			36
#define KILLER			37
// KILLER is between FIRSTLETTER..WOOD (assumed by fastloop())
#define FIRSTHARD		STONE					// 36
#define LASTHARD		KILLER					// 37
#define WOOD			38
// FIRSTLETTER..WOOD are all death for fragments.
#define FIRSTTAIL		39
// anything from FIRSTTAIL onwards is destroyed by bombblasts.
#define LASTTAIL		42
#define LASTSOFT		LASTTAIL				// 42
#define ORB				43
#define ORBTONGUE		44
#define ORBARMOUR		45
#define FIRSTFIRE		46
#define LASTFIRE		49
#define FIRSTMISSILE	50
#define LASTMISSILE		53
#define START			54
#define MUSIC			55
#define CLOCK			56
#define STICKY			57
#define FX				58

#define ANYTHING		FX						// 57
#define ZERO			59
#define ONE				(ZERO + 1)				// 59
#define TWO				(ZERO + 2)				// 60

#define       HEAD			(ZERO + 10)			// 68
#define  GREENHEADUP		 HEAD
#define    REDHEADUP		(HEAD +  1)
#define   BLUEHEADUP		(HEAD +  2)
#define YELLOWHEADUP		(HEAD +  3)
#define  FIRSTHEAD			GREENHEADUP
#define   LASTHEAD			YELLOWHEADUP
#define  GREENHEADDOWN		(HEAD +  4)
#define    REDHEADDOWN		(HEAD +  5)
#define   BLUEHEADDOWN		(HEAD +  6)
#define YELLOWHEADDOWN		(HEAD +  7)
#define  GREENHEADLEFT		(HEAD +  8)
#define    REDHEADLEFT		(HEAD +  9)
#define   BLUEHEADLEFT		(HEAD + 10)
#define YELLOWHEADLEFT		(HEAD + 11)
#define  GREENHEADRIGHT		(HEAD + 12)
#define    REDHEADRIGHT		(HEAD + 13)
#define   BLUEHEADRIGHT		(HEAD + 14)
#define YELLOWHEADRIGHT		(HEAD + 15)
#define  GREENTONGUEUP		(HEAD + 16)
#define    REDTONGUEUP		(HEAD + 17)
#define   BLUETONGUEUP		(HEAD + 18)
#define YELLOWTONGUEUP		(HEAD + 19)
#define  GREENTONGUEDOWN	(HEAD + 20)
#define    REDTONGUEDOWN	(HEAD + 21)
#define   BLUETONGUEDOWN	(HEAD + 22)
#define YELLOWTONGUEDOWN	(HEAD + 23)
#define  GREENTONGUELEFT	(HEAD + 24)
#define    REDTONGUELEFT	(HEAD + 25)
#define   BLUETONGUELEFT	(HEAD + 26)
#define YELLOWTONGUELEFT	(HEAD + 27)
#define  GREENTONGUERIGHT	(HEAD + 28)
#define    REDTONGUERIGHT	(HEAD + 29)
#define   BLUETONGUERIGHT	(HEAD + 30)
#define YELLOWTONGUERIGHT	(HEAD + 31)
#define  GREENARMOURUP		(HEAD + 32)
#define    REDARMOURUP		(HEAD + 33)
#define   BLUEARMOURUP		(HEAD + 34)
#define YELLOWARMOURUP		(HEAD + 35)
#define  GREENARMOURDOWN	(HEAD + 36)
#define    REDARMOURDOWN	(HEAD + 37)
#define   BLUEARMOURDOWN	(HEAD + 38)
#define YELLOWARMOURDOWN	(HEAD + 39)
#define  GREENARMOURLEFT	(HEAD + 40)
#define    REDARMOURLEFT	(HEAD + 41)
#define   BLUEARMOURLEFT	(HEAD + 42)
#define YELLOWARMOURLEFT	(HEAD + 43)
#define  GREENARMOURRIGHT	(HEAD + 44)
#define    REDARMOURRIGHT	(HEAD + 45)
#define   BLUEARMOURRIGHT	(HEAD + 46)
#define YELLOWARMOURRIGHT	(HEAD + 47)
#define ARRAYSIZE			YELLOWARMOURRIGHT	// 114

#define TEMPSILVER			(ARRAYSIZE + 1)		// 115
#define TEMPGOLD			(ARRAYSIZE + 2)		// 116
#define WASSILVER			(ARRAYSIZE + 3)		// 117
#define TEMPWOOD			TEMPSILVER
#define NOSQUARE			(ARRAYSIZE + 4)		// 118

// colours

#define BLACK		 0
#define WHITE		 1
#define DARKGREY	 2
#define LIGHTGREY	 4
#define ORANGE		 5
#define PURPLE		 6
#define DARKGREEN	 8
#define GREEN		 9
#define DARKRED		10
#define RED			11
#define DARKBLUE	12
#define BLUE		13
#define DARKYELLOW	14
#define YELLOW		15

// game status

#define GAMEOVER        0
#define PLAYGAME        1
#define FIELDEDIT		2

// status lines

#define SCORELINE	0
#define LIVESLINE	1
#define BIASLINE	2
#define SPEEDLINE	3
#define AMMOLINE	5
#define POWERLINE	6
#define ARMOURLINE	8
#define TONGUELINE	9
#define LINES		TONGUELINE

// skill points

#define EMPTYPOINT		   1
#define TAILBONUS		   1
#define TURNTOSILVER	   5
#define TURNTOGOLD		  10
#define SILVERPOINT		  10
#define TIMEBONUS		  10
#define TELPOINT		  40
#define GOLDPOINT		  50
#define HITSHOT			  50
#define KILLKILLER		  50
#define KILLWORM		 100
#define CROSSHEADS		 100
#define BOMBOVEREDGE	 100
#define SKULLPOINT		 100
#define ORBLETTER		 100
#define YOURLETTER		 100
#define MYLETTER		 200
#define SURVIVOR		 500
#define LEVELBONUS		 100
#define LIFEMODULO		1000
#define CHAMPION		1000

// scancodes

#define ALPHAONE			0x01	// row 1. alphabetic 1
#define ALPHATWO			0x02	// row 1. alphabetic 2
#define ALPHATHREE			0x03	// row 1. alphabetic 3
#define ALPHAFOUR			0x04	// row 1. alphabetic 4
#define ALPHAFIVE			0x05	// row 1. alphabetic 5
#define ALPHASIX			0x06	// row 1. alphabetic 6
#define ALPHASEVEN			0x07	// row 1. alphabetic 7
#define ALPHAEIGHT			0x08	// row 1. alphabetic 8
#define NUMERICZERO			0x0F	// row 5. numeric 0
#define Q					0x10	// row 2.
#define W					0x11	// row 2.
#define E					0x12	// row 2. erase
#define I					0x17	// row 2. insert
#define O					0x18	// row 2. open...
#define P					0x19	// row 2.
#define NUMERICONE			0x1D	// row 5. numeric 1
#define NUMERICTWO			0x1E	// row 5. numeric 2
#define NUMERICTHREE		0x1F	// row 5. numeric 3
#define A					0x20	// row 3. save as...
#define S					0x21	// row 3. save
#define D					0x22	// row 3. delete
#define F					0x23	// row 3. effects
#define K		 			0x27	// row 3. append
#define INTERNATIONALONE	0x2B	/* row 3. international key adj. to
										Return (on some keyboards) */
#define NUMERICFOUR	 		0x2D	// row 5. numeric 4
#define NUMERICFIVE	 		0x2E	// row 5. numeric 5
#define NUMERICSIX	 		0x2F	// row 5. numeric 6
#define INTERNATIONALTWO	0x30	/* row 4. international key adj. to
										Left Shift (on some keyboards) */
#define Z		 			0x31	// row 4.
#define KEY_X				0x32	// row 4.
#define C					0x33	// row 4.
#define V					0x34	// row 4.
#define N					0x36	// row 4. new
#define M					0x37	// row 4. music
#define NUMERICDOT			0x3C	// row 5. numeric .
#define NUMERICSEVEN		0x3D	// row 5. numeric 7
#define NUMERICEIGHT		0x3E	// row 5. numeric 8
#define NUMERICNINE			0x3F	// row 5. numeric 9
#define SPACEBAR			0x40	// row 4.
#define BACKSPACE			0x41	// row 4.
#define ENTER				0x43	// row 5. numeric Enter
#define RETURN				0x44	// row 2. alphabetic Return
#define ESCAPE				0x45	// row 0.
#define DELETE				0x46	// row 3.
#define NUMERICMINUS		0x4A	// row 5. numeric -
#define UP					0x4C	// row 1.
#define DOWN				0x4D	// row 4.
#define RIGHT				0x4E	// row 3.
#define LEFT				0x4F	// row 2.
#define F1					0x50	// row 0.
#define F2					0x51	// row 0.
#define F3					0x52	// row 0.
#define F4					0x53	// row 0.
#define F5					0x54	// row 0.
#define F6					0x55	// row 0.
#define F7					0x56	// row 0.
#define F8					0x57	// row 0.
#define F10					0x59	// row 0.
#define NUMERICOPEN			0x5A	// row 0. numeric (
#define NUMERICCLOSE		0x5B	// row 0. numeric )
#define NUMERICSLASH		0x5C	// row 5. numeric /
#define NUMERICASTERISK		0x5D	// row 5. numeric *
#define NUMERICPLUS			0x5E	// row 5. numeric +
#define HELP	 			0x5F	// row 0.
#define FIRSTQUALIFIER		0x61
#define LASTQUALIFIER		0x67
#define KEYUP				0x80	// key release

// indicator locations

#define CAUSEYDISTANCE	3	// distance from centre for cause
#define LETTERYDISTANCE	5	// distance from centre for letters
#define ICONY			(FIELDY / 2)
#define MUSICICON		(FIELDX + 2)
#define CLOCKICON		(FIELDX + 5)
#define STICKYICON		(FIELDX + 8)

// control values

#define NONE            0   // must be 0
#define AMIGA           1
#define HUMAN           2

// PUBLIC STRUCTURES ------------------------------------------------------

struct FragStruct
{	BYTE		x, y, deltax, deltay, last;
    BOOL        alive, moved;
};
struct HiScoreStruct
{	BYTE	player,					// which worm it was
			level;					// which level they reached
	ULONG	score;					// the score itself
	TEXT	name[NAMELENGTH + 1];	// name of the player
	BOOL	fresh;
};
struct KillerStruct
{	BYTE		x, y, last;
	BOOL		alive;
};
struct MissileStruct
{   BYTE        x, y, deltax, deltay;
	BOOL		alive, moved;
    ULONG       receipt;
};
struct ObjectStruct
{	WORD		frequency;
	LONG		score;
};
struct OrbStruct
{	BYTE		x, y, deltax, deltay, oldx, oldy;
	BOOL		alive, moved, explode;
	BYTE		speed, mode;
	UBYTE		last;
	WORD		armour, tongue;
	BYTE		multi;
	LONG		score;
};
struct ProtectorStruct
{   BYTE        x, y, deltax, deltay, relx, rely;
    BOOL        alive, last, visible;
};
struct SampStruct
{	STRPTR		fname;
	BYTE		volume;
	BOOL		repeat;
};
struct TeleportStruct
{	BYTE		x, y;
	BOOL		alive;
};
struct TimebombStruct
{	BYTE		x, y, time;
	BOOL		alive;
};
struct WormStruct
{   BYTE        x, y, deltax, deltay, posidir, position, victor, cause,
                    statx, staty, colour, pos, multi, power, mode, last,
					levelreached;
	BOOL		affixer, alive, moved, nitro;
	UBYTE		speed, lives, control;
	WORD		armour, tongue, ammo, bias, ice;
	LONG		score, oldscore;
	UWORD		causewait;
	ULONG		tonguereceipt;
	TEXT		name[NAMELENGTH + 1];
};

/* PROTOTYPES -------------------------------------------------------------

main.c */

void align(STRPTR string, BYTE size, TEXT filler);
									// right-justify
BOOL anykey(BOOL timeout);          // await keypress or mousebutton
void blitmode(BYTE state);			// change drawing modes
BOOL blocked(BYTE which, BYTE deltax, BYTE deltay);
void bombblast(UBYTE triggerer, BYTE player, BYTE centrex, BYTE centrey);
                                	// executes bomb explosions
BYTE bsign(BYTE value);				// get the sign (-1, 0, 1) of a BYTE
void celebrate(void);				// flash colours, etc. on victory
void changefield(void);				// fill field[][] from board[][][]
void cleanexit(void);
void clearjoystick(void);
void clearkybd(void);				// clear IDCMP buffer
void clearletters(void);			// clears letter indicators
void copyfield(UBYTE source, UBYTE destination);
        							// copies one level to another
void death(void);					// check for and handle damage to worms
void draw(BYTE x, BYTE y, UBYTE image);
									// blit a square
void drawcause(BYTE player, BYTE state);
									// draws or blanks a cause
void drawletter(BYTE player, UBYTE letter, BYTE state);
									// draws or blanks a letter
void fillfield(UBYTE which);		// fill level with square
void killall(void);					// kills everything
void matchteleports(void);			// destroy unmatched teleports
void newfield(void);				// create an empty field
void newfields(void);				// create all empty fields
void newlevel(BYTE player);			// advances to the next level
void orientworms(void);				// face worms in correct starting direction
BYTE partner(BYTE teleport);        // returns teleport's co-teleport
void putletter(BYTE player);		// put a letter on field
void renderboard(void);				// draws a field
void say(STRPTR sentence, BYTE colour);
									// writes above the field
void saylevel(BYTE colour);			// tells current level
LONG squareblast(UBYTE type, BYTE player, UBYTE this, BYTE x, BYTE y);
                        			// bomb explosions on one square
void stat(BYTE player, BYTE line);	// update player information
void turnworm(BYTE player, BYTE deltax, BYTE deltay);
        							// turn or adjust speed of worm
void updatesquare(BYTE x, BYTE y);	// redraw a square
BYTE valid(BYTE x, BYTE y);			// check if a field coordinate is in bounds
BOOL verify(void);					// confirms data loss
void wormbullet(BYTE player);		// handles worm bullets and jumping
WORD wsign(WORD value);				// get the sign (-1, 0, 1) of a WORD
WORD xpixeltosquare(WORD x);		// convert X-pixel to X-square
WORD ypixeltosquare(WORD y);		// convert Y-pixel to Y-square
BYTE xwrap(BYTE x);					// modulo of X-coordinate
BYTE ywrap(BYTE y);					// modulo of Y-coordinate

// loop.c

void fastloop(void);				// things done often
void fragloop(void);				// handles fragments
void killerloop(void);				// control killers
void missileloop(void);
void orbloop(BYTE which);			// control orbs
void slowloop(void);				// things done rarely
void wormloop(BYTE player);			// handles worms
void queue(BYTE player, BYTE deltax, BYTE deltay);
									// add a keystroke to the queue

// init.c

void cleanexit(void);
void setup(void);
void initsound(void);
void bouncekiller(BYTE x, BYTE y, BYTE which);
void orbexplosion(BYTE which);		// orb fragments
void orbsplit(BYTE which);			// split an orb
void sendreadrequest(void);			// request a new joystick event
WORD whichfrag(BYTE x, BYTE y);
BYTE whichkiller(BYTE x, BYTE y);
BYTE whichorb(BYTE x, BYTE y);
BYTE whichteleport(BYTE x, BYTE y);
BYTE whichtimebomb(BYTE x, BYTE y);
void wormscore(BYTE player, LONG score);

// fets.c

void activate(BYTE which);
void clearhiscores(void);
void clearstats(void);
void fileabout(void);
void fieldedit(void);				// the field editor
void fileopen(void);				// File|Open function
void filesaveas(BOOL flag);     	// File|Save, File|Save As... functions
void hiscores(void);
void hiscorenames(void);
void levelappend(void);				// Level|Append function
void leveldelete(void);				// Level|Delete function
void levelerase(void);				// Level|Erase function
void levelinsert(void);				// Level|Insert function
BOOL loadfields(STRPTR pathname);	// load fieldset
void newhiscores(void);
BOOL savefields(STRPTR pathname);	// save fieldset
void setbrush(BYTE newbrush);
void setpointer(UBYTE pointer);
void titlescreen(void);				// the title screen
void toggle(BYTE key);
void underline(BYTE square);		// underlines pseudo-gadgets

// sfx.c

void destroy8(void);
BYTE loadsample(char* fname, UBYTE index);
									// load a sample into memory
ULONG effect(UBYTE index);      	// plays effect asynchronously
void presetup(void);
BYTE getaudio(void);				// open audio.device, etc.
void kill8(void);					// shut down effects subsystem
void stopfx(ULONG receipt);

// Must have blank line at EOF.
