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