[BACK]Return to rogue.h CVS log [TXT][DIR] Up to [contributed] / early-roguelike / arogue5

Annotation of early-roguelike/arogue5/rogue.h, Revision 1.1.1.1

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

CVSweb