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