Mercurial > hg > early-roguelike
comparison xrogue/rogue.h @ 133:e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
author | John "Elwin" Edwards |
---|---|
date | Tue, 21 Apr 2015 08:55:20 -0400 |
parents | |
children | cfa9d1609b78 |
comparison
equal
deleted
inserted
replaced
124:d10fc4a065ac | 133:e6179860cb76 |
---|---|
1 /* | |
2 rogue.h - Rogue definitions and variable declarations | |
3 | |
4 XRogue: Expeditions into the Dungeons of Doom | |
5 Copyright (C) 1991 Robert Pietkivitch | |
6 All rights reserved. | |
7 | |
8 Based on "Advanced Rogue" | |
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T | |
10 All rights reserved. | |
11 | |
12 Based on "Rogue: Exploring the Dungeons of Doom" | |
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
14 All rights reserved. | |
15 | |
16 See the file LICENSE.TXT for full copyright and licensing information. | |
17 */ | |
18 | |
19 /* | |
20 * some compiler don't handle void pointers well so | |
21 */ | |
22 #include <assert.h> | |
23 #define reg register | |
24 #define VOID long | |
25 #undef lines | |
26 #define ENCREAD encread | |
27 #define ENCWRITE encwrite | |
28 #undef SCROLL /* UNIX/370 defines SCROLL for some bizarre reason */ | |
29 #define exfork fork /* Standard fork with no paging available */ | |
30 | |
31 /* | |
32 * Maximum number of different things | |
33 */ | |
34 | |
35 #define MINCOLS 70 | |
36 #define MINLINES 22 | |
37 #define MAXROOMS 9 | |
38 #define MAXTHINGS 9 | |
39 #define MAXOBJ 9 | |
40 #define MAXSTATS 74 /* max total of all stats at startup */ | |
41 #define MAXPACK 27 /* max number of items in pack */ | |
42 #define MAXDOUBLE 14 /* max number of times exppts is doubled */ | |
43 #define MAXCONTENTS 20 /* max number of things beaker/book can hold */ | |
44 #define MAXENCHANT 30 /* max number of enchantments on an item */ | |
45 #define MAXTREAS 25 /* number monsters/treasure in treasure room */ | |
46 #define MAXTRAPS 20 /* max number of traps that may be on level */ | |
47 #define MAXTRPTRY 15 /* attempts/level allowed for setting traps */ | |
48 #define MAXDOORS 4 /* maximum doors to a room */ | |
49 #define MAXCHANTS 16 /* maximum number of chants for a druid */ | |
50 #define MAXPRAYERS 16 /* maximum number of prayers for cleric */ | |
51 #define MAXSPELLS 16 /* maximum number of spells for magician */ | |
52 #define MAXQUILL 14 /* scrolls the Quill of Nagrom can write */ | |
53 #define QUILLCHARGES 300 /* max num of charges in the Quill of Nagrom */ | |
54 #define NUM_CNAMES 26 /* number of names per character level */ | |
55 #define NUMMONST 211 /* current number of monsters */ | |
56 #define NUMUNIQUE 60 /* number of UNIQUEs (minus jacaranda) */ | |
57 #define NUMDINOS 30 /* number of dinosaurs (for OUTSIDE level) */ | |
58 #define NLEVMONS 3 /* number of new monsters per level */ | |
59 #define NUMSCORE 20 /* number of entries in score file */ | |
60 #define HARDER 40 /* at this level start making things harder */ | |
61 #define LINELEN 256 /* characters in a buffer */ | |
62 #define JUG_EMPTY -1 /* signifys that the alchemy jug is empty */ | |
63 #define MAXPURCH (pstats.s_charisma/3) /* num of purchases at t.post */ | |
64 #define MAXATT 50 /* charactor's attribute maximum number */ | |
65 | |
66 /* Movement penalties */ | |
67 #define BACKPENALTY 3 | |
68 #define SHOTPENALTY 2 /* In line of sight of missile */ | |
69 #define DOORPENALTY 1 /* Moving out of current room */ | |
70 | |
71 /* | |
72 * these defines are used in calls to get_item() to signify what | |
73 * it is we want | |
74 */ | |
75 | |
76 #define ALL -1 | |
77 #define WEARABLE -2 | |
78 #define CALLABLE -3 | |
79 #define WIELDABLE -4 | |
80 #define USEABLE -5 | |
81 #define IDENTABLE -6 | |
82 #define REMOVABLE -7 | |
83 #define PROTECTABLE -8 | |
84 #define ZAPPABLE -9 | |
85 #define READABLE -10 | |
86 #define QUAFFABLE -11 | |
87 | |
88 /* | |
89 * stuff to do with encumberance | |
90 */ | |
91 | |
92 #define NORMENCB 1400 /* 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 | |
103 #define A_MOVE 0200 /* normal movement */ | |
104 #define A_FREEZE 0201 /* frozen in place */ | |
105 #define A_ATTACK 0202 /* trying to hit */ | |
106 #define A_SELL 0203 /* trying to sell goods */ | |
107 #define A_NIL 0204 /* not doing anything */ | |
108 #define A_BREATHE 0205 /* breathing */ | |
109 #define A_MISSILE 0206 /* Firing magic missiles */ | |
110 #define A_SONIC 0207 /* Sounding a sonic blast */ | |
111 #define A_SUMMON 0210 /* Summoning help */ | |
112 #define A_USERELIC 0211 /* Monster uses a relic */ | |
113 #define A_SLOW 0212 /* monster slows the player */ | |
114 #define A_ZAP 0213 /* monster shoots a wand */ | |
115 #define A_PICKUP 0214 /* player is picking something up */ | |
116 #define A_USEWAND 0215 /* monster is shooting a wand */ | |
117 #define A_THROW 't' | |
118 #define C_CAST 'C' | |
119 #define C_COUNT '*' | |
120 #define C_DIP 'D' | |
121 #define C_DROP 'd' | |
122 #define C_EAT 'e' | |
123 #define C_PRAY 'p' | |
124 #define C_CHANT 'c' | |
125 #define C_QUAFF 'q' | |
126 #define C_READ 'r' | |
127 #define C_SEARCH 's' | |
128 #define C_SETTRAP '^' | |
129 #define C_TAKEOFF 'T' | |
130 #define C_USE CTRL('U') | |
131 #define C_WEAR 'W' | |
132 #define C_WIELD 'w' | |
133 #define C_ZAP 'z' | |
134 | |
135 /* Possible ways for the hero to move */ | |
136 | |
137 #define H_TELEPORT 0 | |
138 | |
139 /* | |
140 * return values for get functions | |
141 */ | |
142 | |
143 #define NORM 0 /* normal exit */ | |
144 #define QUIT 1 /* quit option setting */ | |
145 #define MINUS 2 /* back up one option */ | |
146 | |
147 /* | |
148 * The character types | |
149 */ | |
150 | |
151 #define C_FIGHTER 0 | |
152 #define C_RANGER 1 | |
153 #define C_PALADIN 2 | |
154 #define C_MAGICIAN 3 | |
155 #define C_CLERIC 4 | |
156 #define C_THIEF 5 | |
157 #define C_ASSASSIN 6 | |
158 #define C_DRUID 7 | |
159 #define C_MONK 8 | |
160 #define C_MONSTER 9 | |
161 #define NUM_CHARTYPES 10 | |
162 | |
163 /* | |
164 * define the ability types | |
165 */ | |
166 | |
167 #define A_INTELLIGENCE 0 | |
168 #define A_STRENGTH 1 | |
169 #define A_WISDOM 2 | |
170 #define A_DEXTERITY 3 | |
171 #define A_CONSTITUTION 4 | |
172 #define A_CHARISMA 5 | |
173 #define NUMABILITIES 6 | |
174 | |
175 /* | |
176 * values for games end | |
177 */ | |
178 | |
179 #define UPDATE -2 | |
180 #define SCOREIT -1 | |
181 #define KILLED 0 | |
182 #define CHICKEN 1 | |
183 #define WINNER 2 | |
184 | |
185 /* | |
186 * definitions for function step_ok: | |
187 * MONSTOK indicates it is OK to step on a monster -- it | |
188 * is only OK when stepping diagonally AROUND a monster; | |
189 * it is also OK if the stepper is a friendly monster and | |
190 * is in a fighting mood. | |
191 */ | |
192 | |
193 #define MONSTOK 1 | |
194 #define NOMONST 2 | |
195 #define FIGHTOK 3 | |
196 | |
197 /* | |
198 * used for ring stuff | |
199 */ | |
200 | |
201 #define LEFT_1 0 | |
202 #define LEFT_2 1 | |
203 #define LEFT_3 2 | |
204 #define LEFT_4 3 | |
205 #define RIGHT_1 4 | |
206 #define RIGHT_2 5 | |
207 #define RIGHT_3 6 | |
208 #define RIGHT_4 7 | |
209 #define NUM_FINGERS 8 | |
210 | |
211 /* | |
212 * used for micellaneous magic (MM) stuff | |
213 */ | |
214 | |
215 #define WEAR_BOOTS 0 | |
216 #define WEAR_BRACERS 1 | |
217 #define WEAR_CLOAK 2 | |
218 #define WEAR_GAUNTLET 3 | |
219 #define WEAR_JEWEL 4 | |
220 #define WEAR_NECKLACE 5 | |
221 #define NUM_MM 6 | |
222 | |
223 /* | |
224 How to exit flags: | |
225 */ | |
226 | |
227 #define EXIT_CLS 1 /* Clear screen first */ | |
228 #define EXIT_ENDWIN 2 /* Shutdown Curses */ | |
229 | |
230 | |
231 /* | |
232 * All the fun defines | |
233 */ | |
234 | |
235 #define next(ptr) (*ptr).l_next | |
236 #define prev(ptr) (*ptr).l_prev | |
237 #define ldata(ptr) (*ptr).l_data | |
238 #define inroom(rp, cp) (\ | |
239 (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && (rp)->r_pos.x <= (cp)->x \ | |
240 && (cp)->y <= (rp)->r_pos.y + ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y) | |
241 #define winat(y, x) (mvwinch(mw, y, x)==' '?mvwinch(stdscr, y, x):winch(mw)) | |
242 #define debug if (wizard) msg | |
243 #define RN (((seed = seed*11109+13849) & 0x7fff) >> 1) | |
244 #define unc(cp) (cp).y, (cp).x | |
245 #define cmov(xy) move((xy).y, (xy).x) | |
246 #define DISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)) | |
247 #define OBJPTR(what) (struct object *)((*what).l_data) | |
248 #define THINGPTR(what) (struct thing *)((*what).l_data) | |
249 #define DOORPTR(what) (coord *)((*what).l_data) | |
250 #define when break;case | |
251 #define otherwise break;default | |
252 #define until(expr) while(!(expr)) | |
253 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y) | |
254 #define draw(window) wrefresh(window) | |
255 #define newfont(window) if (funfont) wattron(window, A_ALTCHARSET); | |
256 #define nofont(window) if (funfont) wattroff(window, A_ALTCHARSET); | |
257 #define hero player.t_pos | |
258 #define pstats player.t_stats | |
259 #define max_stats player.maxstats | |
260 #define pack player.t_pack | |
261 #define attach(a, b) _attach(&a, b) | |
262 #define detach(a, b) _detach(&a, b) | |
263 #define o_free_list(a) _o_free_list(&a) | |
264 #define r_free_list(a) _r_free_list(&a) | |
265 #define t_free_list(a) _t_free_list(&a) | |
266 #undef min | |
267 #undef max | |
268 #define max(a, b) ((a) > (b) ? (a) : (b)) | |
269 #define min(a, b) ((a) < (b) ? (a) : (b)) | |
270 #define on(thing, flag) \ | |
271 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) != 0) | |
272 #define off(thing, flag) \ | |
273 (((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & flag) == 0) | |
274 #define turn_on(thing, flag) \ | |
275 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & ~FLAGMASK)) | |
276 #define turn_off(thing, flag) \ | |
277 ((thing).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~flag) | |
278 | |
279 /* define the control character */ | |
280 | |
281 #undef CTRL | |
282 #define CTRL(ch) (ch & 037) | |
283 | |
284 #define ALLOC(x) malloc((unsigned int) x) | |
285 #define FREE(x) free((char *) x) | |
286 #define EQSTR(a, b, c) (strncmp(a, b, c) == 0) | |
287 #define EQUAL(a, b) (strcmp(a, b) == 0) | |
288 #define GOLDCALC (rnd(50 + 10 * level) + 2) | |
289 #define ISRING(h, r) (cur_ring[h] != NULL && cur_ring[h]->o_which == r) | |
290 #define ISWEARING(r) (ISRING(LEFT_1, r) || ISRING(LEFT_2, r) ||\ | |
291 ISRING(LEFT_3, r) || ISRING(LEFT_4, r) ||\ | |
292 ISRING(RIGHT_1, r) || ISRING(RIGHT_2, r) ||\ | |
293 ISRING(RIGHT_3, r) || ISRING(RIGHT_4, r)) | |
294 #define newgrp() ++group | |
295 #define o_charges o_ac | |
296 #define o_kind o_ac | |
297 #define ISMULT(type) (type == FOOD) | |
298 #define isrock(ch) ((ch == WALL) || (ch == HORZWALL) || (ch == VERTWALL) || (ch == SECRETDOOR)) | |
299 #define is_stealth(tp) \ | |
300 (rnd(25) < (tp)->t_stats.s_dext || (tp == &player && ISWEARING(R_STEALTH))) | |
301 | |
302 #define has_light(rp) (((rp)->r_flags & HASFIRE) || ISWEARING(R_LIGHT)) | |
303 | |
304 #define mi_wght mi_worth | |
305 #define mi_food mi_curse | |
306 | |
307 /* | |
308 * Ways to die | |
309 */ | |
310 | |
311 #define D_PETRIFY -1 | |
312 #define D_ARROW -2 | |
313 #define D_DART -3 | |
314 #define D_POISON -4 | |
315 #define D_BOLT -5 | |
316 #define D_SUFFOCATION -6 | |
317 #define D_POTION -7 | |
318 #define D_INFESTATION -8 | |
319 #define D_DROWN -9 | |
320 #define D_ROT -10 | |
321 #define D_CONSTITUTION -11 | |
322 #define D_STRENGTH -12 | |
323 #define D_SIGNAL -13 | |
324 #define D_CHOKE -14 | |
325 #define D_STRANGLE -15 | |
326 #define D_FALL -16 | |
327 #define D_RELIC -17 | |
328 #define D_STARVATION -18 | |
329 #define D_FOOD_CHOKE -19 | |
330 #define D_SCROLL -20 | |
331 #define D_FRIGHT -21 | |
332 #define D_CRYSTAL -22 | |
333 #define D_CARD -23 | |
334 #define DEATHNUM 23 /* number of ways to die */ | |
335 | |
336 /* | |
337 * Things that appear on the screens | |
338 */ | |
339 | |
340 #define WALL ' ' | |
341 #define PASSAGE '#' | |
342 #define DOOR '+' | |
343 #define FLOOR '.' | |
344 #define HORZWALL '-' | |
345 #define VERTWALL '|' | |
346 #define VPLAYER '@' | |
347 #define IPLAYER '_' | |
348 #define POST '^' | |
349 #define TRAPDOOR '>' | |
350 #define ARROWTRAP '{' | |
351 #define SLEEPTRAP '$' | |
352 #define BEARTRAP '}' | |
353 #define TELTRAP '~' | |
354 #define DARTTRAP '`' | |
355 #define WORMHOLE '<' | |
356 #define POOL '"' | |
357 #define MAZETRAP '\'' | |
358 #define SECRETDOOR '&' | |
359 #define STAIRS '%' | |
360 #define GOLD '*' | |
361 #define POTION '!' | |
362 #define SCROLL '?' | |
363 #define MAGIC '$' | |
364 #define BMAGIC '>' /* Blessed magic */ | |
365 #define CMAGIC '<' /* Cursed magic */ | |
366 #define FOOD ':' | |
367 #define WEAPON ')' | |
368 #define MISSILE '*' /* Magic Missile */ | |
369 #define ARMOR ']' | |
370 #define MM ';' | |
371 #define RELIC ',' | |
372 #define RING '=' | |
373 #define STICK '/' | |
374 #define FOREST '\\' | |
375 | |
376 /* | |
377 * Various constants | |
378 * Crypt() returns a different string on the PC for some silly reason | |
379 */ | |
380 | |
381 #define PASSWD "mT5uKwhm5WDRs" | |
382 #define FIGHTBASE 10 | |
383 #define BEFORE 1 | |
384 #define AFTER 2 | |
385 #define ESC 27 | |
386 #define BOLT_LENGTH 12 | |
387 #define MARKLEN 20 | |
388 #define SLEEPTIME (roll(15, 2)) | |
389 #define BEARTIME (roll(15, 2)) | |
390 #define FREEZETIME 30 | |
391 #define HEALTIME 40 | |
392 #define SICKTIME 40 | |
393 #define MORETIME 80 | |
394 #define STOMACHSIZE 2100 | |
395 #define PAINTIME (roll(15, 2)) | |
396 #define CLOAK_TIME (roll(15, 2)) | |
397 #define CHILLTIME (roll(15, 2)) | |
398 #define STONETIME (roll(15, 2)) | |
399 #define SMELLTIME (50+rnd(30)) | |
400 #define DUSTTIME (50+rnd(30)) | |
401 #define STINKTIME (50+rnd(30)) | |
402 #define HASTETIME (50+rnd(30)) | |
403 #define HUHDURATION (50+rnd(30)) | |
404 #define GONETIME (50+rnd(30)) | |
405 #define SKILLDURATION (50+rnd(30)) | |
406 #define SEEDURATION (150+rnd(50)) | |
407 #define CLRDURATION (150+rnd(50)) | |
408 #define FLYTIME (150+rnd(50)) | |
409 #define PHASEDURATION (150+rnd(50)) | |
410 #define ALCHEMYTIME (250+rnd(100)) | |
411 #define FIRETIME (180+roll(20, 2)) | |
412 #define COLDTIME (180+roll(20, 2)) | |
413 #define BOLTTIME (180+roll(20, 2)) | |
414 #define DAYLENGTH 700 | |
415 #define LEVEL 700 /* make depth of dungeon equal to DAYLENGTH */ | |
416 #define WANDERTIME (max(5, (HARDER+rnd(25))-rnd(vlevel*2))) | |
417 #define SPELLTIME ((max(30-pstats.s_lvl,5))) | |
418 #define vlevel (max(level, turns/LEVEL + 1)) | |
419 | |
420 /* | |
421 * Save against things | |
422 */ | |
423 | |
424 #define VS_POISON 00 | |
425 #define VS_PARALYZATION 00 | |
426 #define VS_DEATH 00 | |
427 #define VS_PETRIFICATION 01 | |
428 #define VS_WAND 02 | |
429 #define VS_BREATH 03 | |
430 #define VS_MAGIC 04 | |
431 | |
432 /* | |
433 * attributes for treasures in dungeon | |
434 */ | |
435 | |
436 #define ISCURSED 01 | |
437 #define ISKNOW 02 | |
438 #define ISPOST 04 /* object is in a trading post */ | |
439 #define ISMETAL 010 | |
440 #define ISPROT 020 /* object is protected */ | |
441 #define ISBLESSED 040 | |
442 #define ISPOISON 0100 | |
443 #define ISMISL 020000 | |
444 #define ISMANY 040000 | |
445 | |
446 /* | |
447 * Various flag bits | |
448 */ | |
449 | |
450 #define ISDARK 01 | |
451 #define ISGONE 02 | |
452 #define ISTREAS 04 | |
453 #define ISFOUND 010 | |
454 #define ISTHIEFSET 020 | |
455 #define FORCEDARK 040 | |
456 | |
457 /* | |
458 * 1st set of creature flags (this might include player) | |
459 */ | |
460 | |
461 #define ISBLIND 0x00000001 | |
462 #define ISINWALL 0x00000002 | |
463 #define ISRUN 0x00000004 | |
464 #define ISFLEE 0x00000008 | |
465 #define ISINVIS 0x00000010 | |
466 #define ISMEAN 0x00000020 | |
467 #define ISGREED 0x00000040 | |
468 #define CANSHOOT 0x00000080 | |
469 #define ISHELD 0x00000100 | |
470 #define ISHUH 0x00000200 | |
471 #define ISREGEN 0x00000400 | |
472 #define CANHUH 0x00000800 | |
473 #define CANSEE 0x00001000 | |
474 #define HASFIRE 0x00002000 | |
475 #define ISSLOW 0x00004000 | |
476 #define ISHASTE 0x00008000 | |
477 #define ISCLEAR 0x00010000 | |
478 #define CANINWALL 0x00020000 | |
479 #define ISDISGUISE 0x00040000 | |
480 #define CANBLINK 0x00080000 | |
481 #define CANSNORE 0x00100000 | |
482 #define HALFDAMAGE 0x00200000 | |
483 #define CANSUCK 0x00400000 | |
484 #define CANRUST 0x00800000 | |
485 #define CANPOISON 0x01000000 | |
486 #define CANDRAIN 0x02000000 | |
487 #define ISUNIQUE 0x04000000 | |
488 #define STEALGOLD 0x08000000 | |
489 | |
490 /* | |
491 * Second set of flags | |
492 */ | |
493 | |
494 #define STEALMAGIC 0x10000001 | |
495 #define CANDISEASE 0x10000002 | |
496 #define HASDISEASE 0x10000004 | |
497 #define CANSUFFOCATE 0x10000008 | |
498 #define DIDSUFFOCATE 0x10000010 | |
499 #define BOLTDIVIDE 0x10000020 | |
500 #define BLOWDIVIDE 0x10000040 | |
501 #define NOCOLD 0x10000080 | |
502 #define TOUCHFEAR 0x10000100 | |
503 #define BMAGICHIT 0x10000200 | |
504 #define NOFIRE 0x10000400 | |
505 #define NOBOLT 0x10000800 | |
506 #define CARRYGOLD 0x10001000 | |
507 #define CANITCH 0x10002000 | |
508 #define HASITCH 0x10004000 | |
509 #define DIDDRAIN 0x10008000 | |
510 #define WASTURNED 0x10010000 | |
511 #define CANSELL 0x10020000 | |
512 #define CANBLIND 0x10040000 | |
513 #define NOACID 0x10080000 | |
514 #define NOSLOW 0x10100000 | |
515 #define NOFEAR 0x10200000 | |
516 #define NOSLEEP 0x10400000 | |
517 #define NOPARALYZE 0x10800000 | |
518 #define NOGAS 0x11000000 | |
519 #define CANMISSILE 0x12000000 | |
520 #define CMAGICHIT 0x14000000 | |
521 #define CANPAIN 0x18000000 | |
522 | |
523 /* | |
524 * Third set of flags | |
525 */ | |
526 | |
527 #define CANSLOW 0x20000001 | |
528 #define CANTUNNEL 0x20000002 | |
529 #define TAKEWISDOM 0x20000004 | |
530 #define NOMETAL 0x20000008 | |
531 #define MAGICHIT 0x20000010 | |
532 #define CANINFEST 0x20000020 | |
533 #define HASINFEST 0x20000040 | |
534 #define NOMOVE 0x20000080 | |
535 #define CANSHRIEK 0x20000100 | |
536 #define CANDRAW 0x20000200 | |
537 #define CANSMELL 0x20000400 | |
538 #define CANPARALYZE 0x20000800 | |
539 #define CANROT 0x20001000 | |
540 #define ISSCAVENGE 0x20002000 | |
541 #define DOROT 0x20004000 | |
542 #define CANSTINK 0x20008000 | |
543 #define HASSTINK 0x20010000 | |
544 #define ISSHADOW 0x20020000 | |
545 #define CANCHILL 0x20040000 | |
546 #define CANHUG 0x20080000 | |
547 #define CANSURPRISE 0x20100000 | |
548 #define CANFRIGHTEN 0x20200000 | |
549 #define CANSUMMON 0x20400000 | |
550 #define TOUCHSTONE 0x20800000 | |
551 #define LOOKSTONE 0x21000000 | |
552 #define CANHOLD 0x22000000 | |
553 #define DIDHOLD 0x24000000 | |
554 #define DOUBLEDRAIN 0x28000000 | |
555 | |
556 /* | |
557 * Fourth set of flags | |
558 */ | |
559 | |
560 #define CANBRANDOM 0x30000001 /* Types of breath */ | |
561 #define CANBACID 0x30000002 /* acid */ | |
562 #define CANBFIRE 0x30000004 /* Fire */ | |
563 #define CANBCGAS 0x30000008 /* confusion gas */ | |
564 #define CANBBOLT 0x30000010 /* lightning bolt */ | |
565 #define CANBGAS 0x30000020 /* chlorine gas */ | |
566 #define CANBICE 0x30000040 /* ice */ | |
567 #define CANBFGAS 0x30000080 /* Fear gas */ | |
568 #define CANBPGAS 0x30000100 /* Paralyze gas */ | |
569 #define CANBSGAS 0x30000200 /* Sleeping gas */ | |
570 #define CANBSLGAS 0x30000400 /* Slow gas */ | |
571 #define CANBREATHE 0x300007ff /* Can it breathe at all? */ | |
572 | |
573 /* | |
574 * Fifth set of flags | |
575 */ | |
576 | |
577 #define ISUNDEAD 0x40000001 | |
578 #define CANSONIC 0x40000002 | |
579 #define TURNABLE 0x40000004 | |
580 #define TAKEINTEL 0x40000008 | |
581 #define NOSTAB 0x40000010 | |
582 #define CANDISSOLVE 0x40000020 | |
583 #define ISFLY 0x40000040 /* creature can fly */ | |
584 #define CANTELEPORT 0x40000080 /* creature can teleport */ | |
585 #define CANEXPLODE 0x40000100 /* creature explodes when hit */ | |
586 #define CANDANCE 0x40000200 /* creature can make hero "dance" */ | |
587 #define ISDANCE 0x40000400 /* creature (hero) is dancing */ | |
588 #define CARRYFOOD 0x40000800 | |
589 #define CARRYSCROLL 0x40001000 | |
590 #define CARRYPOTION 0x40002000 | |
591 #define CARRYRING 0x40004000 | |
592 #define CARRYSTICK 0x40008000 | |
593 #define CARRYMISC 0x40010000 | |
594 #define CARRYMDAGGER 0x40020000 /* Dagger of Musty */ | |
595 #define CARRYCLOAK 0x40040000 /* Cloak of Emori */ | |
596 #define CARRYANKH 0x40080000 /* Ankh of Heil */ | |
597 #define CARRYSTAFF 0x40100000 /* Staff of Ming */ | |
598 #define CARRYWAND 0x40200000 /* Wand of Orcus */ | |
599 #define CARRYROD 0x40400000 /* Rod of Asmodeus */ | |
600 #define CARRYYAMULET 0x40800000 /* Amulet of Yendor */ | |
601 #define CARRYMANDOLIN 0x41000000 /* Mandolin of Brian */ | |
602 #define MISSEDDISP 0x42000000 /* Missed Cloak of Displacement */ | |
603 #define CANBSTAB 0x44000000 /* Can backstab */ | |
604 #define ISGUARDIAN 0x48000000 /* Guardian of a treasure room */ | |
605 | |
606 /* | |
607 * Sixth set of flags | |
608 */ | |
609 | |
610 #define CARRYHORN 0x50000001 /* Horn of Geryon */ | |
611 #define CARRYMSTAR 0x50000002 /* Morning Star of Hruggek */ | |
612 #define CARRYFLAIL 0x50000004 /* Flail of Yeenoghu */ | |
613 #define CARRYWEAPON 0x50000008 /* A generic weapon */ | |
614 #define CANAGE 0x50000010 /* can age you */ | |
615 #define CARRYDAGGER 0x50000020 /* carry's a dumb old dagger */ | |
616 #define AREMANY 0x50000040 /* they come in droves */ | |
617 #define CARRYEYE 0x50000080 /* has the eye of Vecna */ | |
618 #define HASSUMMONED 0x50000100 /* has already summoned */ | |
619 #define ISSTONE 0x50000200 /* has been turned to stone */ | |
620 #define NODETECT 0x50000400 /* detect monster will not show him */ | |
621 #define NOSTONE 0x50000800 /* creature made its save vrs stone */ | |
622 #define CARRYQUILL 0x50001000 /* has the quill of Nagrom */ | |
623 #define CARRYAXE 0x50002000 /* has the axe of Aklad */ | |
624 #define TOUCHSLOW 0x50004000 /* touch will slow hero */ | |
625 #define WASDISRUPTED 0x50008000 /* creature was disrupted by player */ | |
626 #define CARRYARMOR 0x50010000 /* creature will pick up armor */ | |
627 #define CARRYBAMULET 0x50020000 /* amulet of skoraus stonebones */ | |
628 #define CARRYSURTURRING 0x50040000 /* ring of Surtur */ | |
629 #define CARRYCARD 0x50080000 /* carry the card of Alteran */ | |
630 #define ISCHARMED 0x50100000 /* is the monster charmed? */ | |
631 #define ISFRIENDLY 0x50100000 /* monster friendly for any reason? */ | |
632 | |
633 #define NEEDSTOACT 0x60000001 /* monster ready to act this turn n */ | |
634 #define ISDEAD 0x60000002 /* monster is dead */ | |
635 #define ISELSEWHERE 0x60000004 /* monster has been whisked away */ | |
636 | |
637 /* Masks for choosing the right flag */ | |
638 | |
639 #define FLAGMASK 0xf0000000 | |
640 #define FLAGINDEX 0x0000000f | |
641 #define FLAGSHIFT 28 | |
642 #define MAXFLAGS 25 /* max initial flags per creature */ | |
643 | |
644 /* | |
645 * Mask for cancelling special abilities | |
646 * The flags listed here will be the ones left on after the | |
647 * cancellation takes place | |
648 */ | |
649 | |
650 #define CANC0MASK ( ISBLIND | ISINWALL | ISRUN | \ | |
651 ISFLEE | ISMEAN | ISGREED | \ | |
652 CANSHOOT | ISHELD | ISHUH | \ | |
653 ISSLOW | ISHASTE | ISCLEAR | \ | |
654 ISUNIQUE ) | |
655 #define CANC1MASK ( HASDISEASE | DIDSUFFOCATE | CARRYGOLD | \ | |
656 HASITCH | CANSELL | DIDDRAIN | \ | |
657 WASTURNED ) | |
658 #define CANC2MASK ( HASINFEST | NOMOVE | ISSCAVENGE | \ | |
659 DOROT | HASSTINK | DIDHOLD ) | |
660 #define CANC3MASK ( CANBREATHE ) | |
661 #define CANC4MASK ( ISUNDEAD | CANSONIC | NOSTAB | \ | |
662 ISFLY | CARRYFOOD | CANEXPLODE | \ | |
663 ISDANCE | CARRYSCROLL | CARRYPOTION | \ | |
664 CARRYRING | CARRYSTICK | CARRYMISC | \ | |
665 CARRYMDAGGER | CARRYCLOAK | CARRYANKH | \ | |
666 CARRYSTAFF | CARRYWAND | CARRYROD | \ | |
667 CARRYYAMULET | CARRYMANDOLIN | ISGUARDIAN ) | |
668 #define CANC5MASK ( CARRYHORN | CARRYMSTAR | CARRYFLAIL | \ | |
669 CARRYEYE | CARRYDAGGER | HASSUMMONED | \ | |
670 AREMANY | CARRYWEAPON | NOSTONE | \ | |
671 CARRYQUILL | CARRYAXE | WASDISRUPTED | \ | |
672 CARRYARMOR | CARRYBAMULET | CARRYSURTURRING ) | |
673 #define CANC6MASK ( CARRYCARD ) | |
674 #define CANC7MASK ( 0 ) | |
675 #define CANC8MASK ( 0 ) | |
676 #define CANC9MASK ( 0 ) | |
677 #define CANCAMASK ( 0 ) | |
678 #define CANCBMASK ( 0 ) | |
679 #define CANCCMASK ( 0 ) | |
680 #define CANCDMASK ( 0 ) | |
681 #define CANCEMASK ( 0 ) | |
682 #define CANCFMASK ( 0 ) | |
683 | |
684 /* types of things */ | |
685 | |
686 #define TYP_POTION 0 | |
687 #define TYP_SCROLL 1 | |
688 #define TYP_FOOD 2 | |
689 #define TYP_WEAPON 3 | |
690 #define TYP_ARMOR 4 | |
691 #define TYP_RING 5 | |
692 #define TYP_STICK 6 | |
693 #define TYP_MM 7 | |
694 #define TYP_RELIC 8 | |
695 #define NUMTHINGS 9 | |
696 | |
697 /* | |
698 * food types | |
699 */ | |
700 | |
701 #define E_RATION 0 | |
702 #define E_APPLE 1 | |
703 #define E_BANANA 2 | |
704 #define E_BLUEBERRY 3 | |
705 #define E_CANDLEBERRY 4 | |
706 #define E_CAPRIFIG 5 | |
707 #define E_DEWBERRY 6 | |
708 #define E_ELDERBERRY 7 | |
709 #define E_GOOSEBERRY 8 | |
710 #define E_GUANABANA 9 | |
711 #define E_HAGBERRY 10 | |
712 #define E_JABOTICABA 11 | |
713 #define E_PEACH 12 | |
714 #define E_PITANGA 13 | |
715 #define E_PRICKLEY 14 | |
716 #define E_RAMBUTAN 15 | |
717 #define E_SAPODILLA 16 | |
718 #define E_SOURSOP 17 | |
719 #define E_STRAWBERRY 18 | |
720 #define E_SWEETSOP 19 | |
721 #define E_WHORTLEBERRY 20 | |
722 #define E_SLIMEMOLD 21 | |
723 #define MAXFOODS 22 | |
724 | |
725 /* | |
726 * Potion types | |
727 */ | |
728 | |
729 #define P_CLEAR 0 | |
730 #define P_ABIL 1 | |
731 #define P_SEEINVIS 2 | |
732 #define P_HEALING 3 | |
733 #define P_MFIND 4 | |
734 #define P_TFIND 5 | |
735 #define P_RAISE 6 | |
736 #define P_HASTE 7 | |
737 #define P_RESTORE 8 | |
738 #define P_PHASE 9 | |
739 #define P_INVIS 10 | |
740 #define P_FLY 11 | |
741 #define P_FFIND 12 | |
742 #define P_SKILL 13 | |
743 #define P_FIRE 14 | |
744 #define P_COLD 15 | |
745 #define P_LIGHTNING 16 | |
746 #define P_POISON 17 | |
747 #define MAXPOTIONS 18 | |
748 | |
749 /* | |
750 * Scroll types | |
751 */ | |
752 | |
753 #define S_CONFUSE 0 | |
754 #define S_MAP 1 | |
755 #define S_LIGHT 2 | |
756 #define S_HOLD 3 | |
757 #define S_SLEEP 4 | |
758 #define S_ALLENCH 5 | |
759 #define S_IDENT 6 | |
760 #define S_SCARE 7 | |
761 #define S_GFIND 8 | |
762 #define S_TELEP 9 | |
763 #define S_CREATE 10 | |
764 #define S_REMOVE 11 | |
765 #define S_PETRIFY 12 | |
766 #define S_GENOCIDE 13 | |
767 #define S_CURING 14 | |
768 #define S_MAKEIT 15 | |
769 #define S_PROTECT 16 | |
770 #define S_FINDTRAPS 17 | |
771 #define S_RUNES 18 | |
772 #define S_CHARM 19 | |
773 #define MAXSCROLLS 20 | |
774 | |
775 /* | |
776 * Weapon types | |
777 */ | |
778 | |
779 #define MACE 0 /* mace */ | |
780 #define SWORD 1 /* long sword */ | |
781 #define BOW 2 /* short bow */ | |
782 #define ARROW 3 /* arrow */ | |
783 #define DAGGER 4 /* dagger */ | |
784 #define ROCK 5 /* rocks */ | |
785 #define TWOSWORD 6 /* two-handed sword */ | |
786 #define SLING 7 /* sling */ | |
787 #define DART 8 /* darts */ | |
788 #define CROSSBOW 9 /* crossbow */ | |
789 #define BOLT 10 /* crossbow bolt */ | |
790 #define SPEAR 11 /* spear */ | |
791 #define TRIDENT 12 /* trident */ | |
792 #define SPETUM 13 /* spetum */ | |
793 #define BARDICHE 14 /* bardiche */ | |
794 #define PIKE 15 /* pike */ | |
795 #define BASWORD 16 /* bastard sword */ | |
796 #define HALBERD 17 /* halberd */ | |
797 #define BATTLEAXE 18 /* battle axe */ | |
798 #define MAXWEAPONS 19 /* types of weapons */ | |
799 #define NONE 100 /* no weapon */ | |
800 | |
801 /* | |
802 * Armor types | |
803 */ | |
804 | |
805 #define LEATHER 0 | |
806 #define RING_MAIL 1 | |
807 #define STUDDED_LEATHER 2 | |
808 #define SCALE_MAIL 3 | |
809 #define PADDED_ARMOR 4 | |
810 #define CHAIN_MAIL 5 | |
811 #define SPLINT_MAIL 6 | |
812 #define BANDED_MAIL 7 | |
813 #define PLATE_MAIL 8 | |
814 #define PLATE_ARMOR 9 | |
815 #define MAXARMORS 10 | |
816 | |
817 /* | |
818 * Ring types | |
819 */ | |
820 | |
821 #define R_PROTECT 0 | |
822 #define R_ADDSTR 1 | |
823 #define R_SUSABILITY 2 | |
824 #define R_SEARCH 3 | |
825 #define R_SEEINVIS 4 | |
826 #define R_ALERT 5 | |
827 #define R_AGGR 6 | |
828 #define R_ADDHIT 7 | |
829 #define R_ADDDAM 8 | |
830 #define R_REGEN 9 | |
831 #define R_DIGEST 10 | |
832 #define R_TELEPORT 11 | |
833 #define R_STEALTH 12 | |
834 #define R_ADDINTEL 13 | |
835 #define R_ADDWISDOM 14 | |
836 #define R_HEALTH 15 | |
837 #define R_CARRY 16 | |
838 #define R_LIGHT 17 | |
839 #define R_DELUSION 18 | |
840 #define R_FEAR 19 | |
841 #define R_HEROISM 20 | |
842 #define R_FIRE 21 | |
843 #define R_WARMTH 22 | |
844 #define R_VAMPREGEN 23 | |
845 #define R_FREEDOM 24 | |
846 #define R_TELCONTROL 25 | |
847 #define MAXRINGS 26 | |
848 | |
849 /* | |
850 * Rod/Wand/Staff types | |
851 */ | |
852 | |
853 #define WS_LIGHT 0 | |
854 #define WS_HIT 1 | |
855 #define WS_ELECT 2 | |
856 #define WS_FIRE 3 | |
857 #define WS_COLD 4 | |
858 #define WS_POLYMORPH 5 | |
859 #define WS_MISSILE 6 | |
860 #define WS_SLOW_M 7 | |
861 #define WS_DRAIN 8 | |
862 #define WS_CHARGE 9 | |
863 #define WS_TELMON 10 | |
864 #define WS_CANCEL 11 | |
865 #define WS_CONFMON 12 | |
866 #define WS_DISINTEGRATE 13 | |
867 #define WS_PETRIFY 14 | |
868 #define WS_PARALYZE 15 | |
869 #define WS_MDEG 16 | |
870 #define WS_CURING 17 | |
871 #define WS_WONDER 18 | |
872 #define WS_FEAR 19 | |
873 #define MAXSTICKS 20 | |
874 | |
875 /* | |
876 * miscellaneous magic items | |
877 */ | |
878 | |
879 #define MM_JUG 0 | |
880 #define MM_BEAKER 1 | |
881 #define MM_BOOK 2 | |
882 #define MM_ELF_BOOTS 3 | |
883 #define MM_BRACERS 4 | |
884 #define MM_OPEN 5 | |
885 #define MM_HUNGER 6 | |
886 #define MM_DISP 7 | |
887 #define MM_PROTECT 8 | |
888 #define MM_DRUMS 9 | |
889 #define MM_DISAPPEAR 10 | |
890 #define MM_CHOKE 11 | |
891 #define MM_G_DEXTERITY 12 | |
892 #define MM_G_OGRE 13 | |
893 #define MM_JEWEL 14 | |
894 #define MM_KEOGHTOM 15 | |
895 #define MM_R_POWERLESS 16 | |
896 #define MM_FUMBLE 17 | |
897 #define MM_ADAPTION 18 | |
898 #define MM_STRANGLE 19 | |
899 #define MM_DANCE 20 | |
900 #define MM_SKILLS 21 | |
901 #define MM_CRYSTAL 22 | |
902 #define MAXMM 23 | |
903 | |
904 /* | |
905 * Relic types | |
906 */ | |
907 | |
908 #define MUSTY_DAGGER 0 | |
909 #define EMORI_CLOAK 1 | |
910 #define HEIL_ANKH 2 | |
911 #define MING_STAFF 3 | |
912 #define ORCUS_WAND 4 | |
913 #define ASMO_ROD 5 | |
914 #define YENDOR_AMULET 6 | |
915 #define BRIAN_MANDOLIN 7 | |
916 #define GERYON_HORN 8 | |
917 #define HRUGGEK_MSTAR 9 | |
918 #define YEENOGHU_FLAIL 10 | |
919 #define EYE_VECNA 11 | |
920 #define AXE_AKLAD 12 | |
921 #define QUILL_NAGROM 13 | |
922 #define STONEBONES_AMULET 14 | |
923 #define SURTUR_RING 15 | |
924 #define ALTERAN_CARD 16 | |
925 #define MAXRELIC 17 | |
926 | |
927 #define MAXDAEMONS 10 | |
928 #define MAXFUSES 20 | |
929 | |
930 extern struct delayed_action d_list[MAXDAEMONS]; | |
931 extern struct delayed_action f_list[MAXFUSES]; | |
932 extern int demoncnt; /* number of active daemons */ | |
933 extern int fusecnt; | |
934 | |
935 /* Now define the structures and types */ | |
936 | |
937 /* | |
938 * character types | |
939 */ | |
940 | |
941 struct character_types { | |
942 char name[40]; /* name of character class */ | |
943 long start_exp; /* starting exp pts for 2nd level */ | |
944 long cap; /* stop doubling here */ | |
945 int hit_pts; /* hit pts gained per level */ | |
946 int base; /* Base to-hit value (AC 10) */ | |
947 int max_lvl; /* Maximum level for changing value */ | |
948 int factor; /* Amount base changes each time */ | |
949 int offset; /* What to offset level */ | |
950 int range; /* Range of levels for each offset */ | |
951 }; | |
952 | |
953 /* | |
954 * level types | |
955 */ | |
956 | |
957 typedef enum { | |
958 NORMLEV, /* normal level */ | |
959 POSTLEV, /* trading post level */ | |
960 MAZELEV, /* maze level */ | |
961 OUTSIDE, /* outside region */ | |
962 STARTLEV /* beginning of the game */ | |
963 } LEVTYPE; | |
964 | |
965 /* | |
966 * Help lists | |
967 */ | |
968 | |
969 struct h_list { | |
970 char h_ch; | |
971 char h_desc[40]; | |
972 }; | |
973 | |
974 struct item_list { | |
975 unsigned char item_ch; | |
976 char item_desc[40]; | |
977 }; | |
978 | |
979 /* | |
980 * Coordinate data type | |
981 */ | |
982 | |
983 typedef struct { | |
984 int x; | |
985 int y; | |
986 } coord; | |
987 | |
988 /* | |
989 * structure for the ways to die | |
990 */ | |
991 | |
992 struct death_type { | |
993 int reason; | |
994 char name[30]; | |
995 }; | |
996 | |
997 /* | |
998 * Linked list data type | |
999 */ | |
1000 | |
1001 struct linked_list { | |
1002 struct linked_list *l_next; | |
1003 struct linked_list *l_prev; | |
1004 char *l_data; /* Various structure pointers */ | |
1005 }; | |
1006 | |
1007 /* | |
1008 * Stuff about magic items | |
1009 */ | |
1010 | |
1011 struct magic_item { | |
1012 char mi_name[30]; | |
1013 int mi_prob; | |
1014 int mi_worth; | |
1015 int mi_curse; | |
1016 int mi_bless; | |
1017 }; | |
1018 | |
1019 /* | |
1020 * Room structure | |
1021 */ | |
1022 | |
1023 struct room { | |
1024 coord r_pos; /* Upper left corner */ | |
1025 coord r_max; /* Size of room */ | |
1026 long r_flags; /* Info about the room */ | |
1027 struct linked_list *r_fires; /* List of fire creatures in room */ | |
1028 struct linked_list *r_exit; /* Linked list of exits */ | |
1029 }; | |
1030 | |
1031 /* | |
1032 * Array of all traps on this level | |
1033 */ | |
1034 | |
1035 struct trap { | |
1036 unsigned char tr_type; /* What kind of trap */ | |
1037 unsigned char tr_show; /* Where disguised trap looks like */ | |
1038 coord tr_pos; /* Where trap is */ | |
1039 long tr_flags; /* Info about trap (i.e. ISFOUND) */ | |
1040 }; | |
1041 | |
1042 /* | |
1043 * Structure describing a fighting being | |
1044 */ | |
1045 | |
1046 struct stats { | |
1047 short s_str; /* Strength */ | |
1048 short s_intel; /* Intelligence */ | |
1049 short s_wisdom; /* Wisdom */ | |
1050 short s_dext; /* Dexterity */ | |
1051 short s_const; /* Constitution */ | |
1052 short s_charisma; /* Charisma */ | |
1053 unsigned long s_exp; /* Experience */ | |
1054 int s_lvladj; /* how much level is adjusted */ | |
1055 int s_lvl; /* Level of mastery */ | |
1056 int s_arm; /* Armor class */ | |
1057 int s_hpt; /* Hit points */ | |
1058 int s_pack; /* current weight of his pack */ | |
1059 int s_carry; /* max weight he can carry */ | |
1060 char s_dmg[30]; /* String describing damage done */ | |
1061 }; | |
1062 | |
1063 /* | |
1064 * Structure describing a fighting being (monster at initialization) | |
1065 */ | |
1066 | |
1067 struct mstats { | |
1068 short ms_str; /* Strength */ | |
1069 short ms_dex; /* dexterity */ | |
1070 short ms_move; /* movement rate */ | |
1071 unsigned long ms_exp; /* Experience */ | |
1072 short ms_lvl; /* Level of mastery */ | |
1073 short ms_arm; /* Armor class */ | |
1074 char ms_hpt[9]; /* Hit points */ | |
1075 char ms_dmg[30]; /* String describing damage done */ | |
1076 }; | |
1077 | |
1078 /* | |
1079 * Structure for monsters and player | |
1080 */ | |
1081 | |
1082 struct thing { | |
1083 bool t_wasshot; /* Was character shot last round? */ | |
1084 unsigned char t_type; /* What it is */ | |
1085 unsigned char t_disguise; /* What mimic looks like */ | |
1086 unsigned char t_oldch; /* Character that was where it was */ | |
1087 short t_ctype; /* Character type */ | |
1088 short t_index; /* Index into monster table */ | |
1089 short t_no_move; /* How long the thing can't move */ | |
1090 short t_quiet; /* used in healing */ | |
1091 short t_movement; /* Base movement rate */ | |
1092 short t_action; /* Action we're waiting to do */ | |
1093 short t_artifact; /* base chance of using artifact */ | |
1094 short t_wand; /* base chance of using wands */ | |
1095 short t_summon; /* base chance of summoning */ | |
1096 short t_cast; /* base chance of casting a spell */ | |
1097 short t_breathe; /* base chance to swing at player */ | |
1098 char *t_name; /* name player gave his pet */ | |
1099 coord t_doorgoal; /* What door are we heading to? */ | |
1100 coord *t_dest; /* Where it is running to */ | |
1101 coord t_pos; /* Position */ | |
1102 coord t_oldpos; /* Last position */ | |
1103 coord t_newpos; /* Where we want to go */ | |
1104 unsigned long t_flags[16]; /* State word */ | |
1105 struct linked_list *t_pack; /* What the thing is carrying */ | |
1106 struct linked_list *t_using; /* What the thing is using */ | |
1107 int t_selection; | |
1108 struct stats t_stats; /* Physical description */ | |
1109 struct stats maxstats; /* maximum(or initial) stats */ | |
1110 int t_reserved; /* reserved for save/restore code */ | |
1111 }; | |
1112 | |
1113 /* | |
1114 * Array containing information on all the various types of monsters | |
1115 */ | |
1116 | |
1117 struct monster { | |
1118 char m_name[30]; /* What to call the monster */ | |
1119 short m_carry; /* Probability of carrying something */ | |
1120 bool m_normal; /* Does monster exist? */ | |
1121 bool m_wander; /* Does monster wander? */ | |
1122 char m_appear; /* What does monster look like? */ | |
1123 char m_intel[8]; /* Intelligence range */ | |
1124 long m_flags[MAXFLAGS]; /* Things about the monster */ | |
1125 char m_typesum[30]; /* type of creature can he summon */ | |
1126 short m_numsum; /* how many creatures can he summon */ | |
1127 short m_add_exp; /* Added experience per hit point */ | |
1128 struct mstats m_stats; /* Initial stats */ | |
1129 }; | |
1130 | |
1131 /* | |
1132 * Structure for a thing that the rogue can carry | |
1133 */ | |
1134 | |
1135 struct object { | |
1136 int o_type; /* What kind of object it is */ | |
1137 coord o_pos; /* Where it lives on the screen */ | |
1138 char o_launch; /* What you need to launch it */ | |
1139 char o_damage[8]; /* Damage if used like sword */ | |
1140 char o_hurldmg[8]; /* Damage if thrown */ | |
1141 struct linked_list *contents; /* contents of this object */ | |
1142 int o_count; /* Count for plural objects */ | |
1143 int o_which; /* Which object of a type it is */ | |
1144 int o_hplus; /* Plusses to hit */ | |
1145 int o_dplus; /* Plusses to damage */ | |
1146 int o_ac; /* Armor class */ | |
1147 long o_flags; /* Information about objects */ | |
1148 int o_group; /* Group number for this object */ | |
1149 int o_weight; /* weight of this object */ | |
1150 unsigned char o_mark[MARKLEN]; /* Mark the specific object */ | |
1151 }; | |
1152 | |
1153 /* | |
1154 * weapon structure | |
1155 */ | |
1156 | |
1157 struct init_weps { | |
1158 char w_name[20]; /* name of weapon */ | |
1159 char w_dam[8]; /* hit damage */ | |
1160 char w_hrl[8]; /* hurl damage */ | |
1161 char w_launch; /* need to launch it */ | |
1162 int w_flags; /* flags */ | |
1163 int w_rate; /* rate of fire */ | |
1164 int w_wght; /* weight of weapon */ | |
1165 int w_worth; /* worth of this weapon */ | |
1166 }; | |
1167 | |
1168 /* | |
1169 * armor structure | |
1170 */ | |
1171 | |
1172 struct init_armor { | |
1173 char a_name[30]; /* name of armor */ | |
1174 int a_prob; /* chance of getting armor */ | |
1175 int a_class; /* normal armor class */ | |
1176 int a_worth; /* worth of armor */ | |
1177 int a_wght; /* weight of armor */ | |
1178 }; | |
1179 | |
1180 struct spells { | |
1181 short s_which; /* which scroll or potion */ | |
1182 short s_cost; /* cost of casting spell */ | |
1183 short s_type; /* scroll or potion */ | |
1184 int s_flag; /* is the spell blessed/cursed? */ | |
1185 }; | |
1186 | |
1187 struct words | |
1188 { | |
1189 char w_string[30]; | |
1190 }; | |
1191 | |
1192 #define NAMELEN 80 | |
1193 #define SYSLEN 10 | |
1194 #define LOGLEN 9 | |
1195 | |
1196 struct sc_ent { | |
1197 unsigned long sc_score; | |
1198 char sc_name[NAMELEN]; | |
1199 char sc_system[SYSLEN]; | |
1200 char sc_login[LOGLEN]; | |
1201 short sc_flags; | |
1202 short sc_level; | |
1203 short sc_ctype; | |
1204 short sc_monster; | |
1205 short sc_quest; | |
1206 }; | |
1207 | |
1208 /* | |
1209 * Other structures | |
1210 */ | |
1211 | |
1212 struct linked_list *find_mons(), *find_obj(), *get_item(), *new_item(), | |
1213 *new_thing(), *wake_monster(), *get_hurl(), *spec_item(), | |
1214 *creat_item(), *wield_weap(); | |
1215 | |
1216 struct room *roomin(); | |
1217 struct trap *trap_at(); | |
1218 | |
1219 char *getenv(), *tr_name(), *new(), *vowelstr(), | |
1220 *inv_name(), *num(), | |
1221 *ring_num(), *misc_num(), *blesscurse(), *p_kind(), *typ_name(), | |
1222 *prname(), *monster_name(), *weap_name(); | |
1223 | |
1224 coord rndmove(), *fallpos(), *doorway(), get_coordinates(); | |
1225 int can_shoot(),misc_name(); | |
1226 | |
1227 short randmonster(), id_monst(), movement(); | |
1228 | |
1229 int bugkill(), nohaste(), spell_recovery(), doctor(), runners(), swander(), | |
1230 unconfuse(), unsee(), fumble(), unclrhead(), unphase(), noslow(), | |
1231 rollwand(), stomach(), sight(), unstink(), suffocate(), cure_disease(), | |
1232 shoot_bolt(), changeclass(), appear(), dust_appear(), unchoke(), | |
1233 alchemy(), trap_look(), strangle(), ring_teleport(), ring_search(), | |
1234 grab(), dsrpt_player(), quill_charge(), make_sell_pack(), unskill(), | |
1235 findmindex(), nobolt(), nofire(), nocold(), usage_time(), eat_gold(), | |
1236 chant_recovery(), prayer_recovery(), dsrpt_monster(), opt_player(); | |
1237 | |
1238 bool blue_light(), can_blink(), creat_mons(), add_pack(), invisible(), | |
1239 straight_shot(), maze_view(), lit_room(), getdelta(), save_file(), | |
1240 save_game(), m_use_it(), m_use_pack(), get_dir(), need_dir(),passwd(); | |
1241 | |
1242 long check_level(); | |
1243 long encread(); | |
1244 long get_worth(); | |
1245 long encwrite(); | |
1246 | |
1247 void byebye(int sig), genmonsters(), quit(int sig), | |
1248 auto_save(int sig), endit(int sig), tstp(); | |
1249 | |
1250 void teleport(); | |
1251 | |
1252 int undance(), land(), cloak_charge(), wghtchk(); | |
1253 | |
1254 int add_intelligence(), add_strength(), add_wisdom(), add_dexterity(), | |
1255 add_constitution(), add_charisma(), res_intelligence(), res_strength(), | |
1256 res_wisdom(), res_dexterity(), res_constitution(), res_charisma(); | |
1257 | |
1258 /* | |
1259 * Now all the global variables | |
1260 */ | |
1261 | |
1262 extern struct trap traps[]; | |
1263 extern struct character_types char_class[]; /* character classes */ | |
1264 extern struct room rooms[]; /* One for each room -- A level */ | |
1265 extern struct room *oldrp; /* Roomin(&oldpos) */ | |
1266 extern struct linked_list *mlist; /* List of monsters on the level */ | |
1267 extern struct linked_list *tlist; /* list of monsters fallen down traps */ | |
1268 extern struct linked_list *rlist; /* list of monsters that have died */ | |
1269 extern struct death_type deaths[]; /* all the ways to die */ | |
1270 extern struct thing player; /* The rogue */ | |
1271 extern struct monster monsters[NUMMONST+1]; /* The initial monster states */ | |
1272 extern struct linked_list *lvl_obj; /* List of objects on this level */ | |
1273 extern struct linked_list *monst_dead; /* Indicates monster that got killed */ | |
1274 extern struct object *cur_weapon; /* Which weapon he is weilding */ | |
1275 extern struct object *cur_armor; /* What a well dresssed rogue wears */ | |
1276 extern struct object *cur_ring[]; /* Which rings are being worn */ | |
1277 extern struct object *cur_misc[]; /* which MM's are in use */ | |
1278 extern struct magic_item things[]; /* Chances for each type of item */ | |
1279 extern struct magic_item s_magic[]; /* Names and chances for scrolls */ | |
1280 extern struct magic_item p_magic[]; /* Names and chances for potions */ | |
1281 extern struct magic_item r_magic[]; /* Names and chances for rings */ | |
1282 extern struct magic_item ws_magic[]; /* Names and chances for sticks */ | |
1283 extern struct magic_item m_magic[]; /* Names and chances for MM */ | |
1284 extern struct magic_item rel_magic[]; /* Names and chances for relics */ | |
1285 extern struct magic_item foods[]; /* Names and chances for foods */ | |
1286 extern struct spells magic_spells[]; /* spells for magicians */ | |
1287 extern struct spells cleric_spells[]; /* spells for clerics */ | |
1288 extern struct spells druid_spells[]; /* spells for druids */ | |
1289 extern struct spells quill_scrolls[]; /* scrolls for quill */ | |
1290 extern const char *cnames[][NUM_CNAMES]; /* Character level names */ | |
1291 extern struct words abilities[NUMABILITIES]; /* Names of the various abilities */ | |
1292 extern char curpurch[]; /* name of item ready to buy */ | |
1293 extern char PLAYER; /* what the player looks like */ | |
1294 extern int nfloors; /* Number of floors in this dungeon */ | |
1295 extern int cols; /* number of columns on terminal */ | |
1296 extern int lines; /* number of lines in terminal */ | |
1297 extern int char_type; /* what type of character is player */ | |
1298 extern int foodlev; /* how fast he eats food */ | |
1299 extern int level; /* What level rogue is on */ | |
1300 extern int trader; /* number of purchases */ | |
1301 extern int curprice; /* price of an item */ | |
1302 extern long purse; /* How much gold the rogue has */ | |
1303 extern int mpos; /* Where cursor is on top line */ | |
1304 extern int ntraps; /* Number of traps on this level */ | |
1305 extern int inpack; /* Number of things in pack */ | |
1306 extern int total; /* Total dynamic memory bytes */ | |
1307 extern int lastscore; /* Score before this turn */ | |
1308 extern int no_food; /* Number of levels without food */ | |
1309 extern int foods_this_level; /* num of foods this level */ | |
1310 extern int seed; /* Random number seed */ | |
1311 extern int count; /* Number of times to repeat command */ | |
1312 extern int max_level; /* Deepest player has gone */ | |
1313 extern int cur_max; /* Deepest player has gone currently */ | |
1314 extern int prev_max; /* A flag for worm hole */ | |
1315 extern int move_free; /* Free movement check */ | |
1316 extern int food_left; /* Amount of food in hero's stomach */ | |
1317 extern int group; /* Current group number */ | |
1318 extern int hungry_state; /* How hungry is he */ | |
1319 extern int infest_dam; /* Damage from parasites */ | |
1320 extern int lost_str; /* Amount of strength lost */ | |
1321 extern int hold_count; /* Number of monsters holding player */ | |
1322 extern int trap_tries; /* Number of attempts to set traps */ | |
1323 extern int chant_time; /* Number of chant points/exp level */ | |
1324 extern int pray_time; /* Number of prayer points/exp level */ | |
1325 extern int spell_power; /* Spell power left at this level */ | |
1326 extern long turns; /* Number of turns player has taken */ | |
1327 extern int quest_item; /* Item hero is looking for */ | |
1328 extern int cur_relic[]; /* Current relics */ | |
1329 extern char take; /* Thing the rogue is taking */ | |
1330 extern char prbuf[]; /* Buffer for sprintfs */ | |
1331 extern char outbuf[]; /* Output buffer for stdout */ | |
1332 extern char runch; /* Direction player is running */ | |
1333 extern char *s_names[]; /* Names of the scrolls */ | |
1334 extern char *p_colors[]; /* Colors of the potions */ | |
1335 extern char *r_stones[]; /* Stone settings of the rings */ | |
1336 extern struct init_weps weaps[]; /* weapons and attributes */ | |
1337 extern struct init_armor armors[]; /* armors and attributes */ | |
1338 extern char *ws_made[]; /* What sticks are made of */ | |
1339 extern char *release; /* Release number of rogue */ | |
1340 extern char whoami[]; /* Name of player */ | |
1341 extern char fruit[]; /* Favorite fruit */ | |
1342 extern char huh[]; /* The last message printed */ | |
1343 extern char *s_guess[]; /* Players guess at what scroll is */ | |
1344 extern char *p_guess[]; /* Players guess at what potion is */ | |
1345 extern char *r_guess[]; /* Players guess at what ring is */ | |
1346 extern char *ws_guess[]; /* Players guess at what wand is */ | |
1347 extern char *m_guess[]; /* Players guess at what MM is */ | |
1348 extern char *ws_type[]; /* Is it a wand or a staff */ | |
1349 extern char file_name[]; /* Save file name */ | |
1350 extern char score_file[]; /* Score file name */ | |
1351 extern char home[]; /* User's home directory */ | |
1352 extern WINDOW *cw; /* Window that the player sees */ | |
1353 extern WINDOW *hw; /* Used for the help command */ | |
1354 extern WINDOW *mw; /* Used to store mosnters */ | |
1355 extern WINDOW *msgw; /* Message window */ | |
1356 extern bool pool_teleport; /* just teleported from a pool */ | |
1357 extern bool inwhgt; /* true if from wghtchk() */ | |
1358 extern bool running; /* True if player is running */ | |
1359 extern bool playing; /* True until he quits */ | |
1360 extern bool wizard; /* True if allows wizard commands */ | |
1361 extern bool after; /* True if we want after daemons */ | |
1362 extern bool notify; /* True if player wants to know */ | |
1363 extern bool fight_flush; /* True if toilet input */ | |
1364 extern bool terse; /* True if we should be short */ | |
1365 extern bool auto_pickup; /* Pick up things automatically? */ | |
1366 extern bool menu_overlay; /* Use overlay type menu */ | |
1367 extern bool door_stop; /* Stop running when we pass a door */ | |
1368 extern bool jump; /* Show running as series of jumps */ | |
1369 extern bool slow_invent; /* Inventory one line at a time */ | |
1370 extern bool def_attr; /* True for default attributes */ | |
1371 extern bool firstmove; /* First move after setting door_stop */ | |
1372 extern bool waswizard; /* Was a wizard sometime */ | |
1373 extern bool askme; /* Ask about unidentified things */ | |
1374 extern bool s_know[]; /* Does he know what a scroll does */ | |
1375 extern bool p_know[]; /* Does he know what a potion does */ | |
1376 extern bool r_know[]; /* Does he know what a ring does */ | |
1377 extern bool ws_know[]; /* Does he know what a stick does */ | |
1378 extern bool m_know[]; /* Does he know what a MM does */ | |
1379 extern bool in_shell; /* True if executing a shell */ | |
1380 extern bool daytime; /* Indicates whether it is daytime */ | |
1381 extern bool funfont; /* Is fun font available? */ | |
1382 extern coord oldpos; /* Position before last look() call */ | |
1383 extern coord grid[]; /* used for random pos generation */ | |
1384 extern char *nothing; /* "Nothing seems to happen." */ | |
1385 extern char *spacemsg; | |
1386 extern char *morestr; | |
1387 extern char *retstr; | |
1388 extern LEVTYPE levtype; | |
1389 extern int (*add_abil[NUMABILITIES])(); /* Functions to change abilities */ | |
1390 extern int (*res_abil[NUMABILITIES])(); /* Functions to change abilities */ | |
1391 extern int mf_count; /* move_free counter - see actions.c(m_act()) */ | |
1392 extern int mf_jmpcnt; /* move_free counter for # of jumps */ | |
1393 extern int killed_chance; /* cumulative chance for goodies to loose it, fight.c */ | |
1394 extern coord move_nh; /* move.c */ | |
1395 #define NCOLORS 32 | |
1396 #define NSYLLS 127 | |
1397 #define NSTONES 47 | |
1398 #define NWOOD 24 | |
1399 #define NMETAL 16 | |
1400 extern struct words rainbow[NCOLORS]; | |
1401 extern struct words sylls[NSYLLS]; | |
1402 extern struct words stones[NSTONES]; | |
1403 extern struct words wood[NWOOD]; | |
1404 extern struct words metal[NMETAL]; | |
1405 |