comparison arogue5/rogue.h @ 63:0ed67132cf10

Import Advanced Rogue 5.8 from the Roguelike Restoration Project (r1490)
author elwin
date Thu, 09 Aug 2012 22:58:48 +0000
parents
children a98834ce7e04
comparison
equal deleted inserted replaced
62:0ef99244acb8 63:0ed67132cf10
1 /*
2 * Rogue definitions and variable declarations
3 *
4 * Advanced Rogue
5 * Copyright (C) 1984, 1985 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 #define reg register /* register abbr. */
16 #define NOOP(x) (x += 0)
17 #define CCHAR(x) ( (char) (x & A_CHARTEXT) )
18
19 /*
20 * Maximum number of different things
21 */
22
23 #define MAXDAEMONS 10
24 #define MAXFUSES 20
25
26 #define NCOLORS 32
27 #define NSTONES 47
28 #define NWOOD 24
29 #define NMETAL 16
30 #define NSYLLS 159
31
32 #define MAXROOMS 9
33 #define MAXTHINGS 9
34 #define MAXOBJ 9
35 #define MAXSTATS 62 /* max total of all stats at startup */
36 #define MAXPACK 23
37 #define MAXCONTENTS 10
38 #define MAXENCHANT 10 /* max number of enchantments on an item */
39 #define MAXTREAS 15 /* number monsters/treasure in treasure room */
40 #define MAXTRAPS 20
41 #define MAXTRPTRY 8 /* attempts/level allowed for setting traps */
42 #define MAXDOORS 4 /* Maximum doors to a room */
43 #define MAXPRAYERS 15 /* Maximum number of prayers for cleric */
44 #define MAXSPELLS 20 /* Maximum number of spells (for magician) */
45 #define NUMMONST 120 /* Current number of monsters */
46 #define NUMUNIQUE 24 /* number of UNIQUE creatures */
47 #define NLEVMONS 3 /* Number of new monsters per level */
48 #define MAXFOODS 1
49 #define NUMSCORE 20 /* number of entries in score file */
50 #define HARDER 35 /* at this level start making things harder */
51 #define MAXPURCH 4 /* max purchases per trading post visit */
52 #define LINELEN 80 /* characters in a buffer */
53 #define JUG_EMPTY -1 /* signifys that the alchemy jug is empty */
54
55 /* Movement penalties */
56 #define BACKPENALTY 3
57 #define SHOTPENALTY 2 /* In line of sight of missile */
58 #define DOORPENALTY 1 /* Moving out of current room */
59
60 /*
61 * these defines are used in calls to get_item() to signify what
62 * it is we want
63 */
64 #define ALL -1
65 #define WEARABLE -2
66 #define CALLABLE -3
67 #define WIELDABLE -4
68 #define USEABLE -5
69 #define IDENTABLE -6
70 #define REMOVABLE -7
71 #define PROTECTABLE -8
72 #define ZAPPABLE -9
73
74 /*
75 * stuff to do with encumberance
76 */
77 #define NORMENCB 1500 /* normal encumberance */
78 #define F_OKAY 0 /* have plenty of food in stomach */
79 #define F_HUNGRY 1 /* player is hungry */
80 #define F_WEAK 2 /* weak from lack of food */
81 #define F_FAINT 3 /* fainting from lack of food */
82
83 /*
84 * return values for get functions
85 */
86 #define NORM 0 /* normal exit */
87 #define QUIT 1 /* quit option setting */
88 #define MINUS 2 /* back up one option */
89
90 /*
91 * The character types
92 */
93 #define C_FIGHTER 0
94 #define C_MAGICIAN 1
95 #define C_CLERIC 2
96 #define C_THIEF 3
97 #define C_MONSTER 4
98
99 /*
100 * Number of hit points for going up a level
101 */
102 #define HIT_FIGHTER 10
103 #define HIT_MAGICIAN 8
104 #define HIT_CLERIC 8
105 #define HIT_THIEF 6
106
107 /*
108 * values for games end
109 */
110 #define UPDATE -2
111 #define SCOREIT -1
112 #define KILLED 0
113 #define CHICKEN 1
114 #define WINNER 2
115
116 /*
117 * definitions for function step_ok:
118 * MONSTOK indicates it is OK to step on a monster -- it
119 * is only OK when stepping diagonally AROUND a monster
120 */
121 #define MONSTOK 1
122 #define NOMONST 2
123
124 /*
125 * used for ring stuff
126 */
127 #define LEFT_1 0
128 #define LEFT_2 1
129 #define LEFT_3 2
130 #define LEFT_4 3
131 #define RIGHT_1 4
132 #define RIGHT_2 5
133 #define RIGHT_3 6
134 #define RIGHT_4 7
135 #define NUM_FINGERS 8
136
137 /*
138 * used for micellaneous magic (MM) stuff
139 */
140 #define WEAR_BOOTS 0
141 #define WEAR_BRACERS 1
142 #define WEAR_CLOAK 2
143 #define WEAR_GAUNTLET 3
144 #define WEAR_JEWEL 4
145 #define WEAR_NECKLACE 5
146 #define NUM_MM 6
147
148 /*
149 * All the fun defines
150 */
151 #define next(ptr) (*ptr).l_next
152 #define prev(ptr) (*ptr).l_prev
153 #define ldata(ptr) (*ptr).l_data
154 #define inroom(rp, cp) (\
155 (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && (rp)->r_pos.x <= (cp)->x \
156 && (cp)->y <= (rp)->r_pos.y + ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y)
157 #define winat(y, x) (mvwinch(mw, y, x)==' '?mvwinch(stdscr, y, x):winch(mw))
158 #define debug if (wizard) msg
159 #define RN (((seed = seed*11109+13849) & 0x7fff) >> 1)
160 #define unc(cp) (cp).y, (cp).x
161 #define cmov(xy) move((xy).y, (xy).x)
162 #define DISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
163 #define OBJPTR(what) (struct object *)((*what).l_data)
164 #define THINGPTR(what) (struct thing *)((*what).l_data)
165 #define DOORPTR(what) (coord *)((*what).l_data)
166 #define when break;case
167 #define otherwise break;default
168 #define until(expr) while(!(expr))
169 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
170 #define draw(window) wrefresh(window)
171 #define hero player.t_pos
172 #define pstats player.t_stats
173 #define max_stats player.maxstats
174 #define pack player.t_pack
175 #define attach(a, b) _attach(&a, b)
176 #define detach(a, b) _detach(&a, b)
177 #define o_free_list(a) _o_free_list(&a)
178 #define t_free_list(a) _t_free_list(&a)
179 #undef max
180 #undef min
181 #define max(a, b) ((a) > (b) ? (a) : (b))
182 #define min(a, b) ((a) < (b) ? (a) : (b))
183 #define on(thing, flag) \
184 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) != 0)
185 #define off(thing, flag) \
186 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) == 0)
187 #define turn_on(thing, flag) \
188 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & ~FLAGMASK))
189 #define turn_off(thing, flag) \
190 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~flag)
191
192 #undef CTRL
193 #define CTRL(ch) (ch & 037)
194
195 #define ALLOC(x) calloc((unsigned int) x,1)
196 #define FREE(x) free((char *) x)
197 #define EQSTR(a, b, c) (strncmp(a, b, c) == 0)
198 #define EQUAL(a, b) (strcmp(a, b) == 0)
199 #define GOLDCALC (rnd(50 + 10 * level) + 2)
200 #define ISRING(h, r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r)
201 #define ISWEARING(r) (ISRING(LEFT_1, r) || ISRING(LEFT_2, r) ||\
202 ISRING(LEFT_3, r) || ISRING(LEFT_4, r) ||\
203 ISRING(RIGHT_1, r) || ISRING(RIGHT_2, r) ||\
204 ISRING(RIGHT_3, r) || ISRING(RIGHT_4, r))
205 #define newgrp() ++group
206 #define o_charges o_ac
207 #define ISMULT(type) (type == FOOD)
208 #define isrock(ch) ((ch == WALL) || (ch == '-') || (ch == '|'))
209 #define invisible(monst) \
210 (((on(*monst, ISINVIS) || \
211 (on(*monst, ISSHADOW) && rnd(100) < 90)) && \
212 off(player, CANSEE)) || \
213 (on(*monst, CANSURPRISE) && !ISWEARING(R_ALERT)))
214 #define is_stealth(tp) \
215 (rnd(25) < (tp)->t_stats.s_dext || (tp == &player && ISWEARING(R_STEALTH)))
216
217 #define has_light(rp) (((rp)->r_flags & HASFIRE) || ISWEARING(R_LIGHT))
218 #define mi_wght mi_worth
219
220 /*
221 * Ways to die
222 */
223 #define D_PETRIFY -1
224 #define D_ARROW -2
225 #define D_DART -3
226 #define D_POISON -4
227 #define D_BOLT -5
228 #define D_SUFFOCATION -6
229 #define D_POTION -7
230 #define D_INFESTATION -8
231 #define D_DROWN -9
232 #define D_ROT -10
233 #define D_CONSTITUTION -11
234 #define D_STRENGTH -12
235 #define D_SIGNAL -13
236 #define D_CHOKE -14
237 #define D_STRANGLE -15
238 #define D_FALL -16
239 #define D_RELIC -17
240 #define DEATHNUM 17 /* number of ways to die */
241
242 /*
243 * Things that appear on the screens
244 */
245 #define WALL ' '
246 #define PASSAGE '#'
247 #define DOOR '+'
248 #define FLOOR '.'
249 #define VPLAYER '@'
250 #define IPLAYER '_'
251 #define POST '^'
252 #define TRAPDOOR '>'
253 #define ARROWTRAP '{'
254 #define SLEEPTRAP '$'
255 #define BEARTRAP '}'
256 #define TELTRAP '~'
257 #define DARTTRAP '`'
258 #define POOL '"'
259 #define MAZETRAP '\''
260 #define SECRETDOOR '&'
261 #define STAIRS '%'
262 #define GOLD '*'
263 #define POTION '!'
264 #define SCROLL '?'
265 #define MAGIC '$'
266 #define BMAGIC '>' /* Blessed magic */
267 #define CMAGIC '<' /* Cursed magic */
268 #define FOOD ':'
269 #define WEAPON ')'
270 #define MISSILE '*' /* Magic Missile */
271 #define ARMOR ']'
272 #define MM ';'
273 #define RELIC ','
274 #define RING '='
275 #define STICK '/'
276 #define FOREST '\\'
277
278 /*
279 * Various constants
280 */
281 #define PASSWD "SihQX7.LYSmbo"
282 #define BEARTIME 3
283 #define SLEEPTIME 4
284 #define FREEZETIME 6
285 #define PAINTIME (roll(1, 6))
286 #define HEALTIME 30
287 #define CHILLTIME (roll(20, 4))
288 #define SMELLTIME 20
289 #define STONETIME 8
290 #define HASTETIME 6
291 #define SICKTIME 10
292 #define STPOS 0
293 #define WANDERTIME (max(5, HARDER-rnd(vlevel)))
294 #define BEFORE 1
295 #define AFTER 2
296 #define HUHDURATION 20
297 #define SEEDURATION 850
298 #define CLRDURATION 15
299 #define GONETIME 200
300 #define FLYTIME 300
301 #define DUSTTIME (20+roll(1,10))
302 #define PHASEDURATION 300
303 #define HUNGERTIME 1300
304 #define MORETIME 150
305 #define STINKTIME 6
306 #define STOMACHSIZE 2000
307 #define ESCAPE 27
308 #define BOLT_LENGTH 10
309 #define MARKLEN 20
310 #define DAYLENGTH 400
311 #define ALCHEMYTIME (400+rnd(100))
312
313 /*
314 * Save against things
315 */
316 #define VS_POISON 00
317 #define VS_PARALYZATION 00
318 #define VS_DEATH 00
319 #define VS_PETRIFICATION 01
320 #define VS_WAND 02
321 #define VS_BREATH 03
322 #define VS_MAGIC 04
323
324 /*
325 * attributes for treasures in dungeon
326 */
327 #define ISCURSED 01
328 #define ISKNOW 02
329 #define ISPOST 04 /* object is in a trading post */
330 #define ISMETAL 010
331 #define ISPROT 020 /* object is protected */
332 #define ISBLESSED 040
333 #define ISMISL 020000
334 #define ISMANY 040000
335 /*
336 * Various flag bits
337 */
338 #define ISDARK 01
339 #define ISGONE 02
340 #define ISTREAS 04
341 #define ISFOUND 010
342 #define ISTHIEFSET 020
343 #define FORCEDARK 040
344 /*
345 * 1st set of creature flags (this might include player)
346 */
347 #define ISBLIND 0x00000001
348 #define ISINWALL 0x00000002
349 #define ISRUN 0x00000004
350 #define ISFLEE 0x00000008
351 #define ISINVIS 0x00000010
352 #define ISMEAN 0x00000020
353 #define ISGREED 0x00000040
354 #define CANSHOOT 0x00000080
355 #define ISHELD 0x00000100
356 #define ISHUH 0x00000200
357 #define ISREGEN 0x00000400
358 #define CANHUH 0x00000800
359 #define CANSEE 0x00001000
360 #define HASFIRE 0x00002000
361 #define ISSLOW 0x00004000
362 #define ISHASTE 0x00008000
363 #define ISCLEAR 0x00010000
364 #define CANINWALL 0x00020000
365 #define ISDISGUISE 0x00040000
366 #define CANBLINK 0x00080000
367 #define CANSNORE 0x00100000
368 #define HALFDAMAGE 0x00200000
369 #define CANSUCK 0x00400000
370 #define CANRUST 0x00800000
371 #define CANPOISON 0x01000000
372 #define CANDRAIN 0x02000000