Annotation of early-roguelike/xrogue/rogue.h, Revision 1.1
1.1 ! rubenllo 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: #ifdef HAVE_CONFIG_H
! 20: #include "config.h"
! 21: #endif
! 22:
! 23: #include <assert.h>
! 24: #define reg register
! 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: struct delayed_action {
! 931: int d_type;
! 932: void (*d_func)();
! 933: union {
! 934: void *vp;
! 935: int i;
! 936: } d_arg;
! 937: int d_time;
! 938: };
! 939:
! 940: extern struct delayed_action d_list[MAXDAEMONS];
! 941: extern struct delayed_action f_list[MAXFUSES];
! 942: extern int demoncnt; /* number of active daemons */
! 943: extern int fusecnt;
! 944:
! 945: /* Now define the structures and types */
! 946:
! 947: /*
! 948: * character types
! 949: */
! 950:
! 951: struct character_types {
! 952: char name[40]; /* name of character class */
! 953: long start_exp; /* starting exp pts for 2nd level */
! 954: long cap; /* stop doubling here */
! 955: int hit_pts; /* hit pts gained per level */
! 956: int base; /* Base to-hit value (AC 10) */
! 957: int max_lvl; /* Maximum level for changing value */
! 958: int factor; /* Amount base changes each time */
! 959: int offset; /* What to offset level */
! 960: int range; /* Range of levels for each offset */
! 961: };
! 962:
! 963: /*
! 964: * level types
! 965: */
! 966:
! 967: typedef enum {
! 968: NORMLEV, /* normal level */
! 969: POSTLEV, /* trading post level */
! 970: MAZELEV, /* maze level */
! 971: OUTSIDE, /* outside region */
! 972: STARTLEV /* beginning of the game */
! 973: } LEVTYPE;
! 974:
! 975: /*
! 976: * Help lists
! 977: */
! 978:
! 979: struct h_list {
! 980: char h_ch;
! 981: char h_desc[40];
! 982: };
! 983:
! 984: struct item_list {
! 985: unsigned char item_ch;
! 986: char item_desc[40];
! 987: };
! 988:
! 989: /*
! 990: * Coordinate data type
! 991: */
! 992:
! 993: typedef struct {
! 994: int x;
! 995: int y;
! 996: } coord;
! 997:
! 998: /*
! 999: * structure for the ways to die
! 1000: */
! 1001:
! 1002: struct death_type {
! 1003: int reason;
! 1004: char name[30];
! 1005: };
! 1006:
! 1007: /*
! 1008: * Linked list data type
! 1009: */
! 1010:
! 1011: struct linked_list {
! 1012: struct linked_list *l_next;
! 1013: struct linked_list *l_prev;
! 1014: char *l_data; /* Various structure pointers */
! 1015: };
! 1016:
! 1017: /*
! 1018: * Stuff about magic items
! 1019: */
! 1020:
! 1021: struct magic_item {
! 1022: char mi_name[30];
! 1023: int mi_prob;
! 1024: int mi_worth;
! 1025: int mi_curse;
! 1026: int mi_bless;
! 1027: };
! 1028:
! 1029: /*
! 1030: * Room structure
! 1031: */
! 1032:
! 1033: struct room {
! 1034: coord r_pos; /* Upper left corner */
! 1035: coord r_max; /* Size of room */
! 1036: long r_flags; /* Info about the room */
! 1037: struct linked_list *r_fires; /* List of fire creatures in room */
! 1038: struct linked_list *r_exit; /* Linked list of exits */
! 1039: };
! 1040:
! 1041: /*
! 1042: * Array of all traps on this level
! 1043: */
! 1044:
! 1045: struct trap {
! 1046: unsigned char tr_type; /* What kind of trap */
! 1047: unsigned char tr_show; /* Where disguised trap looks like */
! 1048: coord tr_pos; /* Where trap is */
! 1049: long tr_flags; /* Info about trap (i.e. ISFOUND) */
! 1050: };
! 1051:
! 1052: /*
! 1053: * Structure describing a fighting being
! 1054: */
! 1055:
! 1056: struct stats {
! 1057: short s_str; /* Strength */
! 1058: short s_intel; /* Intelligence */
! 1059: short s_wisdom; /* Wisdom */
! 1060: short s_dext; /* Dexterity */
! 1061: short s_const; /* Constitution */
! 1062: short s_charisma; /* Charisma */
! 1063: unsigned long s_exp; /* Experience */
! 1064: int s_lvladj; /* how much level is adjusted */
! 1065: int s_lvl; /* Level of mastery */
! 1066: int s_arm; /* Armor class */
! 1067: int s_hpt; /* Hit points */
! 1068: int s_pack; /* current weight of his pack */
! 1069: int s_carry; /* max weight he can carry */
! 1070: char s_dmg[30]; /* String describing damage done */
! 1071: };
! 1072:
! 1073: /*
! 1074: * Structure describing a fighting being (monster at initialization)
! 1075: */
! 1076:
! 1077: struct mstats {
! 1078: short ms_str; /* Strength */
! 1079: short ms_dex; /* dexterity */
! 1080: short ms_move; /* movement rate */
! 1081: unsigned long ms_exp; /* Experience */
! 1082: short ms_lvl; /* Level of mastery */
! 1083: short ms_arm; /* Armor class */
! 1084: char ms_hpt[9]; /* Hit points */
! 1085: char ms_dmg[30]; /* String describing damage done */
! 1086: };
! 1087:
! 1088: /*
! 1089: * Structure for monsters and player
! 1090: */
! 1091:
! 1092: struct thing {
! 1093: bool t_wasshot; /* Was character shot last round? */
! 1094: unsigned char t_type; /* What it is */
! 1095: unsigned char t_disguise; /* What mimic looks like */
! 1096: unsigned char t_oldch; /* Character that was where it was */
! 1097: short t_ctype; /* Character type */
! 1098: short t_index; /* Index into monster table */
! 1099: short t_no_move; /* How long the thing can't move */
! 1100: short t_quiet; /* used in healing */
! 1101: short t_movement; /* Base movement rate */
! 1102: short t_action; /* Action we're waiting to do */
! 1103: short t_artifact; /* base chance of using artifact */
! 1104: short t_wand; /* base chance of using wands */
! 1105: short t_summon; /* base chance of summoning */
! 1106: short t_cast; /* base chance of casting a spell */
! 1107: short t_breathe; /* base chance to swing at player */
! 1108: char *t_name; /* name player gave his pet */
! 1109: coord t_doorgoal; /* What door are we heading to? */
! 1110: coord *t_dest; /* Where it is running to */
! 1111: coord t_pos; /* Position */
! 1112: coord t_oldpos; /* Last position */
! 1113: coord t_newpos; /* Where we want to go */
! 1114: unsigned long t_flags[16]; /* State word */
! 1115: struct linked_list *t_pack; /* What the thing is carrying */
! 1116: struct linked_list *t_using; /* What the thing is using */
! 1117: int t_selection;
! 1118: struct stats t_stats; /* Physical description */
! 1119: struct stats maxstats; /* maximum(or initial) stats */
! 1120: int t_reserved; /* reserved for save/restore code */
! 1121: };
! 1122:
! 1123: /*
! 1124: * Array containing information on all the various types of monsters
! 1125: */
! 1126:
! 1127: struct monster {
! 1128: char m_name[30]; /* What to call the monster */
! 1129: short m_carry; /* Probability of carrying something */
! 1130: bool m_normal; /* Does monster exist? */
! 1131: bool m_wander; /* Does monster wander? */
! 1132: char m_appear; /* What does monster look like? */
! 1133: char m_intel[8]; /* Intelligence range */
! 1134: long m_flags[MAXFLAGS]; /* Things about the monster */
! 1135: char m_typesum[30]; /* type of creature can he summon */
! 1136: short m_numsum; /* how many creatures can he summon */
! 1137: short m_add_exp; /* Added experience per hit point */
! 1138: struct mstats m_stats; /* Initial stats */
! 1139: };
! 1140:
! 1141: /*
! 1142: * Structure for a thing that the rogue can carry
! 1143: */
! 1144:
! 1145: struct object {
! 1146: int o_type; /* What kind of object it is */
! 1147: coord o_pos; /* Where it lives on the screen */
! 1148: char o_launch; /* What you need to launch it */
! 1149: char o_damage[8]; /* Damage if used like sword */
! 1150: char o_hurldmg[8]; /* Damage if thrown */
! 1151: struct linked_list *contents; /* contents of this object */
! 1152: int o_count; /* Count for plural objects */
! 1153: int o_which; /* Which object of a type it is */
! 1154: int o_hplus; /* Plusses to hit */
! 1155: int o_dplus; /* Plusses to damage */
! 1156: int o_ac; /* Armor class */
! 1157: long o_flags; /* Information about objects */
! 1158: int o_group; /* Group number for this object */
! 1159: int o_weight; /* weight of this object */
! 1160: unsigned char o_mark[MARKLEN]; /* Mark the specific object */
! 1161: };
! 1162:
! 1163: /*
! 1164: * weapon structure
! 1165: */
! 1166:
! 1167: struct init_weps {
! 1168: char w_name[20]; /* name of weapon */
! 1169: char w_dam[8]; /* hit damage */
! 1170: char w_hrl[8]; /* hurl damage */
! 1171: char w_launch; /* need to launch it */
! 1172: int w_flags; /* flags */
! 1173: int w_rate; /* rate of fire */
! 1174: int w_wght; /* weight of weapon */
! 1175: int w_worth; /* worth of this weapon */
! 1176: };
! 1177:
! 1178: /*
! 1179: * armor structure
! 1180: */
! 1181:
! 1182: struct init_armor {
! 1183: char a_name[30]; /* name of armor */
! 1184: int a_prob; /* chance of getting armor */
! 1185: int a_class; /* normal armor class */
! 1186: int a_worth; /* worth of armor */
! 1187: int a_wght; /* weight of armor */
! 1188: };
! 1189:
! 1190: struct spells {
! 1191: short s_which; /* which scroll or potion */
! 1192: short s_cost; /* cost of casting spell */
! 1193: short s_type; /* scroll or potion */
! 1194: int s_flag; /* is the spell blessed/cursed? */
! 1195: };
! 1196:
! 1197: struct words
! 1198: {
! 1199: char w_string[30];
! 1200: };
! 1201:
! 1202: #define NAMELEN 80
! 1203: #define SYSLEN 10
! 1204: #define LOGLEN 9
! 1205:
! 1206: struct sc_ent {
! 1207: unsigned long sc_score;
! 1208: char sc_name[NAMELEN];
! 1209: char sc_system[SYSLEN];
! 1210: char sc_login[LOGLEN];
! 1211: short sc_flags;
! 1212: short sc_level;
! 1213: short sc_ctype;
! 1214: short sc_monster;
! 1215: short sc_quest;
! 1216: };
! 1217:
! 1218: /*
! 1219: * Other structures
! 1220: */
! 1221:
! 1222: void _attach(struct linked_list **list, struct linked_list *item);
! 1223: void _detach(struct linked_list **list, struct linked_list *item);
! 1224: void _o_free_list(struct linked_list **ptr);
! 1225: void _r_free_fire_list(struct linked_list **ptr);
! 1226: void _r_free_list(struct linked_list **ptr);
! 1227: void _t_free_list(struct linked_list **ptr);
! 1228: int ac_compute(bool ignoremetal);
! 1229: void activity(void);
! 1230: bool add_pack(struct linked_list *item, bool silent);
! 1231: void add_slow(void);
! 1232: void addmsg(char *fmt, ...);
! 1233: void affect(void);
! 1234: void aggravate(bool do_uniques, bool do_good);
! 1235: void alchemy(struct object *obj);
! 1236: void appear(void);
! 1237: bool attack(struct thing *mp, struct object *weapon, bool thrown);
! 1238: void auto_save(int sig);
! 1239: char be_trapped(struct thing *th, coord *tc);
! 1240: bool blue_light(bool blessed, bool cursed);
! 1241: void buy_it(void);
! 1242: void byebye(int sig);
! 1243: bool can_blink(struct thing *tp);
! 1244: int can_shoot(coord *er, coord *ee, coord *shoot_dir);
! 1245: bool cansee(int y, int x);
! 1246: void carry_obj(struct thing *mp, int chance);
! 1247: void cast(void);
! 1248: void changeclass(int newclass);
! 1249: void chant(void);
! 1250: void chant_recovery(void);
! 1251: void chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree,
! 1252: bool flee);
! 1253: long check_level(void);
! 1254: void check_residue(struct thing *tp);
! 1255: void chg_str(int amt);
! 1256: void choose_qst(void);
! 1257: void cloak_charge(struct object *obj);
! 1258: void command(void);
! 1259: void confus_player(void);
! 1260: int const_bonus(void);
! 1261: void corr_move(int dy, int dx);
! 1262: struct linked_list *creat_item(void);
! 1263: bool creat_mons(struct thing *person, short monster, bool report);
! 1264: void create_obj(bool prompt, int which_item, int which_type);
! 1265: void cur_null(struct object *op);
! 1266: void cure_disease(void);
! 1267: void dbotline(WINDOW *scr, char *message);
! 1268: void death(short monst);
! 1269: void del_pack(struct linked_list *item);
! 1270: void destroy_item(struct linked_list *item);
! 1271: int dex_compute(void);
! 1272: int dext_plus(int dexterity);
! 1273: int dext_prot(int dexterity);
! 1274: bool diag_ok(coord *sp, coord *ep, struct thing *flgptr);
! 1275: void dip_it(void);
! 1276: void do_chase(struct thing *th);
! 1277: void do_daemons(int flag);
! 1278: void do_fuses(int flag);
! 1279: void do_maze(void);
! 1280: void do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp);
! 1281: void do_move(int dy, int dx);
! 1282: void do_panic(int who);
! 1283: void do_passages(void);
! 1284: void do_post(bool startup);
! 1285: void do_rooms(void);
! 1286: void do_run(char ch);
! 1287: void do_teleport(void);
! 1288: void do_terrain(int basey, int basex, int deltay, int deltax, bool fresh);
! 1289: void do_zap(struct thing *zapper, struct object *obj, coord *direction,
! 1290: int which, int flags);
! 1291: void doctor(struct thing *tp);
! 1292: coord *doorway(struct room *rp, coord *door);
! 1293: void draw_room(struct room *rp);
! 1294: bool drop(struct linked_list *item);
! 1295: bool dropcheck(struct object *op);
! 1296: void dsrpt_monster(struct thing *tp, bool always, bool see_him);
! 1297: void dsrpt_player(void);
! 1298: void dust_appear(void);
! 1299: void eat(void);
! 1300: void eat_gold(struct object *obj);
! 1301: int effect(struct thing *att, struct thing *def, struct object *weap,
! 1302: bool thrown, bool see_att, bool see_def);
! 1303: long encread(char *start, unsigned long size, FILE *inf);
! 1304: long encwrite(char *start, unsigned long size, FILE *outf);
! 1305: void endit(int sig);
! 1306: void endmsg(void);
! 1307: void exit_game(int flag);
! 1308: void explode(struct thing *tp);
! 1309: void extinguish(void (*dfunc)());
! 1310: void fall(struct linked_list *item, bool pr);
! 1311: coord *fallpos(coord *pos, bool be_clear, int range);
! 1312: void fatal(char *s);
! 1313: bool fight(coord *mp, struct object *weap, bool thrown);
! 1314: struct linked_list *find_mons(int y, int x);
! 1315: struct linked_list *find_obj(int y, int x);
! 1316: struct delayed_action *find_slot(void (*func)());
! 1317: int findmindex(char *name);
! 1318: void fix_stick(struct object *cur);
! 1319: void fright(struct thing *th);
! 1320: void fumble(void);
! 1321: void fuse(void (*dfunc)(), void *arg, int time, int type);
! 1322: void genmonsters(int least, bool treas);
! 1323: coord get_coordinates(void);
! 1324: bool get_dir(coord *direction);
! 1325: struct linked_list *get_hurl(struct thing *tp);
! 1326: struct linked_list *get_item(struct linked_list *list, char *purpose, int type,
! 1327: bool askfirst, bool showcost);
! 1328: int get_str(char *opt, WINDOW *win);
! 1329: long get_worth(struct object *obj);
! 1330: int getdeath(void);
! 1331: bool getdelta(char match, int *dy, int *dx);
! 1332: void give(struct thing *th);
! 1333: int grab(int y, int x);
! 1334: void gsense(void);
! 1335: void help(void);
! 1336: bool hit_monster(int y, int x, struct object *obj, struct thing *tp);
! 1337: int hitweight(void);
! 1338: void idenpack(void);
! 1339: void ident_hero(void);
! 1340: void identify(unsigned char ch);
! 1341: void init_colors(void);
! 1342: void init_foods(void);
! 1343: void init_materials(void);
! 1344: void init_misc(void);
! 1345: void init_names(void);
! 1346: void init_player(void);
! 1347: void init_stones(void);
! 1348: void init_terrain(void);
! 1349: void init_things(void);
! 1350: void init_weapon(struct object *weap, char type);
! 1351: char *inv_name(struct object *obj, bool drop);
! 1352: bool inventory(struct linked_list *list, int type);
! 1353: bool invisible(struct thing *monst);
! 1354: bool is_current(struct object *obj);
! 1355: bool is_magic(struct object *obj);
! 1356: bool isatrap(char ch);
! 1357: int itemweight(struct object *wh);
! 1358: void kill_daemon(void (*dfunc)());
! 1359: void killed(struct linked_list *item, bool pr, bool points, bool treasure);
! 1360: void land(void);
! 1361: void lengthen(void (*dfunc)(), int xtime);
! 1362: void light(coord *cp);
! 1363: bool lit_room(struct room *rp);
! 1364: void look(bool wakeup, bool runend);
! 1365: void lower_level(short who);
! 1366: void m_use_relic(struct thing *monster);
! 1367: void m_use_wand(struct thing *monster);
! 1368: void make_sell_pack(struct thing *tp);
! 1369: short makemonster(bool showall, char *action);
! 1370: bool maze_view(int y, int x);
! 1371: int misc_name(char *str, struct object *obj);
! 1372: void missile(int ydelta, int xdelta, struct linked_list *item,
! 1373: struct thing *tp);
! 1374: char *monster_name(struct thing *tp);
! 1375: bool move_hero(int why);
! 1376: short movement(struct thing *tp);
! 1377: void msg(char *fmt, ...);
! 1378: void nameitem(struct linked_list *item, bool mark);
! 1379: bool need_dir(int type, int which);
! 1380: char *new(int size);
! 1381: struct linked_list *new_item(int size);
! 1382: void new_level(LEVTYPE ltype);
! 1383: void new_monster(struct linked_list *item, short type, coord *cp,
! 1384: bool max_monster);
! 1385: struct linked_list *new_thing(int thing_type, bool allow_curse);
! 1386: void nobolt(void);
! 1387: void nocold(void);
! 1388: void nofire(void);
! 1389: void nohaste(void);
! 1390: void noslow(void);
! 1391: char *num(int n1, int n2);
! 1392: void o_discard(struct linked_list *item);
! 1393: void opt_player(void);
! 1394: void option(void);
! 1395: void over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory,
! 1396: int cursorx, char redraw);
! 1397: char pack_char(struct linked_list *list, struct object *obj);
! 1398: void parse_opts(char *str);
! 1399: bool passwd(void);
! 1400: void picky_inven(void);
! 1401: bool player_zap(int which, int flag);
! 1402: void playit(void);
! 1403: void pray(void);
! 1404: void prayer_recovery(void);
! 1405: bool price_it(void);
! 1406: char *prname(char *who, bool upper);
! 1407: void quaff(int which, int kind, int flags, bool is_potion);
! 1408: void quill_charge(void);
! 1409: void quit(int sig);
! 1410: void raise_level(void);
! 1411: short randmonster(bool wander, bool no_unique);
! 1412: void read_scroll(int which, int flag, bool is_scroll);
! 1413: void reap(void);
! 1414: void res_strength(long howmuch);
! 1415: bool restore(char *file, char *envp[]);
! 1416: void restscr(WINDOW *scr);
! 1417: int ring_eat(int hand);
! 1418: char *ring_num(struct object *obj);
! 1419: void ring_on(struct linked_list *item);
! 1420: void ring_search(void);
! 1421: void ring_teleport(void);
! 1422: int ring_value(int type);
! 1423: void rmmsg(void);
! 1424: int rnd(int range);
! 1425: void rnd_pos(struct room *rp, coord *cp);
! 1426: int rnd_room(void);
! 1427: coord rndmove(struct thing *who);
! 1428: int roll(int number, int sides);
! 1429: void rollwand(void);
! 1430: struct room *roomin(coord *cp);
! 1431: int runners(int segments);
! 1432: void runto(struct thing *runner, coord *spot);
! 1433: bool save(int which, struct thing *who, int adj);
! 1434: bool save_game(void);
! 1435: char secretdoor(int y, int x);
! 1436: void score(unsigned long amount, int flags, short monst);
! 1437: void search(bool is_thief, bool door_chime);
! 1438: void sell(struct thing *tp);
! 1439: void sell_it(void);
! 1440: void set_trap(struct thing *tp, int y, int x);
! 1441: void setup(void);
! 1442: void shoot_bolt(struct thing *shooter, coord start, coord dir,
! 1443: bool get_points, short reason, char *name, int damage);
! 1444: bool shoot_ok(int ch);
! 1445: char show(int y, int x);
! 1446: void sight(void);
! 1447: bool skirmish(struct thing *attacker, coord *mp, struct object *weap,
! 1448: bool thrown);
! 1449: struct linked_list *spec_item(int type, int which, int hit, int damage);
! 1450: void spell_recovery(void);
! 1451: void start_daemon(void (*dfunc)(), void *arg, int type);
! 1452: void status(bool display);
! 1453: void steal(void);
! 1454: bool step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
! 1455: void stomach(void);
! 1456: int str_compute(void);
! 1457: int str_plus(short str);
! 1458: void strangle(void);
! 1459: void strucpy(char *s1, char *s2, int len);
! 1460: void suffocate(void);
! 1461: void swander(void);
! 1462: bool swing(short class, int at_lvl, int op_arm, int wplus);
! 1463: void take_off(void);
! 1464: void take_with(void);
! 1465: void teleport(void);
! 1466: void total_winner(void);
! 1467: int totalenc(struct thing *tp);
! 1468: char *tr_name(char ch);
! 1469: struct trap *trap_at(int y, int x);
! 1470: void trap_look(void);
! 1471: void unchoke(void);
! 1472: void unclrhead(void);
! 1473: void unconfuse(void);
! 1474: void undance(void);
! 1475: void unphase(void);
! 1476: void unsee(void);
! 1477: void unskill(void);
! 1478: void unstink(void);
! 1479: void updpack(int getmax, struct thing *tp);
! 1480: int usage_time(struct linked_list *item);
! 1481: void use_mm(int which);
! 1482: char *vowelstr(char *str);
! 1483: void wait_for(char ch);
! 1484: struct linked_list *wake_monster(int y, int x);
! 1485: void wake_room(struct room *rp);
! 1486: void wanderer(void);
! 1487: void waste_time(void);
! 1488: int weap_move(struct thing *wielder, struct object *weap);
! 1489: char *weap_name(struct object *obj);
! 1490: void wear(void);
! 1491: void wghtchk(void);
! 1492: void whatis(struct linked_list *what);
! 1493: void wield(void);
! 1494: struct linked_list *wield_weap(struct object *thrown, struct thing *mp);
! 1495: void writelog(unsigned long amount, int flags, short monst);
! 1496: void xsense(void);
! 1497:
! 1498: char *getenv(), *misc_num();
! 1499:
! 1500: int usage_time();
! 1501:
! 1502: void tstp();
! 1503:
! 1504: int md_getuid(void);
! 1505: long md_memused(void);
! 1506: void md_normaluser(void);
! 1507: int md_rand(int range);
! 1508: unsigned int md_random_seed(void);
! 1509: void md_setup(void);
! 1510: int md_shellescape(void);
! 1511: void md_srand(int seed);
! 1512:
! 1513: /*
! 1514: * Now all the global variables
! 1515: */
! 1516:
! 1517: extern struct trap traps[];
! 1518: extern struct character_types char_class[]; /* character classes */
! 1519: extern struct room rooms[]; /* One for each room -- A level */
! 1520: extern struct room *oldrp; /* Roomin(&oldpos) */
! 1521: extern struct linked_list *mlist; /* List of monsters on the level */
! 1522: extern struct linked_list *tlist; /* list of monsters fallen down traps */
! 1523: extern struct linked_list *rlist; /* list of monsters that have died */
! 1524: extern struct death_type deaths[]; /* all the ways to die */
! 1525: extern struct thing player; /* The rogue */
! 1526: extern struct monster monsters[NUMMONST+1]; /* The initial monster states */
! 1527: extern struct linked_list *lvl_obj; /* List of objects on this level */
! 1528: extern struct linked_list *monst_dead; /* Indicates monster that got killed */
! 1529: extern struct object *cur_weapon; /* Which weapon he is weilding */
! 1530: extern struct object *cur_armor; /* What a well dresssed rogue wears */
! 1531: extern struct object *cur_ring[]; /* Which rings are being worn */
! 1532: extern struct object *cur_misc[]; /* which MM's are in use */
! 1533: extern struct magic_item things[]; /* Chances for each type of item */
! 1534: extern struct magic_item s_magic[]; /* Names and chances for scrolls */
! 1535: extern struct magic_item p_magic[]; /* Names and chances for potions */
! 1536: extern struct magic_item r_magic[]; /* Names and chances for rings */
! 1537: extern struct magic_item ws_magic[]; /* Names and chances for sticks */
! 1538: extern struct magic_item m_magic[]; /* Names and chances for MM */
! 1539: extern struct magic_item rel_magic[]; /* Names and chances for relics */
! 1540: extern struct magic_item foods[]; /* Names and chances for foods */
! 1541: extern struct spells magic_spells[]; /* spells for magicians */
! 1542: extern struct spells cleric_spells[]; /* spells for clerics */
! 1543: extern struct spells druid_spells[]; /* spells for druids */
! 1544: extern struct spells quill_scrolls[]; /* scrolls for quill */
! 1545: extern const char *cnames[][NUM_CNAMES]; /* Character level names */
! 1546: extern struct words abilities[NUMABILITIES]; /* Names of the various abilities */
! 1547: extern char curpurch[]; /* name of item ready to buy */
! 1548: extern char PLAYER; /* what the player looks like */
! 1549: extern int nfloors; /* Number of floors in this dungeon */
! 1550: extern int cols; /* number of columns on terminal */
! 1551: extern int lines; /* number of lines in terminal */
! 1552: extern int char_type; /* what type of character is player */
! 1553: extern int foodlev; /* how fast he eats food */
! 1554: extern int level; /* What level rogue is on */
! 1555: extern int trader; /* number of purchases */
! 1556: extern int curprice; /* price of an item */
! 1557: extern long purse; /* How much gold the rogue has */
! 1558: extern int mpos; /* Where cursor is on top line */
! 1559: extern int ntraps; /* Number of traps on this level */
! 1560: extern int inpack; /* Number of things in pack */
! 1561: extern int total; /* Total dynamic memory bytes */
! 1562: extern int lastscore; /* Score before this turn */
! 1563: extern int no_food; /* Number of levels without food */
! 1564: extern int foods_this_level; /* num of foods this level */
! 1565: extern int seed; /* Random number seed */
! 1566: extern int count; /* Number of times to repeat command */
! 1567: extern int max_level; /* Deepest player has gone */
! 1568: extern int cur_max; /* Deepest player has gone currently */
! 1569: extern int prev_max; /* A flag for worm hole */
! 1570: extern int move_free; /* Free movement check */
! 1571: extern int food_left; /* Amount of food in hero's stomach */
! 1572: extern int group; /* Current group number */
! 1573: extern int hungry_state; /* How hungry is he */
! 1574: extern int infest_dam; /* Damage from parasites */
! 1575: extern int lost_str; /* Amount of strength lost */
! 1576: extern int hold_count; /* Number of monsters holding player */
! 1577: extern int trap_tries; /* Number of attempts to set traps */
! 1578: extern int chant_time; /* Number of chant points/exp level */
! 1579: extern int pray_time; /* Number of prayer points/exp level */
! 1580: extern int spell_power; /* Spell power left at this level */
! 1581: extern long turns; /* Number of turns player has taken */
! 1582: extern int quest_item; /* Item hero is looking for */
! 1583: extern int cur_relic[]; /* Current relics */
! 1584: extern char take; /* Thing the rogue is taking */
! 1585: extern char prbuf[]; /* Buffer for sprintfs */
! 1586: extern char outbuf[]; /* Output buffer for stdout */
! 1587: extern char runch; /* Direction player is running */
! 1588: extern char *s_names[]; /* Names of the scrolls */
! 1589: extern char *p_colors[]; /* Colors of the potions */
! 1590: extern char *r_stones[]; /* Stone settings of the rings */
! 1591: extern struct init_weps weaps[]; /* weapons and attributes */
! 1592: extern struct init_armor armors[]; /* armors and attributes */
! 1593: extern char *ws_made[]; /* What sticks are made of */
! 1594: extern char *release; /* Release number of rogue */
! 1595: extern char whoami[]; /* Name of player */
! 1596: extern char fruit[]; /* Favorite fruit */
! 1597: extern char huh[]; /* The last message printed */
! 1598: extern char *s_guess[]; /* Players guess at what scroll is */
! 1599: extern char *p_guess[]; /* Players guess at what potion is */
! 1600: extern char *r_guess[]; /* Players guess at what ring is */
! 1601: extern char *ws_guess[]; /* Players guess at what wand is */
! 1602: extern char *m_guess[]; /* Players guess at what MM is */
! 1603: extern char *ws_type[]; /* Is it a wand or a staff */
! 1604: extern char file_name[]; /* Save file name */
! 1605: extern char score_file[]; /* Score file name */
! 1606: extern char home[]; /* User's home directory */
! 1607: extern WINDOW *cw; /* Window that the player sees */
! 1608: extern WINDOW *hw; /* Used for the help command */
! 1609: extern WINDOW *mw; /* Used to store mosnters */
! 1610: extern WINDOW *msgw; /* Message window */
! 1611: extern bool pool_teleport; /* just teleported from a pool */
! 1612: extern bool inwhgt; /* true if from wghtchk() */
! 1613: extern bool running; /* True if player is running */
! 1614: extern bool playing; /* True until he quits */
! 1615: extern bool wizard; /* True if allows wizard commands */
! 1616: extern bool after; /* True if we want after daemons */
! 1617: extern bool notify; /* True if player wants to know */
! 1618: extern bool fight_flush; /* True if toilet input */
! 1619: extern bool terse; /* True if we should be short */
! 1620: extern bool auto_pickup; /* Pick up things automatically? */
! 1621: extern bool menu_overlay; /* Use overlay type menu */
! 1622: extern bool door_stop; /* Stop running when we pass a door */
! 1623: extern bool jump; /* Show running as series of jumps */
! 1624: extern bool slow_invent; /* Inventory one line at a time */
! 1625: extern bool def_attr; /* True for default attributes */
! 1626: extern bool firstmove; /* First move after setting door_stop */
! 1627: extern bool waswizard; /* Was a wizard sometime */
! 1628: extern bool askme; /* Ask about unidentified things */
! 1629: extern bool use_savedir; /* Use common save location */
! 1630: extern bool s_know[]; /* Does he know what a scroll does */
! 1631: extern bool p_know[]; /* Does he know what a potion does */
! 1632: extern bool r_know[]; /* Does he know what a ring does */
! 1633: extern bool ws_know[]; /* Does he know what a stick does */
! 1634: extern bool m_know[]; /* Does he know what a MM does */
! 1635: extern bool in_shell; /* True if executing a shell */
! 1636: extern bool daytime; /* Indicates whether it is daytime */
! 1637: extern bool funfont; /* Is fun font available? */
! 1638: extern coord oldpos; /* Position before last look() call */
! 1639: extern coord grid[]; /* used for random pos generation */
! 1640: extern char *nothing; /* "Nothing seems to happen." */
! 1641: extern char *spacemsg;
! 1642: extern char *morestr;
! 1643: extern char *retstr;
! 1644: extern FILE *scorefi;
! 1645: extern FILE *logfile;
! 1646: extern LEVTYPE levtype;
! 1647: extern int (*add_abil[NUMABILITIES])(int); /* Functions to change abilities */
! 1648: extern int mf_count; /* move_free counter - see actions.c(m_act()) */
! 1649: extern int mf_jmpcnt; /* move_free counter for # of jumps */
! 1650: extern int killed_chance; /* cumulative chance for goodies to loose it, fight.c */
! 1651: extern coord move_nh; /* move.c */
! 1652: #define NCOLORS 32
! 1653: #define NSYLLS 127
! 1654: #define NSTONES 47
! 1655: #define NWOOD 24
! 1656: #define NMETAL 16
! 1657: extern struct words rainbow[NCOLORS];
! 1658: extern struct words sylls[NSYLLS];
! 1659: extern struct words stones[NSTONES];
! 1660: extern struct words wood[NWOOD];
! 1661: extern struct words metal[NMETAL];
! 1662:
CVSweb