1 /* File: defines.h */
2 
3 /* Purpose: global constants and macro definitions */
4 
5 
6 /*
7  * Do not edit this file unless you know *exactly* what you are doing.
8  *
9  * Some of the values in this file were chosen to preserve game balance,
10  * while others are hard-coded based on the format of old save-files, the
11  * definition of arrays in various places, mathematical properties, fast
12  * computation, storage limits, or the format of external text files.
13  *
14  * Changing some of these values will induce crashes or memory errors or
15  * savefile mis-reads.  Most of the comments in this file are meant as
16  * reminders, not complete descriptions, and even a complete knowledge
17  * of the source may not be sufficient to fully understand the effects
18  * of changing certain definitions.
19  *
20  * Lastly, note that the code does not always use the symbolic constants
21  * below, and sometimes uses various hard-coded values that may not even
22  * be defined in this file, but which may be related to definitions here.
23  * This is of course bad programming practice, but nobody is perfect...
24  *
25  * You have been warned.
26  */
27 
28 
29 /*
30  * Name of the version/variant
31  */
32 #define VERSION_NAME "ZAngband"
33 
34 /* Savefile version */
35 #define SAVEFILE_VERSION 52
36 
37 /* User-visible version */
38 #define VER_MAJOR 2
39 #define VER_MINOR 7
40 #define VER_PATCH 5
41 #define VER_EXTRA 0
42 
43 /* Versions after release */
44 #define VER_AFTER "pre1"
45 
46 /* Stringify argument */
47 #define Z_STR(a) Z_STR1(a)
48 
49 #define Z_STR1(a)\
50 	# a
51 
52 /* Pre-release version string */
53 #if VER_EXTRA != 0
54 	#define PRE_VERSION \
55 		"pre" Z_STR(VER_EXTRA)
56 #else
57 	#define PRE_VERSION
58 #endif /* VER_EXTRA != 0 */
59 
60 
61 /*
62  * Current version string
63  */
64 #define VERSION_STRING \
65 	Z_STR(VER_MAJOR) "." Z_STR(VER_MINOR) "." Z_STR(VER_PATCH) PRE_VERSION VER_AFTER
66 
67 #define ANGBAND_2_8_1
68 #define ZANGBAND
69 #define ZANGBAND_BIGSCREEN
70 #define ZANGBAND_WILDERNESS
71 /* hack - define if the source contains the cleanup_angband() function. */
72 #define HAS_CLEANUP
73 
74 
75 /* Debug modes depend on version */
76 
77 /* Dev version? */
78 #if ((VER_MINOR == 1) || (VER_MINOR == 3) || (VER_MINOR == 5) || \
79     (VER_MINOR == 7) || (VER_MINOR == 9))
80 
81 #define DEBUG
82 #endif /* Dev version */
83 
84 /* Alpha testing */
85 #if (VER_EXTRA != 0)
86 #define DEBUG_ALPHA
87 
88 #ifndef DEBUG
89 #define DEBUG
90 #endif /*  !DEBUG */
91 
92 #endif /* Pre version */
93 
94 /* Turn off assert if not debugging */
95 #ifndef DEBUG
96 #undef assert
97 #define assert(ignore)	((void) 0)
98 #endif /* !DEBUG */
99 
100 
101 /*
102  * The maximum number of players we support
103  */
104 #define MAX_PLAYERS		1
105 
106 /*
107  * Maximum amount of Angband windows.
108  */
109 #define ANGBAND_TERM_MAX 8
110 
111 /*
112  * Maximum of different windows
113  */
114 #define WINDOW_CHOICE_MAX	15
115 
116 /*
117  * Number of grids in each block (vertically)
118  */
119 #define BLOCK_HGT	11
120 
121 /*
122  * Number of grids in each block (horizontally)
123  */
124 #define BLOCK_WID	11
125 
126 /*
127  * Maximum dungeon height in grids.
128  */
129 #define MAX_HGT         66
130 
131 /*
132  * Maximum dungeon width in grids.
133  */
134 #define MAX_WID         198
135 
136 
137 /*
138  * Script triggers
139  */
140 #define MAX_TRIGGER     10
141 
142 #define TRIGGER_USE     0
143 #define TRIGGER_MAKE    1
144 #define TRIGGER_BONUS   2
145 #define TRIGGER_SMASH   3
146 #define TRIGGER_DESC	4
147 #define TRIGGER_TIMED   5
148 #define TRIGGER_HIT     6
149 #define TRIGGER_ATTACK  7
150 #define TRIGGER_ALTER   8
151 #define TRIGGER_SPOIL   9
152 
153 
154 /*
155  * Defines used by the wilderness data structures
156  */
157 
158 /* Size of wilderness in blocks */
159 #define WILD_SIZE		129
160 
161 /* Size of blocks - hard coded. (Affects size of towns) */
162 #define WILD_BLOCK_SIZE	16
163 
164 /* Number of blocks the player can see at one time */
165 #define WILD_VIEW		9
166 
167 /* Number of blocks of wilderness cache */
168 #define WILD_CACHE		(MAX_PLAYERS * WILD_VIEW * WILD_VIEW * 2)
169 
170 
171 /* Hack XXX  Start of the sea types = 2^16 - 65*/
172 #define WILD_SEA	65471
173 
174 /* Town types */
175 #define TOWN_OLD		1
176 #define TOWN_FRACT		2
177 #define TOWN_QUEST		3
178 #define TOWN_DUNGEON    4
179 
180 /*
181  * Quest type
182  */
183 #define QUEST_TYPE_NONE				0
184 #define QUEST_TYPE_BOUNTY			1
185 #define QUEST_TYPE_DUNGEON			2
186 #define QUEST_TYPE_WILD				3
187 #define QUEST_TYPE_MESSAGE			4
188 #define QUEST_TYPE_FIND_ITEM		5
189 #define QUEST_TYPE_FIND_PLACE		6
190 
191 
192 
193 /*
194  * Quest creation types
195  */
196 #define QC_NONE					0
197 #define QC_DUN_MONST			1
198 #define QC_DUN_ARTIFACT			2
199 
200 
201 /*
202  * Quest action triggers
203  */
204 #define QX_NONE					0
205 #define QX_KILL_MONST			1
206 #define QX_KILL_UNIQUE			2
207 #define QX_KILL_WINNER			3
208 #define QX_WILD_ENTER			4
209 #define QX_KNOW_ARTIFACT		5
210 #define QX_FIND_SHOP			6
211 
212 /*
213  * Mega Hack XXX XXX Info for winner quest
214  */
215 #define QW_OBERON				860
216 #define QW_SERPENT				862
217 
218 
219 /* Number of gates in the city */
220 #define MAX_GATES				4
221 
222 /* Maximum length of town name + '/0' */
223 #define T_NAME_LEN	18
224 
225 
226 /*
227  * Total number of stores in vanilla town (see "store.c", etc)
228  */
229 #define MAX_STORES      9
230 
231 
232 /*
233  * Total number of stores with stock (see "store.c", etc)
234  */
235 #define STORE_CACHE_AMNT 100
236 
237 
238 /*
239  * Total number of owners per store (see "store.c", etc)
240  */
241 #define MAX_OWNERS			32
242 
243 
244 /*
245  * Total number of buildings (see "bldg.c", etc)
246  */
247 #define MAX_BLDG			10
248 
249 /* List of building types */
250 #define	BUILD_STORE_GENERAL		0
251 #define BUILD_STORE_ARMOURY		1
252 #define BUILD_STORE_WEAPON		2
253 #define BUILD_STORE_TEMPLE		3
254 #define BUILD_STORE_ALCHEMIST	4
255 #define BUILD_STORE_MAGIC		5
256 #define BUILD_STORE_BLACK		6
257 #define BUILD_STORE_HOME		7
258 #define BUILD_STORE_BOOK		8
259 #define BUILD_STAIRS			9
260 #define BUILD_WEAPONMASTER		10
261 #define BUILD_RECHARGE			11
262 #define BUILD_PLUS_WEAPON		12
263 #define BUILD_PLUS_ARMOUR		13
264 #define BUILD_MUTATE			14
265 #define BUILD_NONE				15
266 #define BUILD_BLANK				16
267 #define BUILD_MAP				17
268 #define BUILD_WEAPON1			18
269 #define BUILD_WEAPON2			19
270 #define BUILD_WEAPON3			20
271 #define BUILD_WEAPON4			21
272 #define BUILD_WEAPON5			22
273 #define BUILD_ARMOUR1			23
274 #define BUILD_ARMOUR2			24
275 #define BUILD_ARMOUR3			25
276 #define BUILD_ARMOUR4			26
277 #define BUILD_ARMOUR5			27
278 #define BUILD_SWORD0			28
279 #define BUILD_SWORD1			29
280 #define BUILD_SWORD2			30
281 #define BUILD_SWORD3			31
282 #define BUILD_SWORD4			32
283 #define BUILD_SWORD5			33
284 #define BUILD_SHIELD0			34
285 #define BUILD_SHIELD1			35
286 #define BUILD_SHIELD2			36
287 #define BUILD_SHIELD3			37
288 #define BUILD_SHIELD4			38
289 #define BUILD_SHIELD5			39
290 #define BUILD_AXE0				40
291 #define BUILD_AXE1				41
292 #define BUILD_AXE2				42
293 #define BUILD_AXE3				43
294 #define BUILD_AXE4				44
295 #define BUILD_AXE5				45
296 #define BUILD_AMMO0				46
297 #define BUILD_AMMO1				47
298 #define BUILD_AMMO2				48
299 #define BUILD_FLET0				49
300 #define BUILD_FLET1				50
301 #define BUILD_FLET2				51
302 #define BUILD_FLET3				52
303 #define BUILD_WARHALL0			53
304 #define BUILD_WARHALL1			54
305 #define BUILD_WARHALL2			55
306 #define BUILD_WARHALL3			56
307 #define BUILD_WARHALL4			57
308 #define BUILD_WARHALL5			58
309 #define BUILD_CLOTH0			59
310 #define BUILD_CLOTH1			60
311 #define BUILD_HARMOUR0			61
312 #define BUILD_HARMOUR1			62
313 #define BUILD_HARMOUR2			63
314 #define BUILD_HARMOUR3			64
315 #define BUILD_HARMOUR4			65
316 #define BUILD_HARMOUR5			66
317 #define BUILD_HAT0				67
318 #define BUILD_HAT1				68
319 #define BUILD_HAT2				69
320 #define BUILD_HAT3				70
321 #define BUILD_JEWEL0			71
322 #define BUILD_JEWEL1			72
323 #define BUILD_JEWEL2			73
324 #define BUILD_JEWEL3			74
325 #define BUILD_JEWEL4			75
326 #define BUILD_STATUE0			76
327 #define BUILD_STATUE1			77
328 #define BUILD_FIGUR0			78
329 #define BUILD_FIGUR1			79
330 #define BUILD_POTION0			80
331 #define BUILD_POTION1			81
332 #define BUILD_POTION2			82
333 #define BUILD_POTION3			83
334 #define BUILD_POTION4			84
335 #define BUILD_SCROLL0			85
336 #define BUILD_SCROLL1			86
337 #define BUILD_SCROLL2			87
338 #define BUILD_SCROLL3			88
339 #define BUILD_SCROLL4			89
340 #define BUILD_MAGIC0			90
341 #define BUILD_MAGIC1			91
342 #define BUILD_MAGIC2			92
343 #define BUILD_MAGIC3			93
344 #define BUILD_MAGIC4			94
345 #define BUILD_BOOK1				95
346 #define BUILD_TEMPLE1			96
347 #define BUILD_TEMPLE2			97
348 #define BUILD_TEMPLE3			98
349 #define BUILD_SUPPLIES0			99
350 #define BUILD_SUPPLIES1			100
351 #define BUILD_BLACK1			101
352 #define BUILD_BLACK2			102
353 #define BUILD_ALCHEMY1			103
354 #define BUILD_ALCHEMY2			104
355 #define BUILD_JUNK				105
356 #define BUILD_FOOD				106
357 #define BUILD_LIBRARY			107
358 #define BUILD_CASINO			108
359 #define BUILD_INN				109
360 #define BUILD_HEALER			110
361 #define BUILD_BLACK0            111
362 #define BUILD_MAGETOWER0        112
363 #define BUILD_MAGETOWER1        113
364 #define BUILD_CASTLE0			114
365 #define BUILD_CASTLE1			115
366 
367 /* Maximum number of "building" types in a city */
368 #define MAX_CITY_BUILD			116
369 
370 
371 /*
372  * Total number of owners per building (see "bldg.c", etc)
373  */
374 #define MAX_B_OWN			5
375 
376 
377 /*
378  * Store constants
379  */
380 #define STORE_INVEN_MAX 24		/* Max number of discrete objs in inven */
381 
382 #define STORE_TURNOVER  9		/* Normal shop turnover, per day */
383 #define STORE_MIN_KEEP1 6		/* Min slots to "always" keep full */
384 #define STORE_MAX_KEEP1 18		/* Max slots to "always" keep full */
385 #define STORE_MIN_KEEP2 3		/* Min slots to "always" keep full */
386 #define STORE_MAX_KEEP2 9		/* Max slots to "always" keep full */
387 #define STORE_SHUFFLE   21		/* 1/Chance (per day) of an owner changing */
388 #define STORE_TURNS     1000	/* Number of turns between turnovers */
389 
390 /* Store extra flags */
391 #define ST_REST_BLESSED		0x01	/* Blessed items */
392 #define ST_REST_GOOD		0x02	/* Good items only */
393 #define ST_REST_GREAT		0x04	/* Great items only */
394 #define ST_HALF_INVEN		0x08	/* One page of inventory */
395 #define ST_GREED			0x10	/* Double prices */
396 #define ST_ULTRA_GREED		0x20	/* Quadruple prices */
397 
398 
399 
400 /*
401  * Maximum number of player "sex" types (see "table.c", etc)
402  */
403 #define MAX_SEXES           2
404 
405 /*
406  * Maximum number of player "class" types (see "table.c", etc)
407  */
408 #define MAX_CLASS           11
409 
410 /* The number of "patrons" available (for Chaos Warriors) */
411 #define MAX_PATRON          16
412 
413 /* Number of entries in the sanity-blast descriptions */
414 #define MAX_SAN_HORROR		20
415 #define MAX_SAN_FUNNY		22
416 #define MAX_SAN_COMMENT		5
417 
418 /* Chaos Warrior: Reward types: */
419 #define REW_POLY_SLF    1
420 #define REW_GAIN_EXP    2
421 #define REW_LOSE_EXP    3
422 #define REW_GOOD_OBJ    4
423 #define REW_GREA_OBJ    5
424 #define REW_CHAOS_WP    6
425 #define REW_GOOD_OBS    7
426 #define REW_GREA_OBS    8
427 #define REW_TY_CURSE    9
428 #define REW_SUMMON_M    10
429 #define REW_H_SUMMON    11
430 #define REW_DO_HAVOC    12
431 #define REW_GAIN_ABL    13
432 #define REW_LOSE_ABL    14
433 #define REW_RUIN_ABL    15
434 #define REW_AUGM_ABL    16
435 #define REW_POLY_WND    17
436 #define REW_HEAL_FUL    18
437 #define REW_HURT_LOT    19
438 #define REW_CURSE_WP    20
439 #define REW_CURSE_AR    21
440 #define REW_PISS_OFF    22
441 #define REW_WRATH       23
442 #define REW_DESTRUCT    24
443 #define REW_GENOCIDE    25
444 #define REW_MASS_GEN    26
445 #define REW_DISPEL_C    27
446 #define REW_UNUSED_1    28
447 #define REW_UNUSED_2    29
448 #define REW_UNUSED_3    30
449 #define REW_UNUSED_4    31
450 #define REW_UNUSED_5    32
451 #define REW_IGNORE      33
452 #define REW_SER_UNDE    34
453 #define REW_SER_DEMO    35
454 #define REW_SER_MONS    36
455 
456 /* Chaos mutations */
457 #define MUT_SETS_MAX	 3
458 #define MUT_PER_SET		32
459 
460 
461 /* "Activatable" mutations must be in MUT1_* */
462 #define MUT1_SPIT_ACID                  0x00000001L
463 #define MUT1_BR_FIRE                    0x00000002L
464 #define MUT1_HYPN_GAZE                  0x00000004L
465 #define MUT1_TELEKINES                  0x00000008L
466 #define MUT1_VTELEPORT                  0x00000010L	/* Voluntary teleport */
467 #define MUT1_MIND_BLST                  0x00000020L
468 #define MUT1_RADIATION                  0x00000040L
469 #define MUT1_VAMPIRISM                  0x00000080L
470 #define MUT1_SMELL_MET                  0x00000100L
471 #define MUT1_SMELL_MON                  0x00000200L
472 #define MUT1_BLINK                      0x00000400L
473 #define MUT1_EAT_ROCK                   0x00000800L
474 #define MUT1_SWAP_POS                   0x00001000L
475 #define MUT1_SHRIEK                     0x00002000L
476 #define MUT1_ILLUMINE                   0x00004000L
477 #define MUT1_DET_CURSE                  0x00008000L
478 #define MUT1_BERSERK                    0x00010000L
479 #define MUT1_POLYMORPH                  0x00020000L
480 #define MUT1_MIDAS_TCH                  0x00040000L
481 #define MUT1_GROW_MOLD                  0x00080000L
482 #define MUT1_RESIST                     0x00100000L
483 #define MUT1_EARTHQUAKE                 0x00200000L
484 #define MUT1_EAT_MAGIC                  0x00400000L
485 #define MUT1_WEIGH_MAG                  0x00800000L
486 #define MUT1_STERILITY                  0x01000000L
487 #define MUT1_PANIC_HIT                  0x02000000L
488 #define MUT1_DAZZLE                     0x04000000L
489 #define MUT1_LASER_EYE                  0x08000000L
490 #define MUT1_RECALL                     0x10000000L
491 #define MUT1_BANISH                     0x20000000L
492 #define MUT1_COLD_TOUCH                 0x40000000L
493 #define MUT1_LAUNCHER                   0x80000000L
494 
495 /* Randomly activating mutations must be MUT2_* */
496 #define MUT2_BERS_RAGE                  0x00000001L
497 #define MUT2_COWARDICE                  0x00000002L
498 #define MUT2_RTELEPORT                  0x00000004L	/* Random teleport */
499 #define MUT2_ALCOHOL                    0x00000008L
500 #define MUT2_HALLU                      0x00000010L
501 #define MUT2_FLATULENT                  0x00000020L
502 #define MUT2_SCOR_TAIL                  0x00000040L
503 #define MUT2_HORNS                      0x00000080L
504 #define MUT2_BEAK                       0x00000100L
505 #define MUT2_ATT_DEMON                  0x00000200L
506 #define MUT2_PROD_MANA                  0x00000400L
507 #define MUT2_SPEED_FLUX                 0x00000800L
508 #define MUT2_BANISH_ALL                 0x00001000L
509 #define MUT2_EAT_LIGHT                  0x00002000L
510 #define MUT2_TRUNK                      0x00004000L
511 #define MUT2_ATT_ANIMAL                 0x00008000L
512 #define MUT2_TENTACLES                  0x00010000L
513 #define MUT2_RAW_CHAOS                  0x00020000L
514 #define MUT2_NORMALITY                  0x00040000L
515 #define MUT2_WRAITH                     0x00080000L
516 #define MUT2_POLY_WOUND                 0x00100000L
517 #define MUT2_WASTING                    0x00200000L
518 #define MUT2_ATT_DRAGON                 0x00400000L
519 #define MUT2_WEIRD_MIND                 0x00800000L
520 #define MUT2_NAUSEA                     0x01000000L
521 #define MUT2_CHAOS_GIFT                 0x02000000L
522 #define MUT2_WALK_SHAD                  0x04000000L
523 #define MUT2_WARNING                    0x08000000L
524 #define MUT2_INVULN                     0x10000000L
525 #define MUT2_SP_TO_HP                   0x20000000L
526 #define MUT2_HP_TO_SP                   0x40000000L
527 #define MUT2_DISARM                     0x80000000L
528 
529 
530 
531 /* Other mutations will be mainly in MUT3_* */
532 
533 #define MUT3_HYPER_STR                  0x00000001L
534 #define MUT3_PUNY                       0x00000002L
535 #define MUT3_HYPER_INT                  0x00000004L
536 #define MUT3_MORONIC                    0x00000008L
537 #define MUT3_RESILIENT                  0x00000010L
538 #define MUT3_XTRA_FAT                   0x00000020L
539 #define MUT3_ALBINO                     0x00000040L
540 #define MUT3_FLESH_ROT                  0x00000080L
541 #define MUT3_SILLY_VOI                  0x00000100L
542 #define MUT3_BLANK_FAC                  0x00000200L
543 #define MUT3_ILL_NORM                   0x00000400L
544 #define MUT3_XTRA_EYES                  0x00000800L
545 #define MUT3_MAGIC_RES                  0x00001000L
546 #define MUT3_XTRA_NOIS                  0x00002000L
547 #define MUT3_INFRAVIS                   0x00004000L
548 #define MUT3_XTRA_LEGS                  0x00008000L
549 #define MUT3_SHORT_LEG                  0x00010000L
550 #define MUT3_ELEC_TOUC                  0x00020000L
551 #define MUT3_FIRE_BODY                  0x00040000L
552 #define MUT3_WART_SKIN                  0x00080000L
553 #define MUT3_SCALES                     0x00100000L
554 #define MUT3_IRON_SKIN                  0x00200000L
555 #define MUT3_WINGS                      0x00400000L
556 #define MUT3_FEARLESS                   0x00800000L
557 #define MUT3_REGEN                      0x01000000L
558 #define MUT3_ESP                        0x02000000L
559 #define MUT3_LIMBER                     0x04000000L
560 #define MUT3_ARTHRITIS                  0x08000000L
561 #define MUT3_BAD_LUCK                   0x10000000L
562 #define MUT3_VULN_ELEM                  0x20000000L
563 #define MUT3_MOTION                     0x40000000L
564 #define MUT3_GOOD_LUCK                  0x80000000L
565 
566 /*
567  * The racial powers
568  */
569 #define MAX_RACE_POWERS		28
570 
571 
572 /* Monk martial arts... */
573 # define MAX_MA			17
574 # define MA_KNEE		1
575 # define MA_SLOW		2
576 
577 /* Mindcrafter */
578 #define MINDCRAFT_NEURAL_BLAST           0
579 #define MINDCRAFT_PRECOGNITION           1
580 #define MINDCRAFT_MINOR_DISPLACEMENT     2
581 #define MINDCRAFT_MAJOR_DISPLACEMENT     3
582 #define MINDCRAFT_DOMINATION             4
583 #define MINDCRAFT_PULVERISE              5
584 #define MINDCRAFT_CHARACTER_ARMOUR       6
585 #define MINDCRAFT_PSYCHOMETRY            7
586 #define MINDCRAFT_MIND_WAVE              8
587 #define MINDCRAFT_ADRENALINE_CHANNELING  9
588 #define MINDCRAFT_PSYCHIC_DRAIN         10
589 #define MINDCRAFT_TELEKINETIC_WAVE      11
590 #define MINDCRAFT_MAX                   12
591 
592 /* Hallucination stuff */
593 #define MAX_SILLY_ATTACK		28
594 
595 
596 /*
597  * Maximum number of high scores in the high score file
598  */
599 #define MAX_HISCORES    100
600 
601 
602 /*
603  * Maximum dungeon level.  The player can never reach this level
604  * in the dungeon, and this value is used for various calculations
605  * involving object and monster creation.  It must be at least 100.
606  * Setting it below 128 may prevent the creation of some objects.
607  */
608 #define MAX_DEPTH       128
609 
610 /*
611  * Maximum size of the "view" array (see "cave.c")
612  * Note that the "view radius" will NEVER exceed 20, and even if the "view"
613  * was octagonal, we would never require more than 1520 entries in the array.
614  */
615 #define VIEW_MAX		1536
616 
617 /*
618  * Maximum size of the "temp" array (see "cave.c")
619  * We must be as large as "VIEW_MAX" for proper functioning
620  * of "update_view()".  We must also be as large as the
621  * largest illuminatable room, but no room is larger than 800 grids.  We
622  * must also be large enough to allow "good enough" use as a circular queue,
623  * to calculate monster flow.  The larger size is due to use as a circular
624  * queue for the fractal caves patch fill routine.
625  */
626 #define TEMP_MAX		2000
627 
628 /*
629  * Maximum number of squares lit by monsters.
630  * (Note that squares far away from the player do not need to be stored.)
631  */
632 #define LITE_MAX		2500
633 
634 
635 /*
636  * Maximum number of monsters that can be exploding at once.
637  */
638 #define DEATH_MAX		100
639 
640 /*
641  * Number of keymap modes
642  */
643 #define KEYMAP_MODES		2
644 
645 /*
646  * Mode for original keyset commands
647  */
648 #define KEYMAP_MODE_ORIG	0
649 
650 /*
651  * Mode for roguelike keyset commands
652  */
653 #define KEYMAP_MODE_ROGUE	1
654 
655 
656 /*
657  * OPTION: Maximum number of macros (see "utils.c")
658  * Default: assume at most 256 macros are used
659  */
660 #define MACRO_MAX       256
661 
662 /*
663  * OPTION: Maximum number of "quarks" (see "utils.c")
664  * Default: assume at most 2048 scripts + names + inscriptions
665  */
666 #define QUARK_MAX       2048
667 
668 /*
669  * Threshold for quark list before compacting
670  */
671 #define QUARK_COMPACT	(MAX_SHORT - 1)
672 
673 
674 /*
675  * OPTION: Maximum number of messages to remember (see "utils.c")
676  * Default: assume maximal memorization of 2048 total messages
677  */
678 #define MESSAGE_MAX     2048
679 
680 /*
681  * OPTION: Maximum space for the message text buffer (see "utils.c")
682  * Default: assume that each of the 2048 messages is repeated an
683  * average of three times, and has an average length of 48
684  */
685 #define MESSAGE_BUF     32768
686 
687 
688 /*
689  * Maximum value storable in a "byte" (hard-coded)
690  */
691 #define MAX_UCHAR       255
692 
693 /*
694  * Maximum value storable in a "s16b" (hard-coded)
695  */
696 #define MAX_SHORT       32767
697 
698 
699 /*
700  * Misc constants
701  */
702 #define TOWN_DAWN               10000	/* Number of turns from dawn to dawn XXX */
703 #define BREAK_GLYPH             550	/* Rune of protection resistance */
704 #define BREAK_MINOR_GLYPH       99	/* For explosive runes */
705 #define BTH_PLUS_ADJ    		1	/* Adjust BTH per plus-to-hit */
706 #define MON_MULT_ADJ    		8	/* High value slows multiplication */
707 #define MON_SUMMON_ADJ  		2	/* Adjust level of summoned creatures */
708 #define MON_DRAIN_LIFE  		2	/* Percent of player exp drained per hit */
709 #define USE_DEVICE      		3	/* x> Harder devices x< Easier devices */
710 
711 
712 /* "Biases" for random artifact gen */
713 
714 #define BIAS_ELEC            1
715 #define BIAS_POIS            2
716 #define BIAS_FIRE            3
717 #define BIAS_COLD            4
718 #define BIAS_ACID            5
719 #define BIAS_STR             6
720 #define BIAS_INT             7
721 #define BIAS_WIS             8
722 #define BIAS_DEX             9
723 #define BIAS_CON            10
724 #define BIAS_CHR            11
725 #define BIAS_CHAOS          12
726 #define BIAS_PRIESTLY       13
727 #define BIAS_NECROMANTIC    14
728 #define BIAS_LAW            15
729 #define BIAS_ROGUE          16
730 #define BIAS_MAGE           17
731 #define BIAS_WARRIOR        18
732 #define BIAS_RANGER         19
733 
734 
735 /*** Pet constants ***/
736 
737 
738 /*
739  * Commands
740  */
741 
742 #define PET_STAY_CLOSE				0
743 #define PET_FOLLOW_ME				1
744 #define PET_SEEK_AND_DESTROY		2
745 #define PET_ALLOW_SPACE				3
746 #define PET_STAY_AWAY				4
747 #define PET_OPEN_DOORS				5
748 #define PET_TAKE_ITEMS				6
749 #define PET_INFO					7
750 #define PET_DISMISS					8
751 #define PET_CHOICE_MAX				9
752 
753 /*
754  * Follow distances
755  */
756 #define PET_CLOSE_DIST				1
757 #define PET_FOLLOW_DIST				6
758 #define PET_SEEK_DIST				10
759 #define PET_DESTROY_DIST			255
760 #define PET_SPACE_DIST				(-10)
761 #define PET_AWAY_DIST				(-25)
762 
763 
764 /*
765  * There is a 1/50 (2%) chance of inflating the requested object_level
766  * during the creation of an object (see "get_obj_num()" in "object.c").
767  * Lower values yield better objects more often.
768  */
769 #define GREAT_OBJ       50
770 
771 
772 /*
773  * There is a 1/10 (10%) chance of inflating the level requested in
774  * making an ego item
775  */
776 #define EGO_INFLATE		10
777 
778 /*
779  * There is a 1/50 (2%) chance of inflating the requested monster level
780  * during the creation of a monsters (see "get_mon_num()" in "monster.c").
781  * Lower values yield harder monsters more often.
782  */
783 #define NASTY_MON       50
784 
785 /* 1/x chance of hurting even if invulnerable! */
786 #define PENETRATE_INVULNERABILITY 13
787 
788 /* Mana drained by getting in a psi hit */
789 #define PSI_COST 1
790 
791 
792 /*
793  * Refueling constants
794  */
795 #define FUEL_TORCH      5000	/* Maximum amount of fuel in a torch */
796 #define FUEL_LAMP       15000	/* Maximum amount of fuel in a lantern */
797 
798 
799 /*
800  * More maximum values
801  */
802 #define MAX_DETECT		30		/* Maximum detection range */
803 #define MAX_SIGHT       20		/* Maximum view distance */
804 #define MAX_RANGE       18		/* Maximum range (spells, etc) < MAX_SIGHT */
805 
806 
807 /*
808  * Max distance the player can be before we redo the flow data
809  */
810 #define FLOW_DIST_MAX	10
811 
812 /*
813  * Maximum flow depth when using "MONSTER_FLOW"
814  */
815 #define MONSTER_FLOW_DEPTH 40
816 
817 
818 /*
819  * There is a 1/160 chance per round of creating a new monster
820  */
821 #define MAX_M_ALLOC_CHANCE      160
822 
823 /*
824  * Normal levels get at least 14 monsters
825  */
826 #define MIN_M_ALLOC_LEVEL       14
827 
828 
829 /*
830  * A monster can only "multiply" (reproduce) if there are fewer than 100
831  * monsters on the level capable of such spontaneous reproduction.  This
832  * is a hack which prevents the "m_list[]" array from exploding due to
833  * reproducing monsters.  Messy, but necessary.
834  */
835 #define MAX_REPRO       100
836 
837 
838 /*
839  * Player constants
840  */
841 #define PY_MAX_EXP      99999999L	/* Maximum exp */
842 #define PY_MAX_GOLD     999999999L	/* Maximum gold */
843 #define PY_MAX_LEVEL    50		/* Maximum level */
844 
845 /*
846  * Player "food" crucial values
847  */
848 #define PY_FOOD_MAX  	15000	/* Food value (Bloated) */
849 #define PY_FOOD_FULL    10000	/* Food value (Normal) */
850 #define PY_FOOD_ALERT   2000	/* Food value (Hungry) */
851 #define PY_FOOD_WEAK    1000	/* Food value (Weak) */
852 #define PY_FOOD_FAINT   500		/* Food value (Fainting) */
853 #define PY_FOOD_STARVE  100		/* Food value (Starving) */
854 
855 /*
856  * Player regeneration constants
857  */
858 #define PY_REGEN_NORMAL         197	/* Regen factor*2^16 when full */
859 #define PY_REGEN_WEAK           98	/* Regen factor*2^16 when weak */
860 #define PY_REGEN_FAINT          33	/* Regen factor*2^16 when fainting */
861 #define PY_REGEN_HPBASE         1442	/* Min amount hp regen*2^16 */
862 #define PY_REGEN_MNBASE         524	/* Min amount mana regen*2^16 */
863 
864 
865 /*
866  * Maximum number of players spells
867  */
868 #define PY_MAX_SPELLS 64
869 
870 /*
871  * Possible realms that can be chosen;
872  * currently used only by birth.c and tables.c
873  */
874 #define CH_NONE         0x00
875 #define CH_LIFE         0x01
876 #define CH_SORCERY      0x02
877 #define CH_NATURE       0x04
878 #define CH_CHAOS        0x08
879 #define CH_DEATH        0x10
880 #define CH_TRUMP        0x20
881 #define CH_ARCANE       0x40
882 
883 
884 /*
885  * Magic realms
886  */
887 #define REALM_NONE         0
888 #define REALM_LIFE         1
889 #define REALM_SORCERY      2
890 #define REALM_NATURE       3
891 #define REALM_CHAOS        4
892 #define REALM_DEATH        5
893 #define REALM_TRUMP        6
894 #define REALM_ARCANE       7
895 #define MAX_REALM          8
896 
897 /*
898  * Magic-books for the realms
899  */
900 #define REALM1_BOOK     (p_ptr->spell.r[0].realm + TV_LIFE_BOOK - 1)
901 #define REALM2_BOOK     (p_ptr->spell.r[1].realm + TV_LIFE_BOOK - 1)
902 
903 
904 /*
905  * Ego item slot-types
906  */
907 
908 /* XXX XXX Hack - gap */
909 
910 #define ES_CROWN     21
911 #define ES_DIG		 22
912 #define ES_AMMO      23
913 #define ES_WIELD     24
914 #define ES_BOW       25
915 
916 /* Hack - gap */
917 
918 #define ES_NECK      28
919 #define ES_LITE      29
920 #define ES_BODY      30
921 #define ES_OUTER     31
922 #define ES_ARM       32
923 #define ES_HEAD      33
924 #define ES_HANDS     34
925 #define ES_FEET      35
926 
927 
928 /*
929  * Maximum number of "normal" pack slots.
930  * Note that "INVEN_PACK" is probably hard-coded by its use in savefiles, and
931  * by the fact that the screen can only show 23 items plus a one-line prompt.
932  */
933 #define INVEN_PACK              23
934 
935 /*
936  * Equipment slots
937  */
938 #define EQUIP_WIELD     0
939 #define EQUIP_BOW       1
940 #define EQUIP_LEFT      2
941 #define EQUIP_RIGHT     3
942 #define EQUIP_NECK      4
943 #define EQUIP_LITE      5
944 #define EQUIP_BODY      6
945 #define EQUIP_OUTER     7
946 #define EQUIP_ARM       8
947 #define EQUIP_HEAD      9
948 #define EQUIP_HANDS     10
949 #define EQUIP_FEET      11
950 
951 /*
952  * Total number of things that you can wield (hard coded)
953  */
954 #define EQUIP_MAX		12
955 
956 
957 /*
958  * A "stack" of items is limited to less than 100 items (hard-coded).
959  */
960 #define MAX_STACK_SIZE		100
961 
962 /*
963  * A "stack" of items is limited to less than or equal to 20.0 lbs.
964  */
965 #define MAX_STACK_WEIGHT        200
966 
967 
968 /*
969  * Indexes of the various "stats" (hard-coded by savefiles, etc).
970  */
971 #define A_STR   0
972 #define A_INT   1
973 #define A_WIS   2
974 #define A_DEX   3
975 #define A_CON   4
976 #define A_CHR   5
977 
978 /*
979  * Total number of stats.
980  */
981 #define A_MAX	6
982 
983 /* 1/x chance of reducing stats (for elemental attacks) */
984 #define HURT_CHANCE 50
985 
986 
987 /*
988  * Player sex constants (hard-coded by save-files, arrays, etc)
989  */
990 #define SEX_FEMALE              0
991 #define SEX_MALE                1
992 
993 
994 /*
995  * Player race constants (hard-coded by save-files, arrays, etc)
996  */
997 #define RACE_HUMAN               0
998 #define RACE_HALF_ELF            1
999 #define RACE_ELF                 2
1000 #define RACE_HOBBIT              3
1001 #define RACE_GNOME               4
1002 #define RACE_DWARF               5
1003 #define RACE_HALF_ORC            6
1004 #define RACE_HALF_TROLL          7
1005 #define RACE_AMBERITE            8
1006 #define RACE_HIGH_ELF            9
1007 #define RACE_BARBARIAN          10
1008 #define RACE_HALF_OGRE          11
1009 #define RACE_HALF_GIANT         12
1010 #define RACE_HALF_TITAN         13
1011 #define RACE_CYCLOPS            14
1012 #define RACE_YEEK               15
1013 #define RACE_KLACKON            16
1014 #define RACE_KOBOLD             17
1015 #define RACE_NIBELUNG           18
1016 #define RACE_DARK_ELF           19
1017 #define RACE_DRACONIAN          20
1018 #define RACE_MIND_FLAYER        21
1019 #define RACE_IMP                22
1020 #define RACE_GOLEM              23
1021 #define RACE_SKELETON           24
1022 #define RACE_ZOMBIE             25
1023 #define RACE_VAMPIRE            26
1024 #define RACE_SPECTRE            27
1025 #define RACE_SPRITE             28
1026 #define RACE_BEASTMAN           29
1027 #define RACE_GHOUL              30
1028 
1029 /*
1030  * Maximum number of player "race" types (see "table.c", etc)
1031  */
1032 #define MAX_RACES               31
1033 
1034 
1035 /*
1036  * Player class constants (hard-coded by save-files, arrays, etc)
1037  */
1038 #define CLASS_WARRIOR            0
1039 #define CLASS_MAGE               1
1040 #define CLASS_PRIEST             2
1041 #define CLASS_ROGUE              3
1042 #define CLASS_RANGER             4
1043 #define CLASS_PALADIN            5
1044 #define CLASS_WARRIOR_MAGE       6
1045 #define CLASS_CHAOS_WARRIOR      7
1046 #define CLASS_MONK               8
1047 #define CLASS_MINDCRAFTER        9
1048 #define CLASS_HIGH_MAGE         10
1049 
1050 /*** Screen Locations ***/
1051 
1052 /*
1053  * Some screen locations for various display routines
1054  */
1055 
1056 #define ROW_RACE                1
1057 #define COL_RACE                0	/* <race name> */
1058 
1059 #define ROW_CLASS               2
1060 #define COL_CLASS               0	/* <class name> */
1061 
1062 #define ROW_TITLE               3
1063 #define COL_TITLE               0	/* <title> or <mode> */
1064 
1065 #define ROW_LEVEL               4
1066 #define COL_LEVEL               0	/* "LEVEL xxxxxx" */
1067 
1068 #define ROW_EXP                 5
1069 #define COL_EXP                 0	/* "EXP xxxxxxxx" */
1070 
1071 #define ROW_GOLD                6
1072 #define COL_GOLD                0	/* "AU xxxxxxxxx" */
1073 
1074 #define ROW_EQUIPPY             7
1075 #define COL_EQUIPPY             0	/* equippy chars */
1076 
1077 #define ROW_STAT                8
1078 #define COL_STAT                0	/* "xxx   xxxxxx" */
1079 
1080 #define ROW_STATBAR             14
1081 #define COL_STATBAR             0	/* "Status bar" */
1082 
1083 #define ROW_AC                  15
1084 #define COL_AC                  0	/* "Cur AC xxxxx" */
1085 
1086 #define ROW_MAXHP               16
1087 #define COL_MAXHP               0	/* "Max HP xxxxx" */
1088 
1089 #define ROW_CURHP               17
1090 #define COL_CURHP               0	/* "Cur HP xxxxx" */
1091 
1092 #define ROW_MAXSP               18
1093 #define COL_MAXSP               0	/* "Max SP xxxxx" */
1094 
1095 #define ROW_CURSP               19
1096 #define COL_CURSP               0	/* "Cur SP xxxxx" */
1097 
1098 #define ROW_INFO                20
1099 #define COL_INFO                0	/* "xxxxxxxxxxxx" */
1100 
1101 #define ROW_CUT                 21
1102 #define COL_CUT                 0	/* <cut> */
1103 
1104 #define ROW_STUN                22
1105 #define COL_STUN                0	/* <stun> */
1106 
1107 #define ROW_MAP					1
1108 #define COL_MAP                 13	/* The map of the dungeon */
1109 
1110 
1111 #define COL_HUNGRY              0	/* "Weak" / "Hungry" / "Full" / "Gorged" */
1112 
1113 #define COL_BLIND               7	/* "Blind" */
1114 
1115 #define COL_CONFUSED    		13	/* "Confused" */
1116 
1117 #define COL_AFRAID              22	/* "Afraid" */
1118 
1119 #define COL_POISONED		    29	/* "Poisoned" */
1120 
1121 #define COL_STATE               38	/* <state> */
1122 
1123 #define COL_SPEED               45	/* "Slow (-NN)" or "Fast (+NN)" */
1124 
1125 #define COL_STUDY               56	/* "Study" */
1126 
1127 #define COL_DEPTH               62	/* "Lev NNN" / "NNNN ft" / town name */
1128 
1129 
1130 
1131 #define MAX_EFFECTS				30	/* Max #of player timed effects */
1132 
1133 
1134 /*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/
1135 
1136 /* Nothing */
1137 #define FEAT_NONE               0x00
1138 
1139 /* Various */
1140 #define FEAT_FLOOR              0x01
1141 /* #define FEAT_INVIS              0x02 Now is a field */
1142 /* #define FEAT_GLYPH              0x03 Now is a field */
1143 #define FEAT_OPEN               0x04
1144 #define FEAT_BROKEN             0x05
1145 #define FEAT_LESS               0x06
1146 #define FEAT_MORE               0x07
1147 
1148 /* Passable floors */
1149 
1150 #define FEAT_SAND				0x08
1151 #define FEAT_SALT				0x09
1152 #define FEAT_WET_MUD			0x0A
1153 #define FEAT_DRY_MUD			0x0B
1154 #define FEAT_FLOOR_TILE			0x0C
1155 #define FEAT_FLOOR_WOOD			0x0D
1156 #define FEAT_PEBBLES			0x0E
1157 #define FEAT_SOLID_LAVA			0x0F
1158 
1159 /* Gap where the traps were */
1160 
1161 /* Closed Door */
1162 #define FEAT_CLOSED				0x20
1163 #define FEAT_PILLAR         	0x21
1164 
1165 /* A big gap for expansion */
1166 
1167 /* Extra */
1168 #define FEAT_SECRET             0x30
1169 #define FEAT_RUBBLE             0x31
1170 
1171 /* Seams */
1172 #define FEAT_MAGMA              0x32
1173 #define FEAT_QUARTZ             0x33
1174 /* #define FEAT_MAGMA_H            0x34 */
1175 /* #define FEAT_QUARTZ_H           0x35 */
1176 #define FEAT_MAGMA_K            0x36
1177 #define FEAT_QUARTZ_K           0x37
1178 
1179 /* Walls */
1180 #define FEAT_WALL_EXTRA         0x38
1181 #define FEAT_WALL_INNER         0x39
1182 #define FEAT_WALL_OUTER         0x3A
1183 #define FEAT_WALL_SOLID         0x3B
1184 #define FEAT_PERM_EXTRA         0x3C
1185 #define FEAT_PERM_INNER         0x3D
1186 #define FEAT_PERM_OUTER         0x3E
1187 #define FEAT_PERM_SOLID         0x3F
1188 
1189 /* Gap where Glyph was */
1190 
1191 /* Pattern */
1192 #define FEAT_PATTERN_START      0x41
1193 #define FEAT_PATTERN_1          0x42
1194 #define FEAT_PATTERN_2          0x43
1195 #define FEAT_PATTERN_3          0x44
1196 #define FEAT_PATTERN_4          0x45
1197 #define FEAT_PATTERN_END        0x46
1198 #define FEAT_PATTERN_OLD        0x47
1199 #define FEAT_PATTERN_XTRA1      0x48
1200 #define FEAT_PATTERN_XTRA2      0x49
1201 
1202 /* Terrains */
1203 #define FEAT_DEEP_WATER         0x53
1204 #define FEAT_SHAL_WATER         0x54
1205 #define FEAT_DEEP_LAVA          0x55
1206 #define FEAT_SHAL_LAVA          0x56
1207 
1208 /* Gap */
1209 
1210 #define FEAT_DIRT               0x58
1211 #define FEAT_GRASS              0x59
1212 
1213 /* Gap */
1214 
1215 #define FEAT_OCEAN_WATER		0x5C
1216 #define FEAT_DEEP_ACID			0x5D
1217 #define FEAT_SHAL_ACID			0x5E
1218 #define FEAT_TREE_WATER			0x5F
1219 
1220 /* Terrain semi-transparent*/
1221 #define FEAT_TREES          	0x60
1222 #define FEAT_MOUNTAIN       	0x61
1223 #define FEAT_SNOW_MOUNTAIN		0x62
1224 #define FEAT_BOULDER			0x63
1225 #define FEAT_PINE_TREE			0x64
1226 #define FEAT_SNOW_TREE			0x65
1227 #define FEAT_OBELISK			0x66
1228 
1229 /* Gap */
1230 
1231 /* Impassible terrains */
1232 #define FEAT_FENCE				0x70
1233 #define FEAT_WELL				0x71
1234 #define FEAT_FOUNTAIN			0x72
1235 #define FEAT_JUNGLE				0x73
1236 
1237 /* Gap */
1238 
1239 /* Slow "floor" terrains */
1240 #define FEAT_BUSH				0x80
1241 #define FEAT_DEAD_BUSH			0x81
1242 #define FEAT_GRASS_LONG			0x82
1243 #define FEAT_ROCK_GEN			0x83
1244 #define FEAT_ROCK_SNOW			0x84
1245 #define FEAT_TREE_GEN			0x85
1246 #define FEAT_TREE_SNOW			0x86
1247 #define FEAT_SNOW				0x87
1248 #define FEAT_DEEP_SWAMP			0x88
1249 #define FEAT_SHAL_SWAMP			0x89
1250 
1251 
1252 /*** Wilderness Info flags - (see "wild.c") ***/
1253 
1254 #define WILD_INFO_TRACK		0x01
1255 #define WILD_INFO_ROAD		0x02
1256 #define WILD_INFO_WATER		0x04
1257 #define WILD_INFO_LAVA		0x08
1258 #define WILD_INFO_DUMMY		0x10
1259 #define WILD_INFO_SEEN		0x20
1260 #define WILD_INFO_ACID		0x40
1261 #define WILD_INFO_QUEST		0x80
1262 
1263 
1264 /* Types of "liquid" for dungeon */
1265 #define LQ_NONE		0x00
1266 #define LQ_WATER	0x01
1267 #define LQ_LAVA		0x02
1268 #define LQ_ACID		0x04
1269 #define LQ_SWAMP	0x08
1270 
1271 #define LQ_MAX		4
1272 
1273 /* Room types */
1274 #define RT_TAG_CROWDED	0x0001 /* Affects "crowded" counter */
1275 #define RT_NATURAL		0x0002
1276 #define RT_ANIMAL		0x0004
1277 #define RT_COMPLEX		0x0008
1278 #define RT_DENSE		0x0010
1279 #define RT_RUIN			0x0020
1280 #define RT_SIMPLE		0x0040
1281 #define RT_BUILDING		0x0080
1282 #define RT_CRYPT		0x0100
1283 #define RT_RVAULT		0x0200
1284 #define RT_STRANGE		0x0400
1285 #define RT_FANCY		0x0800
1286 
1287 
1288 /*** Field Thaumatergical types - (see "fields.c" and t_info.txt) ***/
1289 #define FT_NONE					0x0000
1290 #define FT_WALL_INVIS			0x0001
1291 #define FT_GLYPH_WARDING		0x0002
1292 #define FT_GLYPH_EXPLODE		0x0003
1293 #define FT_CORPSE				0x0004
1294 #define FT_SKELETON				0x0005
1295 #define FT_TRAP_DOOR			0x0006
1296 #define FT_TRAP_PIT				0x0007
1297 #define FT_TRAP_SPIKE_PIT		0x0008
1298 #define FT_TRAP_POISON_PIT		0x0009
1299 #define FT_TRAP_CURSE			0x000A
1300 #define FT_TRAP_TELEPORT		0x000B
1301 #define FT_TRAP_ELEMENT			0x000C
1302 #define FT_TRAP_BA_ELEMENT		0x000D
1303 #define FT_TRAP_GAS				0x000E
1304 #define FT_TRAP_TRAPS			0x000F
1305 #define FT_TRAP_TEMP_STAT		0x0010
1306 #define FT_TRAP_PERM_STAT		0x0011
1307 #define FT_TRAP_LOSE_XP			0x0012
1308 #define FT_TRAP_DISENCHANT		0x0013
1309 #define FT_TRAP_DROP_ITEM		0x0014
1310 #define FT_TRAP_MUTATE			0x0015
1311 #define FT_TRAP_NEW_LIFE		0x0016
1312 #define FT_TRAP_NO_LITE			0x0017
1313 #define FT_TRAP_HUNGER			0x0018
1314 #define FT_TRAP_NO_GOLD			0x0019
1315 #define FT_TRAP_HASTE_MON		0x001A
1316 #define FT_TRAP_RAISE_MON		0x001B
1317 #define FT_TRAP_DRAIN_MAGIC		0x001C
1318 #define FT_TRAP_AGGRAVATE		0x001D
1319 #define FT_TRAP_SUMMON			0x001E
1320 #define FT_TRAP_LOSE_MEMORY		0x001F
1321 #define FT_LOCK_DOOR			0x0020
1322 #define FT_JAM_DOOR				0x0021
1323 #define FT_STORE_GENERAL		0x0022
1324 #define FT_STORE_ARMOURY		0x0023
1325 #define FT_STORE_WEAPON			0x0024
1326 #define FT_STORE_TEMPLE			0x0025
1327 #define FT_STORE_ALCHEMIST		0x0026
1328 #define FT_STORE_MAGIC			0x0027
1329 #define FT_STORE_BLACK			0x0028
1330 #define FT_STORE_HOME			0x0029
1331 #define FT_STORE_BOOK			0x002A
1332 #define FT_BUILD_WEAPON			0x002B
1333 #define FT_BUILD_RECHARGE		0x002C
1334 #define FT_BUILD_PLUS_WEAPON	0x002D
1335 #define FT_BUILD_PLUS_ARMOUR	0x002E
1336 #define FT_BUILD_MUTATE			0x002F
1337 #define FT_BUILD_MAP			0x0030
1338 #define FT_STORE_WEAPON1		0x0031
1339 #define FT_STORE_WEAPON2		0x0032
1340 #define FT_STORE_WEAPON3		0x0033
1341 #define FT_STORE_WEAPON4		0x0034
1342 #define FT_STORE_WEAPON5		0x0035
1343 #define FT_STORE_ARMOUR1		0x0036
1344 #define FT_STORE_ARMOUR2		0x0037
1345 #define FT_STORE_ARMOUR3		0x0038
1346 #define FT_STORE_ARMOUR4		0x0039
1347 #define FT_STORE_ARMOUR5		0x003A
1348 #define FT_STORE_SWORD0			0x003B
1349 #define FT_STORE_SWORD1			0x003C
1350 #define FT_STORE_SWORD2			0x003D
1351 #define FT_STORE_SWORD3			0x003E
1352 #define FT_STORE_SWORD4			0x003F
1353 #define FT_STORE_SWORD5			0x0040
1354 #define FT_STORE_SHIELD0		0x0041
1355 #define FT_STORE_SHIELD1		0x0042
1356 #define FT_STORE_SHIELD2		0x0043
1357 #define FT_STORE_SHIELD3		0x0044
1358 #define FT_STORE_SHIELD4		0x0045
1359 #define FT_STORE_SHIELD5		0x0046
1360 #define FT_STORE_AXE0			0x0047
1361 #define FT_STORE_AXE1			0x0048
1362 #define FT_STORE_AXE2			0x0049
1363 #define FT_STORE_AXE3			0x004A
1364 #define FT_STORE_AXE4			0x004B
1365 #define FT_STORE_AXE5			0x004C
1366 #define FT_STORE_AMMO0			0x004D
1367 #define FT_STORE_AMMO1			0x004E
1368 #define FT_STORE_AMMO2			0x004F
1369 #define FT_STORE_FLET0			0x0050
1370 #define FT_STORE_FLET1			0x0051
1371 #define FT_STORE_FLET2			0x0052
1372 #define FT_STORE_FLET3			0x0053
1373 #define FT_STORE_WARHALL0		0x0054
1374 #define FT_STORE_WARHALL1		0x0055
1375 #define FT_STORE_WARHALL2		0x0056
1376 #define FT_STORE_WARHALL3		0x0057
1377 #define FT_STORE_WARHALL4		0x0058
1378 #define FT_STORE_WARHALL5		0x0059
1379 #define FT_STORE_CLOTH0			0x005A
1380 #define FT_STORE_CLOTH1			0x005B
1381 #define FT_STORE_HARMOUR0		0x005C
1382 #define FT_STORE_HARMOUR1		0x005D
1383 #define FT_STORE_HARMOUR2		0x005E
1384 #define FT_STORE_HARMOUR3		0x005F
1385 #define FT_STORE_HARMOUR4		0x0060
1386 #define FT_STORE_HARMOUR5		0x0061
1387 #define FT_STORE_HAT0			0x0062
1388 #define FT_STORE_HAT1			0x0063
1389 #define FT_STORE_HAT2			0x0064
1390 #define FT_STORE_HAT3			0x0065
1391 #define FT_STORE_JEWEL0			0x0066
1392 #define FT_STORE_JEWEL1			0x0067
1393 #define FT_STORE_JEWEL2			0x0068
1394 #define FT_STORE_JEWEL3			0x0069
1395 #define FT_STORE_JEWEL4			0x006A
1396 #define FT_STORE_STATUE0		0x006B
1397 #define FT_STORE_STATUE1		0x006C
1398 #define FT_STORE_FIGUR0			0x006D
1399 #define FT_STORE_FIGUR1			0x006E
1400 #define FT_STORE_POTION0		0x006F
1401 #define FT_STORE_POTION1		0x0070
1402 #define FT_STORE_POTION2		0x0071
1403 #define FT_STORE_POTION3		0x0072
1404 #define FT_STORE_POTION4		0x0073
1405 #define FT_STORE_SCROLL0		0x0074
1406 #define FT_STORE_SCROLL1		0x0075
1407 #define FT_STORE_SCROLL2		0x0076
1408 #define FT_STORE_SCROLL3		0x0077
1409 #define FT_STORE_SCROLL4		0x0078
1410 #define FT_STORE_MAGIC0			0x0079
1411 #define FT_STORE_MAGIC1			0x007A
1412 #define FT_STORE_MAGIC2			0x007B
1413 #define FT_STORE_MAGIC3			0x007C
1414 #define FT_STORE_MAGIC4			0x007D
1415 #define FT_STORE_BOOK1			0x007E
1416 #define FT_STORE_TEMPLE1		0x007F
1417 #define FT_STORE_TEMPLE2		0x0080
1418 #define FT_STORE_TEMPLE3		0x0081
1419 #define FT_STORE_SUPPLIES0		0x0082
1420 #define FT_STORE_SUPPLIES1		0x0083
1421 #define FT_STORE_BLACK1			0x0084
1422 #define FT_STORE_BLACK2			0x0085
1423 #define FT_STORE_ALCHEMY1		0x0086
1424 #define FT_STORE_ALCHEMY2		0x0087
1425 #define FT_STORE_JUNK			0x0088
1426 #define FT_STORE_FOOD			0x0089
1427 #define FT_BUILD_LIBRARY		0x008A
1428 #define FT_BUILD_CASINO			0x008B
1429 #define FT_BUILD_INN			0x008C
1430 #define FT_BUILD_HEALER			0x008D
1431 #define FT_STORE_BLACK0         0x008E
1432 #define FT_BUILD_MAGETOWER0     0x008F
1433 #define FT_BUILD_MAGETOWER1     0x0090
1434 #define FT_BUILD_CASTLE0		0x0091
1435 #define FT_BUILD_CASTLE1		0x0092
1436 
1437 
1438 /*** Artifact indexes (see "lib/edit/a_info.txt") ***/
1439 
1440 /* The maximum "special" artifact index */
1441 #define MAX_ART_SPECIAL          15
1442 
1443 /* Lites */
1444 #define ART_GALADRIEL            1
1445 #define ART_ELENDIL              2
1446 #define ART_THRAIN               3
1447 
1448 /* Amulets */
1449 #define ART_CARLAMMAS            4
1450 #define ART_INGWE                5
1451 #define ART_DWARVES              6
1452 
1453 /* Rings */
1454 #define ART_BARAHIR              8
1455 #define ART_TULKAS               9
1456 #define ART_NARYA               10
1457 #define ART_NENYA               11
1458 #define ART_VILYA               12
1459 #define ART_POWER               13
1460 #define ART_ELEMENTS			14
1461 
1462 /* Dragon Scale */
1463 #define ART_RAZORBACK           16
1464 #define ART_BLADETURNER         17
1465 
1466 /* Robe */
1467 #define ART_THAUMATURGIST		18
1468 
1469 /* Hard Armour */
1470 #define ART_SOULKEEPER          19
1471 #define ART_ISILDUR             20
1472 #define ART_ROHIRRIM            21
1473 #define ART_BELEGENNON          22
1474 #define ART_CELEBORN            23
1475 #define ART_ARVEDUI             24
1476 #define ART_CASPANION           25
1477 #define ART_NEMOVEBLA			26
1478 
1479 /* Soft Armour */
1480 #define ART_HITHLOMIR           27
1481 #define ART_THALKETTOTH         28
1482 
1483 /* Gap */
1484 
1485 /* Shields */
1486 #define ART_THORIN              30
1487 #define ART_CELEGORM            31
1488 #define ART_ANARION             32
1489 
1490 /* Helms and Crowns */
1491 #define ART_MORGOTH             34
1492 #define ART_BERUTHIEL           35
1493 #define ART_THRANDUIL           36
1494 #define ART_THENGEL             37
1495 #define ART_HAMMERHAND          38
1496 #define ART_DOR                 39
1497 #define ART_HOLHENNETH          40
1498 #define ART_TERROR              41
1499 #define ART_GONDOR              42
1500 
1501 /* Cloaks */
1502 #define ART_KERI                43
1503 #define ART_COLLUIN             44
1504 #define ART_HOLCOLLETH          45
1505 #define ART_THINGOL             46
1506 #define ART_THORONGIL           47
1507 #define ART_COLANNON            48
1508 #define ART_LUTHIEN             49
1509 #define ART_TUOR                50
1510 
1511 /* Gloves */
1512 #define ART_CAMBELEG            52
1513 #define ART_CAMMITHRIM          53
1514 #define ART_PAURHACH            54
1515 #define ART_CORWIN              55
1516 #define ART_PAURAEGEN           56
1517 #define ART_PAURNEN             57
1518 #define ART_CAMLOST             58
1519 #define ART_FINGOLFIN           59
1520 
1521 /* Boots */
1522 #define ART_FEANOR              60
1523 #define ART_DAL                 61
1524 #define ART_THROR               62
1525 
1526 /* Swords */
1527 #define ART_MAEDHROS            64
1528 #define ART_ANGRIST             65
1529 #define ART_NARTHANC            66
1530 #define ART_NIMTHANC            67
1531 #define ART_DETHANC             68
1532 #define ART_RILIA               69
1533 #define ART_BELANGIL            70
1534 #define ART_CALRIS              71
1535 #define ART_GRAYSWANDIR         72
1536 #define ART_GLAMDRING           73
1537 #define ART_AEGLIN              74
1538 #define ART_ORCRIST             75
1539 #define ART_GURTHANG            76
1540 #define ART_ZARCUTHRA           77
1541 #define ART_MORMEGIL            78
1542 #define ART_GONDRICAM           79
1543 #define ART_CRISDURIAN          80
1544 #define ART_GROO                81
1545 #define ART_RINGIL              82
1546 #define ART_ANDURIL             83
1547 #define ART_ANGUIREL            84
1548 #define ART_CHAINSWORD          85
1549 #define ART_FORASGIL            86
1550 #define ART_CARETH              87
1551 #define ART_STING               88
1552 #define ART_HARADEKKET          89
1553 #define ART_GILETTAR            90
1554 #define ART_DOOMCALLER          91
1555 #define ART_VORPAL_BLADE        92
1556 
1557 /* Polearms */
1558 #define ART_THEODEN             93
1559 #define ART_PAIN                94
1560 #define ART_OSONDIR             95
1561 #define ART_TIL                 96
1562 #define ART_AEGLOS              97
1563 #define ART_OROME               98
1564 #define ART_NIMLOTH             99
1565 #define ART_SOULSUCKER          100
1566 #define ART_DURIN               101
1567 #define ART_EONWE               102
1568 #define ART_BALLI               103
1569 #define ART_LOTHARANG           104
1570 #define ART_MUNDWINE            105
1571 #define ART_BARUKKHELED         106
1572 #define ART_WRATH               107
1573 #define ART_ULMO                108
1574 #define ART_AVAVIR              109
1575 
1576 /* The sword of the Dawn */
1577 #define ART_DAWN                110
1578 
1579 /* Hafted */
1580 #define ART_GROND               111
1581 #define ART_TOTILA              112
1582 #define ART_THUNDERFIST         113
1583 #define ART_WHIRLWIND           114
1584 #define ART_FIRESTAR            115
1585 #define ART_ENERGY              116
1586 #define ART_AULE                117
1587 #define ART_NAR                 118
1588 #define ART_ERIRIL              119
1589 #define ART_OLORIN              120
1590 #define ART_DEATHWREAKER        121
1591 #define ART_TURMIL              122
1592 
1593 /* Sling */
1594 #define ART_CATAPULT			123
1595 
1596 /* Bows */
1597 #define ART_BELTHRONDING        124
1598 #define ART_BARD                125
1599 #define ART_BRAND               126
1600 #define ART_MARKSMAN			127
1601 
1602 
1603 /* New artifacts */
1604 #define ART_STORMBRINGER		130
1605 
1606 
1607 /*** Ego-Item indexes (see "lib/edit/e_info.txt") ***/
1608 
1609 
1610 /* Nothing */
1611 /* xxx */
1612 /* xxx */
1613 /* xxx */
1614 
1615 /* Body Armor */
1616 #define EGO_RESIST_ACID         4
1617 #define EGO_RESIST_ELEC         5
1618 #define EGO_RESIST_FIRE         6
1619 #define EGO_RESIST_COLD         7
1620 #define EGO_RESISTANCE          8
1621 #define EGO_ELVENKIND           9
1622 /* xxx */
1623 #define EGO_PERMANENCE          11
1624 
1625 /* Lites */
1626 #define EGO_EVERBURN			12
1627 #define EGO_VISION              13
1628 #define EGO_WARMTH				14
1629 #define EGO_SEARCH              15
1630 
1631 
1632 /* Shields */
1633 #define EGO_ENDURE_ACID         16
1634 #define EGO_ENDURE_ELEC         17
1635 #define EGO_ENDURE_FIRE         18
1636 #define EGO_ENDURE_COLD         19
1637 #define EGO_ENDURANCE           20
1638 #define EGO_REFLECTION          21
1639 /* xxx */
1640 /* xxx */
1641 
1642 /* Crowns and Helms */
1643 #define EGO_INTELLIGENCE        24
1644 #define EGO_WISDOM              25
1645 #define EGO_BEAUTY              26
1646 #define EGO_MAGI                27
1647 #define EGO_MIGHT               28
1648 #define EGO_LORDLINESS          29
1649 #define EGO_SEEING              30
1650 #define EGO_INFRAVISION         31
1651 #define EGO_LITE                32
1652 #define EGO_TELEPATHY           33
1653 #define EGO_REGENERATION        34
1654 #define EGO_TELEPORTATION       35
1655 #define EGO_STUPIDITY           36
1656 #define EGO_NAIVETY             37
1657 #define EGO_UGLINESS            38
1658 #define EGO_SICKLINESS          39
1659 
1660 /* Cloaks */
1661 #define EGO_PROTECTION          40
1662 #define EGO_STEALTH             41
1663 #define EGO_AMAN                42
1664 #define EGO_AURA_FIRE           43
1665 #define EGO_ENVELOPING          44
1666 #define EGO_VULNERABILITY       45
1667 #define EGO_IRRITATION          46
1668 #define EGO_AURA_ELEC           47
1669 
1670 /* Gloves */
1671 #define EGO_FREE_ACTION         48
1672 #define EGO_SLAYING             49
1673 #define EGO_AGILITY             50
1674 #define EGO_POWER               51
1675 #define EGO_GHOUL_TOUCH         52
1676 /* xxx */
1677 #define EGO_WEAKNESS            54
1678 #define EGO_CLUMSINESS          55
1679 
1680 /* Boots */
1681 #define EGO_SLOW_DESCENT        56
1682 #define EGO_QUIET               57
1683 #define EGO_MOTION              58
1684 #define EGO_SPEED               59
1685 /* xxx */
1686 #define EGO_NOISE               61
1687 #define EGO_SLOWNESS            62
1688 #define EGO_ANNOYANCE           63
1689 
1690 /* Weapons */
1691 #define EGO_HA                  64
1692 #define EGO_DF                  65
1693 #define EGO_BLESS_BLADE         66
1694 /* xxx */
1695 #define EGO_WEST                68
1696 #define EGO_ATTACKS             69
1697 #define EGO_SLAYING_WEAPON      70
1698 /* xxx */
1699 #define EGO_BRAND_ACID          72
1700 #define EGO_BRAND_ELEC          73
1701 #define EGO_BRAND_FIRE          74
1702 #define EGO_BRAND_COLD          75
1703 #define EGO_BRAND_POIS          76
1704 #define EGO_CHAOTIC             77
1705 #define EGO_SHARPNESS           78
1706 #define EGO_EARTHQUAKES         79
1707 #define EGO_SLAY_ANIMAL         80
1708 #define EGO_SLAY_EVIL           81
1709 #define EGO_SLAY_UNDEAD         82
1710 #define EGO_SLAY_DEMON          83
1711 #define EGO_SLAY_ORC            84
1712 #define EGO_SLAY_TROLL          85
1713 #define EGO_SLAY_GIANT          86
1714 #define EGO_SLAY_DRAGON         87
1715 #define EGO_KILL_ANIMAL         88
1716 #define EGO_KILL_EVIL           89
1717 #define EGO_KILL_UNDEAD         90
1718 #define EGO_KILL_DEMON          91
1719 #define EGO_KILL_ORC            92
1720 #define EGO_KILL_TROLL          93
1721 #define EGO_KILL_GIANT          94
1722 #define EGO_KILL_DRAGON         95
1723 #define EGO_VAMPIRIC            96
1724 /* xxx */
1725 /* xxx */
1726 #define EGO_TRUMP               98
1727 #define EGO_PATTERN             99
1728 #define EGO_DIGGING             100
1729 /* xxx */
1730 #define EGO_MORGUL              102
1731 /* xxx */
1732 
1733 /* Bows */
1734 #define EGO_ACCURACY            104
1735 #define EGO_VELOCITY            105
1736 /* xxx */
1737 /* xxx */
1738 #define EGO_EXTRA_MIGHT         108
1739 #define EGO_EXTRA_SHOTS         109
1740 /* xxx */
1741 /* xxx */
1742 
1743 /* Ammo */
1744 #define EGO_HURT_ANIMAL         112
1745 #define EGO_HURT_EVIL           113
1746 /* xxx */
1747 /* xxx */
1748 /* xxx */
1749 #define EGO_RETURNING           117
1750 #define EGO_EXPLOSION           118
1751 #define EGO_HURT_DRAGON         119
1752 #define EGO_SLAYING_BOLT        120
1753 #define EGO_LIGHTNING_BOLT      121
1754 #define EGO_FLAME               122
1755 #define EGO_FROST               123
1756 #define EGO_WOUNDING            124
1757 #define EGO_BACKBITING          125
1758 #define EGO_SHATTERED           126
1759 #define EGO_BLASTED             127
1760 
1761 
1762 /*** Object "tval" and "sval" codes ***/
1763 
1764 
1765 /*
1766  * The values for the "tval" field of various objects.
1767  *
1768  * This value is the primary means by which items are sorted in the
1769  * player inventory, followed by "sval" and "cost".
1770  *
1771  * Note that as of 2.7.8, the "item flags" apply to all items, though
1772  * only armor and weapons and a few other items use any of these flags.
1773  */
1774 
1775 #define TV_ANY			 0		/* Used for matching all objects */
1776 #define TV_SKELETON      1		/* Skeletons ('~') */
1777 #define TV_BOTTLE        2		/* Empty bottles ('!') */
1778 #define TV_JUNK          3		/* Sticks, Pottery, etc ('~') */
1779 #define TV_SPIKE         5		/* Spikes ('~') */
1780 #define TV_CHEST         7		/* Chests ('&') */
1781 #define TV_FIGURINE      8		/* Magical figurines */
1782 #define TV_STATUE        9		/* Statue */
1783 /*#define TV_CORPSE       10  */ /* Corpses are now fields */
1784 #define TV_SHOT         16		/* Ammo for slings */
1785 #define TV_ARROW        17		/* Ammo for bows */
1786 #define TV_BOLT         18		/* Ammo for x-bows */
1787 #define TV_BOW          19		/* Slings/Bows/Xbows */
1788 #define TV_DIGGING      20		/* Shovels/Picks */
1789 #define TV_HAFTED       21		/* Priest Weapons */
1790 #define TV_POLEARM      22		/* Axes and Pikes */
1791 #define TV_SWORD        23		/* Edged Weapons */
1792 #define TV_BOOTS        30		/* Boots */
1793 #define TV_GLOVES       31		/* Gloves */
1794 #define TV_HELM         32		/* Helms */
1795 #define TV_CROWN        33		/* Crowns */
1796 #define TV_SHIELD       34		/* Shields */
1797 #define TV_CLOAK        35		/* Cloaks */
1798 #define TV_SOFT_ARMOR   36		/* Soft Armor */
1799 #define TV_HARD_ARMOR   37		/* Hard Armor */
1800 #define TV_DRAG_ARMOR   38		/* Dragon Scale Mail */
1801 #define TV_LITE         39		/* Lites (including Specials) */
1802 #define TV_AMULET       40		/* Amulets (including Specials) */
1803 #define TV_RING         45		/* Rings (including Specials) */
1804 #define TV_STAFF        55
1805 #define TV_WAND         65
1806 #define TV_ROD          66
1807 #define TV_SCROLL       70
1808 #define TV_POTION       75
1809 #define TV_FLASK        77
1810 #define TV_FOOD         80
1811 #define TV_LIFE_BOOK    90
1812 #define TV_SORCERY_BOOK 91
1813 #define TV_NATURE_BOOK  92
1814 #define TV_CHAOS_BOOK   93
1815 #define TV_DEATH_BOOK   94
1816 #define TV_TRUMP_BOOK   95
1817 #define TV_ARCANE_BOOK  96
1818 #define TV_GOLD         100		/* Gold can only be picked up by players */
1819 
1820 #define TV_BOOKS_MIN    TV_LIFE_BOOK	/* First tval of spellbooks */
1821 #define TV_BOOKS_MAX    TV_ARCANE_BOOK	/* Last tval of spellbooks */
1822 
1823 /* Any subvalue */
1824 #define SV_ANY 					255
1825 
1826 /* The "sval" codes for TV_FIGURINE */
1827 #define SV_FIGURINE_NORMAL		0
1828 
1829 /* The "sval" codes for TV_STATUE */
1830 #define SV_WOODEN_STATUE		0
1831 #define SV_CLAY_STATUE			1
1832 #define SV_STONE_STATUE			2
1833 #define SV_IRON_STATUE			3
1834 #define SV_COPPER_STATUE		4
1835 #define SV_SILVER_STATUE		5
1836 #define SV_GOLDEN_STATUE		6
1837 #define SV_IVORY_STATUE			7
1838 #define SV_MITHRIL_STATUE		8
1839 #define SV_ORNATE_STATUE		9
1840 
1841 /* The "sval" codes for TV_SHOT/TV_ARROW/TV_BOLT */
1842 #define SV_AMMO_LIGHT                    0	/* pebbles, flight arrows */
1843 #define SV_AMMO_NORMAL                   1	/* shots, arrows, bolts */
1844 #define SV_AMMO_HEAVY                    2	/* sheaf + seeker arrows and bolts, mithril shots */
1845 
1846 /* The "sval" codes for TV_BOW (note information in "sval") */
1847 #define SV_SLING                         2	/* (x2) */
1848 #define SV_SHORT_BOW                    12	/* (x2) */
1849 #define SV_LONG_BOW                     13	/* (x3 or x2) */
1850 #define SV_LIGHT_XBOW                   23	/* (x4) */
1851 #define SV_HEAVY_XBOW                   24	/* (x5) */
1852 
1853 /* The "sval" codes for TV_DIGGING */
1854 #define SV_SHOVEL                        1
1855 #define SV_GNOMISH_SHOVEL                2
1856 #define SV_DWARVEN_SHOVEL                3
1857 #define SV_PICK                          4
1858 #define SV_ORCISH_PICK                   5
1859 #define SV_DWARVEN_PICK                  6
1860 #define SV_MATTOCK                       7
1861 
1862 /*
1863  * Do not put the damage dice of the weapons or the AC of armour here.
1864  * The values rapidly diverge from what is in k_info.txt
1865  * as they are tweaked.
1866  */
1867 
1868 /* The "sval" values for TV_HAFTED */
1869 #define SV_CLUB                          1
1870 #define SV_WHIP                          2
1871 #define SV_QUARTERSTAFF                  3
1872 #define SV_NUNCHAKU                      4
1873 #define SV_MACE                          5
1874 #define SV_BALL_AND_CHAIN                6
1875 #define SV_JO_STAFF                      7
1876 #define SV_WAR_HAMMER                    8
1877 #define SV_THREE_PIECE_ROD              11
1878 #define SV_MORNING_STAR                 12
1879 #define SV_FLAIL                        13
1880 #define SV_BO_STAFF                     14
1881 #define SV_LEAD_FILLED_MACE             15
1882 #define SV_TETSUBO                      16
1883 #define SV_TWO_HANDED_FLAIL             18
1884 #define SV_GREAT_HAMMER                 19
1885 #define SV_MACE_OF_DISRUPTION           20
1886 #define SV_WHIP_OF_ENTANGLEMENT         21
1887 #define SV_HAMMER_OF_RETURNING          22
1888 #define SV_GROND                        50
1889 
1890 /* The "sval" values for TV_POLEARM */
1891 #define SV_HATCHET                       1
1892 #define SV_SPEAR                         2
1893 #define SV_SICKLE                        3
1894 #define SV_AWL_PIKE                      4
1895 #define SV_TRIDENT                       5
1896 #define SV_FAUCHARD                      6
1897 #define SV_BROAD_SPEAR                   7
1898 #define SV_PIKE                          8
1899 #define SV_NAGINATA                      9
1900 #define SV_BEAKED_AXE                   10
1901 #define SV_BROAD_AXE                    11
1902 #define SV_LUCERNE_HAMMER               12
1903 #define SV_GLAIVE                       13
1904 #define SV_LAJATANG                     14
1905 #define SV_HALBERD                      15
1906 #define SV_GUISARME                     16
1907 #define SV_SCYTHE                       17
1908 #define SV_LANCE                        20
1909 #define SV_BATTLE_AXE                   22
1910 #define SV_GREAT_AXE                    25
1911 #define SV_TRIFURCATE_SPEAR             26
1912 #define SV_LOCHABER_AXE                 28
1913 #define SV_HEAVY_LANCE                  29
1914 #define SV_SCYTHE_OF_SLICING            30
1915 
1916 /* The "sval" codes for TV_SWORD */
1917 #define SV_BROKEN_DAGGER                 1
1918 #define SV_BROKEN_SWORD                  2
1919 #define SV_DAGGER                        4
1920 #define SV_MAIN_GAUCHE                   5
1921 #define SV_TANTO                         6
1922 #define SV_RAPIER                        7
1923 #define SV_SMALL_SWORD                   8
1924 #define SV_BASILLARD                     9
1925 #define SV_SHORT_SWORD                  10
1926 #define SV_SABRE                        11
1927 #define SV_CUTLASS                      12
1928 #define SV_WAKIZASHI                    13
1929 #define SV_KHOPESH                      14
1930 #define SV_TULWAR                       15
1931 #define SV_BROAD_SWORD                  16
1932 #define SV_LONG_SWORD                   17
1933 #define SV_SCIMITAR                     18
1934 #define SV_NINJATO                      19
1935 #define SV_KATANA                       20
1936 #define SV_BASTARD_SWORD                21
1937 #define SV_GREAT_SCIMITAR               22
1938 #define SV_CLAYMORE                     23
1939 #define SV_ESPADON                      24
1940 #define SV_TWO_HANDED_SWORD             25
1941 #define SV_FLAMBERGE                    26
1942 #define SV_NO_DACHI                     27
1943 #define SV_EXECUTIONERS_SWORD           28
1944 #define SV_ZWEIHANDER                   29
1945 #define SV_BLADE_OF_CHAOS               30
1946 #define SV_DIAMOND_EDGE                 31
1947 #define SV_ELFBLADE                     32
1948 #define SV_PSIBLADE                     33
1949 
1950 /* The "sval" codes for TV_SHIELD */
1951 #define SV_SMALL_LEATHER_SHIELD          2
1952 #define SV_SMALL_METAL_SHIELD            3
1953 #define SV_LARGE_LEATHER_SHIELD          4
1954 #define SV_LARGE_METAL_SHIELD            5
1955 #define SV_DRAGON_SHIELD                 6
1956 #define SV_SHIELD_OF_DEFLECTION         10
1957 
1958 /* The "sval" codes for TV_HELM */
1959 #define SV_HARD_LEATHER_CAP              2
1960 #define SV_METAL_CAP                     3
1961 #define SV_JINGASA                       4
1962 #define SV_IRON_HELM                     5
1963 #define SV_STEEL_HELM                    6
1964 #define SV_DRAGON_HELM                   7
1965 #define SV_KABUTO                        8
1966 #define SV_IRON_CROWN                   10
1967 #define SV_GOLDEN_CROWN                 11
1968 #define SV_JEWELED_CROWN                12
1969 #define SV_MORGOTH                      50
1970 
1971 /* The "sval" codes for TV_BOOTS */
1972 #define SV_PAIR_OF_SOFT_LEATHER_BOOTS    2
1973 #define SV_PAIR_OF_HARD_LEATHER_BOOTS    3
1974 #define SV_PAIR_OF_METAL_SHOD_BOOTS      6
1975 
1976 /* The "sval" codes for TV_CLOAK */
1977 #define SV_CLOAK                         1
1978 #define SV_ELVEN_CLOAK                   2
1979 #define SV_FUR_CLOAK                     3
1980 #define SV_SHADOW_CLOAK                  6
1981 
1982 /* The "sval" codes for TV_GLOVES */
1983 #define SV_SET_OF_LEATHER_GLOVES         1
1984 #define SV_SET_OF_GAUNTLETS              2
1985 #define SV_SET_OF_CESTI                  5
1986 
1987 /* The "sval" codes for TV_SOFT_ARMOR */
1988 #define SV_T_SHIRT                       0
1989 #define SV_FILTHY_RAG                    1
1990 #define SV_ROBE                          2
1991 #define SV_PAPER_ARMOR                   3
1992 #define SV_SOFT_LEATHER_ARMOR            4
1993 #define SV_SOFT_STUDDED_LEATHER          5
1994 #define SV_HARD_LEATHER_ARMOR            6
1995 #define SV_HARD_STUDDED_LEATHER          7
1996 #define SV_RHINO_HIDE_ARMOR              8
1997 #define SV_CORD_ARMOR                    9
1998 #define SV_PADDED_ARMOR                 10
1999 #define SV_LEATHER_SCALE_MAIL           11
2000 #define SV_LEATHER_JACK                 12
2001 #define SV_STONE_AND_HIDE_ARMOR         15
2002 #define SV_HAGAROMO			16
2003 
2004 /* The "sval" codes for TV_HARD_ARMOR */
2005 #define SV_RUSTY_CHAIN_MAIL              1
2006 #define SV_RING_MAIL                     2
2007 #define SV_METAL_SCALE_MAIL              3
2008 #define SV_CHAIN_MAIL                    4
2009 #define SV_DOUBLE_RING_MAIL              5
2010 #define SV_AUGMENTED_CHAIN_MAIL          6
2011 #define SV_DOUBLE_CHAIN_MAIL             7
2012 #define SV_BAR_CHAIN_MAIL                8
2013 #define SV_METAL_BRIGANDINE_ARMOUR       9
2014 #define SV_SPLINT_MAIL                  10
2015 #define SV_DO_MARU                      11
2016 #define SV_PARTIAL_PLATE_ARMOUR         12
2017 #define SV_METAL_LAMELLAR_ARMOUR        13
2018 #define SV_HARAMAKIDO                   14
2019 #define SV_FULL_PLATE_ARMOUR            15
2020 #define SV_O_YOROI                      16
2021 #define SV_RIBBED_PLATE_ARMOUR          18
2022 #define SV_MITHRIL_CHAIN_MAIL           20
2023 #define SV_MITHRIL_PLATE_MAIL           25
2024 #define SV_ADAMANTITE_PLATE_MAIL        30
2025 
2026 /* The "sval" codes for TV_DRAG_ARMOR */
2027 #define SV_DRAGON_BLACK                  1
2028 #define SV_DRAGON_BLUE                   2
2029 #define SV_DRAGON_WHITE                  3
2030 #define SV_DRAGON_RED                    4
2031 #define SV_DRAGON_GREEN                  5
2032 #define SV_DRAGON_MULTIHUED              6
2033 #define SV_DRAGON_SHINING               10
2034 #define SV_DRAGON_LAW                   12
2035 #define SV_DRAGON_BRONZE                14
2036 #define SV_DRAGON_GOLD                  16
2037 #define SV_DRAGON_CHAOS                 18
2038 #define SV_DRAGON_BALANCE               20
2039 #define SV_DRAGON_POWER                 30
2040 
2041 /* The sval codes for TV_LITE */
2042 #define SV_LITE_TORCH                    0
2043 #define SV_LITE_LANTERN                  1
2044 #define SV_LITE_GALADRIEL                4
2045 #define SV_LITE_ELENDIL                  5
2046 #define SV_LITE_THRAIN                   6
2047 
2048 /* The "sval" codes for TV_AMULET */
2049 #define SV_AMULET_DOOM                   0
2050 #define SV_AMULET_TELEPORT               1
2051 #define SV_AMULET_BERSERK                2
2052 #define SV_AMULET_SLOW_DIGEST            3
2053 #define SV_AMULET_RESIST_ACID            4
2054 #define SV_AMULET_SEARCHING              5
2055 #define SV_AMULET_WISDOM                 6
2056 #define SV_AMULET_CHARISMA               7
2057 #define SV_AMULET_THE_MAGI               8
2058 #define SV_AMULET_REFLECTION             9
2059 #define SV_AMULET_CARLAMMAS             10
2060 #define SV_AMULET_INGWE                 11
2061 #define SV_AMULET_DWARVES               12
2062 #define SV_AMULET_NO_MAGIC              13
2063 #define SV_AMULET_NO_TELE               14
2064 #define SV_AMULET_RESISTANCE            15
2065 #define SV_AMULET_PROT_EVIL             16
2066 #define SV_AMULET_PROT_UNDEAD           17
2067 #define SV_AMULET_LUCK                  18
2068 #define SV_AMULET_SUSTENANCE            19
2069 
2070 /* The sval codes for TV_RING */
2071 #define SV_RING_WOE                      0
2072 #define SV_RING_AGGRAVATION              1
2073 #define SV_RING_WEAKNESS                 2
2074 #define SV_RING_STUPIDITY                3
2075 #define SV_RING_TELEPORTATION            4
2076 #define SV_RING_SLOW_DIGESTION           6
2077 #define SV_RING_FEATHER_FALL             7
2078 #define SV_RING_RESIST_FIRE              8
2079 #define SV_RING_RESIST_COLD              9
2080 #define SV_RING_SUSTAIN_STR             10
2081 #define SV_RING_SUSTAIN_INT             11
2082 #define SV_RING_SUSTAIN_WIS             12
2083 #define SV_RING_SUSTAIN_DEX             13
2084 #define SV_RING_SUSTAIN_CON             14
2085 #define SV_RING_SUSTAIN_CHR             15
2086 #define SV_RING_PROTECTION              16
2087 #define SV_RING_ACID                    17
2088 #define SV_RING_FLAMES                  18
2089 #define SV_RING_ICE                     19
2090 #define SV_RING_RESIST_POIS             20
2091 #define SV_RING_FREE_ACTION             21
2092 #define SV_RING_SEE_INVIS               22
2093 #define SV_RING_SEARCHING               23
2094 #define SV_RING_STR                     24
2095 #define SV_RING_INT                     25
2096 #define SV_RING_DEX                     26
2097 #define SV_RING_CON                     27
2098 #define SV_RING_ACCURACY                28
2099 #define SV_RING_DAMAGE                  29
2100 #define SV_RING_SLAYING                 30
2101 #define SV_RING_SPEED                   31
2102 #define SV_RING_BARAHIR                 32
2103 #define SV_RING_TULKAS                  33
2104 #define SV_RING_NARYA                   34
2105 #define SV_RING_NENYA                   35
2106 #define SV_RING_VILYA                   36
2107 #define SV_RING_POWER                   37
2108 #define SV_RING_RES_FEAR                38
2109 #define SV_RING_RES_LD                  39
2110 #define SV_RING_RES_NETHER              40
2111 #define SV_RING_RES_NEXUS               41
2112 #define SV_RING_RES_SOUND               42
2113 #define SV_RING_RES_CONFUSION           43
2114 #define SV_RING_RES_SHARDS              44
2115 #define SV_RING_RES_DISENCHANT          45
2116 #define SV_RING_RES_CHAOS               46
2117 #define SV_RING_RES_BLINDNESS           47
2118 #define SV_RING_LORDLY                  48
2119 #define SV_RING_ATTACKS                 49
2120 #define SV_RING_ELEMENTS				50
2121 #define SV_RING_RES_FIRE_COLD           51
2122 #define SV_RING_CAT                     52
2123 #define SV_RING_FATE                    53
2124 #define SV_RING_WIZARDRY                54
2125 
2126 /* The "sval" codes for TV_STAFF */
2127 #define SV_STAFF_DARKNESS                0
2128 #define SV_STAFF_SLOWNESS                1
2129 #define SV_STAFF_HASTE_MONSTERS          2
2130 #define SV_STAFF_SUMMONING               3
2131 #define SV_STAFF_TELEPORTATION           4
2132 #define SV_STAFF_IDENTIFY                5
2133 #define SV_STAFF_REMOVE_CURSE            6
2134 #define SV_STAFF_STARLITE                7
2135 #define SV_STAFF_LITE                    8
2136 #define SV_STAFF_MAPPING                 9
2137 #define SV_STAFF_DETECT_GOLD            10
2138 #define SV_STAFF_DETECT_ITEM            11
2139 #define SV_STAFF_DETECT_TRAP            12
2140 #define SV_STAFF_DETECT_DOOR            13
2141 #define SV_STAFF_DETECT_INVIS           14
2142 #define SV_STAFF_DETECT_EVIL            15
2143 #define SV_STAFF_CURE_LIGHT             16
2144 #define SV_STAFF_CURING                 17
2145 #define SV_STAFF_HEALING                18
2146 #define SV_STAFF_THE_MAGI               19
2147 #define SV_STAFF_SLEEP_MONSTERS         20
2148 #define SV_STAFF_SLOW_MONSTERS          21
2149 #define SV_STAFF_SPEED                  22
2150 #define SV_STAFF_PROBING                23
2151 #define SV_STAFF_DISPEL_EVIL            24
2152 #define SV_STAFF_POWER                  25
2153 #define SV_STAFF_HOLINESS               26
2154 #define SV_STAFF_GENOCIDE               27
2155 #define SV_STAFF_EARTHQUAKES            28
2156 #define SV_STAFF_DESTRUCTION            29
2157 
2158 
2159 /* The "sval" codes for TV_WAND */
2160 #define SV_WAND_HEAL_MONSTER             0
2161 #define SV_WAND_HASTE_MONSTER            1
2162 #define SV_WAND_CLONE_MONSTER            2
2163 #define SV_WAND_TELEPORT_AWAY            3
2164 #define SV_WAND_DISARMING                4
2165 #define SV_WAND_TRAP_DOOR_DEST           5
2166 #define SV_WAND_STONE_TO_MUD             6
2167 #define SV_WAND_LITE                     7
2168 #define SV_WAND_SLEEP_MONSTER            8
2169 #define SV_WAND_SLOW_MONSTER             9
2170 #define SV_WAND_CONFUSE_MONSTER         10
2171 #define SV_WAND_FEAR_MONSTER            11
2172 #define SV_WAND_DRAIN_LIFE              12
2173 #define SV_WAND_POLYMORPH               13
2174 #define SV_WAND_STINKING_CLOUD          14
2175 #define SV_WAND_MAGIC_MISSILE           15
2176 #define SV_WAND_ACID_BOLT               16
2177 #define SV_WAND_CHARM_MONSTER           17
2178 #define SV_WAND_FIRE_BOLT               18
2179 #define SV_WAND_COLD_BOLT               19
2180 #define SV_WAND_ACID_BALL               20
2181 #define SV_WAND_ELEC_BALL               21
2182 #define SV_WAND_FIRE_BALL               22
2183 #define SV_WAND_COLD_BALL               23
2184 #define SV_WAND_WONDER                  24
2185 #define SV_WAND_ANNIHILATION            25
2186 #define SV_WAND_DRAGON_FIRE             26
2187 #define SV_WAND_DRAGON_COLD             27
2188 #define SV_WAND_DRAGON_BREATH           28
2189 #define SV_WAND_ROCKETS                 29
2190 
2191 /* The "sval" codes for TV_ROD */
2192 #define SV_ROD_DETECT_TRAP               0
2193 #define SV_ROD_DETECT_DOOR               1
2194 #define SV_ROD_IDENTIFY                  2
2195 #define SV_ROD_RECALL                    3
2196 #define SV_ROD_ILLUMINATION              4
2197 #define SV_ROD_MAPPING                   5
2198 #define SV_ROD_DETECTION                 6
2199 #define SV_ROD_PROBING                   7
2200 #define SV_ROD_CURING                    8
2201 #define SV_ROD_HEALING                   9
2202 #define SV_ROD_RESTORATION              10
2203 #define SV_ROD_SPEED                    11
2204 #define SV_ROD_PESTICIDE                12
2205 #define SV_ROD_TELEPORT_AWAY            13
2206 #define SV_ROD_DISARMING                14
2207 #define SV_ROD_LITE                     15
2208 #define SV_ROD_SLEEP_MONSTER            16
2209 #define SV_ROD_SLOW_MONSTER             17
2210 #define SV_ROD_DRAIN_LIFE               18
2211 #define SV_ROD_POLYMORPH                19
2212 #define SV_ROD_ACID_BOLT                20
2213 #define SV_ROD_ELEC_BOLT                21
2214 #define SV_ROD_FIRE_BOLT                22
2215 #define SV_ROD_COLD_BOLT                23
2216 #define SV_ROD_ACID_BALL                24
2217 #define SV_ROD_ELEC_BALL                25
2218 #define SV_ROD_FIRE_BALL                26
2219 #define SV_ROD_COLD_BALL                27
2220 #define SV_ROD_HAVOC                    28
2221 
2222 
2223 /* The "sval" codes for TV_SCROLL */
2224 
2225 #define SV_SCROLL_DARKNESS               0
2226 #define SV_SCROLL_AGGRAVATE_MONSTER      1
2227 #define SV_SCROLL_CURSE_ARMOR            2
2228 #define SV_SCROLL_CURSE_WEAPON           3
2229 #define SV_SCROLL_SUMMON_MONSTER         4
2230 #define SV_SCROLL_SUMMON_UNDEAD          5
2231 /* xxx (summon?) */
2232 #define SV_SCROLL_TRAP_CREATION          7
2233 #define SV_SCROLL_PHASE_DOOR             8
2234 #define SV_SCROLL_TELEPORT               9
2235 #define SV_SCROLL_TELEPORT_LEVEL        10
2236 #define SV_SCROLL_WORD_OF_RECALL        11
2237 #define SV_SCROLL_IDENTIFY              12
2238 #define SV_SCROLL_STAR_IDENTIFY         13
2239 #define SV_SCROLL_REMOVE_CURSE          14
2240 #define SV_SCROLL_STAR_REMOVE_CURSE     15
2241 #define SV_SCROLL_ENCHANT_ARMOR         16
2242 #define SV_SCROLL_ENCHANT_WEAPON_TO_HIT 17
2243 #define SV_SCROLL_ENCHANT_WEAPON_TO_DAM 18
2244 /* xxx enchant missile? */
2245 #define SV_SCROLL_STAR_ENCHANT_ARMOR    20
2246 #define SV_SCROLL_STAR_ENCHANT_WEAPON   21
2247 #define SV_SCROLL_RECHARGING            22
2248 #define SV_SCROLL_MUNDANITY             23
2249 #define SV_SCROLL_LIGHT                 24
2250 #define SV_SCROLL_MAPPING               25
2251 #define SV_SCROLL_DETECT_GOLD           26
2252 #define SV_SCROLL_DETECT_ITEM           27
2253 #define SV_SCROLL_DETECT_TRAP           28
2254 #define SV_SCROLL_DETECT_DOOR           29
2255 #define SV_SCROLL_DETECT_INVIS          30
2256 /* xxx (detect evil?) */
2257 #define SV_SCROLL_SATISFY_HUNGER        32
2258 #define SV_SCROLL_BLESSING              33
2259 #define SV_SCROLL_HOLY_CHANT            34
2260 #define SV_SCROLL_HOLY_PRAYER           35
2261 #define SV_SCROLL_MONSTER_CONFUSION     36
2262 #define SV_SCROLL_PROTECTION_FROM_EVIL  37
2263 #define SV_SCROLL_RUNE_OF_PROTECTION    38
2264 #define SV_SCROLL_TRAP_DOOR_DESTRUCTION 39
2265 /* xxx */
2266 #define SV_SCROLL_STAR_DESTRUCTION      41
2267 #define SV_SCROLL_DISPEL_UNDEAD         42
2268 /* xxx */
2269 #define SV_SCROLL_GENOCIDE              44
2270 #define SV_SCROLL_MASS_GENOCIDE         45
2271 #define SV_SCROLL_ACQUIREMENT           46
2272 #define SV_SCROLL_STAR_ACQUIREMENT      47
2273 #define SV_SCROLL_FIRE                  48
2274 #define SV_SCROLL_ICE                   49
2275 #define SV_SCROLL_CHAOS                 50
2276 #define SV_SCROLL_RUMOR                 51
2277 #define SV_SCROLL_ARTIFACT              52
2278 
2279 /* The "sval" codes for TV_POTION */
2280 #define SV_POTION_WATER                  0
2281 #define SV_POTION_APPLE_JUICE            1
2282 #define SV_POTION_SLIME_MOLD             2
2283 /* xxx (fixed color) */
2284 #define SV_POTION_SLOWNESS               4
2285 #define SV_POTION_SALT_WATER             5
2286 #define SV_POTION_POISON                 6
2287 #define SV_POTION_BLINDNESS              7
2288 /* xxx */
2289 #define SV_POTION_CONFUSION              9
2290 /* xxx */
2291 #define SV_POTION_SLEEP                 11
2292 /* xxx */
2293 #define SV_POTION_LOSE_MEMORIES         13
2294 /* xxx */
2295 #define SV_POTION_RUINATION             15
2296 #define SV_POTION_DEC_STR               16
2297 #define SV_POTION_DEC_INT               17
2298 #define SV_POTION_DEC_WIS               18
2299 #define SV_POTION_DEC_DEX               19
2300 #define SV_POTION_DEC_CON               20
2301 #define SV_POTION_DEC_CHR               21
2302 #define SV_POTION_DETONATIONS           22
2303 #define SV_POTION_DEATH                 23
2304 #define SV_POTION_INFRAVISION           24
2305 #define SV_POTION_DETECT_INVIS          25
2306 #define SV_POTION_SLOW_POISON           26
2307 #define SV_POTION_CURE_POISON           27
2308 #define SV_POTION_BOLDNESS              28
2309 #define SV_POTION_SPEED                 29
2310 #define SV_POTION_RESIST_HEAT           30
2311 #define SV_POTION_RESIST_COLD           31
2312 #define SV_POTION_HEROISM               32
2313 #define SV_POTION_BERSERK_STRENGTH      33
2314 #define SV_POTION_CURE_LIGHT            34
2315 #define SV_POTION_CURE_SERIOUS          35
2316 #define SV_POTION_CURE_CRITICAL         36
2317 #define SV_POTION_HEALING               37
2318 #define SV_POTION_STAR_HEALING          38
2319 #define SV_POTION_LIFE                  39
2320 #define SV_POTION_RESTORE_MANA          40
2321 #define SV_POTION_RESTORE_EXP           41
2322 #define SV_POTION_RES_STR               42
2323 #define SV_POTION_RES_INT               43
2324 #define SV_POTION_RES_WIS               44
2325 #define SV_POTION_RES_DEX               45
2326 #define SV_POTION_RES_CON               46
2327 #define SV_POTION_RES_CHR               47
2328 #define SV_POTION_INC_STR               48
2329 #define SV_POTION_INC_INT               49
2330 #define SV_POTION_INC_WIS               50
2331 #define SV_POTION_INC_DEX               51
2332 #define SV_POTION_INC_CON               52
2333 #define SV_POTION_INC_CHR               53
2334 /* xxx */
2335 #define SV_POTION_AUGMENTATION          55
2336 #define SV_POTION_ENLIGHTENMENT         56
2337 #define SV_POTION_STAR_ENLIGHTENMENT    57
2338 #define SV_POTION_SELF_KNOWLEDGE        58
2339 #define SV_POTION_EXPERIENCE            59
2340 #define SV_POTION_RESISTANCE            60
2341 #define SV_POTION_CURING                61
2342 #define SV_POTION_INVULNERABILITY       62
2343 #define SV_POTION_NEW_LIFE              63
2344 
2345 /* The "sval" codes for TV_FOOD */
2346 #define SV_FOOD_POISON                   0
2347 #define SV_FOOD_BLINDNESS                1
2348 #define SV_FOOD_PARANOIA                 2
2349 #define SV_FOOD_CONFUSION                3
2350 #define SV_FOOD_HALLUCINATION            4
2351 #define SV_FOOD_PARALYSIS                5
2352 #define SV_FOOD_WEAKNESS                 6
2353 #define SV_FOOD_SICKNESS                 7
2354 #define SV_FOOD_STUPIDITY                8
2355 #define SV_FOOD_NAIVETY                  9
2356 #define SV_FOOD_UNHEALTH                10
2357 #define SV_FOOD_DISEASE                 11
2358 #define SV_FOOD_CURE_POISON             12
2359 #define SV_FOOD_CURE_BLINDNESS          13
2360 #define SV_FOOD_CURE_PARANOIA           14
2361 #define SV_FOOD_CURE_CONFUSION          15
2362 #define SV_FOOD_CURE_SERIOUS            16
2363 #define SV_FOOD_RESTORE_STR             17
2364 #define SV_FOOD_RESTORE_CON             18
2365 #define SV_FOOD_RESTORING               19
2366 /* many missing mushrooms */
2367 #define SV_FOOD_BISCUIT                 32
2368 #define SV_FOOD_JERKY                   33
2369 #define SV_FOOD_RATION                  35
2370 #define SV_FOOD_SLIME_MOLD              36
2371 #define SV_FOOD_WAYBREAD                37
2372 #define SV_FOOD_PINT_OF_ALE             38
2373 #define SV_FOOD_PINT_OF_WINE            39
2374 
2375 
2376 /*
2377  * Special "sval" limit -- first "normal" food
2378  */
2379 #define SV_FOOD_MIN_FOOD                32
2380 
2381 /*
2382  * Special "sval" limit -- first "aimed" rod
2383  */
2384 #define SV_ROD_MIN_DIRECTION    12
2385 
2386 /*
2387  * Special "sval" limit -- first "large" chest
2388  */
2389 #define SV_CHEST_MIN_LARGE      4
2390 
2391 /*
2392  * Special "sval" limit -- first "good" magic/prayer book
2393  */
2394 #define SV_BOOK_MIN_GOOD    2
2395 
2396 
2397 #define OBJ_GOLD_LIST   480		/* First "gold" entry */
2398 #define MAX_GOLD        18		/* Number of "gold" entries */
2399 
2400 /*
2401  * Object creation flags
2402  * These are the values passable to apply_magic
2403  */
2404 #define OC_NONE			0x00
2405 #define OC_NORMAL		0x01
2406 #define OC_FORCE_BAD	0x02
2407 #define OC_FORCE_GOOD	0x04
2408 
2409 
2410 /*** General flag values ***/
2411 
2412 
2413 /*
2414  * Special cave grid flags
2415  */
2416 #define CAVE_DUM1       0x01
2417 #define CAVE_GLOW       0x02	/* self-illuminating */
2418 #define CAVE_ICKY       0x04	/* part of a vault */
2419 #define CAVE_ROOM       0x08	/* part of a room */
2420 #define CAVE_DUM2       0x10
2421 #define CAVE_MNLT       0x20	/* Illuminated by monster */
2422 #define CAVE_TEMP       0x40	/* temp flag */
2423 #define CAVE_XTRA       0x80	/* misc flag */
2424 
2425 
2426 /*
2427  * Cave grid flags that are player-specific
2428  *
2429  * This data structure will eventually be moved into the players struct.
2430  */
2431 #define GRID_DUM1		0x01
2432 #define GRID_VIEW		0x02	/* In LOS */
2433 #define GRID_SEEN		0x04	/* In LOS + Lit in some way */
2434 #define GRID_DTCT		0x08	/* Detected for traps */
2435 #define GRID_LITE		0x10	/* Lit by torchlight */
2436 #define GRID_DUM3		0x20
2437 #define GRID_DUM4		0x40
2438 #define GRID_DUM5		0x80
2439 
2440 
2441 /*
2442  * Region flags
2443  */
2444 #define REGION_NULL		0x00
2445 #define REGION_CAVE		0x01	/* Cave region */
2446 #define REGION_OVER		0x02	/* Overlay region */
2447 #define REGION_DUM2		0x04
2448 
2449 
2450 /*
2451  * Feature flags
2452  */
2453 #define FF_BLOCK		0x01	/* Blocks movement + los */
2454 #define FF_HALF_LOS		0x02	/* Half-blocks los */
2455 #define FF_USE_TRANS	0x04	/* Use transparency light effects */
2456 #define FF_ICKY			0x08	/* Terrain can not have objects */
2457 #define FF_PERM			0x10	/* Permanent terrain */
2458 #define FF_OBJECT		0x20	/* Terrain is described like an object */
2459 #define FF_PATTERN		0x40	/* The pattern */
2460 #define FF_MARK			0x80	/* Remember tile if seen */
2461 
2462 /*
2463  * Bit flags for the "project()" function
2464  *
2465  *   JUMP: Jump directly to the target location (this is a hack)
2466  *   BEAM: Work as a beam weapon (affect every grid passed through)
2467  *   THRU: Continue "through" the target (used for "bolts"/"beams")
2468  *   STOP: Stop as soon as we hit a monster (used for "bolts")
2469  *   GRID: Affect each grid in the "blast area" in some way
2470  *   ITEM: Affect each object in the "blast area" in some way
2471  *   KILL: Affect each monster in the "blast area" in some way
2472  *   HIDE: Hack -- disable "visual" feedback from projection
2473  *   FRND: Stop if hit a friendly monster / player.
2474  *	 MFLD: Make fields using GF_XXX value as type. (unused as of yet)
2475  */
2476 #define PROJECT_JUMP    0x0001
2477 #define PROJECT_BEAM    0x0002
2478 #define PROJECT_THRU    0x0004
2479 #define PROJECT_STOP    0x0008
2480 #define PROJECT_GRID    0x0010
2481 #define PROJECT_ITEM    0x0020
2482 #define PROJECT_KILL    0x0040
2483 #define PROJECT_HIDE    0x0080
2484 #define PROJECT_FRND	0x0100
2485 #define PROJECT_MFLD	0x0200
2486 
2487 /*
2488  * Bit flags for the "enchant()" function
2489  */
2490 #define ENCH_TOHIT      0x01	/* Enchant to hit */
2491 #define ENCH_TODAM      0x02	/* Enchant to damage */
2492 #define ENCH_TOAC       0x04	/* Enchant to AC */
2493 #define ENCH_FORCE      0x08	/* Force enchantment */
2494 
2495 /*
2496  * Bit flags for the "target_set" function
2497  *
2498  *      KILL: Target monsters
2499  *      LOOK: Describe grid fully
2500  *      XTRA: Currently unused flag
2501  *      GRID: Select from all grids
2502  *		HOST: Select hostile creatures only.
2503  */
2504 #define TARGET_KILL             0x01
2505 #define TARGET_LOOK             0x02
2506 #define TARGET_XTRA             0x04
2507 #define TARGET_GRID             0x08
2508 #define TARGET_HOST				0x10
2509 
2510 
2511 /*
2512  * Some bit-flags for the "smart" field
2513  */
2514 #define SM_RES_ACID             0x00000001
2515 #define SM_RES_ELEC             0x00000002
2516 #define SM_RES_FIRE             0x00000004
2517 #define SM_RES_COLD             0x00000008
2518 #define SM_RES_POIS             0x00000010
2519 #define SM_RES_NETH             0x00000020
2520 #define SM_RES_LITE             0x00000040
2521 #define SM_RES_DARK             0x00000080
2522 #define SM_RES_FEAR             0x00000100
2523 #define SM_RES_CONF             0x00000200
2524 #define SM_RES_CHAOS            0x00000400
2525 #define SM_RES_DISEN            0x00000800
2526 #define SM_RES_BLIND            0x00001000
2527 #define SM_RES_NEXUS            0x00002000
2528 #define SM_RES_SOUND            0x00004000
2529 #define SM_RES_SHARD            0x00008000
2530 #define SM_OPP_ACID             0x00010000
2531 #define SM_OPP_ELEC             0x00020000
2532 #define SM_OPP_FIRE             0x00040000
2533 #define SM_OPP_COLD             0x00080000
2534 #define SM_OPP_POIS             0x00100000
2535 #define SM_MIMIC                0x00200000	/* XXX Unknown Mimic */
2536 #define SM_CLONED               0x00400000	/* XXX Cloned */
2537 #define SM_PET                  0x00800000	/* XXX Pet */
2538 #define SM_IMM_ACID             0x01000000
2539 #define SM_IMM_ELEC             0x02000000
2540 #define SM_IMM_FIRE             0x04000000
2541 #define SM_IMM_COLD             0x08000000
2542 #define SM_FRIENDLY             0x10000000	/* XXX Friendly */
2543 #define SM_IMM_REFLECT          0x20000000
2544 #define SM_IMM_FREE             0x40000000
2545 #define SM_IMM_MANA             0x80000000
2546 
2547 
2548 /*
2549  * Bit flags for the "get_item" function
2550  */
2551 #define USE_EQUIP	0x01		/* Allow equip items */
2552 #define USE_INVEN	0x02		/* Allow inven items */
2553 #define USE_FLOOR	0x04		/* Allow floor items */
2554 #define USE_STORE	0x10		/* Selling to store */
2555 
2556 /*
2557  * Bit flags for the "p_ptr->notice" variable
2558  */
2559 #define PN_COMBINE      0x00000001L	/* Combine the pack */
2560 #define PN_REORDER      0x00000002L	/* Reorder the pack */
2561 /* xxx (many) */
2562 
2563 
2564 /*
2565  * Bit flags for the "p_ptr->update" variable
2566  */
2567 #define PU_BONUS        0x00000001L	/* Calculate bonuses */
2568 #define PU_TORCH        0x00000002L	/* Calculate torch radius */
2569 /* xxx (many) */
2570 #define PU_HP           0x00000010L	/* Calculate chp and mhp */
2571 #define PU_MANA         0x00000020L	/* Calculate csp and msp */
2572 #define PU_SPELLS       0x00000040L	/* Calculate spells */
2573 /* xxx (many) */
2574 #define PU_WEIGHT		0x00000100L	/* Calculate weight of inventory */
2575 /* xxx (many) */
2576 #define PU_MAP			0x00001000L	/* Notice change in screen size */
2577 /* xxx (many) */
2578 #define PU_VIEW         0x00100000L	/* Update view */
2579 #define PU_MON_LITE		0x00200000L	/* Monster illumination */
2580 #define PU_WIZ_FIX		0x00400000L	/* Fix up after a wiz_lite() */
2581 /* xxx */
2582 #define PU_MONSTERS     0x01000000L	/* Update monsters */
2583 #define PU_DISTANCE     0x02000000L	/* Update distances */
2584 /* xxx */
2585 #define PU_FLOW         0x10000000L	/* Update flow */
2586 /* xxx (many) */
2587 
2588 
2589 /*
2590  * Bit flags for the "p_ptr->change" variable
2591  */
2592 #define PC_WIZ_LITE		0x00000001L	/* Redraw map after a wiz_lite() */
2593 #define PC_SHIMMER		0x00000002L /* Shimmer monsters */
2594 #define PC_REPAIR		0x00000004L	/* Repair monsters */
2595 #define PC_MUTATE		0x00000008L	/* Mutate player (on birth) */
2596 
2597 
2598 /*
2599  * Bit flags for the "p_ptr->redraw" variable
2600  */
2601 #define PR_MISC         0x00000001L	/* Display Race/Class */
2602 #define PR_TITLE        0x00000002L	/* Display Title */
2603 #define PR_LEV          0x00000004L	/* Display Level */
2604 #define PR_EXP          0x00000008L	/* Display Experience */
2605 #define PR_STATS        0x00000010L	/* Display Stats */
2606 #define PR_ARMOR        0x00000020L	/* Display Armor */
2607 #define PR_HP           0x00000040L	/* Display Hitpoints */
2608 #define PR_MANA         0x00000080L	/* Display Mana */
2609 #define PR_GOLD         0x00000100L	/* Display Gold */
2610 #define PR_DEPTH        0x00000200L	/* Display Depth */
2611 #define PR_EQUIPPY      0x00000400L	/* Display equippy chars */
2612 #define PR_HEALTH       0x00000800L	/* Display Health Bar */
2613 #define PR_CUT          0x00001000L	/* Display Extra (Cut) */
2614 #define PR_STUN         0x00002000L	/* Display Extra (Stun) */
2615 #define PR_HUNGER       0x00004000L	/* Display Extra (Hunger) */
2616 #define PR_STATUS       0x00008000L	/* Display Status Bar */
2617 #define PR_BLIND        0x00010000L	/* Display Extra (Blind) */
2618 #define PR_CONFUSED     0x00020000L	/* Display Extra (Confused) */
2619 #define PR_AFRAID       0x00040000L	/* Display Extra (Afraid) */
2620 #define PR_POISONED     0x00080000L	/* Display Extra (Poisoned) */
2621 #define PR_STATE        0x00100000L	/* Display Extra (State) */
2622 #define PR_SPEED        0x00200000L	/* Display Extra (Speed) */
2623 #define PR_STUDY        0x00400000L	/* Display Extra (Study) */
2624 /* xxx */
2625 #define PR_EXTRA        0x01000000L	/* Display Extra Info */
2626 #define PR_BASIC        0x02000000L	/* Display Basic Info */
2627 #define PR_MAP          0x04000000L	/* Display Map */
2628 #define PR_WIPE         0x08000000L	/* Hack -- Total Redraw */
2629 /* xxx */
2630 /* xxx */
2631 /* xxx */
2632 /* xxx */
2633 
2634 
2635 /*
2636  * Bit flags for the "p_ptr->window" variable (etc)
2637  */
2638 #define PW_INVEN            0x00000001L	/* Display inven/equip */
2639 #define PW_EQUIP            0x00000002L	/* Display equip/inven */
2640 #define PW_SPELL            0x00000004L	/* Display spell list */
2641 #define PW_PLAYER           0x00000008L	/* Display character */
2642 #define PW_SCRIPT_VARS      0x00000010L	/* Display script messages */
2643 #define PW_SCRIPT_SOURCE    0x00000020L	/* Display script messages */
2644 #define PW_MESSAGE          0x00000040L	/* Display messages */
2645 #define PW_OVERHEAD         0x00000080L	/* Display overhead view */
2646 #define PW_MONSTER          0x00000100L	/* Display monster recall */
2647 #define PW_OBJECT           0x00000200L	/* Display object recall */
2648 #define PW_DUNGEON          0x00000400L	/* Display dungeon view */
2649 #define PW_SNAPSHOT         0x00000800L	/* Display snap-shot */
2650 #define PW_VISIBLE          0x00001000L	/* Display monster visible list */
2651 #define PW_BORG_1           0x00002000L	/* Display borg messages */
2652 #define PW_BORG_2           0x00004000L	/* Display borg status */
2653 
2654 
2655 /*** General index values ***/
2656 
2657 
2658 /*
2659  * Legal restrictions for "summon_specific()"
2660  */
2661 #define SUMMON_ANT                  11
2662 #define SUMMON_SPIDER               12
2663 #define SUMMON_HOUND                13
2664 #define SUMMON_HYDRA                14
2665 #define SUMMON_ANGEL                15
2666 #define SUMMON_DEMON                16
2667 #define SUMMON_UNDEAD               17
2668 #define SUMMON_DRAGON               18
2669 #define SUMMON_HI_UNDEAD            21
2670 #define SUMMON_HI_DRAGON            22
2671 #define SUMMON_AMBERITES            31
2672 #define SUMMON_UNIQUE               32
2673 #define SUMMON_BIZARRE1             33
2674 #define SUMMON_BIZARRE2             34
2675 #define SUMMON_BIZARRE3             35
2676 #define SUMMON_BIZARRE4             36
2677 #define SUMMON_BIZARRE5             37
2678 #define SUMMON_BIZARRE6             38
2679 #define SUMMON_CYBER                39
2680 #define SUMMON_KIN                  40
2681 #define SUMMON_DAWN                 41
2682 #define SUMMON_ANIMAL               42
2683 #define SUMMON_ANIMAL_RANGER        43
2684 #define SUMMON_HI_UNDEAD_NO_UNIQUES 44
2685 #define SUMMON_HI_DRAGON_NO_UNIQUES 45
2686 #define SUMMON_NO_UNIQUES           46
2687 #define SUMMON_PHANTOM              47
2688 #define SUMMON_ELEMENTAL            48
2689 #define SUMMON_BLUE_HORROR          49
2690 
2691 
2692 
2693 /*
2694  * Spell types used by project(), and related functions.
2695  */
2696 #define GF_NONE			0
2697 #define GF_ELEC         1
2698 #define GF_POIS         2
2699 #define GF_ACID         3
2700 #define GF_COLD         4
2701 #define GF_FIRE         5
2702 #define GF_MISSILE      10
2703 #define GF_ARROW        11
2704 #define GF_PLASMA       12
2705 /* Replaced with GF_HOLY_FIRE and GF_HELL_FIRE */
2706 /* #define GF_HOLY_ORB     13 */
2707 #define GF_WATER        14
2708 #define GF_LITE         15
2709 #define GF_DARK         16
2710 #define GF_LITE_WEAK    17
2711 #define GF_DARK_WEAK    18
2712 #define GF_SHARDS       20
2713 #define GF_SOUND        21
2714 #define GF_CONFUSION    22
2715 #define GF_FORCE        23
2716 #define GF_INERTIA      24
2717 #define GF_MANA         26
2718 #define GF_METEOR       27
2719 #define GF_ICE          28
2720 #define GF_CHAOS        30
2721 #define GF_NETHER       31
2722 #define GF_DISENCHANT   32
2723 #define GF_NEXUS        33
2724 #define GF_TIME         34
2725 #define GF_GRAVITY      35
2726 #define GF_KILL_WALL    40
2727 #define GF_KILL_DOOR    41
2728 #define GF_KILL_TRAP    42
2729 #define GF_MAKE_WALL    45
2730 #define GF_MAKE_DOOR    46
2731 #define GF_MAKE_TRAP    47
2732 #define GF_OLD_CLONE    51
2733 #define GF_OLD_POLY     52
2734 #define GF_OLD_HEAL     53
2735 #define GF_OLD_SPEED    54
2736 #define GF_OLD_SLOW     55
2737 #define GF_OLD_CONF		56
2738 #define GF_OLD_SLEEP    57
2739 #define GF_OLD_DRAIN	58
2740 #define GF_NEW_DRAIN	59
2741 #define GF_AWAY_UNDEAD  61
2742 #define GF_AWAY_EVIL    62
2743 #define GF_AWAY_ALL     63
2744 #define GF_TURN_UNDEAD  64
2745 #define GF_TURN_EVIL    65
2746 #define GF_TURN_ALL     66
2747 #define GF_DISP_UNDEAD  67
2748 #define GF_DISP_EVIL    68
2749 #define GF_DISP_ALL 	69
2750 #define GF_DISP_DEMON   70		/* New types for Zangband begin here... */
2751 #define GF_DISP_LIVING  71
2752 #define GF_ROCKET       72
2753 #define GF_NUKE         73
2754 #define GF_MAKE_GLYPH   74
2755 #define GF_STASIS       75
2756 #define GF_STONE_WALL   76
2757 #define GF_DEATH_RAY    77
2758 #define GF_STUN         78
2759 #define GF_HOLY_FIRE    79
2760 #define GF_HELL_FIRE    80
2761 #define GF_DISINTEGRATE 81
2762 #define GF_CHARM        82
2763 #define GF_CONTROL_UNDEAD   83
2764 #define GF_CONTROL_ANIMAL   84
2765 #define GF_PSI			85
2766 #define GF_PSI_DRAIN	86
2767 #define GF_TELEKINESIS  87
2768 #define GF_JAM_DOOR     88
2769 #define GF_DOMINATION   89
2770 #define GF_DISP_GOOD    90
2771 #define MAX_GF			91
2772 
2773 /*
2774  * Some things which induce learning
2775  */
2776 #define DRS_ACID         1
2777 #define DRS_ELEC         2
2778 #define DRS_FIRE         3
2779 #define DRS_COLD         4
2780 #define DRS_POIS         5
2781 #define DRS_NETH         6
2782 #define DRS_LITE         7
2783 #define DRS_DARK         8
2784 #define DRS_FEAR         9
2785 #define DRS_CONF        10
2786 #define DRS_CHAOS       11
2787 #define DRS_DISEN       12
2788 #define DRS_BLIND       13
2789 #define DRS_NEXUS       14
2790 #define DRS_SOUND       15
2791 #define DRS_SHARD       16
2792 #define DRS_FREE        30
2793 #define DRS_MANA        31
2794 #define DRS_REFLECT		32
2795 
2796 /*
2797  * Game generated inscription indices. These are stored in the object,
2798  * and are used to index the string array from tables.c.
2799  */
2800 
2801 #define FEEL_NONE              0
2802 #define FEEL_BROKEN            1
2803 #define FEEL_TERRIBLE          2
2804 #define FEEL_WORTHLESS         3
2805 #define FEEL_CURSED            4
2806 #define FEEL_UNCURSED          5
2807 #define FEEL_AVERAGE           6
2808 #define FEEL_GOOD              7
2809 #define FEEL_EXCELLENT         8
2810 #define FEEL_SPECIAL           9
2811 #define FEEL_BAD			   10
2812 #define FEEL_DUBIOUS		   11
2813 #define FEEL_TAINTED		   12
2814 
2815 #define FEEL_MAX               13
2816 
2817 /*
2818  * Special "xtra" object powers for ego items and some artifacts
2819  */
2820 
2821 /* Sustain one stat */
2822 #define EGO_XTRA_SUSTAIN        1
2823 
2824 /* Resistances */
2825 #define EGO_XTRA_LO_RESIST      2
2826 #define EGO_XTRA_HI_RESIST      3
2827 #define EGO_XTRA_ANY_RESIST     4
2828 
2829 /* Special ability */
2830 #define EGO_XTRA_ABILITY        5
2831 
2832 /* Special ability OR high resist */
2833 #define EGO_XTRA_POWER          6
2834 
2835 
2836 /*** Object flag values ***/
2837 
2838 
2839 /*
2840  * Chest trap flags (see "tables.c")
2841  */
2842 #define CHEST_LOSE_STR          0x01
2843 #define CHEST_LOSE_CON          0x02
2844 #define CHEST_POISON            0x04
2845 #define CHEST_PARALYZE          0x08
2846 #define CHEST_EXPLODE           0x10
2847 #define CHEST_SUMMON            0x20
2848 
2849 
2850 
2851 /*
2852  * Special Object Flags
2853  */
2854 #define OB_SENSE     0x01		/* Item has been "sensed" */
2855 #define OB_SEEN      0x02		/* Item is seen */
2856 #define OB_EMPTY     0x04		/* Item charges are known */
2857 #define OB_KNOWN     0x08		/* Item abilities are known */
2858 #define OB_STOREB    0x10		/* Item is storebought */
2859 #define OB_MENTAL    0x20		/* Item is *id*'ed */
2860 #define OB_NO_EXP    0x40		/* Item gives no score */
2861 #define OB_DUMMY4    0x80
2862 
2863 
2864 
2865 /*
2866  * Special Monster Flags (all temporary)
2867  */
2868 #define MFLAG_VIEW      0x01	/* Monster is in line of sight */
2869 #define MFLAG_TEMP      0x02	/* Monster is marked for project_hack() */
2870 #define MFLAG_XXX2      0x04	/* (unused) */
2871 #define MFLAG_XXX3      0x08	/* (unused) */
2872 #define MFLAG_MOVE      0x10	/* Monster has moved this turn */
2873 #define MFLAG_NICE      0x20	/* Monster is still being nice */
2874 #define MFLAG_SHOW      0x40	/* Monster is recently memorized */
2875 #define MFLAG_MARK      0x80	/* Monster is currently memorized */
2876 
2877 
2878 
2879 /*
2880  * As of 2.7.8, the "object flags" are valid for all objects, and as
2881  * of 2.7.9, these flags are not actually stored with the object.
2882  *
2883  * Note that "flags1" contains all flags dependant on "pval" (including
2884  * stat bonuses, but NOT stat sustainers), plus all "extra attack damage"
2885  * flags (SLAY_XXX and BRAND_XXX).
2886  *
2887  * Note that "flags2" contains all "resistances" (including "Stat Sustainers",
2888  * actual immunities, and resistances).  Note that "Hold Life" is really an
2889  * "immunity" to ExpLoss, and "Free Action" is "immunity to paralysis".
2890  *
2891  * Note that "flags3" contains everything else -- including the three "CURSED"
2892  * flags, and the "BLESSED" flag, several "item display" parameters, some new
2893  * flags for powerful Bows, and flags which affect the player in a "general"
2894  * way (LITE, TELEPATHY, SEE_INVIS, SLOW_DIGEST, REGEN, FEATHER), including
2895  * all the "general" curses (TELEPORT, AGGRAVATE, EXP_DRAIN).  It also has
2896  * four new flags called "ITEM_IGNORE_XXX" which lets an item specify that
2897  * it can not be affected by various forms of destruction.  This is NOT as
2898  * powerful as actually granting resistance/immunity to the wearer.
2899  */
2900 
2901 #define NUM_TR_SETS 4
2902 
2903 #define TR0_STR                 0x00000001L	/* STR += "pval" */
2904 #define TR0_INT                 0x00000002L	/* INT += "pval" */
2905 #define TR0_WIS                 0x00000004L	/* WIS += "pval" */
2906 #define TR0_DEX                 0x00000008L	/* DEX += "pval" */
2907 #define TR0_CON                 0x00000010L	/* CON += "pval" */
2908 #define TR0_CHR                 0x00000020L	/* CHR += "pval" */
2909 #define TR0_XXX1                0x00000040L	/* Later */
2910 #define TR0_SP                  0x00000080L	/* Extra mana */
2911 #define TR0_STEALTH             0x00000100L	/* Stealth += "pval" */
2912 #define TR0_SEARCH              0x00000200L	/* Search += "pval" */
2913 #define TR0_INFRA               0x00000400L	/* Infra += "pval" */
2914 #define TR0_TUNNEL              0x00000800L	/* Tunnel += "pval" */
2915 #define TR0_SPEED               0x00001000L	/* Speed += "pval" */
2916 #define TR0_BLOWS               0x00002000L	/* Blows += "pval" */
2917 #define TR0_CHAOTIC             0x00004000L
2918 #define TR0_VAMPIRIC            0x00008000L
2919 #define TR0_SLAY_ANIMAL         0x00010000L
2920 #define TR0_SLAY_EVIL           0x00020000L
2921 #define TR0_SLAY_UNDEAD         0x00040000L
2922 #define TR0_SLAY_DEMON          0x00080000L
2923 #define TR0_SLAY_ORC            0x00100000L
2924 #define TR0_SLAY_TROLL          0x00200000L
2925 #define TR0_SLAY_GIANT          0x00400000L
2926 #define TR0_SLAY_DRAGON         0x00800000L
2927 #define TR0_KILL_DRAGON         0x01000000L	/* Execute Dragon */
2928 #define TR0_VORPAL              0x02000000L	/* Later */
2929 #define TR0_IMPACT              0x04000000L	/* Cause Earthquakes */
2930 #define TR0_BRAND_POIS          0x08000000L
2931 #define TR0_BRAND_ACID          0x10000000L
2932 #define TR0_BRAND_ELEC          0x20000000L
2933 #define TR0_BRAND_FIRE          0x40000000L
2934 #define TR0_BRAND_COLD          0x80000000L
2935 
2936 #define TR1_SUST_STR            0x00000001L
2937 #define TR1_SUST_INT            0x00000002L
2938 #define TR1_SUST_WIS            0x00000004L
2939 #define TR1_SUST_DEX            0x00000008L
2940 #define TR1_SUST_CON            0x00000010L
2941 #define TR1_SUST_CHR            0x00000020L
2942 #define TR1_XXX1                0x00000040L	/* Later */
2943 #define TR1_IM_POIS             0x00000080L
2944 #define TR1_IM_ACID             0x00000100L
2945 #define TR1_IM_ELEC             0x00000200L
2946 #define TR1_IM_FIRE             0x00000400L
2947 #define TR1_IM_COLD             0x00000800L
2948 #define TR1_THROW               0x00001000L	/* Throwing items */
2949 #define TR1_REFLECT             0x00002000L	/* Reflect 'bolts' */
2950 #define TR1_FREE_ACT            0x00004000L	/* Free Action */
2951 #define TR1_HOLD_LIFE           0x00008000L	/* Hold Life */
2952 #define TR1_RES_ACID            0x00010000L
2953 #define TR1_RES_ELEC            0x00020000L
2954 #define TR1_RES_FIRE            0x00040000L
2955 #define TR1_RES_COLD            0x00080000L
2956 #define TR1_RES_POIS            0x00100000L
2957 #define TR1_RES_FEAR            0x00200000L	/* Added for Zangband */
2958 #define TR1_RES_LITE            0x00400000L
2959 #define TR1_RES_DARK            0x00800000L
2960 #define TR1_RES_BLIND           0x01000000L
2961 #define TR1_RES_CONF            0x02000000L
2962 #define TR1_RES_SOUND           0x04000000L
2963 #define TR1_RES_SHARDS          0x08000000L
2964 #define TR1_RES_NETHER          0x10000000L
2965 #define TR1_RES_NEXUS           0x20000000L
2966 #define TR1_RES_CHAOS           0x40000000L
2967 #define TR1_RES_DISEN           0x80000000L
2968 
2969 #define TR2_SH_FIRE             0x00000001L	/* Immolation (Fire) */
2970 #define TR2_SH_ELEC             0x00000002L	/* Electric Sheath */
2971 #define TR2_QUESTITEM           0x00000004L	/* quest level item -KMW- */
2972 #define TR2_XXX4                0x00000008L	/* Later */
2973 #define TR2_NO_TELE             0x00000010L	/* Anti-teleportation */
2974 #define TR2_NO_MAGIC            0x00000020L	/* Anti-magic */
2975 #define TR2_XXX7                0x00000040L	/* Later */
2976 #define TR2_TY_CURSE            0x00000080L	/* The Ancient Curse */
2977 #define TR2_EASY_KNOW           0x00000100L	/* Aware -> Known */
2978 #define TR2_HIDE_TYPE           0x00000200L	/* Hide "pval" description */
2979 #define TR2_SHOW_MODS           0x00000400L	/* Always show Tohit/Todam */
2980 #define TR2_INSTA_ART           0x00000800L	/* Item must be an artifact */
2981 #define TR2_FEATHER             0x00001000L	/* Feather Falling */
2982 #define TR2_LITE                0x00002000L	/* Permanent Light */
2983 #define TR2_SEE_INVIS           0x00004000L	/* See Invisible */
2984 #define TR2_TELEPATHY           0x00008000L	/* Telepathy */
2985 #define TR2_SLOW_DIGEST         0x00010000L	/* Item slows down digestion */
2986 #define TR2_REGEN               0x00020000L	/* Item induces regeneration */
2987 #define TR2_XTRA_MIGHT          0x00040000L	/* Bows get extra multiplier */
2988 #define TR2_XTRA_SHOTS          0x00080000L	/* Bows get extra shots */
2989 #define TR2_IGNORE_ACID         0x00100000L	/* Item ignores Acid Damage */
2990 #define TR2_IGNORE_ELEC         0x00200000L	/* Item ignores Elec Damage */
2991 #define TR2_IGNORE_FIRE         0x00400000L	/* Item ignores Fire Damage */
2992 #define TR2_IGNORE_COLD         0x00800000L	/* Item ignores Cold Damage */
2993 #define TR2_ACTIVATE            0x01000000L	/* Item can be activated */
2994 #define TR2_DRAIN_EXP           0x02000000L	/* Item drains Experience */
2995 #define TR2_TELEPORT            0x04000000L	/* Item teleports player */
2996 #define TR2_AGGRAVATE           0x08000000L	/* Item aggravates monsters */
2997 #define TR2_BLESSED             0x10000000L	/* Item is Blessed */
2998 #define TR2_CURSED              0x20000000L	/* Item is Cursed */
2999 #define TR2_HEAVY_CURSE         0x40000000L	/* Item is Heavily Cursed */
3000 #define TR2_PERMA_CURSE         0x80000000L	/* Item is Perma Cursed */
3001 
3002 
3003 #define TR3_LUCK_10             0x00000001L
3004 #define TR3_WILD_SHOT           0x00000002L
3005 #define TR3_WILD_WALK           0x00000004L
3006 #define TR3_EASY_ENCHANT        0x00000008L
3007 #define TR3_XXX5                0x00000010L
3008 #define TR3_XXX6                0x00000020L
3009 #define TR3_XXX7                0x00000040L
3010 #define TR3_XXX8                0x00000080L
3011 #define TR3_IM_LITE             0x00000100L
3012 #define TR3_IM_DARK             0x00000200L
3013 #define TR3_SH_ACID             0x00000400L
3014 #define TR3_SH_COLD             0x00000800L
3015 #define TR3_MUTATE              0x00001000L
3016 #define TR3_PATRON              0x00002000L
3017 #define TR3_STRANGE_LUCK        0x00004000L
3018 #define TR3_PASS_WALL           0x00008000L
3019 #define TR3_GHOUL_TOUCH         0x00010000L
3020 #define TR3_PSI_CRIT            0x00020000L
3021 #define TR3_RETURN              0x00040000L
3022 #define TR3_EXPLODE             0x00080000L
3023 #define TR3_HURT_ACID           0x00100000L
3024 #define TR3_HURT_ELEC           0x00200000L
3025 #define TR3_HURT_FIRE           0x00400000L
3026 #define TR3_HURT_COLD           0x00800000L
3027 #define TR3_HURT_LITE           0x01000000L
3028 #define TR3_HURT_DARK           0x02000000L
3029 #define TR3_XXX27               0x04000000L
3030 #define TR3_XXX28               0x08000000L
3031 #define TR3_AUTO_CURSE          0x10000000L
3032 #define TR3_DRAIN_STATS         0x20000000L
3033 #define TR3_CANT_EAT            0x40000000L
3034 #define TR3_SLOW_HEAL           0x80000000L
3035 
3036 
3037 /*
3038  * Hack -- flag set 1 -- mask for "pval-dependant" flags.
3039  * Note that all "pval" dependant flags must be in "flags1".
3040  */
3041 #define TR0_PVAL_MASK \
3042 	(TR0_STR | TR0_INT | TR0_WIS | TR0_DEX | \
3043      TR0_CON | TR0_CHR | TR0_SP | \
3044 	 TR0_STEALTH | TR0_SEARCH | TR0_INFRA | TR0_TUNNEL | \
3045      TR0_SPEED | TR0_BLOWS)
3046 
3047 /*
3048  * Flag set 1 -- mask for "easy" flags.
3049  * These flags are automatically learned if the item is worn.
3050  */
3051 #define TR0_EASY_MASK \
3052     (TR0_STR | TR0_INT | TR0_WIS | TR0_DEX | \
3053      TR0_CON | TR0_CHR | TR0_SP | \
3054      TR0_INFRA | TR0_SPEED | TR0_BLOWS)
3055 
3056 /*
3057  * Flag set 3 -- mask for "ignore element" flags.
3058  */
3059 #define TR2_IGNORE_MASK \
3060 	(TR2_IGNORE_ACID | TR2_IGNORE_ELEC | TR2_IGNORE_FIRE | \
3061 	 TR2_IGNORE_COLD )
3062 
3063 
3064 
3065 /* Helpers for the FLAG() macro */
3066 #define TR_STR				0,	TR0_STR
3067 #define TR_INT				0,	TR0_INT
3068 #define TR_WIS  		 	0,  TR0_WIS
3069 #define TR_DEX  		 	0,  TR0_DEX
3070 #define TR_CON  		 	0,  TR0_CON
3071 #define TR_CHR  		 	0,  TR0_CHR
3072 #define TR_XXX1 		 	0,  TR0_XXX1
3073 #define TR_SP			 	0,  TR0_SP
3074 #define TR_STEALTH  	 	0,  TR0_STEALTH
3075 #define TR_SEARCH		 	0,  TR0_SEARCH
3076 #define TR_INFRA		 	0,  TR0_INFRA
3077 #define TR_TUNNEL		 	0,  TR0_TUNNEL
3078 #define TR_SPEED		 	0,  TR0_SPEED
3079 #define TR_BLOWS		 	0,  TR0_BLOWS
3080 #define TR_CHAOTIC  	 	0,  TR0_CHAOTIC
3081 #define TR_VAMPIRIC 	 	0,  TR0_VAMPIRIC
3082 #define TR_SLAY_ANIMAL   	0,  TR0_SLAY_ANIMAL
3083 #define TR_SLAY_EVIL	 	0,  TR0_SLAY_EVIL
3084 #define TR_SLAY_UNDEAD   	0,  TR0_SLAY_UNDEAD
3085 #define TR_SLAY_DEMON	 	0,  TR0_SLAY_DEMON
3086 #define TR_SLAY_ORC 	 	0,  TR0_SLAY_ORC
3087 #define TR_SLAY_TROLL	 	0,  TR0_SLAY_TROLL
3088 #define TR_SLAY_GIANT	 	0,  TR0_SLAY_GIANT
3089 #define TR_SLAY_DRAGON   	0,  TR0_SLAY_DRAGON
3090 #define TR_KILL_DRAGON   	0,  TR0_KILL_DRAGON
3091 #define TR_VORPAL		 	0,  TR0_VORPAL
3092 #define TR_IMPACT		 	0,  TR0_IMPACT
3093 #define TR_BRAND_POIS	 	0,  TR0_BRAND_POIS
3094 #define TR_BRAND_ACID	 	0,  TR0_BRAND_ACID
3095 #define TR_BRAND_ELEC	 	0,  TR0_BRAND_ELEC
3096 #define TR_BRAND_FIRE	 	0,  TR0_BRAND_FIRE
3097 #define TR_BRAND_COLD	 	0,  TR0_BRAND_COLD
3098 
3099 #define TR_SUST_STR 	 	1,  TR1_SUST_STR
3100 #define TR_SUST_INT 	 	1,  TR1_SUST_INT
3101 #define TR_SUST_WIS 	 	1,  TR1_SUST_WIS
3102 #define TR_SUST_DEX 	 	1,  TR1_SUST_DEX
3103 #define TR_SUST_CON 	 	1,  TR1_SUST_CON
3104 #define TR_SUST_CHR 	 	1,  TR1_SUST_CHR
3105 #define TR_XXX2 		 	1,  TR1_XXX2
3106 #define TR_IM_POIS 		 	1,  TR1_IM_POIS
3107 #define TR_IM_ACID  	 	1,  TR1_IM_ACID
3108 #define TR_IM_ELEC  	 	1,  TR1_IM_ELEC
3109 #define TR_IM_FIRE  	 	1,  TR1_IM_FIRE
3110 #define TR_IM_COLD  	 	1,  TR1_IM_COLD
3111 #define TR_THROW		 	1,  TR1_THROW
3112 #define TR_REFLECT  	 	1,  TR1_REFLECT
3113 #define TR_FREE_ACT 	 	1,  TR1_FREE_ACT
3114 #define TR_HOLD_LIFE	 	1,  TR1_HOLD_LIFE
3115 #define TR_RES_ACID 	 	1,  TR1_RES_ACID
3116 #define TR_RES_ELEC 	 	1,  TR1_RES_ELEC
3117 #define TR_RES_FIRE 	 	1,  TR1_RES_FIRE
3118 #define TR_RES_COLD 	 	1,  TR1_RES_COLD
3119 #define TR_RES_POIS 	 	1,  TR1_RES_POIS
3120 #define TR_RES_FEAR 	 	1,  TR1_RES_FEAR
3121 #define TR_RES_LITE 	 	1,  TR1_RES_LITE
3122 #define TR_RES_DARK 	 	1,  TR1_RES_DARK
3123 #define TR_RES_BLIND	 	1,  TR1_RES_BLIND
3124 #define TR_RES_CONF 	 	1,  TR1_RES_CONF
3125 #define TR_RES_SOUND	 	1,  TR1_RES_SOUND
3126 #define TR_RES_SHARDS	 	1,  TR1_RES_SHARDS
3127 #define TR_RES_NETHER	 	1,  TR1_RES_NETHER
3128 #define TR_RES_NEXUS	 	1,  TR1_RES_NEXUS
3129 #define TR_RES_CHAOS	 	1,  TR1_RES_CHAOS
3130 #define TR_RES_DISEN	 	1,  TR1_RES_DISEN
3131 
3132 #define TR_SH_FIRE  	 	2,  TR2_SH_FIRE
3133 #define TR_SH_ELEC  	 	2,  TR2_SH_ELEC
3134 #define TR_QUESTITEM	 	2,  TR2_QUESTITEM
3135 #define TR_XXX4 		 	2,  TR2_XXX4
3136 #define TR_NO_TELE  	 	2,  TR2_NO_TELE
3137 #define TR_NO_MAGIC 	 	2,  TR2_NO_MAGIC
3138 #define TR_XXX5 		 	2,  TR2_XXX5
3139 #define TR_TY_CURSE 	 	2,  TR2_TY_CURSE
3140 #define TR_EASY_KNOW	 	2,  TR2_EASY_KNOW
3141 #define TR_HIDE_TYPE	 	2,  TR2_HIDE_TYPE
3142 #define TR_SHOW_MODS	 	2,  TR2_SHOW_MODS
3143 #define TR_INSTA_ART	 	2,  TR2_INSTA_ART
3144 #define TR_FEATHER  	 	2,  TR2_FEATHER
3145 #define TR_LITE 		 	2,  TR2_LITE
3146 #define TR_SEE_INVIS	 	2,  TR2_SEE_INVIS
3147 #define TR_TELEPATHY	 	2,  TR2_TELEPATHY
3148 #define TR_SLOW_DIGEST   	2,  TR2_SLOW_DIGEST
3149 #define TR_REGEN		 	2,  TR2_REGEN
3150 #define TR_XTRA_MIGHT	 	2,  TR2_XTRA_MIGHT
3151 #define TR_XTRA_SHOTS	 	2,  TR2_XTRA_SHOTS
3152 #define TR_IGNORE_ACID   	2,  TR2_IGNORE_ACID
3153 #define TR_IGNORE_ELEC   	2,  TR2_IGNORE_ELEC
3154 #define TR_IGNORE_FIRE   	2,  TR2_IGNORE_FIRE
3155 #define TR_IGNORE_COLD   	2,  TR2_IGNORE_COLD
3156 #define TR_ACTIVATE 	 	2,  TR2_ACTIVATE
3157 #define TR_DRAIN_EXP	 	2,  TR2_DRAIN_EXP
3158 #define TR_TELEPORT 	 	2,  TR2_TELEPORT
3159 #define TR_AGGRAVATE	 	2,  TR2_AGGRAVATE
3160 #define TR_BLESSED  	 	2,  TR2_BLESSED
3161 #define TR_CURSED		 	2,  TR2_CURSED
3162 #define TR_HEAVY_CURSE   	2,  TR2_HEAVY_CURSE
3163 #define TR_PERMA_CURSE   	2,  TR2_PERMA_CURSE
3164 
3165 
3166 #define TR_LUCK_10  	 	3,  TR3_LUCK_10
3167 #define TR_WILD_SHOT            3,  TR3_WILD_SHOT
3168 #define TR_WILD_WALK            3,  TR3_WILD_WALK
3169 #define TR_EASY_ENCHANT		3,  TR3_EASY_ENCHANT
3170 #define TR_XXX7 		 	3,  TR3_XXX7
3171 #define TR_XXX8 		 	3,  TR3_XXX8
3172 #define TR_XXX9 		 	3,  TR3_XXX9
3173 #define TR_XXX10 		 	3,  TR3_XXX10
3174 #define TR_XXX11		 	3,  TR3_XXX11
3175 #define TR_XXX12 		 	3,  TR3_XXX12
3176 #define TR_IM_LITE  	 	3,  TR3_IM_LITE
3177 #define TR_IM_DARK  	 	3,  TR3_IM_DARK
3178 #define TR_SH_ACID  	 	3,  TR3_SH_ACID
3179 #define TR_SH_COLD  	 	3,  TR3_SH_COLD
3180 #define TR_MUTATE		 	3,  TR3_MUTATE
3181 #define TR_PATRON		 	3,  TR3_PATRON
3182 #define TR_STRANGE_LUCK  	3,  TR3_STRANGE_LUCK
3183 #define TR_PASS_WALL	 	3,  TR3_PASS_WALL
3184 #define TR_GHOUL_TOUCH   	3,  TR3_GHOUL_TOUCH
3185 #define TR_PSI_CRIT 	 	3,  TR3_PSI_CRIT
3186 #define TR_RETURN		 	3,  TR3_RETURN
3187 #define TR_EXPLODE  	 	3,  TR3_EXPLODE
3188 #define TR_HURT_ACID	 	3,  TR3_HURT_ACID
3189 #define TR_HURT_ELEC	 	3,  TR3_HURT_ELEC
3190 #define TR_HURT_FIRE	 	3,  TR3_HURT_FIRE
3191 #define TR_HURT_COLD	 	3,  TR3_HURT_COLD
3192 #define TR_HURT_LITE	 	3,  TR3_HURT_LITE
3193 #define TR_HURT_DARK	 	3,  TR3_HURT_DARK
3194 #define TR_XXX27		 	3,  TR3_XXX27
3195 #define TR_XXX28		 	3,  TR3_XXX28
3196 #define TR_AUTO_CURSE	 	3,  TR3_AUTO_CURSE
3197 #define TR_DRAIN_STATS   	3,  TR3_DRAIN_STATS
3198 #define TR_CANT_EAT 	 	3,  TR3_CANT_EAT
3199 #define TR_SLOW_HEAL	 	3,  TR3_SLOW_HEAL
3200 
3201 
3202 /* Extra helpers */
3203 #define TR_PVAL_MASK     	0,	TR0_PVAL_MASK
3204 #define TR_EASY_MASK    	0,	TR0_EASY_MASK
3205 #define TR_IGNORE_MASK      2,	TR2_IGNORE_MASK
3206 
3207 
3208 /*** Monster blow constants ***/
3209 
3210 
3211 /*
3212  * New monster blow methods
3213  */
3214 #define RBM_HIT          1
3215 #define RBM_TOUCH        2
3216 #define RBM_PUNCH        3
3217 #define RBM_KICK         4
3218 #define RBM_CLAW         5
3219 #define RBM_BITE         6
3220 #define RBM_STING        7
3221 #define RBM_XXX1         8
3222 #define RBM_BUTT         9
3223 #define RBM_CRUSH       10
3224 #define RBM_ENGULF      11
3225 #define RBM_CHARGE      12
3226 #define RBM_CRAWL       13
3227 #define RBM_DROOL       14
3228 #define RBM_SPIT        15
3229 #define RBM_EXPLODE     16
3230 #define RBM_GAZE        17
3231 #define RBM_WAIL        18
3232 #define RBM_SPORE       19
3233 #define RBM_XXX4        20
3234 #define RBM_BEG         21
3235 #define RBM_INSULT      22
3236 #define RBM_MOAN        23
3237 #define RBM_SHOW        24
3238 
3239 #define MAX_RBM			25
3240 
3241 /*
3242  * New monster blow effects
3243  */
3244 #define RBE_HURT         1
3245 #define RBE_POISON       2
3246 #define RBE_UN_BONUS     3
3247 #define RBE_UN_POWER     4
3248 #define RBE_EAT_GOLD     5
3249 #define RBE_EAT_ITEM     6
3250 #define RBE_EAT_FOOD     7
3251 #define RBE_EAT_LITE     8
3252 #define RBE_ACID         9
3253 #define RBE_ELEC        10
3254 #define RBE_FIRE        11
3255 #define RBE_COLD        12
3256 #define RBE_BLIND       13
3257 #define RBE_CONFUSE     14
3258 #define RBE_TERRIFY     15
3259 #define RBE_PARALYZE    16
3260 #define RBE_LOSE_STR    17
3261 #define RBE_LOSE_INT    18
3262 #define RBE_LOSE_WIS    19
3263 #define RBE_LOSE_DEX    20
3264 #define RBE_LOSE_CON    21
3265 #define RBE_LOSE_CHR    22
3266 #define RBE_LOSE_ALL    23
3267 #define RBE_SHATTER     24
3268 #define RBE_EXP_10      25
3269 #define RBE_EXP_20      26
3270 #define RBE_EXP_40      27
3271 #define RBE_EXP_80      28
3272 #define RBE_DISEASE     29
3273 #define RBE_TIME        30
3274 #define RBE_EXP_VAMP    31
3275 
3276 
3277 /*** Monster flag values (hard-coded) ***/
3278 
3279 
3280 /*
3281  * New monster race bit flags
3282  */
3283 #define RF0_UNIQUE              0x00000001	/* Unique Monster */
3284 #define RF0_QUESTOR             0x00000002	/* Quest Monster */
3285 #define RF0_MALE                0x00000004	/* Male gender */
3286 #define RF0_FEMALE              0x00000008	/* Female gender */
3287 #define RF0_CHAR_CLEAR          0x00000010	/* Absorbs symbol */
3288 #define RF0_CHAR_MIMIC          0x00000020	/* Changes symbol */
3289 #define RF0_ATTR_CLEAR          0x00000040	/* Absorbs color */
3290 #define RF0_ATTR_MULTI          0x00000080	/* Changes color */
3291 #define RF0_FORCE_DEPTH         0x00000100	/* Start at "correct" depth */
3292 #define RF0_FORCE_MAXHP         0x00000200	/* Start with max hitpoints */
3293 #define RF0_FORCE_SLEEP         0x00000400	/* Start out sleeping */
3294 #define RF0_FORCE_EXTRA         0x00000800	/* Start out something */
3295 #define RF0_XXX_1               0x00001000	/* Unused */
3296 #define RF0_FRIENDS             0x00002000	/* Arrive with some friends */
3297 #define RF0_ESCORT              0x00004000	/* Arrive with an escort */
3298 #define RF0_ESCORTS             0x00008000	/* Arrive with some escorts */
3299 #define RF0_NEVER_BLOW          0x00010000	/* Never make physical blow */
3300 #define RF0_NEVER_MOVE          0x00020000	/* Never make physical move */
3301 #define RF0_RAND_25             0x00040000	/* Moves randomly (25%) */
3302 #define RF0_RAND_50             0x00080000	/* Moves randomly (50%) */
3303 #define RF0_ONLY_GOLD           0x00100000	/* Drop only gold */
3304 #define RF0_ONLY_ITEM           0x00200000	/* Drop only items */
3305 #define RF0_DROP_60             0x00400000	/* Drop an item/gold (60%) */
3306 #define RF0_DROP_90             0x00800000	/* Drop an item/gold (90%) */
3307 #define RF0_DROP_1D2            0x01000000	/* Drop 1d2 items/gold */
3308 #define RF0_DROP_2D2            0x02000000	/* Drop 2d2 items/gold */
3309 #define RF0_DROP_3D2            0x04000000	/* Drop 3d2 items/gold */
3310 #define RF0_DROP_4D2            0x08000000	/* Drop 4d2 items/gold */
3311 #define RF0_DROP_GOOD           0x10000000	/* Drop good items */
3312 #define RF0_DROP_GREAT          0x20000000	/* Drop great items */
3313 #define RF0_DROP_USEFUL         0x40000000	/* Drop "useful" items */
3314 #define RF0_DROP_CHOSEN         0x80000000	/* Drop "chosen" items */
3315 
3316 /*
3317  * New monster race bit flags
3318  */
3319 #define RF1_STUPID          0x00000001	/* Monster is stupid */
3320 #define RF1_SMART           0x00000002	/* Monster is smart */
3321 #define RF1_CAN_SPEAK       0x00000004	/* TY: can speak */
3322 #define RF1_REFLECTING      0x00000008	/* Reflects bolts */
3323 #define RF1_INVISIBLE       0x00000010	/* Monster avoids vision */
3324 #define RF1_COLD_BLOOD      0x00000020	/* Monster avoids infra */
3325 #define RF1_EMPTY_MIND      0x00000040	/* Monster avoids telepathy */
3326 #define RF1_WEIRD_MIND      0x00000080	/* Monster avoids telepathy? */
3327 #define RF1_MULTIPLY        0x00000100	/* Monster reproduces */
3328 #define RF1_REGENERATE      0x00000200	/* Monster regenerates */
3329 #define RF1_SHAPECHANGER    0x00000400	/* TY: shapechanger */
3330 #define RF1_ATTR_ANY        0x00000800	/* TY: Attr_any */
3331 #define RF1_POWERFUL        0x00001000	/* Monster has strong breath */
3332 #define RF1_XXX_1			0x00002000
3333 #define RF1_AURA_FIRE       0x00004000	/* Burns in melee */
3334 #define RF1_AURA_ELEC       0x00008000	/* Shocks in melee */
3335 #define RF1_OPEN_DOOR       0x00010000	/* Monster can open doors */
3336 #define RF1_BASH_DOOR       0x00020000	/* Monster can bash doors */
3337 #define RF1_PASS_WALL       0x00040000	/* Monster can pass walls */
3338 #define RF1_KILL_WALL       0x00080000	/* Monster can destroy walls */
3339 #define RF1_MOVE_BODY       0x00100000	/* Monster can move monsters */
3340 #define RF1_KILL_BODY       0x00200000	/* Monster can kill monsters */
3341 #define RF1_TAKE_ITEM       0x00400000	/* Monster can pick up items */
3342 #define RF1_KILL_ITEM       0x00800000	/* Monster can crush items */
3343 #define RF1_BRAIN_1         0x01000000
3344 #define RF1_BRAIN_2         0x02000000
3345 #define RF1_BRAIN_3         0x04000000
3346 #define RF1_BRAIN_4         0x08000000
3347 #define RF1_BRAIN_5         0x10000000
3348 #define RF1_BRAIN_6         0x20000000
3349 #define RF1_BRAIN_7         0x40000000
3350 #define RF1_QUANTUM         0x80000000	/* Monster has quantum behavior */
3351 
3352 /*
3353  * New monster race bit flags
3354  */
3355 #define RF2_ORC             0x00000001	/* Orc */
3356 #define RF2_TROLL           0x00000002	/* Troll */
3357 #define RF2_GIANT           0x00000004	/* Giant */
3358 #define RF2_DRAGON          0x00000008	/* Dragon */
3359 #define RF2_DEMON           0x00000010	/* Demon */
3360 #define RF2_UNDEAD          0x00000020	/* Undead */
3361 #define RF2_EVIL            0x00000040	/* Evil */
3362 #define RF2_ANIMAL          0x00000080	/* Animal */
3363 #define RF2_AMBERITE        0x00000100	/* TY: Amberite */
3364 #define RF2_GOOD            0x00000200	/* Good */
3365 #define RF2_AURA_COLD       0x00000400	/* Freezes in melee */
3366 #define RF2_NONLIVING       0x00000800	/* TY: Non-Living (?) */
3367 #define RF2_HURT_LITE       0x00001000	/* Hurt by lite */
3368 #define RF2_HURT_ROCK       0x00002000	/* Hurt by rock remover */
3369 #define RF2_HURT_FIRE       0x00004000	/* Hurt badly by fire */
3370 #define RF2_HURT_COLD       0x00008000	/* Hurt badly by cold */
3371 #define RF2_IM_ACID         0x00010000	/* Resist acid a lot */
3372 #define RF2_IM_ELEC         0x00020000	/* Resist elec a lot */
3373 #define RF2_IM_FIRE         0x00040000	/* Resist fire a lot */
3374 #define RF2_IM_COLD         0x00080000	/* Resist cold a lot */
3375 #define RF2_IM_POIS         0x00100000	/* Resist poison a lot */
3376 #define RF2_RES_TELE        0x00200000	/* Resist teleportation */
3377 #define RF2_RES_NETH        0x00400000	/* Resist nether a lot */
3378 #define RF2_RES_WATE        0x00800000	/* Resist water */
3379 #define RF2_RES_PLAS        0x01000000	/* Resist plasma */
3380 #define RF2_RES_NEXU        0x02000000	/* Resist nexus */
3381 #define RF2_RES_DISE        0x04000000	/* Resist disenchantment */
3382 #define RF2_UNIQUE_7        0x08000000	/* Is a "Nazgul" unique */
3383 #define RF2_NO_FEAR         0x10000000	/* Cannot be scared */
3384 #define RF2_NO_STUN         0x20000000	/* Cannot be stunned */
3385 #define RF2_NO_CONF         0x40000000	/* Cannot be confused */
3386 #define RF2_NO_SLEEP        0x80000000	/* Cannot be slept */
3387 
3388 /*
3389  * New monster race bit flags
3390  */
3391 #define RF3_SHRIEK          0x00000001	/* Shriek for help */
3392 #define RF3_ELDRITCH_HORROR 0x00000002	/* Sanity-blasting horror */
3393 #define RF3_XXX3            0x00000004	/* (?) */
3394 #define RF3_ROCKET          0x00000008	/* TY: Rocket */
3395 #define RF3_ARROW           0x00000010  /* Fire an arrow */
3396 #define RF3_XXX6            0x00000020  /* (?) */
3397 #define RF3_XXX7            0x00000040  /* (?) */
3398 #define RF3_XXX8            0x00000080  /* (?) */
3399 #define RF3_BR_ACID         0x00000100	/* Breathe Acid */
3400 #define RF3_BR_ELEC         0x00000200	/* Breathe Elec */
3401 #define RF3_BR_FIRE         0x00000400	/* Breathe Fire */
3402 #define RF3_BR_COLD         0x00000800	/* Breathe Cold */
3403 #define RF3_BR_POIS         0x00001000	/* Breathe Poison */
3404 #define RF3_BR_NETH         0x00002000	/* Breathe Nether */
3405 #define RF3_BR_LITE         0x00004000	/* Breathe Lite */
3406 #define RF3_BR_DARK         0x00008000	/* Breathe Dark */
3407 #define RF3_BR_CONF         0x00010000	/* Breathe Confusion */
3408 #define RF3_BR_SOUN         0x00020000	/* Breathe Sound */
3409 #define RF3_BR_CHAO         0x00040000	/* Breathe Chaos */
3410 #define RF3_BR_DISE         0x00080000	/* Breathe Disenchant */
3411 #define RF3_BR_NEXU         0x00100000	/* Breathe Nexus */
3412 #define RF3_BR_TIME         0x00200000	/* Breathe Time */
3413 #define RF3_BR_INER         0x00400000	/* Breathe Inertia */
3414 #define RF3_BR_GRAV         0x00800000	/* Breathe Gravity */
3415 #define RF3_BR_SHAR         0x01000000	/* Breathe Shards */
3416 #define RF3_BR_PLAS         0x02000000	/* Breathe Plasma */
3417 #define RF3_BR_WALL         0x04000000	/* Breathe Force */
3418 #define RF3_BR_MANA         0x08000000	/* Breathe Mana */
3419 #define RF3_BA_NUKE         0x10000000	/* TY: Nuke Ball */
3420 #define RF3_BR_NUKE         0x20000000	/* TY: Toxic Breath */
3421 #define RF3_BA_CHAO         0x40000000	/* TY: Logrus Ball */
3422 #define RF3_BR_DISI         0x80000000	/* Breathe Disintegration */
3423 
3424 /*
3425  * New monster race bit flags
3426  */
3427 #define RF4_BA_ACID         0x00000001	/* Acid Ball */
3428 #define RF4_BA_ELEC         0x00000002	/* Elec Ball */
3429 #define RF4_BA_FIRE         0x00000004	/* Fire Ball */
3430 #define RF4_BA_COLD         0x00000008	/* Cold Ball */
3431 #define RF4_BA_POIS         0x00000010	/* Poison Ball */
3432 #define RF4_BA_NETH         0x00000020	/* Nether Ball */
3433 #define RF4_BA_WATE         0x00000040	/* Water Ball */
3434 #define RF4_BA_MANA         0x00000080	/* Mana Storm */
3435 #define RF4_BA_DARK         0x00000100	/* Darkness Storm */
3436 #define RF4_DRAIN_MANA      0x00000200	/* Drain Mana */
3437 #define RF4_MIND_BLAST      0x00000400	/* Blast Mind */
3438 #define RF4_BRAIN_SMASH     0x00000800	/* Smash Brain */
3439 #define RF4_CAUSE_1         0x00001000	/* Cause Light Wound */
3440 #define RF4_CAUSE_2         0x00002000	/* Cause Serious Wound */
3441 #define RF4_CAUSE_3         0x00004000	/* Cause Critical Wound */
3442 #define RF4_CAUSE_4         0x00008000	/* Cause Mortal Wound */
3443 #define RF4_BO_ACID         0x00010000	/* Acid Bolt */
3444 #define RF4_BO_ELEC         0x00020000	/* Elec Bolt (unused) */
3445 #define RF4_BO_FIRE         0x00040000	/* Fire Bolt */
3446 #define RF4_BO_COLD         0x00080000	/* Cold Bolt */
3447 #define RF4_BO_POIS         0x00100000	/* Poison Bolt (unused) */
3448 #define RF4_BO_NETH         0x00200000	/* Nether Bolt */
3449 #define RF4_BO_WATE         0x00400000	/* Water Bolt */
3450 #define RF4_BO_MANA         0x00800000	/* Mana Bolt */
3451 #define RF4_BO_PLAS         0x01000000	/* Plasma Bolt */
3452 #define RF4_BO_ICEE         0x02000000	/* Ice Bolt */
3453 #define RF4_MISSILE         0x04000000	/* Magic Missile */
3454 #define RF4_SCARE           0x08000000	/* Frighten Player */
3455 #define RF4_BLIND           0x10000000	/* Blind Player */
3456 #define RF4_CONF            0x20000000	/* Confuse Player */
3457 #define RF4_SLOW            0x40000000	/* Slow Player */
3458 #define RF4_HOLD            0x80000000	/* Paralyze Player */
3459 
3460 /*
3461  * New monster race bit flags
3462  */
3463 #define RF5_HASTE           0x00000001	/* Speed self */
3464 #define RF5_HAND_DOOM       0x00000002	/* Hand of Doom */
3465 #define RF5_HEAL            0x00000004	/* Heal self */
3466 #define RF5_INVULNER        0x00000008	/* INVULNERABILITY! */
3467 #define RF5_BLINK           0x00000010	/* Teleport Short */
3468 #define RF5_TPORT           0x00000020	/* Teleport Long */
3469 #define RF5_XXX3            0x00000040	/* Move to Player (?) */
3470 #define RF5_XXX4            0x00000080	/* Move to Monster (?) */
3471 #define RF5_TELE_TO         0x00000100	/* Move player to monster */
3472 #define RF5_TELE_AWAY       0x00000200	/* Move player far away */
3473 #define RF5_TELE_LEVEL      0x00000400	/* Move player vertically */
3474 #define RF5_XXX5            0x00000800	/* Move player (?) */
3475 #define RF5_DARKNESS        0x00001000	/* Create Darkness */
3476 #define RF5_TRAPS           0x00002000	/* Create Traps */
3477 #define RF5_FORGET          0x00004000	/* Cause amnesia */
3478 #define RF5_RAISE_DEAD      0x00008000	/* Raise Dead */
3479 #define RF5_S_KIN           0x00010000	/* Summon "kin" */
3480 #define RF5_S_CYBER         0x00020000	/* Summon Cyberdemons! */
3481 #define RF5_S_MONSTER       0x00040000	/* Summon Monster */
3482 #define RF5_S_MONSTERS      0x00080000	/* Summon Monsters */
3483 #define RF5_S_ANT           0x00100000	/* Summon Ants */
3484 #define RF5_S_SPIDER        0x00200000	/* Summon Spiders */
3485 #define RF5_S_HOUND         0x00400000	/* Summon Hounds */
3486 #define RF5_S_HYDRA         0x00800000	/* Summon Hydras */
3487 #define RF5_S_ANGEL         0x01000000	/* Summon Angel */
3488 #define RF5_S_DEMON         0x02000000	/* Summon Demon */
3489 #define RF5_S_UNDEAD        0x04000000	/* Summon Undead */
3490 #define RF5_S_DRAGON        0x08000000	/* Summon Dragon */
3491 #define RF5_S_HI_UNDEAD     0x10000000	/* Summon Greater Undead */
3492 #define RF5_S_HI_DRAGON     0x20000000	/* Summon Ancient Dragon */
3493 #define RF5_S_AMBERITES     0x40000000	/* Summon Amberites */
3494 #define RF5_S_UNIQUE        0x80000000	/* Summon Unique Monster */
3495 
3496 /*
3497  * New monster race bit flags
3498  */
3499 #define RF6_AQUATIC			0x00000001	/* Aquatic monster */
3500 #define RF6_CAN_SWIM		0x00000002	/* Monster can swim */
3501 #define RF6_CAN_FLY			0x00000004	/* Monster can fly */
3502 #define RF6_FRIENDLY		0x00000008	/* Monster is friendly */
3503 #define RF6_SILLY			0x00000010	/* Monster is "silly" */
3504 #define RF6_LITE_1			0x00000020	/* Monster carries a small lite */
3505 #define RF6_LITE_2			0x00000040	/* Monster carries a large lite */
3506 #define RF6_LIBRARY			0x00000080  /* Monster has been researched at a library */
3507 
3508 /*
3509  * Monster race wilderness flags
3510  */
3511 #define RF7_WILD_FOREST1        0x00000001
3512 #define RF7_WILD_FOREST2        0x00000002
3513 #define RF7_WILD_MOUNT1         0x00000004
3514 #define RF7_WILD_MOUNT2         0x00000008
3515 #define RF7_WILD_WASTE1         0x00000010
3516 #define RF7_WILD_WASTE2         0x00000020
3517 #define RF7_WILD_SWAMP1         0x00000040
3518 #define RF7_WILD_SWAMP2         0x00000080
3519 #define RF7_WILD_SHORE          0x00000100
3520 #define RF7_WILD_OCEAN          0x00000200
3521 #define RF7_WILD_GRASS          0x00000400
3522 #define RF7_WILD_TOWN           0x00000800
3523 #define RF7_DUN_DARKWATER       0x00001000
3524 #define RF7_DUN_LAIR            0x00002000
3525 #define RF7_DUN_TEMPLE          0x00004000
3526 #define RF7_DUN_TOWER           0x00008000
3527 #define RF7_DUN_RUIN            0x00010000
3528 #define RF7_DUN_GRAVE           0x00020000
3529 #define RF7_DUN_CAVERN          0x00040000
3530 #define RF7_DUN_PLANAR          0x00080000
3531 #define RF7_DUN_HELL            0x00100000
3532 #define RF7_DUN_HORROR          0x00200000
3533 #define RF7_DUN_MINE            0x00400000
3534 #define RF7_DUN_CITY            0x00800000
3535 #define RF7_DUN_XTRA1			0x01000000
3536 #define RF7_DUN_XTRA2			0x02000000
3537 #define RF7_DUN_XTRA3			0x04000000
3538 #define RF7_DUN_XTRA4			0x08000000
3539 #define RF7_DUN_XTRA5			0x10000000
3540 #define RF7_DUN_XTRA6			0x20000000
3541 #define RF7_DUN_XTRA7			0x40000000
3542 #define RF7_DUN_XTRA8			0x80000000
3543 
3544 
3545 /*
3546  * Useful flag combinations
3547  */
3548 
3549 #define RF7_DUNGEON             0xFFFFF000
3550 #define RF7_WILD                0x000007FF
3551 
3552 
3553 /*
3554  * Monster drop info
3555  */
3556 
3557 #define RF8_DROP_CORPSE         0x00000001
3558 #define RF8_DROP_SKELETON       0x00000002
3559 
3560 /*
3561  * Hack -- choose "intelligent" spells when desperate
3562  */
3563 
3564 #define RF3_INT_MASK \
3565    0L
3566 
3567 #define RF4_INT_MASK \
3568   (RF4_HOLD | RF4_SLOW | RF4_CONF | RF4_BLIND | RF4_SCARE)
3569 
3570 #define RF5_INT_MASK \
3571    (RF5_BLINK | RF5_TPORT | RF5_TELE_LEVEL | RF5_TELE_AWAY | \
3572     RF5_HEAL | RF5_INVULNER | RF5_HASTE | RF5_TRAPS | RF5_RAISE_DEAD | \
3573     RF5_S_KIN | RF5_S_CYBER | RF5_S_MONSTER | RF5_S_MONSTERS | \
3574     RF5_S_ANT | RF5_S_SPIDER | RF5_S_HOUND | RF5_S_HYDRA | \
3575     RF5_S_ANGEL | RF5_S_DRAGON | RF5_S_UNDEAD | RF5_S_DEMON | \
3576     RF5_S_HI_DRAGON | RF5_S_HI_UNDEAD | RF5_S_AMBERITES | RF5_S_UNIQUE)
3577 
3578 
3579 /*
3580  * Hack -- "bolt" spells that may hurt fellow monsters
3581  */
3582 #define RF3_BOLT_MASK \
3583   (RF3_ROCKET | RF3_ARROW)
3584 
3585 #define RF4_BOLT_MASK \
3586    (RF4_BO_ACID | RF4_BO_ELEC | RF4_BO_FIRE | RF4_BO_COLD | \
3587     RF4_BO_POIS | RF4_BO_NETH | RF4_BO_WATE | RF4_BO_MANA | \
3588     RF4_BO_PLAS | RF4_BO_ICEE | RF4_MISSILE)
3589 
3590 #define RF5_BOLT_MASK \
3591    0L
3592 
3593 /*
3594  * Spells that hurt the player directly
3595  */
3596 #define RF3_ATTACK_MASK \
3597 	(RF3_ROCKET | RF3_ARROW |  \
3598 	 RF3_BR_ACID | RF3_BR_ELEC | RF3_BR_FIRE | RF3_BR_COLD | RF3_BR_POIS | \
3599 	 RF3_BR_NETH | RF3_BR_LITE | RF3_BR_DARK | RF3_BR_CONF | RF3_BR_SOUN | \
3600 	 RF3_BR_CHAO | RF3_BR_DISE | RF3_BR_NEXU | RF3_BR_TIME | RF3_BR_INER | \
3601 	 RF3_BR_GRAV | RF3_BR_SHAR | RF3_BR_PLAS | RF3_BR_WALL | RF3_BR_MANA | \
3602 	 RF3_BA_NUKE | RF3_BR_NUKE | RF3_BA_CHAO | RF3_BR_DISI)
3603 
3604 #define RF4_ATTACK_MASK \
3605 	(RF4_BA_ACID | RF4_BA_ELEC | RF4_BA_FIRE | RF4_BA_COLD | RF4_BA_POIS | \
3606 	 RF4_BA_NETH | RF4_BA_WATE | RF4_BA_MANA | RF4_BA_DARK | \
3607 	 RF4_MIND_BLAST | RF4_BRAIN_SMASH | RF4_CAUSE_1 | RF4_CAUSE_2 | \
3608 	 RF4_CAUSE_3 | RF4_CAUSE_4 | RF4_BO_ACID | RF4_BO_ELEC | RF4_BO_FIRE | \
3609 	 RF4_BO_COLD | RF4_BO_POIS | RF4_BO_NETH | RF4_BO_WATE | RF4_BO_MANA | \
3610 	 RF4_BO_PLAS | RF4_BO_ICEE | RF4_MISSILE)
3611 
3612 #define RF5_ATTACK_MASK \
3613 	(RF5_HAND_DOOM)
3614 
3615 
3616 
3617 /*
3618  * Spells that allow the caster to escape
3619  */
3620 #define RF3_ESCAPE_MASK \
3621 	(0L)
3622 
3623 #define RF4_ESCAPE_MASK \
3624 	(0L)
3625 
3626 #define RF5_ESCAPE_MASK \
3627 	(RF5_BLINK | RF5_TPORT | RF5_TELE_AWAY | RF5_TELE_LEVEL)
3628 
3629 
3630 
3631 /*
3632  * Hack -- 'ball' spells that may hurt friends
3633  */
3634 #define RF3_BALL_MASK \
3635 	(RF3_ROCKET | RF3_BR_ACID | RF3_BR_ELEC | RF3_BR_FIRE | \
3636 	RF3_BR_COLD | RF3_BR_POIS | RF3_BR_NETH | RF3_BR_LITE | \
3637 	RF3_BR_DARK | RF3_BR_CONF | RF3_BR_SOUN | RF3_BR_CHAO | \
3638 	RF3_BR_DISE | RF3_BR_NEXU | RF3_BR_SHAR | \
3639 	RF3_BR_SOUN | RF3_BR_TIME | RF3_BR_INER | RF3_BR_GRAV | \
3640 	RF3_BR_PLAS | RF3_BR_WALL | RF3_BR_MANA | RF3_BA_NUKE | \
3641 	RF3_BR_NUKE | RF3_BA_CHAO | RF3_BR_DISI)
3642 
3643 #define RF4_BALL_MASK \
3644 	(RF4_BA_ACID | RF4_BA_ELEC | RF4_BA_FIRE | RF4_BA_COLD | \
3645 	RF4_BA_NETH | RF4_BA_DARK | RF4_BA_WATE | RF4_BA_MANA)
3646 
3647 #define RF5_BALL_MASK \
3648 	0L
3649 
3650 
3651 /* Hack -- summon spells */
3652 
3653 #define RF3_SUMMON_MASK \
3654     0L
3655 
3656 #define RF4_SUMMON_MASK \
3657     0L
3658 
3659 #define RF5_SUMMON_MASK \
3660     (RF5_S_KIN | RF5_S_CYBER | RF5_S_MONSTER | RF5_S_MONSTERS | RF5_S_ANT | \
3661      RF5_S_SPIDER | RF5_S_HOUND | RF5_S_HYDRA | RF5_S_ANGEL | RF5_S_DEMON | \
3662      RF5_S_UNDEAD | RF5_S_DRAGON | RF5_S_HI_UNDEAD | RF5_S_HI_DRAGON | \
3663      RF5_S_AMBERITES | RF5_S_UNIQUE)
3664 
3665 
3666 /*
3667  * Spells that improve the caster's tactical position
3668  */
3669 #define RF3_TACTIC_MASK \
3670 	(0L)
3671 
3672 #define RF4_TACTIC_MASK \
3673 	(0L)
3674 
3675 #define RF5_TACTIC_MASK \
3676 	(RF5_BLINK)
3677 
3678 
3679 /*
3680  * Annoying spells
3681  */
3682 #define RF3_ANNOY_MASK \
3683 	(RF3_SHRIEK | RF3_ELDRITCH_HORROR)
3684 
3685 #define RF4_ANNOY_MASK \
3686 	(RF4_DRAIN_MANA | RF4_MIND_BLAST | RF4_BRAIN_SMASH | \
3687 	RF4_CAUSE_1 | RF4_CAUSE_2 | RF4_CAUSE_3 | RF4_CAUSE_4 | \
3688 	RF4_SCARE | RF4_BLIND | RF4_CONF | RF4_SLOW | RF4_HOLD)
3689 
3690 #define RF5_ANNOY_MASK \
3691 	(RF5_TELE_TO | RF5_DARKNESS | RF5_TRAPS | RF5_FORGET | RF5_RAISE_DEAD)
3692 
3693 
3694 /*
3695  * Spells that increase the caster's relative speed
3696  */
3697 #define RF3_HASTE_MASK \
3698 	(0L)
3699 
3700 #define RF4_HASTE_MASK \
3701 	(RF4_SLOW | RF4_HOLD)
3702 
3703 #define RF5_HASTE_MASK \
3704 	(RF5_HASTE)
3705 
3706 /*
3707  * Spells that give invulnerability
3708  */
3709 #define RF3_INVULN_MASK \
3710 	(0L)
3711 
3712 #define RF4_INVULN_MASK \
3713 	(0L)
3714 
3715 #define RF5_INVULN_MASK \
3716 	(RF5_INVULNER)
3717 
3718 /*
3719  * Healing spells
3720  */
3721 #define RF3_HEAL_MASK \
3722 	(0L)
3723 
3724 #define RF4_HEAL_MASK \
3725 	(0L)
3726 
3727 #define RF5_HEAL_MASK \
3728 	(RF5_HEAL)
3729 
3730 
3731 /*
3732  * Innate spell-like effects
3733  */
3734 #define RF3_INNATE_MASK \
3735 	(RF3_SHRIEK | RF3_ELDRITCH_HORROR | RF3_ARROW | \
3736 	 RF3_BR_ACID | RF3_BR_ELEC | RF3_BR_FIRE | \
3737 	 RF3_BR_COLD | RF3_BR_POIS | RF3_BR_NETH | RF3_BR_LITE | RF3_BR_DARK | \
3738 	 RF3_BR_CONF | RF3_BR_SOUN | RF3_BR_CHAO | RF3_BR_DISE | RF3_BR_NEXU | \
3739 	 RF3_BR_TIME | RF3_BR_INER | RF3_BR_GRAV | RF3_BR_SHAR | RF3_BR_PLAS | \
3740 	 RF3_BR_WALL | RF3_BR_MANA | RF3_BR_NUKE | RF3_BR_DISI)
3741 
3742 #define RF4_INNATE_MASK \
3743 	(0L)
3744 
3745 #define RF5_INNATE_MASK \
3746 	(0L)
3747 
3748 
3749 /*
3750  * Breath mask
3751  */
3752 #define RF3_BREATHS \
3753 	(RF3_BR_ACID | RF3_BR_ELEC | RF3_BR_FIRE | RF3_BR_COLD | RF3_BR_POIS | \
3754 	 RF3_BR_NETH | RF3_BR_LITE | RF3_BR_DARK | RF3_BR_CONF | RF3_BR_SOUN | \
3755 	 RF3_BR_CHAO | RF3_BR_DISE | RF3_BR_NEXU | RF3_BR_TIME | RF3_BR_INER | \
3756 	 RF3_BR_GRAV | RF3_BR_SHAR | RF3_BR_PLAS | RF3_BR_WALL | RF3_BR_MANA | \
3757 	 RF3_BR_NUKE | RF3_BR_DISI)
3758 
3759 
3760 #define RF_UNIQUE			   0,  RF0_UNIQUE
3761 #define RF_QUESTOR  		   0,  RF0_QUESTOR
3762 #define RF_MALE 			   0,  RF0_MALE
3763 #define RF_FEMALE			   0,  RF0_FEMALE
3764 #define RF_CHAR_CLEAR		   0,  RF0_CHAR_CLEAR
3765 #define RF_CHAR_MIMIC		   0,  RF0_CHAR_MIMIC
3766 #define RF_ATTR_CLEAR		   0,  RF0_ATTR_CLEAR
3767 #define RF_ATTR_MULTI		   0,  RF0_ATTR_MULTI
3768 #define RF_FORCE_DEPTH  	   0,  RF0_FORCE_DEPTH
3769 #define RF_FORCE_MAXHP  	   0,  RF0_FORCE_MAXHP
3770 #define RF_FORCE_SLEEP  	   0,  RF0_FORCE_SLEEP
3771 #define RF_FORCE_EXTRA  	   0,  RF0_FORCE_EXTRA
3772 #define RF_XXX_1			   0,  RF0_XXX_1
3773 #define RF_FRIENDS  		   0,  RF0_FRIENDS
3774 #define RF_ESCORT			   0,  RF0_ESCORT
3775 #define RF_ESCORTS  		   0,  RF0_ESCORTS
3776 #define RF_NEVER_BLOW		   0,  RF0_NEVER_BLOW
3777 #define RF_NEVER_MOVE		   0,  RF0_NEVER_MOVE
3778 #define RF_RAND_25  		   0,  RF0_RAND_25
3779 #define RF_RAND_50  		   0,  RF0_RAND_50
3780 #define RF_ONLY_GOLD		   0,  RF0_ONLY_GOLD
3781 #define RF_ONLY_ITEM		   0,  RF0_ONLY_ITEM
3782 #define RF_DROP_60  		   0,  RF0_DROP_60
3783 #define RF_DROP_90  		   0,  RF0_DROP_90
3784 #define RF_DROP_1D2 		   0,  RF0_DROP_1D2
3785 #define RF_DROP_2D2 		   0,  RF0_DROP_2D2
3786 #define RF_DROP_3D2 		   0,  RF0_DROP_3D2
3787 #define RF_DROP_4D2 		   0,  RF0_DROP_4D2
3788 #define RF_DROP_GOOD		   0,  RF0_DROP_GOOD
3789 #define RF_DROP_GREAT		   0,  RF0_DROP_GREAT
3790 #define RF_DROP_USEFUL  	   0,  RF0_DROP_USEFUL
3791 #define RF_DROP_CHOSEN  	   0,  RF0_DROP_CHOSEN
3792 
3793 /*
3794  * New monster race bit flags
3795  */
3796 #define RF_STUPID			   1,  RF1_STUPID
3797 #define RF_SMART			   1,  RF1_SMART
3798 #define RF_CAN_SPEAK		   1,  RF1_CAN_SPEAK
3799 #define RF_REFLECTING		   1,  RF1_REFLECTING
3800 #define RF_INVISIBLE		   1,  RF1_INVISIBLE
3801 #define RF_COLD_BLOOD		   1,  RF1_COLD_BLOOD
3802 #define RF_EMPTY_MIND		   1,  RF1_EMPTY_MIND
3803 #define RF_WEIRD_MIND		   1,  RF1_WEIRD_MIND
3804 #define RF_MULTIPLY 		   1,  RF1_MULTIPLY
3805 #define RF_REGENERATE		   1,  RF1_REGENERATE
3806 #define RF_SHAPECHANGER 	   1,  RF1_SHAPECHANGER
3807 #define RF_ATTR_ANY 		   1,  RF1_ATTR_ANY
3808 #define RF_POWERFUL 		   1,  RF1_POWERFUL
3809 #define RF_XXX_2			   1,  RF1_XXX_2
3810 #define RF_AURA_FIRE		   1,  RF1_AURA_FIRE
3811 #define RF_AURA_ELEC		   1,  RF1_AURA_ELEC
3812 #define RF_OPEN_DOOR		   1,  RF1_OPEN_DOOR
3813 #define RF_BASH_DOOR		   1,  RF1_BASH_DOOR
3814 #define RF_PASS_WALL		   1,  RF1_PASS_WALL
3815 #define RF_KILL_WALL		   1,  RF1_KILL_WALL
3816 #define RF_MOVE_BODY		   1,  RF1_MOVE_BODY
3817 #define RF_KILL_BODY		   1,  RF1_KILL_BODY
3818 #define RF_TAKE_ITEM		   1,  RF1_TAKE_ITEM
3819 #define RF_KILL_ITEM		   1,  RF1_KILL_ITEM
3820 #define RF_BRAIN_1  		   1,  RF1_BRAIN_1
3821 #define RF_BRAIN_2  		   1,  RF1_BRAIN_2
3822 #define RF_BRAIN_3  		   1,  RF1_BRAIN_3
3823 #define RF_BRAIN_4  		   1,  RF1_BRAIN_4
3824 #define RF_BRAIN_5  		   1,  RF1_BRAIN_5
3825 #define RF_BRAIN_6  		   1,  RF1_BRAIN_6
3826 #define RF_BRAIN_7  		   1,  RF1_BRAIN_7
3827 #define RF_QUANTUM  		   1,  RF1_QUANTUM
3828 
3829 /*
3830  * New monster race bit flag
3831  */
3832 #define RF_ORC  			   2,  RF2_ORC
3833 #define RF_TROLL			   2,  RF2_TROLL
3834 #define RF_GIANT			   2,  RF2_GIANT
3835 #define RF_DRAGON			   2,  RF2_DRAGON
3836 #define RF_DEMON			   2,  RF2_DEMON
3837 #define RF_UNDEAD			   2,  RF2_UNDEAD
3838 #define RF_EVIL 			   2,  RF2_EVIL
3839 #define RF_ANIMAL			   2,  RF2_ANIMAL
3840 #define RF_AMBERITE 		   2,  RF2_AMBERITE
3841 #define RF_GOOD 			   2,  RF2_GOOD
3842 #define RF_AURA_COLD		   2,  RF2_AURA_COLD
3843 #define RF_NONLIVING		   2,  RF2_NONLIVING
3844 #define RF_HURT_LITE		   2,  RF2_HURT_LITE
3845 #define RF_HURT_ROCK		   2,  RF2_HURT_ROCK
3846 #define RF_HURT_FIRE		   2,  RF2_HURT_FIRE
3847 #define RF_HURT_COLD		   2,  RF2_HURT_COLD
3848 #define RF_IM_ACID  		   2,  RF2_IM_ACID
3849 #define RF_IM_ELEC  		   2,  RF2_IM_ELEC
3850 #define RF_IM_FIRE  		   2,  RF2_IM_FIRE
3851 #define RF_IM_COLD  		   2,  RF2_IM_COLD
3852 #define RF_IM_POIS  		   2,  RF2_IM_POIS
3853 #define RF_RES_TELE 		   2,  RF2_RES_TELE
3854 #define RF_RES_NETH 		   2,  RF2_RES_NETH
3855 #define RF_RES_WATE 		   2,  RF2_RES_WATE
3856 #define RF_RES_PLAS 		   2,  RF2_RES_PLAS
3857 #define RF_RES_NEXU 		   2,  RF2_RES_NEXU
3858 #define RF_RES_DISE 		   2,  RF2_RES_DISE
3859 #define RF_UNIQUE_7 		   2,  RF2_UNIQUE_7
3860 #define RF_NO_FEAR  		   2,  RF2_NO_FEAR
3861 #define RF_NO_STUN  		   2,  RF2_NO_STUN
3862 #define RF_NO_CONF  		   2,  RF2_NO_CONF
3863 #define RF_NO_SLEEP 		   2,  RF2_NO_SLEEP
3864 
3865 /*
3866  * New monster race bit flag
3867  */
3868 #define RF_SHRIEK			   3,  RF3_SHRIEK
3869 #define RF_ELDRITCH_HORROR     3,  RF3_ELDRITCH_HORROR
3870 #define RF_XXX3 			   3,  RF3_XXX3
3871 #define RF_ROCKET			   3,  RF3_ROCKET
3872 #define RF_ARROW  		   3,  RF3_ARROW
3873 #define RF_XXX6X4  		   3,  RF3_XXX6
3874 #define RF_XXX7X4  		   3,  RF3_XXX7
3875 #define RF_XXX8X4  		   3,  RF3_XXX8
3876 #define RF_BR_ACID  		   3,  RF3_BR_ACID
3877 #define RF_BR_ELEC  		   3,  RF3_BR_ELEC
3878 #define RF_BR_FIRE  		   3,  RF3_BR_FIRE
3879 #define RF_BR_COLD  		   3,  RF3_BR_COLD
3880 #define RF_BR_POIS  		   3,  RF3_BR_POIS
3881 #define RF_BR_NETH  		   3,  RF3_BR_NETH
3882 #define RF_BR_LITE  		   3,  RF3_BR_LITE
3883 #define RF_BR_DARK  		   3,  RF3_BR_DARK
3884 #define RF_BR_CONF  		   3,  RF3_BR_CONF
3885 #define RF_BR_SOUN  		   3,  RF3_BR_SOUN
3886 #define RF_BR_CHAO  		   3,  RF3_BR_CHAO
3887 #define RF_BR_DISE  		   3,  RF3_BR_DISE
3888 #define RF_BR_NEXU  		   3,  RF3_BR_NEXU
3889 #define RF_BR_TIME  		   3,  RF3_BR_TIME
3890 #define RF_BR_INER  		   3,  RF3_BR_INER
3891 #define RF_BR_GRAV  		   3,  RF3_BR_GRAV
3892 #define RF_BR_SHAR  		   3,  RF3_BR_SHAR
3893 #define RF_BR_PLAS  		   3,  RF3_BR_PLAS
3894 #define RF_BR_WALL  		   3,  RF3_BR_WALL
3895 #define RF_BR_MANA  		   3,  RF3_BR_MANA
3896 #define RF_BA_NUKE  		   3,  RF3_BA_NUKE
3897 #define RF_BR_NUKE  		   3,  RF3_BR_NUKE
3898 #define RF_BA_CHAO  		   3,  RF3_BA_CHAO
3899 #define RF_BR_DISI  		   3,  RF3_BR_DISI
3900 
3901 /*
3902  * New monster race bit flag
3903  */
3904 #define RF_BA_ACID  		   4,  RF4_BA_ACID
3905 #define RF_BA_ELEC  		   4,  RF4_BA_ELEC
3906 #define RF_BA_FIRE  		   4,  RF4_BA_FIRE
3907 #define RF_BA_COLD  		   4,  RF4_BA_COLD
3908 #define RF_BA_POIS  		   4,  RF4_BA_POIS
3909 #define RF_BA_NETH  		   4,  RF4_BA_NETH
3910 #define RF_BA_WATE  		   4,  RF4_BA_WATE
3911 #define RF_BA_MANA  		   4,  RF4_BA_MANA
3912 #define RF_BA_DARK  		   4,  RF4_BA_DARK
3913 #define RF_DRAIN_MANA		   4,  RF4_DRAIN_MANA
3914 #define RF_MIND_BLAST		   4,  RF4_MIND_BLAST
3915 #define RF_BRAIN_SMASH  	   4,  RF4_BRAIN_SMASH
3916 #define RF_CAUSE_1  		   4,  RF4_CAUSE_1
3917 #define RF_CAUSE_2  		   4,  RF4_CAUSE_2
3918 #define RF_CAUSE_3  		   4,  RF4_CAUSE_3
3919 #define RF_CAUSE_4  		   4,  RF4_CAUSE_4
3920 #define RF_BO_ACID  		   4,  RF4_BO_ACID
3921 #define RF_BO_ELEC  		   4,  RF4_BO_ELEC
3922 #define RF_BO_FIRE  		   4,  RF4_BO_FIRE
3923 #define RF_BO_COLD  		   4,  RF4_BO_COLD
3924 #define RF_BO_POIS  		   4,  RF4_BO_POIS
3925 #define RF_BO_NETH  		   4,  RF4_BO_NETH
3926 #define RF_BO_WATE  		   4,  RF4_BO_WATE
3927 #define RF_BO_MANA  		   4,  RF4_BO_MANA
3928 #define RF_BO_PLAS  		   4,  RF4_BO_PLAS
3929 #define RF_BO_ICEE  		   4,  RF4_BO_ICEE
3930 #define RF_MISSILE  		   4,  RF4_MISSILE
3931 #define RF_SCARE			   4,  RF4_SCARE
3932 #define RF_BLIND			   4,  RF4_BLIND
3933 #define RF_CONF 			   4,  RF4_CONF
3934 #define RF_SLOW 			   4,  RF4_SLOW
3935 #define RF_HOLD 			   4,  RF4_HOLD
3936 
3937 /*
3938  * New monster race bit flag
3939  */
3940 #define RF_HASTE			   5,  RF5_HASTE
3941 #define RF_HAND_DOOM		   5,  RF5_HAND_DOOM
3942 #define RF_HEAL 			   5,  RF5_HEAL
3943 #define RF_INVULNER 		   5,  RF5_INVULNER
3944 #define RF_BLINK			   5,  RF5_BLINK
3945 #define RF_TPORT			   5,  RF5_TPORT
3946 #define RF_XXX4 			   5,  RF5_XXX4
3947 #define RF_XXX5 			   5,  RF5_XXX5
3948 #define RF_TELE_TO  		   5,  RF5_TELE_TO
3949 #define RF_TELE_AWAY		   5,  RF5_TELE_AWAY
3950 #define RF_TELE_LEVEL		   5,  RF5_TELE_LEVEL
3951 #define RF_XXX6 			   5,  RF5_XXX6
3952 #define RF_DARKNESS 		   5,  RF5_DARKNESS
3953 #define RF_TRAPS			   5,  RF5_TRAPS
3954 #define RF_FORGET			   5,  RF5_FORGET
3955 #define RF_RAISE_DEAD		   5,  RF5_RAISE_DEAD
3956 #define RF_S_KIN			   5,  RF5_S_KIN
3957 #define RF_S_CYBER  		   5,  RF5_S_CYBER
3958 #define RF_S_MONSTER		   5,  RF5_S_MONSTER
3959 #define RF_S_MONSTERS		   5,  RF5_S_MONSTERS
3960 #define RF_S_ANT			   5,  RF5_S_ANT
3961 #define RF_S_SPIDER 		   5,  RF5_S_SPIDER
3962 #define RF_S_HOUND  		   5,  RF5_S_HOUND
3963 #define RF_S_HYDRA  		   5,  RF5_S_HYDRA
3964 #define RF_S_ANGEL  		   5,  RF5_S_ANGEL
3965 #define RF_S_DEMON  		   5,  RF5_S_DEMON
3966 #define RF_S_UNDEAD 		   5,  RF5_S_UNDEAD
3967 #define RF_S_DRAGON 		   5,  RF5_S_DRAGON
3968 #define RF_S_HI_UNDEAD  	   5,  RF5_S_HI_UNDEAD
3969 #define RF_S_HI_DRAGON  	   5,  RF5_S_HI_DRAGON
3970 #define RF_S_AMBERITES  	   5,  RF5_S_AMBERITES
3971 #define RF_S_UNIQUE 		   5,  RF5_S_UNIQUE
3972 
3973 /*
3974  * New monster race bit flag
3975  */
3976 #define RF_AQUATIC  		   6,  RF6_AQUATIC
3977 #define RF_CAN_SWIM 		   6,  RF6_CAN_SWIM
3978 #define RF_CAN_FLY  		   6,  RF6_CAN_FLY
3979 #define RF_FRIENDLY 		   6,  RF6_FRIENDLY
3980 #define RF_SILLY			   6,  RF6_SILLY
3981 #define RF_LITE_1			   6,  RF6_LITE_1
3982 #define RF_LITE_2			   6,  RF6_LITE_2
3983 #define RF_LIBRARY			   6,  RF6_LIBRARY
3984 
3985 /*
3986  * Monster race wilderness flags
3987  */
3988 #define RF_WILD_FOREST1 	   7,  RF7_WILD_FOREST1
3989 #define RF_WILD_FOREST2 	   7,  RF7_WILD_FOREST2
3990 #define RF_WILD_MOUNT1  	   7,  RF7_WILD_MOUNT1
3991 #define RF_WILD_MOUNT2  	   7,  RF7_WILD_MOUNT2
3992 #define RF_WILD_WASTE1  	   7,  RF7_WILD_WASTE1
3993 #define RF_WILD_WASTE2  	   7,  RF7_WILD_WASTE2
3994 #define RF_WILD_SWAMP1  	   7,  RF7_WILD_SWAMP1
3995 #define RF_WILD_SWAMP2  	   7,  RF7_WILD_SWAMP2
3996 #define RF_WILD_SHORE		   7,  RF7_WILD_SHORE
3997 #define RF_WILD_OCEAN		   7,  RF7_WILD_OCEAN
3998 #define RF_WILD_GRASS		   7,  RF7_WILD_GRASS
3999 #define RF_WILD_TOWN		   7,  RF7_WILD_TOWN
4000 #define RF_DUN_DARKWATER	   7,  RF7_DUN_DARKWATER
4001 #define RF_DUN_LAIR 		   7,  RF7_DUN_LAIR
4002 #define RF_DUN_TEMPLE		   7,  RF7_DUN_TEMPLE
4003 #define RF_DUN_TOWER		   7,  RF7_DUN_TOWER
4004 #define RF_DUN_RUIN 		   7,  RF7_DUN_RUIN
4005 #define RF_DUN_GRAVE		   7,  RF7_DUN_GRAVE
4006 #define RF_DUN_CAVERN		   7,  RF7_DUN_CAVERN
4007 #define RF_DUN_PLANAR		   7,  RF7_DUN_PLANAR
4008 #define RF_DUN_HELL 		   7,  RF7_DUN_HELL
4009 #define RF_DUN_HORROR		   7,  RF7_DUN_HORROR
4010 #define RF_DUN_MINE 		   7,  RF7_DUN_MINE
4011 #define RF_DUN_CITY 		   7,  RF7_DUN_CITY
4012 #define RF_DUN_XTRA1		   7,  RF7_DUN_XTRA1
4013 #define RF_DUN_XTRA2		   7,  RF7_DUN_XTRA2
4014 #define RF_DUN_XTRA3		   7,  RF7_DUN_XTRA3
4015 #define RF_DUN_XTRA4		   7,  RF7_DUN_XTRA4
4016 #define RF_DUN_XTRA5		   7,  RF7_DUN_XTRA5
4017 #define RF_DUN_XTRA6		   7,  RF7_DUN_XTRA6
4018 #define RF_DUN_XTRA7		   7,  RF7_DUN_XTRA7
4019 #define RF_DUN_XTRA8		   7,  RF7_DUN_XTRA8
4020 
4021 
4022 #define RF_DUNGEON             7,  RF7_DUNGEON
4023 #define RF_WILD                7,  RF7_WILD
4024 
4025 #define RF_DROP_CORPSE         8,  RF8_DROP_CORPSE
4026 #define RF_DROP_SKELETON       8,  RF8_DROP_SKELETON
4027 
4028 /*
4029  * Flag manipulation macros
4030  */
4031 #ifdef _MSC_VER
4032 
4033 /* Hack - VC++ doesn't expand preprocessor macros properly */
FLAG_AUX(const u32b * flags,int num,u32b mask)4034 static __inline bool FLAG_AUX(const u32b *flags, int num, u32b mask)
4035 {
4036 	return((flags[num] & mask) != 0);
4037 }
4038 
SET_FLAG_AUX(u32b * flags,int num,u32b mask)4039 static __inline void SET_FLAG_AUX(u32b *flags, int num, u32b mask)
4040 {
4041 	flags[num] |= mask;
4042 }
4043 
COPY_FLAG_AUX(const u32b * flags1,u32b * flags2,int num,u32b mask)4044 static __inline void COPY_FLAG_AUX(const u32b *flags1, u32b *flags2, int num, u32b mask)
4045 {
4046 	flags2[num] |= flags1[num] & mask;
4047 }
4048 
4049 #else /* _MSC_VER */
4050 #define FLAG_AUX(A, NUM, MASK) (((A)[NUM] & (MASK)) != 0)
4051 #define SET_FLAG_AUX(A, NUM, MASK) ((A)[NUM] |= (MASK))
4052 #define COPY_FLAG_AUX(A1, A2, NUM, MASK) ((A2)[NUM] |= ((A1)[NUM] & (MASK)))
4053 #endif /* _MSC_VER */
4054 
4055 #define FLAG(P, F) FLAG_AUX((P)->flags, F)
4056 #define SET_FLAG(P, F) SET_FLAG_AUX((P)->flags, F)
4057 #define COPY_FLAG(P1, P2, F) COPY_FLAG_AUX((P1)->flags, (P2)->flags, F)
4058 #define KN_FLAG(P, F) FLAG_AUX((P)->kn_flags, F)
4059 
4060 
4061 /* Skills */
4062 #define MAX_SKILL	10
4063 
4064 #define SKILL_DIS	0 /* Skill: Disarming */
4065 #define SKILL_DEV	1 /* Skill: Magic Devices */
4066 #define SKILL_SAV	2 /* Skill: Saving throw */
4067 #define SKILL_STL	3 /* Skill: Stealth factor */
4068 #define SKILL_SNS	4 /* Skill: Sensing ability */
4069 #define SKILL_FOS	5 /* Skill: Searching frequency */
4070 #define SKILL_THN	6 /* Skill: To hit (normal) */
4071 #define SKILL_THB	7 /* Skill: To hit (shooting) */
4072 #define SKILL_THT	8 /* Skill: To hit (throwing) */
4073 #define SKILL_DIG	9 /* Skill: Digging */
4074 
4075 /*** Menu Stuff ***/
4076 
4077 
4078 /* Menu seperator */
4079 #define MENU_SEPERATOR {"", NULL, NULL, 0x00}
4080 
4081 /* Menu terminator */
4082 #define MENU_END {NULL, NULL, NULL, 0x00}
4083 
4084 #define MN_ACTIVE		0x01	/* Available to choose */
4085 #define MN_SELECT		0x02	/* Can 'select' action */
4086 #define MN_CLEAR		0x04	/* Clear screen before calling */
4087 
4088 /*** Option Definitions ***/
4089 
4090 /*
4091  * Option indexes (offsets)
4092  *
4093  * These values are hard-coded by savefiles (and various pieces of code).
4094  */
4095 
4096 #define OPT_MAX					256
4097 #define OPT_PLAYER				192
4098 #define OPT_BIRTH				32
4099 #define OPT_SERVER				32
4100 
4101 #define OPT_FLAG_BIRTH			0x01
4102 #define OPT_FLAG_SERVER			0x02
4103 #define OPT_FLAG_PLAYER			0x04
4104 
4105 
4106 #define OPT_BIRTH_PAGE			6
4107 
4108 /* Option set 0 */
4109 
4110 #define rogue_like_commands		p_ptr->options[0]
4111 #define quick_messages			p_ptr->options[1]
4112 /* {TRUE,  0, NULL,					"Number 2" }, p_ptr->options[2] */
4113 #define carry_query_flag		p_ptr->options[3]
4114 #define use_old_target			p_ptr->options[4]
4115 #define always_pickup			p_ptr->options[5]
4116 /* {TRUE,  0, NULL,					"Number 6" }, p_ptr->options[6] */
4117 #define depth_in_feet			p_ptr->options[7]
4118 /* {TRUE,  0, NULL,					"Number 8" }, p_ptr->options[8] */
4119 /* {FALSE, 0, NULL,					"Number 9" }, p_ptr->options[9] */
4120 #define show_labels				p_ptr->options[10]
4121 #define show_weights			p_ptr->options[11]
4122 #define view_monster_grids		p_ptr->options[12]
4123 #define toggle_xp				p_ptr->options[13]
4124 #define ring_bell				p_ptr->options[14]
4125 #define use_color				p_ptr->options[15]
4126 #define find_ignore_stairs		p_ptr->options[16]
4127 #define find_ignore_doors		p_ptr->options[17]
4128 #define find_cut				p_ptr->options[18]
4129 #define find_examine			p_ptr->options[19]
4130 #define disturb_view			p_ptr->options[20]
4131 #define disturb_near			p_ptr->options[21]
4132 #define disturb_panel			p_ptr->options[22]
4133 #define disturb_state			p_ptr->options[23]
4134 #define disturb_minor			p_ptr->options[24]
4135 #define disturb_other			p_ptr->options[25]
4136 #define disturb_traps			p_ptr->options[26]
4137 #define auto_more				p_ptr->options[27]
4138 #define last_words				p_ptr->options[28]
4139 #define speak_unique			p_ptr->options[29]
4140 #define small_levels			svr_ptr->options[0]
4141 /* {TRUE,  0, NULL,					"Number 31" }, p_ptr->options[30] */
4142 
4143 /* Option set 1 */
4144 
4145 /* {TRUE,  0, NULL,					"Number 32" }, svr_ptr->options[1] */
4146 /* {TRUE,  0, NULL,					"Number 33" }, svr_ptr->options[2] */
4147 /* {TRUE,  0, NULL,					"Number 34" }, svr_ptr->options[3] */
4148 /* {TRUE,  0, NULL,					"Number 35" }, svr_ptr->options[4] */
4149 /* {TRUE, 0, NULL, 					"Number 36" }, svr_ptr->options[5] */
4150 #define expand_list				svr_ptr->options[6]
4151 /* {TRUE, 0, NULL, 					"Number 38" }, p_ptr->options[31] */
4152 #define view_torch_grids		p_ptr->options[32]
4153 /* {TRUE,  0, NULL,					"Number 40" }, svr_ptr->options[7] */
4154 #define dungeon_stair			svr_ptr->options[8]
4155 /* {TRUE,  0, NULL,					"Number 42" }, svr_ptr->options[9] */
4156 /* {TRUE,  0, NULL,					"Number 43" }, svr_ptr->options[10] */
4157 /* {TRUE,  0, NULL,					"Number 44" }, svr_ptr->options[11] */
4158 /* {TRUE,  0, NULL,					"Number 45" }, svr_ptr->options[12] */
4159 #define smart_packs				svr_ptr->options[13]
4160 /* {TRUE,  0, NULL,					"Number 47" }, svr_ptr->options[14] */
4161 /* {TRUE,  0, NULL,					"Number 48" }, p_ptr->options[33] */
4162 /* {TRUE,  0, NULL,					"Number 49" }, p_ptr->options[34] */
4163 /* {TRUE,  0, NULL,					"Number 50" }, p_ptr->options[35] */
4164 /* {TRUE,  0, NULL,					"Number 51" }, p_ptr->options[36] */
4165 #define flush_failure			p_ptr->options[37]
4166 #define flush_disturb			p_ptr->options[38]
4167 /* {FALSE, 0, NULL, 					"Number 54" }, p_ptr->options[39] */
4168 #define fresh_before			p_ptr->options[40]
4169 #define fresh_after				p_ptr->options[41]
4170 #define emergency_stop			p_ptr->options[42]
4171 /* {FALSE, 0, NULL,					"Number 57" }, p_ptr->options[42] */
4172 #define compress_savefile		p_ptr->options[43]
4173 #define hilite_player			p_ptr->options[44]
4174 #define view_yellow_lite		p_ptr->options[45]
4175 #define	view_bright_lite		p_ptr->options[46]
4176 #define view_granite_lite		p_ptr->options[47]
4177 #define	view_special_lite		p_ptr->options[48]
4178 
4179 /* Option Set 2 */
4180 
4181 #define	view_player_colour		p_ptr->options[49]
4182 /* {TRUE,  0, NULL,					"Number 65" }, p_ptr->options[50] */
4183 /* {TRUE,  0, NULL,					"Number 66" }, p_ptr->options[51] */
4184 /* {TRUE,  0, NULL,					"Number 67" }, p_ptr->options[52] */
4185 /* {TRUE,  0, NULL,					"Number 68" }, p_ptr->options[53] */
4186 /* {TRUE,  0, NULL,					"Number 69" }, p_ptr->options[54] */
4187 /* {TRUE,  0, NULL,					"Number 70" }, p_ptr->options[55] */
4188 /* {TRUE,  0, NULL,					"Number 71" }, p_ptr->options[56] */
4189 /* {TRUE,  0, NULL,					"Number 72" }, p_ptr->options[57] */
4190 /* {TRUE,  0, NULL,					"Number 73" }, p_ptr->options[58] */
4191 /* {TRUE,  0, NULL,					"Number 74" }, p_ptr->options[59] */
4192 /* {TRUE,  0, NULL,					"Number 75" }, p_ptr->options[60] */
4193 /* {TRUE,  0, NULL,					"Number 76" }, p_ptr->options[61] */
4194 /* {TRUE,  0, NULL,					"Number 77" }, p_ptr->options[62] */
4195 /* {TRUE,  0, NULL,					"Number 78" }, p_ptr->options[63] */
4196 /* {TRUE,  0, NULL,					"Number 79" }, p_ptr->options[64] */
4197 /* {TRUE,  0, NULL,					"Number 80" }, p_ptr->options[65] */
4198 /* {TRUE,  0, NULL,					"Number 81" }, p_ptr->options[66] */
4199 /* {TRUE,  0, NULL,					"Number 82" }, p_ptr->options[67] */
4200 /* {TRUE,  0, NULL,					"Number 83" }, p_ptr->options[68] */
4201 /* {TRUE,  0, NULL,					"Number 84" }, p_ptr->options[69] */
4202 /* {TRUE,  0, NULL,					"Number 85" }, p_ptr->options[70] */
4203 /* {TRUE,  0, NULL,					"Number 86" }, p_ptr->options[71] */
4204 /* {TRUE,  0, NULL,					"Number 87" }, p_ptr->options[72] */
4205 /* {TRUE,  0, NULL,					"Number 88" }, p_ptr->options[73] */
4206 /* {TRUE,  0, NULL,					"Number 89" }, p_ptr->options[74] */
4207 /* {TRUE,  0, NULL,					"Number 90" }, p_ptr->options[75] */
4208 /* {TRUE,  0, NULL,					"Number 91" }, p_ptr->options[76] */
4209 /* {TRUE,  0, NULL,					"Number 92" }, p_ptr->options[77] */
4210 /* {TRUE,  0, NULL,					"Number 93" }, p_ptr->options[78] */
4211 /* {TRUE,  0, NULL,					"Number 94" }, p_ptr->options[79] */
4212 /* {TRUE,  0, NULL,					"Number 95" }, p_ptr->options[80] */
4213 
4214 /* Option Set 3 */
4215 
4216 /* {TRUE,  0, NULL,					"Number 96" }, p_ptr->options[81] */
4217 /* {TRUE,  0, NULL,					"Number 97" }, p_ptr->options[82] */
4218 /* {TRUE,  0, NULL,					"Number 98" }, p_ptr->options[83] */
4219 /* {TRUE,  0, NULL,					"Number 99" }, p_ptr->options[84] */
4220 /* {TRUE,  0, NULL,					"Number 100" }, p_ptr->options[85] */
4221 /* {TRUE,  0, NULL,					"Number 101" }, p_ptr->options[86] */
4222 /* {TRUE,  0, NULL,					"Number 102" }, p_ptr->options[87] */
4223 /* {TRUE,  0, NULL,					"Number 103" }, p_ptr->options[88] */
4224 /* {TRUE,  0, NULL,					"Number 104" }, p_ptr->options[89] */
4225 /* {TRUE,  0, NULL,					"Number 105" }, p_ptr->options[90] */
4226 /* {TRUE,  0, NULL,					"Number 106" }, p_ptr->options[91] */
4227 /* {TRUE,  0, NULL,					"Number 107" }, p_ptr->options[92] */
4228 /* {TRUE,  0, NULL,					"Number 108" }, p_ptr->options[93] */
4229 /* {TRUE,  0, NULL,					"Number 109" }, p_ptr->options[94] */
4230 /* {TRUE,  0, NULL,					"Number 110" }, p_ptr->options[95] */
4231 /* {TRUE,  0, NULL,					"Number 111" }, p_ptr->options[96] */
4232 /* {TRUE,  0, NULL,					"Number 112" }, p_ptr->options[97] */
4233 /* {TRUE,  0, NULL,					"Number 113" }, p_ptr->options[98] */
4234 /* {TRUE,  0, NULL,					"Number 114" }, p_ptr->options[99] */
4235 /* {TRUE,  0, NULL,					"Number 115" }, p_ptr->options[100] */
4236 /* {TRUE,  0, NULL,					"Number 116" }, p_ptr->options[101] */
4237 /* {TRUE,  0, NULL,					"Number 117" }, p_ptr->options[102] */
4238 /* {TRUE,  0, NULL,					"Number 118" }, p_ptr->options[103] */
4239 /* {TRUE,  0, NULL,					"Number 119" }, p_ptr->options[104] */
4240 /* {TRUE,  0, NULL,					"Number 120" }, p_ptr->options[105] */
4241 /* {TRUE,  0, NULL,					"Number 121" }, p_ptr->options[106] */
4242 /* {TRUE,  0, NULL,					"Number 122" }, p_ptr->options[107 */
4243 /* {TRUE,  0, NULL,					"Number 123" }, p_ptr->options[108] */
4244 /* {TRUE,  0, NULL,					"Number 124" }, p_ptr->options[109] */
4245 /* {TRUE,  0, NULL,					"Number 125" }, p_ptr->options[110] */
4246 /* {TRUE,  0, NULL,					"Number 126" }, p_ptr->options[111] */
4247 /* {TRUE,  0, NULL,					"Number 127" }, p_ptr->options[112] */
4248 
4249 /* Option Set 4 */
4250 
4251 /* {TRUE,  0, NULL,					"Number 128" },p_ptr->options[113] */
4252 /* {TRUE,  0, NULL,					"Number 129" },p_ptr->options[114] */
4253 /* {TRUE,  0, NULL,					"Number 130" },p_ptr->options[115] */
4254 /* {TRUE,  0, NULL,					"Number 131" },p_ptr->options[116] */
4255 /* {TRUE,  0, NULL,					"Number 132" },p_ptr->options[117] */
4256 /* {TRUE,  0, NULL,					"Number 133" },p_ptr->options[118] */
4257 /* {TRUE,  0, NULL,					"Number 134" },p_ptr->options[119] */
4258 /* {TRUE,  0, NULL,					"Number 135" },p_ptr->options[120] */
4259 /* {TRUE,  0, NULL,					"Number 136" },p_ptr->options[121] */
4260 /* {TRUE,  0, NULL,					"Number 137" },p_ptr->options[122] */
4261 /* {TRUE,  0, NULL,					"Number 138" },p_ptr->options[123] */
4262 /* {TRUE,  0, NULL,					"Number 139" },p_ptr->options[124] */
4263 /* {TRUE,  0, NULL,					"Number 140" },p_ptr->options[125] */
4264 /* {TRUE,  0, NULL,					"Number 141" },p_ptr->options[126] */
4265 /* {TRUE,  0, NULL,					"Number 142" },p_ptr->options[127] */
4266 /* {TRUE,  0, NULL,					"Number 143" },p_ptr->options[128] */
4267 /* {TRUE,  0, NULL,					"Number 144" },p_ptr->options[129] */
4268 /* {TRUE,  0, NULL,					"Number 145" },p_ptr->options[130] */
4269 /* {TRUE,  0, NULL,					"Number 146" },p_ptr->options[131] */
4270 /* {TRUE,  0, NULL,					"Number 147" },p_ptr->options[132] */
4271 /* {TRUE,  0, NULL,					"Number 148" },p_ptr->options[133] */
4272 /* {TRUE,  0, NULL,					"Number 149" },p_ptr->options[134] */
4273 /* {TRUE,  0, NULL,					"Number 150" },p_ptr->options[135] */
4274 /* {TRUE,  0, NULL,					"Number 151" },p_ptr->options[136] */
4275 /* {TRUE,  0, NULL,					"Number 152" },p_ptr->options[137] */
4276 /* {TRUE,  0, NULL,					"Number 153" },p_ptr->options[138] */
4277 /* {TRUE,  0, NULL,					"Number 154" },p_ptr->options[139] */
4278 /* {TRUE,  0, NULL,					"Number 155" },p_ptr->options[140] */
4279 /* {TRUE,  0, NULL,					"Number 156" },p_ptr->options[141] */
4280 /* {TRUE,  0, NULL,					"Number 157" },p_ptr->options[142] */
4281 /* {TRUE,  0, NULL,					"Number 158" },p_ptr->options[143] */
4282 /* {TRUE,  0, NULL,					"Number 159" },p_ptr->options[144] */
4283 
4284 /* Option Set 5 */
4285 
4286 /* {TRUE,  0, NULL,					"Number 160" }, p_ptr->options[145] */
4287 #define	plain_descriptions		p_ptr->options[146]
4288 #define stupid_monsters			p_ptr->birth[0]
4289 #define auto_destroy			p_ptr->options[147]
4290 #define confirm_wear			p_ptr->options[148]
4291 /* {FALSE, 0, NULL,					"Number 165" }, p_ptr->options[149] */
4292 #define easy_open				p_ptr->options[150]
4293 #define easy_disarm				p_ptr->options[151]
4294 #define easy_floor				p_ptr->options[152]
4295 /* {TRUE,  0, NULL,					"Number 169" }, p_ptr->options[153] */
4296 #define center_player			p_ptr->options[154]
4297 #define avoid_center			p_ptr->options[155]
4298 /* {TRUE,  0, NULL,					"Number 172" }, p_ptr->options[156] */
4299 #define limit_messages			p_ptr->options[157]
4300 #define check_transaction		p_ptr->options[158]
4301 /* {TRUE,  0, NULL,					"Number 175" }, p_ptr->options[159] */
4302 /* {TRUE,  0, NULL,					"Number 176" }, p_ptr->options[160] */
4303 /* {TRUE,  0, NULL,					"Number 177" }, p_ptr->options[161] */
4304 /* {TRUE,  0, NULL,					"Number 178" }, p_ptr->options[162] */
4305 /* {TRUE,  0, NULL,					"Number 179" }, p_ptr->options[163] */
4306 /* {TRUE,  0, NULL,					"Number 180" }, p_ptr->options[164] */
4307 /* {TRUE,  0, NULL,					"Number 181" }, p_ptr->options[165] */
4308 /* {TRUE,  0, NULL,					"Number 182" }, p_ptr->options[166] */
4309 /* {TRUE,  0, NULL,					"Number 183" }, p_ptr->options[167] */
4310 /* {TRUE,  0, NULL,					"Number 184" }, p_ptr->options[168] */
4311 /* {TRUE,  0, NULL,					"Number 185" }, p_ptr->options[169] */
4312 /* {TRUE,  0, NULL,					"Number 186" }, p_ptr->options[170] */
4313 /* {TRUE,  0, NULL,					"Number 187" }, p_ptr->options[171] */
4314 /* {TRUE,  0, NULL,					"Number 188" }, p_ptr->options[172] */
4315 /* {TRUE,  0, NULL,					"Number 189" }, p_ptr->options[173] */
4316 /* {TRUE,  0, NULL,					"Number 190" }, p_ptr->options[174] */
4317 /* {TRUE,  0, NULL,					"Number 191" }, p_ptr->options[175] */
4318 
4319 /* Option Set 6 */
4320 
4321 #define vanilla_town			p_ptr->birth[1]
4322 /* {TRUE,  0, NULL,					"Number 193" }, p_ptr->options[176] */
4323 #define ironman_shops			p_ptr->birth[2]
4324 #define ironman_small_levels	p_ptr->birth[3]
4325 #define ironman_downward		p_ptr->birth[4]
4326 /* {TRUE,  0, NULL,					"Number 197" }, p_ptr->birth[5] */
4327 /* {TRUE,  0, NULL,					"Number 198" }, p_ptr->birth[6] */
4328 /* {TRUE,  0, NULL,					"Number 199" }, p_ptr->birth[7] */
4329 /* {TRUE,  0, NULL,					"Number 200" }, p_ptr->birth[8] */
4330 /* {TRUE,  0, NULL,					"Number 201" }, p_ptr->birth[9] */
4331 /* {TRUE,  0, NULL,					"Number 202" }, p_ptr->birth[10] */
4332 #define munchkin_death			p_ptr->birth[11]
4333 /* {TRUE,  0, NULL,					"Number 204" }, p_ptr->birth[12] */
4334 /* {TRUE,  0, NULL,					"Number 205" }, p_ptr->birth[13] */
4335 #define preserve_mode			p_ptr->birth[14]
4336 #define autoroller				p_ptr->birth[15]
4337 #define point_based				p_ptr->birth[16]
4338 #define silly_monsters			p_ptr->birth[17]
4339 #define ironman_nightmare		p_ptr->birth[18]
4340 /* {TRUE,  0, NULL,					"Number 211" }, p_ptr->birth[19] */
4341 /* {TRUE,  0, NULL,					"Number 212" }, p_ptr->birth[20] */
4342 /* {TRUE,  0, NULL,					"Number 213" }, p_ptr->birth[21] */
4343 /* {TRUE,  0, NULL,					"Number 214" }, p_ptr->birth[22] */
4344 /* {TRUE,  0, NULL,					"Number 215" }, p_ptr->birth[23] */
4345 /* {TRUE,  0, NULL,					"Number 216" }, p_ptr->birth[24] */
4346 /* {TRUE,  0, NULL,					"Number 217" }, p_ptr->birth[25] */
4347 /* {TRUE,  0, NULL,					"Number 218" }, p_ptr->birth[26] */
4348 /* {TRUE,  0, NULL,					"Number 219" }, p_ptr->birth[27] */
4349 /* {TRUE,  0, NULL,					"Number 220" }, p_ptr->birth[28] */
4350 /* {TRUE,  0, NULL,					"Number 221" }, p_ptr->birth[29] */
4351 /* {TRUE,  0, NULL,					"Number 222" }, p_ptr->birth[30] */
4352 /* {TRUE,  0, NULL,					"Number 223" }, p_ptr->birth[31] */
4353 
4354 /* Option Set 7 */
4355 
4356 /* {TRUE,  0, NULL,					"Number 224" },svr_ptr->options[15] */
4357 #define monster_light			svr_ptr->options[16]
4358 /* "Turn on muliplayer client - server code" , svr_ptr->options[17] */
4359 /* {TRUE,  0, NULL,					"Number 227" },svr_ptr->options[18] */
4360 /* {TRUE,  0, NULL,					"Number 228" },svr_ptr->options[19] */
4361 /* {TRUE,  0, NULL,					"Number 229" },svr_ptr->options[20] */
4362 /* {TRUE,  0, NULL,					"Number 230" },svr_ptr->options[21] */
4363 /* {TRUE,  0, NULL,					"Number 231" },svr_ptr->options[22] */
4364 /* {TRUE,  0, NULL,					"Number 232" },svr_ptr->options[23] */
4365 /* {TRUE,  0, NULL,					"Number 233" },svr_ptr->options[24] */
4366 /* {TRUE,  0, NULL,					"Number 234" },svr_ptr->options[25] */
4367 /* {TRUE,  0, NULL,					"Number 235" },svr_ptr->options[26] */
4368 /* {TRUE,  0, NULL,					"Number 236" },svr_ptr->options[27] */
4369 /* {TRUE,  0, NULL,					"Number 237" },svr_ptr->options[28] */
4370 /* {TRUE,  0, NULL,					"Number 238" },svr_ptr->options[29] */
4371 /* {TRUE,  0, NULL,					"Number 239" },p_ptr->options[177] */
4372 /* {TRUE,  0, NULL,					"Number 240" },p_ptr->options[178] */
4373 /* {TRUE,  0, NULL,					"Number 241" },p_ptr->options[179] */
4374 /* {TRUE,  0, NULL,					"Number 242" },p_ptr->options[180] */
4375 /* {TRUE,  0, NULL,					"Number 243" },p_ptr->options[181] */
4376 /* {TRUE,  0, NULL,					"Number 244" },p_ptr->options[182] */
4377 /* {TRUE,  0, NULL,					"Number 245" },p_ptr->options[183] */
4378 /* {TRUE,  0, NULL,					"Number 246" },p_ptr->options[184] */
4379 /* {TRUE,  0, NULL,					"Number 247" },p_ptr->options[185] */
4380 /* {TRUE,  0, NULL,					"Number 248" },p_ptr->options[186] */
4381 /* {TRUE,  0, NULL,					"Number 249" },p_ptr->options[187] */
4382 /* {TRUE,  0, NULL,					"Number 250" },p_ptr->options[188] */
4383 #define auto_notes				p_ptr->options[189]
4384 #define take_notes				p_ptr->options[190]
4385 /* {TRUE,  0, NULL,					"Number 253" }, p_ptr->options[191] */
4386 #define testing_stack			svr_ptr->options[30]
4387 /* {TRUE,  0, NULL,					"Number 255" }, svr_ptr->options[31] */
4388 
4389 
4390 
4391 /*** Macro Definitions ***/
4392 
4393 /*
4394  * Hack -- The main "screen"
4395  */
4396 #define term_screen     (angband_term[0])
4397 
4398 
4399 /*
4400  * Determine if a given inventory item is "aware"
4401  */
4402 #define object_aware_p(T) \
4403     (k_info[(T)->k_idx].aware)
4404 
4405 /*
4406  * Determine if a given inventory item is "tried"
4407  */
4408 #define object_tried_p(T) \
4409     (k_info[(T)->k_idx].tried)
4410 
4411 
4412 /*
4413  * Determine if a given inventory item is "known"
4414  * Test One -- Check for special "known" tag
4415  * Test Two -- Check for "Easy Know" + "Aware"
4416  */
4417 #define object_known_p(T) \
4418     (((T)->info & (OB_KNOWN)) || \
4419      (k_info[(T)->k_idx].easy_know && k_info[(T)->k_idx].aware))
4420 
4421 /*
4422  * Is the object fully known?
4423  */
4424 #define object_known_full(T) \
4425 	((T)->info & (OB_MENTAL))
4426 
4427 
4428 /*
4429  * Return the "attr" for a given item.
4430  * Use "flavor" if available.
4431  * Default to user definitions.
4432  */
4433 #define object_attr(T) \
4434 	((k_info[(T)->k_idx].flavor) ? \
4435 	 (misc_to_attr[k_info[(T)->k_idx].flavor]) : \
4436 	 (k_info[(T)->k_idx].x_attr))
4437 
4438 /*
4439  * Return the "char" for a given item.
4440  * Use "flavor" if available.
4441  * Default to user definitions.
4442  */
4443 #define object_char(T) \
4444 	((k_info[(T)->k_idx].flavor) ? \
4445 	 (misc_to_char[k_info[(T)->k_idx].flavor]) : \
4446 	 (k_info[(T)->k_idx].x_char))
4447 
4448 
4449 /*
4450  * Ego-Items are named, but are not INSTA_ART.
4451  */
4452 #define ego_item_p(T) \
4453 	((((T)->xtra_name) && (!((T)->flags[2] & TR2_INSTA_ART))) ? TRUE : FALSE)
4454 
4455 /*
4456  * Cursed items.
4457  */
4458 #define cursed_p(T) \
4459 	((T)->flags[2] & (TR2_CURSED))
4460 
4461 
4462 /*
4463  * Iterate over the objects in a list
4464  */
4465 #define OBJ_ITT_START(OSTART, O) \
4466 	do { \
4467 		s16b _this_o_idx, _next_o_idx = 0; \
4468 		\
4469 		for (_this_o_idx = (OSTART); _this_o_idx; _this_o_idx = _next_o_idx) \
4470 		{ \
4471 			(O) = &o_list[_this_o_idx];\
4472 			assert((O)->k_idx); \
4473 			\
4474 			_next_o_idx = (O)->next_o_idx;
4475 
4476 #define OBJ_ITT_END \
4477 		} \
4478 	} while (0)
4479 
4480 /*
4481  * Iterate over the fieldss in a list
4482  */
4483 #define FLD_ITT_START(FSTART, F) \
4484 	do { \
4485 		s16b _this_f_idx, _next_f_idx = 0; \
4486 		\
4487 		for (_this_f_idx = (FSTART); _this_f_idx; _this_f_idx = _next_f_idx) \
4488 		{ \
4489 			(F) = &fld_list[_this_f_idx];\
4490 			assert((F)->t_idx); \
4491 			\
4492 			_next_f_idx = (F)->next_f_idx;
4493 
4494 #define FLD_ITT_END \
4495 		} \
4496 	} while (0)
4497 
4498 /*
4499  * Useful macros for object formatting
4500  * (So we use the correct number of arguments)
4501  */
4502 #define OBJECT_FMT(O, P, M) \
4503 	object_fmt, (O), (P), (M)
4504 
4505 #define OBJECT_STORE_FMT(O, P, M) \
4506 	object_store_fmt, (O), (P), (M)
4507 
4508 /* Monster name format */
4509 #define MONSTER_FMT(M, P) \
4510 	monster_fmt, (M), (P)
4511 
4512 
4513 /*
4514  * Test bounds checking
4515  */
4516 #ifdef DEBUG_ALPHA
4517 #define area(X, Y) \
4518 	(assert_exp(in_bounds2((X), (Y))) ? area_aux((X), (Y)): NULL)
4519 
4520 #define parea(X, Y) \
4521 	(assert_exp(in_boundsp((X), (Y))) ? parea_aux((X), (Y)): NULL)
4522 
4523 #else /* DEBUG_ALPHA */
4524 #define area(X, Y) \
4525 	area_aux((X), (Y))
4526 #define parea(X, Y) \
4527 	parea_aux((X), (Y))
4528 
4529 
4530 #endif /* DEBUG_ALPHA */
4531 
4532 
4533 /*
4534  * Determines if a map location is currently "on screen" -RAK-
4535  */
4536 #define panel_contains(X,Y) \
4537   (((Y) >= p_ptr->panel_y1) && ((Y) < p_ptr->panel_y2) && \
4538    ((X) >= p_ptr->panel_x1) && ((X) < p_ptr->panel_x2))
4539 
4540 /*
4541  * Determine if a "legal" grid is a "floor" grid
4542  */
4543 #define cave_floor_grid(C) \
4544     (!(f_info[(C)->feat].flags & FF_BLOCK))
4545 /*
4546  * Determine if a "legal" grid is a "wall" grid
4547  */
4548 #define cave_wall_grid(C) \
4549     (f_info[(C)->feat].flags & FF_BLOCK)
4550 
4551 /*
4552  * A half-blocking grid
4553  */
4554 #define cave_semi_grid(C) \
4555 	(f_info[(C)->feat].flags & FF_HALF_LOS)
4556 
4557 
4558 /*
4559  * True half the time for trees. (Block line of sight half the time.)
4560  */
4561 #define cave_half_grid(C) \
4562     (cave_semi_grid(C) && (quick_rand()))
4563 
4564 /*
4565  * Grid will block LOS.
4566  */
4567 #define cave_los_grid(C) \
4568    ((cave_floor_grid(C)) || (cave_half_grid(C)))
4569 
4570 /*
4571  * A nice grid for dropping objects
4572  */
4573 #define cave_nice_grid(C) \
4574     (!(f_info[(C)->feat].flags & FF_ICKY))
4575 
4576 /*
4577  * Grid that does not have any objects or "interesting" terrains
4578  */
4579 #define cave_clean_grid(C) \
4580     (cave_nice_grid(C) && \
4581 	((C)->o_idx == 0))
4582 
4583 /*
4584  * Not occupied by a monster
4585  */
4586 #define cave_empty_grid(C) \
4587     (cave_floor_grid(C) && !((C)->m_idx))
4588 
4589 /*
4590  * Grid that is empty of everything interesting
4591  */
4592 #define cave_naked_grid(C) \
4593     (cave_nice_grid(C) && \
4594 	((C)->o_idx == 0) && \
4595 	((C)->m_idx == 0) && \
4596 	((C)->fld_idx == 0))
4597 
4598 
4599 /*
4600  * Grid that cannot be destroyed or passed.
4601  */
4602 #define cave_perma_grid(C) \
4603 	(f_info[(C)->feat].flags & FF_PERM)
4604 
4605 
4606 /*
4607  * Pattern grid.
4608  */
4609 #define cave_pattern_grid(C) \
4610 	(f_info[(C)->feat].flags & FF_PATTERN)
4611 
4612 /*
4613  * Is the grid worth remembering?
4614  */
4615 #define cave_mem_grid(C) \
4616 	(f_info[(C)->feat].flags & FF_MARK)
4617 
4618 /*
4619  * Determine if a "legal" grid is within "los" of the player
4620  *
4621  * Note the use of comparison to zero to force a "boolean" result
4622  */
4623 #define player_has_los_grid(C) \
4624     (((C)->player & (GRID_VIEW)) != 0)
4625 
4626 /*
4627  * Determine if the player can see a grid
4628  *
4629  * (The grid is lit + in view)
4630  */
4631 #define player_can_see_grid(C) \
4632 	(((C)->player & (GRID_SEEN)) != 0)
4633 
4634 /*
4635  * Forget square
4636  */
4637 #define forget_grid(C) \
4638 	((C)->feat = FEAT_NONE)
4639 
4640 /*
4641  * Memorise square
4642  *
4643  * Hack XXX XXX - we test C1->info and C2->player
4644  *  so we have the correct types.
4645  * (Without this check - it would be quite easy
4646  * to get the two pointers the wrong way around.)
4647  *
4648  * We need to lite_spot() as well...
4649  */
4650 #define remember_grid(C1, C2) \
4651 	(((C2)->feat = (C1)->feat), \
4652 	(void) ((C1)->info), \
4653 	(void) ((C2)->player))
4654 
4655 
4656 /*
4657  * Create a dungeon region
4658  */
4659 #define create_region(R, WID, HGT, FLAGS) \
4660 	create_region_aux(&(R)->region, (WID), (HGT), (FLAGS))
4661 
4662 /*
4663  * Is the monster a pet of the player?
4664  */
4665 #define is_pet(T) \
4666 	 ((bool)(((T)->smart & SM_PET) != 0))
4667 
4668 /*
4669  * Is the monster friendly toward the player?
4670  */
4671 #define is_friendly(T) \
4672 	 ((bool)(((T)->smart & SM_FRIENDLY) != 0))
4673 
4674 
4675 /*
4676  * Is the monster hostile toward the player?
4677  */
4678 #define is_hostile(T) \
4679 	 ((bool)(!(is_pet(T) || is_friendly(T))))
4680 
4681 
4682 /*
4683  * Helper macro so call path_build() with correct buffer size.
4684  */
4685 #define path_make(B, P, F) \
4686 	do \
4687 	{ \
4688 		assert(sizeof(B) > sizeof(void*)); \
4689 		path_build((B), sizeof(B), (P), (F)); \
4690 	} \
4691 	while (FALSE)
4692 
4693 
4694 
4695 /*
4696  * Hack -- Prepare to use the "Secure" routines
4697  */
4698 #if defined(SET_UID) && defined(SECURE)
4699 extern int PlayerUID;
4700 # define getuid() PlayerUID
4701 # define geteuid() PlayerUID
4702 #endif
4703 
4704 
4705 
4706 /*** Color constants ***/
4707 
4708 
4709 /*
4710  * Angband "attributes" (with symbols, and base (R,G,B) codes)
4711  *
4712  * The "(R,G,B)" codes are given in "fourths" of the "maximal" value,
4713  * and should "gamma corrected" on most (non-Macintosh) machines.
4714  */
4715 #define TERM_DARK                0  /* 'd' */	/* 0,0,0 */
4716 #define TERM_WHITE               1  /* 'w' */	/* 4,4,4 */
4717 #define TERM_SLATE               2  /* 's' */	/* 2,2,2 */
4718 #define TERM_ORANGE              3  /* 'o' */	/* 4,2,0 */
4719 #define TERM_RED                 4  /* 'r' */	/* 3,0,0 */
4720 #define TERM_GREEN               5  /* 'g' */	/* 0,2,1 */
4721 #define TERM_BLUE                6  /* 'b' */	/* 0,0,4 */
4722 #define TERM_UMBER               7  /* 'u' */	/* 2,1,0 */
4723 #define TERM_L_DARK              8  /* 'D' */	/* 1,1,1 */
4724 #define TERM_L_WHITE             9  /* 'W' */	/* 3,3,3 */
4725 #define TERM_VIOLET             10  /* 'v' */	/* 4,0,4 */
4726 #define TERM_YELLOW             11  /* 'y' */	/* 4,4,0 */
4727 #define TERM_L_RED              12  /* 'R' */	/* 4,0,0 */
4728 #define TERM_L_GREEN            13  /* 'G' */	/* 0,4,0 */
4729 #define TERM_L_BLUE             14  /* 'B' */	/* 0,4,4 */
4730 #define TERM_L_UMBER            15  /* 'U' */	/* 3,2,1 */
4731 
4732 
4733 /*
4734  * Colour format specifiers in strings
4735  *
4736  * Start with $, and then have a character that depends on the
4737  * colour.  We could also use this techinque for other formatting
4738  * specifiers...
4739  *
4740  * Note we must use 'nice' characters for the specifier because
4741  * the formatting routines eat some of the control characters.
4742  */
4743 #define CLR_DARK		"$A"
4744 #define CLR_WHITE		"$B"
4745 #define CLR_SLATE		"$C"
4746 #define CLR_ORANGE		"$D"
4747 #define CLR_RED			"$E"
4748 #define CLR_GREEN		"$F"
4749 #define CLR_BLUE		"$G"
4750 #define CLR_UMBER		"$H"
4751 #define CLR_L_DARK		"$I"
4752 #define CLR_L_WHITE		"$J"
4753 #define CLR_VIOLET		"$K"
4754 #define CLR_YELLOW		"$L"
4755 #define CLR_L_RED		"$M"
4756 #define CLR_L_GREEN		"$N"
4757 #define CLR_L_BLUE		"$O"
4758 #define CLR_L_UMBER		"$P"
4759 #define CLR_SET_DEFAULT "$Q"
4760 #define CLR_DEFAULT		"$R"
4761 
4762 
4763 /*
4764  * Raw message types
4765  */
4766 #define MSG_GENERIC          0
4767 #define MSG_HIT              1
4768 #define MSG_MISS             2
4769 #define MSG_FLEE             3
4770 #define MSG_DROP             4
4771 #define MSG_KILL             5
4772 #define MSG_LEVEL            6
4773 #define MSG_DEATH            7
4774 #define MSG_STUDY            8
4775 #define MSG_TELEPORT         9
4776 #define MSG_SHOOT           10
4777 #define MSG_QUAFF           11
4778 #define MSG_ZAP             12
4779 #define MSG_WALK            13
4780 #define MSG_TPOTHER         14
4781 #define MSG_HITWALL         15
4782 #define MSG_EAT             16
4783 #define MSG_STORE1          17
4784 #define MSG_STORE2          18
4785 #define MSG_STORE3          19
4786 #define MSG_STORE4          20
4787 #define MSG_DIG             21
4788 #define MSG_OPENDOOR        22
4789 #define MSG_SHUTDOOR        23
4790 #define MSG_TPLEVEL         24
4791 #define MSG_BELL            25
4792 #define MSG_NOTHING_TO_OPEN 26
4793 #define MSG_LOCKPICK_FAIL   27
4794 #define MSG_STAIRS          28
4795 #define MSG_HITPOINT_WARN   29
4796 
4797 #define MSG_MAX             30
4798 
4799 /*
4800  * 'Magic' macro that changes the default message type.
4801  * set_message_type sets a static variable to be T, and
4802  * then parses the following string as a format string.
4803  */
4804 #define MESSAGE_TYPE(T)		"%v", set_message_type, (T)
4805 
4806 /*
4807  * Message types used for msgf()  (See util.c)
4808  */
4809 #define MSGT_GENERIC		 MESSAGE_TYPE(0)
4810 #define MSGT_HIT             MESSAGE_TYPE(1)
4811 #define MSGT_MISS            MESSAGE_TYPE(2)
4812 #define MSGT_FLEE            MESSAGE_TYPE(3)
4813 #define MSGT_DROP            MESSAGE_TYPE(4)
4814 #define MSGT_KILL            MESSAGE_TYPE(5)
4815 #define MSGT_LEVEL           MESSAGE_TYPE(6)
4816 #define MSGT_DEATH           MESSAGE_TYPE(7)
4817 #define MSGT_STUDY           MESSAGE_TYPE(8)
4818 #define MSGT_TELEPORT        MESSAGE_TYPE(9)
4819 #define MSGT_SHOOT           MESSAGE_TYPE(10)
4820 #define MSGT_QUAFF           MESSAGE_TYPE(11)
4821 #define MSGT_ZAP             MESSAGE_TYPE(12)
4822 #define MSGT_WALK            MESSAGE_TYPE(13)
4823 #define MSGT_TPOTHER         MESSAGE_TYPE(14)
4824 #define MSGT_HITWALL         MESSAGE_TYPE(15)
4825 #define MSGT_EAT             MESSAGE_TYPE(16)
4826 #define MSGT_STORE1          MESSAGE_TYPE(17)
4827 #define MSGT_STORE2          MESSAGE_TYPE(18)
4828 #define MSGT_STORE3          MESSAGE_TYPE(19)
4829 #define MSGT_STORE4          MESSAGE_TYPE(20)
4830 #define MSGT_DIG             MESSAGE_TYPE(21)
4831 #define MSGT_OPENDOOR        MESSAGE_TYPE(22)
4832 #define MSGT_SHUTDOOR        MESSAGE_TYPE(23)
4833 #define MSGT_TPLEVEL         MESSAGE_TYPE(24)
4834 #define MSGT_BELL            MESSAGE_TYPE(25)
4835 #define MSGT_NOTHING_TO_OPEN MESSAGE_TYPE(26)
4836 #define MSGT_LOCKPICK_FAIL   MESSAGE_TYPE(27)
4837 #define MSGT_STAIRS          MESSAGE_TYPE(28)
4838 #define MSGT_HITPOINT_WARN   MESSAGE_TYPE(29)
4839 
4840 
4841 
4842 
4843 /*** Sound constants ***/
4844 
4845 
4846 /*
4847  * Mega-Hack -- some primitive sound support (see "main-win.c")
4848  *
4849  * Some "sound" constants for "Term_xtra(TERM_XTRA_SOUND, val)"
4850  */
4851 #define SOUND_NONE		 0
4852 #define SOUND_HIT        1
4853 #define SOUND_MISS       2
4854 #define SOUND_FLEE       3
4855 #define SOUND_DROP       4
4856 #define SOUND_KILL       5
4857 #define SOUND_LEVEL      6
4858 #define SOUND_DEATH      7
4859 #define SOUND_STUDY      8
4860 #define SOUND_TELEPORT   9
4861 #define SOUND_SHOOT     10
4862 #define SOUND_QUAFF     11
4863 #define SOUND_ZAP       12
4864 #define SOUND_WALK      13
4865 #define SOUND_TPOTHER   14
4866 #define SOUND_HITWALL   15
4867 #define SOUND_EAT       16
4868 #define SOUND_STORE1    17
4869 #define SOUND_STORE2    18
4870 #define SOUND_STORE3    19
4871 #define SOUND_STORE4    20
4872 #define SOUND_DIG       21
4873 #define SOUND_OPENDOOR  22
4874 #define SOUND_SHUTDOOR  23
4875 #define SOUND_TPLEVEL   24
4876 #define SOUND_SCROLL	25
4877 #define SOUND_BUY	    26
4878 #define SOUND_SELL	    27
4879 #define SOUND_WARN	    28
4880 #define SOUND_ROCKET    29		/* Somebody's shooting rockets */
4881 #define SOUND_N_KILL    30		/* The player kills a non-living/undead monster */
4882 #define SOUND_U_KILL    31		/* The player kills a unique */
4883 #define SOUND_QUEST     32		/* The player has just completed a quest */
4884 #define SOUND_HEAL      33		/* The player was healed a little bit */
4885 #define SOUND_X_HEAL    34		/* The player was healed full health */
4886 #define SOUND_BITE      35		/* A monster bites you */
4887 #define SOUND_CLAW      36		/* A monster claws you */
4888 #define SOUND_M_SPELL   37		/* A monster casts a miscellaneous spell */
4889 #define SOUND_SUMMON    38		/* A monster casts a summoning spell */
4890 #define SOUND_BREATH    39		/* A monster breathes */
4891 #define SOUND_BALL      40		/* A monster casts a ball / bolt spell */
4892 #define SOUND_M_HEAL    41		/* A monster heals itself somehow */
4893 #define SOUND_ATK_SPELL 42		/* A monster casts a misc. offensive spell */
4894 #define SOUND_EVIL      43		/* Something nasty has just happened! */
4895 #define SOUND_TOUCH     44		/* A monster touches you */
4896 #define SOUND_STING     45		/* A monster stings you */
4897 #define SOUND_CRUSH     46		/* A monster crushes / envelopes you */
4898 #define SOUND_SLIME     47		/* A monster drools/spits/etc on you */
4899 #define SOUND_WAIL      48		/* A monster wails */
4900 #define SOUND_WINNER    49		/* Just won the game! */
4901 #define SOUND_FIRE      50		/* An item was burned */
4902 #define SOUND_ACID      51		/* An item was destroyed by acid */
4903 #define SOUND_ELEC      52		/* An item was destroyed by electricity */
4904 #define SOUND_COLD      53		/* An item was shattered */
4905 #define SOUND_ILLEGAL   54		/* Illegal command attempted */
4906 #define SOUND_FAIL      55		/* Fail to get a spell off / activate an item */
4907 #define SOUND_WAKEUP    56		/* A monster wakes up */
4908 #define SOUND_INVULN    57		/* Invulnerability! */
4909 #define SOUND_FALL      58		/* Falling through a trapdoor... */
4910 #define SOUND_PAIN      59		/* A monster is in pain! */
4911 #define SOUND_DESTITEM  60		/* An item was destroyed by misc. means */
4912 #define SOUND_MOAN      61		/* A monster makes a moan/beg/insult attack */
4913 #define SOUND_SHOW      62		/* A monster makes a "show" attack */
4914 #define SOUND_UNUSED    63		/* (no sound for gaze attacks) */
4915 #define SOUND_EXPLODE   64		/* Something (or somebody) explodes */
4916 
4917 /*
4918  * Mega-Hack -- maximum known sounds
4919  */
4920 #define SOUND_MAX 65
4921 
4922 
4923 #define V_COMPASSION	1
4924 #define V_HONOUR		2
4925 #define V_JUSTICE	    3
4926 #define V_SACRIFICE	    4
4927 #define V_KNOWLEDGE	    5
4928 #define V_FAITH 	    6
4929 #define V_ENLIGHTEN	    7
4930 #define V_ENCHANT	    8
4931 #define V_CHANCE	    9
4932 #define V_NATURE	   10
4933 #define V_HARMONY	   11
4934 #define V_VITALITY	   12
4935 #define V_UNLIFE	   13
4936 #define V_PATIENCE	   14
4937 #define V_TEMPERANCE   15
4938 #define V_DILIGENCE	   16
4939 #define V_VALOUR	   17
4940 #define V_INDIVIDUALISM    18
4941 
4942 #define MAX_VIRTUE		18
4943 
4944 /*
4945  * Number of virtues the player can have
4946  * ToDo: Check if changing this value breaks anything
4947  * (apart from savefile compatibility).
4948  */
4949 #define MAX_PLAYER_VIRTUES 8
4950 
4951 
4952 /*
4953  * Available graphic modes
4954  */
4955 #define GRAPHICS_NONE			0
4956 #define GRAPHICS_ORIGINAL		1
4957 #define GRAPHICS_ADAM_BOLT		2
4958 #define GRAPHICS_DAVID_GERVAIS	3
4959 #define GRAPHICS_ANY			4
4960 #define GRAPHICS_HALF_3D		5
4961 
4962 /*
4963  * Modes for the random name generator
4964  */
4965 #define NAME_DWARF  1
4966 #define NAME_ELF    2
4967 #define NAME_GNOME  3
4968 #define NAME_HOBBIT 4
4969 #define NAME_HUMAN  5
4970 #define NAME_ORC    6
4971 
4972 /*
4973  * Modes for the tokenizer
4974  */
4975 #define TOKENIZE_CHECKQUOTE 0x01	/* Special handling of single quotes */
4976 
4977 /*
4978  * Automatic note taking types
4979  */
4980 #define NOTE_BIRTH		1
4981 #define NOTE_WINNER		2
4982 #define NOTE_SAVE_GAME		3
4983 #define NOTE_ENTER_DUNGEON	4
4984 
4985 /*
4986  * Field information flags
4987  */
4988 #define FIELD_INFO_TEMP		0x0001	/* Temporary field - use counter */
4989 #define FIELD_INFO_FEAT		0x0002	/* Terrain feature based field */
4990 #define FIELD_INFO_VIS		0x0004	/* Has attr / char */
4991 #define FIELD_INFO_MARK		0x0008	/* Known */
4992 #define FIELD_INFO_TRANS	0x0010	/* Tile uses 16x16 transparency effects */
4993 #define FIELD_INFO_NO_LOOK	0x0020	/* Do not describe when looked at */
4994 #define FIELD_INFO_NFT_LOOK	0x0040	/* Do not describe feat when looked at */
4995 #define FIELD_INFO_MERGE	0x0080	/* Merge counter with similar fields */
4996 #define FIELD_INFO_NO_ENTER	0x0100	/* Grid blocks player entry */
4997 #define FIELD_INFO_NO_MAGIC	0x0200	/* Grid blocks magic */
4998 #define FIELD_INFO_NO_OBJCT	0x0400	/* Grid cannot hold objects */
4999 #define FIELD_INFO_PERM		0x0800	/* Grid is not affected by disintegrate */
5000 #define FIELD_INFO_IGNORE	0x1000	/* Grid is below the object layer */
5001 #define FIELD_INFO_NO_MPLACE 0x2000	/* Grid blocks monster placement */
5002 #define FIELD_INFO_DUMMY13	0x4000
5003 #define FIELD_INFO_DUMMY14  0x8000
5004 
5005 #define FTYPE_NOTHING	0
5006 #define FTYPE_TRAP		1
5007 #define FTYPE_DOOR		2
5008 #define FTYPE_BUILD		3
5009 #define FTYPE_FEAT		4
5010 #define FTYPE_QUEST		5
5011 #define FTYPE_FIELD		6
5012 #define FTYPE_CORPSE	7
5013 #define FTYPE_MISC		8
5014 
5015 /*
5016  * Field Actions
5017  */
5018 #define FIELD_ACT_INIT			0	/* Initialise the field data */
5019 #define FIELD_ACT_LOAD			1	/* Loading Initialisation */
5020 #define FIELD_ACT_PLAYER_ENTER	2	/* Player walks onto square */
5021 #define FIELD_ACT_PLAYER_ON		3	/* Player is on square */
5022 #define FIELD_ACT_MONSTER_ENTER	4	/* Monster walks onto square */
5023 #define FIELD_ACT_MONSTER_ON	5	/* Monster is on square */
5024 #define FIELD_ACT_OBJECT_DROP	6	/* Object lands on square */
5025 #define FIELD_ACT_OBJECT_ON		7	/* Object is on square */
5026 #define FIELD_ACT_INTERACT		8	/* Type-specific interation */
5027 #define FIELD_ACT_MAGIC_TARGET	9	/* Targeting this square */
5028 #define FIELD_ACT_LOOK			10	/* Hook for name of field when looking */
5029 #define FIELD_ACT_EXIT			11	/* Field is destroyed */
5030 #define FIELD_ACT_MONSTER_AI	12	/* Monster AI hook */
5031 #define FIELD_ACT_SPECIAL		13	/* Special, type specific action */
5032 #define FIELD_ACT_INTERACT_TEST	14	/* Test for type of player interaction */
5033 #define FIELD_ACT_MON_ENTER_TEST 15	/* Monster attempts to enter grid */
5034 #define FIELD_ACT_BUILD_ACT1	16	/* Building prelimiary action */
5035 #define FIELD_ACT_BUILD_ACT2	17	/* Building final action */
5036 #define FIELD_ACT_STORE_ACT1	18	/* Store object antiselection action */
5037 #define FIELD_ACT_STORE_ACT2	19	/* Store object selection action */
5038 #define FIELD_ACT_SB_INIT		20	/* Initialize a store / building */
5039 #define FIELD_ACTION_MAX		21
5040 
5041 #define ACT_TUNNEL		0
5042 #define ACT_DISARM		1
5043 #define ACT_OPEN		2
5044 
5045 /* To make the declarations in externs.h simpler */
5046 #define DECL_FIELD_ACTION(N) \
5047 	extern bool field_action_##N (field_type *f_ptr, va_list vp)
5048 
5049 /*
5050  * Player displays
5051  */
5052 #define DISPLAY_PLAYER_STANDARD		0	/* standard display */
5053 #define DISPLAY_PLAYER_SUMMARY		1	/* summary of various things */
5054 #define DISPLAY_PLAYER_FLAG             2
5055 
5056 #define DISPLAY_PLAYER_MAX		3
5057 
5058 /* Types of object list */
5059 #define LIST_INVEN			1
5060 #define LIST_EQUIP			2
5061 #define LIST_FLOOR			3
5062 #define LIST_STORE			4
5063 #define LIST_HOME			5
5064 
5065 /* Locations of the tables on the screen (see ui.c / birth.c) */
5066 #define HEADER_ROW		1
5067 #define QUESTION_ROW	7
5068 #define TABLE_ROW		10
5069 
5070 #define INVALID_CHOICE 255
5071 
5072 /*
5073  * Useful macros for lua interface.
5074  */
5075 #define LUA_VAR(A) \
5076 	#A, (A)
5077 #define LUA_VAR_NAMED(A, N) \
5078 	N, (A)
5079 #define LUA_RETURN(A) \
5080 	#A, &(A)
5081 #define LUA_RETURN_NAMED(A, N) \
5082 	N, &(A)
5083 #define LUA_OBJECT(A) \
5084 	"object", "object_type", (void *)(A)
5085 #define LUA_OBJECT_NAMED(A, N) \
5086 	N, "object_type", (void *)(A)
5087