home *** CD-ROM | disk | FTP | other *** search
- /* $Filename: WormWars/Source/same.h $
- * $VER: WormWars 4.4 $
- * $Description: Header file for Worm Wars 4.4 $
- *
- * © Copyright 1999 James R. Jacobs.
- *
- * This file is used by most files on Amiga and IBM-PC
-
- SAME ON EACH PLATFORM -------------------------------------------------- */
-
- #define elif else if
-
- // miscellaneous
-
- #define CAUSEWAIT 80
- #define DEFAULTLEVELS 5
- #define ENDXPIXEL ((STARTXPIXEL + SQUAREX * (FIELDX + 1)) - 1)
- #define ENDYPIXEL ((STARTYPIXEL + SQUAREY * (FIELDY + 1)) - 1)
- #define FIELDX 52 // in squares
- #define FIELDY 38 // in squares
- #define HISCORES 4
- #define ILLEGAL ((APTR) 0xA9A9) // debugging value
- #define LIFEMODULO 1000
- #define MAXLEVELS 30 // 2K per level. <=99!
- #define NAMELENGTH 22 // 0..21 are TEXT, 22 is NULL
- #define NUMKEYS 29
- #define PATIENCE 20
- #define SAYLIMIT ((ENDXPIXEL - STARTXPIXEL) / FONTX)
- #define VERSION "$VER: Worm Wars 4.4 (22.9.99) $"
-
- // samples
-
- #define FXKILLERFIRE 0
- #define FXPROTECTORBORN 1
- #define FXTIMEBOMBTICK 2
- #define FXGETGROWER 3
- #define FXMISSILEACTIVE 4
- #define FXGETPOWERUP 5
- #define FXUSETELEPORT 6
- #define FXWORMDEATH 7
- #define FXGETAMMO 8
- #define FXEXPLODE 9
- #define FXKILLERBORN 10
- #define FXORBBORN 11
- #define FXSHOOT 12
- #define FXTITLESCREEN 13
- #define FXVICTORY 14
- #define FXFILENEW 15
- #define FXFILEOPEN 16
- #define FXFILESAVE 17
- #define FXBOMBBLAST 18
- #define FXDEFEAT 19
- #define FXENDOFLEVEL 20
- #define FXCLICK 21
- #define FXUSEARMOUR 22
- #define FXGETOBJECT 23
- #define FXTIMEALERT 24
- #define FXORBSPLIT 25
- #define FXORBDEATH 26
- #define FXFILESAVEAS 27
- #define FXFX 28
- #define FXGETNITRO 29
- #define FXJUMP 30
- #define FX_C 31
- #define FX_O 32
- #define FX_M 33
- #define FX_P 34
- #define FX_L 35
- #define FX_E 36
- #define FX_T 37
- #define FXHISCORE 38
- #define FXTHUD 39
- #define FXKILLERDEATH 40
- #define FXGETSKULL 41
- #define FXUSETONGUE 42
- #define FXDRIPBORN 43
- #define FXAMIGAN 44
- #define FXPAIN 45
- #define SAMPLES 48
-
- #define FXSTAMPED FXBOMBBLAST
- #define FXUSEPROTECTOR FXPROTECTORBORN
- #define FXDRIP FXFX
-
- // frequencies
-
- #define DRIPFREQ_MAX 30 // starting frequency (level 0)
- #define DRIPFREQ_DEC 2 // minus level * DRIPDECREASE
- #define DRIPFREQ_MIN 10 // but always at least DRIPFREQ_MIN
- #define KILLERFREQ_MAX 120
- #define KILLERFREQ_DEC 5
- #define KILLERFREQ_MIN 20
- #define ORBFREQ_MAX 220
- #define ORBFREQ_DEC 10
- #define ORBFREQ_MIN 20
- #define SLIMEFREQ_MAX 200
- #define SLIMEFREQ_DEC 30
- #define SLIMEFREQ_MIN 50
-
- #define KILLERFIREFREQ 10
- #define TELFREQ 240
-
- // key types
-
- #define MOVE 0 // not AMMO, TRAINER, ONEHUMAN
- #define TRAINER 2 // not MOVE, AMMO, ONEHUMAN
- #define ONEHUMAN 3 // not MOVE, AMMO, TRAINER
-
- // speeds
-
- #define VERYFAST 1
- #define FAST 2
- #define NORMAL 4
- #define SLOW 8
- #define VERYSLOW 16 // must be non-0
-
- #define DRIPSPEED_MAX SLOW
- #define DRIPSPEED_DIV 2
- #define FRAGSPEED_MAX NORMAL
- #define FRAGSPEED_DIV 2 // must be non-0
- #define ORBSPEED_MAX SLOW
- #define ORBSPEED_DIV 3 // must be non-0
- #define KILLERSPEED_MAX SLOW
- #define KILLERSPEED_DIV 2 // must be non-0
-
- #define TIMEBOMBSPEED 4
- #define MISSILESPEED FAST
-
- /* 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).
-
- 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...
- These are objects. */
- #define AFFIXER 0
- #define AMMO 1
- #define ARMOUR 2
- #define BIAS 3
- #define BOMB 4
- #define BONUS 5
- #define CLOCK 6
- #define GROWER 7
- #define HEALER 8
- #define ICE 9
- #define LIFE 10
- #define MISSILE 11
- #define MULTIPLIER 12
- #define NITRO 13
- #define POWER 14
- #define PROTECTOR 15
- #define SLAYER 16
- #define SLOWER 17
- #define SWITCHER 18
- #define TONGUE 19
- #define TREASURE 20
- #define UMBRELLA 21
- #define LASTOBJECT UMBRELLA
- // These are `empty'.
- #define EMPTY (LASTOBJECT + 1)
- #define SILVER (LASTOBJECT + 2)
- #define GOLD (LASTOBJECT + 3)
- #define FIRSTEMPTY EMPTY
- #define LASTEMPTY GOLD
- #define LASTKILLERFIRE LASTEMPTY
- // Nothing special about the following...
- #define TELEPORT (GOLD + 1)
- #define FRAGMENT (GOLD + 2)
- #define ORB (GOLD + 3)
- #define FIRSTPROTECTOR (GOLD + 4)
- #define LASTPROTECTOR (GOLD + 7)
- /* Margins indicate `ranges' for:
- l: letters.
- n: orb bouncing, normal mode.
- t: orb bouncing, tongue mode.
- a: orb bouncing, armour mode.
- f: fragment death.
- k: killers. l n t a f k */
- #define GREEN_C (GOLD + 8) // [ [
- #define RED_O (GOLD + 9) // | |
- #define BLUE_M (GOLD + 10) // | |
- #define YELLOW_P (GOLD + 11) // | |
- #define GREEN_L (GOLD + 12) // | |
- #define RED_E (GOLD + 13) // | |
- #define BLUE_T (GOLD + 14) // | |
- #define YELLOW_E (GOLD + 15) // ] |
- #define SKULL (GOLD + 16) // |
- #define SLIME (GOLD + 17) // [ | [
- #define STONE (GOLD + 18) // [ [ | | |
- #define KILLER (GOLD + 19) // ] | | | |
- #define WOOD (GOLD + 20) // | ] ] |
- #define FIRSTTAIL (GOLD + 21) // | |
- #define LASTTAIL (GOLD + 24) // ] ]
- #define FIRSTLETTER GREEN_C
- #define FIRSTNONE STONE
- #define FIRSTTONGUE STONE
- #define FIRSTARMOUR SLIME
- #define FIRSTFRAGDEATH FIRSTLETTER
- #define FIRSTKILLER SLIME
- #define LASTLETTER YELLOW_E
- #define LASTNONE LASTTAIL
- #define LASTTONGUE KILLER
- #define LASTARMOUR KILLER
- #define LASTFRAGDEATH WOOD
- #define LASTKILLER LASTTAIL
- #define LETTERS (LASTLETTER - FIRSTLETTER)
-
- /* These are never part of the field[][] or board[][][] arrays
- (except METAL) */
- #define ORBTONGUE (LASTTAIL + 1)
- #define ORBARMOUR (LASTTAIL + 2)
- #define FIRSTFIRE (LASTTAIL + 3)
- #define LASTFIRE (LASTTAIL + 6)
- #define FIRSTMISSILE (LASTTAIL + 7)
- #define LASTMISSILE (LASTTAIL + 10)
- #define START (LASTTAIL + 11)
- #define MUSIC (LASTTAIL + 12)
- #define STICKY (LASTTAIL + 13)
- #define FX (LASTTAIL + 14)
- #define ZERO (LASTTAIL + 15)
- #define ONE (ZERO + 1)
- #define TWO (ZERO + 2)
- #define HEAD (ZERO + 10)
- #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 GREENMODEUP (HEAD + 16)
- #define REDMODEUP (HEAD + 17)
- #define BLUEMODEUP (HEAD + 18)
- #define YELLOWMODEUP (HEAD + 19)
- #define GREENMODEDOWN (HEAD + 20)
- #define REDMODEDOWN (HEAD + 21)
- #define BLUEMODEDOWN (HEAD + 22)
- #define YELLOWMODEDOWN (HEAD + 23)
- #define GREENMODELEFT (HEAD + 24)
- #define REDMODELEFT (HEAD + 25)
- #define BLUEMODELEFT (HEAD + 26)
- #define YELLOWMODELEFT (HEAD + 27)
- #define GREENMODERIGHT (HEAD + 28)
- #define REDMODERIGHT (HEAD + 29)
- #define BLUEMODERIGHT (HEAD + 30)
- #define YELLOWMODERIGHT (HEAD + 31)
- #define METAL (HEAD + 32)
- #define FIRSTDRIP (HEAD + 33)
- #define LASTDRIP (HEAD + 36)
- #define BLACKENED (HEAD + 37)
- #define WHITENED (HEAD + 38)
- #define ARRAYSIZE WHITENED
-
- #define ANYTHING FX
-
- // These have no imagery.
- #define TEMPTAIL (ARRAYSIZE + 1)
- #define TEMPWOOD TEMPTAIL
- #define TEMPSLIME TEMPTAIL
- #define TEMPSILVER (ARRAYSIZE + 2)
- #define TEMPGOLD (ARRAYSIZE + 3)
- #define NOSQUARE (ARRAYSIZE + 4)
-
- // game status
-
- #define GAMEOVER 0
- #define PLAYGAME 1
- #define FIELDEDIT 2
- #define TITLESCREEN 3
-
- // indicator locations
-
- #define CAUSEYDISTANCE 2 // distance from centre for cause
- #define LETTERYDISTANCE 3 // 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
- #define IBMPC AMIGA
-
- /* PROTOTYPES -------------------------------------------------------------
-
- engine.c(pp) */
-
- void align(STRPTR string, SBYTE size, TEXT filler);
- // right-justify a string within another string
- SWORD atleast(SWORD value, SWORD minimum);
- ABOOL blocked(SBYTE which, SBYTE deltax, SBYTE deltay);
- void bombblast(SBYTE triggerer, SBYTE player, SBYTE centrex, SBYTE centrey);
- void bouncekiller(SBYTE which, SBYTE x, SBYTE y);
- ABOOL bounceorb(SBYTE which, SBYTE x, SBYTE y);
- SBYTE bsign(SBYTE value);
- void changefield(void);
- void clearhiscores(void);
- void clearletters(void);
- void copyfield(SBYTE source, SBYTE destination);
- void death(void);
- void drawcause(SBYTE player, SBYTE state);
- void drawletter(SBYTE player, SBYTE letter, SBYTE state);
- void driploop(void);
- void enginesetup(void); // once-only initialization of engine variables
- void fastloop(void); // things done often
- void fillfield(SBYTE which);
- ABOOL findempty(SBYTE* x, SBYTE* y, SBYTE first, SBYTE last);
- void fragloop(void); // controls fragments
- void gameloop(void);
- void killall(void);
- void killerloop(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
- ABOOL loadfields(STRPTR pathname);
- void matchteleports(void);
- void missileloop(void); // controls missiles
- void newfield(void);
- void newfields(void);
- void newgame(void);
- void newhiscores(void);
- void newlevel(SBYTE player);
- void orbexplosion(SBYTE which);
- void orbloop(SBYTE which); // controls orbs
- void orbscore(SBYTE which, ULONG score);
- void orbsplit(SBYTE which);
- void orientworms(void);
- SBYTE partner(SBYTE which);
- void putletter(SBYTE player);
- void queue(SBYTE player, SBYTE deltax, SBYTE deltay);
- void ramming(SBYTE player);
- void reflect(SBYTE which, SBYTE iwhich);
- void renderboard(void);
- ABOOL savefields(STRPTR pathname);
- void saylevel(COLOUR colour);
- void setbrush(SBYTE newbrush);
- SBYTE slowdown(SBYTE speed); // halve worm's speed
- void slowloop(void); // things done rarely
- SBYTE speedup(SBYTE speed, ABOOL nitro);
- LONG squareblast(SBYTE type, SBYTE player, SBYTE thissy, SBYTE x, SBYTE y);
- void timeloop(void);
- void train(SCANCODE scancode);
- void turnworm(SBYTE player, SBYTE deltax, SBYTE deltay);
- void updatesquare(SBYTE x, SBYTE y);
- SBYTE valid(SBYTE x, SBYTE y);
- void whichfrag(SBYTE x, SBYTE y, SBYTE* whichptr, SBYTE* iwhichptr);
- SBYTE whichdrip(SBYTE x, SBYTE y);
- SBYTE whichkiller(SBYTE x, SBYTE y);
- SBYTE whichorb(SBYTE x, SBYTE y);
- SBYTE whichteleport(SBYTE x, SBYTE y);
- SBYTE whichtimebomb(SBYTE x, SBYTE y);
- void wormbullet(SBYTE player);
- void wormletter(SBYTE player, SBYTE thissy);
- void wormloop(SBYTE player); // controls worms and protectors
- void wormscore(SBYTE player, LONG score);
- SWORD wsign(SWORD value);
- SWORD xpixeltosquare(SWORD x);
- SWORD ypixeltosquare(SWORD y);
- SBYTE xwrap(SBYTE x);
- SBYTE ywrap(SBYTE y);
-
- // system.c(pp)
-
- ABOOL anykey(ABOOL timeout);
- ABOOL beginfx(void);
- void celebrate(void);
- void cleanexit(SLONG rc);
- void clearjoystick(void);
- void clearkybd(void);
- void clearstats(void);
- void dot(SBYTE x, SBYTE y);
- void draw(SBYTE x, SBYTE y, SBYTE image);
- ULONG effect(SBYTE index);
- void fileabout(void); // File|About... function
- void fileopen(void); // File|Open... function
- void filesaveas(ABOOL flag); // File|Save, File|Save As... functions
- void freefx(void);
- void gameinput(void);
- void hiscores(void);
- void loadthefx(void);
- void loadthemusic(void);
- void preserve(SWORD x, SBYTE row, SBYTE image, UWORD amount);
- void resettime(void);
- void rundown(SBYTE player);
- void say(STRPTR sentence, COLOUR colour);
- void sendreadrequest(void);
- void setpointer(SBYTE brush);
- void stat(SBYTE player, SBYTE line);
- void stopfx(ULONG receipt);
- void systemsetup(void);
- void timing(void);
- void titlescreen(void); // the title screen
- void toggle(SBYTE key);
- void underline(SBYTE brush);
- ABOOL verify(void);
- void waitasec(void);
- ABOOL ZOpen(STRPTR fieldname, ABOOL write);
- ABOOL ZRead(STRPTR IOBuffer, ULONG length);
- ABOOL ZWrite(STRPTR IOBuffer, ULONG length);
- ABOOL ZClose(void);
-
- // PUBLIC STRUCTURES ------------------------------------------------------
-
- AGLOBAL struct HiScoreStruct
- { SBYTE player, level;
- SLONG score; // the score itself
- TEXT name[NAMELENGTH + 1]; // name of the player
- ABOOL fresh; // is the entry new?
- };
- AGLOBAL struct OrbStruct
- { SBYTE x, y, deltax, deltay, oldx, oldy;
- ABOOL alive, moved, explode;
- SBYTE speed, mode, multi, last;
- SWORD armour, tongue;
- SLONG score;
- };
- AGLOBAL struct TeleportStruct
- { SBYTE x, y;
- ABOOL alive;
- };
- AGLOBAL struct WormStruct
- { SBYTE x, y, deltax, deltay, posidir, position, victor, cause,
- statx, staty, pos, multi, power, mode, last,
- levelreached;
- ABOOL affixer, alive, moved, nitro;
- UBYTE speed, control;
- SWORD armour, tongue, ammo, bias, ice, lives;
- SLONG score, oldscore;
- ULONG causewait;
- TEXT name[NAMELENGTH + 1];
- COLOUR colour;
- };
-
- // Must have blank line at EOF.
-