comparison arogue5/rogue.h @ 63:0ed67132cf10

Import Advanced Rogue 5.8 from the Roguelike Restoration Project (r1490)
author elwin
date Thu, 09 Aug 2012 22:58:48 +0000
parents
children a98834ce7e04
comparison
equal deleted inserted replaced
62:0ef99244acb8 63:0ed67132cf10
1 /*
2 * Rogue definitions and variable declarations
3 *
4 * Advanced Rogue
5 * Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
6 * All rights reserved.
7 *
8 * Based on "Rogue: Exploring the Dungeons of Doom"
9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
10 * All rights reserved.
11 *
12 * See the file LICENSE.TXT for full copyright and licensing information.
13 */
14
15 #define reg register /* register abbr. */
16 #define NOOP(x) (x += 0)
17 #define CCHAR(x) ( (char) (x & A_CHARTEXT) )
18
19 /*
20 * Maximum number of different things
21 */
22
23 #define MAXDAEMONS 10
24 #define MAXFUSES 20
25
26 #define NCOLORS 32
27 #define NSTONES 47
28 #define NWOOD 24
29 #define NMETAL 16
30 #define NSYLLS 159
31
32 #define MAXROOMS 9
33 #define MAXTHINGS 9
34 #define MAXOBJ 9
35 #define MAXSTATS 62 /* max total of all stats at startup */
36 #define MAXPACK 23
37 #define MAXCONTENTS 10
38 #define MAXENCHANT 10 /* max number of enchantments on an item */
39 #define MAXTREAS 15 /* number monsters/treasure in treasure room */
40 #define MAXTRAPS 20
41 #define MAXTRPTRY 8 /* attempts/level allowed for setting traps */
42 #define MAXDOORS 4 /* Maximum doors to a room */
43 #define MAXPRAYERS 15 /* Maximum number of prayers for cleric */
44 #define MAXSPELLS 20 /* Maximum number of spells (for magician) */
45 #define NUMMONST 120 /* Current number of monsters */
46 #define NUMUNIQUE 24 /* number of UNIQUE creatures */
47 #define NLEVMONS 3 /* Number of new monsters per level */
48 #define MAXFOODS 1
49 #define NUMSCORE 20 /* number of entries in score file */
50 #define HARDER 35 /* at this level start making things harder */
51 #define MAXPURCH 4 /* max purchases per trading post visit */
52 #define LINELEN 80 /* characters in a buffer */
53 #define JUG_EMPTY -1 /* signifys that the alchemy jug is empty */
54
55 /* Movement penalties */
56 #define BACKPENALTY 3
57 #define SHOTPENALTY 2 /* In line of sight of missile */
58 #define DOORPENALTY 1 /* Moving out of current room */
59
60 /*
61 * these defines are used in calls to get_item() to signify what
62 * it is we want
63 */
64 #define ALL -1
65 #define WEARABLE -2
66 #define CALLABLE -3
67 #define WIELDABLE -4
68 #define USEABLE -5
69 #define IDENTABLE -6
70 #define REMOVABLE -7
71 #define PROTECTABLE -8
72 #define ZAPPABLE -9
73
74 /*
75 * stuff to do with encumberance
76 */
77 #define NORMENCB 1500 /* normal encumberance */
78 #define F_OKAY 0 /* have plenty of food in stomach */
79 #define F_HUNGRY 1 /* player is hungry */
80 #define F_WEAK 2 /* weak from lack of food */
81 #define F_FAINT 3 /* fainting from lack of food */
82
83 /*
84 * return values for get functions
85 */
86 #define NORM 0 /* normal exit */
87 #define QUIT 1 /* quit option setting */
88 #define MINUS 2 /* back up one option */
89
90 /*
91 * The character types
92 */
93 #define C_FIGHTER 0
94 #define C_MAGICIAN 1
95 #define C_CLERIC 2
96 #define C_THIEF 3
97 #define C_MONSTER 4
98
99 /*
100 * Number of hit points for going up a level
101 */
102 #define HIT_FIGHTER 10
103 #define HIT_MAGICIAN 8
104 #define HIT_CLERIC 8
105 #define HIT_THIEF 6
106
107 /*
108 * values for games end
109 */
110 #define UPDATE -2
111 #define SCOREIT -1
112 #define KILLED 0
113 #define CHICKEN 1
114 #define WINNER 2
115
116 /*
117 * definitions for function step_ok:
118 * MONSTOK indicates it is OK to step on a monster -- it
119 * is only OK when stepping diagonally AROUND a monster
120 */
121 #define MONSTOK 1
122 #define NOMONST 2
123
124 /*
125 * used for ring stuff
126 */
127 #define LEFT_1 0
128 #define LEFT_2 1
129 #define LEFT_3 2
130 #define LEFT_4 3
131 #define RIGHT_1 4
132 #define RIGHT_2 5
133 #define RIGHT_3 6
134 #define RIGHT_4 7
135 #define NUM_FINGERS 8
136
137 /*
138 * used for micellaneous magic (MM) stuff
139 */
140 #define WEAR_BOOTS 0
141 #define WEAR_BRACERS 1
142 #define WEAR_CLOAK 2
143 #define WEAR_GAUNTLET 3
144 #define WEAR_JEWEL 4
145 #define WEAR_NECKLACE 5
146 #define NUM_MM 6
147
148 /*
149 * All the fun defines
150 */
151 #define next(ptr) (*ptr).l_next
152 #define prev(ptr) (*ptr).l_prev
153 #define ldata(ptr) (*ptr).l_data
154 #define inroom(rp, cp) (\
155 (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && (rp)->r_pos.x <= (cp)->x \
156 && (cp)->y <= (rp)->r_pos.y + ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y)
157 #define winat(y, x) (mvwinch(mw, y, x)==' '?mvwinch(stdscr, y, x):winch(mw))
158 #define debug if (wizard) msg
159 #define RN (((seed = seed*11109+13849) & 0x7fff) >> 1)
160 #define unc(cp) (cp).y, (cp).x
161 #define cmov(xy) move((xy).y, (xy).x)
162 #define DISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
163 #define OBJPTR(what) (struct object *)((*what).l_data)
164 #define THINGPTR(what) (struct thing *)((*what).l_data)
165 #define DOORPTR(what) (coord *)((*what).l_data)
166 #define when break;case
167 #define otherwise break;default
168 #define until(expr) while(!(expr))
169 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
170 #define draw(window) wrefresh(window)
171 #define hero player.t_pos
172 #define pstats player.t_stats
173 #define max_stats player.maxstats
174 #define pack player.t_pack
175 #define attach(a, b) _attach(&a, b)
176 #define detach(a, b) _detach(&a, b)
177 #define o_free_list(a) _o_free_list(&a)
178 #define t_free_list(a) _t_free_list(&a)
179 #undef max
180 #undef min
181 #define max(a, b) ((a) > (b) ? (a) : (b))
182 #define min(a, b) ((a) < (b) ? (a) : (b))
183 #define on(thing, flag) \
184 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) != 0)
185 #define off(thing, flag) \
186 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) == 0)
187 #define turn_on(thing, flag) \
188 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & ~FLAGMASK))
189 #define turn_off(thing, flag) \
190 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~flag)
191
192 #undef CTRL
193 #define CTRL(ch) (ch & 037)
194
195 #define ALLOC(x) calloc((unsigned int) x,1)
196 #define FREE(x) free((char *) x)
197 #define EQSTR(a, b, c) (strncmp(a, b, c) == 0)
198 #define EQUAL(a, b) (strcmp(a, b) == 0)
199 #define GOLDCALC (rnd(50 + 10 * level) + 2)
200 #define ISRING(h, r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r)
201 #define ISWEARING(r) (ISRING(LEFT_1, r) || ISRING(LEFT_2, r) ||\
202 ISRING(LEFT_3, r) || ISRING(LEFT_4, r) ||\
203 ISRING(RIGHT_1, r) || ISRING(RIGHT_2, r) ||\
204 ISRING(RIGHT_3, r) || ISRING(RIGHT_4, r))
205 #define newgrp() ++group
206 #define o_charges o_ac
207 #define ISMULT(type) (type == FOOD)
208 #define isrock(ch) ((ch == WALL) || (ch == '-') || (ch == '|'))
209 #define invisible(monst) \
210 (((on(*monst, ISINVIS) || \
211 (on(*monst, ISSHADOW) && rnd(100) < 90)) && \
212 off(player, CANSEE)) || \
213 (on(*monst, CANSURPRISE) && !ISWEARING(R_ALERT)))
214 #define is_stealth(tp) \
215 (rnd(25) < (tp)->t_stats.s_dext || (tp == &player && ISWEARING(R_STEALTH)))
216
217 #define has_light(rp) (((rp)->r_flags & HASFIRE) || ISWEARING(R_LIGHT))
218 #define mi_wght mi_worth
219
220 /*
221 * Ways to die
222 */
223 #define D_PETRIFY -1
224 #define D_ARROW -2
225 #define D_DART -3
226 #define D_POISON -4
227 #define D_BOLT -5
228 #define D_SUFFOCATION -6
229 #define D_POTION -7
230 #define D_INFESTATION -8
231 #define D_DROWN -9
232 #define D_ROT -10
233 #define D_CONSTITUTION -11
234 #define D_STRENGTH -12
235 #define D_SIGNAL -13
236 #define D_CHOKE -14
237 #define D_STRANGLE -15
238 #define D_FALL -16
239 #define D_RELIC -17
240 #define DEATHNUM 17 /* number of ways to die */
241
242 /*
243 * Things that appear on the screens
244 */
245 #define WALL ' '
246 #define PASSAGE '#'
247 #define DOOR '+'
248 #define FLOOR '.'
249 #define VPLAYER '@'
250 #define IPLAYER '_'
251 #define POST '^'
252 #define TRAPDOOR '>'
253 #define ARROWTRAP '{'
254 #define SLEEPTRAP '$'
255 #define BEARTRAP '}'
256 #define TELTRAP '~'
257 #define DARTTRAP '`'
258 #define POOL '"'
259 #define MAZETRAP '\''
260 #define SECRETDOOR '&'
261 #define STAIRS '%'
262 #define GOLD '*'
263 #define POTION '!'
264 #define SCROLL '?'
265 #define MAGIC '$'
266 #define BMAGIC '>' /* Blessed magic */
267 #define CMAGIC '<' /* Cursed magic */
268 #define FOOD ':'
269 #define WEAPON ')'
270 #define MISSILE '*' /* Magic Missile */
271 #define ARMOR ']'
272 #define MM ';'
273 #define RELIC ','
274 #define RING '='
275 #define STICK '/'
276 #define FOREST '\\'
277
278 /*
279 * Various constants
280 */
281 #define PASSWD "SihQX7.LYSmbo"
282 #define BEARTIME 3
283 #define SLEEPTIME 4
284 #define FREEZETIME 6
285 #define PAINTIME (roll(1, 6))
286 #define HEALTIME 30
287 #define CHILLTIME (roll(20, 4))
288 #define SMELLTIME 20
289 #define STONETIME 8
290 #define HASTETIME 6
291 #define SICKTIME 10
292 #define STPOS 0
293 #define WANDERTIME (max(5, HARDER-rnd(vlevel)))
294 #define BEFORE 1
295 #define AFTER 2
296 #define HUHDURATION 20
297 #define SEEDURATION 850
298 #define CLRDURATION 15
299 #define GONETIME 200
300 #define FLYTIME 300
301 #define DUSTTIME (20+roll(1,10))
302 #define PHASEDURATION 300
303 #define HUNGERTIME 1300
304 #define MORETIME 150
305 #define STINKTIME 6
306 #define STOMACHSIZE 2000
307 #define ESCAPE 27
308 #define BOLT_LENGTH 10
309 #define MARKLEN 20
310 #define DAYLENGTH 400
311 #define ALCHEMYTIME (400+rnd(100))
312
313 /*
314 * Save against things
315 */
316 #define VS_POISON 00
317 #define VS_PARALYZATION 00
318 #define VS_DEATH 00
319 #define VS_PETRIFICATION 01
320 #define VS_WAND 02
321 #define VS_BREATH 03
322 #define VS_MAGIC 04
323
324 /*
325 * attributes for treasures in dungeon
326 */
327 #define ISCURSED 01
328 #define ISKNOW 02
329 #define ISPOST 04 /* object is in a trading post */
330 #define ISMETAL 010
331 #define ISPROT 020 /* object is protected */
332 #define ISBLESSED 040
333 #define ISMISL 020000
334 #define ISMANY 040000
335 /*
336 * Various flag bits
337 */
338 #define ISDARK 01
339 #define ISGONE 02
340 #define ISTREAS 04
341 #define ISFOUND 010
342 #define ISTHIEFSET 020
343 #define FORCEDARK 040
344 /*
345 * 1st set of creature flags (this might include player)
346 */
347 #define ISBLIND 0x00000001
348 #define ISINWALL 0x00000002
349 #define ISRUN 0x00000004
350 #define ISFLEE 0x00000008
351 #define ISINVIS 0x00000010
352 #define ISMEAN 0x00000020
353 #define ISGREED 0x00000040
354 #define CANSHOOT 0x00000080
355 #define ISHELD 0x00000100
356 #define ISHUH 0x00000200
357 #define ISREGEN 0x00000400
358 #define CANHUH 0x00000800
359 #define CANSEE 0x00001000
360 #define HASFIRE 0x00002000
361 #define ISSLOW 0x00004000
362 #define ISHASTE 0x00008000
363 #define ISCLEAR 0x00010000
364 #define CANINWALL 0x00020000
365 #define ISDISGUISE 0x00040000
366 #define CANBLINK 0x00080000
367 #define CANSNORE 0x00100000
368 #define HALFDAMAGE 0x00200000
369 #define CANSUCK 0x00400000
370 #define CANRUST 0x00800000
371 #define CANPOISON 0x01000000
372 #define CANDRAIN 0x02000000
373 #define ISUNIQUE 0x04000000
374 #define STEALGOLD 0x08000000
375 /*
376 * Second set of flags
377 */
378 #define STEALMAGIC 0x10000001
379 #define CANDISEASE 0x10000002
380 #define HASDISEASE 0x10000004
381 #define CANSUFFOCATE 0x10000008
382 #define DIDSUFFOCATE 0x10000010
383 #define BOLTDIVIDE 0x10000020
384 #define BLOWDIVIDE 0x10000040
385 #define NOCOLD 0x10000080
386 #define TOUCHFEAR 0x10000100
387 #define BMAGICHIT 0x10000200
388 #define NOFIRE 0x10000400
389 #define NOBOLT 0x10000800
390 #define CARRYGOLD 0x10001000
391 #define CANITCH 0x10002000
392 #define HASITCH 0x10004000
393 #define DIDDRAIN 0x10008000
394 #define WASTURNED 0x10010000
395 #define CANSELL 0x10020000
396 #define CANBLIND 0x10040000
397 #define NOACID 0x10080000
398 #define NOSLOW 0x10100000
399 #define NOFEAR 0x10200000
400 #define NOSLEEP 0x10400000
401 #define NOPARALYZE 0x10800000
402 #define NOGAS 0x11000000
403 #define CANMISSILE 0x12000000
404 #define CMAGICHIT 0x14000000
405 #define CANPAIN 0x18000000
406
407 /*
408 * Third set of flags
409 */
410 #define CANSLOW 0x20000001
411 #define CANTUNNEL 0x20000002
412 #define TAKEWISDOM 0x20000004
413 #define NOMETAL 0x20000008
414 #define MAGICHIT 0x20000010
415 #define CANINFEST 0x20000020
416 #define HASINFEST 0x20000040
417 #define NOMOVE 0x20000080
418 #define CANSHRIEK 0x20000100
419 #define CANDRAW 0x20000200
420 #define CANSMELL 0x20000400
421 #define CANPARALYZE 0x20000800
422 #define CANROT 0x20001000
423 #define ISSCAVENGE 0x20002000
424 #define DOROT 0x20004000
425 #define CANSTINK 0x20008000
426 #define HASSTINK 0x20010000
427 #define ISSHADOW 0x20020000
428 #define CANCHILL 0x20040000
429 #define CANHUG 0x20080000
430 #define CANSURPRISE 0x20100000
431 #define CANFRIGHTEN 0x20200000
432 #define CANSUMMON 0x20400000
433 #define TOUCHSTONE 0x20800000
434 #define LOOKSTONE 0x21000000
435 #define CANHOLD 0x22000000
436 #define DIDHOLD 0x24000000
437 #define DOUBLEDRAIN 0x28000000
438
439 /*
440 * Fourth set of flags
441 */
442 #define CANBRANDOM 0x30000001 /* Types of breath */
443 #define CANBACID 0x30000002 /* acid */
444 #define CANBFIRE 0x30000004 /* Fire */
445 #define CANBCGAS 0x30000008 /* confusion gas */
446 #define CANBBOLT 0x30000010 /* lightning bolt */
447 #define CANBGAS 0x30000020 /* clorine gas */
448 #define CANBICE 0x30000040 /* ice */
449 #define CANBFGAS 0x30000080 /* Fear gas */
450 #define CANBPGAS 0x30000100 /* Paralyze gas */
451 #define CANBSGAS 0x30000200 /* Sleeping gas */
452 #define CANBSLGAS 0x30000400 /* Slow gas */
453 #define CANBREATHE 0x300007ff /* Can it breathe at all? */
454 /*
455 * Fifth set of flags
456 */
457 #define ISUNDEAD 0x40000001
458 #define CANSONIC 0x40000002
459 #define TURNABLE 0x40000004
460 #define TAKEINTEL 0x40000008
461 #define NOSTAB 0x40000010
462 #define CANDISSOLVE 0x40000020
463 #define ISFLY 0x40000040 /* creature can fly */
464 #define CANTELEPORT 0x40000080 /* creature can teleport */
465 #define CANEXPLODE 0x40000100 /* creature explodes when hit */
466 #define CANDANCE 0x40000200 /* creature can make hero "dance" */
467 #define ISDANCE 0x40000400 /* creature (hero) is dancing */
468 #define CARRYFOOD 0x40000800
469 #define CARRYSCROLL 0x40001000
470 #define CARRYPOTION 0x40002000
471 #define CARRYRING 0x40004000
472 #define CARRYSTICK 0x40008000
473 #define CARRYMISC 0x40010000
474 #define CARRYDAGGER 0x40020000 /* Dagger of Musty */
475 #define CARRYCLOAK 0x40040000 /* Cloak of Emori */
476 #define CARRYANKH 0x40080000 /* Ankh of Heil */
477 #define CARRYSTAFF 0x40100000 /* Staff of Ming */
478 #define CARRYWAND 0x40200000 /* Wand of Orcus */
479 #define CARRYROD 0x40400000 /* Rod of Asmodeus */
480 #define CARRYAMULET 0x40800000 /* Amulet of Yendor */
481 #define CARRYMANDOLIN 0x41000000 /* Mandolin of Brian */
482 #define MISSEDDISP 0x42000000 /* Missed Cloak of Displacement */
483 #define CANBSTAB 0x44000000 /* Can backstab */
484
485
486 #define CARRYHORN 0x50000001 /* Horn of Geryon */
487 #define CARRYMSTAR 0x50000002 /* Morning Star of Hruggek */
488 #define CARRYFLAIL 0x50000004 /* Flail of Yeenoghu */
489 #define CARRYWEAPON 0x50000008 /* A generic weapon */
490 #define CANAGE 0x50000010 /* can age you */
491
492 #define ISREADY 0x60000001
493 #define ISDEAD 0x60000002
494 #define ISELSEWHERE 0x60000004
495
496 /* Masks for choosing the right flag */
497 #define FLAGMASK 0xf0000000
498 #define FLAGINDEX 0x0000000f
499 #define FLAGSHIFT 28
500 #define MAXFLAGS 25 /* max initial flags per creature */
501
502 /*
503 * Mask for cancelling special abilities
504 * The flags listed here will be the ones left on after the
505 * cancellation takes place
506 */
507 #define CANC0MASK ( ISBLIND | ISINWALL | ISRUN | \
508 ISFLEE | ISMEAN | ISGREED | \
509 CANSHOOT | ISHELD | ISHUH | \
510 ISSLOW | ISHASTE | ISCLEAR | \
511 ISUNIQUE )
512 #define CANC1MASK ( HASDISEASE | DIDSUFFOCATE | CARRYGOLD | \
513 HASITCH | CANSELL | DIDDRAIN | \
514 WASTURNED )
515 #define CANC2MASK ( HASINFEST | NOMOVE | ISSCAVENGE | \
516 DOROT | HASSTINK | DIDHOLD )
517 #define CANC3MASK ( CANBREATHE )
518 #define CANC4MASK ( ISUNDEAD | CANSONIC | NOSTAB | \
519 ISFLY | CARRYFOOD | CANEXPLODE | \
520 ISDANCE | CARRYSCROLL | CARRYPOTION | \
521 CARRYRING | CARRYSTICK | CARRYMISC | \
522 CARRYDAGGER | CARRYCLOAK | CARRYANKH | \
523 CARRYSTAFF | CARRYWAND | CARRYROD | \
524 CARRYAMULET | CARRYMANDOLIN )
525 #define CANC5MASK ( CARRYHORN | CARRYMSTAR | CARRYFLAIL )
526
527 /* types of things */
528 #define TYP_POTION 0
529 #define TYP_SCROLL 1
530 #define TYP_FOOD 2
531 #define TYP_WEAPON 3
532 #define TYP_ARMOR 4
533 #define TYP_RING 5
534 #define TYP_STICK 6
535 #define TYP_MM 7
536 #define TYP_RELIC 8
537 #define NUMTHINGS 9
538 /*
539 * Potion types
540 */
541 #define P_CLEAR 0
542 #define P_ABIL 1
543 #define P_SEEINVIS 2
544 #define P_HEALING 3
545 #define P_MFIND 4
546 #define P_TFIND 5
547 #define P_RAISE 6
548 #define P_HASTE 7
549 #define P_RESTORE 8
550 #define P_PHASE 9
551 #define P_INVIS 10
552 #define P_FLY 11
553 #define MAXPOTIONS 12
554 /*
555 * Scroll types
556 */
557 #define S_CONFUSE 0
558 #define S_MAP 1
559 #define S_LIGHT 2
560 #define S_HOLD 3
561 #define S_SLEEP 4
562 #define S_ALLENCH 5
563 #define S_IDENT 6
564 #define S_SCARE 7
565 #define S_GFIND 8
566 #define S_TELEP 9
567 #define S_CREATE 10
568 #define S_REMOVE 11
569 #define S_PETRIFY 12
570 #define S_GENOCIDE 13
571 #define S_CURING 14
572 #define S_MAKEIT 15
573 #define S_PROTECT 16
574 #define MAXSCROLLS 17
575
576 /*
577 * Weapon types
578 */
579 #define MACE 0 /* mace */
580 #define SWORD 1 /* long sword */
581 #define BOW 2 /* short bow */
582 #define ARROW 3 /* arrow */
583 #define DAGGER 4 /* dagger */
584 #define ROCK 5 /* rocks */
585 #define TWOSWORD 6 /* two-handed sword */
586 #define SLING 7 /* sling */
587 #define DART 8 /* darts */
588 #define CROSSBOW 9 /* crossbow */
589 #define BOLT 10 /* crossbow bolt */
590 #define SPEAR 11 /* spear */
591 #define TRIDENT 12 /* trident */
592 #define SPETUM 13 /* spetum */
593 #define BARDICHE 14 /* bardiche */
594 #define PIKE 15 /* pike */
595 #define BASWORD 16 /* bastard sword */
596 #define HALBERD 17 /* halberd */
597 #define BATTLEAXE 18 /* battle axe */
598 #define MAXWEAPONS 19 /* types of weapons */
599 #define NONE 100 /* no weapon */
600
601 /*
602 * Armor types
603 */
604 #define LEATHER 0
605 #define RING_MAIL 1
606 #define STUDDED_LEATHER 2
607 #define SCALE_MAIL 3
608 #define PADDED_ARMOR 4
609 #define CHAIN_MAIL 5
610 #define SPLINT_MAIL 6
611 #define BANDED_MAIL 7
612 #define PLATE_MAIL 8
613 #define PLATE_ARMOR 9
614 #define MAXARMORS 10
615
616 /*
617 * Ring types
618 */
619 #define R_PROTECT 0
620 #define R_ADDSTR 1
621 #define R_SUSABILITY 2
622 #define R_SEARCH 3
623 #define R_SEEINVIS 4
624 #define R_ALERT 5
625 #define R_AGGR 6
626 #define R_ADDHIT 7
627 #define R_ADDDAM 8
628 #define R_REGEN 9
629 #define R_DIGEST 10
630 #define R_TELEPORT 11
631 #define R_STEALTH 12
632 #define R_ADDINTEL 13
633 #define R_ADDWISDOM 14
634 #define R_HEALTH 15
635 #define R_HEAVY 16
636 #define R_LIGHT 17
637 #define R_DELUSION 18
638 #define R_FEAR 19
639 #define R_HEROISM 20
640 #define R_FIRE 21
641 #define R_WARMTH 22
642 #define R_VAMPREGEN 23
643 #define MAXRINGS 24
644
645 /*
646 * Rod/Wand/Staff types
647 */
648
649 #define WS_LIGHT 0
650 #define WS_HIT 1
651 #define WS_ELECT 2
652 #define WS_FIRE 3
653 #define WS_COLD 4
654 #define WS_POLYMORPH 5
655 #define WS_MISSILE 6
656 #define WS_SLOW_M 7
657 #define WS_DRAIN 8
658 #define WS_CHARGE 9
659 #define WS_TELMON 10
660 #define WS_CANCEL 11
661 #define WS_CONFMON 12
662 #define WS_DISINTEGRATE 13
663 #define WS_PETRIFY 14
664 #define WS_PARALYZE 15
665 #define WS_MDEG 16
666 #define WS_CURING 17
667 #define WS_WONDER 18
668 #define WS_FEAR 19
669 #define MAXSTICKS 20
670
671 /*
672 * miscellaneous magic items
673 */
674 #define MM_JUG 0
675 #define MM_BEAKER 1
676 #define MM_BOOK 2
677 #define MM_ELF_BOOTS 3
678 #define MM_BRACERS 4
679 #define MM_OPEN 5
680 #define MM_HUNGER 6
681 #define MM_DISP 7
682 #define MM_PROTECT 8
683 #define MM_DRUMS 9
684 #define MM_DISAPPEAR 10
685 #define MM_CHOKE 11
686 #define MM_G_DEXTERITY 12
687 #define MM_G_OGRE 13
688 #define MM_JEWEL 14
689 #define MM_KEOGHTOM 15
690 #define MM_R_POWERLESS 16
691 #define MM_FUMBLE 17
692 #define MM_ADAPTION 18
693 #define MM_STRANGLE 19
694 #define MM_DANCE 20
695 #define MM_SKILLS 21
696 #define MAXMM 22
697
698 /*
699 * Relic types
700 */
701 #define MUSTY_DAGGER 0
702 #define EMORI_CLOAK 1
703 #define HEIL_ANKH 2
704 #define MING_STAFF 3
705 #define ORCUS_WAND 4
706 #define ASMO_ROD 5
707 #define YENDOR_AMULET 6
708 #define BRIAN_MANDOLIN 7
709 #define GERYON_HORN 8
710 #define HRUGGEK_MSTAR 9
711 #define YEENOGHU_FLAIL 10
712 #define MAXRELIC 11
713
714
715 #define LEVEL 600
716 #define vlevel max(level, turns/LEVEL + 1)
717 /*
718 * Now we define the structures and types
719 */
720
721 struct delayed_action {
722 int d_type;
723 int (*d_func)();
724 int d_arg;
725 int d_time;
726 };
727
728 /*
729 * level types
730 */
731 typedef enum {
732 NORMLEV, /* normal level */
733 POSTLEV, /* trading post level */
734 MAZELEV, /* maze level */
735 OUTSIDE /* outside level */
736 } LEVTYPE;
737
738 /*
739 * Help list
740 */
741
742 struct h_list {
743 char h_ch;
744 char *h_desc;
745 };
746
747 /*
748 * Coordinate data type
749 */
750 typedef struct {
751 int x;
752 int y;
753 } coord;
754
755 /*
756 * structure for the ways to die
757 */
758 struct death_type {
759 int reason;
760 char *name;
761 };
762
763
764 /*
765 * Linked list data type
766 */
767 struct linked_list {
768 struct linked_list *l_next;
769 struct linked_list *l_prev;
770 char *l_data; /* Various structure pointers */
771 };
772
773 /*
774 * Stuff about magic items
775 */
776
777 struct magic_item {
778 char *mi_name;
779 int mi_prob;
780 int mi_worth;
781 int mi_curse;
782 int mi_bless;
783 };
784
785 /*
786 * Room structure
787 */
788 struct room {
789 coord r_pos; /* Upper left corner */
790 coord r_max; /* Size of room */
791 long r_flags; /* Info about the room */
792 struct linked_list *r_fires; /* List of fire creatures in room */
793 struct linked_list *r_exit; /* Linked list of exits */
794 };
795
796 /*
797 * Array of all traps on this level
798 */
799
800 struct trap {
801 char tr_type; /* What kind of trap */
802 char tr_show; /* Where disguised trap looks like */
803 coord tr_pos; /* Where trap is */
804 long tr_flags; /* Info about trap (i.e. ISFOUND) */
805 };
806
807 /*
808 * Structure describing a fighting being
809 */
810 struct stats {
811 short s_str; /* Strength */
812 short s_intel; /* Intelligence */
813 short s_wisdom; /* Wisdom */
814 short s_dext; /* Dexterity */
815 short s_const; /* Constitution */
816 short s_charisma; /* Charisma */
817 unsigned long s_exp; /* Experience */
818 int s_lvl; /* Level of mastery */
819 int s_arm; /* Armor class */
820 int s_hpt; /* Hit points */
821 int s_pack; /* current weight of his pack */
822 int s_carry; /* max weight he can carry */
823 char s_dmg[30]; /* String describing damage done */
824 };
825
826 /*
827 * Structure describing a fighting being (monster at initialization)
828 */
829 struct mstats {
830 short s_str; /* Strength */
831 unsigned long s_exp; /* Experience */
832 int s_lvl; /* Level of mastery */
833 int s_arm; /* Armor class */
834 char *s_hpt; /* Hit points */
835 char *s_dmg; /* String describing damage done */
836 };
837
838 /*
839 * Structure for monsters and player
840 */
841 struct thing {
842 bool t_turn; /* If slowed, is it a turn to move */
843 bool t_wasshot; /* Was character shot last round? */
844 char t_type; /* What it is */
845 char t_disguise; /* What mimic looks like */
846 char t_oldch; /* Character that was where it was */
847 short t_ctype; /* Character type */
848 short t_index; /* Index into monster table */
849 short t_no_move; /* How long the thing can't move */
850 short t_quiet; /* used in healing */
851 coord *t_doorgoal; /* What door are we heading to? */
852 coord t_pos; /* Position */
853 coord t_oldpos; /* Last position */
854 coord *t_dest; /* Where it is running to */
855 unsigned long t_flags[16]; /* State word */
856 struct linked_list *t_pack; /* What the thing is carrying */
857 struct stats t_stats; /* Physical description */
858 struct stats maxstats; /* maximum(or initial) stats */
859 int t_reserved;
860 int t_reserved2;
861 int t_reserved3;
862 };
863
864 /*
865 * Array containing information on all the various types of monsters
866 */
867 struct monster {
868 const char *m_name; /* What to call the monster */
869 const short m_carry; /* Probability of carrying something */
870 bool m_normal; /* Does monster exist? */
871 bool m_wander; /* Does monster wander? */
872 const char m_appear; /* What does monster look like? */
873 const char *m_intel; /* Intelligence range */
874 const long m_flags[MAXFLAGS]; /* Things about the monster */
875 const char *m_typesum; /* type of creature can he summon */
876 short m_numsum; /* how many creatures can he summon */
877 const short m_add_exp; /* Added experience per hit point */
878 const struct mstats m_stats; /* Initial stats */
879 };
880
881 /*
882 * Structure for a thing that the rogue can carry
883 */
884
885 struct object {
886 int o_type; /* What kind of object it is */
887 coord o_pos; /* Where it lives on the screen */
888 char *o_text; /* What it says if you read it */
889 char o_launch; /* What you need to launch it */
890 char o_damage[8]; /* Damage if used like sword */
891 char o_hurldmg[8]; /* Damage if thrown */
892 struct linked_list *contents; /* contents of this object */
893 int o_count; /* Count for plural objects */
894 int o_which; /* Which object of a type it is */
895 int o_hplus; /* Plusses to hit */
896 int o_dplus; /* Plusses to damage */
897 int o_ac; /* Armor class */
898 long o_flags; /* Information about objects */
899 int o_group; /* Group number for this object */
900 int o_weight; /* weight of this object */
901 char o_mark[MARKLEN]; /* Mark the specific object */
902 };
903 /*
904 * weapon structure
905 */
906 struct init_weps {
907 char *w_name; /* name of weapon */
908 char *w_dam; /* hit damage */
909 char *w_hrl; /* hurl damage */
910 char w_launch; /* need to launch it */
911 int w_flags; /* flags */
912 int w_wght; /* weight of weapon */
913 int w_worth; /* worth of this weapon */
914 };
915
916 /*
917 * armor structure
918 */
919 struct init_armor {
920 char *a_name; /* name of armor */
921 int a_prob; /* chance of getting armor */
922 int a_class; /* normal armor class */
923 int a_worth; /* worth of armor */
924 int a_wght; /* weight of armor */
925 };
926
927 struct matrix {
928 int base; /* Base to-hit value (AC 10) */
929 int max_lvl; /* Maximum level for changing value */
930 int factor; /* Amount base changes each time */
931 int offset; /* What to offset level */
932 int range; /* Range of levels for each offset */
933 };
934
935 struct spells {
936 short s_which; /* which scroll or potion */
937 short s_cost; /* cost of casting spell */
938 short s_type; /* scroll or potion */
939 int s_flag; /* is the spell blessed/cursed? */
940 };
941
942 struct linked_list *find_mons(), *find_obj(), *get_item(), *new_item(),
943 *new_thing(), *wake_monster(), *get_hurl(),
944 *spec_item(), *creat_item();
945 struct object *wield_weap();
946 struct room *roomin();
947 struct trap *trap_at();
948
949 char *getenv(), *tr_name(), *new(),
950 *vowelstr(), *inv_name(),
951 *ctime(), *num(), *ring_num(), *misc_num(), *blesscurse(), *typ_name(),
952 *weap_name(), *misc_name();
953 coord *rndmove(), *can_shoot(), *fallpos();
954 short randmonster(), id_monst();
955 void quit(int sig), tstp(int sig), auto_save(int sig), bugkill(int sig), endit(int sig);
956 int rnd(), wghtchk(), nohaste(), res_strength(),
957 doctor(), runners(), swander(), unconfuse(), unsee(), fumble(),
958 unclrhead(), unphase(), noslow(), rollwand(), stomach(), sight(),
959 unstink(), suffocate(), cure_disease(), un_itch(), shoot_bolt(),
960 appear(), dust_appear(), unchoke(), alchemy(), trap_look(), strangle(),
961 ring_teleport(), ring_search(), grab();
962 bool blue_light(), can_blink(), creat_mons(), add_pack(),
963 straight_shot(), maze_view(), lit_room(), getdelta(), save_file(),
964 save_game();
965 long check_level();
966 void byebye(int sig), genmonsters();
967 int land(), undance();
968 #ifdef CHECKTIME
969 int checkout();
970 #endif
971 extern char *md_getusername();
972 extern char *md_gethomedir();
973 extern void md_flushinp();
974 extern char *md_getshell();
975 extern char *md_gethostname();
976 extern void md_dobinaryio();
977 extern char *md_getpass();
978 extern char *md_crypt();
979 extern char *md_getroguedir();
980 extern void md_init();
981
982 /*
983 * Now all the global variables
984 */
985
986 extern char outstring[]; /* string for use with msg */
987 extern struct trap traps[];
988 extern struct h_list helpstr[];
989 extern struct h_list wiz_help[];
990 extern struct room rooms[]; /* One for each room -- A level */
991 extern struct room *oldrp; /* Roomin(&oldpos) */
992 extern struct linked_list *mlist; /* List of monsters on the level */
993 extern struct linked_list *tlist; /* list of monsters fallen down traps */
994 extern struct death_type deaths[]; /* all the ways to die */
995 extern struct thing player; /* The rogue */
996 extern struct monster monsters[]; /* The initial monster states */
997 extern struct linked_list *lvl_obj; /* List of objects on this level */
998 extern struct linked_list *monst_dead; /* Indicates monster that got killed */
999 extern struct object *cur_weapon; /* Which weapon he is weilding */
1000 extern struct object *cur_armor; /* What a well dresssed rogue wears */
1001 extern struct object *cur_ring[]; /* Which rings are being worn */
1002 extern struct object *cur_misc[]; /* which MM's are in use */
1003 extern struct magic_item things[]; /* Chances for each type of item */
1004 extern struct magic_item s_magic[]; /* Names and chances for scrolls */
1005 extern struct magic_item p_magic[]; /* Names and chances for potions */
1006 extern struct magic_item r_magic[]; /* Names and chances for rings */
1007 extern struct magic_item ws_magic[]; /* Names and chances for sticks */
1008 extern struct magic_item m_magic[]; /* Names and chances for MM */
1009 extern struct magic_item rel_magic[]; /* Names and chances for relics */
1010 extern struct spells magic_spells[]; /* spells for magic users */
1011 extern struct spells cleric_spells[]; /* spells for magic users */
1012 extern char *cnames[][11]; /* Character level names */
1013 extern char curpurch[]; /* name of item ready to buy */
1014 extern char PLAYER; /* what the player looks like */
1015 extern char nfloors; /* Number of floors in this dungeon */
1016 extern int char_type; /* what type of character is player */
1017 extern int foodlev; /* how fast he eats food */
1018 extern int level; /* What level rogue is on */
1019 extern int trader; /* number of purchases */
1020 extern int curprice; /* price of an item */
1021 extern int purse; /* How much gold the rogue has */
1022 extern int mpos; /* Where cursor is on top line */
1023 extern int ntraps; /* Number of traps on this level */
1024 extern int no_move; /* Number of turns held in place */
1025 extern int no_command; /* Number of turns asleep */
1026 extern int inpack; /* Number of things in pack */
1027 extern int total; /* Total dynamic memory bytes */
1028 extern int lastscore; /* Score before this turn */
1029 extern int no_food; /* Number of levels without food */
1030 extern int foods_this_level; /* num of foods this level */
1031 extern int seed; /* Random number seed */
1032 extern int count; /* Number of times to repeat command */
1033 extern int dnum; /* Dungeon number */
1034 extern int max_level; /* Deepest player has gone */
1035 extern int cur_max; /* Deepest player has gone currently */
1036 extern int food_left; /* Amount of food in hero's stomach */
1037 extern int group; /* Current group number */
1038 extern int hungry_state; /* How hungry is he */
1039 extern int infest_dam; /* Damage from parasites */
1040 extern int lost_str; /* Amount of strength lost */
1041 extern int lost_dext; /* amount of dexterity lost */
1042 extern int hold_count; /* Number of monsters holding player */
1043 extern int trap_tries; /* Number of attempts to set traps */
1044 extern int pray_time; /* Number of prayer points/exp level */
1045 extern int spell_power; /* Spell power left at this level */
1046 extern int turns; /* Number of turns player has taken */
1047 extern int quest_item; /* Item hero is looking for */
1048 extern int cur_relic[]; /* Current relics */
1049 extern char take; /* Thing the rogue is taking */
1050 extern char prbuf[]; /* Buffer for sprintfs */
1051 extern char outbuf[]; /* Output buffer for stdout */
1052 extern char runch; /* Direction player is running */
1053 extern char *s_names[]; /* Names of the scrolls */
1054 extern char *p_colors[]; /* Colors of the potions */
1055 extern char *r_stones[]; /* Stone settings of the rings */
1056 extern struct init_weps weaps[]; /* weapons and attributes */
1057 extern struct init_armor armors[]; /* armors and attributes */
1058 extern char *ws_made[]; /* What sticks are made of */
1059 extern char *release; /* Release number of rogue */
1060 extern char whoami[]; /* Name of player */
1061 extern char fruit[]; /* Favorite fruit */
1062 extern char huh[LINELEN]; /* The last message printed */
1063 extern char *s_guess[]; /* Players guess at what scroll is */
1064 extern char *p_guess[]; /* Players guess at what potion is */
1065 extern char *r_guess[]; /* Players guess at what ring is */
1066 extern char *ws_guess[]; /* Players guess at what wand is */
1067 extern char *m_guess[]; /* Players guess at what MM is */
1068 extern char *ws_type[]; /* Is it a wand or a staff */
1069 extern char file_name[]; /* Save file name */
1070 extern char score_file[]; /* Score file name */
1071 extern char home[]; /* User's home directory */
1072 extern WINDOW *cw; /* Window that the player sees */
1073 extern WINDOW *hw; /* Used for the help command */
1074 extern WINDOW *mw; /* Used to store mosnters */
1075 extern WINDOW *msgw; /* Used to display messages */
1076 extern bool pool_teleport; /* just teleported from a pool */
1077 extern bool inwhgt; /* true if from wghtchk() */
1078 extern bool running; /* True if player is running */
1079 extern bool playing; /* True until he quits */
1080 extern bool wizard; /* True if allows wizard commands */
1081 extern bool after; /* True if we want after daemons */
1082 extern bool notify; /* True if player wants to know */
1083 extern bool fight_flush; /* True if toilet input */
1084 extern bool terse; /* True if we should be short */
1085 extern bool auto_pickup; /* pick up things automatically? */
1086 extern bool door_stop; /* Stop running when we pass a door */
1087 extern bool jump; /* Show running as series of jumps */
1088 extern bool slow_invent; /* Inventory one line at a time */
1089 extern bool firstmove; /* First move after setting door_stop */
1090 extern bool waswizard; /* Was a wizard sometime */
1091 extern bool askme; /* Ask about unidentified things */
1092 extern bool s_know[]; /* Does he know what a scroll does */
1093 extern bool p_know[]; /* Does he know what a potion does */
1094 extern bool r_know[]; /* Does he know what a ring does */
1095 extern bool ws_know[]; /* Does he know what a stick does */
1096 extern bool m_know[]; /* Does he know what a MM does */
1097 extern bool in_shell; /* True if executing a shell */
1098 extern bool daytime; /* Indicates whether it is daytime */
1099 extern coord oldpos; /* Position before last look() call */
1100 extern coord delta; /* Change indicated to get_dir() */
1101 extern coord grid[]; /* used for random pos generation */
1102 extern char *nothing; /* "nothing happens" msg */
1103 extern char *spacemsg;
1104 extern char *morestr;
1105 extern char *retstr;
1106 extern LEVTYPE levtype;
1107 extern int demoncnt;
1108 extern int fusecnt;
1109 extern int between;
1110 extern struct delayed_action d_list[MAXDAEMONS];
1111 extern struct delayed_action f_list[MAXFUSES];
1112 extern char *rainbow[NCOLORS];
1113 extern char *sylls[NSYLLS];
1114 extern char *stones[NSTONES];
1115 extern char *metal[NMETAL];
1116 extern char *wood[NWOOD];
1117 extern coord ch_ret;