Annotation of early-roguelike/urogue/rogue.h, Revision 1.1.1.1
1.1 rubenllo 1: /*
2: rogue.h - A very large header file
3:
4: UltraRogue: The Ultimate Adventure in the Dungeons of Doom
5: Copyright (C) 1984, 1991, 1997 Herb Chong
6: All rights reserved.
7:
8: Based on "Advanced Rogue"
9: Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka
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: #include <signal.h>
20: #include <stdio.h>
21: #include <stdarg.h>
22:
23: #ifndef LINT
24: #include <curses.h>
25: #else
26: #include "lint-curses.h"
27: #endif
28:
29: #define SHOTPENALTY 2 /* In line of sight of missile */
30: #define DOORPENALTY 1 /* Moving out of current room */
31:
32: /* Maximum number of different things */
33: #define MAXROOMS 9 /* max rooms per normal level */
34: #define MAXDOORS 4 /* max doors to a room */
35: #define MAXOBJ 6 /* max number of items to find on a level */
36: #define MAXTREAS 30 /* max number monsters/treasure in treasure room */
37: #define MAXTRAPS 80 /* max traps per level */
38: #define MAXTRPTRY 16 /* max attempts/level allowed for setting traps */
39: #define MAXPURCH 8 /* max purchases per trading post visit */
40: #define NUMMONST (sizeof(monsters) / sizeof(struct monster) - 2)
41: #define NUMSUMMON 48 /* number of creatures that can summon hero */
42: #define NLEVMONS 8 /* number of new monsters per level */
43: #define LINELEN 512 /* characters in a buffer */
44:
45: /* The character types */
46: #define C_FIGHTER 0
47: #define C_PALADIN 1
48: #define C_RANGER 2
49: #define C_CLERIC 3
50: #define C_DRUID 4
51: #define C_MAGICIAN 5
52: #define C_ILLUSION 6
53: #define C_THIEF 7
54: #define C_ASSASIN 8
55: #define C_NINJA 9
56: #define C_MONSTER 10
57: #define C_NOTSET 11 /* Must not be a value from above */
58:
59: /* used for ring stuff */
60: #define LEFT_1 0
61: #define LEFT_2 1
62: #define LEFT_3 2
63: #define LEFT_4 3
64: #define LEFT_5 4
65: #define RIGHT_1 5
66: #define RIGHT_2 6
67: #define RIGHT_3 7
68: #define RIGHT_4 8
69: #define RIGHT_5 9
70:
71: /* All the fun defines */
72: #define next(ptr) ((ptr)?(ptr->l_next):NULL)
73: #define prev(ptr) ((ptr)?(ptr->l_prev):NULL)
74: #define identifier(ptr) (ptr->o_ident)
75: #define winat(y,x) ( (char) \
76: ((mvwinch(mw,y,x) == ' ') ? mvwinch(stdscr,y,x) : winch(mw)) )
77:
78: #define debug if (wizard && wiz_verbose) msg
79: #define verify(b) if (b) verify_function(__FILE__, __LINE__);
80: #define DISTANCE(c1, c2) ( ((c2).x - (c1).x)*((c2).x - (c1).x) + \
81: ((c2).y - (c1).y)*((c2).y - (c1).y) )
82:
83: #define xyDISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
84: #define OBJPTR(what) ((*what).data.obj)
85: #define THINGPTR(what) ((*what).data.th)
86: #define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
87: #define hero player.t_pos
88: #define pstats player.t_stats
89: #define max_stats player.maxstats
90: #define pack player.t_pack
91: #define attach(a, b) _attach(&a, b)
92: #define detach(a, b) _detach(&a, b)
93: #define free_list(a) _free_list(&a)
94: #ifndef max
95: #define max(a, b) ((a) > (b) ? (a) : (b))
96: #define min(a, b) ((a) < (b) ? (a) : (b))
97: #endif
98: #define GOLDCALC (rnd(50 + 30 * level) + 2)
99: #define o_charges o_ac
100: #define mi_wght mi_worth
101:
102: /* Things that appear on the screens */
103: #define WALL ' '
104: #define PASSAGE '#'
105: #define DOOR '+'
106: #define FLOOR '.'
107: #define VPLAYER '@'
108: #define IPLAYER '_'
109: #define POST '^'
110: #define LAIR '('
111: #define RUSTTRAP ';'
112: #define TRAPDOOR '>'
113: #define ARROWTRAP '{'
114: #define SLEEPTRAP '$'
115: #define BEARTRAP '}'
116: #define TELTRAP '~'
117: #define DARTTRAP '`'
118: #define POOL '"'
119: #define MAZETRAP '\\'
120: #define FIRETRAP '<'
121: #define POISONTRAP '['
122: #define ARTIFACT ','
123: #define SECRETDOOR '&'
124: #define STAIRS '%'
125: #define GOLD '*'
126: #define POTION '!'
127: #define SCROLL '?'
128: #define MAGIC '$'
129: #define BMAGIC '>' /* Blessed magic */
130: #define CMAGIC '<' /* Cursed magic */
131: #define FOOD ':'
132: #define WEAPON ')'
133: #define ARMOR ']'
134: #define RING '='
135: #define STICK '/'
136:
137: /* Various constants */
138: #define HOLDTIME 2
139: #define BEARTIME 3
140: #define SLEEPTIME 4
141: #define FREEZETIME 6
142: #define STINKTIME 6
143: #define CHILLTIME (roll(2, 4))
144: #define STONETIME 8
145: #define SICKTIME 10
146: #define CLRDURATION 15
147: #define HUHDURATION 20
148: #define SMELLTIME 20
149: #define HEROTIME 20
150: #define HEALTIME 30
151: #define WANDERTIME 140
152: #define GONETIME 200
153: #define PHASEDURATION 300
154: #define SEEDURATION 850
155:
156: #define STPOS 0
157: #define BEFORE 1
158: #define AFTER 2
159:
160: #define MORETIME 150
161: #define HUNGERTIME 1300
162: #define STOMACHSIZE 2000
163:
164: #define BOLT_LENGTH 10
165: #define MARKLEN 20
166:
167: #define LINEFEED 10
168: #define CARRIAGE_RETURN 13
169: #define ESCAPE 27
170:
171: /* Adjustments for save against things */
172: #define VS_POISON 0
173: #define VS_PARALYZATION 0
174: #define VS_DEATH 0
175: #define VS_PETRIFICATION 1
176: #define VS_WAND 2
177: #define VS_BREATH 3
178: #define VS_MAGIC 4
179:
180: /*attributes for treasures in dungeon */
181: #define ISNORMAL 0x00000000UL /* Neither blessed nor cursed */
182: #define ISCURSED 0x00000001UL /* cursed */
183: #define ISKNOW 0x00000002UL /* has been identified */
184: #define ISPOST 0x00000004UL /* object is in a trading post */
185: #define ISMETAL 0x00000008UL /* is metallic */
186: #define ISPROT 0x00000010UL /* object is protected */
187: #define ISBLESSED 0x00000020UL /* blessed */
188: #define ISZAPPED 0x00000040UL /* weapon has been charged by dragon */
189: #define ISVORPED 0x00000080UL /* vorpalized weapon */
190: #define ISSILVER 0x00000100UL /* silver weapon */
191: #define ISPOISON 0x00000200UL /* poisoned weapon */
192: #define CANRETURN 0x00000400UL /* weapon returns if misses */
193: #define ISOWNED 0x00000800UL /* weapon returns always */
194: #define ISLOST 0x00001000UL /* weapon always disappears */
195: #define ISMISL 0x00002000UL /* missile weapon */
196: #define ISMANY 0x00004000UL /* show up in a group */
197: #define CANBURN 0x00008000UL /* burns monsters */
198: #define ISSHARP 0x00010000UL /* cutting edge */
199: #define ISTWOH 0x00020000UL /* needs two hands to wield */
200: #define ISLITTLE 0x00040000UL /* small weapon */
201: #define ISLAUNCHER 0x00080000UL /* used to throw other weapons */
202: #define TYP_MAGIC_MASK 0x0f000000UL
203: #define POT_MAGIC 0x01000000UL
204: #define SCR_MAGIC 0x02000000UL
205: #define ZAP_MAGIC 0x04000000UL
206: #define SP_WIZARD 0x10000000UL /* only wizards */
207: #define SP_ILLUSION 0x20000000UL /* only illusionists */
208: #define SP_CLERIC 0x40000000UL /* only clerics/paladins */
209: #define SP_DRUID 0x80000000UL /* only druids/rangers */
210: #define SP_MAGIC 0x30000000UL /* wizard or illusionist */
211: #define SP_PRAYER 0xc0000000UL /* cleric or druid */
212: #define SP_ALL 0xf0000000UL /* all special classes */
213: #define _TWO_ ISBLESSED /* more powerful spell */
214:
215: /* Various flag bits */
216: #define ISDARK 0x00000001UL
217: #define ISGONE 0x00000002UL
218: #define ISTREAS 0x00000004UL
219: #define ISFOUND 0x00000008UL
220: #define ISTHIEFSET 0x00000010UL
221: #define WASDARK 0x00000020UL
222:
223: /* struct thing t_flags (might include player) for monster attributes */
224: #define ISBLIND 0x00000001UL
225: #define ISINWALL 0x00000002UL
226: #define ISRUN 0x00000004UL
227: #define ISFLEE 0x00000008UL
228: #define ISINVIS 0x00000010UL
229: #define ISMEAN 0x00000020UL
230: #define ISGREED 0x00000040UL
231: #define CANSHOOT 0x00000080UL
232: #define ISHELD 0x00000100UL
233: #define ISHUH 0x00000200UL
234: #define ISREGEN 0x00000400UL
235: #define CANHUH 0x00000800UL
236: #define CANSEE 0x00001000UL
237: #define HASFIRE 0x00002000UL
238: #define ISSLOW 0x00004000UL
239: #define ISHASTE 0x00008000UL
240: #define ISCLEAR 0x00010000UL
241: #define CANINWALL 0x00020000UL
242: #define ISDISGUISE 0x00040000UL
243: #define CANBLINK 0x00080000UL
244: #define CANSNORE 0x00100000UL
245: #define HALFDAMAGE 0x00200000UL
246: #define CANSUCK 0x00400000UL
247: #define CANRUST 0x00800000UL
248: #define CANPOISON 0x01000000UL
249: #define CANDRAIN 0x02000000UL
250: #define ISUNIQUE 0x04000000UL
251: #define STEALGOLD 0x08000000UL
252: #define STEALMAGIC 0x10000001UL
253: #define CANDISEASE 0x10000002UL
254: #define HASDISEASE 0x10000004UL
255: #define CANSUFFOCATE 0x10000008UL
256: #define DIDSUFFOCATE 0x10000010UL
257: #define BOLTDIVIDE 0x10000020UL
258: #define BLOWDIVIDE 0x10000040UL
259: #define NOCOLD 0x10000080UL
260: #define TOUCHFEAR 0x10000100UL
261: #define BMAGICHIT 0x10000200UL
262: #define NOFIRE 0x10000400UL
263: #define NOBOLT 0x10000800UL
264: #define CARRYGOLD 0x10001000UL
265: #define CANITCH 0x10002000UL
266: #define HASITCH 0x10004000UL
267: #define DIDDRAIN 0x10008000UL
268: #define WASTURNED 0x10010000UL
269: #define CANSELL 0x10020000UL
270: #define CANBLIND 0x10040000UL
271: #define CANBBURN 0x10080000UL
272: #define ISCHARMED 0x10100000UL
273: #define CANSPEAK 0x10200000UL
274: #define CANFLY 0x10400000UL
275: #define ISFRIENDLY 0x10800000UL
276: #define CANHEAR 0x11000000UL
277: #define ISDEAF 0x12000000UL
278: #define CANSCENT 0x14000000UL
279: #define ISUNSMELL 0x18000000UL
280: #define WILLRUST 0x20000001UL
281: #define WILLROT 0x20000002UL
282: #define SUPEREAT 0x20000004UL
283: #define PERMBLIND 0x20000008UL
284: #define MAGICHIT 0x20000010UL
285: #define CANINFEST 0x20000020UL
286: #define HASINFEST 0x20000040UL
287: #define NOMOVE 0x20000080UL
288: #define CANSHRIEK 0x20000100UL
289: #define CANDRAW 0x20000200UL
290: #define CANSMELL 0x20000400UL
291: #define CANPARALYZE 0x20000800UL
292: #define CANROT 0x20001000UL
293: #define ISSCAVENGE 0x20002000UL
294: #define DOROT 0x20004000UL
295: #define CANSTINK 0x20008000UL
296: #define HASSTINK 0x20010000UL
297: #define ISSHADOW 0x20020000UL
298: #define CANCHILL 0x20040000UL
299: #define CANHUG 0x20080000UL
300: #define CANSURPRISE 0x20100000UL
301: #define CANFRIGHTEN 0x20200000UL
302: #define CANSUMMON 0x20400000UL
303: #define TOUCHSTONE 0x20800000UL
304: #define LOOKSTONE 0x21000000UL
305: #define CANHOLD 0x22000000UL
306: #define DIDHOLD 0x24000000UL
307: #define DOUBLEDRAIN 0x28000000UL
308: #define ISUNDEAD 0x30000001UL
309: #define BLESSMAP 0x30000002UL
310: #define BLESSGOLD 0x30000004UL
311: #define BLESSMONS 0x30000008UL
312: #define BLESSMAGIC 0x30000010UL
313: #define BLESSFOOD 0x30000020UL
314: #define CANBRANDOM 0x30000040UL /* Types of breath */
315: #define CANBACID 0x30000080UL
316: #define CANBFIRE 0x30000100UL
317: #define CANBBOLT 0x30000200UL
318: #define CANBGAS 0x30000400UL
319: #define CANBICE 0x30000800UL
320: #define CANBPGAS 0x30001000UL /* Paralyze gas */
321: #define CANBSGAS 0x30002000UL /* Sleeping gas */
322: #define CANBSLGAS 0x30004000UL /* Slow gas */
323: #define CANBFGAS 0x30008000UL /* Fear gas */
324: #define CANBREATHE 0x3000ffc0UL /* Can it breathe at all? */
325: #define STUMBLER 0x30010000UL
326: #define POWEREAT 0x30020000UL
327: #define ISELECTRIC 0x30040000UL
328: #define HASOXYGEN 0x30080000UL /* Doesn't need to breath air */
329: #define POWERDEXT 0x30100000UL
330: #define POWERSTR 0x30200000UL
331: #define POWERWISDOM 0x30400000UL
332: #define POWERINTEL 0x30800000UL
333: #define POWERCONST 0x31000000UL
334: #define SUPERHERO 0x32000000UL
335: #define ISUNHERO 0x34000000UL
336: #define CANCAST 0x38000000UL
337: #define CANTRAMPLE 0x40000001UL
338: #define CANSWIM 0x40000002UL
339: #define LOOKSLOW 0x40000004UL
340: #define CANWIELD 0x40000008UL
341: #define CANDARKEN 0x40000010UL
342: #define ISFAST 0x40000020UL
343: #define CANBARGAIN 0x40000040UL
344: #define NOMETAL 0x40000080UL
345: #define CANSPORE 0x40000100UL
346: #define NOSHARP 0x40000200UL
347: #define DRAINWISDOM 0x40000400UL
348: #define DRAINBRAIN 0x40000800UL
349: #define ISLARGE 0x40001000UL
350: #define ISSMALL 0x40002000UL
351: #define CANSTAB 0x40004000UL
352: #define ISFLOCK 0x40008000UL
353: #define ISSWARM 0x40010000UL
354: #define CANSTICK 0x40020000UL
355: #define CANTANGLE 0x40040000UL
356: #define DRAINMAGIC 0x40080000UL
357: #define SHOOTNEEDLE 0x40100000UL
358: #define CANZAP 0x40200000UL
359: #define HASARMOR 0x40400000UL
360: #define CANTELEPORT 0x40800000UL
361: #define ISBERSERK 0x41000000UL
362: #define ISFAMILIAR 0x42000000UL
363: #define HASFAMILIAR 0x44000000UL
364: #define SUMMONING 0x48000000UL
365: #define CANREFLECT 0x50000001UL
366: #define LOWFRIENDLY 0x50000002UL
367: #define MEDFRIENDLY 0x50000004UL
368: #define HIGHFRIENDLY 0x50000008UL
369: #define MAGICATTRACT 0x50000010UL
370: #define ISGOD 0x50000020UL
371: #define CANLIGHT 0x50000040UL
372: #define HASSHIELD 0x50000080UL
373: #define HASMSHIELD 0x50000100UL
374: #define LOWCAST 0x50000200UL
375: #define MEDCAST 0x50000400UL
376: #define HIGHCAST 0x50000800UL
377: #define WASSUMMONED 0x50001000UL
378: #define HASSUMMONED 0x50002000UL
379: #define CANTRUESEE 0x50004000UL
380:
381:
382: #define FLAGSHIFT 28UL
383: #define FLAGINDEX 0x0000000fL
384: #define FLAGMASK 0x0fffffffL
385:
386: /* on - check if a monster flag is on */
387: #define on(th, flag) \
388: ((th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & (flag & FLAGMASK))
389:
390: /* off - check if a monster flag is off */
391: #define off(th, flag) \
392: (!((th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & (flag & FLAGMASK)))
393:
394: /* turn_on - turn on a monster flag */
395: #define turn_on(th, flag) \
396: ( (th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & FLAGMASK))
397:
398: /* turn_off - turn off a monster flag */
399: #define turn_off(th, flag) \
400: ( (th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~(flag & FLAGMASK))
401:
402: #define SAME_POS(c1,c2) ( (c1.x == c2.x) && (c1.y == c2.y) )
403:
404: /* types of things */
405: /* All magic spells duplicate a potion, scroll, or stick effect */
406:
407: #define TYP_POTION 0
408: #define TYP_SCROLL 1
409: #define TYP_RING 2
410: #define TYP_STICK 3
411: #define MAXMAGICTYPES 4 /* max number of items in magic class */
412: #define MAXMAGICITEMS 50 /* max number of items in magic class */
413: #define TYP_FOOD 4
414: #define TYP_WEAPON 5
415: #define TYP_ARMOR 6
416: #define TYP_ARTIFACT 7
417: #define NUMTHINGS (sizeof(things) / sizeof(struct magic_item))
418:
419: /* Artifact types */
420: #define TR_PURSE 0
421: #define TR_PHIAL 1
422: #define TR_AMULET 2
423: #define TR_PALANTIR 3
424: #define TR_CROWN 4
425: #define TR_SCEPTRE 5
426: #define TR_SILMARIL 6
427: #define TR_WAND 7
428: #define MAXARTIFACT (sizeof(arts) / sizeof(struct init_artifact))
429:
430: /* Artifact flags */
431: #define ISUSED 01
432: #define ISACTIVE 02
433:
434: /* Potion types - add also to magic_item.c and potions.c */
435: #define P_CLEAR 0
436: #define P_GAINABIL 1
437: #define P_SEEINVIS 2
438: #define P_HEALING 3
439: #define P_MONSTDET 4
440: #define P_TREASDET 5
441: #define P_RAISELEVEL 6
442: #define P_HASTE 7
443: #define P_RESTORE 8
444: #define P_PHASE 9
445: #define P_INVIS 10
446: #define P_SMELL 11
447: #define P_HEAR 12
448: #define P_SHERO 13
449: #define P_DISGUISE 14
450: #define P_FIRERESIST 15
451: #define P_COLDRESIST 16
452: #define P_HASOXYGEN 17
453: #define P_LEVITATION 18
454: #define P_REGENERATE 19
455: #define P_SHIELD 20
456: #define P_TRUESEE 21
457: #define MAXPOTIONS 22
458:
459: /* Scroll types - add also to magic_item.c and scrolls.c */
460: #define S_CONFUSE 0
461: #define S_MAP 1
462: #define S_LIGHT 2
463: #define S_HOLD 3
464: #define S_SLEEP 4
465: #define S_ENCHANT 5
466: #define S_IDENTIFY 6
467: #define S_SCARE 7
468: #define S_GFIND 8
469: #define S_SELFTELEP 9
470: #define S_CREATE 10
471: #define S_REMOVECURSE 11
472: #define S_PETRIFY 12
473: #define S_GENOCIDE 13
474: #define S_CURING 14
475: #define S_MAKEITEMEM 15
476: #define S_PROTECT 16
477: #define S_NOTHING 17
478: #define S_SILVER 18
479: #define S_OWNERSHIP 19
480: #define S_FOODDET 20
481: #define S_ELECTRIFY 21
482: #define S_CHARM 22
483: #define S_SUMMON 23
484: #define S_REFLECT 24
485: #define S_SUMFAMILIAR 25
486: #define S_FEAR 26
487: #define S_MSHIELD 27
488: #define MAXSCROLLS 28
489:
490: /* Rod/Wand/Staff types - add also to magic_item.c and sticks.c */
491: #define WS_LIGHT 0
492: #define WS_HIT 1
493: #define WS_ELECT 2
494: #define WS_FIRE 3
495: #define WS_COLD 4
496: #define WS_POLYMORPH 5
497: #define WS_MISSILE 6
498: #define WS_SLOW_M 7
499: #define WS_DRAIN 8
500: #define WS_CHARGE 9
501: #define WS_MONSTELEP 10
502: #define WS_CANCEL 11
503: #define WS_CONFMON 12
504: #define WS_DISINTEGRATE 13
505: #define WS_ANTIMATTER 14
506: #define WS_PARALYZE 15
507: #define WS_XENOHEALING 16
508: #define WS_NOTHING 17
509: #define WS_INVIS 18
510: #define WS_BLAST 19
511: #define WS_WEB 20
512: #define WS_KNOCK 21
513: #define WS_CLOSE 22
514: #define MAXSTICKS 23
515:
516: /* Ring types */
517: #define R_PROTECT 0
518: #define R_ADDSTR 1
519: #define R_SUSABILITY 2
520: #define R_SEARCH 3
521: #define R_SEEINVIS 4
522: #define R_ALERT 5
523: #define R_AGGR 6
524: #define R_ADDHIT 7
525: #define R_ADDDAM 8
526: #define R_REGEN 9
527: #define R_DIGEST 10
528: #define R_TELEPORT 11
529: #define R_STEALTH 12
530: #define R_ADDINTEL 13
531: #define R_ADDWISDOM 14
532: #define R_HEALTH 15
533: #define R_VREGEN 16
534: #define R_LIGHT 17
535: #define R_DELUSION 18
536: #define R_CARRYING 19
537: #define R_ADORNMENT 20
538: #define R_LEVITATION 21
539: #define R_FIRERESIST 22
540: #define R_COLDRESIST 23
541: #define R_ELECTRESIST 24
542: #define R_RESURRECT 25
543: #define R_BREATHE 26
544: #define R_FREEDOM 27
545: #define R_WIZARD 28
546: #define R_PIETY 29
547: #define R_TELCONTROL 30
548: #define R_TRUESEE 31
549: #define MAXRINGS 32
550:
551: /* Weapon types */
552: #define SLING 0 /* sling */
553: #define ROCK 1 /* rocks */
554: #define BULLET 2 /* sling bullet */
555: #define BOW 3 /* short bow */
556: #define ARROW 4 /* arrow */
557: #define SILVERARROW 5 /* silver arrows */
558: #define FLAMEARROW 6 /* flaming arrows */
559: #define FOOTBOW 7 /* footbow */
560: #define FBBOLT 8 /* footbow bolt */
561: #define CROSSBOW 9 /* crossbow */
562: #define BOLT 10 /* crossbow bolt */
563:
564: #define DART 11 /* darts */
565: #define DAGGER 12 /* dagger */
566: #define HAMMER 13 /* hammer */
567: #define LEUKU 14 /* leuku */
568: #define JAVELIN 15 /* javelin */
569: #define TOMAHAWK 16 /* tomahawk */
570: #define MACHETE 17 /* machete */
571: #define THROW_AXE 18 /* throwing axe */
572: #define SHORT_SPEAR 19 /* spear */
573: #define BOOMERANG 20 /* boomerangs */
574: #define LONG_SPEAR 21 /* spear */
575: #define SHURIKEN 22 /* shurikens */
576: #define MOLOTOV 23 /* molotov cocktails */
577: #define GRENADE 24 /* grenade for explosions */
578: #define CLUB 25 /* club */
579: #define PITCHFORK 26 /* pitchfork */
580: #define SHORT_SWORD 27 /* short sword */
581: #define HAND_AXE 28 /* hand axe */
582: #define PARTISAN 29 /* partisan */
583: #define GRAIN_FLAIL 30 /* grain flail */
584: #define SINGLESTICK 31 /* singlestick */
585: #define RAPIER 32 /* rapier */
586: #define SICKLE 33 /* sickle */
587: #define HATCHET 34 /* hatchet */
588: #define SCIMITAR 35 /* scimitar */
589: #define LIGHT_MACE 36 /* mace */
590: #define MORNINGSTAR 37 /* morning star */
591: #define BROAD_SWORD 38 /* broad sword */
592: #define MINER_PICK 39 /* miner's pick */
593: #define GUISARME 40 /* guisarme */
594: #define WAR_FLAIL 41 /* war flail */
595: #define CRYSKNIFE 42 /* crysknife */
596: #define BATTLE_AXE 43 /* battle axe */
597: #define CUTLASS 44 /* cutlass sword */
598: #define GLAIVE 45 /* glaive */
599: #define PERTUSKA 46 /* pertuska */
600: #define LONG_SWORD 47 /* long sword */
601: #define LANCE 48 /* lance */
602: #define RANSEUR 49 /* ranseur */
603: #define SABRE 50 /* sabre */
604: #define SPETUM 51 /* spetum */
605: #define HALBERD 52 /* halberd */
606: #define TRIDENT 53 /* trident */
607: #define WAR_PICK 54 /* war pick */
608: #define BARDICHE 55 /* bardiche */
609: #define HEAVY_MACE 56 /* mace */
610: #define SCYTHE 57 /* great scythe */
611: #define QUARTERSTAFF 58 /* quarter staff */
612: #define BAST_SWORD 59 /* bastard sword */
613: #define PIKE 60 /* pike */
614: #define TWO_FLAIL 61 /* two-handed flail */
615: #define TWO_MAUL 62 /* two-handed maul */
616: #define TWO_PICK 63 /* two-handed pick */
617: #define TWO_SWORD 64 /* two-handed sword */
618: #define CLAYMORE 65 /* claymore sword */
619: #define MAXWEAPONS (sizeof(weaps) / sizeof(struct init_weps))
620: #define NONE 100 /* no weapon */
621:
622: /* Armor types */
623: #define SOFT_LEATHER 0
624: #define CUIRBOLILLI 1
625: #define HEAVY_LEATHER 2
626: #define RING_MAIL 3
627: #define STUDDED_LEATHER 4
628: #define SCALE_MAIL 5
629: #define PADDED_ARMOR 6
630: #define CHAIN_MAIL 7
631: #define BRIGANDINE 8
632: #define SPLINT_MAIL 9
633: #define BANDED_MAIL 10
634: #define GOOD_CHAIN 11
635: #define PLATE_MAIL 12
636: #define PLATE_ARMOR 13
637: #define MITHRIL 14
638: #define CRYSTAL_ARMOR 15
639: #define MAXARMORS (sizeof(armors) / sizeof(struct init_armor))
640:
641: /* Food types */
642: #define FD_RATION 0
643: #define FD_FRUIT 1
644: #define FD_CRAM 2
645: #define FD_CAKES 3
646: #define FD_LEMBA 4
647: #define FD_MIRUVOR 5
648: #define MAXFOODS (sizeof(fd_data) / sizeof(struct magic_item))
649:
650: /* stuff to do with encumberance */
651: #define F_OK 0 /* have plenty of food in stomach */
652: #define F_HUNGRY 1 /* player is hungry */
653: #define F_WEAK 2 /* weak from lack of food */
654: #define F_FAINT 3 /* fainting from lack of food */
655:
656: /* return values for get functions */
657: #define NORM 0 /* normal exit */
658: #define QUIT 1 /* quit option setting */
659: #define MINUS 2 /* back up one option */
660:
661: /* These are the types of inventory styles. */
662: #define INV_SLOW 0
663: #define INV_OVER 1
664: #define INV_CLEAR 2
665:
666: /* These will eventually become enumerations */
667: #define MESSAGE TRUE
668: #define NOMESSAGE FALSE
669: #define POINTS TRUE
670: #define NOPOINTS FALSE
671: #define LOWERCASE TRUE
672: #define UPPERCASE FALSE
673: #define WANDER TRUE
674: #define NOWANDER FALSE
675: #define GRAB TRUE
676: #define NOGRAB FALSE
677: #define FAMILIAR TRUE
678: #define NOFAMILIAR FALSE
679: #define MAXSTATS TRUE
680: #define NOMAXSTATS FALSE
681: #define FORCE TRUE
682: #define NOFORCE FALSE
683: #define THROWN TRUE
684: #define NOTHROWN FALSE
685:
686: /* Ways to die */
687: #define D_PETRIFY -1
688: #define D_ARROW -2
689: #define D_DART -3
690: #define D_POISON -4
691: #define D_BOLT -5
692: #define D_SUFFOCATION -6
693: #define D_POTION -7
694: #define D_INFESTATION -8
695: #define D_DROWN -9
696: #define D_FALL -10
697: #define D_FIRE -11
698: #define D_SPELLFUMBLE -12
699: #define D_DRAINLIFE -13
700: #define D_ARTIFACT -14
701: #define D_GODWRATH -15
702: #define D_CLUMSY -16
703:
704: /* values for games end */
705: #define SCOREIT -1
706: #define KILLED 0
707: #define CHICKEN 1
708: #define WINNER 2
709: #define TOTAL 3
710:
711: /*
712: * definitions for function step_ok: MONSTOK indicates it is OK to step on a
713: * monster -- it is only OK when stepping diagonally AROUND a monster
714: */
715:
716: #define MONSTOK 1
717: #define NOMONST 2
718:
719:
720:
721: #define good_monster(m) (on(m, ISCHARMED) || \
722: on(m, ISFRIENDLY) || \
723: on(m, ISFAMILIAR))
724:
725: /* Now we define the structures and types */
726:
727: /* level types */
728: typedef enum
729: {
730: NORMLEV, /* normal level */
731: POSTLEV, /* trading post level */
732: MAZELEV, /* maze level */
733: THRONE /* unique monster's throne room */
734: } LEVTYPE;
735:
736: /* Help list */
737:
738: struct h_list
739: {
740: char h_ch;
741: char *h_desc;
742: };
743:
744: /* Coordinate data type */
745: typedef struct
746: {
747: int x;
748: int y;
749: } coord;
750:
751: /* Linked list data type */
752: typedef struct linked_list
753: {
754: struct linked_list *l_next;
755: struct linked_list *l_prev;
756:
757: union
758: {
759: struct object *obj;
760: struct thing *th;
761: void *l_data;
762: } data;
763:
764: } linked_list;
765:
766: /* Stuff about magic items */
767:
768: struct magic_item
769: {
770: char *mi_name;
771: char *mi_abrev;
772: int mi_prob;
773: long mi_worth;
774: int mi_curse;
775: int mi_bless;
776: };
777:
778: /* Room structure */
779: struct room
780: {
781: coord r_pos; /* Upper left corner */
782: coord r_max; /* Size of room */
783: coord r_exit[MAXDOORS]; /* Where the exits are */
784: int r_flags; /* Info about the room */
785: int r_nexits; /* Number of exits */
786: short r_fires; /* Number of fires in room */
787: };
788:
789: /* Initial artifact stats */
790: struct init_artifact
791: {
792: char *ar_name; /* name of the artifact */
793: int ar_level; /* first level where it appears */
794: int ar_rings; /* number of ring effects */
795: int ar_potions; /* number of potion effects */
796: int ar_scrolls; /* number of scroll effects */
797: int ar_wands; /* number of wand effects */
798: int ar_worth; /* gold pieces */
799: int ar_weight; /* weight of object */
800: };
801:
802: /* Array of all traps on this level */
803:
804: struct trap
805: {
806: coord tr_pos; /* Where trap is */
807: long tr_flags; /* Info about trap (i.e. ISFOUND) */
808: char tr_type; /* What kind of trap */
809: char tr_show; /* What disguised trap looks like */
810: };
811:
812: /* Structure describing a fighting being */
813:
814: struct stats
815: {
816: char *s_dmg; /* String describing damage done */
817: long s_exp; /* Experience */
818: long s_hpt; /* Hit points */
819: int s_pack; /* current weight of his pack */
820: int s_carry; /* max weight he can carry */
821: int s_lvl; /* Level of mastery */
822: int s_arm; /* Armor class */
823: int s_acmod; /* Armor clss modifier */
824: int s_power; /* Spell points */
825: int s_str; /* Strength */
826: int s_intel; /* Intelligence */
827: int s_wisdom; /* Wisdom */
828: int s_dext; /* Dexterity */
829: int s_const; /* Constitution */
830: int s_charisma; /* Charisma */
831: };
832:
833: /* Structure describing a fighting being (monster at initialization) */
834:
835: struct mstats
836: {
837: short s_str; /* Strength */
838: long s_exp; /* Experience */
839: int s_lvl; /* Level of mastery */
840: int s_arm; /* Armor class */
841: char *s_hpt; /* Hit points */
842: char *s_dmg; /* String describing damage done */
843: };
844:
845: /* Structure for monsters and player */
846:
847: /*
848: NOTE: In initial v1.04 code the t_chasee variable will be
849: reset during the save/restore process. Eventually
850: need to implement a "thing" manager where I can
851: refer to "things" by number such that references
852: to them can be saved. Problems exist with regard
853: to removing references to "things" that have been
854: killed.
855: */
856:
857: typedef struct thing
858: {
859: long chasee_index, horde_index; /* Used in save/rest process */
860: struct linked_list *t_pack; /* What the thing is carrying */
861: struct stats t_stats; /* Physical description */
862: struct stats maxstats; /* maximum(or initial) stats */
863: int t_ischasing; /* Are we chasing someone? */
864: struct thing *t_chasee; /* Who are we chasing */
865: struct object *t_horde; /* What are we hordeing */
866: coord t_pos; /* Cuurent Position */
867: coord t_oldpos; /* Last Position */
868: coord t_nxtpos; /* Next Position */
869: long t_flags[16]; /* State word */
870: int t_praycnt; /* Times prayed... */
871: int t_trans; /* # of transactions at post */
872: int t_turn; /* If slowed, is it a turn to move */
873: int t_wasshot; /* Was character shot last round? */
874: int t_ctype; /* Character type */
875: int t_index; /* Index into monster table */
876: int t_no_move; /* How long the thing can't move */
877: int t_rest_hpt; /* used in hit point regeneration */
878: int t_rest_pow; /* used in spell point regeneration */
879: int t_doorgoal; /* What door are we heading to? */
880: char t_type; /* What it is */
881: char t_disguise; /* What mimic looks like */
882: char t_oldch; /* Character that was where it was */
883: } thing;
884:
885: /* Array containing information on all the various types of monsters */
886:
887: struct monster
888: {
889: char *m_name; /* What to call the monster */
890: short m_carry; /* Probability of carrying something */
891: int m_normal; /* Does monster exist? */
892: int m_wander; /* Does monster wander? */
893: char m_appear; /* What does monster look like? */
894: char *m_intel; /* Intelligence range */
895: unsigned long m_flags[16]; /* Things about the monster */
896: char *m_typesum; /* type of creature can he summon */
897: short m_numsum; /* how many creatures can he summon */
898: short m_add_exp; /* Added experience per hit point */
899: struct mstats m_stats; /* Initial stats */
900: };
901:
902: /* Structure for a thing that the rogue can carry */
903:
904: typedef struct object
905: {
906: coord o_pos; /* Where it lives on the screen */
907: struct linked_list *next_obj; /* The next obj. for stacked objects */
908: struct linked_list *o_bag; /* bag linked list pointer */
909: char *o_text; /* What it says if you read it */
910: char *o_damage; /* Damage if used like sword */
911: char *o_hurldmg; /* Damage if thrown */
912: long o_flags; /* Information about objects */
913: long ar_flags; /* general flags */
914: char o_type; /* What kind of object it is */
915: int o_ident; /* identifier for object */
916: unsigned int o_count; /* Count for plural objects */
917: int o_which; /* Which object of a type it is */
918: int o_hplus; /* Plusses to hit */
919: int o_dplus; /* Plusses to damage */
920: int o_ac; /* Armor class */
921: int o_group; /* Group number for this object */
922: int o_weight; /* weight of this object */
923: char o_launch; /* What you need to launch it */
924: char o_mark[MARKLEN]; /* Mark the specific object */
925: long o_worth;
926: } object;
927:
928: /* weapon structure */
929:
930: struct init_weps
931: {
932: char *w_name; /* name of weapon */
933: char *w_dam; /* hit damage */
934: char *w_hrl; /* hurl damage */
935: char w_launch; /* need to launch it */
936: int w_wght; /* weight of weapon */
937: long w_worth; /* worth of this weapon */
938: long w_flags; /* flags */
939: };
940:
941: /* armor structure */
942:
943: struct init_armor
944: {
945: char *a_name; /* name of armor */
946: long a_worth; /* worth of armor */
947: int a_prob; /* chance of getting armor */
948: int a_class; /* normal armor class */
949: int a_wght; /* weight of armor */
950: };
951:
952: struct matrix
953: {
954: int base; /* Base to-hit value (AC 10) */
955: int max_lvl;/* Maximum level for changing value */
956: int factor; /* Amount base changes each time */
957: int offset; /* What to offset level */
958: int range; /* Range of levels for each offset */
959: };
960:
961: /*
962: ANSI C Prototype Additions
963: */
964:
965: /* armor.c */
966: extern void wear(void);
967: extern void take_off(void);
968: extern void waste_time(void);
969: extern int wear_ok(struct thing *th, struct object *obj, int print_message);
970:
971: /* artifact.c */
972: extern void apply(void);
973: extern int possessed(int artifact);
974: extern int is_carrying(int artifact);
975: extern int make_artifact(void);
976: extern struct object *new_artifact(int which, struct object *cur);
977: extern void do_minor(struct object *obj);
978: extern void do_major(void);
979: extern void do_phial(void);
980: extern void do_palantir(void);
981: extern void do_sceptre(void);
982: extern void do_silmaril(void);
983: extern void do_amulet(void);
984: extern void do_bag(struct object *obj);
985: extern void do_wand(void);
986: extern void do_crown(void);
987: extern void level_eval(void);
988:
989: /* bag.c */
990:
991: typedef union
992: {
993: void *varg;
994: int *iarg;
995: struct object *obj;
996: } bag_arg;
997:
998:
999: extern struct object *apply_to_bag(struct linked_list *bag_p, int type,
1000: int (*bff_p)(struct object *obj, bag_arg *arg),
1001: int (*baf_p)(struct object *obj, bag_arg *arg, int id),
1002: void *user_arg);
1003: extern int count_bag(linked_list *bag_p, int type,
1004: int (*bff_p)(struct object *obj, bag_arg *arg));
1005: extern void del_bag(linked_list *bag_p, object *obj_p);
1006: extern struct object *pop_bag(linked_list **bag_pp, object *obj_p);
1007: extern void push_bag(linked_list **bag_pp, object *obj_p);
1008: extern struct object *scan_bag(linked_list *bag_p, int type, int id);
1009: extern struct object *select_bag(linked_list *bag_p, int type,
1010: int (*bff_p)(struct object *obj, bag_arg *arg), int index);
1011:
1012: /* chase.c */
1013:
1014: extern void do_chase(struct thing *th, int flee);
1015: extern void chase_it(coord *runner, struct thing *th);
1016: extern void runto(void);/* coord *runner, coord *spot); */
1017: extern int chase(struct thing *tp, coord *ee, int flee);
1018: extern struct room *roomin(coord cp);
1019: extern struct linked_list *find_mons(int y, int x);
1020: extern struct linked_list *f_mons_a(int y, int x, int hit_bad);
1021: extern int diag_ok(coord *sp, coord *ep, struct thing *flgptr);
1022: extern int cansee(int y, int x);
1023: extern coord *find_shoot(struct thing *tp, coord *dir);
1024: extern coord *can_shoot(coord *er, coord *ee, coord *dir);
1025: extern int straight_shot(int ery, int erx, int eey, int eex, coord *dir);
1026: extern struct linked_list *get_hurl(struct thing *tp);
1027: extern struct object *pick_weap(struct thing *tp);
1028: extern int can_blink(struct thing *tp);
1029:
1030: /* command.c */
1031:
1032: extern char fight_ch;
1033: extern char countch;
1034: extern void command(void);
1035: extern void do_after_effects(void);
1036: extern void make_omnipotent(void);
1037: extern void quit_handler(int sig);
1038: extern void quit(void);
1039: extern void search(int is_thief);
1040: extern void help(void);
1041: extern void identify(void);
1042: extern void d_level(void);
1043: extern void u_level(void);
1044: extern void call(int mark);
1045: extern int att_bonus(void);
1046:
1047: /* daemon.c */
1048:
1049: extern int demoncnt;
1050:
1051: struct delayed_action
1052: {
1053: int d_type;
1054: int d_when;
1055: int d_id;
1056: void *d_arg;
1057: int d_time;
1058: };
1059:
1060: #define EMPTY 0
1061: #define DAEMON 1
1062: #define FUSE 2
1063:
1064: typedef void fuse;
1065:
1066: typedef union
1067: {
1068: void *varg;
1069: int *iarg;
1070: struct linked_list *ll;
1071: } fuse_arg;
1072:
1073: typedef union
1074: {
1075: void *varg;
1076: int *iarg;
1077: struct thing *thingptr;
1078: } daemon_arg;
1079:
1080: struct fuse
1081: {
1082: int index;
1083: fuse (*func)(fuse_arg *arg);
1084: };
1085:
1086: struct daemon
1087: {
1088: int index;
1089: void (*func)(daemon_arg *arg);
1090: };
1091:
1092: #define MAXDAEMONS 60
1093:
1094: #define FUSE_NULL 0
1095: #define FUSE_SWANDER 1
1096: #define FUSE_UNCONFUSE 2
1097: #define FUSE_UNSCENT 3
1098: #define FUSE_SCENT 4
1099: #define FUSE_UNHEAR 5
1100: #define FUSE_HEAR 6
1101: #define FUSE_UNSEE 7
1102: #define FUSE_UNSTINK 8
1103: #define FUSE_UNCLRHEAD 9
1104: #define FUSE_UNPHASE 10
1105: #define FUSE_SIGHT 11
1106: #define FUSE_RES_STRENGTH 12
1107: #define FUSE_NOHASTE 13
1108: #define FUSE_NOSLOW 14
1109: #define FUSE_SUFFOCATE 15
1110: #define FUSE_CURE_DISEASE 16
1111: #define FUSE_UNITCH 17
1112: #define FUSE_APPEAR 18
1113: #define FUSE_UNELECTRIFY 19
1114: #define FUSE_UNBHERO 20
1115: #define FUSE_UNSHERO 21
1116: #define FUSE_UNXRAY 22
1117: #define FUSE_UNDISGUISE 23
1118: #define FUSE_SHERO 24
1119: #define FUSE_WGHTCHK 25
1120: #define FUSE_UNSUMMON 26
1121: #define FUSE_UNGAZE 27
1122: #define FUSE_UNCOLD 28
1123: #define FUSE_UNHOT 29
1124: #define FUSE_UNFLY 30
1125: #define FUSE_UNBREATHE 31
1126: #define FUSE_UNREGEN 32
1127: #define FUSE_UNSUPEREAT 33
1128: #define FUSE_UNSHIELD 34
1129: #define FUSE_UNMSHIELD 35
1130: #define FUSE_UNTRUESEE 36
1131: #define FUSE_MAX 37
1132:
1133: #define DAEMON_NULL 0
1134: #define DAEMON_DOCTOR 1
1135: #define DAEMON_ROLLWAND 2
1136: #define DAEMON_STOMACH 3
1137: #define DAEMON_RUNNERS 4
1138: #define DAEMON_MAX 5
1139:
1140: extern struct delayed_action d_list[MAXDAEMONS];
1141: extern struct daemon daemons[DAEMON_MAX];
1142: extern struct fuse fuses[FUSE_MAX];
1143:
1144: extern struct delayed_action *d_slot(void);
1145: extern struct delayed_action *find_slot(int id, int type);
1146: extern void start_daemon(int id, void *arg, int whendo);
1147: extern void kill_daemon(int id);
1148: extern void do_daemons(int now);
1149: extern void light_fuse(int id, void *arg, int time, int whendo);
1150: extern void lengthen_fuse(int id, int xtime);
1151: extern void extinguish_fuse(int id);
1152: extern void do_fuses(int flag);
1153: extern void activity(void);
1154:
1155: /* daemons.c */
1156:
1157: extern void doctor_spell_points(struct thing *tp);
1158: extern void runners(daemon_arg *arg);
1159: extern void doctor(daemon_arg *tp);
1160: extern void rollwand(daemon_arg *arg);
1161: extern void stomach(daemon_arg *arg);
1162: extern fuse swander(fuse_arg *arg);
1163: extern fuse unconfuse(fuse_arg *arg);
1164: extern fuse unscent(fuse_arg *arg);
1165: extern fuse scent(fuse_arg *arg);
1166: extern fuse unhear(fuse_arg *arg);
1167: extern fuse hear(fuse_arg *arg);
1168: extern fuse unsee(fuse_arg *arg);
1169: extern fuse unstink(fuse_arg *arg);
1170: extern fuse unclrhead(fuse_arg *arg);
1171: extern fuse unphase(fuse_arg *arg);
1172: extern fuse sight(fuse_arg *arg);
1173: extern fuse res_strength(fuse_arg *arg);
1174: extern fuse nohaste(fuse_arg *arg);
1175: extern fuse noslow(fuse_arg *arg);
1176: extern fuse suffocate(fuse_arg *arg);
1177: extern fuse cure_disease(fuse_arg *arg);
1178: extern fuse un_itch(fuse_arg *arg);
1179: extern fuse appear(fuse_arg *arg);
1180: extern fuse unelectrify(fuse_arg *arg);
1181: extern fuse unshero(fuse_arg *arg);
1182: extern fuse unbhero(fuse_arg *arg);
1183: extern fuse undisguise(fuse_arg *arg);
1184: extern fuse unsummon(fuse_arg *monst);
1185: extern fuse ungaze(fuse_arg *arg);
1186: extern fuse shero(fuse_arg *arg);
1187: extern fuse uncold(fuse_arg *arg);
1188: extern fuse unhot(fuse_arg *arg);
1189: extern fuse unfly(fuse_arg *arg);
1190: extern fuse unbreathe(fuse_arg *arg);
1191: extern fuse unregen(fuse_arg *arg);
1192: extern fuse unsupereat(fuse_arg *arg);
1193: extern fuse unshield(fuse_arg *arg);
1194: extern fuse unmshield(fuse_arg *arg);
1195: extern fuse untruesee(fuse_arg *arg);
1196: extern fuse wghtchk(fuse_arg *arg);
1197:
1198: /* encumb.h */
1199:
1200: extern void updpack(void);
1201: extern int packweight(void);
1202: extern int itemweight(struct object *wh);
1203: extern int playenc(void);
1204: extern int totalenc(void);
1205: extern int hitweight(void);
1206:
1207: /* fight.c */
1208:
1209: extern void do_fight(coord dir, int tothedeath);
1210: extern int fight(coord *mp, struct object *weap, int thrown);
1211: extern int attack(struct thing *mp, struct object *weapon, int thrown);
1212: extern int mon_mon_attack(struct thing *attacker, struct linked_list *mon,
1213: struct object *weapon, int thrown);
1214: extern int swing(int class, int at_lvl, int op_arm, int wplus);
1215: extern void init_exp(void);
1216: extern int next_exp_level(int print_message);
1217: extern void check_level(void);
1218: extern int roll_em(struct thing *att_er, struct thing *def_er,
1219: struct object *weap, int thrown, struct object *cur_weapon);
1220: extern const char *prname(char *who);
1221: extern void hit(char *ee);
1222: extern void miss(char *ee);
1223: extern int save_throw(int which, struct thing *tp);
1224: extern int save(int which);
1225: extern int dext_plus(int dexterity);
1226: extern int dext_prot(int dexterity);
1227: extern int str_plus(int str);
1228: extern int add_dam(int str);
1229: extern int hung_dam(void);
1230: extern void raise_level(void);
1231: extern void thunk(struct object *weap, char *mname);
1232: extern void m_thunk(struct object *weap, char *mname);
1233: extern void bounce(struct object *weap, char *mname);
1234: extern void m_bounce(struct object *weap, char *mname);
1235: extern void remove_monster(coord *mp, struct linked_list *item);
1236: extern int is_magic(struct object *obj);
1237: extern void killed(struct thing *killer,struct linked_list *item,
1238: int print_message, int give_points);
1239: extern struct object *wield_weap(struct object *weapon, struct thing *mp);
1240: extern void summon_help(struct thing *mons, int force);
1241: extern int maxdamage(char *cp);
1242:
1243: /* getplay.c */
1244:
1245: extern int geta_player(void);
1246: extern void puta_player(void);
1247: extern void do_getplayer(void);
1248: extern void print_stored(void);
1249: extern char *which_class(int c_class);
1250:
1251: /* ident.c */
1252:
1253: extern char print_letters[];
1254: extern int get_ident(struct object *obj_p);
1255: extern void free_ident(struct object *obj_p);
1256: extern int unprint_id(char *print_id);
1257: extern int max_print(void);
1258:
1259: /* init.c */
1260:
1261: extern void init_materials(void);
1262: extern void init_player(void);
1263: extern void init_flags(void);
1264: extern void init_things(void);
1265: extern void init_fd(void);
1266: extern void init_colors(void);
1267: extern void init_names(void);
1268: extern void init_stones(void);
1269: extern void badcheck(char *name, struct magic_item *magic, int bound);
1270:
1271: /* io.c */
1272:
1273: extern int get_string(char *buffer, WINDOW *win);
1274: extern void msg(const char *fmt, ...);
1275: extern void addmsg(const char *fmt, ...);
1276: extern void endmsg(void);
1277: extern void doadd(const char *fmt, va_list ap);
1278: extern char readchar(void);
1279: extern char readcharw(WINDOW *scr);
1280: extern void status(int display);
1281: extern void wait_for(int ch);
1282: extern void show_win(WINDOW *scr, char *message);
1283: extern void restscr(WINDOW *scr);
1284: extern void add_line(const char *fmt, ...);
1285: extern void end_line(void);
1286: extern void hearmsg(const char *fmt, ...);
1287: extern void seemsg(const char *fmt, ...);
1288:
1289: /* list.c */
1290:
1291: extern void *ur_alloc(size_t size);
1292: extern void ur_free(void *buf_p);
1293: extern void _detach(struct linked_list **list, struct linked_list *item);
1294: extern void _attach(struct linked_list **list, struct linked_list *item);
1295: extern void _attach_after(linked_list **list_pp, linked_list *list_p, linked_list *new_p);
1296: extern void _free_list(struct linked_list **ptr);
1297: extern void discard(struct linked_list *item);
1298: extern void throw_away(struct object *ptr);
1299: extern struct linked_list *new_item(int size);
1300: extern void *new_alloc(size_t size);
1301: extern struct linked_list *new_list(void);
1302:
1303: /* magic.c */
1304:
1305: /* for printing out messages */
1306:
1307: #define CAST_NORMAL 0x000 /* cast normal version */
1308: #define CAST_CURSED 0x001 /* cast cursed version */
1309: #define CAST_BLESSED 0x002 /* cast blessed version */
1310: #define CAST_CROWN 0x010 /* crown helped out */
1311: #define CAST_SEPTRE 0x020 /* septre helped out */
1312:
1313: #define MAX_SPELLS 100 /* Max # sorted_spells */
1314: #define MIN_FUMBLE_CHANCE 5
1315: #define MAX_FUMBLE_CHANCE 95
1316:
1317: /* Spells that a monster can cast */
1318:
1319: #define M_SELFTELEP 0
1320: #define M_HLNG2 1
1321: #define M_REGENERATE 2
1322: #define M_HLNG 3
1323: #define NUM_RUN 4
1324: #define M_HASTE 4
1325: #define M_SEEINVIS 5
1326: #define M_SHERO 6
1327: #define M_PHASE 7
1328: #define M_INVIS 8
1329: #define M_CANCEL 9
1330: #define M_OFFENSE 10
1331:
1332:
1333: struct spells
1334: {
1335: int sp_level; /* level of casting spell */
1336: int sp_which; /* which scroll or potion */
1337: unsigned long sp_flags; /* scroll, blessed, known */
1338: int sp_cost; /* generated in incant() */
1339: };
1340:
1341:
1342: extern void incant(struct thing *caster, coord shoot_dir);
1343: extern char *spell_name(struct spells *sp, char *buf);
1344: extern char *spell_abrev(struct spells *sp, char *buf);
1345: extern void fumble_spell(struct thing *caster, int num_fumbles);
1346: extern void learn_new_spells(void);
1347: extern struct spells *pick_monster_spell(struct thing *caster);
1348: extern int sort_spells(const void *a, const void *b);
1349:
1350: /* magicitm.c */
1351:
1352: extern struct magic_item things[]; /* Chances for each type of item*/
1353: extern struct magic_item s_magic[]; /* Names and chances for scrolls*/
1354: extern struct magic_item p_magic[]; /* Names and chances for potions*/
1355: extern struct magic_item r_magic[]; /* Names and chances for rings */
1356: extern struct magic_item ws_magic[]; /* Names and chances for sticks */
1357: extern struct magic_item fd_data[]; /* Names and chances for food */
1358: extern struct init_weps weaps[]; /* weapons and attributes */
1359: extern struct init_armor armors[]; /* armors and attributes */
1360: extern struct init_artifact arts[]; /* artifacts and attributes */
1361: extern int maxarmors;
1362: extern int maxartifact;
1363: extern int maxfoods;
1364: extern int maxpotions;
1365: extern int maxrings;
1366: extern int maxscrolls;
1367: extern int maxsticks;
1368: extern int maxweapons;
1369: extern int numthings;
1370: extern char *s_names[]; /* Names of the scrolls */
1371: extern char *p_colors[]; /* Colors of the potions */
1372: extern char *r_stones[]; /* Stone settings of the rings */
1373: extern char *guess_items[MAXMAGICTYPES][MAXMAGICITEMS];
1374: /* Players guess at what magic is */
1375: extern int know_items[MAXMAGICTYPES][MAXMAGICITEMS];
1376: /* Does he know what a magic item does */
1377: extern char *ws_type[]; /* Is it a wand or a staff */
1378: extern char *ws_made[]; /* What sticks are made of */
1379:
1380: /* main.c */
1381:
1382: extern FILE *fd_score;
1383: extern FILE *file_log;
1384: extern int summoned;
1385: extern coord dta;
1386: extern int main(int argc, char *argv[]);
1387: extern void fatal(char *s);
1388: extern int rnd(int range);
1389: extern unsigned char ucrnd(unsigned char range);
1390: extern short srnd(short range);
1391: extern unsigned long ulrnd(unsigned long range);
1392: extern int roll(int number, int sides);
1393:
1394: /* maze.c */
1395:
1396: extern void do_maze(void);
1397: extern void draw_maze(void);
1398: extern char *moffset(int y, int x);
1399: extern char *foffset(int y, int x);
1400: extern int findcells(int y, int x);
1401: extern void rmwall(int newy, int newx, int oldy, int oldx);
1402: extern void crankout(void);
1403:
1404: /* memory.c */
1405:
1406: extern void mem_debug(const int level);
1407: extern void mem_tracking(int flag);
1408: extern int mem_check(char *fname, int line);
1409: extern void *mem_malloc(const size_t bytes);
1410: extern void mem_free(const void *ptr);
1411: extern void *mem_realloc(const void *ptr, const size_t new_size);
1412: extern int mem_validate(const void *ptr);
1413:
1414: /* misc.c */
1415:
1416: extern char *tr_name(char ch, char *buf);
1417: extern void look(int wakeup);
1418: extern char secretdoor(int y, int x);
1419: extern struct linked_list *find_obj(int y, int x);
1420: extern void eat(void);
1421: extern void chg_str(int amt, int both, int lost);
1422: extern void chg_dext(int amt, int both, int lost);
1423: extern void add_haste(int blessed);
1424: extern void aggravate(void);
1425: extern char *vowelstr(char *str);
1426: extern int is_current(struct object *obj);
1427: extern int get_dir(void);
1428: extern int is_wearing(int type);
1429: extern int maze_view(int y, int x);
1430: extern void listen(void);
1431: extern void nothing_message(int flags);
1432: extern void feel_message(void);
1433: extern int const_bonus(void);
1434: extern int int_wis_bonus(void);
1435: extern void electrificate(void);
1436: extern void feed_me(int hungry_state);
1437: extern int get_monster_number(char *message);
1438:
1439: /* monsdata.c */
1440:
1441: extern struct monster monsters[];
1442: extern int nummonst;
1443:
1444: /* monsters.c */
1445:
1446: extern struct linked_list *summon_monster(int type, int familiar, int print_message);
1447: extern int randmonster(int wander, int grab);
1448: extern void new_monster(struct linked_list *item, int type, coord *cp, int max_monster);
1449: extern void wanderer(void);
1450: extern struct linked_list *wake_monster(int y, int x);
1451: extern void genocide(int flags);
1452: extern void id_monst(int monster);
1453: extern void check_residue(struct thing *tp);
1454: extern void sell(struct thing *tp);
1455: extern void carried_weapon(struct thing *owner, struct object *weapon);
1456:
1457: /* move.c */
1458:
1459: extern coord nh;
1460: extern void do_run(char ch);
1461: extern int step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
1462: extern void corr_move(int dy, int dx);
1463: extern void do_move(int dy, int dx);
1464: extern void light(coord *cp);
1465: extern int blue_light(int flags);
1466: extern char show(int y, int x);
1467: extern char be_trapped(struct thing *th, coord tc);
1468: extern void dip_it(void);
1469: extern struct trap *trap_at(int y, int x);
1470: extern void set_trap(struct thing *tp, int y, int x);
1471: extern coord rndmove(struct thing *who);
1472: extern int isatrap(int ch);
1473:
1474: /* newlvl.c */
1475:
1476: extern void new_level(LEVTYPE ltype, int special);
1477: extern void put_things(LEVTYPE ltype);
1478: extern int throne_monster;
1479: extern void do_throne(int special);
1480: extern void create_lucifer(coord *stairs);
1481:
1482: /* options.c */
1483:
1484: typedef union
1485: {
1486: void *varg;
1487: char *str;
1488: int *iarg;
1489: } opt_arg;
1490:
1491: struct optstruct
1492: {
1493: char *o_name; /* option name */
1494: char *o_prompt; /* prompt for interactive entry */
1495: opt_arg o_opt; /* pointer to thing to set */
1496: void (*o_putfunc)(opt_arg *arg,WINDOW *win);/* func to print value */
1497: int (*o_getfunc)(opt_arg *arg,WINDOW *win);/* func to get value */
1498: };
1499:
1500: typedef struct optstruct OPTION;
1501:
1502: extern void parse_opts(char *str);
1503: extern void option(void);
1504: extern void put_bool(opt_arg *iarg, WINDOW *win);
1505: extern void put_str(opt_arg *str, WINDOW *win);
1506: extern void put_abil(opt_arg *ability, WINDOW *win);
1507: extern void put_inv(opt_arg *inv, WINDOW *win);
1508: extern int get_bool(opt_arg *bp, WINDOW *win);
1509: extern int get_str(opt_arg *opt, WINDOW *win);
1510: extern int get_abil(opt_arg *abil, WINDOW *win);
1511: extern int get_inv(opt_arg *inv, WINDOW *win);
1512:
1513: /* pack.c */
1514:
1515: extern void swap_top(struct linked_list *top, struct linked_list *node);
1516: extern void get_all(struct linked_list *top);
1517: extern struct linked_list *get_stack(struct linked_list *item);
1518: extern int add_pack(struct linked_list *item, int print_message);
1519: extern void pack_report(object *obj, int print_message, char *message);
1520: extern void inventory(struct linked_list *container, int type);
1521: extern void pick_up(char ch);
1522: extern struct object *get_object(struct linked_list *container, char *purpose, int type, int (*bff_p)(struct object *obj, bag_arg *junk) );
1523: extern struct linked_list *get_item(char *purpose, int type);
1524: extern void del_pack(struct linked_list *what);
1525: extern void discard_pack(struct object *obj_p);
1526: extern void rem_pack(struct object *obj_p);
1527: extern void cur_null(struct object *op);
1528: extern void idenpack(void);
1529: extern void show_floor(void);
1530:
1531: /* passages.c */
1532:
1533: struct rdes
1534: {
1535: int conn[MAXROOMS]; /* possible to connect to room i? */
1536: int isconn[MAXROOMS]; /* connection been made to room i? */
1537: int ingraph; /* this room in graph already? */
1538: };
1539:
1540: extern void do_passages(void);
1541: extern void conn(int r1, int r2);
1542: extern void door(struct room *rm, coord *cp);
1543:
1544: /* player.c */
1545:
1546: extern void prayer(void);
1547: extern int gsense(void);
1548: extern int is_stealth(struct thing *tp);
1549: extern void steal(void);
1550: extern void affect(void);
1551: extern void undead_sense(void);
1552:
1553: /* potions.c */
1554:
1555: extern void quaff(struct thing *quaffer, int which, int flag);
1556: extern void lower_level(int who);
1557: extern void res_dexterity(void);
1558: extern void res_wisdom(void);
1559: extern void res_intelligence(void);
1560: extern void add_strength(int cursed);
1561: extern void add_intelligence(int cursed);
1562: extern void add_wisdom(int cursed);
1563: extern void add_dexterity(int cursed);
1564: extern void add_const(int cursed);
1565: extern void monquaff(struct thing *quaffer, int which, int flag);
1566:
1567: /* properti.c */
1568:
1569: extern int baf_print_item(struct object *obj_p, bag_arg *type, int id);
1570: extern int baf_identify(struct object *obj_p, bag_arg *junk, int id);
1571: extern int baf_curse(struct object *obj_p, bag_arg *junk, int id);
1572: extern int baf_decrement_test(struct object *obj_p, bag_arg *count_p, int id);
1573: extern int baf_increment(struct object *obj_p, bag_arg *count_p, int id);
1574: extern int bafcweapon(struct object *obj_p, bag_arg *junk, int id);
1575: extern int bafcarmor(struct object *obj_p, bag_arg *junk, int id);
1576: extern int bff_group(struct object *obj_p, bag_arg *new_obj_p);
1577: extern int bff_callable(struct object *obj_p, bag_arg *junk);
1578: extern int bff_markable(struct object *obj_p, bag_arg *junk);
1579: extern int bffron(object *obj_p, bag_arg *junk);
1580: extern int bff_zappable(struct object *obj_p, bag_arg *junk);
1581:
1582: /* random.c */
1583:
1584: extern void ur_srandom(unsigned x);
1585: extern long ur_random(void);
1586:
1587: /* rings.c */
1588:
1589: extern void ring_on(void);
1590: extern void ring_off(void);
1591: extern int ring_eat(int hand);
1592: extern char *ring_num(struct object *obj, char *buf);
1593: extern int ring_value(int type);
1594:
1595: /* rip.c */
1596:
1597: extern void death(int monst);
1598: extern void score(long amount, int lvl, int flags, int monst);
1599: extern void total_winner(void);
1600: extern char *killname(int monst, char *buf);
1601: extern void showpack(char *howso);
1602: extern void byebye(void);
1603: extern int save_resurrect(int bonus);
1604:
1605: /* rogue.c */
1606:
1607: extern const char *monstern;
1608: extern const struct h_list helpstr[];
1609: extern const char *cnames[][15]; /* Character level names */
1610: extern char *spacemsg;
1611: extern char *morestr;
1612: extern char *retstr;
1613:
1614: /* state.c */
1615:
1616: extern int mpos; /* Where cursor is on top line */
1617: extern struct trap traps[];
1618: extern struct room rooms[]; /* One for each room -- A level */
1619: extern struct thing player; /* The rogue */
1620: extern struct thing *beast; /* The last monster attacking */
1621: extern struct object *cur_armor; /* What a well dresssed rogue wears */
1622: extern struct object *cur_weapon; /* Which weapon he is wielding */
1623: extern struct object *cur_ring[]; /* What rings are being worn */
1624: extern struct linked_list *fam_ptr; /* A ptr to the familiar */
1625: extern struct linked_list *lvl_obj; /* List of objects on this level */
1626: extern struct linked_list *mlist; /* List of monsters on the level */
1627: extern struct linked_list *curr_mons; /* The mons. currently moving */
1628: extern struct linked_list *next_mons; /* The mons. after curr_mons */
1629:
1630: extern int prscore; /* Print scores */
1631: extern int prversion; /* Print version info */
1632:
1633: extern WINDOW *cw; /* Window that the player sees */
1634: extern WINDOW *hw; /* Used for the help command */
1635: extern WINDOW *mw; /* Used to store mosnters */
1636: extern LEVTYPE levtype;
1637: extern coord delta; /* Change indicated to get_dir() */
1638:
1639: extern char *release; /* Release number of rogue */
1640: extern char *lastfmt;
1641: extern char *lastarg;
1642: extern unsigned long total; /* Total dynamic memory bytes */
1643: extern long purse; /* How much gold the rogue has */
1644: extern int line_cnt; /* Counter for inventory style */
1645: extern int newpage;
1646: extern int resurrect; /* resurrection counter */
1647: extern int foodlev; /* how fast he eats food */
1648: extern int see_dist; /* (how far he can see)^2 */
1649: extern int level; /* What level rogue is on */
1650: extern int ntraps; /* Number of traps on this level */
1651: extern int no_command; /* Number of turns asleep */
1652: extern int no_food; /* Number of levels without food */
1653: extern int count; /* Number of times to repeat command */
1654: extern int dnum; /* Dungeon number */
1655: extern int max_level; /* Deepest player has gone */
1656: extern int food_left; /* Amount of food in hero's stomach */
1657: extern int group; /* Current group number */
1658: extern int hungry_state; /* How hungry is he */
1659: extern int infest_dam; /* Damage from parasites */
1660: extern int lost_str; /* Amount of strength lost */
1661: extern int lost_dext; /* amount of dexterity lost */
1662: extern int hold_count; /* Number of monsters holding player */
1663: extern int trap_tries; /* Number of attempts to set traps */
1664: extern int has_artifact; /* set for possesion of artifacts */
1665: extern int picked_artifact; /* set for any artifacts picked up */
1666: extern int msg_index; /* pointer to current message buffer */
1667: extern int luck; /* how expensive things to buy thing */
1668: extern int fam_type; /* Type of familiar */
1669: extern int times_prayed; /* The number of time prayed */
1670: extern int mons_summoned; /* Number of summoned monsters */
1671: extern int char_type; /* what type of character is player */
1672: extern int pool_teleport; /* just teleported from a pool */
1673: extern int inwhgt; /* true if from wghtchk() */
1674: extern int running; /* True if player is running */
1675: extern int fighting; /* True if player is fighting */
1676: extern int playing; /* True until he quits */
1677: extern int wizard; /* True if allows wizard commands */
1678: extern int wiz_verbose; /* True if show debug messages */
1679: extern int after; /* True if we want after daemons */
1680: extern int fight_flush; /* True if toilet input */
1681: extern int terse; /* True if we should be short */
1682: extern int doorstop; /* Stop running when we pass a door */
1683: extern int jump; /* Show running as series of jumps */
1684: extern int door_stop; /* Current status of doorstop */
1685: extern int firstmove; /* First move after setting door_stop */
1686: extern int waswizard; /* Was a wizard sometime */
1687: extern int canwizard; /* Will be permitted to do this */
1688: extern int askme; /* Ask about unidentified things */
1689: extern int moving; /* move using 'm' command */
1690: extern int use_savedir; /* Savefile is in system savedir */
1691:
1692: extern int inv_type; /* Inven style. Bool so options works */
1693: extern char take; /* Thing the rogue is taking */
1694: extern char PLAYER; /* what the player looks like */
1695: extern char prbuf[]; /* Buffer for sprintfs */
1696: extern char runch; /* Direction player is running */
1697: extern char whoami[]; /* Name of player */
1698: extern char fruit[]; /* Favorite fruit */
1699: extern char msgbuf[10][2 * LINELEN]; /* message buffer */
1700: extern char file_name[]; /* Save file name */
1701: extern char score_file[]; /* Score file name */
1702:
1703: extern struct linked_list *arrow, *bolt, *rock, *silverarrow, *fbbolt;
1704: extern struct linked_list *bullet, *firearrow, *dart, *dagger, *shuriken;
1705: extern struct linked_list *oil, *grenade;
1706: extern struct room *oldrp; /* Roomin(&oldpos) */
1707:
1708: extern void ur_write_thing(FILE *savef, struct thing *t);
1709: extern struct thing *ur_read_thing(FILE *savef);
1710: extern void ur_write_object_stack(FILE *savef, struct linked_list *l);
1711: extern void ur_write_bag(FILE *savef, struct linked_list *l);
1712: extern struct linked_list *ur_read_bag(FILE *savef);
1713: extern struct linked_list *ur_read_object_stack(FILE *savef);
1714: extern int restore_file(FILE *savef);
1715:
1716: /* rooms.c */
1717:
1718: extern void do_rooms(void);
1719: extern void draw_room(struct room *rp);
1720: extern void horiz(int cnt);
1721: extern void vert(int cnt);
1722: extern void rnd_pos(struct room *rp, coord *cp);
1723: extern int rnd_room(void);
1724:
1725: /* save.c */
1726:
1727: extern int restore(char *file);
1728: extern int save_game(void);
1729: extern void save_file(FILE *savefd);
1730:
1731: /* scrolls.c */
1732:
1733: extern void read_scroll(struct thing *reader, int which, int flags);
1734: extern struct linked_list *creat_mons(struct thing *person,int monster,int message);
1735: extern int place_mons(int y, int x, coord *pos);
1736: extern int is_r_on(struct object *obj);
1737: extern void monread(struct thing *reader, int which, int flags);
1738:
1739: /* status.c */
1740:
1741: extern int has_defensive_spell(struct thing th);
1742:
1743: /* sticks.c */
1744:
1745: extern void fix_stick(struct object *cur);
1746: extern void do_zap(struct thing *zapper, int which, unsigned long flags);
1747: extern void drain(int ymin, int ymax, int xmin, int xmax);
1748: extern char *charge_str(struct object *obj, char *buf);
1749: extern void shoot_bolt(struct thing *shooter, coord start, coord dir, int get_points, int reason, char *name, int damage);
1750: extern void monster_do_zap(struct thing *zapper, int which, int flags);
1751: extern void cancel_player(int not_unique);
1752:
1753: /* things.c */
1754:
1755: extern char *inv_name(struct object *obj, int lowercase);
1756: extern void rem_obj(struct linked_list *item, int dis);
1757: extern void add_obj(struct linked_list *item, int y, int x);
1758: extern int drop(struct linked_list *item);
1759: extern int dropcheck(struct object *op);
1760: extern struct linked_list *new_thing(void);
1761: extern struct linked_list *spec_item(char type, int which, int hit, int damage);
1762: extern int pick_one(struct magic_item *magic, int nitems);
1763: extern char *blesscurse(long flags);
1764: extern int extras(void);
1765: extern char *name_type(int type);
1766: extern linked_list *make_item(object *obj_p);
1767: extern int is_member(char *list_p, int member);
1768:
1769: /* trader.c */
1770:
1771: extern void do_post(void);
1772: extern void buy_it(char itemtype, int flags);
1773: extern void sell_it(void);
1774: extern void describe_it(struct object *obj);
1775: extern int open_market(void);
1776: extern int get_worth(struct object *obj);
1777: extern void trans_line(void);
1778:
1779: /* verify.c */
1780:
1781: extern void verify_function(const char *file, const int line);
1782:
1783: /* vers.c */
1784:
1785: extern char *save_format;
1786: extern char *version;
1787: extern char *release;
1788:
1789: /* weapons.c */
1790:
1791: extern coord do_motion(int ob, int ydelta, int xdelta, struct thing *tp);
1792: extern void fall(struct thing *tp, struct linked_list *item, int pr, int
1793: player_owned);
1794: extern int hit_monster(int y, int x, struct object *weapon, struct thing *thrower);
1795: extern int wield_ok(struct thing *wieldee, struct object *obj, int print_message);
1796: extern int shoot_ok(int ch);
1797: extern int fallpos(coord pos, coord *newpos);
1798: extern void wield(void);
1799: extern char *num(int n1, int n2, char *buf);
1800: extern void init_weapon(struct object *weap, int type);
1801: extern void missile(int ydelta, int xdelta, struct linked_list *item, struct thing *tp);
1802:
1803: /* wizard.c */
1804:
1805: extern void whatis(struct linked_list *what);
1806: extern void teleport(void);
1807: extern int passwd(void);
1808:
1809: /* mdport.c */
1810: char *md_strdup(const char *s);
1811: long md_random(void);
1812: void md_srandom(long seed);
1813: int md_readchar(WINDOW *win);
1814: int md_getuid(void);
1815: void md_normaluser(void);
1816: void md_onsignal_autosave(void);
1817: void md_ignore_signals(void);
1818:
1819: #define NOOP(x) (x += 0)
1820: #define CCHAR(x) ( (char) (x & A_CHARTEXT) )
CVSweb