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. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)rogue.h 8.1 (Berkeley) 5/31/93
37 * $FreeBSD: src/games/rogue/rogue.h,v 1.3.2.1 2001/12/17 12:43:23 phantom Exp $
38 * $DragonFly: src/games/rogue/rogue.h,v 1.4 2006/09/02 19:31:07 pavalos Exp $
49 * This source herein may be modified and/or distributed by anybody who
50 * so desires, with the following restrictions:
51 * 1.) This notice shall not be removed.
52 * 2.) Credit shall not be taken for the creation of this source.
53 * 3.) This code is not to be traded, sold, or used for personal
59 #define NOTHING ((unsigned short) 0)
60 #define OBJECT ((unsigned short) 01)
61 #define MONSTER ((unsigned short) 02)
62 #define STAIRS ((unsigned short) 04)
63 #define HORWALL ((unsigned short) 010)
64 #define VERTWALL ((unsigned short) 020)
65 #define DOOR ((unsigned short) 040)
66 #define FLOOR ((unsigned short) 0100)
67 #define TUNNEL ((unsigned short) 0200)
68 #define TRAP ((unsigned short) 0400)
69 #define HIDDEN ((unsigned short) 01000)
71 #define ARMOR ((unsigned short) 01)
72 #define WEAPON ((unsigned short) 02)
73 #define SCROL ((unsigned short) 04)
74 #define POTION ((unsigned short) 010)
75 #define GOLD ((unsigned short) 020)
76 #define FOOD ((unsigned short) 040)
77 #define WAND ((unsigned short) 0100)
78 #define RING ((unsigned short) 0200)
79 #define AMULET ((unsigned short) 0400)
80 #define ALL_OBJECTS ((unsigned short) 0777)
98 #define TWO_HANDED_SWORD 7
101 #define MAX_PACK_COUNT 24
103 #define PROTECT_ARMOR 0
104 #define HOLD_MONSTER 1
105 #define ENCH_WEAPON 2
110 #define SCARE_MONSTER 7
111 #define REMOVE_CURSE 8
112 #define CREATE_MONSTER 9
113 #define AGGRAVATE_MONSTER 10
114 #define MAGIC_MAPPING 11
118 #define INCREASE_STRENGTH 0
119 #define RESTORE_STRENGTH 1
121 #define EXTRA_HEALING 3
123 #define RAISE_LEVEL 5
125 #define HALLUCINATION 7
126 #define DETECT_MONSTER 8
127 #define DETECT_OBJECTS 9
129 #define LEVITATION 11
130 #define HASTE_SELF 12
131 #define SEE_INVISIBLE 13
135 #define SLOW_MONSTER 1
136 #define INVISIBILITY 2
138 #define HASTE_MONSTER 4
139 #define MAGIC_MISSILE 5
140 #define CANCELLATION 6
149 #define REGENERATION 2
150 #define SLOW_DIGEST 3
151 #define ADD_STRENGTH 4
152 #define SUSTAIN_STRENGTH 5
155 #define R_SEE_INVISIBLE 8
156 #define MAINTAIN_ARMOR 9
163 #define NOT_USED ((unsigned short) 0)
164 #define BEING_WIELDED ((unsigned short) 01)
165 #define BEING_WORN ((unsigned short) 02)
166 #define ON_LEFT_HAND ((unsigned short) 04)
167 #define ON_RIGHT_HAND ((unsigned short) 010)
168 #define ON_EITHER_HAND ((unsigned short) 014)
169 #define BEING_USED ((unsigned short) 017)
176 #define SLEEPING_GAS_TRAP 4
180 #define STEALTH_FACTOR 3
181 #define R_TELE_PERCENT 8
183 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
184 #define IDENTIFIED ((unsigned short) 01)
185 #define CALLED ((unsigned short) 02)
190 #define MAX_TITLE_LENGTH 30
191 #define MAXSYLLABLES 40
193 #define WAND_MATERIALS 30
196 #define GOLD_PERCENT 46
198 #define MAX_OPT_LEN 40
200 #define HUNGER_STR_LEN 8
202 #define MAX_ID_TITLE_LEN 64
206 char title
[MAX_ID_TITLE_LEN
];
208 unsigned short id_status
;
211 /* The following #defines provide more meaningful names for some of the
212 * struct object fields that are used for monsters. This, since each monster
213 * and object (scrolls, potions, etc) are represented by a struct object.
214 * Ideally, this should be handled by some kind of union structure.
217 #define m_damage damage
218 #define hp_to_kill quantity
220 #define first_level is_protected
221 #define last_level is_cursed
222 #define m_hit_chance class
223 #define stationary_damage identified
224 #define drop_percent which_kind
225 #define trail_char d_enchant
226 #define slowed_toggle quiver
227 #define moves_confused hit_enchant
228 #define nap_length picked_up
229 #define disguise what_is
230 #define next_monster next_object
232 struct obj
{ /* comment is monster meaning */
233 unsigned long m_flags
; /* monster flags */
234 const char *damage
; /* damage it does */
235 short quantity
; /* hit points to kill */
236 short ichar
; /* 'A' is for aquatar */
237 short kill_exp
; /* exp for killing it */
238 short is_protected
; /* level starts */
239 short is_cursed
; /* level ends */
240 short class; /* chance of hitting you */
241 short identified
; /* 'F' damage, 1,2,3... */
242 unsigned short which_kind
; /* item carry/drop % */
243 short o_row
, o_col
, o
; /* o is how many times stuck at o_row, o_col */
244 short row
, col
; /* current row, col */
245 short d_enchant
; /* room char when detect_monster */
246 short quiver
; /* monster slowed toggle */
247 short trow
, tcol
; /* target row, col */
248 short hit_enchant
; /* how many moves is confused */
249 unsigned short what_is
; /* imitator's charactor (?!%: */
250 short picked_up
; /* sleep from wand of sleep */
251 unsigned short in_use_flags
;
252 struct obj
*next_object
; /* next monster */
255 typedef struct obj object
;
257 #define INIT_AW (object*)0,(object*)0
258 #define INIT_RINGS (object*)0,(object*)0
260 #define INIT_STR 16,16
262 #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}
264 #define INIT_CHAR '@'
265 #define INIT_MOVES 1250
270 object
*left_ring
, *right_ring
;
284 typedef struct fightr fighter
;
294 typedef struct dr door
;
297 short bottom_row
, right_col
, left_col
, top_row
;
299 unsigned short is_room
;
302 typedef struct rm room
;
309 #define PASSAGE -3 /* cur_room value */
311 #define AMULET_LEVEL 26
313 #define R_NOTHING ((unsigned short) 01)
314 #define R_ROOM ((unsigned short) 02)
315 #define R_MAZE ((unsigned short) 04)
316 #define R_DEADEND ((unsigned short) 010)
317 #define R_CROSS ((unsigned short) 020)
319 #define MAX_EXP_LEVEL 21
320 #define MAX_EXP 10000001L
321 #define MAX_GOLD 999999
324 #define MAX_STRENGTH 99
325 #define LAST_DUNGEON 99
327 #define STAT_LEVEL 01
330 #define STAT_STRENGTH 010
331 #define STAT_ARMOR 020
333 #define STAT_HUNGER 0100
334 #define STAT_LABEL 0200
335 #define STAT_ALL 0377
337 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
339 #define MAX_TRAPS 10 /* maximum traps per level */
341 #define HIDE_PERCENT 12
345 short trap_row
, trap_col
;
348 typedef struct tr trap
;
350 extern fighter rogue
;
353 extern unsigned short dungeon
[DROWS
][DCOLS
];
354 extern object level_objects
;
356 extern struct id id_scrolls
[];
357 extern struct id id_potions
[];
358 extern struct id id_wands
[];
359 extern struct id id_rings
[];
360 extern struct id id_weapons
[];
361 extern struct id id_armors
[];
363 extern object mon_tab
[];
364 extern object level_monsters
;
370 #define INVISIBLE 04L
376 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */
377 #define CONFUSED 01000L
380 #define FREEZES 010000L
381 #define STEALS_GOLD 020000L
382 #define STEALS_ITEM 040000L
383 #define STINGS 0100000L
384 #define DRAINS_LIFE 0200000L
385 #define DROPS_LEVEL 0400000L
386 #define SEEKS_GOLD 01000000L
387 #define FREEZING_ROGUE 02000000L
388 #define RUST_VANISHED 04000000L
389 #define CONFUSES 010000000L
390 #define IMITATES 020000000L
391 #define FLAMES 040000000L
392 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */
393 #define NAPPING 0200000000L /* can't wake up for a while */
394 #define ALREADY_MOVED 0400000000L
396 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
398 #define WAKE_PERCENT 45
399 #define FLIT_PERCENT 40
400 #define PARTY_WAKE_PERCENT 75
402 #define HYPOTHERMIA 1
404 #define POISON_DART 3
426 #define MOVE_FAILED -1
427 #define STOPPED_ON_SOMETHING -2
428 #define CANCEL '\033'
439 short year
; /* >= 1987 */
440 short month
; /* 1 - 12 */
441 short day
; /* 1 - 31 */
442 short hour
; /* 0 - 23 */
443 short minute
; /* 0 - 59 */
444 short second
; /* 0 - 59 */
447 /* external routine declarations.
449 #define rrandom random
450 #define srrandom(x) srandomdev()
453 void mon_hit(object
*);
454 void rogue_hit(object
*, boolean
);
455 void rogue_damage(short, object
*, short);
456 int get_damage(const char *, boolean
);
457 int get_number(const char *);
458 long lget_number(const char *);
459 boolean
mon_damage(object
*, short);
461 void get_dir_rc(short, short *, short *, short);
462 short get_hit_chance(const object
*);
463 short get_weapon_damage(const object
*);
464 void s_con_mon(object
*);
467 boolean
init(int, char**);
468 void clean_up(const char *);
469 void start_window(void);
470 void stop_window(void);
473 void error_save(void);
476 void inventory(const object
*, unsigned short);
478 void mix_colors(void);
479 void make_scroll_titles(void);
480 void get_desc(const object
*, char *);
481 void get_wand_and_ring_materials(void);
482 void single_inv(short);
483 struct id
*get_id_table(const object
*);
484 void inv_armor_weapon(boolean
);
488 void make_level(void);
489 void clear_level(void);
490 void put_player(short);
491 boolean
drop_check(void);
492 boolean
check_up(void);
493 void add_exp(int, boolean
);
495 void show_average_hp(void);
500 void md_control_keybord(boolean
);
501 void md_heed_signals(void);
502 void md_ignore_signals(void);
503 int md_get_file_id(const char *);
504 int md_link_count(const char *);
505 void md_gct(struct rogue_time
*);
506 void md_gfmt(const char *, struct rogue_time
*);
507 boolean
md_df(const char *);
508 const char *md_gln(void);
510 char *md_getenv(const char *);
511 char *md_malloc(int);
514 void md_lock(boolean
);
515 void md_shell(const char *);
519 void message(const char *, boolean
);
520 void remessage(short);
521 void check_message(void);
522 short get_input_line(const char *, const char *, char *,
523 const char *, boolean
, boolean
);
525 void print_stats(int);
526 void sound_bell(void);
527 boolean
is_digit(short);
528 int r_index(const char *, int, boolean
);
532 object
*gr_monster(object
*, int);
534 void party_monsters(int, int);
535 short gmc_row_col(int, int);
537 void mv_1_monster(object
*, short, short);
538 void move_mon_to(object
*, short, short);
539 boolean
mon_can_go(const object
*, short, short);
540 void wake_up(object
*);
541 void wake_room(short, boolean
, short, short);
542 const char *mon_name(const object
*);
544 void show_monsters(void);
545 void create_monster(void);
546 int rogue_can_see(int, int);
547 char gr_obj_char(void);
548 void aggravate(void);
549 boolean
mon_sees(const object
*, int, int);
550 void mv_aquatars(void);
553 short one_move_rogue(short, short);
554 void multiple_move_rogue(short);
555 boolean
is_passable(int, int);
556 boolean
can_move(short, short, short, short);
557 void move_onto(void);
558 boolean
is_direction(short, short *);
559 boolean
reg_move(void);
563 void put_objects(void);
564 void place_at(object
*, int, int);
565 object
*object_at(object
*, short, short);
566 object
*get_letter_object(int);
567 void free_stuff(object
*);
568 const char *name_of(const object
*);
569 object
*gr_object(void);
570 void get_food(object
*, boolean
);
571 void put_stairs(void);
572 short get_armor_class(const object
*);
573 object
*alloc_object(void);
574 void free_object(object
*);
575 void show_objects(void);
576 void put_amulet(void);
577 void c_object_for_wizard(void);
580 object
*add_to_pack(object
*, object
*, int);
581 void take_from_pack(object
*, object
*);
582 object
*pick_up(int, int, short *);
584 void wait_for_ack(void);
585 short pack_letter(const char *, unsigned short);
588 void unwear(object
*);
589 void do_wear(object
*);
591 void do_wield(object
*);
592 void unwield(object
*);
594 short pack_count(const object
*);
595 boolean
has_amulet(void);
596 void kick_into_pack(void);
599 void play_level(void);
602 int get_rand(int, int);
603 boolean
rand_percent(int);
604 boolean
coin_toss(void);
607 void put_on_ring(void);
608 void do_put_on(object
*, boolean
);
609 void remove_ring(void);
610 void un_put_on(object
*);
611 void gr_ring(object
*, boolean
);
612 void inv_rings(void);
613 void ring_stats(boolean
);
616 void light_up_room(int);
617 void light_passage(int, int);
618 void darken_room(short);
619 char get_dungeon_char(int, int);
620 char get_mask_char(unsigned short);
621 void gr_row_col(short *, short *, unsigned short);
623 short party_objects(short);
624 short get_room_number(int, int);
625 boolean
is_all_connected(void);
626 void draw_magic_map(void);
627 void dr_course(object
*, boolean
, short, short);
628 void edit_opts(void);
632 void save_game(void);
633 void save_into_file(const char *);
634 void restore(const char *);
637 void killed_by(const object
*, short);
640 void put_scores(const object
*, short);
641 boolean
is_vowel(short);
642 void xxxx(char *, short);
646 void special_hit(object
*);
648 void cough_up(object
*);
649 boolean
seek_gold(object
*);
650 void check_gold_seeker(object
*);
651 boolean
check_imitator(object
*);
652 boolean
imitating(short, short);
653 boolean
m_confuse(object
*);
654 boolean
flame_broil(object
*);
658 void rand_around(short, short *, short *);
661 void trap_player(short, short);
662 void add_traps(void);
664 void show_traps(void);
665 void search(short, boolean
);
669 void read_scroll(void);
670 void vanish(object
*, short, object
*);
673 void hallucinate(void);
674 void unhallucinate(void);
677 void take_a_nap(void);
679 void unconfuse(void);
683 void wizardize(void);
684 void bounce(short, short, short, short, short);
687 * external variable declarations.
689 extern char hunger_str
[HUNGER_STR_LEN
];
690 extern char login_name
[MAX_OPT_LEN
];
691 extern const char *error_file
;