1 /* omega copyright (c) 1987,1988,1989 by Laurence Raphael Brothers */
2 /* This file is the header file for all omega modules */
3 /* defs.h */
4 
5 /* omega will NOT function unless the implementor sets the appropriate
6 definitions in the following section. */
7 
8 /*--------------------------USER DEFINITIONS--------------------------*/
9 
10 /* Implementor should uncomment the following if his system uses
11 string.h instead of strings.h (try man string) */
12 
13 #define STRING
14 
15 /* Implementor should uncomment the following if random and srandom
16    are not available  (try man random) */
17 
18 /* #define NORANDOM */
19 
20 /* Implementor should uncomment the following if omega appears to
21 redraw the screen excessively. */
22 
23 #define EXCESSIVE_REDRAW
24 
25 /* The following definition is recommended. Remove it only if you have
26 huge amounts of disk space and are annoyed at waiting a few more seconds
27 on save and restore. */
28 
29 #define COMPRESS_SAVE_FILES
30 
31 /* If your system has gzip, I recommend using it instead of compress */
32 /* (try just typing 'gzip' at the shell prompt) */
33 
34 #define USE_GZIP
35 
36 /* If your system doesn't have the usleep call, uncomment this line */
37 /* (try man usleep) */
38 
39 /* #define NO_USLEEP */
40 
41 /* OMEGALIB is where all the data files reside.
42    Note the final / is necessary.
43    msdos note: \ is the C string escape character, so you need \\ in the
44    path given in OMEGALIB
45    This might usually be "/usr/games/lib/omegalib/", for unix,
46    or something like "c:\\games\\omega\\omegalib\\" for msdos */
47 
48 #ifndef OMEGALIB
49 #define OMEGALIB "./lib/"
50 #endif
51 
52 /* Comment the following line out if you want users to be able to override */
53 /* the OMEGALIB define, above, by setting the environment variable OMEGALIB */
54 /* (I recommend leaving this line uncommented, unless you're compiling */
55 /* for someone else and don't know where they'll be putting the omegalib */
56 /* directory, as is the case with compiling executables for home computers. */
57 /* It would be downright insecure to comment this line out in a multi-user */
58 /* environment, especially if you're going to run omega setuid.) */
59 
60 /*#define FIXED_OMEGALIB*/
61 
62 /* set WIZARD to maintainers's username */
63 
64 #define WIZARD "wtanksle"
65 
66 /* If CATCH_SIGNALS is set to 1, will not dump core, nicer for players. */
67 /* dbx still intercepts the signals first, so it's ok for debugging */
68 
69 #define CATCH_SIGNALS 1
70 
71 
72 /*---------------------------SYSTEM DEFINITIONS---------------------------*/
73 
74 /* Don't change anything from here on (unless you know what you're doing) */
75 #define VERSION 90
76 #define VERSIONSTRING "omega version 0.90"
77 
78 #ifndef AMIGA
79 #ifndef MSDOS
80 #ifndef BSD
81 #ifndef SYSV
82     ERROR! - One of these should be set - edit the makefile appropriately
83 #endif
84 #endif
85 #endif
86 #endif
87 
88 #if defined(MSDOS_SUPPORTED_ANTIQUE)
89 #define SAVE_LEVELS
90 #endif
91 
92 #ifdef COMPRESS_SAVE_FILES
93 # ifdef USE_GZIP
94 # define COMPRESSOR "gzip"
95 # define UNCOMPRESSOR "gunzip"
96 # define COMPRESS_EXT "gz"
97 # define EXT_LENGTH 2
98 # else
99 # define COMPRESSOR "compress"
100 # define UNCOMPRESSOR "uncompress"
101 # define COMPRESS_EXT "Z"
102 # define EXT_LENGTH 1
103 # endif
104 #endif
105 
106 #define VACANT 0
107 #define ABORT -1
108 #define CASHVALUE -2
109 
110 /* moderately arbitrary but probably cannot be easily changed */
111 #define MAXWIDTH 64
112 #define MAXLENGTH 64
113 #define SMALLSCREENLENGTH 16
114 
115 /* number of slots in inventory. Cannot be changed without work */
116 #define MAXITEMS 16
117 
118 /* number of slots in pack. Should be <= 26. */
119 #define MAXPACK 26
120 
121 /* number of items in pawn shop. Should be <= 26 */
122 #define PAWNITEMS 20 /* DG -- the more the merrier.  WDT -- I agree. */
123 
124 /* number of lines back strings are recalled */
125 #define STRING_BUFFER_SIZE 25
126 
127 /* number of rerolls allowed +1 */  /* added by dagibbs (DG) */
128 #define REROLLS 31
129 
130 /* Verbosity levels */
131 #define TERSE 0
132 #define MEDIUM 1
133 #define VERBOSE 2
134 
135 /* Arbitrary. Max of the levels in the dungeons */
136 #define MAXLEVELS 21
137 
138 /* levels in each dungeon */
139 #define ASTRALLEVELS 5
140 #define SEWERLEVELS 18
141 #define CASTLELEVELS 16
142 #define CAVELEVELS 10
143 #define VOLCANOLEVELS 20
144 
145 /* Overall Game Progress Vector Bits */
146 /* Long had BETTER have at least 32 bits.... */
147 #define SPOKE_TO_DRUID		0x1
148 #define COMPLETED_CAVES		0x2
149 #define COMPLETED_SEWERS	0x4
150 #define COMPLETED_CASTLE	0x8
151 #define COMPLETED_ASTRAL	0x10
152 #define COMPLETED_VOLCANO	0x20
153 #define KILLED_DRAGONLORD	0x40
154 #define KILLED_EATER		0x80
155 #define KILLED_LAWBRINGER	0x100
156 #define COMPLETED_CHALLENGE	0x200
157 #define SOLD_CONDO		0x400
158 #define FAST_MOVE		0x800
159 #define SKIP_PLAYER		0x1000
160 #define SKIP_MONSTERS		0x2000
161 #define MOUNTED			0x4000
162 #define SUPPRESS_PRINTING	0x8000
163 #define LOST			0x10000
164 #define ARENA_MODE		0x20000
165 #define CHEATED			0x40000
166 #define BANK_BROKEN		0x80000
167 #define CLUB_MEMBER		0x100000
168 #define PREPARED_VOID		0x200000
169 #define DESTROYED_ORDER		0x400000
170 #define GAVE_STARGEM		0x800000
171 #define ATTACKED_ORACLE		0x1000000
172 #define UNDEAD_GUARDS		0x2000000
173 
174 /* non-existant environments for the random number seeding routine */
175  /* added 12/30/98 (DG) */
176 #define E_RESTORE -2
177 #define E_RANDOM -1
178 /* general environment types */
179 #define E_NEVER_NEVER_LAND 0
180 #define E_COUNTRYSIDE 1
181 #define E_CITY 2
182 #define E_VILLAGE 3
183 #define E_TACTICAL_MAP 4
184 #define E_SEWERS 5
185 #define E_CASTLE 6
186 #define E_CAVES 7
187 #define E_VOLCANO 8
188 #define E_ASTRAL 9
189 #define E_ARENA 10
190 #define E_HOVEL 11
191 #define E_MANSION 12
192 #define E_HOUSE 13
193 #define E_DLAIR 14
194 #define E_ABYSS 15
195 #define E_STARPEAK 16
196 #define E_MAGIC_ISLE 17
197 #define E_TEMPLE 18
198 #define E_CIRCLE 19
199 #define E_COURT 20
200 #define E_MAX E_COURT
201 
202 /* player game status */
203 #define DEAD 1
204 #define QUIT 2
205 #define WIN 3
206 #define BIGWIN 4
207 
208 /* kind of arbitrary */
209 #define MAXROOMS 48
210 #define MAXCONNECTIONS 4
211 #define STRING_LEN 100
212 
213 /* some random characters */
214 #define ESCAPE 27
215 #define RETURN '\n'
216 #define LINEFEED '\r'
217 #define BACKSPACE '\b'
218 #define DELETE 127
219 
220 
221 /* tac mode action definitions */
222 /* have to remember to find where these are used, mostly unused, now! */
223 #define DISENGAGE 10
224 #define BLOCK 20
225 #define CUT 30
226 #define THRUST 40
227 #define MAGIC 50
228 #define LUNGE 60
229 #define RIPOSTE 70
230 #define WIELD 80
231 #define PICK_UP 90
232 
233 /* as in attack low, block high, etc. */
234 /* These values may be added to the ones above to get things like
235    block high, cut low, etc. CLEVER is only used by some monsters
236    to cheat with.... */
237 #define LOW 1
238 #define CENTER 2
239 #define HIGH 3
240 #define CLEVER 4
241 
242 
243 /* weapon types */
244 #define CUTTING 1
245 #define THRUSTING 2
246 #define STRIKING 3
247 #define MISSILE 4
248 
249 /* random aux constants */
250 /* aux field for private residences in city */
251 #define BURGLED 2
252 #define LOCKED 3
253 #define UNLOCKED 0
254 
255 /* cannot use M command on site with this aux value */
256 #define NOCITYMOVE 666
257 
258 /* bow and crossbow object aux fields */
259 #define LOADED 1
260 #define UNLOADED 0
261 
262 /* alignment used randomly throughout*/
263 #define LAWFUL 1
264 #define CHAOTIC 2
265 #define NEUTRAL 3
266 
267 /* spells */
268 #define NUMSPELLS 41
269 
270 #define S_MON_DET 0
271 #define S_OBJ_DET 1
272 #define S_MISSILE 2
273 #define S_FIREBOLT 3
274 #define S_TELEPORT 4
275 #define S_LBALL 5
276 #define S_SLEEP 6
277 #define S_DISRUPT 7
278 #define S_DISINTEGRATE 8
279 #define S_POLYMORPH 9
280 #define S_HEAL 10
281 #define S_DISPEL 11
282 #define S_IDENTIFY 12
283 #define S_BREATHE 13
284 #define S_INVISIBLE 14
285 #define S_WARP 15
286 #define S_ENCHANT 16
287 #define S_BLESS 17
288 #define S_RESTORE 18
289 #define S_CURE 19
290 #define S_TRUESIGHT 20
291 #define S_HELLFIRE 21
292 #define S_KNOWLEDGE 22
293 #define S_HERO 23
294 #define S_RETURN 24
295 #define S_DESECRATE 25
296 #define S_HASTE 26
297 #define S_SUMMON 27
298 #define S_SANCTUARY 28
299 #define S_ACCURACY 29
300 #define S_RITUAL 30
301 #define S_FEAR 31
302 #define S_APPORT 32
303 #define S_SHADOWFORM 33
304 #define S_ALERT 34
305 #define S_REGENERATE 35
306 #define S_SANCTIFY 36
307 #define S_CLAIRVOYANCE 37
308 #define S_DRAIN 38
309 #define S_LEVITATE 39
310 #define S_WISH 40
311 
312 /* ranks in guilds, etc */
313 #define NUMRANKS 9
314 
315 #define LEGION 0
316 #define ARENA 1
317 #define COLLEGE 2
318 #define THIEVES 3
319 #define ORDER 4
320 #define CIRCLE 5
321 #define NOBILITY 6
322 #define PRIESTHOOD 7
323 #define ADEPT 8
324 
325 #define LEGIONAIRE 1
326 #define CENTURION 2
327 #define FORCE_LEADER 3
328 #define COLONEL 4
329 #define COMMANDANT 5
330 
331 #define TRAINEE 1
332 #define BESTIARIUS 2
333 #define RETIARIUS 3
334 #define GLADIATOR 4
335 #define CHAMPION 5
336 
337 #define NOVICE 1
338 #define STUDENT 2
339 #define PRECEPTOR 3
340 #define MAGE 4
341 #define ARCHMAGE 5
342 
343 #define TMEMBER 1
344 #define ATHIEF 2
345 #define THIEF 3
346 #define TMASTER 4
347 #define SHADOWLORD 5
348 
349 #define GALLANT 1
350 #define GUARDIAN 2
351 #define CHEVALIER 3
352 #define PALADIN 4
353 #define JUSTICIAR 5
354 
355 #define INITIATE 1
356 #define ENCHANTER 2
357 #define SORCEROR 3
358 #define HIGHSORCEROR 4
359 #define PRIME 5
360 
361 #define COMMONER 1
362 #define ESQUIRE 2
363 #define KNIGHT 3
364 #define LORD 4
365 #define DUKE 5
366 
367 #define LAY 1
368 #define ACOLYTE 2
369 #define PRIEST 3
370 #define SPRIEST 4
371 #define HIGHPRIEST 5
372 
373 /* different priesthoods */
374 #define ODIN 1
375 #define SET 2
376 #define ATHENA 3
377 #define HECATE 4
378 #define DRUID 5
379 #define DESTINY 6
380 
381 
382 
383 /* MONSTER STATUS/ABILITY BITS */
384 #define AWAKE 1
385 #define MOBILE 2
386 #define HOSTILE 4
387 #define WANDERING 16
388 #define HUNGRY 32
389 #define GREEDY 64
390 #define NEEDY  128
391 #define ONLYSWIM 256
392 #define FLYING 512
393 #define INTANGIBLE 1024
394 #define M_INVISIBLE 2048
395 #define SWIMMING 4096
396 #define POISONOUS 8192
397 #define EDIBLE 16384
398 
399 
400 /* PLAYER STATUS INDICES */
401 #define NUMSTATI 25
402 
403 #define ACCURACY 0
404 #define BLINDED 1
405 #define SLOWED 2
406 #define DISPLACED 3
407 #define SLEPT 4
408 #define DISEASED 5
409 #define POISONED 6
410 #define HASTED 7
411 #define BREATHING 8
412 #define INVISIBLE 9
413 #define REGENERATING 10
414 #define VULNERABLE 11
415 #define BERSERK 12
416 #define IMMOBILE 13
417 #define ALERT 14
418 #define AFRAID 15
419 #define HERO 16
420 #define LEVITATING 17
421 #define ACCURATE 18
422 #define TRUESIGHT 19
423 #define SHADOWFORM 20
424 #define ILLUMINATION 21
425 #define DEFLECTION 22
426 #define PROTECTION 23
427 /* PROTECTION is deviant -- indicates protective value, not duration */
428 #define RETURNING 24
429 /* RETURNING is somewhat deviant--how many turns 'til RETURN spell goes off */
430 
431 /* player immunity indices */
432 /* also monster immunity bits (2^n) */
433 /* also damage types */
434 #define NUMIMMUNITIES 14
435 
436 #define UNSTOPPABLE 0
437 #define NORMAL_DAMAGE 1
438 #define FLAME 2
439 #define COLD 3
440 #define ELECTRICITY 4
441 #define POISON 5
442 #define ACID 6
443 #define FEAR 7
444 #define SLEEP 8
445 #define NEGENERGY 9
446 #define OTHER_MAGIC 10
447 #define THEFT 11
448 #define GAZE 12
449 #define INFECTION 13
450 #define EVERYTHING -1
451 
452 
453 /* location lstatus bits */
454 #define SEEN 1
455 #define LIT 2
456 #define SECRET 4
457 #define STOPS 8
458 #define CHANGED 16
459 
460 
461 /* room string id */
462 /* for use in roomname() */
463 #define NUMROOMNAMES 30
464 
465 /* normal room name indices start after the RS_ constants */
466 #define ROOMBASE 39
467 #define RS_COURT 38
468 #define RS_ZORCH 37
469 #define RS_CIRCLE 36
470 #define RS_MAGIC_ISLE 35
471 #define RS_STARPEAK 34
472 #define RS_VOLCANO 33
473 #define RS_HIGHASTRAL 32
474 #define RS_FIREPLANE 31
475 #define RS_AIRPLANE 30
476 #define RS_WATERPLANE 29
477 #define RS_EARTHPLANE 28
478 #define RS_LOWERASTRAL 27
479 #define RS_CLOSET 26
480 #define RS_SECRETPASSAGE 25
481 #define RS_DININGROOM 24
482 #define RS_BATHROOM 23
483 #define RS_BEDROOM 22
484 #define RS_KITCHEN 21
485 #define RS_DROWNED_SEWER 20
486 #define RS_DRAINED_SEWER 19
487 #define RS_SEWER_DUCT 18
488 #define RS_ARENA 17
489 #define RS_COUNTRYSIDE 16
490 #define RS_DRUID 15
491 #define RS_HECATE 14
492 #define RS_ATHENA 13
493 #define RS_SET 12
494 #define RS_ODIN 11
495 #define RS_DESTINY 10
496 #define RS_ADEPT 9
497 #define RS_WYRM 8
498 #define RS_OCEAN 7
499 #define RS_PONDS 6
500 #define RS_DRAGONLORD 5
501 #define RS_GOBLINKING 4
502 #define RS_CAVERN 3
503 #define RS_CORRIDOR 2
504 #define RS_WALLSPACE 1
505 
506 #if defined(MSDOS_SUPPORTED_ANTIQUE) || defined(AMIGA)
507 #define CLR(fg)		COL_##fg
508 #define CLRS(fg,bg)	COL_##fg|COL_BG_##bg
509 #endif
510 
511 #ifdef MSDOS_SUPPORTED_ANTIQUE
512 
513 #define COL_BLACK 0x0000
514 #define COL_BLUE 0x0100
515 #define COL_GREEN 0x0200
516 #define COL_CYAN 0x0300
517 #define COL_RED 0x0400
518 #define COL_PURPLE 0x0500
519 #define COL_BROWN 0x0600
520 #define COL_WHITE 0x0700
521 #define COL_GREY 0x0800
522 #define COL_LIGHT_BLUE 0x0900
523 #define COL_LIGHT_GREEN 0x0a00
524 #define COL_LIGHT_CYAN 0x0b00
525 #define COL_LIGHT_RED 0x0c00
526 #define COL_LIGHT_PURPLE 0x0d00
527 #define COL_YELLOW 0x0e00
528 #define COL_BRIGHT_WHITE 0x0f00
529 #define COL_BG_BLACK 0x0000
530 #define COL_BG_BLUE 0x1000
531 #define COL_BG_GREEN 0x2000
532 #define COL_BG_CYAN 0x3000
533 #define COL_BG_RED 0x4000
534 #define COL_BG_PURPLE 0x5000
535 #define COL_BG_BROWN 0x6000
536 #define COL_BG_WHITE 0x7000
537 #define COL_FG_BLINK 0x8000
538 
539 #else
540 #ifdef AMIGA
541 
542 #include <curses210.h>
543 
544 /* unfortunately, this curses package only implements 8 colours... */
545 
546 #define COL_WHITE 0x0100
547 #define COL_BLACK COL_WHITE
548 	    /* this assumes that all things with black fg have white bg */
549 #define COL_BROWN 0x0200
550 #define COL_YELLOW 0x0300
551 #define COL_GREY 0x0400
552 #define COL_GREEN 0x0500
553 #define COL_BLUE 0x0600
554 #define COL_RED 0x0700
555 #define COL_CYAN 0x0500		/* = green */
556 #define COL_PURPLE 0x0700	/* = red */
557 #define COL_LIGHT_BLUE 0x0600	/* = blue */
558 #define COL_LIGHT_GREEN 0x0500	/* = green */
559 #define COL_LIGHT_CYAN 0x0500	/* = green */
560 #define COL_LIGHT_RED 0x0700	/* = red */
561 #define COL_LIGHT_PURPLE 0x0100	/* = white */
562 #define COL_BRIGHT_WHITE 0x0100	/* = white */
563 #define COL_BG_BLACK 0x0000
564 #define COL_BG_WHITE (A_REVERSE<<8)
565 #define COL_BG_GREEN (A_REVERSE<<8)
566 #define COL_BG_CYAN (A_REVERSE<<8)
567 #define COL_BG_RED (A_REVERSE<<8)
568 #define COL_BG_PURPLE (A_REVERSE<<8)
569 #define COL_BG_BROWN (A_REVERSE<<8)
570 #define COL_BG_BLUE (A_REVERSE<<8)
571 #define COL_FG_BLINK 0x0000	/* not implemented :( */
572 /* WDT: thank goodness for that lack of implementation. */
573 
574 #else
575 #ifdef __FreeBSD__
576 #include <ncurses.h>
577 #else
578 #include <curses.h>
579 #endif
580 
581 #define COL_FG_BLINK A_BLINK
582 
583 #ifdef COLOR_PAIR
584 
585 # ifdef OMEGA_CLRGEN
586 #  define CLR(fg)	OMEGA_CLRGEN1 fg
587 #  define CLRS(fg, bg)	OMEGA_CLRGEN2 fg bg
588 # else
589 #  include "clrgen.h"
590 #  define CLR(fg)	CLR_##fg##_BLACK
591 #  define CLRS(fg, bg)	CLR_##fg##_##bg
592 # endif
593 
594 #else
595 
596 #define CLR(fg)		0
597 #define CLRS(fg,bg)	0
598 
599 #endif
600 #endif
601 #endif
602 
603 /* objects, locations, and terrain; characters to draw */
604 #define NULL_ITEM '\0'
605 #define SPACE (' ' | CLR(WHITE))
606 #define WALL ('#' | CLR(GREY))
607 #define PORTCULLIS ('7' | CLR(WHITE))
608 #define OPEN_DOOR ('|' | CLR(BROWN))
609 #define CLOSED_DOOR ('-' | CLR(BROWN))
610 #define WHIRLWIND ('6' | CLR(LIGHT_BLUE))
611 #define ABYSS ('0' | CLRS(BLACK,BROWN))
612 #define VOID_CHAR (' ' | CLR(WHITE))
613 #define LAVA ('`' | CLR(RED))
614 #define HEDGE ('\"' | CLR(GREEN))
615 #define WATER ('~' | CLR(BLUE))
616 #define FIRE (';' | CLR(LIGHT_RED))
617 #define TRAP ('^' | CLR(RED))
618 #define LIFT ('_' | CLR(BRIGHT_WHITE))
619 #define STAIRS_UP ('<' | CLR(WHITE))
620 #define STAIRS_DOWN ('>' | CLR(WHITE))
621 #define FLOOR ('.' | CLR(BROWN))
622 #define PLAYER ('@' | CLR(WHITE))
623 #define CORPSE ('+' | CLR(RED))
624 #define STATUE ('1' | CLR(GREY))
625 #define RUBBLE ('4' | CLR(GREY))
626 #define ALTAR ('8' | CLR(LIGHT_BLUE))
627 #define CASH ('$' | CLR(YELLOW))	/* various kinds of money */
628 #define PILE ('*' | CLR(BRIGHT_WHITE))	/* several objects in one place */
629 #define FOOD ('%' | CLR(BROWN))
630 #define WEAPON (')' | CLR(GREY))
631 #define MISSILEWEAPON ('(' | CLR(BROWN))
632 #define SCROLL ('?' | CLR(YELLOW))
633 #define POTION ('!' | CLR(LIGHT_GREEN))
634 #define ARMOR (']' | CLR(GREY))
635 #define SHIELD ('[' | CLR(BROWN))
636 #define CLOAK ('}' | CLR(CYAN))
637 #define BOOTS ('{' | CLR(BROWN))
638 #define STICK ('/' | CLR(BROWN))
639 
640 #define RING ('=' | CLR(YELLOW))
641 #define THING ('\\' | CLR(WHITE))
642 #define ARTIFACT ('&' | CLR(YELLOW))
643 
644 /* TERRAIN TYPES */
645 #define PLAINS ('-' | CLR(LIGHT_GREEN))
646 #define TUNDRA ('_' | CLR(GREY))
647 #define ROAD ('.' | CLR(BROWN))
648 #define MOUNTAINS ('^' | CLR(GREY))
649 #define PASS ('v' | CLR(BROWN))
650 #define RIVER ('~' | CLR(BLUE))
651 #define CITY ('O' | CLR(WHITE))
652 #define VILLAGE ('o' | CLR(WHITE))
653 #define FOREST ('(' | CLR(LIGHT_GREEN))
654 #define JUNGLE (')' | CLR(GREEN))
655 #define SWAMP ('=' | CLR(GREEN))
656 #define VOLCANO ('!' | CLR(RED))
657 #define CASTLE ('%' | CLR(GREY))
658 #define TEMPLE ('X' | CLR(BROWN))
659 #define CAVES ('*' | CLRS(BLACK,BROWN))
660 #define DESERT ('\"' | CLR(YELLOW))
661 #define CHAOS_SEA ('+' | CLR(LIGHT_PURPLE))
662 #define STARPEAK ('|' | CLR(LIGHT_BLUE))
663 #define DRAGONLAIR ('$' | CLR(BROWN))
664 #define MAGIC_ISLE ('&' | CLR(PURPLE))
665 
666 #define CHAIR ('5' | CLR(BROWN))
667 #define SAFE ('3' | CLR(GREY))
668 #define FURNITURE ('2' | CLR(BROWN))
669 #define BED ('9' | CLR(CYAN))
670 
671 /* wow, all characters used! */
672 
673 
674 /* total number of player options */
675 #define NUMOPTIONS 11
676 
677 /* number of options with TRUE/FALSE values */
678 #define NUMTFOPTIONS 9
679 
680 /* The slot number of the two options not in Player.options */
681 #define VERBOSITY_LEVEL 10
682 #define SEARCH_DURATION 11
683 
684 /* Player.options bits */
685 #define BELLICOSE 1
686 #define JUMPMOVE 2
687 #define RUNSTOP 4
688 #define PICKUP 8
689 #define CONFIRM 16
690 #define TOPINV 32
691 #define PACKADD 64
692 #define COMPRESS_OPTION 128
693 #define SHOW_COLOUR 256
694 
695 /* This has to be changed whenever an item is added */
696 #define NUMSCROLLS 24
697 #define NUMPOTIONS 18
698 #define NUMFOODS 16
699 #define NUMTHINGS 26
700 #define NUMWEAPONS 41
701 #define NUMARMOR 17
702 #define NUMSHIELDS 8
703 #define NUMCLOAKS 7
704 #define NUMBOOTS 7
705 #define NUMRINGS 10
706 #define NUMSTICKS 17
707 #define NUMARTIFACTS 24
708 
709 /* running sum of itemtypes, for indexing into Objects array */
710 #define THINGID 0
711 #define FOODID NUMTHINGS
712 #define SCROLLID (FOODID + NUMFOODS)
713 #define POTIONID (SCROLLID + NUMSCROLLS)
714 #define WEAPONID (POTIONID + NUMPOTIONS)
715 #define ARMORID (WEAPONID + NUMWEAPONS)
716 #define SHIELDID (ARMORID + NUMARMOR)
717 #define CLOAKID (SHIELDID + NUMSHIELDS)
718 #define BOOTID (CLOAKID + NUMCLOAKS)
719 #define RINGID (BOOTID + NUMBOOTS)
720 #define STICKID (RINGID + NUMRINGS)
721 #define ARTIFACTID (STICKID + NUMSTICKS)
722 #define CASHID (ARTIFACTID+NUMARTIFACTS)
723 /* Corpse's aux field is monster id */
724 #define CORPSEID (CASHID+1)
725 
726 #define TOTALITEMS (CORPSEID+1)
727 
728 /* describing unique items and monsters */
729 #define COMMON 0
730 #define UNIQUE_UNMADE 1
731 #define UNIQUE_MADE 2
732 #define UNIQUE_TAKEN 3
733 
734 /* general item function id's */
735 #define I_NO_OP 0
736 #define I_NOTHING 1
737 
738   /* note some of these functions are for other types of items too */
739 
740     /* scroll functions */
741 #define I_BLESS 101
742 #define I_ACQUIRE 102
743 #define I_ENCHANT 103
744 #define I_TELEPORT 104
745 #define I_WISH 105
746 #define I_CLAIRVOYANCE 106
747 #define I_DISPLACE 107
748 #define I_ID 108
749 #define I_FIREFLASH 109
750 #define I_SPELLS 110
751 #define I_JANE_T 111
752 #define I_ALERT 112
753 #define I_FLUX 113
754 #define I_CHARGE 114
755 #define I_WARP 115
756 #define I_KNOWLEDGE 116
757 #define I_LAW 117
758 #define I_HINT 118
759 #define I_HERO 119
760 #define I_TRUESIGHT 120
761 #define I_ILLUMINATE 121
762 #define I_DEFLECT 122
763 
764     /* potion functions */
765 #define I_HEAL 201
766 #define I_OBJDET 202
767 #define I_MONDET 203
768 #define I_SLEEP_SELF 204
769 #define I_RESTORE 205
770 #define I_NEUTRALIZE_POISON 206
771 #define I_SPEED 207
772 #define I_AZOTH 208
773 #define I_REGENERATE 210
774 #define I_INVISIBLE 211
775 #define I_BREATHING 212
776 #define I_FEAR_RESIST 213
777 #define I_AUGMENT 214
778 #define I_CHAOS 215
779 #define I_ACCURACY 216
780 #define I_LEVITATION 217
781 #define I_CURE 218
782 
783     /* stick functions */
784 #define I_FIREBOLT 301
785 #define I_LBOLT 302
786 #define I_MISSILE 303
787 #define I_SLEEP_OTHER 304
788 #define I_FIREBALL 305
789 #define I_LBALL 306
790 #define I_SUMMON 307
791 #define I_HIDE 308
792 #define I_DISRUPT 309
793 #define I_DISINTEGRATE 310
794 #define I_SNOWBALL 311
795 #define I_APPORT 312
796 #define I_DISPEL 313
797 #define I_POLYMORPH 314
798 #define I_FEAR 315
799 
800     /* food functions */
801 #define I_FOOD 401
802 #define I_LEMBAS 402
803 #define I_STIM 403
804 #define I_POW 404
805 #define I_IMMUNE 405
806 #define I_POISON_FOOD 406
807 #define I_CORPSE 407
808 #define I_PEPPER_FOOD 408
809 #define I_CANNIBAL 409
810 #define I_INEDIBLE 410
811 
812     /* boots functions */
813 #define I_PERM_SPEED 501
814 #define I_PERM_HERO 502
815 #define I_PERM_LEVITATE 503
816 #define I_PERM_AGILITY 504
817 #define I_BOOTS_JUMPING 505
818 #define I_BOOTS_7LEAGUE 506
819 
820     /* cloak functions */
821 #define I_PERM_DISPLACE 601
822 #define I_PERM_NEGIMMUNE 602
823 #define I_PERM_INVISIBLE 603
824 #define I_PERM_ACCURACY 604
825 #define I_PERM_PROTECTION 605
826 #define I_PERM_TRUESIGHT 606
827 
828     /* ring functions */
829 #define I_PERM_VISION 701
830 #define I_PERM_BURDEN 702
831 #define I_PERM_STRENGTH 703
832 #define I_PERM_GAZE_IMMUNE 704
833 #define I_PERM_FIRE_RESIST 705
834 #define I_PERM_POISON_RESIST 706
835 #define I_PERM_REGENERATE 707
836 #define I_PERM_KNOWLEDGE 708
837 
838     /* armor functions */
839 #define I_PERM_ENERGY_RESIST 801
840 #define I_PERM_BREATHING 802
841 #define I_PERM_FEAR_RESIST 803
842 #define I_NORMAL_ARMOR 804
843 
844 /* artifact functions */
845 #define I_ORBFIRE 901
846 #define I_ORBWATER 902
847 #define I_ORBEARTH 903
848 #define I_ORBAIR 904
849 #define I_ORBMASTERY 905
850 #define I_ORBDEAD 906
851 #define I_CRYSTAL 907
852 #define I_ANTIOCH 908
853 #define I_KOLWYNIA 909
854 #define I_DEATH 910
855 #define I_ENCHANTMENT 911
856 #define I_HELM 912
857 #define I_LIFE 913
858 #define I_JUGGERNAUT 914
859 #define I_SYMBOL 915
860 #define I_STARGEM 916
861 #define I_SCEPTRE 917
862 #define I_PLANES 918
863 
864 /* weapons functions */
865 #define I_NORMAL_WEAPON 1001
866 #define I_LIGHTSABRE 1002
867 #define I_DEMONBLADE 1003
868 #define I_MACE_DISRUPT 1004
869 #define I_TANGLE 1005
870 #define I_ARROW 1006
871 #define I_BOLT 1007
872 #define I_VORPAL 1008
873 #define I_DESECRATE 1009
874 #define I_FIRESTAR 1010
875 #define I_DEFEND 1011
876 #define I_VICTRIX 1012
877 #define I_EMPIRE 1013
878 #define I_SCYTHE 1014
879 #define I_ACIDWHIP 1015
880 
881 /* thing functions */
882 #define I_PICK 1101
883 #define I_KEY 1102
884 #define I_SHOVEL 1103 /* unused */
885 #define I_EXCAVATOR 1104 /* unused */
886 #define I_PERM_ILLUMINATE 1105
887 #define I_TRAP 1106
888 #define I_RAISE_PORTCULLIS 1107
889 
890 /* shield functions */
891 #define I_PERM_DEFLECT 1201
892 #define I_NORMAL_SHIELD 1202
893 
894 /* monster function ids */
895 /* Its conceivable for a function of one type to be called when another
896 would usually occur. A monster's special function may be an extra move,
897 for example. */
898 
899 #define M_NO_OP -1
900 
901 /* talk functions */
902 #define M_TALK_STUPID 101
903 #define M_TALK_SILENT 102
904 #define M_TALK_HUNGRY 103
905 #define M_TALK_GREEDY 104
906 #define M_TALK_TITTER 105
907 #define M_TALK_MAN 106
908 #define M_TALK_ROBOT 107
909 #define M_TALK_EVIL 108
910 #define M_TALK_BURBLE 109
911 #define M_TALK_SLITHY 110
912 #define M_TALK_MIMSY 111
913 #define M_TALK_SEDUCTOR 112
914 #define M_TALK_MP 113
915 #define M_TALK_IM 114
916 #define M_TALK_GUARD 115
917 #define M_TALK_GHOST 116
918 #define M_TALK_HINT 117
919 #define M_TALK_BEG 118
920 #define M_TALK_EF 119
921 #define M_TALK_GF 120
922 #define M_TALK_MORGON 121
923 #define M_TALK_LB 122
924 #define M_TALK_DEMONLOVER 123
925 #define M_TALK_ASSASSIN 124
926 #define M_TALK_NINJA 125
927 #define M_TALK_THIEF 126
928 #define M_TALK_MERCHANT 127
929 #define M_TALK_HORSE 128
930 #define M_TALK_PARROT 129
931 #define M_TALK_ANIMAL 130
932 #define M_TALK_HYENA 131
933 #define M_TALK_SERVANT 132
934 #define M_TALK_SCREAM 133
935 #define M_TALK_DRUID 134
936 #define M_TALK_ARCHMAGE 135
937 #define M_TALK_PRIME 136
938 
939 /* ability functions */
940 #define M_SP_SURPRISE 201
941 #define M_SP_MP 202
942 #define M_SP_THIEF 203
943 #define M_SP_AGGRAVATE 204
944 #define M_SP_POISON_CLOUD 205
945 #define M_SP_HUGE 206
946 #define M_SP_SUMMON 207
947 #define M_SP_ILLUSION 208
948 #define M_SP_FLUTTER 209
949 #define M_SP_ESCAPE 210
950 #define M_SP_SPELL 211
951 #define M_SP_EXPLODE 212
952 #define M_SP_DEMON 213
953 #define M_SP_ACID_CLOUD 214
954 #define M_SP_WHIRL 215
955 #define M_SP_GHOST 216
956 #define M_SP_WHISTLEBLOWER 217
957 #define M_SP_EATER 218
958 #define M_SP_LAWBRINGER 219
959 #define M_SP_DRAGONLORD 220
960 #define M_SP_DE 221
961 #define M_SP_DEMONLOVER 222
962 #define M_SP_SEDUCTOR 223
963 #define M_SP_MASTER 224
964 #define M_SP_WYRM 225
965 #define M_SP_BLACKOUT 226
966 #define M_SP_BOG 227
967 #define M_SP_MERCHANT 228
968 #define M_SP_WERE 229
969 #define M_SP_SERVANT 231
970 #define M_SP_AV 232
971 #define M_SP_LW 233
972 #define M_SP_SWARM 234
973 #define M_SP_ANGEL 235
974 #define M_SP_MB 236
975 #define M_SP_MIRROR 237
976 #define M_SP_RAISE 238
977 #define M_SP_DEATH 239
978 #define M_SP_COURT 240
979 #define M_SP_LAIR 241
980 #define M_SP_PRIME 242
981 
982 /* rangestrike functions */
983 #define M_STRIKE_MISSILE 301
984 #define M_STRIKE_FBOLT 302
985 #define M_STRIKE_LBALL 303
986 #define M_STRIKE_FBALL 304
987 #define M_STRIKE_BLIND 305
988 #define M_STRIKE_SNOWBALL 306
989 #define M_STRIKE_MASTER 307
990 #define M_STRIKE_SONIC 308
991 
992 /* combat functions */
993 #define M_MELEE_NORMAL 401
994 #define M_MELEE_FIRE 402
995 #define M_MELEE_DRAGON 403
996 #define M_MELEE_MP 404
997 #define M_MELEE_ELEC 405
998 #define M_MELEE_POISON 406
999 #define M_MELEE_NG 407
1000 #define M_MELEE_SUCCUBUS 408
1001 #define M_MELEE_SPIRIT 409
1002 #define M_MELEE_DISEASE 410
1003 #define M_MELEE_SLEEP 411
1004 #define M_MELEE_COLD 412
1005 #define M_MELEE_MASTER 413
1006 #define M_MELEE_GRAPPLE 414
1007 #define M_MELEE_DEATH 415
1008 
1009 /* movement functions */
1010 #define M_MOVE_NORMAL 501
1011 #define M_MOVE_FLUTTER 502
1012 #define M_MOVE_TELEPORT 503
1013 #define M_MOVE_FOLLOW 504
1014 #define M_MOVE_RANDOM 505
1015 #define M_MOVE_SMART 506
1016 #define M_MOVE_SPIRIT 507
1017 #define M_MOVE_SCAREDY 508
1018 #define M_MOVE_CONFUSED 509
1019 #define M_MOVE_ANIMAL 510
1020 #define M_MOVE_LEASH 230
1021 
1022 /* MLx -> index to Monsters starting for level x */
1023 /* MLx -> number of monsters of level x or less */
1024 /* NML_x -> number of monsters of level x */
1025 /* NML-X must be changed whenever a monster is added */
1026 /* This whole thing MUST be repaired.  Monster levels must
1027  * be represented elsewhere. */
1028 #define ML0 0
1029 #define NML_0 9
1030 #define ML1 (ML0 + NML_0) /* 9 */
1031 #define NML_1 22
1032 #define ML2 (ML1 + NML_1) /* 31 */
1033 #define NML_2 14
1034 #define ML3 (ML2 + NML_2) /* 45 */
1035 #define NML_3 15
1036 #define ML4 (ML3 + NML_3) /* 60 */
1037 #define NML_4 18
1038 #define ML5 (ML4 + NML_4) /* 78 */
1039 #define NML_5 14
1040 #define ML6 (ML5 + NML_5) /* 92 */
1041 #define NML_6 13
1042 #define ML7 (ML6 + NML_6) /* 105 */
1043 #define NML_7 15
1044 #define ML8 (ML7 + NML_7) /* 120 */
1045 #define NML_8 12
1046 #define ML9 (ML8 + NML_8) /* 132 */
1047 #define NML_9 8
1048 #define ML10 (ML9 + NML_9) /* 140 */
1049 #define NML_10 10
1050 
1051 #define NUMMONSTERS (ML10 + NML_10)  /* 150 */
1052 
1053 /* Some monster ID's : (Those that are explicitly named in code) */
1054 /* Actually, there are still many magic constants floating around. */
1055 /* Eventually I'll get around to making each monster's id a constant.... */
1056 /* done, thanks to David Given. */
1057 #define RANDOM -1
1058 #define HORNET (ML0+0)
1059 #define MEND_PRIEST (ML0+1)
1060 #define ITIN_MERCH (ML0+2)
1061 #define GUARD (ML0+3)
1062 #define NPC (ML0+4)
1063 #define SHEEP (ML0+5)
1064 #define MERCHANT (ML0+6)
1065 #define ZERO_NPC (ML0+7)
1066 #define HISCORE_NPC (ML0+8)
1067 #define GRUNT (ML1+0)
1068 #define TSETSE (ML1+1)
1069 #define FNORD (ML1+2)
1070 #define SEWER_RAT (ML1+3)
1071 #define AGGRAVATOR (ML1+4)
1072 #define BLIPPER (ML1+5)
1073 #define GOBLIN (ML1+6)
1074 #define PHANTASTICON (ML1+7)
1075 #define ROBOT (ML1+8)
1076 #define GEEK (ML1+9)
1077 #define BOROGROVE (ML1+10)
1078 #define QUAIL (ML1+11)
1079 #define BADGER (ML1+12)
1080 #define HAWK (ML1+13)
1081 #define DEER (ML1+14)
1082 #define CAMEL (ML1+15)
1083 #define ANTEATER (ML1+16)
1084 #define BUNNY (ML1+17)
1085 #define TROUT (ML1+18)
1086 #define BASS (ML1+19)
1087 #define PARROT (ML1+20)
1088 #define HYENA (ML1+21)
1089 #define APPR_NINJA (ML2+0)
1090 #define NIGHT_GAUNT (ML2+1)
1091 #define SNEAK_THIEF (ML2+2)
1092 #define EYE (ML2+3)
1093 #define TOVE (ML2+4)
1094 #define NASTY (ML2+5)
1095 #define GHOST (ML2+6)
1096 #define ENCHANTOR (ML2+7)  /* use 'OR' to avoid conflict with circle rank */
1097 #define MURK (ML2+8)
1098 #define GOBLIN_CHIEF (ML2+9)
1099 #define WOLF (ML2+10)
1100 #define ANT (ML2+11)
1101 #define ELEPHANT (ML2+12)
1102 #define HORSE (ML2+13)
1103 #define SALAMANDER (ML3+0)
1104 #define CATOBLEPAS (ML3+1)
1105 #define L_FDEMON (ML3+2)
1106 #define ACID_CLOUD (ML3+3)
1107 #define PHANTOM (ML3+4)
1108 #define GOBLIN_KING (ML3+5)
1109 #define PTERODACTYL (ML3+6)
1110 #define GOBLIN_SHAMAN (ML3+7)
1111 #define LION (ML3+8)
1112 #define BRIGAND (ML3+9)
1113 #define BEAR (ML3+10)
1114 #define MAMBA (ML3+11)
1115 #define MANOWAR (ML3+12)
1116 #define WEREHUMAN (ML3+13)
1117 #define THOUGHTFORM (ML3+14)
1118 #define MANTICORE (ML4+0)
1119 #define TASMANIAN (ML4+1)
1120 #define AUTO_MINOR (ML4+2)
1121 #define DENEBIAN (ML4+3)
1122 #define JUBJUB (ML4+4)
1123 #define HAUNT (ML4+5)
1124 #define INCUBUS (ML4+6)
1125 #define SATYR (ML4+7)
1126 #define CROC (ML4+8)
1127 #define TORPOR (ML4+9)
1128 #define DOBERMAN (ML4+10)
1129 #define FUZZY (ML4+11)
1130 #define SERV_LAW (ML4+12)
1131 #define SERV_CHAOS (ML4+13)
1132 #define SWARM (ML4+14)
1133 #define BAN_SIDHE (ML4+15)
1134 #define GRUE (ML4+16)
1135 #define GENIN (ML4+17)
1136 #define DRAGONETTE (ML5+0)
1137 #define TESLA (ML5+1)
1138 #define WYVERN (ML5+2)
1139 #define CATEAGLE (ML5+3)
1140 #define FROST_DEMON (ML5+4)
1141 #define SPECTRE (ML5+5)
1142 #define NECROMANCER (ML5+6)
1143 #define SHADOW (ML5+7)
1144 #define BOGTHING (ML5+8)
1145 #define ASTRAL_VAMP (ML5+9)
1146 #define LAVA_WORM (ML5+10)
1147 #define MANABURST (ML5+11)
1148 #define OUTER_DEMON (ML5+12)
1149 #define MIRRORSHADE (ML5+13)
1150 #define FIRE_ELEM (ML6+0)
1151 #define AIR_ELEM (ML6+1)
1152 #define WATER_ELEM (ML6+2)
1153 #define EARTH_ELEM (ML6+3)
1154 #define BANDERSNATCH (ML6+4)
1155 #define LICHE (ML6+5)
1156 #define TRITON (ML6+6)
1157 #define MAST_THIEF (ML6+7)
1158 #define TRICER (ML6+8)
1159 #define RAKSHASA (ML6+9)
1160 #define DEMON_SERP (ML6+10)
1161 #define ANGEL (ML6+11)
1162 #define CHUNIN (ML6+12)
1163 #define BEHEMOTH (ML7+0)
1164 #define NAZGUL (ML7+1)
1165 #define UNICORN (ML7+2)
1166 #define ROUS (ML7+3)
1167 #define ILL_FIEND (ML7+4)
1168 #define GREAT_WYRM (ML7+5)
1169 #define FLAME_DEV (ML7+6)
1170 #define LURKER (ML7+7)
1171 #define SANDMAN (ML7+8)
1172 #define MIRRORMAST (ML7+9)
1173 #define ELDER_GRUE (ML7+10)
1174 #define LOATHLY (ML7+11)
1175 #define ZOMBIE (ML7+12)
1176 #define RICOCHET (ML7+13)
1177 #define INNER_DEMON (ML7+14)
1178 #define GOOD_FAIRY (ML8+0)
1179 #define BAD_FAIRY (ML8+1)
1180 #define AUTO_MAJOR (ML8+2)
1181 #define DRAGON (ML8+3)
1182 #define JABBERWOCK (ML8+4)
1183 #define FDEMON_L (ML8+5)
1184 #define TIGERSHARK (ML8+6)
1185 #define JONIN (ML8+7)
1186 #define SHADOW_SLAY (ML8+8)
1187 #define MIL_PRIEST (ML8+9)
1188 #define COMA (ML8+10)
1189 #define HIGH_ANGEL (ML8+11)
1190 #define JOTUN (ML9+0)
1191 #define INVIS_SLAY (ML9+1)
1192 #define KING_WYV (ML9+2)
1193 #define DEATHSTAR (ML9+3)
1194 #define THAUMATURGIST (ML9+4)
1195 #define VAMP_LORD (ML9+5)
1196 #define ARCHANGEL (ML9+6)
1197 #define DEMON_PRINCE (ML9+7)
1198 #define DEATH (ML10+0)
1199 #define EATER (ML10+1)
1200 #define LAWBRINGER (ML10+2)
1201 #define DRAGON_LORD (ML10+3)
1202 #define DEMON_EMP (ML10+4)
1203 #define LORD_EARTH (ML10+5)
1204 #define LORD_AIR (ML10+6)
1205 #define LORD_WATER (ML10+7)
1206 #define LORD_FIRE (ML10+8)
1207 #define ELEM_MASTER (ML10+9)
1208 
1209 /* location functions */
1210 #define L_NO_OP 0
1211 
1212 /* random sites */
1213 #define L_LIFT 1
1214 #define L_BALANCESTONE 2
1215 #define L_FIRE 3
1216 #define L_WHIRLWIND 4
1217 #define L_VOIDSTONE 5
1218 #define L_WARNING 6
1219 #define L_ARENA_EXIT 7
1220 #define L_HOUSE_EXIT 8
1221 #define L_SAFE 9
1222 
1223 /* city level shop and guild functions */
1224 /* following are those in CitySiteList */
1225 #define NUMCITYSITES 27
1226 #define CITYSITEBASE 10
1227 #define L_CHARITY 10
1228 #define L_ARMORER 11
1229 #define L_CLUB 12
1230 #define L_GYM 13
1231 #define L_THIEVES_GUILD 14
1232 #define L_COLLEGE 15
1233 #define L_HEALER 16
1234 #define L_CASINO 17
1235 #define L_TAVERN 18
1236 #define L_MERC_GUILD 19
1237 #define L_ALCHEMIST 20
1238 #define L_SORCERORS 21
1239 #define L_CASTLE 22
1240 #define L_ARENA 23
1241 #define L_DPW 24
1242 #define L_LIBRARY 25
1243 #define L_PAWN_SHOP 26
1244 #define L_BANK 27
1245 #define L_CONDO 28
1246 #define L_ORACLE 29
1247 #define L_ORDER 30
1248 #define L_DINER 31
1249 #define L_COMMANDANT 32
1250 #define L_CRAP 33
1251 #define L_TEMPLE 34
1252 #define L_COUNTRYSIDE 35
1253 #define L_BROTHEL 36
1254 /* end of city sites */
1255 
1256 /* random sites */
1257 #define L_JAIL 37
1258 #define L_TEMPLE_WARNING 38
1259 #define L_LAWSTONE 39
1260 #define L_CHAOSTONE 40
1261 
1262 /* final abyss sites ignore levitation*/
1263 #define L_EARTH_STATION 41
1264 #define L_FIRE_STATION 42
1265 #define L_WATER_STATION 43
1266 #define L_AIR_STATION 44
1267 #define L_VOID_STATION 45
1268 #define L_VOID 46
1269 #define L_VOICE1 47
1270 #define L_VOICE2 48
1271 #define L_VOICE3 49
1272 
1273 #define L_SACRIFICESTONE 50
1274 
1275 /* circle hq sites */
1276 #define L_TOME1 51
1277 #define L_TOME2 52
1278 #define L_ENTER_CIRCLE 53
1279 #define L_CIRCLE_LIBRARY 54
1280 
1281 /* other site functions */
1282 #define L_DRUID 55
1283 #define L_ALTAR 56
1284 
1285 #define L_GARDEN 57
1286 #define L_ADEPT 58
1287 #define L_SEWER 59
1288 
1289 #define L_OMEGA 60
1290 #define L_CARTOGRAPHER 61
1291 #define L_STABLES 62
1292 #define L_COMMONS 63
1293 #define L_GRANARY 64
1294 #define L_MAZE 65
1295 #define L_HOVEL 66
1296 #define L_HOUSE 67
1297 #define L_MANSION 68
1298 #define L_OCCUPIED_HOUSE 69
1299 #define L_TACTICAL_EXIT 70
1300 #define L_VAULT 71
1301 #define L_CEMETARY 72
1302 #define L_THRONE 73
1303 #define L_ESCALATOR 74
1304 #define L_ENTER_COURT 75
1305 
1306 #define L_TRIFID 76
1307 #define L_FINAL_ABYSS 77
1308 #define L_RAISE_PORTCULLIS 78
1309 
1310 #define L_MINDSTONE 79
1311 
1312 /* above LEVITATION_AVOIDANCE, no effect if player is levitating */
1313 #define LEVITATION_AVOIDANCE 80
1314 
1315 /* random sites */
1316 #define L_CHAOS 81
1317 #define L_WATER 82
1318 #define L_LAVA 83
1319 #define L_MAGIC_POOL 84
1320 #define L_PORTCULLIS_TRAP 85
1321 #define L_DROP_EVERY_PORTCULLIS 87
1322 #define L_PORTCULLIS 88
1323 
1324 
1325 /* traps */
1326 #define NUMTRAPS 13
1327 #define TRAP_BASE 89
1328 
1329 /* traps */
1330 #define L_TRAP_DART 89
1331 #define L_TRAP_PIT 90
1332 #define L_TRAP_DOOR 91
1333 #define L_TRAP_SNARE 92
1334 #define L_TRAP_BLADE 93
1335 #define L_TRAP_FIRE 94
1336 #define L_TRAP_TELEPORT 95
1337 #define L_TRAP_DISINTEGRATE 96
1338 #define L_TRAP_SLEEP_GAS 97
1339 #define L_TRAP_ACID 98
1340 #define L_TRAP_MANADRAIN 99
1341 #define L_TRAP_ABYSS 100
1342 #define L_TRAP_SIREN 101
1343 
1344 /* more random sites */
1345 #define L_STATUE_WAKE 102
1346 #define L_STATUE_RANDOM 103
1347 
1348 #define L_HEDGE 104
1349 #define L_RUBBLE 105
1350 
1351 #define L_ABYSS 106
1352 
1353 /* player possession slots */
1354 /* slot 0 should not be filled when out of inventory_control() */
1355 
1356 #define O_UP_IN_AIR 0
1357 #define O_READY_HAND 1
1358 #define O_WEAPON_HAND 2
1359 #define O_LEFT_SHOULDER 3
1360 #define O_RIGHT_SHOULDER 4
1361 #define O_BELT1 5
1362 #define O_BELT2 6
1363 #define O_BELT3 7
1364 #define O_SHIELD 8
1365 #define O_ARMOR 9
1366 #define O_BOOTS 10
1367 #define O_CLOAK 11
1368 #define O_RING1 12
1369 #define O_RING2 13
1370 #define O_RING3 14
1371 #define O_RING4 15
1372 
1373 /* typedefs needed by structs */
1374 
1375 #if defined(MSDOS_SUPPORTED_ANTIQUE) || defined(AMIGA)
1376 typedef short Symbol;
1377 #else
1378 typedef int Symbol;
1379 #endif
1380 
1381 
1382 /* structure definitions */
1383 
1384 struct room {
1385   int lighted;
1386   int left,right,top,bottom;
1387   int rsi; /* index into roomname switch */
1388 };
1389 
1390 
1391 
1392 struct spell {
1393   char known;
1394   char id;
1395   char powerdrain;
1396 } ;
1397 
1398 
1399 struct monster {
1400   struct objectlist *possessions;
1401   unsigned char attacked;
1402   int aux1,aux2,x,y,click;
1403   int id,hp,hit,ac,dmg,sense,wakeup,level,speed;
1404   unsigned char sleep,treasure;
1405   long xpv;
1406   int corpseweight,corpsevalue,transformid,startthing;
1407   unsigned char uniqueness;
1408   int talkf,movef,meleef,strikef,specialf;
1409   long status,immunity;
1410   Symbol monchar;
1411   char *monstring,*corpsestr,*meleestr;
1412 };
1413 
1414 
1415 struct monsterlist {
1416   struct monster *m;
1417   struct monsterlist *next;
1418 };
1419 
1420 
1421 
1422 
1423 struct player {
1424   int str,con,dex,agi,iq,pow,maxstr,maxcon,maxdex,maxagi,maxiq,maxpow;
1425   long xp;
1426   int level,hp,maxhp,hit,dmg,absorption,speed,click;
1427   int defense,food,alignment;
1428   long mana,maxmana;
1429   long cash;
1430   int patron,birthday;
1431   char preference;
1432   int sx,sy; /* sanctuary coordinates */
1433   int x,y; /* current player coordinates */
1434   int itemweight,maxweight;
1435   int immunity[NUMIMMUNITIES];
1436   int status[NUMSTATI];
1437   long options;
1438   int rank[NUMRANKS];
1439   long guildxp[NUMRANKS];
1440   char name[64];
1441   char meleestr[64];
1442   struct object *possessions[MAXITEMS];
1443   struct object *pack[MAXPACK];
1444   int packptr;
1445 };
1446 
1447 struct object {
1448   int id,weight,plus,charge,dmg,hit,aux,number,fragility;
1449   long basevalue;
1450   unsigned char known,used;
1451   int blessing;
1452   unsigned char type,uniqueness;
1453   int usef;
1454   unsigned char level;
1455   Symbol objchar;
1456   char *objstr,*truename,*cursestr;
1457 };
1458 
1459 
1460 
1461 struct objectlist {
1462   struct object *thing;
1463   struct objectlist *next;
1464 };
1465 
1466 
1467 
1468 /* terrain locations */
1469 struct terrain {
1470   Symbol base_terrain_type;
1471   Symbol current_terrain_type;
1472   char aux;
1473   char status;
1474 };
1475 
1476 /* dungeon locations */
1477 struct location {
1478   char p_locf; /* function executed when moved on */
1479   unsigned char lstatus; /* seen,stopsrun,lit,secret, */
1480   char roomnumber; /* so room can be named */
1481   Symbol locchar; /* terrain type */
1482   Symbol showchar; /*char instantaneously drawn for site */
1483   int aux; /* signifies various things */
1484   unsigned char buildaux; /* used in constructing level */
1485   struct objectlist *things;
1486   struct monster *creature;
1487  };
1488 
1489 
1490 struct level {
1491   char depth; /* which level is this */
1492   struct level *next; /* pointer to next level in dungeon */
1493 #ifndef SAVE_LEVELS
1494   struct location site[MAXWIDTH][MAXLENGTH]; /* dungeon data */
1495 #else
1496   /* Over 64K worth of data! */
1497   struct location *site[MAXWIDTH]; /* dungeon data */
1498 #endif
1499   char generated; /* has the level been made (visited) yet? */
1500   char numrooms; /* number of rooms on level */
1501   char tunnelled; /* amount of tunnelling done on this level */
1502   struct monsterlist *mlist; /* List of monsters on level */
1503   int environment; /* where kind of level is this? */
1504   int last_visited; /* time player was last on this level */
1505 };
1506 
1507 
1508 /* random typedef's */
1509 
1510 typedef struct monsterlist mltype;
1511 typedef mltype *pml;
1512 
1513 typedef struct monster montype;
1514 typedef montype *pmt;
1515 
1516 typedef struct location loctype;
1517 typedef loctype *plc;
1518 
1519 typedef struct level levtype;
1520 typedef levtype *plv;
1521 
1522 typedef struct object objtype;
1523 typedef objtype *pob;
1524 
1525 typedef struct objectlist oltype;
1526 typedef oltype *pol;
1527 
1528 /* random  function declarations from system libraries */
1529 
1530 #include <stdlib.h>
1531 
1532 /* The assert macro (for ANSI/ISO C).  Hopefully this will always work! */
1533 #include <assert.h>
1534 
1535 #ifdef MSDOS
1536 #include <time.h>
1537 #define getlogin() "pcuser"
1538 #endif
1539 
1540 #undef sign
1541 #undef max
1542 #undef min
1543 #undef abs
1544 /* These must be made to work for both longs and ints */
1545 #define sign(n) (((n) < 0) ? -1 : (((n) > 0) ? 1 : 0))
1546 #define max(a,b) (((a) > (b)) ? (a) : (b))
1547 #define min(a,b) (((a) < (b)) ? (a) : (b))
1548 #define abs(n) (((n) < 0) ? (-(n)) : (n))
1549 
1550 #ifdef NORANDOM
1551 #define RANDFUNCTION rand
1552 #define SRANDFUNCTION srand
1553 #endif
1554 
1555 #ifndef NORANDOM
1556 #define RANDFUNCTION random
1557 #define SRANDFUNCTION srandom
1558 #endif
1559 
1560 
1561 /* WDT: This should be harmless under ANSI C, and will stop
1562  * some errors under bizarre platforms. */
1563 #define pow2(n) (1L << (n))
1564 
1565 /* these bit operations were functions, but are faster as macros... */
1566 
1567 #define loc_statusp(x,y,stat) ((Level->site[x][y].lstatus&(stat))?1:0)
1568 #define lset(x,y,stat) (Level->site[x][y].lstatus |= (stat))
1569 #define lreset(x,y,stat) (Level->site[x][y].lstatus &= ~(stat))
1570 
1571 #define c_statusp(x,y,stat) ((Country[x][y].status&(stat))?1:0)
1572 #define c_set(x,y,stat) (Country[x][y].status |= (stat))
1573 #define c_reset(x,y,stat) (Country[x][y].status &= ~(stat))
1574 
1575 #define m_statusp(m,s) (((m)->status&(s))?1:0)
1576 #define m_status_set(m,s) ((m)->status |= (s))
1577 #define m_status_reset(m,s) ((m)->status &= ~(s))
1578 #define m_immunityp(m,s) (((m)->immunity&pow2(s))?1:0)
1579 
1580 #define gamestatusp(flag) ((GameStatus&(flag))?1:0)
1581 #define setgamestatus(flag) (GameStatus |= (flag))
1582 #define resetgamestatus(flag) (GameStatus &= ~(flag))
1583 
1584 #define optionp(o) ((Player.options&(o))?1:0)
1585 #define optionset(o) (Player.options |= (o))
1586 #define optionreset(o) (Player.options &= ~(o))
1587 
1588 /* systemV for some reason uses string.h instead of strings.h */
1589 /* Also, random and srandom are unlikely to be found on system V... */
1590 
1591 #ifdef STRING
1592 #include <string.h>
1593 #endif
1594 
1595 #ifndef STRING
1596 #include <strings.h>
1597 #endif
1598 
1599 #include <stdio.h>
1600 
1601 #ifndef TRUE
1602 #define TRUE 1
1603 #define FALSE 0
1604 #endif
1605 
1606 #ifdef SAVE_LEVELS
1607 plv msdos_changelevel();
1608 #endif
1609