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