rogue.h revision 1.3 1 /* $NetBSD: rogue.h,v 1.3 1995/04/22 10:28:14 cgd Exp $ */
2
3 /*
4 * Copyright (c) 1988, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Timoth C. Stoehr.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)rogue.h 8.1 (Berkeley) 5/31/93
39 */
40
41 /*
42 * rogue.h
43 *
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
49 * gain or profit.
50 */
51
52 #define boolean char
53
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)
65
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)
76
77 #define LEATHER 0
78 #define RINGMAIL 1
79 #define SCALE 2
80 #define CHAIN 3
81 #define BANDED 4
82 #define SPLINT 5
83 #define PLATE 6
84 #define ARMORS 7
85
86 #define BOW 0
87 #define DART 1
88 #define ARROW 2
89 #define DAGGER 3
90 #define SHURIKEN 4
91 #define MACE 5
92 #define LONG_SWORD 6
93 #define TWO_HANDED_SWORD 7
94 #define WEAPONS 8
95
96 #define MAX_PACK_COUNT 24
97
98 #define PROTECT_ARMOR 0
99 #define HOLD_MONSTER 1
100 #define ENCH_WEAPON 2
101 #define ENCH_ARMOR 3
102 #define IDENTIFY 4
103 #define TELEPORT 5
104 #define SLEEP 6
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
110 #define CON_MON 12
111 #define SCROLS 13
112
113 #define INCREASE_STRENGTH 0
114 #define RESTORE_STRENGTH 1
115 #define HEALING 2
116 #define EXTRA_HEALING 3
117 #define POISON 4
118 #define RAISE_LEVEL 5
119 #define BLINDNESS 6
120 #define HALLUCINATION 7
121 #define DETECT_MONSTER 8
122 #define DETECT_OBJECTS 9
123 #define CONFUSION 10
124 #define LEVITATION 11
125 #define HASTE_SELF 12
126 #define SEE_INVISIBLE 13
127 #define POTIONS 14
128
129 #define TELE_AWAY 0
130 #define SLOW_MONSTER 1
131 #define INVISIBILITY 2
132 #define POLYMORPH 3
133 #define HASTE_MONSTER 4
134 #define MAGIC_MISSILE 5
135 #define CANCELLATION 6
136 #define DO_NOTHING 7
137 #define DRAIN_LIFE 8
138 #define COLD 9
139 #define FIRE 10
140 #define WANDS 11
141
142 #define STEALTH 0
143 #define R_TELEPORT 1
144 #define REGENERATION 2
145 #define SLOW_DIGEST 3
146 #define ADD_STRENGTH 4
147 #define SUSTAIN_STRENGTH 5
148 #define DEXTERITY 6
149 #define ADORNMENT 7
150 #define R_SEE_INVISIBLE 8
151 #define MAINTAIN_ARMOR 9
152 #define SEARCHING 10
153 #define RINGS 11
154
155 #define RATION 0
156 #define FRUIT 1
157
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)
165
166 #define NO_TRAP -1
167 #define TRAP_DOOR 0
168 #define BEAR_TRAP 1
169 #define TELE_TRAP 2
170 #define DART_TRAP 3
171 #define SLEEPING_GAS_TRAP 4
172 #define RUST_TRAP 5
173 #define TRAPS 6
174
175 #define STEALTH_FACTOR 3
176 #define R_TELE_PERCENT 8
177
178 #define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */
179 #define IDENTIFIED ((unsigned short) 01)
180 #define CALLED ((unsigned short) 02)
181
182 #define DROWS 24
183 #define DCOLS 80
184 #define NMESSAGES 5
185 #define MAX_TITLE_LENGTH 30
186 #define MAXSYLLABLES 40
187 #define MAX_METAL 14
188 #define WAND_MATERIALS 30
189 #define GEMS 14
190
191 #define GOLD_PERCENT 46
192
193 #define MAX_OPT_LEN 40
194
195 struct id {
196 short value;
197 char *title;
198 char *real;
199 unsigned short id_status;
200 };
201
202 /* The following #defines provide more meaningful names for some of the
203 * struct object fields that are used for monsters. This, since each monster
204 * and object (scrolls, potions, etc) are represented by a struct object.
205 * Ideally, this should be handled by some kind of union structure.
206 */
207
208 #define m_damage damage
209 #define hp_to_kill quantity
210 #define m_char ichar
211 #define first_level is_protected
212 #define last_level is_cursed
213 #define m_hit_chance class
214 #define stationary_damage identified
215 #define drop_percent which_kind
216 #define trail_char d_enchant
217 #define slowed_toggle quiver
218 #define moves_confused hit_enchant
219 #define nap_length picked_up
220 #define disguise what_is
221 #define next_monster next_object
222
223 struct obj { /* comment is monster meaning */
224 unsigned long m_flags; /* monster flags */
225 char *damage; /* damage it does */
226 short quantity; /* hit points to kill */
227 short ichar; /* 'A' is for aquatar */
228 short kill_exp; /* exp for killing it */
229 short is_protected; /* level starts */
230 short is_cursed; /* level ends */
231 short class; /* chance of hitting you */
232 short identified; /* 'F' damage, 1,2,3... */
233 unsigned short which_kind; /* item carry/drop % */
234 short o_row, o_col, o; /* o is how many times stuck at o_row, o_col */
235 short row, col; /* current row, col */
236 short d_enchant; /* room char when detect_monster */
237 short quiver; /* monster slowed toggle */
238 short trow, tcol; /* target row, col */
239 short hit_enchant; /* how many moves is confused */
240 unsigned short what_is; /* imitator's charactor (?!%: */
241 short picked_up; /* sleep from wand of sleep */
242 unsigned short in_use_flags;
243 struct obj *next_object; /* next monster */
244 };
245
246 typedef struct obj object;
247
248 #define INIT_AW (object*)0,(object*)0
249 #define INIT_RINGS (object*)0,(object*)0
250 #define INIT_HP 12,12
251 #define INIT_STR 16,16
252 #define INIT_EXP 1,0
253 #define INIT_PACK {0}
254 #define INIT_GOLD 0
255 #define INIT_CHAR '@'
256 #define INIT_MOVES 1250
257
258 struct fightr {
259 object *armor;
260 object *weapon;
261 object *left_ring, *right_ring;
262 short hp_current;
263 short hp_max;
264 short str_current;
265 short str_max;
266 object pack;
267 long gold;
268 short exp;
269 long exp_points;
270 short row, col;
271 short fchar;
272 short moves_left;
273 };
274
275 typedef struct fightr fighter;
276
277 struct dr {
278 short oth_room;
279 short oth_row,
280 oth_col;
281 short door_row,
282 door_col;
283 };
284
285 typedef struct dr door;
286
287 struct rm {
288 short bottom_row, right_col, left_col, top_row;
289 door doors[4];
290 unsigned short is_room;
291 };
292
293 typedef struct rm room;
294
295 #define MAXROOMS 9
296 #define BIG_ROOM 10
297
298 #define NO_ROOM -1
299
300 #define PASSAGE -3 /* cur_room value */
301
302 #define AMULET_LEVEL 26
303
304 #define R_NOTHING ((unsigned short) 01)
305 #define R_ROOM ((unsigned short) 02)
306 #define R_MAZE ((unsigned short) 04)
307 #define R_DEADEND ((unsigned short) 010)
308 #define R_CROSS ((unsigned short) 020)
309
310 #define MAX_EXP_LEVEL 21
311 #define MAX_EXP 10000001L
312 #define MAX_GOLD 999999
313 #define MAX_ARMOR 99
314 #define MAX_HP 999
315 #define MAX_STRENGTH 99
316 #define LAST_DUNGEON 99
317
318 #define STAT_LEVEL 01
319 #define STAT_GOLD 02
320 #define STAT_HP 04
321 #define STAT_STRENGTH 010
322 #define STAT_ARMOR 020
323 #define STAT_EXP 040
324 #define STAT_HUNGER 0100
325 #define STAT_LABEL 0200
326 #define STAT_ALL 0377
327
328 #define PARTY_TIME 10 /* one party somewhere in each 10 level span */
329
330 #define MAX_TRAPS 10 /* maximum traps per level */
331
332 #define HIDE_PERCENT 12
333
334 struct tr {
335 short trap_type;
336 short trap_row, trap_col;
337 };
338
339 typedef struct tr trap;
340
341 extern fighter rogue;
342 extern room rooms[];
343 extern trap traps[];
344 extern unsigned short dungeon[DROWS][DCOLS];
345 extern object level_objects;
346
347 extern struct id id_scrolls[];
348 extern struct id id_potions[];
349 extern struct id id_wands[];
350 extern struct id id_rings[];
351 extern struct id id_weapons[];
352 extern struct id id_armors[];
353
354 extern object mon_tab[];
355 extern object level_monsters;
356
357 #define MONSTERS 26
358
359 #define HASTED 01L
360 #define SLOWED 02L
361 #define INVISIBLE 04L
362 #define ASLEEP 010L
363 #define WAKENS 020L
364 #define WANDERS 040L
365 #define FLIES 0100L
366 #define FLITS 0200L
367 #define CAN_FLIT 0400L /* can, but usually doesn't, flit */
368 #define CONFUSED 01000L
369 #define RUSTS 02000L
370 #define HOLDS 04000L
371 #define FREEZES 010000L
372 #define STEALS_GOLD 020000L
373 #define STEALS_ITEM 040000L
374 #define STINGS 0100000L
375 #define DRAINS_LIFE 0200000L
376 #define DROPS_LEVEL 0400000L
377 #define SEEKS_GOLD 01000000L
378 #define FREEZING_ROGUE 02000000L
379 #define RUST_VANISHED 04000000L
380 #define CONFUSES 010000000L
381 #define IMITATES 020000000L
382 #define FLAMES 040000000L
383 #define STATIONARY 0100000000L /* damage will be 1,2,3,... */
384 #define NAPPING 0200000000L /* can't wake up for a while */
385 #define ALREADY_MOVED 0400000000L
386
387 #define SPECIAL_HIT (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
388
389 #define WAKE_PERCENT 45
390 #define FLIT_PERCENT 40
391 #define PARTY_WAKE_PERCENT 75
392
393 #define HYPOTHERMIA 1
394 #define STARVATION 2
395 #define POISON_DART 3
396 #define QUIT 4
397 #define WIN 5
398 #define KFIRE 6
399
400 #define UPWARD 0
401 #define UPRIGHT 1
402 #define RIGHT 2
403 #define DOWNRIGHT 3
404 #define DOWN 4
405 #define DOWNLEFT 5
406 #define LEFT 6
407 #define UPLEFT 7
408 #define DIRS 8
409
410 #define ROW1 7
411 #define ROW2 15
412
413 #define COL1 26
414 #define COL2 52
415
416 #define MOVED 0
417 #define MOVE_FAILED -1
418 #define STOPPED_ON_SOMETHING -2
419 #define CANCEL '\033'
420 #define LIST '*'
421
422 #define HUNGRY 300
423 #define WEAK 150
424 #define FAINT 20
425 #define STARVE 0
426
427 #define MIN_ROW 1
428
429 /* external routine declarations.
430 */
431 char *strcpy();
432 char *strncpy();
433 char *strcat();
434
435 char *mon_name();
436 char *get_ench_color();
437 char *name_of();
438 char *md_gln();
439 char *md_getenv();
440 char *md_malloc();
441 boolean is_direction();
442 boolean mon_sees();
443 boolean mask_pack();
444 boolean mask_room();
445 boolean is_digit();
446 boolean check_hunger();
447 boolean reg_move();
448 boolean md_df();
449 boolean has_been_touched();
450 object *add_to_pack();
451 object *alloc_object();
452 object *get_letter_object();
453 object *gr_monster();
454 object *get_thrown_at_monster();
455 object *get_zapped_monster();
456 object *check_duplicate();
457 object *gr_object();
458 object *object_at();
459 object *pick_up();
460 struct id *get_id_table();
461 unsigned short gr_what_is();
462 long rrandom();
463 long lget_number();
464 long xxx();
465 void byebye(), onintr(), error_save();
466
467 struct rogue_time {
468 short year; /* >= 1987 */
469 short month; /* 1 - 12 */
470 short day; /* 1 - 31 */
471 short hour; /* 0 - 23 */
472 short minute; /* 0 - 59 */
473 short second; /* 0 - 59 */
474 };
475
476 #ifdef CURSES
477 struct _win_st {
478 short _cury, _curx;
479 short _maxy, _maxx;
480 };
481
482 typedef struct _win_st WINDOW;
483
484 extern int LINES, COLS;
485 extern WINDOW *curscr;
486 extern char *CL;
487
488 char *md_gdtcf();
489
490 #else
491 #include <curses.h>
492 #endif
493