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