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