diff arogue7/rogue.h @ 125:adfa37e67084

Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
author John "Elwin" Edwards
date Fri, 08 May 2015 15:24:40 -0400
parents
children c697782a9b37
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arogue7/rogue.h	Fri May 08 15:24:40 2015 -0400
@@ -0,0 +1,1297 @@
+/*
+ * rogue.h - Rogue definitions and variable declarations
+ *
+ * Advanced Rogue
+ * Copyright (C) 1984, 1985, 1986 Michael Morgan, Ken Dalka and AT&T
+ * All rights reserved.
+ *
+ * Based on "Rogue: Exploring the Dungeons of Doom"
+ * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
+ * All rights reserved.
+ *
+ * See the file LICENSE.TXT for full copyright and licensing information.
+ */
+
+/*
+ * Rogue definitions and variable declarations
+ *
+ */
+
+#define reg register
+#undef lines /* AIX's term.h defines this, causing a conflict */
+#ifdef BSD
+#undef tolower(c)
+#define _tolower(c)	((c)-'A'+'a')
+extern char tolower();
+#undef toupper(c)
+#define _toupper(c)	((c)-'a'+'A')
+extern char toupper();
+#define strchr index
+
+#define exfork vfork	/* Better way to do a fork followed by an exec */
+#else
+#define exfork fork	/* Standard fork with no paging available */
+#endif
+
+/*
+ * Maximum number of different things
+ */
+#define MAXDAEMONS	10
+#define MAXFUSES	20
+#define	MAXROOMS	9
+#define	MAXTHINGS	9
+#define	MAXOBJ		9
+#define MAXSTATS	72	/* max total of all stats at startup */
+#define	MAXPACK		23
+#define MAXDOUBLE	14	/* Maximum number of times exppts is doubled */
+#define	MAXCONTENTS	10
+#define MAXENCHANT	10	/* max number of enchantments on an item */
+#define	MAXTREAS	15	/* number monsters/treasure in treasure room */
+#define	MAXTRAPS	25
+#define	MAXTRPTRY	8	/* attempts/level allowed for setting traps */
+#define	MAXDOORS	4	/* Maximum doors to a room */
+#define	MAXCHANTS	16	/* Maximum number of chants for a druid */
+#define	MAXPRAYERS	18	/* Maximum number of prayers for cleric */
+#define	MAXSPELLS	20	/* Maximum number of spells (for magician) */
+#define MAXQUILL	13	/* scrolls the Quill of Nagrom can write */
+#define QUILLCHARGES	160	/* max num of charges in the Quill of Nagrom */
+#define	NUMMONST	125	/* Current number of monsters */
+#define NUM_CNAMES	17	/* number of names per character level */
+#define NUMUNIQUE	27	/* number of UNIQUE creatures */
+#define	NLEVMONS	3	/* Number of new monsters per level */
+#define NUMSCORE	10	/* number of entries in score file */
+#define HARDER		35	/* at this level start making things harder */
+#define LINELEN		256	/* characters in a buffer */
+#define JUG_EMPTY	-1	/* signifys that the alchemy jug is empty */
+#define MAXPURCH	(pstats.s_charisma/3) /* # of purchases at post */
+
+/* Movement penalties */
+#define BACKPENALTY 3
+#define SHOTPENALTY 2		/* In line of sight of missile */
+#define DOORPENALTY 1		/* Moving out of current room */
+
+/*
+ * these defines are used in calls to get_item() to signify what
+ * it is we want
+ */
+#define	ALL		-1
+#define	WEARABLE	-2
+#define	CALLABLE	-3
+#define WIELDABLE	-4
+#define USEABLE		-5
+#define IDENTABLE	-6
+#define REMOVABLE	-7
+#define PROTECTABLE	-8
+#define ZAPPABLE	-9
+#define READABLE	-10
+#define QUAFFABLE	-11
+
+/*
+ * stuff to do with encumberance
+ */
+#define NORMENCB	1500	/* normal encumberance */
+#define F_SATIATED	 0	/* player's stomach is very full */
+#define F_OKAY		 1	/* have plenty of food in stomach */
+#define F_HUNGRY	 2	/* player is hungry */
+#define F_WEAK		 3	/* weak from lack of food */
+#define F_FAINT		 4	/* fainting from lack of food */
+
+/*
+ * actions a player/monster will take
+ */
+#define A_MOVE		0200	/* normal movement */
+#define A_FREEZE	0201	/* frozen in place */
+#define A_ATTACK	0202	/* trying to hit */
+#define A_SELL		0203	/* trying to sell goods */
+#define A_NIL		0204	/* not doing anything */
+#define A_BREATHE	0205	/* breathing */
+#define A_MISSILE	0206	/* Firing magic missiles */
+#define A_SONIC		0207	/* Sounding a sonic blast */
+#define A_SUMMON	0210	/* Summoning help */
+#define A_USERELIC	0211	/* Monster uses a relic */
+#define A_SLOW		0212	/* monster slows the player */
+#define A_ZAP		0213	/* monster shoots a wand */
+#define A_PICKUP	0214	/* player is picking something up */
+#define A_USEWAND	0215	/* monster is shooting a wand */
+#define A_THROW		't'
+#define C_CAST		'C'
+#define C_COUNT		'*'
+#define C_DIP		'D'
+#define C_DROP		'd'
+#define C_EAT		'e'
+#define C_PRAY		'p'
+#define C_CHANT		'c'
+#define C_QUAFF		'q'
+#define C_READ		'r'
+#define C_SEARCH	's'
+#define C_SETTRAP	'^'
+#define C_TAKEOFF	'T'
+#define C_USE		CTRL('U')
+#define C_WEAR		'W'
+#define C_WIELD		'w'
+#define C_ZAP		'z'
+
+/* Possible ways for the hero to move */
+#define	H_TELEPORT 0
+
+/*
+ * return values for get functions
+ */
+#define	NORM	0	/* normal exit */
+#define	QUIT	1	/* quit option setting */
+#define	MINUS	2	/* back up one option */
+
+/* 
+ * The character types
+ */
+#define	C_FIGHTER	0
+#define C_RANGER	1
+#define C_PALADIN	2
+#define	C_MAGICIAN	3
+#define	C_CLERIC	4
+#define	C_THIEF		5
+#define C_ASSASIN	6
+#define C_DRUID		7
+#define C_MONK		8
+#define	C_MONSTER	9
+#define NUM_CHARTYPES	10
+
+/*
+ * define the ability types
+ */
+#define	A_INTELLIGENCE	0
+#define	A_STRENGTH	1
+#define	A_WISDOM	2
+#define	A_DEXTERITY	3
+#define	A_CONSTITUTION	4
+#define	A_CHARISMA	5
+#define	NUMABILITIES	6
+
+/*
+ * values for games end
+ */
+#define UPDATE  -2
+#define SCOREIT -1
+#define KILLED 	 0
+#define CHICKEN  1
+#define WINNER   2
+
+/*
+ * definitions for function step_ok:
+ *	MONSTOK indicates it is OK to step on a monster -- it
+ *	is only OK when stepping diagonally AROUND a monster;
+ *	it is also OK if the stepper is a friendly monster and
+ *	is in a fighting mood.
+ */
+#define MONSTOK 1
+#define NOMONST 2
+#define	FIGHTOK 3
+
+/*
+ * used for ring stuff
+ */
+#define LEFT_1		 0
+#define LEFT_2		 1
+#define LEFT_3		 2
+#define LEFT_4		 3
+#define RIGHT_1		 4
+#define RIGHT_2		 5
+#define RIGHT_3		 6
+#define RIGHT_4		 7
+#define NUM_FINGERS	 8
+
+/*
+ * used for micellaneous magic (MM) stuff
+ */
+#define WEAR_BOOTS	0
+#define WEAR_BRACERS	1
+#define WEAR_CLOAK	2
+#define WEAR_GAUNTLET	3
+#define WEAR_JEWEL	4
+#define WEAR_NECKLACE	5
+#define NUM_MM		6
+
+/*
+ * All the fun defines
+ */
+#define next(ptr) (*ptr).l_next
+#define prev(ptr) (*ptr).l_prev
+#define ldata(ptr) (*ptr).l_data
+#define inroom(rp, cp) (\
+    (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && (rp)->r_pos.x <= (cp)->x \
+ && (cp)->y <= (rp)->r_pos.y + ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y)
+#define winat(y, x) (mvwinch(mw, y, x)==' '?mvwinch(stdscr, y, x):winch(mw))
+#define debug if (wizard) msg
+#define RN (((seed = seed*11109+13849) & 0x7fff) >> 1)
+#define unc(cp) (cp).y, (cp).x
+#define cmov(xy) move((xy).y, (xy).x)
+#define DISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
+#define OBJPTR(what)	(struct object *)((*what).l_data)
+#define THINGPTR(what)	(struct thing *)((*what).l_data)
+#define DOORPTR(what)	(coord *)((*what).l_data)
+#define when break;case
+#define otherwise break;default
+#define until(expr) while(!(expr))
+#define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
+#define draw(window) wrefresh(window)
+#define hero player.t_pos
+#define pstats player.t_stats
+#define max_stats player.maxstats
+#define pack player.t_pack
+#define attach(a, b) _attach(&a, b)
+#define detach(a, b) _detach(&a, b)
+#define o_free_list(a) _o_free_list(&a)
+#define r_free_list(a) _r_free_list(&a)
+#define t_free_list(a) _t_free_list(&a)
+#ifndef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+#define on(thing, flag) \
+    (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) != 0)
+#define off(thing, flag) \
+    (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) == 0)
+#define turn_on(thing, flag) \
+    ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & ~FLAGMASK))
+#define turn_off(thing, flag) \
+    ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~flag)
+
+#undef CTRL
+#define CTRL(ch) (ch & 037)
+
+#define ALLOC(x) calloc((unsigned int) x,1)
+#define FREE(x) free((char *) x)
+#define	EQSTR(a, b, c)	(strncmp(a, b, c) == 0)
+#define	EQUAL(a, b)	(strcmp(a, b) == 0)
+#define GOLDCALC (rnd(50 + 10 * level) + 2)
+#define ISRING(h, r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r)
+#define ISWEARING(r)	(ISRING(LEFT_1, r) || ISRING(LEFT_2, r) ||\
+			 ISRING(LEFT_3, r) || ISRING(LEFT_4, r) ||\
+			 ISRING(RIGHT_1, r) || ISRING(RIGHT_2, r) ||\
+			 ISRING(RIGHT_3, r) || ISRING(RIGHT_4, r))
+#define newgrp() ++group
+#define o_charges o_ac
+#define	o_kind o_ac
+#define ISMULT(type) (type == FOOD)
+#define isrock(ch) ((ch == WALL) || (ch == '-') || (ch == '|') || (ch == SECRETDOOR))
+#define invisible(monst) \
+	    (((on(*monst, ISINVIS) || \
+	       (on(*monst, ISSHADOW) && rnd(100) < 90)) && \
+	      off(player, CANSEE)) || \
+	     (on(*monst, CANSURPRISE) && !ISWEARING(R_ALERT)))
+#define is_stealth(tp) \
+    (rnd(25) < (tp)->t_stats.s_dext || (tp == &player && ISWEARING(R_STEALTH)))
+
+#define has_light(rp) (((rp)->r_flags & HASFIRE) || ISWEARING(R_LIGHT))
+
+#define mi_wght mi_worth
+#define mi_food mi_curse
+
+/*
+ * Ways to die
+ */
+#define	D_PETRIFY	-1
+#define	D_ARROW		-2
+#define	D_DART		-3
+#define	D_POISON	-4
+#define	D_BOLT		-5
+#define	D_SUFFOCATION	-6
+#define	D_POTION	-7
+#define	D_INFESTATION	-8
+#define D_DROWN		-9
+#define D_ROT		-10
+#define D_CONSTITUTION  -11
+#define D_STRENGTH	-12
+#define D_SIGNAL	-13
+#define D_CHOKE		-14
+#define D_STRANGLE	-15
+#define D_FALL		-16
+#define D_RELIC		-17
+#define D_STARVATION	-18
+#define D_FOOD_CHOKE	-19
+#define D_SCROLL	-20
+#define DEATHNUM	20	/* number of ways to die */
+
+/*
+ * Things that appear on the screens
+ */
+#define	WALL		' '
+#define	PASSAGE		'#'
+#define	DOOR		'+'
+#define	FLOOR		'.'
+#define VPLAYER 	'@'
+#define IPLAYER 	'_'
+#define	POST		'^'
+#define	TRAPDOOR	'>'
+#define	ARROWTRAP	'{'
+#define	SLEEPTRAP	'$'
+#define	BEARTRAP	'}'
+#define	TELTRAP		'~'
+#define	DARTTRAP	'`'
+#define POOL		'"'
+#define MAZETRAP	'\''
+#define	SECRETDOOR	'&'
+#define	STAIRS		'%'
+#define	GOLD		'*'
+#define	POTION		'!'
+#define	SCROLL		'?'
+#define	MAGIC		'$'
+#define	BMAGIC		'>'	/*	Blessed	magic	*/
+#define	CMAGIC		'<'	/*	Cursed	magic	*/
+#define	FOOD		':'
+#define	WEAPON		')'
+#define MISSILE		'*'	/*	Magic Missile	*/
+#define	ARMOR		']'
+#define	MM		';'
+#define RELIC		','
+#define	RING		'='
+#define	STICK		'/'
+#define FOREST		'\\'
+
+/*
+ * Various constants
+ */
+#define	PASSWD		"mTdNfNGDrwAZ."
+#define FIGHTBASE	10
+#define SPELLTIME	((max(30-pstats.s_lvl,5)))
+#define	BEARTIME	17
+#define CLOAK_TIME	(roll(20,20))
+#define	SLEEPTIME	7
+#define	FREEZETIME	11
+#define PAINTIME	(roll(2, 12))
+#define	HEALTIME	30
+#define	CHILLTIME	(roll(20, 4))
+#define	SMELLTIME	20
+#define	STONETIME	(roll(10,2))
+#define HASTETIME	11
+#define	SICKTIME	25
+#define	WANDERTIME	(max(5, (HARDER*2)-rnd(vlevel)))
+#define	BEFORE		1
+#define	AFTER		2
+#define	HUHDURATION	(50+rnd(30))
+#define	SEEDURATION	850
+#define SKILLDURATION	(100+rnd(50))
+#define	CLRDURATION	50
+#define GONETIME	200
+#define FIRETIME	(200+roll(5,5))
+#define COLDTIME	(200+roll(5,5))
+#define BOLTTIME	(200+roll(5,5))
+#define FLYTIME		300
+#define DUSTTIME	(30+roll(5,10))
+#define	PHASEDURATION	300
+#define	MORETIME	100
+#define	STINKTIME	16
+#define	STOMACHSIZE	1500
+#define	ESCAPE		27
+#define	BOLT_LENGTH	10
+#define	MARKLEN		20
+#define DAYLENGTH	400
+#define ALCHEMYTIME	(400+rnd(150))
+
+/*
+ * Save against things
+ */
+#define	VS_POISON		00
+#define	VS_PARALYZATION		00
+#define	VS_DEATH		00
+#define	VS_PETRIFICATION	01
+#define	VS_WAND			02
+#define	VS_BREATH		03
+#define	VS_MAGIC		04
+
+/*
+ * attributes for treasures in dungeon
+ */
+#define ISCURSED     	       01
+#define ISKNOW      	       02
+#define ISPOST		       04	/* object is in a trading post */
+#define	ISMETAL     	      010
+#define ISPROT		      020	/* object is protected */
+#define ISBLESSED     	      040
+#define ISPOISON	     0100
+#define ISMISL      	   020000
+#define ISMANY     	   040000
+/*
+ * Various flag bits
+ */
+#define ISDARK	    	       01
+#define ISGONE	    	       02
+#define	ISTREAS     	       04
+#define ISFOUND     	      010
+#define ISTHIEFSET	      020
+#define FORCEDARK	      040
+/*
+ * 1st set of creature flags (this might include player)
+ */
+#define ISBLIND		0x00000001
+#define	ISINWALL     	0x00000002
+#define ISRUN		0x00000004
+#define	ISFLEE		0x00000008
+#define ISINVIS		0x00000010
+#define ISMEAN		0x00000020
+#define ISGREED		0x00000040
+#define CANSHOOT	0x00000080
+#define ISHELD		0x00000100
+#define ISHUH		0x00000200
+#define ISREGEN		0x00000400
+#define CANHUH		0x00000800
+#define CANSEE		0x00001000
+#define HASFIRE		0x00002000
+#define ISSLOW		0x00004000
+#define ISHASTE		0x00008000
+#define ISCLEAR		0x00010000
+#define CANINWALL	0x00020000
+#define ISDISGUISE	0x00040000
+#define CANBLINK	0x00080000
+#define CANSNORE	0x00100000
+#define HALFDAMAGE	0x00200000
+#define	CANSUCK		0x00400000
+#define	CANRUST		0x00800000
+#define	CANPOISON	0x01000000
+#define	CANDRAIN	0x02000000
+#define ISUNIQUE	0x04000000
+#define	STEALGOLD	0x08000000
+/* 
+ * Second set of flags 
+ */
+#define	STEALMAGIC	0x10000001
+#define	CANDISEASE	0x10000002
+#define HASDISEASE	0x10000004
+#define CANSUFFOCATE	0x10000008
+#define DIDSUFFOCATE	0x10000010
+#define BOLTDIVIDE	0x10000020
+#define BLOWDIVIDE	0x10000040
+#define NOCOLD		0x10000080
+#define	TOUCHFEAR	0x10000100
+#define BMAGICHIT	0x10000200
+#define NOFIRE		0x10000400
+#define NOBOLT		0x10000800
+#define CARRYGOLD	0x10001000
+#define CANITCH		0x10002000
+#define HASITCH		0x10004000
+#define DIDDRAIN	0x10008000
+#define WASTURNED	0x10010000
+#define CANSELL		0x10020000
+#define CANBLIND	0x10040000
+#define NOACID		0x10080000
+#define NOSLOW		0x10100000
+#define NOFEAR		0x10200000
+#define NOSLEEP		0x10400000
+#define NOPARALYZE	0x10800000
+#define NOGAS		0x11000000
+#define CANMISSILE	0x12000000
+#define CMAGICHIT	0x14000000
+#define CANPAIN		0x18000000
+
+/* 
+ * Third set of flags 
+ */
+#define CANSLOW		0x20000001
+#define CANTUNNEL	0x20000002
+#define TAKEWISDOM	0x20000004
+#define NOMETAL		0x20000008
+#define MAGICHIT	0x20000010
+#define CANINFEST	0x20000020
+#define HASINFEST	0x20000040
+#define NOMOVE		0x20000080
+#define CANSHRIEK	0x20000100
+#define CANDRAW		0x20000200
+#define CANSMELL	0x20000400
+#define CANPARALYZE	0x20000800
+#define CANROT		0x20001000
+#define ISSCAVENGE	0x20002000
+#define DOROT		0x20004000
+#define CANSTINK	0x20008000
+#define HASSTINK	0x20010000
+#define ISSHADOW	0x20020000
+#define CANCHILL	0x20040000
+#define	CANHUG		0x20080000
+#define CANSURPRISE	0x20100000
+#define CANFRIGHTEN	0x20200000
+#define CANSUMMON	0x20400000
+#define TOUCHSTONE	0x20800000
+#define LOOKSTONE	0x21000000
+#define CANHOLD		0x22000000
+#define DIDHOLD		0x24000000
+#define DOUBLEDRAIN	0x28000000
+
+/* 
+ * Fourth set of flags 
+ */
+#define CANBRANDOM	0x30000001	/* Types of breath */
+#define CANBACID	0x30000002	/* acid */
+#define CANBFIRE	0x30000004	/* Fire */
+#define CANBCGAS	0x30000008	/* confusion gas */
+#define CANBBOLT	0x30000010	/* lightning bolt */
+#define CANBGAS		0x30000020	/* clorine gas */
+#define CANBICE		0x30000040	/* ice */
+#define CANBFGAS	0x30000080	/* Fear gas */
+#define CANBPGAS	0x30000100	/* Paralyze gas */
+#define CANBSGAS	0x30000200	/* Sleeping gas */
+#define CANBSLGAS	0x30000400	/* Slow gas */
+#define CANBREATHE	0x300007ff	/* Can it breathe at all? */
+/*
+ * Fifth set of flags
+ */
+#define ISUNDEAD	0x40000001
+#define CANSONIC	0x40000002
+#define TURNABLE	0x40000004
+#define TAKEINTEL	0x40000008
+#define NOSTAB		0x40000010
+#define CANDISSOLVE	0x40000020
+#define ISFLY		0x40000040	/* creature can fly */
+#define CANTELEPORT	0x40000080	/* creature can teleport */
+#define CANEXPLODE	0x40000100	/* creature explodes when hit */
+#define CANDANCE	0x40000200	/* creature can make hero "dance" */
+#define ISDANCE		0x40000400	/* creature (hero) is dancing */
+#define CARRYFOOD	0x40000800
+#define CARRYSCROLL	0x40001000
+#define CARRYPOTION	0x40002000
+#define CARRYRING	0x40004000
+#define CARRYSTICK	0x40008000
+#define CARRYMISC	0x40010000
+#define CARRYMDAGGER	0x40020000	/* Dagger of Musty */
+#define CARRYCLOAK	0x40040000	/* Cloak of Emori */
+#define CARRYANKH	0x40080000	/* Ankh of Heil */
+#define CARRYSTAFF	0x40100000	/* Staff of Ming */
+#define CARRYWAND	0x40200000	/* Wand of Orcus */
+#define	CARRYROD	0x40400000	/* Rod of Asmodeus */
+#define	CARRYYAMULET	0x40800000	/* Amulet of Yendor */
+#define	CARRYMANDOLIN	0x41000000	/* Mandolin of Brian */
+#define MISSEDDISP	0x42000000	/* Missed Cloak of Displacement */
+#define CANBSTAB	0x44000000	/* Can backstab */
+#define ISGUARDIAN	0x48000000	/* Guardian of a treasure room */
+
+
+#define CARRYHORN	0x50000001	/* Horn of Geryon */
+#define CARRYMSTAR	0x50000002	/* Morning Star of Hruggek */
+#define CARRYFLAIL	0x50000004	/* Flail of Yeenoghu */
+#define CARRYWEAPON	0x50000008	/* A generic weapon */
+#define CANAGE		0x50000010	/* can age you */
+#define CARRYDAGGER	0x50000020	/* carry's a dumb old dagger */
+#define AREMANY		0x50000040	/* they come in droves */
+#define CARRYEYE	0x50000080	/* has the eye of Vecna */
+#define HASSUMMONED	0x50000100	/* has already summoned */
+#define ISSTONE		0x50000200	/* has been turned to stone */
+#define NODETECT	0x50000400	/* detect monster will not show him */
+#define NOSTONE		0x50000800	/* creature made its save vrs stone */
+#define CARRYQUILL	0x50001000	/* has the quill of Nagrom */
+#define CARRYAXE	0x50002000	/* has the axe of Aklad */
+#define TOUCHSLOW	0x50004000	/* touch will slow hero */
+#define WASDISRUPTED	0x50008000	/* creature was disrupted by player */
+#define	CARRYARMOR	0x50010000	/* creature will pick up armor */
+#define CARRYBAMULET	0x50020000	/* amulet of skoraus stonebones */
+#define CARRYSURTURRING	0x50040000	/* ring of Surtur */
+#define	ISCHARMED	0x50080000	/* is the monster charmed? */
+#define	ISFRIENDLY	0x50080000	/* monster friendly for any reason? */
+
+#define ISREADY		0x60000001
+#define ISDEAD		0x60000002
+#define ISELSEWHERE	0x60000004
+
+/* Masks for choosing the right flag */
+#define FLAGMASK     0xf0000000
+#define FLAGINDEX    0x0000000f
+#define FLAGSHIFT    28
+#define MAXFLAGS     25			/* max initial flags per creature */
+
+/* 
+ * Mask for cancelling special abilities 
+ * The flags listed here will be the ones left on after the
+ * cancellation takes place
+ */
+#define CANC0MASK (	ISBLIND		| ISINWALL	| ISRUN		| \
+			ISFLEE		| ISMEAN	| ISGREED	| \
+			CANSHOOT	| ISHELD	| ISHUH		| \
+			ISSLOW		| ISHASTE	| ISCLEAR	| \
+			ISUNIQUE )
+#define CANC1MASK (	HASDISEASE	| DIDSUFFOCATE	| CARRYGOLD 	| \
+			HASITCH		| CANSELL 	| DIDDRAIN	| \
+			WASTURNED )
+#define CANC2MASK (	HASINFEST	| NOMOVE	| ISSCAVENGE	| \
+			DOROT		| HASSTINK	| DIDHOLD )
+#define CANC3MASK (	CANBREATHE )
+#define CANC4MASK (	ISUNDEAD	| CANSONIC	| NOSTAB	| \
+			ISFLY		| CARRYFOOD	| CANEXPLODE	| \
+			ISDANCE		| CARRYSCROLL	| CARRYPOTION	| \
+			CARRYRING	| CARRYSTICK	| CARRYMISC	| \
+			CARRYMDAGGER	| CARRYCLOAK	| CARRYANKH	| \
+			CARRYSTAFF	| CARRYWAND	| CARRYROD	| \
+			CARRYYAMULET	| CARRYMANDOLIN | ISGUARDIAN )
+#define CANC5MASK (	CARRYHORN	| CARRYMSTAR 	| CARRYFLAIL	| \
+			CARRYEYE	| CARRYDAGGER	| HASSUMMONED	| \
+			AREMANY		| CARRYWEAPON	| NOSTONE	| \
+			CARRYQUILL	| CARRYAXE	| WASDISRUPTED	| \
+			CARRYARMOR	| CARRYBAMULET 	| CARRYSURTURRING )
+#define CANC6MASK ( 0 )
+#define CANC7MASK ( 0 )
+#define CANC8MASK ( 0 )
+#define CANC9MASK ( 0 )
+#define CANCAMASK ( 0 )
+#define CANCBMASK ( 0 )
+#define CANCCMASK ( 0 )
+#define CANCDMASK ( 0 )
+#define CANCEMASK ( 0 )
+#define CANCFMASK ( 0 )
+
+/* types of things */
+#define TYP_POTION	0
+#define TYP_SCROLL	1
+#define TYP_FOOD	2
+#define TYP_WEAPON	3
+#define TYP_ARMOR	4
+#define TYP_RING	5
+#define TYP_STICK	6
+#define TYP_MM		7