2 * Rogue definitions and variable declarations
4 * @(#)rogue.h 3.38 (Berkeley) 6/15/81
6 * Rogue: Exploring the Dungeons of Doom
7 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
10 * See the file LICENSE.TXT for full copyright and licensing information.
14 * Maximum number of different things
21 #define NUMTHINGS 7 /* number of types of things (scrolls, rings, etc.) */
24 * return values for get functions
26 #define NORM 0 /* normal exit */
27 #define QUIT 1 /* quit option setting */
28 #define MINUS 2 /* back up one option */
33 #define next(ptr) (*ptr).l_next
34 #define prev(ptr) (*ptr).l_prev
35 #define ldata(ptr) (*ptr).l_data
36 #define inroom(rp, cp) (\
37 (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && (rp)->r_pos.x <= (cp)->x \
38 && (cp)->y <= (rp)->r_pos.y + ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y)
39 #define winat(y, x) (mvwinch(mw,y,x)==' '?mvwinch(stdscr,y,x):winch(mw))
40 #define debug if (wizard) msg
41 #define RN (((seed = seed*11109+13849) & 0x7fff) >> 1)
42 #define unc(cp) (cp).y, (cp).x
43 #define cmov(xy) move((xy).y, (xy).x)
44 #define DISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
45 #define OBJPTR(what) (struct object *)((*what).l_data)
46 #define THINGPTR(what) (struct thing *)((*what).l_data)
47 #define when break;case
48 #define otherwise break;default
49 #define until(expr) while(!(expr))
50 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
51 #define draw(window) (wrefresh(window),usleep(20000))
52 #define hero player.t_pos
53 #define pstats player.t_stats
54 #define pack player.t_pack
55 #define attach(a,b) _attach(&a,b)
56 #define detach(a,b) _detach(&a,b)
57 #define free_list(a) _free_list(&a)
59 #define max(a, b) ((a) > (b) ? (a) : (b))
61 #define on(thing, flag) (((thing).t_flags & flag) != 0)
62 #define off(thing, flag) (((thing).t_flags & flag) == 0)
64 #define CTRL(ch) (ch & 037)
65 #define ALLOC(x) malloc((unsigned int) x)
66 #define FREE(x) free((char *) x)
67 #define EQSTR(a, b, c) (strncmp(a, b, c) == 0)
68 #define GOLDCALC (rnd(50 + 10 * level) + 2)
69 #define ISRING(h,r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r)
70 #define ISWEARING(r) (ISRING(LEFT, r) || ISRING(RIGHT, r))
71 #define newgrp() ++group
72 #define o_charges o_ac
73 #define ISMULT(type) (type == POTION || type == SCROLL || type == FOOD)
74 #define rndchoice(a) (a[rnd(sizeof(a)/sizeof((a)[0]))])
75 #define hash(i) ((unsigned)(i)*2654435761u)
78 * Things that appear on the screens
91 #define SECRETDOOR '&'
108 #define PASSWD "mTBellIQOsLNA"
114 #define WANDERTIME 70
117 #define HUHDURATION 20
118 #define SEEDURATION 850
119 #define HUNGERTIME 1300
121 #define STOMACHSIZE 2000
125 #define BOLT_LENGTH 6
128 * Save against things
131 #define VS_PARALYZATION 00
133 #define VS_PETRIFICATION 01
140 #define ISDARK 0000001
141 #define ISCURSED 000001
142 #define ISBLIND 0000001
143 #define ISGONE 0000002
144 #define ISKNOW 0000002
145 #define ISRUN 0000004
146 #define ISFOUND 0000010
147 #define ISINVIS 0000020
148 #define ISMEAN 0000040
149 #define ISGREED 0000100
150 #define ISBLOCK 0000200
151 #define ISHELD 0000400
152 #define ISHUH 0001000
153 #define ISREGEN 0002000
154 #define CANHUH 0004000
155 #define CANSEE 0010000
156 #define ISMISL 0020000
157 #define ISCANC 0020000
158 #define ISMANY 0040000
159 #define ISSLOW 0040000
160 #define ISHASTE 0100000
179 #define MAXPOTIONS 14
199 #define S_GENOCIDE 15
200 #define MAXSCROLLS 16
217 #define MAXWEAPONS 12
224 #define STUDDED_LEATHER 2
227 #define SPLINT_MAIL 5
228 #define BANDED_MAIL 6
246 #define R_TELEPORT 11
251 * Rod/Wand/Staff types
259 #define WS_POLYMORPH 5
265 #define WS_TELAWAY 11
271 * Now we define the structures and types
283 extern struct h_list helpstr
[];
286 * Coordinate data type
299 * Linked list data type
302 struct linked_list
*l_next
;
303 struct linked_list
*l_prev
;
304 char *l_data
; /* Various structure pointers */
308 * Stuff about magic items
321 coord r_pos
; /* Upper left corner */
322 coord r_max
; /* Size of room */
323 coord r_gold
; /* Where the gold is */
324 int r_goldval
; /* How much the gold is worth */
325 int r_flags
; /* Info about the room */
326 int r_nexits
; /* Number of exits */
327 coord r_exit
[4]; /* Where the exits are */
331 * Array of all traps on this level
334 coord tr_pos
; /* Where trap is */
335 char tr_type
; /* What kind of trap */
336 int tr_flags
; /* Info about trap (i.e. ISFOUND) */
339 extern struct trap traps
[MAXTRAPS
];
341 #define NUM_FEATURES 6
342 #define MAYBE_INTERESTED 1
343 #define INTERESTED 20
346 * Structure describing a fighting being
349 str_t s_str
; /* Strength */
350 long s_exp
; /* Experience */
351 int s_lvl
; /* Level of mastery */
352 int s_arm
; /* Armor class */
353 int s_hpt
; /* Hit points */
354 char s_dmg
[30]; /* String describing damage done */
355 int s_ont
; /* Orientation flags */
356 int s_int
; /* Level of interest in rogue */
360 * Structure for monsters and player
363 coord t_pos
; /* Position */
364 bool t_turn
; /* If slowed, is it a turn to move */
365 char t_type
; /* What it is */
366 char t_disguise
; /* What mimic looks like */
367 char t_oldch
; /* Character that was where it was */
368 coord
*t_dest
; /* Where it is running to */
369 short t_flags
; /* State word */
370 struct stats t_stats
; /* Physical description */
371 struct linked_list
*t_pack
; /* What the thing is carrying */
372 int t_reserved
; /* reserved for save/restore code */
376 * Array containing information on all the various types of mosnters
379 char m_name
[20]; /* What to call the monster */
380 short m_carry
; /* Probability of carrying something */
381 short m_flags
; /* Things about the monster */
382 struct stats m_stats
; /* Initial stats */
386 * Structure for a thing that the rogue can carry
390 int o_type
; /* What kind of object it is */
391 coord o_pos
; /* Where it lives on the screen */
392 char o_launch
; /* What you need to launch it */
393 char o_damage
[8]; /* Damage if used like sword */
394 char o_hurldmg
[8]; /* Damage if thrown */
395 int o_count
; /* Count for plural objects */
396 int o_which
; /* Which object of a type it is */
397 int o_hplus
; /* Plusses to hit */
398 int o_dplus
; /* Plusses to damage */
399 int o_ac
; /* Armor class */
400 int o_flags
; /* Information about objects */
401 int o_group
; /* Group number for this object */
404 struct delayed_action
{
412 * Now all the global variables
415 extern struct room rooms
[MAXROOMS
]; /* One for each room -- A level */
416 extern struct room
*oldrp
; /* Roomin(&oldpos) */
417 extern struct linked_list
*mlist
; /* List of monsters on the level */
418 extern struct thing player
; /* The rogue */
419 extern struct stats max_stats
; /* The maximum for the player */
420 extern struct monster monsters
[26]; /* The initial monster states */
421 extern struct linked_list
*lvl_obj
; /* List of objects on this level */
422 extern struct object
*cur_weapon
; /* Which weapon he is weilding */
423 extern struct object
*cur_armor
; /* What a well dresssed rogue wears */
424 extern struct object
*cur_ring
[2]; /* Which rings are being worn */
425 extern struct magic_item things
[NUMTHINGS
]; /* Chances for each type of item */
426 extern struct magic_item s_magic
[MAXSCROLLS
]; /* Names and chances for scrolls */
427 extern struct magic_item p_magic
[MAXPOTIONS
]; /* Names and chances for potions */
428 extern struct magic_item r_magic
[MAXRINGS
]; /* Names and chances for rings */
429 extern struct magic_item ws_magic
[MAXSTICKS
]; /* Names and chances for sticks */
431 extern int level
; /* What level rogue is on */
432 extern int purse
; /* How much gold the rogue has */
433 extern int mpos
; /* Where cursor is on top line */
434 extern int ntraps
; /* Number of traps on this level */
435 extern int no_move
; /* Number of turns held in place */
436 extern int no_command
; /* Number of turns asleep */
437 extern int inpack
; /* Number of things in pack */
438 extern int max_hp
; /* Player's max hit points */
439 extern int total
; /* Total dynamic memory bytes */
440 extern int a_chances
[MAXARMORS
]; /* Probabilities for armor */
441 extern int a_class
[MAXARMORS
]; /* Armor class for various armors */
442 extern int lastscore
; /* Score before this turn */
443 extern int no_food
; /* Number of levels without food */
444 extern int seed
; /* Random number seed */
445 extern int count
; /* Number of times to repeat command */
446 extern int dnum
; /* Dungeon number */
447 extern int fung_hit
; /* Number of time fungi has hit */
448 extern int quiet
; /* Number of quiet turns */
449 extern int max_level
; /* Deepest player has gone */
450 extern int food_left
; /* Amount of food in hero's stomach */
451 extern int group
; /* Current group number */
452 extern int hungry_state
; /* How hungry is he */
454 extern char take
; /* Thing the rogue is taking */
455 extern char prbuf
[80]; /* Buffer for sprintfs */
456 extern char runch
; /* Direction player is running */
457 extern char *s_names
[MAXSCROLLS
]; /* Names of the scrolls */
458 extern char *p_colors
[MAXPOTIONS
]; /* Colors of the potions */
459 extern char *r_stones
[MAXRINGS
]; /* Stone settings of the rings */
460 extern char *w_names
[MAXWEAPONS
]; /* Names of the various weapons */
461 extern char *a_names
[MAXARMORS
]; /* Names of armor types */
462 extern char *ws_made
[MAXSTICKS
]; /* What sticks are made of */
463 extern char *release
; /* Release number of rogue */
464 extern char whoami
[80]; /* Name of player */
465 extern char fruit
[80]; /* Favorite fruit */
466 extern char huh
[80]; /* The last message printed */
467 extern char *s_guess
[MAXSCROLLS
]; /* Players guess at what scroll is */
468 extern char *p_guess
[MAXPOTIONS
]; /* Players guess at what potion is */
469 extern char *r_guess
[MAXRINGS
]; /* Players guess at what ring is */
470 extern char *ws_guess
[MAXSTICKS
]; /* Players guess at what wand is */
471 extern char *ws_type
[MAXSTICKS
]; /* Is it a wand or a staff */
472 extern char file_name
[80]; /* Save file name */
473 extern char home
[80]; /* User's home directory */
475 extern WINDOW
*cw
; /* Window that the player sees */
476 extern WINDOW
*hw
; /* Used for the help command */
477 extern WINDOW
*mw
; /* Used to store mosnters */
479 extern bool running
; /* True if player is running */
480 extern bool playing
; /* True until he quits */
481 extern bool wizard
; /* True if allows wizard commands */
482 extern bool after
; /* True if we want after daemons */
483 extern bool notify
; /* True if player wants to know */
484 extern bool fight_flush
; /* True if toilet input */
485 extern bool terse
; /* True if we should be short */
486 extern bool door_stop
; /* Stop running when we pass a door */
487 extern bool jump
; /* Show running as series of jumps */
488 extern bool slow_invent
; /* Inventory one line at a time */
489 extern bool firstmove
; /* First move after setting door_stop */
490 extern bool waswizard
; /* Was a wizard sometime */
491 extern bool askme
; /* Ask about unidentified things */
492 extern bool s_know
[MAXSCROLLS
]; /* Does he know what a scroll does */
493 extern bool p_know
[MAXPOTIONS
]; /* Does he know what a potion does */
494 extern bool r_know
[MAXRINGS
]; /* Does he know what a ring does */
495 extern bool ws_know
[MAXSTICKS
]; /* Does he know what a stick does */
496 extern bool amulet
; /* He found the amulet */
497 extern bool in_shell
; /* True if executing a shell */
499 extern coord oldpos
; /* Position before last look() call */
500 extern coord delta
; /* Change indicated to get_dir() */
503 extern char countch
,direction
,newcount
;
504 extern struct delayed_action d_list
[20];
506 extern int num_checks
;
507 extern char lvl_mons
[27],wand_mons
[27];
510 struct linked_list
*find_mons(), *find_obj(), *get_item(), *new_item();
511 struct linked_list
*new_thing(), *wake_monster();
513 char *tr_name(), *new();
514 char *charge_str(),*vowelstr(), *inv_name();
515 char *ctime(), *num(), *ring_num();
517 int readchar(WINDOW
*win
);
518 int md_readchar(WINDOW
*win
);
519 int wait_for(WINDOW
*win
, register char ch
);
520 char *killname(register char monst
);
522 struct room
*roomin();
526 void auto_save(int p
), endit(int p
), quit(int p
), tstp(), checkout();
527 int nohaste(), doctor(), runners(), swander();
528 int unconfuse(), unsee(), rollwand(), stomach(), sight();
530 struct trap
*trap_at();
532 extern char *rainbow
[];
533 extern char *stones
[];
535 extern char *metal
[];
537 extern const int cNCOLORS
;
538 extern const int cNSTONES
;
539 extern const int cNWOOD
;
540 extern const int cNMETAL
;