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 HIT_MESSAGE_SIZE 80
197 #define HUNGER_STR_LEN 8
199 #define MAX_ID_TITLE_LEN 64
203 char title
[MAX_ID_TITLE_LEN
];
205 unsigned short id_status
;
208 /* The following #defines provide more meaningful names for some of the
209 * struct object fields that are used for monsters. This, since each monster
210 * and object (scrolls, potions, etc) are represented by a struct object.
211 * Ideally, this should be handled by some kind of union structure.
214 #define m_damage damage
215 #define hp_to_kill quantity
217 #define first_level is_protected
218 #define last_level is_cursed
219 #define m_hit_chance class
220 #define stationary_damage identified
221 #define drop_percent which_kind
222 #define trail_char d_enchant
223 #define slowed_toggle quiver
224 #define moves_confused hit_enchant
225 #define nap_length picked_up
226 #define disguise what_is
227 #define next_monster next_object
229 struct obj
{ /* comment is monster meaning */
230 unsigned long m_flags
; /* monster flags */
231 const char *damage
; /* damage it does */
232 short quantity
; /* hit points to kill */
233 short ichar
; /* 'A' is for aquator */
234 short kill_exp
; /* exp for killing it */
235 short is_protected
; /* level starts */
236 short is_cursed
; /* level ends */
237 short class; /* chance of hitting you */
238 short identified
; /* 'F' damage, 1,2,3... */
239 unsigned short which_kind
; /* item carry/drop % */
240 short o_row
, o_col
, o
; /* o is how many times stuck at o_row, o_col */
241 short row
, col
; /* current row, col */
242 short d_enchant
; /* room char when detect_monster */
243 short quiver
; /* monster slowed toggle */
244 short trow
, tcol
; /* target row, col */
245 short hit_enchant
; /* how many moves is confused */
246 unsigned short what_is
; /* imitator's charactor (?!%: */
247 short picked_up
; /* sleep from wand of sleep */
248 unsigned short in_use_flags
;
249 struct obj
*next_object
; /* next monster */
252 typedef struct obj object
;
254 #define INIT_AW NULL,NULL
255 #define INIT_RINGS NULL,NULL
257 #define INIT_STR 16,16
259 #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}
261 #define INIT_CHAR '@'
262 #define INIT_MOVES 1250
267 object
*left_ring
, *right_ring
;
281 typedef struct fightr fighter
;
291 typedef struct dr door
;
294 short bottom_row
, right_col
, left_col
, top_row
;
296 unsigned short is_room
;
299 typedef struct rm room
;
306 #define PASSAGE (-3) /* cur_room value */
308 #define AMULET_LEVEL 26
310 #define R_NOTHING ((unsigned short) 01)
311 #define R_ROOM ((unsigned short) 02)
312 #define R_MAZE ((unsigned short) 04)
313 #define R_DEADEND ((unsigned short) 010)
314 #define R_CROSS ((unsigned short) 020)
316 #define MAX_EXP_LEVEL 21
317 #define MAX_EXP 10000001L
318 #define MAX_GOLD 999999
321 #define MAX_STRENGTH 99
322 #define LAST_DUNGEON 99
324 #define STAT_LEVEL 01
327 #define STAT_STRENGTH 010
328 #define STAT_ARMOR 020
330 #define STAT_HUNGER 0100
331 #define STAT_LABEL 0200
332 #define STAT_ALL 0377
334 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
336 #define MAX_TRAPS 10 /* maximum traps per level */
338 #define HIDE_PERCENT 12
342 short trap_row
, trap_col
;
345 typedef struct tr trap
;
347 extern fighter rogue
;
350 extern unsigned short dungeon
[DROWS
][DCOLS
];
351 extern object level_objects
;
353 extern struct id id_scrolls
[];
354 extern struct id id_potions
[];
355 extern struct id id_wands
[];
356 extern struct id id_rings
[];
357 extern struct id id_weapons
[];
358 extern struct id id_armors
[];
360 extern object level_monsters
;
366 #define INVISIBLE 04L
372 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */
373 #define CONFUSED 01000L
376 #define FREEZES 010000L
377 #define STEALS_GOLD 020000L
378 #define STEALS_ITEM 040000L
379 #define STINGS 0100000L
380 #define DRAINS_LIFE 0200000L
381 #define DROPS_LEVEL 0400000L
382 #define SEEKS_GOLD 01000000L
383 #define FREEZING_ROGUE 02000000L
384 #define RUST_VANISHED 04000000L
385 #define CONFUSES 010000000L
386 #define IMITATES 020000000L
387 #define FLAMES 040000000L
388 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */
389 #define NAPPING 0200000000L /* can't wake up for a while */
390 #define ALREADY_MOVED 0400000000L
392 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
394 #define WAKE_PERCENT 45
395 #define FLIT_PERCENT 40
396 #define PARTY_WAKE_PERCENT 75
398 #define HYPOTHERMIA 1
400 #define POISON_DART 3
422 #define MOVE_FAILED -1
423 #define STOPPED_ON_SOMETHING -2
424 #define CANCEL '\033'
435 short year
; /* >= 1987 */
436 short month
; /* 1 - 12 */
437 short day
; /* 1 - 31 */
438 short hour
; /* 0 - 23 */
439 short minute
; /* 0 - 59 */
440 short second
; /* 0 - 59 */
444 * external routine declarations.
446 #define rrandom random
449 void mon_hit(object
*);
450 void rogue_hit(object
*, boolean
);
451 void rogue_damage(short, object
*, short);
452 int get_damage(const char *, boolean
);
453 int get_number(const char *);
454 long lget_number(const char *);
455 boolean
mon_damage(object
*, short);
457 void get_dir_rc(short, short *, short *, short);
458 short get_hit_chance(const object
*);
459 short get_weapon_damage(const object
*);
460 void s_con_mon(object
*);
463 boolean
init(int, char**);
464 void clean_up(const char *) __dead2
;
465 void start_window(void);
466 void stop_window(void);
469 void error_save(int) __dead2
;
472 void inventory(const object
*, unsigned short);
474 void mix_colors(void);
475 void make_scroll_titles(void);
476 void get_desc(const object
*, char *);
477 void get_wand_and_ring_materials(void);
478 void single_inv(short);
479 struct id
*get_id_table(const object
*);
480 void inv_armor_weapon(boolean
);
484 void make_level(void);
485 void clear_level(void);
486 void put_player(short);
487 boolean
drop_check(void);
488 boolean
check_up(void);
489 void add_exp(int, boolean
);
491 void show_average_hp(void);
496 void md_control_keybord(boolean
);
497 void md_heed_signals(void);
498 void md_ignore_signals(void);
499 int md_get_file_id(const char *);
500 int md_link_count(const char *);
501 void md_gct(struct rogue_time
*);
502 void md_gfmt(const char *, struct rogue_time
*);
503 boolean
md_df(const char *);
504 const char *md_gln(void);
506 char *md_getenv(const char *);
507 char *md_malloc(int);
508 void md_exit(int) __dead2
;
509 void md_lock(boolean
);
510 void md_shell(const char *);
514 void message(const char *, boolean
);
515 void remessage(short);
516 void check_message(void);
517 short get_input_line(const char *, const char *, char *,
518 const char *, boolean
, boolean
);
520 void print_stats(int);
521 void sound_bell(void);
522 boolean
is_digit(short);
523 int r_index(const char *, int, boolean
);
527 object
*gr_monster(object
*, int);
529 void party_monsters(int, int);
530 short gmc_row_col(int, int);
532 void mv_1_monster(object
*, short, short);
533 void move_mon_to(object
*, short, short);
534 boolean
mon_can_go(const object
*, short, short);
535 void wake_up(object
*);
536 void wake_room(short, boolean
, short, short);
537 const char *mon_name(const object
*);
539 void show_monsters(void);
540 void create_monster(void);
541 int rogue_can_see(int, int);
542 char gr_obj_char(void);
543 void aggravate(void);
544 boolean
mon_sees(const object
*, int, int);
545 void mv_aquatars(void);
548 short one_move_rogue(short, short);
549 void multiple_move_rogue(short);
550 boolean
is_passable(int, int);
551 boolean
can_move(short, short, short, short);
552 void move_onto(void);
553 boolean
is_direction(short, short *);
554 boolean
reg_move(void);
558 void put_objects(void);
559 void place_at(object
*, int, int);
560 object
*object_at(object
*, short, short);
561 object
*get_letter_object(int);
562 void free_stuff(object
*);
563 const char *name_of(const object
*);
564 object
*gr_object(void);
565 void get_food(object
*, boolean
);
566 void put_stairs(void);
567 short get_armor_class(const object
*);
568 object
*alloc_object(void);
569 void free_object(object
*);
570 void show_objects(void);
571 void put_amulet(void);
572 void c_object_for_wizard(void);
575 object
*add_to_pack(object
*, object
*, int);
576 void take_from_pack(object
*, object
*);
577 object
*pick_up(int, int, short *);
579 void wait_for_ack(void);
580 short pack_letter(const char *, unsigned short);
583 void unwear(object
*);
584 void do_wear(object
*);
586 void do_wield(object
*);
587 void unwield(object
*);
589 short pack_count(const object
*);
590 boolean
has_amulet(void);
591 void kick_into_pack(void);
594 void play_level(void);
597 int get_rand(int, int);
598 boolean
rand_percent(int);
599 boolean
coin_toss(void);
602 void put_on_ring(void);
603 void do_put_on(object
*, boolean
);
604 void remove_ring(void);
605 void un_put_on(object
*);
606 void gr_ring(object
*, boolean
);
607 void inv_rings(void);
608 void ring_stats(boolean
);
611 void light_up_room(int);
612 void light_passage(int, int);
613 void darken_room(short);
614 char get_dungeon_char(int, int);
615 char get_mask_char(unsigned short);
616 void gr_row_col(short *, short *, unsigned short);
618 short party_objects(short);
619 short get_room_number(int, int);
620 boolean
is_all_connected(void);
621 void draw_magic_map(void);
622 void dr_course(object
*, boolean
, short, short);
623 void edit_opts(void);
627 void save_game(void);
628 void save_into_file(const char *);
629 void restore(const char *);
632 void killed_by(const object
*, short) __dead2
;
633 void win(void) __dead2
;
635 void put_scores(const object
*, short) __dead2
;
636 boolean
is_vowel(short);
637 void xxxx(char *, short);
641 void special_hit(object
*);
643 void cough_up(object
*);
644 boolean
seek_gold(object
*);
645 void check_gold_seeker(object
*);
646 boolean
check_imitator(object
*);
647 boolean
imitating(short, short);
648 boolean
m_confuse(object
*);
649 boolean
flame_broil(object
*);
653 void rand_around(short, short *, short *);
656 void trap_player(short, short);
657 void add_traps(void);
659 void show_traps(void);
660 void search(short, boolean
);
664 void read_scroll(void);
665 void vanish(object
*, short, object
*);
668 void hallucinate(void);
669 void unhallucinate(void);
672 void take_a_nap(void);
674 void unconfuse(void);
678 void wizardize(void);
679 void bounce(short, short, short, short, short);
682 * external variable declarations.
684 extern boolean ask_quit
;
685 extern boolean being_held
;
686 extern boolean cant_int
;
687 extern boolean con_mon
;
688 extern boolean detect_monster
;
689 extern boolean did_int
;
690 extern boolean flush
;
691 extern boolean interrupted
;
692 extern boolean is_wood
[];
694 extern boolean maintain_armor
;
695 extern boolean mon_disappeared
;
696 extern boolean msg_cleared
;
697 extern boolean no_skull
;
698 extern boolean passgo
;
699 extern boolean r_see_invisible
;
700 extern boolean r_teleport
;
701 extern boolean save_is_interactive
;
702 extern boolean score_only
;
703 extern boolean see_invisible
;
704 extern boolean sustain_strength
;
705 extern boolean trap_door
;
706 extern boolean wizard
;
707 extern char hit_message
[HIT_MESSAGE_SIZE
];
708 extern char hunger_str
[HUNGER_STR_LEN
];
709 extern char login_name
[MAX_OPT_LEN
];
710 extern const char *byebye_string
;
711 extern const char curse_message
[];
712 extern const char *error_file
;
714 extern const char *const m_names
[];
715 extern const char *more
;
716 extern const char *new_level_message
;
717 extern char *nick_name
;
718 extern const char *press_space
;
719 extern char *save_file
;
720 extern const char you_can_move_again
[];
721 extern const long level_points
[];
722 extern short add_strength
;
723 extern short auto_search
;
724 extern short bear_trap
;
726 extern short confused
;
727 extern short cur_level
;
728 extern short cur_room
;
729 extern short e_rings
;
730 extern short extra_hp
;
733 extern short haste_self
;
734 extern short less_hp
;
735 extern short levitate
;
736 extern short m_moves
;
737 extern short max_level
;
738 extern short party_room
;
739 extern short r_rings
;
740 extern short regeneration
;
741 extern short ring_exp
;
742 extern short stealthy
;