hack.h revision 1.4 1 1.4 christos /* $NetBSD: hack.h,v 1.4 1997/10/19 16:58:02 christos Exp $ */
2 1.4 christos
3 1.2 mycroft /*
4 1.2 mycroft * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
5 1.2 mycroft */
6 1.4 christos #ifndef _HACK_H_
7 1.4 christos #define _HACK_H_
8 1.1 cgd
9 1.1 cgd #include "config.h"
10 1.1 cgd #include <string.h>
11 1.1 cgd
12 1.1 cgd #ifndef BSD
13 1.1 cgd #define index strchr
14 1.1 cgd #define rindex strrchr
15 1.4 christos #endif /* BSD */
16 1.1 cgd
17 1.1 cgd #define Null(type) ((struct type *) 0)
18 1.1 cgd
19 1.1 cgd #include "def.objclass.h"
20 1.1 cgd
21 1.1 cgd typedef struct {
22 1.1 cgd xchar x,y;
23 1.1 cgd } coord;
24 1.1 cgd
25 1.1 cgd #include "def.monst.h" /* uses coord */
26 1.1 cgd #include "def.gold.h"
27 1.1 cgd #include "def.trap.h"
28 1.1 cgd #include "def.obj.h"
29 1.1 cgd #include "def.flag.h"
30 1.1 cgd
31 1.1 cgd #define plur(x) (((x) == 1) ? "" : "s")
32 1.1 cgd
33 1.1 cgd #define BUFSZ 256 /* for getlin buffers */
34 1.1 cgd #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */
35 1.1 cgd
36 1.1 cgd #include "def.rm.h"
37 1.1 cgd #include "def.permonst.h"
38 1.1 cgd
39 1.1 cgd #define newstring(x) (char *) alloc((unsigned)(x))
40 1.1 cgd #include "hack.onames.h"
41 1.1 cgd
42 1.1 cgd #define ON 1
43 1.1 cgd #define OFF 0
44 1.1 cgd
45 1.1 cgd struct prop {
46 1.1 cgd #define TIMEOUT 007777 /* mask */
47 1.1 cgd #define LEFT_RING W_RINGL /* 010000L */
48 1.1 cgd #define RIGHT_RING W_RINGR /* 020000L */
49 1.1 cgd #define INTRINSIC 040000L
50 1.1 cgd #define LEFT_SIDE LEFT_RING
51 1.1 cgd #define RIGHT_SIDE RIGHT_RING
52 1.1 cgd #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE)
53 1.1 cgd long p_flgs;
54 1.4 christos void (*p_tofn) __P((void)); /* called after timeout */
55 1.1 cgd };
56 1.1 cgd
57 1.1 cgd struct you {
58 1.1 cgd xchar ux, uy;
59 1.1 cgd schar dx, dy, dz; /* direction of move (or zap or ... ) */
60 1.1 cgd #ifdef QUEST
61 1.1 cgd schar di; /* direction of FF */
62 1.1 cgd xchar ux0, uy0; /* initial position FF */
63 1.1 cgd #endif QUEST
64 1.1 cgd xchar udisx, udisy; /* last display pos */
65 1.1 cgd char usym; /* usually '@' */
66 1.1 cgd schar uluck;
67 1.1 cgd #define LUCKMAX 10 /* on moonlit nights 11 */
68 1.1 cgd #define LUCKMIN (-10)
69 1.1 cgd int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */
70 1.1 cgd /* +: turn right, -: turn left */
71 1.1 cgd unsigned udispl:1; /* @ on display */
72 1.1 cgd unsigned ulevel:4; /* 1 - 14 */
73 1.1 cgd #ifdef QUEST
74 1.1 cgd unsigned uhorizon:7;
75 1.1 cgd #endif QUEST
76 1.1 cgd unsigned utrap:3; /* trap timeout */
77 1.1 cgd unsigned utraptype:1; /* defined if utrap nonzero */
78 1.1 cgd #define TT_BEARTRAP 0
79 1.1 cgd #define TT_PIT 1
80 1.1 cgd unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */
81 1.1 cgd
82 1.1 cgd
83 1.1 cgd /* perhaps these #define's should also be generated by makedefs */
84 1.1 cgd #define TELEPAT LAST_RING /* not a ring */
85 1.1 cgd #define Telepat u.uprops[TELEPAT].p_flgs
86 1.1 cgd #define FAST (LAST_RING+1) /* not a ring */
87 1.1 cgd #define Fast u.uprops[FAST].p_flgs
88 1.1 cgd #define CONFUSION (LAST_RING+2) /* not a ring */
89 1.1 cgd #define Confusion u.uprops[CONFUSION].p_flgs
90 1.1 cgd #define INVIS (LAST_RING+3) /* not a ring */
91 1.1 cgd #define Invis u.uprops[INVIS].p_flgs
92 1.1 cgd #define Invisible (Invis && !See_invisible)
93 1.1 cgd #define GLIB (LAST_RING+4) /* not a ring */
94 1.1 cgd #define Glib u.uprops[GLIB].p_flgs
95 1.1 cgd #define PUNISHED (LAST_RING+5) /* not a ring */
96 1.1 cgd #define Punished u.uprops[PUNISHED].p_flgs
97 1.1 cgd #define SICK (LAST_RING+6) /* not a ring */
98 1.1 cgd #define Sick u.uprops[SICK].p_flgs
99 1.1 cgd #define BLIND (LAST_RING+7) /* not a ring */
100 1.1 cgd #define Blind u.uprops[BLIND].p_flgs
101 1.1 cgd #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */
102 1.1 cgd #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs
103 1.1 cgd #define STONED (LAST_RING+9) /* not a ring */
104 1.1 cgd #define Stoned u.uprops[STONED].p_flgs
105 1.1 cgd #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */
106 1.1 cgd unsigned umconf:1;
107 1.1 cgd char *usick_cause;
108 1.1 cgd struct prop uprops[LAST_RING+10];
109 1.1 cgd
110 1.1 cgd unsigned uswallow:1; /* set if swallowed by a monster */
111 1.1 cgd unsigned uswldtim:4; /* time you have been swallowed */
112 1.1 cgd unsigned uhs:3; /* hunger state - see hack.eat.c */
113 1.1 cgd schar ustr,ustrmax;
114 1.1 cgd schar udaminc;
115 1.1 cgd schar uac;
116 1.1 cgd int uhp,uhpmax;
117 1.1 cgd long int ugold,ugold0,uexp,urexp;
118 1.1 cgd int uhunger; /* refd only in eat.c and shk.c */
119 1.1 cgd int uinvault;
120 1.1 cgd struct monst *ustuck;
121 1.1 cgd int nr_killed[CMNUM+2]; /* used for experience bookkeeping */
122 1.1 cgd };
123 1.1 cgd
124 1.1 cgd #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
125 1.1 cgd
126 1.1 cgd #define PL_CSIZ 20 /* sizeof pl_character */
127 1.1 cgd #define MAX_CARR_CAP 120 /* so that boulders can be heavier */
128 1.1 cgd #define MAXLEVEL 40
129 1.1 cgd #define FAR (COLNO+2) /* position outside screen */
130 1.4 christos
131 1.4 christos extern boolean in_mklev;
132 1.4 christos extern boolean level_exists[];
133 1.4 christos extern boolean restoring;
134 1.4 christos extern char *CD;
135 1.4 christos extern char *catmore;
136 1.4 christos extern char *hname;
137 1.4 christos extern char *hu_stat[]; /* in eat.c */
138 1.4 christos extern char *nomovemsg;
139 1.4 christos extern char *occtxt;
140 1.4 christos extern char *save_cm,*killer;
141 1.4 christos extern char *traps[];
142 1.4 christos extern char SAVEF[];
143 1.4 christos extern char fut_geno[60]; /* idem */
144 1.4 christos extern char genocided[60]; /* defined in Decl.c */
145 1.4 christos extern char lock[];
146 1.4 christos extern char mlarge[];
147 1.4 christos extern char morc;
148 1.4 christos extern char nul[];
149 1.4 christos extern char pl_character[];
150 1.4 christos extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
151 1.4 christos extern char quitchars[];
152 1.4 christos extern char sdir[]; /* defined in hack.c */
153 1.4 christos extern char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
154 1.4 christos extern char vowels[];
155 1.4 christos extern coord bhitpos; /* place where thrown weapon falls to the ground */
156 1.4 christos extern int (*afternmv) __P((void));
157 1.4 christos extern int (*occupation) __P((void));
158 1.4 christos extern int CO, LI; /* usually COLNO and ROWNO+2 */
159 1.4 christos extern int bases[];
160 1.4 christos extern int doorindex;
161 1.4 christos extern int hackpid;
162 1.4 christos extern int multi;
163 1.4 christos extern int nroom;
164 1.4 christos extern long moves;
165 1.4 christos extern long wailmsg;
166 1.4 christos extern schar xdir[], ydir[]; /* idem */
167 1.4 christos extern struct gold *fgold;
168 1.4 christos extern struct monst *mydogs;
169 1.4 christos extern struct monst youmonst;
170 1.4 christos extern struct obj *billobjs;
171 1.4 christos extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg;
172 1.4 christos extern struct obj *uleft, *uright, *fcobj;
173 1.4 christos extern struct obj *uball; /* defined if PUNISHED */
174 1.4 christos extern struct obj *uchain; /* defined iff PUNISHED */
175 1.4 christos extern struct obj zeroobj;
176 1.4 christos extern struct permonst li_dog, dog, la_dog;
177 1.4 christos extern struct permonst mons[CMNUM + 2];
178 1.4 christos extern struct permonst pm_eel;
179 1.4 christos extern struct permonst pm_ghost;
180 1.4 christos extern struct permonst pm_mail_daemon;
181 1.4 christos extern struct permonst pm_wizard;
182 1.4 christos #ifndef NOWORM
183 1.4 christos extern long wgrowtime[32];
184 1.4 christos extern struct wseg *m_atseg;
185 1.4 christos extern struct wseg *wsegs[32], *wheads[32];
186 1.4 christos #endif
187 1.4 christos extern struct you u;
188 1.4 christos extern xchar curx, cury; /* cursor location on screen */
189 1.4 christos extern xchar dlevel, maxdlevel; /* dungeon level */
190 1.4 christos extern xchar seehx,seelx,seehy,seely; /* where to see*/
191 1.4 christos extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
192 1.4 christos #endif /* _HACK_H_ */
193