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 $
34 * $DragonFly: src/games/rogue/rogue.h,v 1.4 2006/09/02 19:31:07 pavalos Exp $
45 * This source herein may be modified and/or distributed by anybody who
46 * so desires, with the following restrictions:
47 * 1.) This notice shall not be removed.
48 * 2.) Credit shall not be taken for the creation of this source.
49 * 3.) This code is not to be traded, sold, or used for personal
55 #define NOTHING ((unsigned short) 0)
56 #define OBJECT ((unsigned short) 01)
57 #define MONSTER ((unsigned short) 02)
58 #define STAIRS ((unsigned short) 04)
59 #define HORWALL ((unsigned short) 010)
60 #define VERTWALL ((unsigned short) 020)
61 #define DOOR ((unsigned short) 040)
62 #define FLOOR ((unsigned short) 0100)
63 #define TUNNEL ((unsigned short) 0200)
64 #define TRAP ((unsigned short) 0400)
65 #define HIDDEN ((unsigned short) 01000)
67 #define ARMOR ((unsigned short) 01)
68 #define WEAPON ((unsigned short) 02)
69 #define SCROL ((unsigned short) 04)
70 #define POTION ((unsigned short) 010)
71 #define GOLD ((unsigned short) 020)
72 #define FOOD ((unsigned short) 040)
73 #define WAND ((unsigned short) 0100)
74 #define RING ((unsigned short) 0200)
75 #define AMULET ((unsigned short) 0400)
76 #define ALL_OBJECTS ((unsigned short) 0777)
94 #define TWO_HANDED_SWORD 7
97 #define MAX_PACK_COUNT 24
99 #define PROTECT_ARMOR 0
100 #define HOLD_MONSTER 1
101 #define ENCH_WEAPON 2
106 #define SCARE_MONSTER 7
107 #define REMOVE_CURSE 8
108 #define CREATE_MONSTER 9
109 #define AGGRAVATE_MONSTER 10
110 #define MAGIC_MAPPING 11
114 #define INCREASE_STRENGTH 0
115 #define RESTORE_STRENGTH 1
117 #define EXTRA_HEALING 3
119 #define RAISE_LEVEL 5
121 #define HALLUCINATION 7
122 #define DETECT_MONSTER 8
123 #define DETECT_OBJECTS 9
125 #define LEVITATION 11
126 #define HASTE_SELF 12
127 #define SEE_INVISIBLE 13
131 #define SLOW_MONSTER 1
132 #define INVISIBILITY 2
134 #define HASTE_MONSTER 4
135 #define MAGIC_MISSILE 5
136 #define CANCELLATION 6
145 #define REGENERATION 2
146 #define SLOW_DIGEST 3
147 #define ADD_STRENGTH 4
148 #define SUSTAIN_STRENGTH 5
151 #define R_SEE_INVISIBLE 8
152 #define MAINTAIN_ARMOR 9
159 #define NOT_USED ((unsigned short) 0)
160 #define BEING_WIELDED ((unsigned short) 01)
161 #define BEING_WORN ((unsigned short) 02)
162 #define ON_LEFT_HAND ((unsigned short) 04)
163 #define ON_RIGHT_HAND ((unsigned short) 010)
164 #define ON_EITHER_HAND ((unsigned short) 014)
165 #define BEING_USED ((unsigned short) 017)
172 #define SLEEPING_GAS_TRAP 4
176 #define STEALTH_FACTOR 3
177 #define R_TELE_PERCENT 8
179 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
180 #define IDENTIFIED ((unsigned short) 01)
181 #define CALLED ((unsigned short) 02)
186 #define MAX_TITLE_LENGTH 30
187 #define MAXSYLLABLES 40
189 #define WAND_MATERIALS 30
192 #define GOLD_PERCENT 46
194 #define MAX_OPT_LEN 40
196 #define HUNGER_STR_LEN 8
198 #define MAX_ID_TITLE_LEN 64
202 char title
[MAX_ID_TITLE_LEN
];
204 unsigned short id_status
;
207 /* The following #defines provide more meaningful names for some of the
208 * struct object fields that are used for monsters. This, since each monster
209 * and object (scrolls, potions, etc) are represented by a struct object.
210 * Ideally, this should be handled by some kind of union structure.
213 #define m_damage damage
214 #define hp_to_kill quantity
216 #define first_level is_protected
217 #define last_level is_cursed
218 #define m_hit_chance class
219 #define stationary_damage identified
220 #define drop_percent which_kind
221 #define trail_char d_enchant
222 #define slowed_toggle quiver
223 #define moves_confused hit_enchant
224 #define nap_length picked_up
225 #define disguise what_is
226 #define next_monster next_object
228 struct obj
{ /* comment is monster meaning */
229 unsigned long m_flags
; /* monster flags */
230 const char *damage
; /* damage it does */
231 short quantity
; /* hit points to kill */
232 short ichar
; /* 'A' is for aquatar */
233 short kill_exp
; /* exp for killing it */
234 short is_protected
; /* level starts */
235 short is_cursed
; /* level ends */
236 short class; /* chance of hitting you */
237 short identified
; /* 'F' damage, 1,2,3... */
238 unsigned short which_kind
; /* item carry/drop % */
239 short o_row
, o_col
, o
; /* o is how many times stuck at o_row, o_col */
240 short row
, col
; /* current row, col */
241 short d_enchant
; /* room char when detect_monster */
242 short quiver
; /* monster slowed toggle */
243 short trow
, tcol
; /* target row, col */
244 short hit_enchant
; /* how many moves is confused */
245 unsigned short what_is
; /* imitator's charactor (?!%: */
246 short picked_up
; /* sleep from wand of sleep */
247 unsigned short in_use_flags
;
248 struct obj
*next_object
; /* next monster */
251 typedef struct obj object
;
253 #define INIT_AW NULL,NULL
254 #define INIT_RINGS NULL,NULL
256 #define INIT_STR 16,16
258 #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}
260 #define INIT_CHAR '@'
261 #define INIT_MOVES 1250
266 object
*left_ring
, *right_ring
;
280 typedef struct fightr fighter
;
290 typedef struct dr door
;
293 short bottom_row
, right_col
, left_col
, top_row
;
295 unsigned short is_room
;
298 typedef struct rm room
;
305 #define PASSAGE (-3) /* cur_room value */
307 #define AMULET_LEVEL 26
309 #define R_NOTHING ((unsigned short) 01)
310 #define R_ROOM ((unsigned short) 02)
311 #define R_MAZE ((unsigned short) 04)
312 #define R_DEADEND ((unsigned short) 010)
313 #define R_CROSS ((unsigned short) 020)
315 #define MAX_EXP_LEVEL 21
316 #define MAX_EXP 10000001L
317 #define MAX_GOLD 999999
320 #define MAX_STRENGTH 99
321 #define LAST_DUNGEON 99
323 #define STAT_LEVEL 01
326 #define STAT_STRENGTH 010
327 #define STAT_ARMOR 020
329 #define STAT_HUNGER 0100
330 #define STAT_LABEL 0200
331 #define STAT_ALL 0377
333 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
335 #define MAX_TRAPS 10 /* maximum traps per level */
337 #define HIDE_PERCENT 12
341 short trap_row
, trap_col
;
344 typedef struct tr trap
;
346 extern fighter rogue
;
349 extern unsigned short dungeon
[DROWS
][DCOLS
];
350 extern object level_objects
;
352 extern struct id id_scrolls
[];
353 extern struct id id_potions
[];
354 extern struct id id_wands
[];
355 extern struct id id_rings
[];
356 extern struct id id_weapons
[];
357 extern struct id id_armors
[];
359 extern object mon_tab
[];
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 */
443 /* external routine declarations.
445 #define rrandom random
446 #define srrandom(x) srandomdev()
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 *);
465 void start_window(void);
466 void stop_window(void);
469 void error_save(void);
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);
510 void md_lock(boolean
);
511 void md_shell(const char *);
515 void message(const char *, boolean
);
516 void remessage(short);
517 void check_message(void);
518 short get_input_line(const char *, const char *, char *,
519 const char *, boolean
, boolean
);
521 void print_stats(int);
522 void sound_bell(void);
523 boolean
is_digit(short);
524 int r_index(const char *, int, boolean
);
528 object
*gr_monster(object
*, int);
530 void party_monsters(int, int);
531 short gmc_row_col(int, int);
533 void mv_1_monster(object
*, short, short);
534 void move_mon_to(object
*, short, short);
535 boolean
mon_can_go(const object
*, short, short);
536 void wake_up(object
*);
537 void wake_room(short, boolean
, short, short);
538 const char *mon_name(const object
*);
540 void show_monsters(void);
541 void create_monster(void);
542 int rogue_can_see(int, int);
543 char gr_obj_char(void);
544 void aggravate(void);
545 boolean
mon_sees(const object
*, int, int);
546 void mv_aquatars(void);
549 short one_move_rogue(short, short);
550 void multiple_move_rogue(short);
551 boolean
is_passable(int, int);
552 boolean
can_move(short, short, short, short);
553 void move_onto(void);
554 boolean
is_direction(short, short *);
555 boolean
reg_move(void);
559 void put_objects(void);
560 void place_at(object
*, int, int);
561 object
*object_at(object
*, short, short);
562 object
*get_letter_object(int);
563 void free_stuff(object
*);
564 const char *name_of(const object
*);
565 object
*gr_object(void);
566 void get_food(object
*, boolean
);
567 void put_stairs(void);
568 short get_armor_class(const object
*);
569 object
*alloc_object(void);
570 void free_object(object
*);
571 void show_objects(void);
572 void put_amulet(void);
573 void c_object_for_wizard(void);
576 object
*add_to_pack(object
*, object
*, int);
577 void take_from_pack(object
*, object
*);
578 object
*pick_up(int, int, short *);
580 void wait_for_ack(void);
581 short pack_letter(const char *, unsigned short);
584 void unwear(object
*);
585 void do_wear(object
*);
587 void do_wield(object
*);
588 void unwield(object
*);
590 short pack_count(const object
*);
591 boolean
has_amulet(void);
592 void kick_into_pack(void);
595 void play_level(void);
598 int get_rand(int, int);
599 boolean
rand_percent(int);
600 boolean
coin_toss(void);
603 void put_on_ring(void);
604 void do_put_on(object
*, boolean
);
605 void remove_ring(void);
606 void un_put_on(object
*);
607 void gr_ring(object
*, boolean
);
608 void inv_rings(void);
609 void ring_stats(boolean
);
612 void light_up_room(int);
613 void light_passage(int, int);
614 void darken_room(short);
615 char get_dungeon_char(int, int);
616 char get_mask_char(unsigned short);
617 void gr_row_col(short *, short *, unsigned short);
619 short party_objects(short);
620 short get_room_number(int, int);
621 boolean
is_all_connected(void);
622 void draw_magic_map(void);
623 void dr_course(object
*, boolean
, short, short);
624 void edit_opts(void);
628 void save_game(void);
629 void save_into_file(const char *);
630 void restore(const char *);
633 void killed_by(const object
*, short);
636 void put_scores(const object
*, short);
637 boolean
is_vowel(short);
638 void xxxx(char *, short);
642 void special_hit(object
*);
644 void cough_up(object
*);
645 boolean
seek_gold(object
*);
646 void check_gold_seeker(object
*);
647 boolean
check_imitator(object
*);
648 boolean
imitating(short, short);
649 boolean
m_confuse(object
*);
650 boolean
flame_broil(object
*);
654 void rand_around(short, short *, short *);
657 void trap_player(short, short);
658 void add_traps(void);
660 void show_traps(void);
661 void search(short, boolean
);
665 void read_scroll(void);
666 void vanish(object
*, short, object
*);
669 void hallucinate(void);
670 void unhallucinate(void);
673 void take_a_nap(void);
675 void unconfuse(void);
679 void wizardize(void);
680 void bounce(short, short, short, short, short);
683 * external variable declarations.
685 extern char hunger_str
[HUNGER_STR_LEN
];
686 extern char login_name
[MAX_OPT_LEN
];
687 extern const char *error_file
;