Mercurial > hg > early-roguelike
comparison arogue7/rogue.h @ 125:adfa37e67084
Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
author | John "Elwin" Edwards |
---|---|
date | Fri, 08 May 2015 15:24:40 -0400 |
parents | |
children | c697782a9b37 |
comparison
equal
deleted
inserted
replaced
124:d10fc4a065ac | 125:adfa37e67084 |
---|---|
1 /* | |
2 * rogue.h - Rogue definitions and variable declarations | |
3 * | |
4 * Advanced Rogue | |
5 * Copyright (C) 1984, 1985, 1986 Michael Morgan, Ken Dalka and AT&T | |
6 * All rights reserved. | |
7 * | |
8 * Based on "Rogue: Exploring the Dungeons of Doom" | |
9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
10 * All rights reserved. | |
11 * | |
12 * See the file LICENSE.TXT for full copyright and licensing information. | |
13 */ | |
14 | |
15 /* | |
16 * Rogue definitions and variable declarations | |
17 * | |
18 */ | |
19 | |
20 #define reg register | |
21 #undef lines /* AIX's term.h defines this, causing a conflict */ | |
22 #ifdef BSD | |
23 #undef tolower(c) | |
24 #define _tolower(c) ((c)-'A'+'a') | |
25 extern char tolower(); | |
26 #undef toupper(c) | |
27 #define _toupper(c) ((c)-'a'+'A') | |
28 extern char toupper(); | |
29 #define strchr index | |
30 | |
31 #define exfork vfork /* Better way to do a fork followed by an exec */ | |
32 #else | |
33 #define exfork fork /* Standard fork with no paging available */ | |
34 #endif | |
35 | |
36 /* | |
37 * Maximum number of different things | |
38 */ | |
39 #define MAXDAEMONS 10 | |
40 #define MAXFUSES 20 | |
41 #define MAXROOMS 9 | |
42 #define MAXTHINGS 9 | |
43 #define MAXOBJ 9 | |
44 #define MAXSTATS 72 /* max total of all stats at startup */ | |
45 #define MAXPACK 23 | |
46 #define MAXDOUBLE 14 /* Maximum number of times exppts is doubled */ | |
47 #define MAXCONTENTS 10 | |
48 #define MAXENCHANT 10 /* max number of enchantments on an item */ | |
49 #define MAXTREAS 15 /* number monsters/treasure in treasure room */ | |
50 #define MAXTRAPS 25 | |
51 #define MAXTRPTRY 8 /* attempts/level allowed for setting traps */ | |
52 #define MAXDOORS 4 /* Maximum doors to a room */ | |
53 #define MAXCHANTS 16 /* Maximum number of chants for a druid */ | |
54 #define MAXPRAYERS 18 /* Maximum number of prayers for cleric */ | |
55 #define MAXSPELLS 20 /* Maximum number of spells (for magician) */ | |
56 #define MAXQUILL 13 /* scrolls the Quill of Nagrom can write */ | |
57 #define QUILLCHARGES 160 /* max num of charges in the Quill of Nagrom */ | |
58 #define NUMMONST 125 /* Current number of monsters */ | |
59 #define NUM_CNAMES 17 /* number of names per character level */ | |
60 #define NUMUNIQUE 27 /* number of UNIQUE creatures */ | |
61 #define NLEVMONS 3 /* Number of new monsters per level */ | |
62 #define NUMSCORE 10 /* number of entries in score file */ | |
63 #define HARDER 35 /* at this level start making things harder */ | |
64 #define LINELEN 256 /* characters in a buffer */ | |
65 #define JUG_EMPTY -1 /* signifys that the alchemy jug is empty */ | |
66 #define MAXPURCH (pstats.s_charisma/3) /* # of purchases at post */ | |
67 | |
68 /* Movement penalties */ | |
69 #define BACKPENALTY 3 | |
70 #define SHOTPENALTY 2 /* In line of sight of missile */ | |
71 #define DOORPENALTY 1 /* Moving out of current room */ | |
72 | |
73 /* | |
74 * these defines are used in calls to get_item() to signify what | |
75 * it is we want | |
76 */ | |
77 #define ALL -1 | |
78 #define WEARABLE -2 | |
79 #define CALLABLE -3 | |
80 #define WIELDABLE -4 | |
81 #define USEABLE -5 | |
82 #define IDENTABLE -6 | |
83 #define REMOVABLE -7 | |
84 #define PROTECTABLE -8 | |
85 #define ZAPPABLE -9 | |
86 #define READABLE -10 | |
87 #define QUAFFABLE -11 | |
88 | |
89 /* | |
90 * stuff to do with encumberance | |
91 */ | |
92 #define NORMENCB 1500 /* normal encumberance */ | |
93 #define F_SATIATED 0 /* player's stomach is very full */ | |
94 #define F_OKAY 1 /* have plenty of food in stomach */ | |
95 #define F_HUNGRY 2 /* player is hungry */ | |
96 #define F_WEAK 3 /* weak from lack of food */ | |
97 #define F_FAINT 4 /* fainting from lack of food */ | |
98 | |
99 /* | |
100 * actions a player/monster will take | |
101 */ | |
102 #define A_MOVE 0200 /* normal movement */ | |
103 #define A_FREEZE 0201 /* frozen in place */ | |
104 #define A_ATTACK 0202 /* trying to hit */ | |
105 #define A_SELL 0203 /* trying to sell goods */ | |
106 #define A_NIL 0204 /* not doing anything */ | |
107 #define A_BREATHE 0205 /* breathing */ | |
108 #define A_MISSILE 0206 /* Firing magic missiles */ | |
109 #define A_SONIC 0207 /* Sounding a sonic blast */ | |
110 #define A_SUMMON 0210 /* Summoning help */ | |
111 #define A_USERELIC 0211 /* Monster uses a relic */ | |
112 #define A_SLOW 0212 /* monster slows the player */ | |
113 #define A_ZAP 0213 /* monster shoots a wand */ | |
114 #define A_PICKUP 0214 /* player is picking something up */ | |
115 #define A_USEWAND 0215 /* monster is shooting a wand */ | |
116 #define A_THROW 't' | |
117 #define C_CAST 'C' | |
118 #define C_COUNT '*' | |
119 #define C_DIP 'D' | |
120 #define C_DROP 'd' | |
121 #define C_EAT 'e' | |
122 #define C_PRAY 'p' | |
123 #define C_CHANT 'c' | |
124 #define C_QUAFF 'q' | |
125 #define C_READ 'r' | |
126 #define C_SEARCH 's' | |
127 #define C_SETTRAP '^' | |
128 #define C_TAKEOFF 'T' | |
129 #define C_USE CTRL('U') | |
130 #define C_WEAR 'W' | |
131 #define C_WIELD 'w' | |
132 #define C_ZAP 'z' | |
133 | |
134 /* Possible ways for the hero to move */ | |
135 #define H_TELEPORT 0 | |
136 | |
137 /* | |
138 * return values for get functions | |
139 */ | |
140 #define NORM 0 /* normal exit */ | |
141 #define QUIT 1 /* quit option setting */ | |
142 #define MINUS 2 /* back up one option */ | |
143 | |
144 /* | |
145 * The character types | |
146 */ | |
147 #define C_FIGHTER 0 | |
148 #define C_RANGER 1 | |
149 #define C_PALADIN 2 | |
150 #define C_MAGICIAN 3 | |
151 #define C_CLERIC 4 | |
152 #define C_THIEF 5 | |
153 #define C_ASSASIN 6 | |
154 #define C_DRUID 7 | |
155 #define C_MONK 8 | |
156 #define C_MONSTER 9 | |
157 #define NUM_CHARTYPES 10 | |
158 | |
159 /* | |
160 * define the ability types | |
161 */ | |
162 #define A_INTELLIGENCE 0 | |
163 #define A_STRENGTH 1 | |
164 #define A_WISDOM 2 | |
165 #define A_DEXTERITY 3 | |
166 #define A_CONSTITUTION 4 | |
167 #define A_CHARISMA 5 | |
168 #define NUMABILITIES 6 | |
169 | |
170 /* | |
171 * values for games end | |
172 */ | |
173 #define UPDATE -2 | |
174 #define SCOREIT -1 | |
175 #define KILLED 0 | |
176 #define CHICKEN 1 | |
177 #define WINNER 2 | |
178 | |
179 /* | |
180 * definitions for function step_ok: | |
181 * MONSTOK indicates it is OK to step on a monster -- it | |
182 * is only OK when stepping diagonally AROUND a monster; | |
183 * it is also OK if the stepper is a friendly monster and | |
184 * is in a fighting mood. | |
185 */ | |
186 #define MONSTOK 1 | |
187 #define NOMONST 2 | |
188 #define FIGHTOK 3 | |
189 | |
190 /* | |
191 * used for ring stuff | |
192 */ | |
193 #define LEFT_1 0 | |
194 #define LEFT_2 1 | |
195 #define LEFT_3 2 | |
196 #define LEFT_4 3 | |
197 #define RIGHT_1 4 | |
198 #define RIGHT_2 5 | |
199 #define RIGHT_3 6 | |
200 #define RIGHT_4 7 | |
201 #define NUM_FINGERS 8 | |
202 | |
203 /* | |
204 * used for micellaneous magic (MM) stuff | |
205 */ | |
206 #define WEAR_BOOTS 0 | |
207 #define WEAR_BRACERS 1 | |
208 #define WEAR_CLOAK 2 | |
209 #define WEAR_GAUNTLET 3 | |
210 #define WEAR_JEWEL 4 | |
211 #define WEAR_NECKLACE 5 | |
212 #define NUM_MM 6 | |
213 | |
214 /* | |
215 * All the fun defines | |
216 */ | |
217 #define next(ptr) (*ptr).l_next | |
218 #define prev(ptr) (*ptr).l_prev | |
219 #define ldata(ptr) (*ptr).l_data | |
220 #define inroom(rp, cp) (\ | |
221 (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && (rp)->r_pos.x <= (cp)->x \ | |
222 && (cp)->y <= (rp)->r_pos.y + ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y) | |
223 #define winat(y, x) (mvwinch(mw, y, x)==' '?mvwinch(stdscr, y, x):winch(mw)) | |
224 #define debug if (wizard) msg | |
225 #define RN (((seed = seed*11109+13849) & 0x7fff) >> 1) | |
226 #define unc(cp) (cp).y, (cp).x | |
227 #define cmov(xy) move((xy).y, (xy).x) | |
228 #define DISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)) | |
229 #define OBJPTR(what) (struct object *)((*what).l_data) | |
230 #define THINGPTR(what) (struct thing *)((*what).l_data) | |
231 #define DOORPTR(what) (coord *)((*what).l_data) | |
232 #define when break;case | |
233 #define otherwise break;default | |
234 #define until(expr) while(!(expr)) | |
235 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y) | |
236 #define draw(window) wrefresh(window) | |
237 #define hero player.t_pos | |
238 #define pstats player.t_stats | |
239 #define max_stats player.maxstats | |
240 #define pack player.t_pack | |
241 #define attach(a, b) _attach(&a, b) | |
242 #define detach(a, b) _detach(&a, b) | |
243 #define o_free_list(a) _o_free_list(&a) | |
244 #define r_free_list(a) _r_free_list(&a) | |
245 #define t_free_list(a) _t_free_list(&a) | |
246 #ifndef max | |
247 #define max(a, b) ((a) > (b) ? (a) : (b)) | |
248 #define min(a, b) ((a) < (b) ? (a) : (b)) | |
249 #endif | |
250 #define on(thing, flag) \ | |
251 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) != 0) | |
252 #define off(thing, flag) \ | |
253 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) == 0) | |
254 #define turn_on(thing, flag) \ | |
255 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & ~FLAGMASK)) | |
256 #define turn_off(thing, flag) \ | |
257 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~flag) | |
258 | |
259 #undef CTRL | |
260 #define CTRL(ch) (ch & 037) | |
261 | |
262 #define ALLOC(x) calloc((unsigned int) x,1) | |
263 #define FREE(x) free((char *) x) | |
264 #define EQSTR(a, b, c) (strncmp(a, b, c) == 0) | |
265 #define EQUAL(a, b) (strcmp(a, b) == 0) | |
266 #define GOLDCALC (rnd(50 + 10 * level) + 2) | |
267 #define ISRING(h, r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r) | |
268 #define ISWEARING(r) (ISRING(LEFT_1, r) || ISRING(LEFT_2, r) ||\ | |
269 ISRING(LEFT_3, r) || ISRING(LEFT_4, r) ||\ | |
270 ISRING(RIGHT_1, r) || ISRING(RIGHT_2, r) ||\ | |
271 ISRING(RIGHT_3, r) || ISRING(RIGHT_4, r)) | |
272 #define newgrp() ++group | |
273 #define o_charges o_ac | |
274 #define o_kind o_ac | |
275 #define ISMULT(type) (type == FOOD) | |
276 #define isrock(ch) ((ch == WALL) || (ch == '-') || (ch == '|') || (ch == SECRETDOOR)) | |
277 #define invisible(monst) \ | |
278 (((on(*monst, ISINVIS) || \ | |
279 (on(*monst, ISSHADOW) && rnd(100) < 90)) && \ | |
280 off(player, CANSEE)) || \ | |
281 (on(*monst, CANSURPRISE) && !ISWEARING(R_ALERT))) | |
282 #define is_stealth(tp) \ | |
283 (rnd(25) < (tp)->t_stats.s_dext || (tp == &player && ISWEARING(R_STEALTH))) | |
284 | |
285 #define has_light(rp) (((rp)->r_flags & HASFIRE) || ISWEARING(R_LIGHT)) | |
286 | |
287 #define mi_wght mi_worth | |
288 #define mi_food mi_curse | |
289 | |
290 /* | |
291 * Ways to die | |
292 */ | |
293 #define D_PETRIFY -1 | |
294 #define D_ARROW -2 | |
295 #define D_DART -3 | |
296 #define D_POISON -4 | |
297 #define D_BOLT -5 | |
298 #define D_SUFFOCATION -6 | |
299 #define D_POTION -7 | |
300 #define D_INFESTATION -8 | |
301 #define D_DROWN -9 | |
302 #define D_ROT -10 | |
303 #define D_CONSTITUTION -11 | |
304 #define D_STRENGTH -12 | |
305 #define D_SIGNAL -13 | |
306 #define D_CHOKE -14 | |
307 #define D_STRANGLE -15 | |
308 #define D_FALL -16 | |
309 #define D_RELIC -17 | |
310 #define D_STARVATION -18 | |
311 #define D_FOOD_CHOKE -19 | |
312 #define D_SCROLL -20 | |
313 #define DEATHNUM 20 /* number of ways to die */ | |
314 | |
315 /* | |
316 * Things that appear on the screens | |
317 */ | |
318 #define WALL ' ' | |
319 #define PASSAGE '#' | |
320 #define DOOR '+' | |
321 #define FLOOR '.' | |
322 #define VPLAYER '@' | |
323 #define IPLAYER '_' | |
324 #define POST '^' | |
325 #define TRAPDOOR '>' | |
326 #define ARROWTRAP '{' | |
327 #define SLEEPTRAP '$' | |
328 #define BEARTRAP '}' | |
329 #define TELTRAP '~' | |
330 #define DARTTRAP '`' | |
331 #define POOL '"' | |
332 #define MAZETRAP '\'' | |
333 #define SECRETDOOR '&' | |
334 #define STAIRS '%' | |
335 #define GOLD '*' | |
336 #define POTION '!' | |
337 #define SCROLL '?' | |
338 #define MAGIC '$' | |
339 #define BMAGIC '>' /* Blessed magic */ | |
340 #define CMAGIC '<' /* Cursed magic */ | |
341 #define FOOD ':' | |
342 #define WEAPON ')' | |
343 #define MISSILE '*' /* Magic Missile */ | |
344 #define ARMOR ']' | |
345 #define MM ';' | |
346 #define RELIC ',' | |
347 #define RING '=' | |
348 #define STICK '/' | |
349 #define FOREST '\\' | |
350 | |
351 /* | |
352 * Various constants | |
353 */ | |
354 #define PASSWD "mTdNfNGDrwAZ." | |
355 #define FIGHTBASE 10 | |
356 #define SPELLTIME ((max(30-pstats.s_lvl,5))) | |
357 #define BEARTIME 17 | |
358 #define CLOAK_TIME (roll(20,20)) | |
359 #define SLEEPTIME 7 | |
360 #define FREEZETIME 11 | |
361 #define PAINTIME (roll(2, 12)) | |
362 #define HEALTIME 30 | |
363 #define CHILLTIME (roll(20, 4)) | |
364 #define SMELLTIME 20 | |
365 #define STONETIME (roll(10,2)) | |
366 #define HASTETIME 11 | |
367 #define SICKTIME 25 | |
368 #define WANDERTIME (max(5, (HARDER*2)-rnd(vlevel))) | |
369 #define BEFORE 1 | |