2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * @(#)rogue.h 8.1 (Berkeley) 5/31/93
33 * $FreeBSD: src/games/rogue/rogue.h,v 1.3.2.1 2001/12/17 12:43:23 phantom Exp $
44 * This source herein may be modified and/or distributed by anybody who
45 * so desires, with the following restrictions:
46 * 1.) This notice shall not be removed.
47 * 2.) Credit shall not be taken for the creation of this source.
48 * 3.) This code is not to be traded, sold, or used for personal
54 #define NOTHING ((unsigned short) 0)
55 #define OBJECT ((unsigned short) 01)
56 #define MONSTER ((unsigned short) 02)
57 #define STAIRS ((unsigned short) 04)
58 #define HORWALL ((unsigned short) 010)
59 #define VERTWALL ((unsigned short) 020)
60 #define DOOR ((unsigned short) 040)
61 #define FLOOR ((unsigned short) 0100)
62 #define TUNNEL ((unsigned short) 0200)
63 #define TRAP ((unsigned short) 0400)
64 #define HIDDEN ((unsigned short) 01000)
66 #define ARMOR ((unsigned short) 01)
67 #define WEAPON ((unsigned short) 02)
68 #define SCROL ((unsigned short) 04)
69 #define POTION ((unsigned short) 010)
70 #define GOLD ((unsigned short) 020)
71 #define FOOD ((unsigned short) 040)
72 #define WAND ((unsigned short) 0100)
73 #define RING ((unsigned short) 0200)
74 #define AMULET ((unsigned short) 0400)
75 #define ALL_OBJECTS ((unsigned short) 0777)
93 #define TWO_HANDED_SWORD 7
96 #define MAX_PACK_COUNT 24
98 #define PROTECT_ARMOR 0
99 #define HOLD_MONSTER 1
100 #define ENCH_WEAPON 2
105 #define SCARE_MONSTER 7
106 #define REMOVE_CURSE 8
107 #define CREATE_MONSTER 9
108 #define AGGRAVATE_MONSTER 10
109 #define MAGIC_MAPPING 11
113 #define INCREASE_STRENGTH 0
114 #define RESTORE_STRENGTH 1
116 #define EXTRA_HEALING 3
118 #define RAISE_LEVEL 5
120 #define HALLUCINATION 7
121 #define DETECT_MONSTER 8
122 #define DETECT_OBJECTS 9
124 #define LEVITATION 11
125 #define HASTE_SELF 12
126 #define SEE_INVISIBLE 13
130 #define SLOW_MONSTER 1
131 #define INVISIBILITY 2
133 #define HASTE_MONSTER 4
134 #define MAGIC_MISSILE 5
135 #define CANCELLATION 6
144 #define REGENERATION 2
145 #define SLOW_DIGEST 3
146 #define ADD_STRENGTH 4
147 #define SUSTAIN_STRENGTH 5
150 #define R_SEE_INVISIBLE 8
151 #define MAINTAIN_ARMOR 9
158 #define NOT_USED ((unsigned short) 0)
159 #define BEING_WIELDED ((unsigned short) 01)
160 #define BEING_WORN ((unsigned short) 02)
161 #define ON_LEFT_HAND ((unsigned short) 04)
162 #define ON_RIGHT_HAND ((unsigned short) 010)
163 #define ON_EITHER_HAND ((unsigned short) 014)
164 #define BEING_USED ((unsigned short) 017)
171 #define SLEEPING_GAS_TRAP 4
175 #define STEALTH_FACTOR 3
176 #define R_TELE_PERCENT 8
178 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
179 #define IDENTIFIED ((unsigned short) 01)
180 #define CALLED ((unsigned short) 02)
185 #define MAX_TITLE_LENGTH 30
186 #define MAXSYLLABLES 40
188 #define WAND_MATERIALS 30
191 #define GOLD_PERCENT 46
193 #define MAX_OPT_LEN 40
195 #define HUNGER_STR_LEN 8
197 #define MAX_ID_TITLE_LEN 64
201 char title
[MAX_ID_TITLE_LEN
];
203 unsigned short id_status
;
206 /* The following #defines provide more meaningful names for some of the
207 * struct object fields that are used for monsters. This, since each monster
208 * and object (scrolls, potions, etc) are represented by a struct object.
209 * Ideally, this should be handled by some kind of union structure.
212 #define m_damage damage
213 #define hp_to_kill quantity
215 #define first_level is_protected
216 #define last_level is_cursed
217 #define m_hit_chance class
218 #define stationary_damage identified
219 #define drop_percent which_kind
220 #define trail_char d_enchant
221 #define slowed_toggle quiver
222 #define moves_confused hit_enchant
223 #define nap_length picked_up
224 #define disguise what_is
225 #define next_monster next_object
227 struct obj
{ /* comment is monster meaning */
228 unsigned long m_flags
; /* monster flags */
229 const char *damage
; /* damage it does */
230 short quantity
; /* hit points to kill */
231 short ichar
; /* 'A' is for aquatar */
232 short kill_exp
; /* exp for killing it */
233 short is_protected
; /* level starts */
234 short is_cursed
; /* level ends */
235 short class; /* chance of hitting you */
236 short identified
; /* 'F' damage, 1,2,3... */
237 unsigned short which_kind
; /* item carry/drop % */
238 short o_row
, o_col
, o
; /* o is how many times stuck at o_row, o_col */
239 short row
, col
; /* current row, col */
240 short d_enchant
; /* room char when detect_monster */
241 short quiver
; /* monster slowed toggle */
242 short trow
, tcol
; /* target row, col */
243 short hit_enchant
; /* how many moves is confused */
244 unsigned short what_is
; /* imitator's charactor (?!%: */
245 short picked_up
; /* sleep from wand of sleep */
246 unsigned short in_use_flags
;
247 struct obj
*next_object
; /* next monster */
250 typedef struct obj object
;
252 #define INIT_AW NULL,NULL
253 #define INIT_RINGS NULL,NULL
255 #define INIT_STR 16,16
257 #define INIT_PACK {0,"",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}
259 #define INIT_CHAR '@'
260 #define INIT_MOVES 1250
265 object
*left_ring
, *right_ring
;
279 typedef struct fightr fighter
;
289 typedef struct dr door
;
292 short bottom_row
, right_col
, left_col
, top_row
;
294 unsigned short is_room
;
297 typedef struct rm room
;
304 #define PASSAGE (-3) /* cur_room value */
306 #define AMULET_LEVEL 26
308 #define R_NOTHING ((unsigned short) 01)
309 #define R_ROOM ((unsigned short) 02)
310 #define R_MAZE ((unsigned short) 04)
311 #define R_DEADEND ((unsigned short) 010)
312 #define R_CROSS ((unsigned short) 020)
314 #define MAX_EXP_LEVEL 21
315 #define MAX_EXP 10000001L
316 #define MAX_GOLD 999999
319 #define MAX_STRENGTH 99
320 #define LAST_DUNGEON 99
322 #define STAT_LEVEL 01
325 #define STAT_STRENGTH 010
326 #define STAT_ARMOR 020
328 #define STAT_HUNGER 0100
329 #define STAT_LABEL 0200
330 #define STAT_ALL 0377
332 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
334 #define MAX_TRAPS 10 /* maximum traps per level */
336 #define HIDE_PERCENT 12
340 short trap_row
, trap_col
;
343 typedef struct tr trap
;
345 extern fighter rogue
;
348 extern unsigned short dungeon
[DROWS
][DCOLS
];
349 extern object level_objects
;
351 extern struct id id_scrolls
[];
352 extern struct id id_potions
[];
353 extern struct id id_wands
[];
354 extern struct id id_rings
[];
355 extern struct id id_weapons
[];
356 extern struct id id_armors
[];
358 extern object mon_tab
[];
359 extern object level_monsters
;
365 #define INVISIBLE 04L
371 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */
372 #define CONFUSED 01000L
375 #define FREEZES 010000L
376 #define STEALS_GOLD 020000L
377 #define STEALS_ITEM 040000L
378 #define STINGS 0100000L
379 #define DRAINS_LIFE 0200000L
380 #define DROPS_LEVEL 0400000L
381 #define SEEKS_GOLD 01000000L
382 #define FREEZING_ROGUE 02000000L
383 #define RUST_VANISHED 04000000L
384 #define CONFUSES 010000000L
385 #define IMITATES 020000000L
386 #define FLAMES 040000000L
387 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */
388 #define NAPPING 0200000000L /* can't wake up for a while */
389 #define ALREADY_MOVED 0400000000L
391 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
393 #define WAKE_PERCENT 45
394 #define FLIT_PERCENT 40
395 #define PARTY_WAKE_PERCENT 75
397 #define HYPOTHERMIA 1
399 #define POISON_DART 3
421 #define MOVE_FAILED -1
422 #define STOPPED_ON_SOMETHING -2
423 #define CANCEL '\033'
434 short year
; /* >= 1987 */
435 short month
; /* 1 - 12 */
436 short day
; /* 1 - 31 */
437 short hour
; /* 0 - 23 */
438 short minute
; /* 0 - 59 */
439 short second
; /* 0 - 59 */
442 /* external routine declarations.
444 #define rrandom random
447 void mon_hit(object
*);
448 void rogue_hit(object
*, boolean
);
449 void rogue_damage(short, object
*, short);
450 int get_damage(const char *, boolean
);
451 int get_number(const char *);
452 long lget_number(const char *);
453 boolean
mon_damage(object
*, short);
455 void get_dir_rc(short, short *, short *, short);
456 short get_hit_chance(const object
*);
457 short get_weapon_damage(const object
*);
458 void s_con_mon(object
*);
461 boolean
init(int, char**);
462 void clean_up(const char *) __dead2
;
463 void start_window(void);
464 void stop_window(void);
467 void error_save(int) __dead2
;
470 void inventory(const object
*, unsigned short);
472 void mix_colors(void);
473 void make_scroll_titles(void);
474 void get_desc(const object
*, char *);
475 void get_wand_and_ring_materials(void);
476 void single_inv(short);
477 struct id
*get_id_table(const object
*);
478 void inv_armor_weapon(boolean
);
482 void make_level(void);
483 void clear_level(void);
484 void put_player(short);
485 boolean
drop_check(void);
486 boolean
check_up(void);
487 void add_exp(int, boolean
);
489 void show_average_hp(void);
494 void md_control_keybord(boolean
);
495 void md_heed_signals(void);
496 void md_ignore_signals(void);
497 int md_get_file_id(const char *);
498 int md_link_count(const char *);
499 void md_gct(struct rogue_time
*);
500 void md_gfmt(const char *, struct rogue_time
*);
501 boolean
md_df(const char *);
502 const char *md_gln(void);
504 char *md_getenv(const char *);
505 char *md_malloc(int);
506 void md_exit(int) __dead2
;
507 void md_lock(boolean
);
508 void md_shell(const char *);
512 void message(const char *, boolean
);
513 void remessage(short);
514 void check_message(void);
515 short get_input_line(const char *, const char *, char *,
516 const char *, boolean
, boolean
);
518 void print_stats(int);
519 void sound_bell(void);
520 boolean
is_digit(short);
521 int r_index(const char *, int, boolean
);
525 object
*gr_monster(object
*, int);
527 void party_monsters(int, int);
528 short gmc_row_col(int, int);
530 void mv_1_monster(object
*, short, short);
531 void move_mon_to(object
*, short, short);
532 boolean
mon_can_go(const object
*, short, short);
533 void wake_up(object
*);
534 void wake_room(short, boolean
, short, short);
535 const char *mon_name(const object
*);
537 void show_monsters(void);
538 void create_monster(void);
539 int rogue_can_see(int, int);
540 char gr_obj_char(void);
541 void aggravate(void);
542 boolean
mon_sees(const object
*, int, int);
543 void mv_aquatars(void);
546 short one_move_rogue(short, short);
547 void multiple_move_rogue(short);
548 boolean
is_passable(int, int);
549 boolean
can_move(short, short, short, short);
550 void move_onto(void);
551 boolean
is_direction(short, short *);
552 boolean
reg_move(void);
556 void put_objects(void);
557 void place_at(object
*, int, int);
558 object
*object_at(object
*, short, short);
559 object
*get_letter_object(int);
560 void free_stuff(object
*);
561 const char *name_of(const object
*);
562 object
*gr_object(void);
563 void get_food(object
*, boolean
);
564 void put_stairs(void);
565 short get_armor_class(const object
*);
566 object
*alloc_object(void);
567 void free_object(object
*);
568 void show_objects(void);
569 void put_amulet(void);
570 void c_object_for_wizard(void);
573 object
*add_to_pack(object
*, object
*, int);
574 void take_from_pack(object
*, object
*);
575 object
*pick_up(int, int, short *);
577 void wait_for_ack(void);
578 short pack_letter(const char *, unsigned short);
581 void unwear(object
*);
582 void do_wear(object
*);
584 void do_wield(object
*);
585 void unwield(object
*);
587 short pack_count(const object
*);
588 boolean
has_amulet(void);
589 void kick_into_pack(void);
592 void play_level(void);
595 int get_rand(int, int);
596 boolean
rand_percent(int);
597 boolean
coin_toss(void);
600 void put_on_ring(void);
601 void do_put_on(object
*, boolean
);
602 void remove_ring(void);
603 void un_put_on(object
*);
604 void gr_ring(object
*, boolean
);
605 void inv_rings(void);
606 void ring_stats(boolean
);
609 void light_up_room(int);
610 void light_passage(int, int);
611 void darken_room(short);
612 char get_dungeon_char(int, int);
613 char get_mask_char(unsigned short);
614 void gr_row_col(short *, short *, unsigned short);
616 short party_objects(short);
617 short get_room_number(int, int);
618 boolean
is_all_connected(void);
619 void draw_magic_map(void);
620 void dr_course(object
*, boolean
, short, short);
621 void edit_opts(void);
625 void save_game(void);
626 void save_into_file(const char *);
627 void restore(const char *);
630 void killed_by(const object
*, short) __dead2
;
631 void win(void) __dead2
;
633 void put_scores(const object
*, short) __dead2
;
634 boolean
is_vowel(short);
635 void xxxx(char *, short);
639 void special_hit(object
*);
641 void cough_up(object
*);
642 boolean
seek_gold(object
*);
643 void check_gold_seeker(object
*);
644 boolean
check_imitator(object
*);
645 boolean
imitating(short, short);
646 boolean
m_confuse(object
*);
647 boolean
flame_broil(object
*);
651 void rand_around(short, short *, short *);
654 void trap_player(short, short);
655 void add_traps(void);
657 void show_traps(void);
658 void search(short, boolean
);
662 void read_scroll(void);
663 void vanish(object
*, short, object
*);
666 void hallucinate(void);
667 void unhallucinate(void);
670 void take_a_nap(void);
672 void unconfuse(void);
676 void wizardize(void);
677 void bounce(short, short, short, short, short);
680 * external variable declarations.
682 extern char hunger_str
[HUNGER_STR_LEN
];
683 extern char login_name
[MAX_OPT_LEN
];
684 extern const char *error_file
;