xref: /original-bsd/games/rogue/rogue.h (revision b0d0e5d6)
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  * %sccs.include.redist.c%
9  *
10  *	@(#)rogue.h	8.1 (Berkeley) 05/31/93
11  */
12 
13 /*
14  * rogue.h
15  *
16  * This source herein may be modified and/or distributed by anybody who
17  * so desires, with the following restrictions:
18  *    1.)  This notice shall not be removed.
19  *    2.)  Credit shall not be taken for the creation of this source.
20  *    3.)  This code is not to be traded, sold, or used for personal
21  *         gain or profit.
22  */
23 
24 #define boolean char
25 
26 #define NOTHING		((unsigned short)     0)
27 #define OBJECT		((unsigned short)    01)
28 #define MONSTER		((unsigned short)    02)
29 #define STAIRS		((unsigned short)    04)
30 #define HORWALL		((unsigned short)   010)
31 #define VERTWALL	((unsigned short)   020)
32 #define DOOR		((unsigned short)   040)
33 #define FLOOR		((unsigned short)  0100)
34 #define TUNNEL		((unsigned short)  0200)
35 #define TRAP		((unsigned short)  0400)
36 #define HIDDEN		((unsigned short) 01000)
37 
38 #define ARMOR		((unsigned short)   01)
39 #define WEAPON		((unsigned short)   02)
40 #define SCROL		((unsigned short)   04)
41 #define POTION		((unsigned short)  010)
42 #define GOLD		((unsigned short)  020)
43 #define FOOD		((unsigned short)  040)
44 #define WAND		((unsigned short) 0100)
45 #define RING		((unsigned short) 0200)
46 #define AMULET		((unsigned short) 0400)
47 #define ALL_OBJECTS	((unsigned short) 0777)
48 
49 #define LEATHER 0
50 #define RINGMAIL 1
51 #define SCALE 2
52 #define CHAIN 3
53 #define BANDED 4
54 #define SPLINT 5
55 #define PLATE 6
56 #define ARMORS 7
57 
58 #define BOW 0
59 #define DART 1
60 #define ARROW 2
61 #define DAGGER 3
62 #define SHURIKEN 4
63 #define MACE 5
64 #define LONG_SWORD 6
65 #define TWO_HANDED_SWORD 7
66 #define WEAPONS 8
67 
68 #define MAX_PACK_COUNT 24
69 
70 #define PROTECT_ARMOR 0
71 #define HOLD_MONSTER 1
72 #define ENCH_WEAPON 2
73 #define ENCH_ARMOR 3
74 #define IDENTIFY 4
75 #define TELEPORT 5
76 #define SLEEP 6
77 #define SCARE_MONSTER 7
78 #define REMOVE_CURSE 8
79 #define CREATE_MONSTER 9
80 #define AGGRAVATE_MONSTER 10
81 #define MAGIC_MAPPING 11
82 #define CON_MON 12
83 #define SCROLS 13
84 
85 #define INCREASE_STRENGTH 0
86 #define RESTORE_STRENGTH 1
87 #define HEALING 2
88 #define EXTRA_HEALING 3
89 #define POISON 4
90 #define RAISE_LEVEL 5
91 #define BLINDNESS 6
92 #define HALLUCINATION 7
93 #define DETECT_MONSTER 8
94 #define DETECT_OBJECTS 9
95 #define CONFUSION 10
96 #define LEVITATION 11
97 #define HASTE_SELF 12
98 #define SEE_INVISIBLE 13
99 #define POTIONS 14
100 
101 #define TELE_AWAY 0
102 #define SLOW_MONSTER 1
103 #define INVISIBILITY 2
104 #define POLYMORPH 3
105 #define HASTE_MONSTER 4
106 #define MAGIC_MISSILE 5
107 #define CANCELLATION 6
108 #define DO_NOTHING 7
109 #define DRAIN_LIFE 8
110 #define COLD 9
111 #define FIRE 10
112 #define WANDS 11
113 
114 #define STEALTH 0
115 #define R_TELEPORT 1
116 #define REGENERATION 2
117 #define SLOW_DIGEST 3
118 #define ADD_STRENGTH 4
119 #define SUSTAIN_STRENGTH 5
120 #define DEXTERITY 6
121 #define ADORNMENT 7
122 #define R_SEE_INVISIBLE 8
123 #define MAINTAIN_ARMOR 9
124 #define SEARCHING 10
125 #define RINGS 11
126 
127 #define RATION 0
128 #define FRUIT 1
129 
130 #define NOT_USED		((unsigned short)   0)
131 #define BEING_WIELDED	((unsigned short)  01)
132 #define BEING_WORN		((unsigned short)  02)
133 #define ON_LEFT_HAND	((unsigned short)  04)
134 #define ON_RIGHT_HAND	((unsigned short) 010)
135 #define ON_EITHER_HAND	((unsigned short) 014)
136 #define BEING_USED		((unsigned short) 017)
137 
138 #define NO_TRAP -1
139 #define TRAP_DOOR 0
140 #define BEAR_TRAP 1
141 #define TELE_TRAP 2
142 #define DART_TRAP 3
143 #define SLEEPING_GAS_TRAP 4
144 #define RUST_TRAP 5
145 #define TRAPS 6
146 
147 #define STEALTH_FACTOR 3
148 #define R_TELE_PERCENT 8
149 
150 #define UNIDENTIFIED ((unsigned short) 00)	/* MUST BE ZERO! */
151 #define IDENTIFIED ((unsigned short) 01)
152 #define CALLED ((unsigned short) 02)
153 
154 #define DROWS 24
155 #define DCOLS 80
156 #define NMESSAGES 5
157 #define MAX_TITLE_LENGTH 30
158 #define MAXSYLLABLES 40
159 #define MAX_METAL 14
160 #define WAND_MATERIALS 30
161 #define GEMS 14
162 
163 #define GOLD_PERCENT 46
164 
165 #define MAX_OPT_LEN 40
166 
167 struct id {
168 	short value;
169 	char *title;
170 	char *real;
171 	unsigned short id_status;
172 };
173 
174 /* The following #defines provide more meaningful names for some of the
175  * struct object fields that are used for monsters.  This, since each monster
176  * and object (scrolls, potions, etc) are represented by a struct object.
177  * Ideally, this should be handled by some kind of union structure.
178  */
179 
180 #define m_damage damage
181 #define hp_to_kill quantity
182 #define m_char ichar
183 #define first_level is_protected
184 #define last_level is_cursed
185 #define m_hit_chance class
186 #define stationary_damage identified
187 #define drop_percent which_kind
188 #define trail_char d_enchant
189 #define slowed_toggle quiver
190 #define moves_confused hit_enchant
191 #define nap_length picked_up
192 #define disguise what_is
193 #define next_monster next_object
194 
195 struct obj {				/* comment is monster meaning */
196 	unsigned long m_flags;	/* monster flags */
197 	char *damage;			/* damage it does */
198 	short quantity;			/* hit points to kill */
199 	short ichar;			/* 'A' is for aquatar */
200 	short kill_exp;			/* exp for killing it */
201 	short is_protected;		/* level starts */
202 	short is_cursed;		/* level ends */
203 	short class;			/* chance of hitting you */
204 	short identified;		/* 'F' damage, 1,2,3... */
205 	unsigned short which_kind; /* item carry/drop % */
206 	short o_row, o_col, o;	/* o is how many times stuck at o_row, o_col */
207 	short row, col;			/* current row, col */
208 	short d_enchant;		/* room char when detect_monster */
209 	short quiver;			/* monster slowed toggle */
210 	short trow, tcol;		/* target row, col */
211 	short hit_enchant;		/* how many moves is confused */
212 	unsigned short what_is;	/* imitator's charactor (?!%: */
213 	short picked_up;		/* sleep from wand of sleep */
214 	unsigned short in_use_flags;
215 	struct obj *next_object;	/* next monster */
216 };
217 
218 typedef struct obj object;
219 
220 #define INIT_AW (object*)0,(object*)0
221 #define INIT_RINGS (object*)0,(object*)0
222 #define INIT_HP 12,12
223 #define INIT_STR 16,16
224 #define INIT_EXP 1,0
225 #define INIT_PACK {0}
226 #define INIT_GOLD 0
227 #define INIT_CHAR '@'
228 #define INIT_MOVES 1250
229 
230 struct fightr {
231 	object *armor;
232 	object *weapon;
233 	object *left_ring, *right_ring;
234 	short hp_current;
235 	short hp_max;
236 	short str_current;
237 	short str_max;
238 	object pack;
239 	long gold;
240 	short exp;
241 	long exp_points;
242 	short row, col;
243 	short fchar;
244 	short moves_left;
245 };
246 
247 typedef struct fightr fighter;
248 
249 struct dr {
250 	short oth_room;
251 	short oth_row,
252 	      oth_col;
253 	short door_row,
254 		  door_col;
255 };
256 
257 typedef struct dr door;
258 
259 struct rm {
260 	short bottom_row, right_col, left_col, top_row;
261 	door doors[4];
262 	unsigned short is_room;
263 };
264 
265 typedef struct rm room;
266 
267 #define MAXROOMS 9
268 #define BIG_ROOM 10
269 
270 #define NO_ROOM -1
271 
272 #define PASSAGE -3		/* cur_room value */
273 
274 #define AMULET_LEVEL 26
275 
276 #define R_NOTHING	((unsigned short) 01)
277 #define R_ROOM		((unsigned short) 02)
278 #define R_MAZE		((unsigned short) 04)
279 #define R_DEADEND	((unsigned short) 010)
280 #define R_CROSS		((unsigned short) 020)
281 
282 #define MAX_EXP_LEVEL 21
283 #define MAX_EXP 10000001L
284 #define MAX_GOLD 999999
285 #define MAX_ARMOR 99
286 #define MAX_HP 999
287 #define MAX_STRENGTH 99
288 #define LAST_DUNGEON 99
289 
290 #define STAT_LEVEL 01
291 #define STAT_GOLD 02
292 #define STAT_HP 04
293 #define STAT_STRENGTH 010
294 #define STAT_ARMOR 020
295 #define STAT_EXP 040
296 #define STAT_HUNGER 0100
297 #define STAT_LABEL 0200
298 #define STAT_ALL 0377
299 
300 #define PARTY_TIME 10	/* one party somewhere in each 10 level span */
301 
302 #define MAX_TRAPS 10	/* maximum traps per level */
303 
304 #define HIDE_PERCENT 12
305 
306 struct tr {
307 	short trap_type;
308 	short trap_row, trap_col;
309 };
310 
311 typedef struct tr trap;
312 
313 extern fighter rogue;
314 extern room rooms[];
315 extern trap traps[];
316 extern unsigned short dungeon[DROWS][DCOLS];
317 extern object level_objects;
318 
319 extern struct id id_scrolls[];
320 extern struct id id_potions[];
321 extern struct id id_wands[];
322 extern struct id id_rings[];
323 extern struct id id_weapons[];
324 extern struct id id_armors[];
325 
326 extern object mon_tab[];
327 extern object level_monsters;
328 
329 #define MONSTERS 26
330 
331 #define HASTED					01L
332 #define SLOWED					02L
333 #define INVISIBLE				04L
334 #define ASLEEP				   010L
335 #define WAKENS				   020L
336 #define WANDERS				   040L
337 #define FLIES				  0100L
338 #define FLITS				  0200L
339 #define CAN_FLIT			  0400L		/* can, but usually doesn't, flit */
340 #define CONFUSED	 		 01000L
341 #define RUSTS				 02000L
342 #define HOLDS				 04000L
343 #define FREEZES				010000L
344 #define STEALS_GOLD			020000L
345 #define STEALS_ITEM			040000L
346 #define STINGS			   0100000L
347 #define DRAINS_LIFE		   0200000L
348 #define DROPS_LEVEL		   0400000L
349 #define SEEKS_GOLD		  01000000L
350 #define FREEZING_ROGUE	  02000000L
351 #define RUST_VANISHED	  04000000L
352 #define CONFUSES		 010000000L
353 #define IMITATES		 020000000L
354 #define FLAMES			 040000000L
355 #define STATIONARY		0100000000L		/* damage will be 1,2,3,... */
356 #define NAPPING			0200000000L		/* can't wake up for a while */
357 #define ALREADY_MOVED	0400000000L
358 
359 #define SPECIAL_HIT		(RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
360 
361 #define WAKE_PERCENT 45
362 #define FLIT_PERCENT 40
363 #define PARTY_WAKE_PERCENT 75
364 
365 #define HYPOTHERMIA 1
366 #define STARVATION 2
367 #define POISON_DART 3
368 #define QUIT 4
369 #define WIN 5
370 #define KFIRE 6
371 
372 #define UPWARD 0
373 #define UPRIGHT 1
374 #define RIGHT 2
375 #define DOWNRIGHT 3
376 #define DOWN 4
377 #define DOWNLEFT 5
378 #define LEFT 6
379 #define UPLEFT 7
380 #define DIRS 8
381 
382 #define ROW1 7
383 #define ROW2 15
384 
385 #define COL1 26
386 #define COL2 52
387 
388 #define MOVED 0
389 #define MOVE_FAILED -1
390 #define STOPPED_ON_SOMETHING -2
391 #define CANCEL '\033'
392 #define LIST '*'
393 
394 #define HUNGRY 300
395 #define WEAK 150
396 #define FAINT 20
397 #define STARVE 0
398 
399 #define MIN_ROW 1
400 
401 /* external routine declarations.
402  */
403 char *strcpy();
404 char *strncpy();
405 char *strcat();
406 
407 char *mon_name();
408 char *get_ench_color();
409 char *name_of();
410 char *md_gln();
411 char *md_getenv();
412 char *md_malloc();
413 boolean is_direction();
414 boolean mon_sees();
415 boolean mask_pack();
416 boolean mask_room();
417 boolean is_digit();
418 boolean check_hunger();
419 boolean reg_move();
420 boolean md_df();
421 boolean has_been_touched();
422 object *add_to_pack();
423 object *alloc_object();
424 object *get_letter_object();
425 object *gr_monster();
426 object *get_thrown_at_monster();
427 object *get_zapped_monster();
428 object *check_duplicate();
429 object *gr_object();
430 object *object_at();
431 object *pick_up();
432 struct id *get_id_table();
433 unsigned short gr_what_is();
434 long rrandom();
435 long lget_number();
436 long xxx();
437 void byebye(), onintr(), error_save();
438 
439 struct rogue_time {
440 	short year;		/* >= 1987 */
441 	short month;	/* 1 - 12 */
442 	short day;		/* 1 - 31 */
443 	short hour;		/* 0 - 23 */
444 	short minute;	/* 0 - 59 */
445 	short second;	/* 0 - 59 */
446 };
447 
448 #ifdef CURSES
449 struct _win_st {
450 	short _cury, _curx;
451 	short _maxy, _maxx;
452 };
453 
454 typedef struct _win_st WINDOW;
455 
456 extern int LINES, COLS;
457 extern WINDOW *curscr;
458 extern char *CL;
459 
460 char *md_gdtcf();
461 
462 #else
463 #include <curses.h>
464 #endif
465