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