view urogue/rogue.h @ 295:1e1c81fbb533

Rogue V5: fix elemental wands. Bolts often failed to hit, due to some struct members not being initialized. Reported by 'LazyCat' from RogueTemple.
author John "Elwin" Edwards
date Fri, 12 Jan 2018 18:02:39 -0500
parents 1db299e868b8
children
line wrap: on
line source

/*
    rogue.h - A very large header file
 
    UltraRogue: The Ultimate Adventure in the Dungeons of Doom
    Copyright (C) 1984, 1991, 1997 Herb Chong
    All rights reserved.

    Based on "Advanced Rogue"
    Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka
    All rights reserved.

    Based on "Rogue: Exploring the Dungeons of Doom"
    Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
    All rights reserved.

    See the file LICENSE.TXT for full copyright and licensing information.
*/

#include <signal.h>
#include <stdio.h>
#include <stdarg.h>

#ifndef LINT
#include <curses.h>
#else
#include "lint-curses.h"
#endif

#define SHOTPENALTY 2       /* In line of sight of missile */
#define DOORPENALTY 1       /* Moving out of current room */

/* Maximum number of different things */
#define MAXROOMS    9   /* max rooms per normal level */
#define MAXDOORS    4   /* max doors to a room */
#define MAXOBJ      6   /* max number of items to find on a level */
#define MAXTREAS    30  /* max number monsters/treasure in treasure room */
#define MAXTRAPS    80  /* max traps per level */
#define MAXTRPTRY   16  /* max attempts/level allowed for setting traps */
#define MAXPURCH    8   /* max purchases per trading post visit */
#define NUMMONST    (sizeof(monsters) / sizeof(struct monster) - 2)
#define NUMSUMMON   48  /* number of creatures that can summon hero */
#define NLEVMONS    8   /* number of new monsters per level */
#define LINELEN     512 /* characters in a buffer */

/* The character types */
#define C_FIGHTER    0
#define C_PALADIN    1
#define C_RANGER     2
#define C_CLERIC     3
#define C_DRUID      4
#define C_MAGICIAN   5
#define C_ILLUSION   6
#define C_THIEF      7
#define C_ASSASIN    8
#define C_NINJA      9
#define C_MONSTER   10
#define C_NOTSET    11  /* Must not be a value from above */

/* used for ring stuff */
#define LEFT_1  0
#define LEFT_2  1
#define LEFT_3  2
#define LEFT_4  3
#define LEFT_5  4
#define RIGHT_1 5
#define RIGHT_2 6
#define RIGHT_3 7
#define RIGHT_4 8
#define RIGHT_5 9

/* All the fun defines */
#define next(ptr) ((ptr)?(ptr->l_next):NULL)
#define prev(ptr) ((ptr)?(ptr->l_prev):NULL)
#define identifier(ptr) (ptr->o_ident)
#define winat(y,x) ( (char) \
 ((mvwinch(mw,y,x) == ' ') ? mvwinch(stdscr,y,x) : winch(mw))  )

#define debug if (wizard && wiz_verbose) msg
#define verify(b) if (b) verify_function(__FILE__, __LINE__);
#define DISTANCE(c1, c2)  ( ((c2).x - (c1).x)*((c2).x - (c1).x) + \
                            ((c2).y - (c1).y)*((c2).y - (c1).y) )

#define xyDISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
#define OBJPTR(what)    ((*what).data.obj)
#define THINGPTR(what)  ((*what).data.th)
#define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
#define hero player.t_pos
#define pstats player.t_stats
#define max_stats player.maxstats
#define pack player.t_pack
#define attach(a, b) _attach(&a, b)
#define detach(a, b) _detach(&a, b)
#define free_list(a) _free_list(&a)
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
#define GOLDCALC (rnd(50 + 30 * level) + 2)
#define o_charges o_ac
#define mi_wght mi_worth

/* Things that appear on the screens */
#define WALL        ' '
#define PASSAGE     '#'
#define DOOR        '+'
#define FLOOR       '.'
#define VPLAYER     '@'
#define IPLAYER     '_'
#define POST        '^'
#define LAIR        '('
#define RUSTTRAP    ';'
#define TRAPDOOR    '>'
#define ARROWTRAP   '{'
#define SLEEPTRAP   '$'
#define BEARTRAP    '}'
#define TELTRAP     '~'
#define DARTTRAP    '`'
#define POOL        '"'
#define MAZETRAP    '\\'
#define FIRETRAP    '<'
#define POISONTRAP  '['
#define ARTIFACT    ','
#define SECRETDOOR  '&'
#define STAIRS      '%'
#define GOLD        '*'
#define POTION      '!'
#define SCROLL      '?'
#define MAGIC       '$'
#define BMAGIC      '>' /* Blessed magic */
#define CMAGIC      '<' /* Cursed  magic */
#define FOOD        ':'
#define WEAPON      ')'
#define ARMOR       ']'
#define RING        '='
#define STICK       '/'

/* Various constants */
#define HOLDTIME      2
#define BEARTIME      3
#define SLEEPTIME     4
#define FREEZETIME    6
#define STINKTIME     6
#define CHILLTIME     (roll(2, 4))
#define STONETIME     8
#define SICKTIME     10
#define CLRDURATION  15
#define HUHDURATION  20
#define SMELLTIME    20
#define HEROTIME     20
#define HEALTIME     30
#define WANDERTIME   140
#define GONETIME    200
#define PHASEDURATION   300
#define SEEDURATION 850

#define STPOS         0
#define BEFORE        1
#define AFTER         2

#define MORETIME     150
#define HUNGERTIME  1300
#define STOMACHSIZE 2000

#define BOLT_LENGTH 10
#define MARKLEN     20

#define LINEFEED    10
#define CARRIAGE_RETURN 13
#define ESCAPE      27

/* Adjustments for save against things */
#define VS_POISON       0
#define VS_PARALYZATION     0
#define VS_DEATH        0
#define VS_PETRIFICATION    1
#define VS_WAND         2
#define VS_BREATH       3
#define VS_MAGIC        4

/*attributes for treasures in dungeon */
#define ISNORMAL    0x00000000UL /* Neither blessed nor cursed */
#define ISCURSED    0x00000001UL /* cursed */
#define ISKNOW      0x00000002UL /* has been identified */
#define ISPOST      0x00000004UL /* object is in a trading post */
#define ISMETAL     0x00000008UL /* is metallic */
#define ISPROT      0x00000010UL /* object is protected */
#define ISBLESSED   0x00000020UL /* blessed */
#define ISZAPPED    0x00000040UL /* weapon has been charged by dragon */
#define ISVORPED    0x00000080UL /* vorpalized weapon */
#define ISSILVER    0x00000100UL /* silver weapon */
#define ISPOISON    0x00000200UL /* poisoned weapon */
#define CANRETURN   0x00000400UL /* weapon returns if misses */
#define ISOWNED     0x00000800UL /* weapon returns always */
#define ISLOST      0x00001000UL /* weapon always disappears */
#define ISMISL      0x00002000UL /* missile weapon */
#define ISMANY      0x00004000UL /* show up in a group */
#define CANBURN     0x00008000UL /* burns monsters */
#define ISSHARP     0x00010000UL /* cutting edge */
#define ISTWOH      0x00020000UL /* needs two hands to wield */
#define ISLITTLE    0x00040000UL /* small weapon */
#define ISLAUNCHER  0x00080000UL /* used to throw other weapons */
#define TYP_MAGIC_MASK  0x0f000000UL
#define POT_MAGIC   0x01000000UL
#define SCR_MAGIC   0x02000000UL
#define ZAP_MAGIC   0x04000000UL
#define SP_WIZARD   0x10000000UL /* only wizards */
#define SP_ILLUSION 0x20000000UL /* only illusionists */
#define SP_CLERIC   0x40000000UL /* only clerics/paladins */
#define SP_DRUID    0x80000000UL /* only druids/rangers */
#define SP_MAGIC    0x30000000UL /* wizard or illusionist */
#define SP_PRAYER   0xc0000000UL /* cleric or druid */
#define SP_ALL      0xf0000000UL /* all special classes */
#define _TWO_       ISBLESSED   /* more powerful spell */

/* Various flag bits */
#define ISDARK      0x00000001UL
#define ISGONE      0x00000002UL
#define ISTREAS     0x00000004UL
#define ISFOUND     0x00000008UL
#define ISTHIEFSET  0x00000010UL
#define WASDARK     0x00000020UL

/* struct thing t_flags (might include player) for monster attributes */
#define ISBLIND     0x00000001UL
#define ISINWALL    0x00000002UL
#define ISRUN       0x00000004UL
#define ISFLEE      0x00000008UL
#define ISINVIS     0x00000010UL
#define ISMEAN      0x00000020UL
#define ISGREED     0x00000040UL
#define CANSHOOT    0x00000080UL
#define ISHELD      0x00000100UL
#define ISHUH       0x00000200UL
#define ISREGEN     0x00000400UL
#define CANHUH      0x00000800UL
#define CANSEE      0x00001000UL
#define HASFIRE     0x00002000UL
#define ISSLOW      0x00004000UL
#define ISHASTE     0x00008000UL
#define ISCLEAR     0x00010000UL
#define CANINWALL   0x00020000UL
#define ISDISGUISE  0x00040000UL
#define CANBLINK    0x00080000UL
#define CANSNORE    0x00100000UL
#define HALFDAMAGE  0x00200000UL
#define CANSUCK     0x00400000UL
#define CANRUST     0x00800000UL
#define CANPOISON   0x01000000UL
#define CANDRAIN    0x02000000UL
#define ISUNIQUE    0x04000000UL
#define STEALGOLD   0x08000000UL
#define STEALMAGIC  0x10000001UL
#define CANDISEASE  0x10000002UL
#define HASDISEASE  0x10000004UL
#define CANSUFFOCATE    0x10000008UL
#define DIDSUFFOCATE    0x10000010UL
#define BOLTDIVIDE  0x10000020UL
#define BLOWDIVIDE  0x10000040UL
#define NOCOLD      0x10000080UL
#define TOUCHFEAR   0x10000100UL
#define BMAGICHIT   0x10000200UL
#define NOFIRE      0x10000400UL
#define NOBOLT      0x10000800UL
#define CARRYGOLD   0x10001000UL
#define CANITCH     0x10002000UL
#define HASITCH     0x10004000UL
#define DIDDRAIN    0x10008000UL
#define WASTURNED   0x10010000UL
#define CANSELL     0x10020000UL
#define CANBLIND    0x10040000UL
#define CANBBURN    0x10080000UL
#define ISCHARMED   0x10100000UL
#define CANSPEAK    0x10200000UL
#define CANFLY      0x10400000UL
#define ISFRIENDLY  0x10800000UL
#define CANHEAR     0x11000000UL
#define ISDEAF      0x12000000UL
#define CANSCENT    0x14000000UL
#define ISUNSMELL   0x18000000UL
#define WILLRUST    0x20000001UL
#define WILLROT     0x20000002UL
#define SUPEREAT    0x20000004UL
#define PERMBLIND   0x20000008UL
#define MAGICHIT    0x20000010UL
#define CANINFEST   0x20000020UL
#define HASINFEST   0x20000040UL
#define NOMOVE      0x20000080UL
#define CANSHRIEK   0x20000100UL
#define CANDRAW     0x20000200UL
#define CANSMELL    0x20000400UL
#define CANPARALYZE 0x20000800UL
#define CANROT      0x20001000UL
#define ISSCAVENGE  0x20002000UL
#define DOROT       0x20004000UL
#define CANSTINK    0x20008000UL
#define HASSTINK    0x20010000UL
#define ISSHADOW    0x20020000UL
#define CANCHILL    0x20040000UL
#define CANHUG      0x20080000UL
#define CANSURPRISE 0x20100000UL
#define CANFRIGHTEN 0x20200000UL
#define CANSUMMON   0x20400000UL
#define TOUCHSTONE  0x20800000UL
#define LOOKSTONE   0x21000000UL
#define CANHOLD     0x22000000UL
#define DIDHOLD     0x24000000UL
#define DOUBLEDRAIN 0x28000000UL
#define ISUNDEAD    0x30000001UL
#define BLESSMAP    0x30000002UL
#define BLESSGOLD   0x30000004UL
#define BLESSMONS   0x30000008UL
#define BLESSMAGIC  0x30000010UL
#define BLESSFOOD   0x30000020UL
#define CANBRANDOM  0x30000040UL /* Types of breath */
#define CANBACID    0x30000080UL
#define CANBFIRE    0x30000100UL
#define CANBBOLT    0x30000200UL
#define CANBGAS     0x30000400UL
#define CANBICE     0x30000800UL
#define CANBPGAS    0x30001000UL /* Paralyze gas */
#define CANBSGAS    0x30002000UL /* Sleeping gas */
#define CANBSLGAS   0x30004000UL /* Slow gas */
#define CANBFGAS    0x30008000UL /* Fear gas */
#define CANBREATHE  0x3000ffc0UL /* Can it breathe at all? */
#define STUMBLER    0x30010000UL
#define POWEREAT    0x30020000UL
#define ISELECTRIC  0x30040000UL
#define HASOXYGEN   0x30080000UL /* Doesn't need to breath air */
#define POWERDEXT   0x30100000UL
#define POWERSTR    0x30200000UL
#define POWERWISDOM 0x30400000UL
#define POWERINTEL  0x30800000UL
#define POWERCONST  0x31000000UL
#define SUPERHERO   0x32000000UL
#define ISUNHERO    0x34000000UL
#define CANCAST     0x38000000UL
#define CANTRAMPLE  0x40000001UL
#define CANSWIM     0x40000002UL
#define LOOKSLOW    0x40000004UL
#define CANWIELD    0x40000008UL
#define CANDARKEN   0x40000010UL
#define ISFAST      0x40000020UL
#define CANBARGAIN  0x40000040UL
#define NOMETAL     0x40000080UL
#define CANSPORE    0x40000100UL
#define NOSHARP     0x40000200UL
#define DRAINWISDOM 0x40000400UL
#define DRAINBRAIN  0x40000800UL
#define ISLARGE     0x40001000UL
#define ISSMALL     0x40002000UL
#define CANSTAB     0x40004000UL
#define ISFLOCK     0x40008000UL
#define ISSWARM     0x40010000UL
#define CANSTICK    0x40020000UL
#define CANTANGLE   0x40040000UL
#define DRAINMAGIC  0x40080000UL
#define SHOOTNEEDLE 0x40100000UL
#define CANZAP      0x40200000UL
#define HASARMOR    0x40400000UL
#define CANTELEPORT 0x40800000UL
#define ISBERSERK   0x41000000UL
#define ISFAMILIAR  0x42000000UL
#define HASFAMILIAR 0x44000000UL
#define SUMMONING   0x48000000UL
#define CANREFLECT  0x50000001UL
#define LOWFRIENDLY 0x50000002UL
#define MEDFRIENDLY 0x50000004UL
#define HIGHFRIENDLY    0x50000008UL
#define MAGICATTRACT    0x50000010UL
#define ISGOD       0x50000020UL
#define CANLIGHT    0x50000040UL
#define HASSHIELD   0x50000080UL
#define HASMSHIELD  0x50000100UL
#define LOWCAST     0x50000200UL
#define MEDCAST     0x50000400UL
#define HIGHCAST    0x50000800UL
#define WASSUMMONED 0x50001000UL
#define HASSUMMONED 0x50002000UL
#define CANTRUESEE  0x50004000UL


#define FLAGSHIFT       28UL
#define FLAGINDEX       0x0000000fL
#define FLAGMASK        0x0fffffffL

/* on - check if a monster flag is on */
#define on(th, flag) \
        ((th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & (flag & FLAGMASK))

/* off - check if a monster flag is off */
#define off(th, flag) \
        (!((th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] & (flag & FLAGMASK)))

/* turn_on - turn on a monster flag */
#define turn_on(th, flag) \
        ( (th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] |= (flag & FLAGMASK))

/* turn_off - turn off a monster flag */
#define turn_off(th, flag) \
        ( (th).t_flags[(flag >> FLAGSHIFT) & FLAGINDEX] &= ~(flag & FLAGMASK))

#define SAME_POS(c1,c2) ( (c1.x == c2.x) && (c1.y == c2.y) )

/* types of things */
/* All magic spells duplicate a potion, scroll, or stick effect */

#define TYP_POTION  0
#define TYP_SCROLL  1
#define TYP_RING    2
#define TYP_STICK   3
#define MAXMAGICTYPES   4   /* max number of items in magic class */
#define MAXMAGICITEMS   50  /* max number of items in magic class */
#define TYP_FOOD    4
#define TYP_WEAPON  5
#define TYP_ARMOR   6
#define TYP_ARTIFACT    7
#define NUMTHINGS   (sizeof(things) / sizeof(struct magic_item))

/* Artifact types */
#define TR_PURSE    0
#define TR_PHIAL    1
#define TR_AMULET   2
#define TR_PALANTIR 3
#define TR_CROWN    4
#define TR_SCEPTRE  5
#define TR_SILMARIL 6
#define TR_WAND     7
#define MAXARTIFACT (sizeof(arts) / sizeof(struct init_artifact))

/* Artifact flags */
#define ISUSED      01
#define ISACTIVE    02

/* Potion types - add also to magic_item.c and potions.c */
#define P_CLEAR     0
#define P_GAINABIL  1
#define P_SEEINVIS  2
#define P_HEALING   3
#define P_MONSTDET  4
#define P_TREASDET  5
#define P_RAISELEVEL    6
#define P_HASTE     7
#define P_RESTORE   8
#define P_PHASE     9
#define P_INVIS     10
#define P_SMELL     11
#define P_HEAR      12
#define P_SHERO     13
#define P_DISGUISE  14
#define P_FIRERESIST    15
#define P_COLDRESIST    16
#define P_HASOXYGEN 17
#define P_LEVITATION    18
#define P_REGENERATE    19
#define P_SHIELD    20
#define P_TRUESEE   21
#define MAXPOTIONS  22

/* Scroll types - add also to magic_item.c and scrolls.c */
#define S_CONFUSE   0
#define S_MAP       1
#define S_LIGHT     2
#define S_HOLD      3
#define S_SLEEP     4
#define S_ENCHANT   5
#define S_IDENTIFY  6
#define S_SCARE     7
#define S_GFIND     8
#define S_SELFTELEP 9
#define S_CREATE    10
#define S_REMOVECURSE   11
#define S_PETRIFY   12
#define S_GENOCIDE  13
#define S_CURING    14
#define S_MAKEITEMEM    15
#define S_PROTECT   16
#define S_NOTHING   17
#define S_SILVER    18
#define S_OWNERSHIP 19
#define S_FOODDET   20
#define S_ELECTRIFY 21
#define S_CHARM     22
#define S_SUMMON    23
#define S_REFLECT   24
#define S_SUMFAMILIAR   25
#define S_FEAR      26
#define S_MSHIELD   27
#define MAXSCROLLS  28

/* Rod/Wand/Staff types - add also to magic_item.c and sticks.c */
#define WS_LIGHT    0
#define WS_HIT      1
#define WS_ELECT    2
#define WS_FIRE     3
#define WS_COLD     4
#define WS_POLYMORPH    5
#define WS_MISSILE  6
#define WS_SLOW_M   7
#define WS_DRAIN    8
#define WS_CHARGE   9
#define WS_MONSTELEP    10
#define WS_CANCEL   11
#define WS_CONFMON  12
#define WS_DISINTEGRATE 13
#define WS_ANTIMATTER   14
#define WS_PARALYZE 15
#define WS_XENOHEALING  16
#define WS_NOTHING  17
#define WS_INVIS    18
#define WS_BLAST    19
#define WS_WEB      20
#define WS_KNOCK    21
#define WS_CLOSE    22
#define MAXSTICKS   23

/* Ring types */
#define R_PROTECT   0
#define R_ADDSTR    1
#define R_SUSABILITY    2
#define R_SEARCH    3
#define R_SEEINVIS  4
#define R_ALERT     5
#define R_AGGR      6
#define R_ADDHIT    7
#define R_ADDDAM    8
#define R_REGEN     9
#define R_DIGEST    10
#define R_TELEPORT  11
#define R_STEALTH   12
#define R_ADDINTEL  13
#define R_ADDWISDOM 14
#define R_HEALTH    15
#define R_VREGEN    16
#define R_LIGHT     17
#define R_DELUSION  18
#define R_CARRYING  19
#define R_ADORNMENT 20
#define R_LEVITATION    21
#define R_FIRERESIST    22
#define R_COLDRESIST    23
#define R_ELECTRESIST   24
#define R_RESURRECT 25
#define R_BREATHE   26
#define R_FREEDOM   27
#define R_WIZARD    28
#define R_PIETY     29
#define R_TELCONTROL    30
#define R_TRUESEE   31
#define MAXRINGS    32

/* Weapon types */
#define SLING       0   /* sling */
#define ROCK        1   /* rocks */
#define BULLET      2   /* sling bullet */
#define BOW     3   /* short bow */
#define ARROW       4   /* arrow */
#define SILVERARROW 5   /* silver arrows */
#define FLAMEARROW  6   /* flaming arrows */
#define FOOTBOW     7   /* footbow */
#define FBBOLT      8   /* footbow bolt */
#define CROSSBOW    9   /* crossbow */
#define BOLT        10  /* crossbow bolt */

#define DART        11  /* darts */
#define DAGGER      12  /* dagger */
#define HAMMER      13  /* hammer */
#define LEUKU       14  /* leuku */
#define JAVELIN     15  /* javelin */
#define TOMAHAWK    16  /* tomahawk */
#define MACHETE     17  /* machete */
#define THROW_AXE   18  /* throwing axe */
#define SHORT_SPEAR 19  /* spear */
#define BOOMERANG   20  /* boomerangs */
#define LONG_SPEAR  21  /* spear */
#define SHURIKEN    22  /* shurikens */
#define MOLOTOV     23  /* molotov cocktails */
#define GRENADE     24  /* grenade for explosions */
#define CLUB        25  /* club */
#define PITCHFORK   26  /* pitchfork */
#define SHORT_SWORD 27  /* short sword */
#define HAND_AXE    28  /* hand axe */
#define PARTISAN    29  /* partisan */
#define GRAIN_FLAIL 30  /* grain flail */
#define SINGLESTICK 31  /* singlestick */
#define RAPIER      32  /* rapier */
#define SICKLE      33  /* sickle */
#define HATCHET     34  /* hatchet */
#define SCIMITAR    35  /* scimitar */
#define LIGHT_MACE  36  /* mace */
#define MORNINGSTAR 37  /* morning star */
#define BROAD_SWORD 38  /* broad sword */
#define MINER_PICK  39  /* miner's pick */
#define GUISARME    40  /* guisarme */
#define WAR_FLAIL   41  /* war flail */
#define CRYSKNIFE   42  /* crysknife */
#define BATTLE_AXE  43  /* battle axe */
#define CUTLASS     44  /* cutlass sword */
#define GLAIVE      45  /* glaive */
#define PERTUSKA    46  /* pertuska */
#define LONG_SWORD  47  /* long sword */
#define LANCE       48  /* lance */
#define RANSEUR     49  /* ranseur */
#define SABRE       50  /* sabre */
#define SPETUM      51  /* spetum */
#define HALBERD     52  /* halberd */
#define TRIDENT     53  /* trident */
#define WAR_PICK    54  /* war pick */
#define BARDICHE    55  /* bardiche */
#define HEAVY_MACE  56  /* mace */
#define SCYTHE      57  /* great scythe */
#define QUARTERSTAFF    58  /* quarter staff */
#define BAST_SWORD  59  /* bastard sword */
#define PIKE        60  /* pike */
#define TWO_FLAIL   61  /* two-handed flail */
#define TWO_MAUL    62  /* two-handed maul */
#define TWO_PICK    63  /* two-handed pick */
#define TWO_SWORD   64  /* two-handed sword */
#define CLAYMORE    65  /* claymore sword */
#define MAXWEAPONS  (sizeof(weaps) / sizeof(struct init_weps))
#define NONE        100 /* no weapon */

/* Armor types */
#define SOFT_LEATHER    0
#define CUIRBOLILLI 1
#define HEAVY_LEATHER   2
#define RING_MAIL   3
#define STUDDED_LEATHER 4
#define SCALE_MAIL  5
#define PADDED_ARMOR    6
#define CHAIN_MAIL  7
#define BRIGANDINE  8
#define SPLINT_MAIL 9
#define BANDED_MAIL 10
#define GOOD_CHAIN  11
#define PLATE_MAIL  12
#define PLATE_ARMOR 13
#define MITHRIL     14
#define CRYSTAL_ARMOR   15
#define MAXARMORS   (sizeof(armors) / sizeof(struct init_armor))

/* Food types */
#define FD_RATION   0
#define FD_FRUIT    1
#define FD_CRAM     2
#define FD_CAKES    3
#define FD_LEMBA    4
#define FD_MIRUVOR  5
#define MAXFOODS    (sizeof(fd_data) / sizeof(struct magic_item))

/* stuff to do with encumberance */
#define F_OK        0   /* have plenty of food in stomach */
#define F_HUNGRY    1   /* player is hungry */
#define F_WEAK      2   /* weak from lack of food */
#define F_FAINT     3   /* fainting from lack of food */

/* return values for get functions */
#define NORM    0       /* normal exit */
#define QUIT    1       /* quit option setting */
#define MINUS   2       /* back up one option */

/* These are the types of inventory styles. */
#define INV_SLOW    0
#define INV_OVER    1
#define INV_CLEAR   2

/* These will eventually become enumerations */
#define MESSAGE     TRUE
#define NOMESSAGE   FALSE
#define POINTS      TRUE
#define NOPOINTS    FALSE
#define LOWERCASE   TRUE
#define UPPERCASE   FALSE
#define WANDER      TRUE
#define NOWANDER    FALSE
#define GRAB        TRUE
#define NOGRAB      FALSE
#define FAMILIAR    TRUE
#define NOFAMILIAR  FALSE
#define MAXSTATS    TRUE
#define NOMAXSTATS  FALSE
#define FORCE       TRUE
#define NOFORCE     FALSE
#define THROWN      TRUE
#define NOTHROWN    FALSE

/* Ways to die */
#define D_PETRIFY   -1
#define D_ARROW     -2
#define D_DART      -3
#define D_POISON    -4
#define D_BOLT      -5
#define D_SUFFOCATION   -6
#define D_POTION    -7
#define D_INFESTATION   -8
#define D_DROWN     -9
#define D_FALL      -10
#define D_FIRE      -11
#define D_SPELLFUMBLE   -12
#define D_DRAINLIFE -13
#define D_ARTIFACT  -14
#define D_GODWRATH  -15
#define D_CLUMSY    -16

/* values for games end */
#define SCOREIT -1
#define KILLED   0
#define CHICKEN  1
#define WINNER   2
#define TOTAL    3

/*
 * definitions for function step_ok: MONSTOK indicates it is OK to step on a
 * monster -- it is only OK when stepping diagonally AROUND a monster
 */

#define MONSTOK 1
#define NOMONST 2



#define good_monster(m) (on(m, ISCHARMED) || \
            on(m, ISFRIENDLY) || \
            on(m, ISFAMILIAR))

/* Now we define the structures and types */

/* level types */
typedef enum
{
    NORMLEV,        /* normal level */
    POSTLEV,        /* trading post level */
    MAZELEV,        /* maze level */
    THRONE          /* unique monster's throne room */
}   LEVTYPE;

/* Help list */

struct h_list
{
    char        h_ch;
    char        *h_desc;
};

/* Coordinate data type */
typedef struct
{
    int     x;
    int     y;
} coord;

/* Linked list data type */
typedef struct linked_list
{
    struct linked_list  *l_next;
    struct linked_list  *l_prev;

    union
    {
        struct object *obj;
        struct thing  *th;
        void *l_data;
    } data;

} linked_list;

/* Stuff about magic items */

struct magic_item
{
    char   *mi_name;
    char   *mi_abrev;
    int     mi_prob;
    long    mi_worth;
    int     mi_curse;
    int     mi_bless;
};

/* Room structure */
struct room
{
    coord   r_pos;      /* Upper left corner */
    coord   r_max;      /* Size of room */
    coord   r_exit[MAXDOORS];   /* Where the exits are */
    int     r_flags;    /* Info about the room */
    int     r_nexits;   /* Number of exits */
    short   r_fires;    /* Number of fires in room */
};

/* Initial artifact stats */
struct init_artifact
{
    char   *ar_name;   /* name of the artifact */
    int     ar_level;   /* first level where it appears */
    int     ar_rings;   /* number of ring effects */
    int     ar_potions; /* number of potion effects */
    int     ar_scrolls; /* number of scroll effects */
    int     ar_wands;   /* number of wand effects */
    int     ar_worth;   /* gold pieces */
    int     ar_weight;  /* weight of object */
};

/* Array of all traps on this level */

struct trap
{
    coord       tr_pos;     /* Where trap is */
    long        tr_flags;   /* Info about trap (i.e. ISFOUND) */
    char        tr_type;    /* What kind of trap */
    char        tr_show;    /* What disguised trap looks like */
};

/* Structure describing a fighting being */

struct stats
{
    char   *s_dmg;     /* String describing damage done */
    long    s_exp;      /* Experience */
    long    s_hpt;      /* Hit points */
    int     s_pack;     /* current weight of his pack */
    int     s_carry;    /* max weight he can carry */
    int     s_lvl;      /* Level of mastery */
    int     s_arm;      /* Armor class */
    int     s_acmod;    /* Armor clss modifier */
    int     s_power;    /* Spell points */
    int     s_str;      /* Strength */
    int     s_intel;    /* Intelligence */
    int     s_wisdom;   /* Wisdom */
    int     s_dext;     /* Dexterity */
    int     s_const;    /* Constitution */
    int     s_charisma; /* Charisma */
};

/* Structure describing a fighting being (monster at initialization) */

struct mstats
{
    short s_str;        /* Strength */
    long  s_exp;        /* Experience */
    int   s_lvl;        /* Level of mastery */