Commit | Line | Data |
---|---|---|
565ece5c KB |
1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ |
2 | /* hack.h - version 1.0.3 */ | |
3 | ||
4 | #include "config.h" | |
5 | ||
6 | #ifdef BSD | |
7 | #include <strings.h> /* declarations for strcat etc. */ | |
8 | #else | |
9 | #include <string.h> /* idem on System V */ | |
10 | #define index strchr | |
11 | #define rindex strrchr | |
12 | #endif BSD | |
13 | ||
14 | #define Null(type) ((struct type *) 0) | |
15 | ||
16 | #include "def.objclass.h" | |
17 | ||
18 | typedef struct { | |
19 | xchar x,y; | |
20 | } coord; | |
21 | ||
22 | #include "def.monst.h" /* uses coord */ | |
23 | #include "def.gold.h" | |
24 | #include "def.trap.h" | |
25 | #include "def.obj.h" | |
26 | #include "def.flag.h" | |
27 | ||
565ece5c KB |
28 | #define plur(x) (((x) == 1) ? "" : "s") |
29 | ||
30 | #define BUFSZ 256 /* for getlin buffers */ | |
31 | #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ | |
32 | ||
33 | #include "def.rm.h" | |
34 | #include "def.permonst.h" | |
35 | ||
36 | extern long *alloc(); | |
37 | ||
38 | extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ | |
39 | ||
40 | extern xchar dlevel; | |
41 | #define newstring(x) (char *) alloc((unsigned)(x)) | |
42 | #include "hack.onames.h" | |
43 | ||
44 | #define ON 1 | |
45 | #define OFF 0 | |
46 | ||
47 | extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg, | |
48 | *uleft, *uright, *fcobj; | |
49 | extern struct obj *uchain; /* defined iff PUNISHED */ | |
50 | extern struct obj *uball; /* defined if PUNISHED */ | |
51 | struct obj *o_at(), *getobj(), *sobj_at(); | |
52 | ||
53 | struct prop { | |
54 | #define TIMEOUT 007777 /* mask */ | |
55 | #define LEFT_RING W_RINGL /* 010000L */ | |
56 | #define RIGHT_RING W_RINGR /* 020000L */ | |
57 | #define INTRINSIC 040000L | |
58 | #define LEFT_SIDE LEFT_RING | |
59 | #define RIGHT_SIDE RIGHT_RING | |
60 | #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) | |
61 | long p_flgs; | |
62 | int (*p_tofn)(); /* called after timeout */ | |
63 | }; | |
64 | ||
65 | struct you { | |
66 | xchar ux, uy; | |
67 | schar dx, dy, dz; /* direction of move (or zap or ... ) */ | |
68 | #ifdef QUEST | |
69 | schar di; /* direction of FF */ | |
70 | xchar ux0, uy0; /* initial position FF */ | |
71 | #endif QUEST | |
72 | xchar udisx, udisy; /* last display pos */ | |
73 | char usym; /* usually '@' */ | |
74 | schar uluck; | |
75 | #define LUCKMAX 10 /* on moonlit nights 11 */ | |
76 | #define LUCKMIN (-10) | |
77 | int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */ | |
78 | /* +: turn right, -: turn left */ | |
79 | unsigned udispl:1; /* @ on display */ | |
80 | unsigned ulevel:4; /* 1 - 14 */ | |
81 | #ifdef QUEST | |
82 | unsigned uhorizon:7; | |
83 | #endif QUEST | |
84 | unsigned utrap:3; /* trap timeout */ | |
85 | unsigned utraptype:1; /* defined if utrap nonzero */ | |
86 | #define TT_BEARTRAP 0 | |
87 | #define TT_PIT 1 | |
88 | unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */ | |
89 | ||
90 | ||
91 | /* perhaps these #define's should also be generated by makedefs */ | |
92 | #define TELEPAT LAST_RING /* not a ring */ | |
93 | #define Telepat u.uprops[TELEPAT].p_flgs | |
94 | #define FAST (LAST_RING+1) /* not a ring */ | |
95 | #define Fast u.uprops[FAST].p_flgs | |
96 | #define CONFUSION (LAST_RING+2) /* not a ring */ | |
97 | #define Confusion u.uprops[CONFUSION].p_flgs | |
98 | #define INVIS (LAST_RING+3) /* not a ring */ | |
99 | #define Invis u.uprops[INVIS].p_flgs | |
100 | #define Invisible (Invis && !See_invisible) | |
101 | #define GLIB (LAST_RING+4) /* not a ring */ | |
102 | #define Glib u.uprops[GLIB].p_flgs | |
103 | #define PUNISHED (LAST_RING+5) /* not a ring */ | |
104 | #define Punished u.uprops[PUNISHED].p_flgs | |
105 | #define SICK (LAST_RING+6) /* not a ring */ | |
106 | #define Sick u.uprops[SICK].p_flgs | |
107 | #define BLIND (LAST_RING+7) /* not a ring */ | |
108 | #define Blind u.uprops[BLIND].p_flgs | |
109 | #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */ | |
110 | #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs | |
111 | #define STONED (LAST_RING+9) /* not a ring */ | |
112 | #define Stoned u.uprops[STONED].p_flgs | |
113 | #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ | |
114 | unsigned umconf:1; | |
115 | char *usick_cause; | |
116 | struct prop uprops[LAST_RING+10]; | |
117 | ||
118 | unsigned uswallow:1; /* set if swallowed by a monster */ | |
119 | unsigned uswldtim:4; /* time you have been swallowed */ | |
120 | unsigned uhs:3; /* hunger state - see hack.eat.c */ | |
121 | schar ustr,ustrmax; | |
122 | schar udaminc; | |
123 | schar uac; | |
124 | int uhp,uhpmax; | |
125 | long int ugold,ugold0,uexp,urexp; | |
126 | int uhunger; /* refd only in eat.c and shk.c */ | |
127 | int uinvault; | |
128 | struct monst *ustuck; | |
129 | int nr_killed[CMNUM+2]; /* used for experience bookkeeping */ | |
130 | }; | |
131 | ||
132 | extern struct you u; | |
133 | ||
134 | extern char *traps[]; | |
135 | extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(), | |
136 | *doname(), *aobjnam(); | |
137 | extern char readchar(); | |
138 | extern char vowels[]; | |
139 | ||
140 | extern xchar curx,cury; /* cursor location on screen */ | |
141 | ||
142 | extern coord bhitpos; /* place where thrown weapon falls to the ground */ | |
143 | ||
144 | extern xchar seehx,seelx,seehy,seely; /* where to see*/ | |
145 | extern char *save_cm,*killer; | |
146 | ||
147 | extern xchar dlevel, maxdlevel; /* dungeon level */ | |
148 | ||
149 | extern long moves; | |
150 | ||
151 | extern int multi; | |
152 | ||
153 | ||
154 | extern char lock[]; | |
155 | ||
156 | ||
157 | #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2))) | |
158 | ||
159 | #define PL_CSIZ 20 /* sizeof pl_character */ | |
160 | #define MAX_CARR_CAP 120 /* so that boulders can be heavier */ | |
161 | #define MAXLEVEL 40 | |
162 | #define FAR (COLNO+2) /* position outside screen */ |