]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - games/rogue/rogue.h
This commit was generated by cvs2svn to compensate for changes in r64583,
[FreeBSD/FreeBSD.git] / games / rogue / rogue.h
1 /*
2  * Copyright (c) 1988, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Timoth C. Stoehr.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
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.
23  *
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
34  * SUCH DAMAGE.
35  *
36  *      @(#)rogue.h     8.1 (Berkeley) 5/31/93
37  */
38
39 #include <string.h>
40 /*
41  * rogue.h
42  *
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
48  *         gain or profit.
49  */
50
51 #define boolean char
52
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)
64
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)
75
76 #define LEATHER 0
77 #define RINGMAIL 1
78 #define SCALE 2
79 #define CHAIN 3
80 #define BANDED 4
81 #define SPLINT 5
82 #define PLATE 6
83 #define ARMORS 7
84
85 #define BOW 0
86 #define DART 1
87 #define ARROW 2
88 #define DAGGER 3
89 #define SHURIKEN 4
90 #define MACE 5
91 #define LONG_SWORD 6
92 #define TWO_HANDED_SWORD 7
93 #define WEAPONS 8
94
95 #define MAX_PACK_COUNT 24
96
97 #define PROTECT_ARMOR 0
98 #define HOLD_MONSTER 1
99 #define ENCH_WEAPON 2
100 #define ENCH_ARMOR 3
101 #define IDENTIFY 4
102 #define TELEPORT 5
103 #define SLEEP 6
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
109 #define CON_MON 12
110 #define SCROLS 13
111
112 #define INCREASE_STRENGTH 0
113 #define RESTORE_STRENGTH 1
114 #define HEALING 2
115 #define EXTRA_HEALING 3
116 #define POISON 4
117 #define RAISE_LEVEL 5
118 #define BLINDNESS 6
119 #define HALLUCINATION 7
120 #define DETECT_MONSTER 8
121 #define DETECT_OBJECTS 9
122 #define CONFUSION 10
123 #define LEVITATION 11
124 #define HASTE_SELF 12
125 #define SEE_INVISIBLE 13
126 #define POTIONS 14
127
128 #define TELE_AWAY 0
129 #define SLOW_MONSTER 1
130 #define INVISIBILITY 2
131 #define POLYMORPH 3
132 #define HASTE_MONSTER 4
133 #define MAGIC_MISSILE 5
134 #define CANCELLATION 6
135 #define DO_NOTHING 7
136 #define DRAIN_LIFE 8
137 #define COLD 9
138 #define FIRE 10
139 #define WANDS 11
140
141 #define STEALTH 0
142 #define R_TELEPORT 1
143 #define REGENERATION 2
144 #define SLOW_DIGEST 3
145 #define ADD_STRENGTH 4
146 #define SUSTAIN_STRENGTH 5
147 #define DEXTERITY 6
148 #define ADORNMENT 7
149 #define R_SEE_INVISIBLE 8
150 #define MAINTAIN_ARMOR 9
151 #define SEARCHING 10
152 #define RINGS 11
153
154 #define RATION 0
155 #define FRUIT 1
156
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)
164
165 #define NO_TRAP -1
166 #define TRAP_DOOR 0
167 #define BEAR_TRAP 1
168 #define TELE_TRAP 2
169 #define DART_TRAP 3
170 #define SLEEPING_GAS_TRAP 4
171 #define RUST_TRAP 5
172 #define TRAPS 6
173
174 #define STEALTH_FACTOR 3
175 #define R_TELE_PERCENT 8
176
177 #define UNIDENTIFIED ((unsigned short) 00)      /* MUST BE ZERO! */
178 #define IDENTIFIED ((unsigned short) 01)
179 #define CALLED ((unsigned short) 02)
180
181 #define DROWS 24
182 #define DCOLS 80
183 #define NMESSAGES 5
184 #define MAX_TITLE_LENGTH 30
185 #define MAXSYLLABLES 40
186 #define MAX_METAL 14
187 #define WAND_MATERIALS 30
188 #define GEMS 14
189
190 #define GOLD_PERCENT 46
191
192 #define MAX_OPT_LEN 40
193
194 struct id {
195         short value;
196         char *title;
197         char *real;
198         unsigned short id_status;
199 };
200
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.
205  */
206
207 #define m_damage damage
208 #define hp_to_kill quantity
209 #define m_char ichar
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
221
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 */
243 };
244
245 typedef struct obj object;
246
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
251 #define INIT_EXP 1,0
252 #define INIT_PACK {0}
253 #define INIT_GOLD 0
254 #define INIT_CHAR '@'
255 #define INIT_MOVES 1250
256
257 struct fightr {
258         object *armor;
259         object *weapon;
260         object *left_ring, *right_ring;
261         short hp_current;
262         short hp_max;
263         short str_current;
264         short str_max;
265         object pack;
266         long gold;
267         short exp;
268         long exp_points;
269         short row, col;
270         short fchar;
271         short moves_left;
272 };
273
274 typedef struct fightr fighter;
275
276 struct dr {
277         short oth_room;
278         short oth_row,
279               oth_col;
280         short door_row,
281                   door_col;
282 };
283
284 typedef struct dr door;
285
286 struct rm {
287         short bottom_row, right_col, left_col, top_row;
288         door doors[4];
289         unsigned short is_room;
290 };
291
292 typedef struct rm room;
293
294 #define MAXROOMS 9
295 #define BIG_ROOM 10
296
297 #define NO_ROOM -1
298
299 #define PASSAGE -3              /* cur_room value */
300
301 #define AMULET_LEVEL 26
302
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)
308
309 #define MAX_EXP_LEVEL 21
310 #define MAX_EXP 10000001L
311 #define MAX_GOLD 999999
312 #define MAX_ARMOR 99
313 #define MAX_HP 999
314 #define MAX_STRENGTH 99
315 #define LAST_DUNGEON 99
316
317 #define STAT_LEVEL 01
318 #define STAT_GOLD 02
319 #define STAT_HP 04
320 #define STAT_STRENGTH 010
321 #define STAT_ARMOR 020
322 #define STAT_EXP 040
323 #define STAT_HUNGER 0100
324 #define STAT_LABEL 0200
325 #define STAT_ALL 0377
326
327 #define PARTY_TIME 10   /* one party somewhere in each 10 level span */
328
329 #define MAX_TRAPS 10    /* maximum traps per level */
330
331 #define HIDE_PERCENT 12
332
333 struct tr {
334         short trap_type;
335         short trap_row, trap_col;
336 };
337
338 typedef struct tr trap;
339
340 extern fighter rogue;
341 extern room rooms[];
342 extern trap traps[];
343 extern unsigned short dungeon[DROWS][DCOLS];
344 extern object level_objects;
345
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[];
352
353 extern object mon_tab[];
354 extern object level_monsters;
355
356 #define MONSTERS 26
357
358 #define HASTED                                  01L
359 #define SLOWED                                  02L
360 #define INVISIBLE                               04L
361 #define ASLEEP                             010L
362 #define WAKENS                             020L
363 #define WANDERS                            040L
364 #define FLIES                             0100L
365 #define FLITS                             0200L
366 #define CAN_FLIT                          0400L         /* can, but usually doesn't, flit */
367 #define CONFUSED                         01000L
368 #define RUSTS                            02000L
369 #define HOLDS                            04000L
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
385
386 #define SPECIAL_HIT             (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
387
388 #define WAKE_PERCENT 45
389 #define FLIT_PERCENT 40
390 #define PARTY_WAKE_PERCENT 75
391
392 #define HYPOTHERMIA 1
393 #define STARVATION 2
394 #define POISON_DART 3
395 #define QUIT 4
396 #define WIN 5
397 #define KFIRE 6
398
399 #define UPWARD 0
400 #define UPRIGHT 1
401 #define RIGHT 2
402 #define DOWNRIGHT 3
403 #define DOWN 4
404 #define DOWNLEFT 5
405 #define LEFT 6
406 #define UPLEFT 7
407 #define DIRS 8
408
409 #define ROW1 7
410 #define ROW2 15
411
412 #define COL1 26
413 #define COL2 52
414
415 #define MOVED 0
416 #define MOVE_FAILED -1
417 #define STOPPED_ON_SOMETHING -2
418 #define CANCEL '\033'
419 #define LIST '*'
420
421 #define HUNGRY 300
422 #define WEAK 150
423 #define FAINT 20
424 #define STARVE 0
425
426 #define MIN_ROW 1
427
428 /* external routine declarations.
429  */
430 const char *mon_name();
431 const char *get_ench_color();
432 const char *name_of();
433 const char *md_gln();
434 char *md_getenv();
435 char *md_malloc();
436 boolean is_direction();
437 boolean mon_sees();
438 boolean mask_pack();
439 boolean mask_room();
440 boolean is_digit();
441 boolean check_hunger();
442 boolean reg_move();
443 boolean md_df();
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();
452 object *gr_object();
453 object *object_at();
454 object *pick_up();
455 struct id *get_id_table();
456 unsigned short gr_what_is();
457 #define rrandom random
458 #define srrandom(x) srandomdev()
459 long lget_number();
460 long xxx();
461 void byebye(), onintr(), error_save();
462
463 struct rogue_time {
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 */
470 };
471
472 #ifdef CURSES
473 struct _win_st {
474         short _cury, _curx;
475         short _maxy, _maxx;
476 };
477
478 typedef struct _win_st WINDOW;
479
480 extern int LINES, COLS;
481 extern WINDOW *curscr;
482 extern char *CL;
483
484 char *md_gdtcf();
485
486 #else
487 #include <curses.h>
488 #endif