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
43 * This source herein may be modified and/or distributed by anybody who
44 * so desires, with the following restrictions:
45 * 1.) This notice shall not be removed.
46 * 2.) Credit shall not be taken for the creation of this source.
47 * 3.) This code is not to be traded, sold, or used for personal
53 #define NOTHING ((unsigned short) 0)
54 #define OBJECT ((unsigned short) 01)
55 #define MONSTER ((unsigned short) 02)
56 #define STAIRS ((unsigned short) 04)
57 #define HORWALL ((unsigned short) 010)
58 #define VERTWALL ((unsigned short) 020)
59 #define DOOR ((unsigned short) 040)
60 #define FLOOR ((unsigned short) 0100)
61 #define TUNNEL ((unsigned short) 0200)
62 #define TRAP ((unsigned short) 0400)
63 #define HIDDEN ((unsigned short) 01000)
65 #define ARMOR ((unsigned short) 01)
66 #define WEAPON ((unsigned short) 02)
67 #define SCROL ((unsigned short) 04)
68 #define POTION ((unsigned short) 010)
69 #define GOLD ((unsigned short) 020)
70 #define FOOD ((unsigned short) 040)
71 #define WAND ((unsigned short) 0100)
72 #define RING ((unsigned short) 0200)
73 #define AMULET ((unsigned short) 0400)
74 #define ALL_OBJECTS ((unsigned short) 0777)
92 #define TWO_HANDED_SWORD 7
95 #define MAX_PACK_COUNT 24
97 #define PROTECT_ARMOR 0
98 #define HOLD_MONSTER 1
104 #define SCARE_MONSTER 7
105 #define REMOVE_CURSE 8
106 #define CREATE_MONSTER 9
107 #define AGGRAVATE_MONSTER 10
108 #define MAGIC_MAPPING 11
112 #define INCREASE_STRENGTH 0
113 #define RESTORE_STRENGTH 1
115 #define EXTRA_HEALING 3
117 #define RAISE_LEVEL 5
119 #define HALLUCINATION 7
120 #define DETECT_MONSTER 8
121 #define DETECT_OBJECTS 9
123 #define LEVITATION 11
124 #define HASTE_SELF 12
125 #define SEE_INVISIBLE 13
129 #define SLOW_MONSTER 1
130 #define INVISIBILITY 2
132 #define HASTE_MONSTER 4
133 #define MAGIC_MISSILE 5
134 #define CANCELLATION 6
143 #define REGENERATION 2
144 #define SLOW_DIGEST 3
145 #define ADD_STRENGTH 4
146 #define SUSTAIN_STRENGTH 5
149 #define R_SEE_INVISIBLE 8
150 #define MAINTAIN_ARMOR 9
157 #define NOT_USED ((unsigned short) 0)
158 #define BEING_WIELDED ((unsigned short) 01)
159 #define BEING_WORN ((unsigned short) 02)
160 #define ON_LEFT_HAND ((unsigned short) 04)
161 #define ON_RIGHT_HAND ((unsigned short) 010)
162 #define ON_EITHER_HAND ((unsigned short) 014)
163 #define BEING_USED ((unsigned short) 017)
170 #define SLEEPING_GAS_TRAP 4
174 #define STEALTH_FACTOR 3
175 #define R_TELE_PERCENT 8
177 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
178 #define IDENTIFIED ((unsigned short) 01)
179 #define CALLED ((unsigned short) 02)
184 #define MAX_TITLE_LENGTH 30
185 #define MAXSYLLABLES 40
187 #define WAND_MATERIALS 30
190 #define GOLD_PERCENT 46
192 #define MAX_OPT_LEN 40
198 unsigned short id_status;
201 /* The following #defines provide more meaningful names for some of the
202 * struct object fields that are used for monsters. This, since each monster
203 * and object (scrolls, potions, etc) are represented by a struct object.
204 * Ideally, this should be handled by some kind of union structure.
207 #define m_damage damage
208 #define hp_to_kill quantity
210 #define first_level is_protected
211 #define last_level is_cursed
212 #define m_hit_chance class
213 #define stationary_damage identified
214 #define drop_percent which_kind
215 #define trail_char d_enchant
216 #define slowed_toggle quiver
217 #define moves_confused hit_enchant
218 #define nap_length picked_up
219 #define disguise what_is
220 #define next_monster next_object
222 struct obj { /* comment is monster meaning */
223 unsigned long m_flags; /* monster flags */
224 const char *damage; /* damage it does */
225 short quantity; /* hit points to kill */
226 short ichar; /* 'A' is for aquatar */
227 short kill_exp; /* exp for killing it */
228 short is_protected; /* level starts */
229 short is_cursed; /* level ends */
230 short class; /* chance of hitting you */
231 short identified; /* 'F' damage, 1,2,3... */
232 unsigned short which_kind; /* item carry/drop % */
233 short o_row, o_col, o; /* o is how many times stuck at o_row, o_col */
234 short row, col; /* current row, col */
235 short d_enchant; /* room char when detect_monster */
236 short quiver; /* monster slowed toggle */
237 short trow, tcol; /* target row, col */
238 short hit_enchant; /* how many moves is confused */
239 unsigned short what_is; /* imitator's charactor (?!%: */
240 short picked_up; /* sleep from wand of sleep */
241 unsigned short in_use_flags;
242 struct obj *next_object; /* next monster */
245 typedef struct obj object;
247 #define INIT_AW (object*)0,(object*)0
248 #define INIT_RINGS (object*)0,(object*)0
249 #define INIT_HP 12,12
250 #define INIT_STR 16,16
252 #define INIT_PACK {0}
254 #define INIT_CHAR '@'
255 #define INIT_MOVES 1250
260 object *left_ring, *right_ring;
274 typedef struct fightr fighter;
284 typedef struct dr door;
287 short bottom_row, right_col, left_col, top_row;
289 unsigned short is_room;
292 typedef struct rm room;
299 #define PASSAGE -3 /* cur_room value */
301 #define AMULET_LEVEL 26
303 #define R_NOTHING ((unsigned short) 01)
304 #define R_ROOM ((unsigned short) 02)
305 #define R_MAZE ((unsigned short) 04)
306 #define R_DEADEND ((unsigned short) 010)
307 #define R_CROSS ((unsigned short) 020)
309 #define MAX_EXP_LEVEL 21
310 #define MAX_EXP 10000001L
311 #define MAX_GOLD 999999
314 #define MAX_STRENGTH 99
315 #define LAST_DUNGEON 99
317 #define STAT_LEVEL 01
320 #define STAT_STRENGTH 010
321 #define STAT_ARMOR 020
323 #define STAT_HUNGER 0100
324 #define STAT_LABEL 0200
325 #define STAT_ALL 0377
327 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
329 #define MAX_TRAPS 10 /* maximum traps per level */
331 #define HIDE_PERCENT 12
335 short trap_row, trap_col;
338 typedef struct tr trap;
340 extern fighter rogue;
343 extern unsigned short dungeon[DROWS][DCOLS];
344 extern object level_objects;
346 extern struct id id_scrolls[];
347 extern struct id id_potions[];
348 extern struct id id_wands[];
349 extern struct id id_rings[];
350 extern struct id id_weapons[];
351 extern struct id id_armors[];
353 extern object mon_tab[];
354 extern object level_monsters;
360 #define INVISIBLE 04L
366 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */
367 #define CONFUSED 01000L
370 #define FREEZES 010000L
371 #define STEALS_GOLD 020000L
372 #define STEALS_ITEM 040000L
373 #define STINGS 0100000L
374 #define DRAINS_LIFE 0200000L
375 #define DROPS_LEVEL 0400000L
376 #define SEEKS_GOLD 01000000L
377 #define FREEZING_ROGUE 02000000L
378 #define RUST_VANISHED 04000000L
379 #define CONFUSES 010000000L
380 #define IMITATES 020000000L
381 #define FLAMES 040000000L
382 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */
383 #define NAPPING 0200000000L /* can't wake up for a while */
384 #define ALREADY_MOVED 0400000000L
386 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
388 #define WAKE_PERCENT 45
389 #define FLIT_PERCENT 40
390 #define PARTY_WAKE_PERCENT 75
392 #define HYPOTHERMIA 1
394 #define POISON_DART 3
416 #define MOVE_FAILED -1
417 #define STOPPED_ON_SOMETHING -2
418 #define CANCEL '\033'
428 /* external routine declarations.
430 const char *mon_name();
431 const char *get_ench_color();
432 const char *name_of();
433 const char *md_gln();
436 boolean is_direction();
441 boolean check_hunger();
444 boolean has_been_touched();
445 object *add_to_pack();
446 object *alloc_object();
447 object *get_letter_object();
448 object *gr_monster();
449 object *get_thrown_at_monster();
450 object *get_zapped_monster();
451 object *check_duplicate();
455 struct id *get_id_table();
456 unsigned short gr_what_is();
457 #define rrandom random
458 #define srrandom(x) srandomdev()
461 void byebye(), onintr(), error_save();
464 short year; /* >= 1987 */
465 short month; /* 1 - 12 */
466 short day; /* 1 - 31 */
467 short hour; /* 0 - 23 */
468 short minute; /* 0 - 59 */
469 short second; /* 0 - 59 */
478 typedef struct _win_st WINDOW;
480 extern int LINES, COLS;
481 extern WINDOW *curscr;