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