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