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