1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.h - version 1.0.3 */
3 /* $DragonFly: src/games/hack/hack.h,v 1.3 2005/05/22 03:37:05 y0netan1 Exp $ */
10 #define rindex strrchr
13 #define Null(type) ((struct type *) 0)
15 #include "def.objclass.h"
21 #include "def.monst.h" /* uses coord */
27 #define plur(x) (((x) == 1) ? "" : "s")
29 #define BUFSZ 256 /* for getlin buffers */
30 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
33 #include "def.permonst.h"
37 extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
40 #define newstring(x) (char *) alloc((unsigned)(x))
41 #include "hack.onames.h"
46 extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg,
47 *uleft, *uright, *fcobj;
48 extern struct obj *uchain; /* defined iff PUNISHED */
49 extern struct obj *uball; /* defined if PUNISHED */
50 struct obj *o_at(), *getobj(), *sobj_at();
53 #define TIMEOUT 007777 /* mask */
54 #define LEFT_RING W_RINGL /* 010000L */
55 #define RIGHT_RING W_RINGR /* 020000L */
56 #define INTRINSIC 040000L
57 #define LEFT_SIDE LEFT_RING
58 #define RIGHT_SIDE RIGHT_RING
59 #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE)
61 int (*p_tofn)(); /* called after timeout */
66 schar dx, dy, dz; /* direction of move (or zap or ... ) */
68 schar di; /* direction of FF */
69 xchar ux0, uy0; /* initial position FF */
71 xchar udisx, udisy; /* last display pos */
72 char usym; /* usually '@' */
74 #define LUCKMAX 10 /* on moonlit nights 11 */
76 int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */
77 /* +: turn right, -: turn left */
78 unsigned udispl:1; /* @ on display */
79 unsigned ulevel:4; /* 1 - 14 */
83 unsigned utrap:3; /* trap timeout */
84 unsigned utraptype:1; /* defined if utrap nonzero */
87 unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */
90 /* perhaps these #define's should also be generated by makedefs */
91 #define TELEPAT LAST_RING /* not a ring */
92 #define Telepat u.uprops[TELEPAT].p_flgs
93 #define FAST (LAST_RING+1) /* not a ring */
94 #define Fast u.uprops[FAST].p_flgs
95 #define CONFUSION (LAST_RING+2) /* not a ring */
96 #define Confusion u.uprops[CONFUSION].p_flgs
97 #define INVIS (LAST_RING+3) /* not a ring */
98 #define Invis u.uprops[INVIS].p_flgs
99 #define Invisible (Invis && !See_invisible)
100 #define GLIB (LAST_RING+4) /* not a ring */
101 #define Glib u.uprops[GLIB].p_flgs
102 #define PUNISHED (LAST_RING+5) /* not a ring */
103 #define Punished u.uprops[PUNISHED].p_flgs
104 #define SICK (LAST_RING+6) /* not a ring */
105 #define Sick u.uprops[SICK].p_flgs
106 #define BLIND (LAST_RING+7) /* not a ring */
107 #define Blind u.uprops[BLIND].p_flgs
108 #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */
109 #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs
110 #define STONED (LAST_RING+9) /* not a ring */
111 #define Stoned u.uprops[STONED].p_flgs
112 #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */
114 const char *usick_cause;
115 struct prop uprops[LAST_RING+10];
117 unsigned uswallow:1; /* set if swallowed by a monster */
118 unsigned uswldtim:4; /* time you have been swallowed */
119 unsigned uhs:3; /* hunger state - see hack.eat.c */
124 long int ugold,ugold0,uexp,urexp;
125 int uhunger; /* refd only in eat.c and shk.c */
127 struct monst *ustuck;
128 int nr_killed[CMNUM+2]; /* used for experience bookkeeping */
133 extern const char *traps[];
134 extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(),
135 *doname(), *aobjnam();
136 extern char readchar();
137 extern char vowels[];
139 extern xchar curx,cury; /* cursor location on screen */
141 extern coord bhitpos; /* place where thrown weapon falls to the ground */
143 extern xchar seehx,seelx,seehy,seely; /* where to see*/
144 extern const char *save_cm, *killer, *nomovemsg;
146 extern xchar dlevel, maxdlevel; /* dungeon level */
155 extern const char *occtxt;
156 extern const char *hu_stat[];
158 const char *exclam(int);
159 void gethdate(const char *);
160 void done(const char *);
162 #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
164 #define PL_CSIZ 20 /* sizeof pl_character */
165 #define MAX_CARR_CAP 120 /* so that boulders can be heavier */
167 #define FAR (COLNO+2) /* position outside screen */