xref: /openbsd/games/hack/hack.h (revision ce7279d8)
1 /*	$OpenBSD: hack.h,v 1.15 2024/05/21 05:00:47 jsg Exp $*/
2 /*	$NetBSD: hack.h,v 1.3 1995/03/23 08:30:21 cgd Exp $*/
3 
4 /*
5  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
6  * Amsterdam
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are
11  * met:
12  *
13  * - Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * - Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  *
20  * - Neither the name of the Stichting Centrum voor Wiskunde en
21  * Informatica, nor the names of its contributors may be used to endorse or
22  * promote products derived from this software without specific prior
23  * written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
26  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
28  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
29  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 /*
39  * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
40  * All rights reserved.
41  *
42  * Redistribution and use in source and binary forms, with or without
43  * modification, are permitted provided that the following conditions
44  * are met:
45  * 1. Redistributions of source code must retain the above copyright
46  *    notice, this list of conditions and the following disclaimer.
47  * 2. Redistributions in binary form must reproduce the above copyright
48  *    notice, this list of conditions and the following disclaimer in the
49  *    documentation and/or other materials provided with the distribution.
50  * 3. The name of the author may not be used to endorse or promote products
51  *    derived from this software without specific prior written permission.
52  *
53  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
54  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
55  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
56  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
57  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
58  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
59  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
60  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
61  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
62  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63  */
64 
65 #include <fcntl.h>
66 #include <stdarg.h>
67 #include <string.h>
68 
69 #define	Null(type)	((struct type *) 0)
70 
71 #include "config.h"
72 #include "def.objclass.h"
73 
74 typedef struct {
75 	xchar x,y;
76 } coord;
77 
78 #include "def.mkroom.h"
79 #include "def.monst.h"	/* uses coord */
80 #include "def.gold.h"
81 #include "def.trap.h"
82 #include "def.obj.h"
83 #include "def.flag.h"
84 #include "def.wseg.h"
85 
86 #define	plur(x)	(((x) == 1) ? "" : "s")
87 
88 #define	BUFSZ	256	/* for getlin buffers */
89 #define	PL_NSIZ	32	/* name of player, ghost, shopkeeper */
90 
91 #include "def.rm.h"
92 #include "def.permonst.h"
93 
94 extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
95 
96 extern xchar dlevel;
97 #define	newstring(x)	(char *) alloc((unsigned)(x))
98 
99 #include "hack.onames.h"
100 
101 #define ON 1
102 #define OFF 0
103 
104 extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg,
105 	*uleft, *uright, *fcobj;
106 extern struct obj *uchain;	/* defined iff PUNISHED */
107 extern struct obj *uball;	/* defined if PUNISHED */
108 
109 struct prop {
110 #define	TIMEOUT		007777	/* mask */
111 #define	LEFT_RING	W_RINGL	/* 010000L */
112 #define	RIGHT_RING	W_RINGR	/* 020000L */
113 #define	INTRINSIC	040000L
114 #define	LEFT_SIDE	LEFT_RING
115 #define	RIGHT_SIDE	RIGHT_RING
116 #define	BOTH_SIDES	(LEFT_SIDE | RIGHT_SIDE)
117 	long p_flgs;
118 	int (*p_tofn)();	/* called after timeout */
119 };
120 
121 struct you {
122 	xchar ux, uy;
123 	schar dx, dy, dz;	/* direction of move (or zap or ... ) */
124 #ifdef QUEST
125 	schar di;		/* direction of FF */
126 	xchar ux0, uy0;		/* initial position FF */
127 #endif /* QUEST */
128 	xchar udisx, udisy;	/* last display pos */
129 	char usym;		/* usually '@' */
130 	schar uluck;
131 #define	LUCKMAX		10	/* on moonlit nights 11 */
132 #define	LUCKMIN		(-10)
133 	int last_str_turn:3;	/* 0: none, 1: half turn, 2: full turn */
134 				/* +: turn right, -: turn left */
135 	unsigned udispl:1;	/* @ on display */
136 	unsigned ulevel:4;	/* 1 - 14 */
137 #ifdef QUEST
138 	unsigned uhorizon:7;
139 #endif /* QUEST */
140 	unsigned utrap:3;	/* trap timeout */
141 	unsigned utraptype:1;	/* defined if utrap nonzero */
142 #define	TT_BEARTRAP	0
143 #define	TT_PIT		1
144 	unsigned uinshop:6;	/* used only in shk.c - (roomno+1) of shop */
145 
146 
147 /* perhaps these #define's should also be generated by makedefs */
148 #define	TELEPAT		LAST_RING		/* not a ring */
149 #define	Telepat		u.uprops[TELEPAT].p_flgs
150 #define	FAST		(LAST_RING+1)		/* not a ring */
151 #define	Fast		u.uprops[FAST].p_flgs
152 #define	CONFUSION	(LAST_RING+2)		/* not a ring */
153 #define	Confusion	u.uprops[CONFUSION].p_flgs
154 #define	INVIS		(LAST_RING+3)		/* not a ring */
155 #define	Invis		u.uprops[INVIS].p_flgs
156 #define Invisible	(Invis && !See_invisible)
157 #define	GLIB		(LAST_RING+4)		/* not a ring */
158 #define	Glib		u.uprops[GLIB].p_flgs
159 #define	PUNISHED	(LAST_RING+5)		/* not a ring */
160 #define	Punished	u.uprops[PUNISHED].p_flgs
161 #define	SICK		(LAST_RING+6)		/* not a ring */
162 #define	Sick		u.uprops[SICK].p_flgs
163 #define	BLIND		(LAST_RING+7)		/* not a ring */
164 #define	Blind		u.uprops[BLIND].p_flgs
165 #define	WOUNDED_LEGS	(LAST_RING+8)		/* not a ring */
166 #define Wounded_legs	u.uprops[WOUNDED_LEGS].p_flgs
167 #define STONED		(LAST_RING+9)		/* not a ring */
168 #define Stoned		u.uprops[STONED].p_flgs
169 #define PROP(x) (x-RIN_ADORNMENT)       /* convert ring to index in uprops */
170 	unsigned umconf:1;
171 	char *usick_cause;
172 	struct prop uprops[LAST_RING+10];
173 
174 	unsigned uswallow:1;		/* set if swallowed by a monster */
175 	unsigned uswldtim:4;		/* time you have been swallowed */
176 	unsigned uhs:3;			/* hunger state - see hack.eat.c */
177 	schar ustr,ustrmax;
178 	schar udaminc;
179 	schar uac;
180 	int uhp,uhpmax;
181 	long int ugold,ugold0,uexp,urexp;
182 	int uhunger;			/* refd only in eat.c and shk.c */
183 	int uinvault;
184 	struct monst *ustuck;
185 	int nr_killed[CMNUM+2];		/* used for experience bookkeeping */
186 };
187 
188 extern struct you u;
189 
190 extern char *traps[];
191 extern char vowels[];
192 
193 extern xchar curx,cury;	/* cursor location on screen */
194 
195 extern coord bhitpos;	/* place where thrown weapon falls to the ground */
196 
197 extern xchar seehx,seelx,seehy,seely; /* where to see*/
198 extern char *save_cm,*killer;
199 
200 extern xchar dlevel, maxdlevel; /* dungeon level */
201 
202 extern long moves;
203 
204 extern int multi;
205 
206 
207 extern char lock[PL_NSIZ+4];
208 
209 
210 #define DIST(x1,y1,x2,y2)       (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
211 
212 #define	PL_CSIZ		20	/* sizeof pl_character */
213 #define	MAX_CARR_CAP	120	/* so that boulders can be heavier */
214 #define	MAXLEVEL	40
215 #define	FAR	(COLNO+2)	/* position outside screen */
216 
217 
218 /* alloc.c */
219 void *alloc(unsigned int);
220 
221 /* hack.apply.c */
222 int  doapply(void);
223 int  holetime(void);
224 void dighole(void);
225 
226 /* hack.bones.c */
227 void savebones(void);
228 int  getbones(void);
229 
230 /* hack.c */
231 void unsee(void);
232 void seeoff(int);
233 void domove(void);
234 int  dopickup(void);
235 void pickup(int);
236 void lookaround(void);
237 int  monster_nearby(void);
238 int  cansee(xchar, xchar);
239 int  sgn(int);
240 void setsee(void);
241 void nomul(int);
242 int  abon(void);
243 int  dbon(void);
244 void losestr(int);
245 void losehp(int, char *);
246 void losehp_m(int, struct monst *);
247 void losexp(void);
248 int  inv_weight(void);
249 long newuexp(void);
250 
251 /* hack.cmd.c */
252 void rhack(char *);
253 int  doextcmd(void);
254 int  movecmd(char);
255 int  getdir(boolean);
256 void confdir(void);
257 #ifdef QUEST
258 void finddir(void);
259 int  isroom(int, int);
260 #endif
261 int  isok(int, int);
262 
263 /* hack.do.c */
264 int  dodrop(void);
265 void dropx(struct obj *);
266 void dropy(struct obj *);
267 int  doddrop(void);
268 int  dodown(void);
269 int  doup(void);
270 void goto_level(int, boolean);
271 int  donull(void);
272 int  dopray(void);
273 int  dothrow(void);
274 struct obj *splitobj(struct obj *, int);
275 void more_experienced(int, int);
276 void set_wounded_legs(long, int);
277 void heal_legs(void);
278 
279 /* hack.do_name.c */
280 coord getpos(int, char *);
281 int  do_mname(void);
282 int  ddocall(void);
283 void docall(struct obj *);
284 char *xmonnam(struct monst *, int);
285 char *monnam(struct monst *);
286 char *Monnam(struct monst *);
287 char *amonnam(struct monst *, char *);
288 char *Amonnam(struct monst *, char *);
289 char *Xmonnam(struct monst *);
290 
291 /* hack.do_wear.c */
292 int  doremarm(void);
293 int  doremring(void);
294 int  armoroff(struct obj *);
295 int  doweararm(void);
296 int  dowearring(void);
297 void ringoff(struct obj *);
298 void find_ac(void);
299 void glibr(void);
300 struct obj *some_armor(void);
301 void corrode_armor(void);
302 
303 /* hack.dog.c */
304 void makedog(void);
305 void losedogs(void);
306 void keepdogs(void);
307 void fall_down(struct monst *);
308 int  dog_move(struct monst *, int);
309 int  inroom(xchar, xchar);
310 int  tamedog(struct monst *, struct obj *);
311 
312 /* hack.eat.c */
313 void init_uhunger(void);
314 int  opentin(void);
315 void Meatdone(void);
316 int  doeat(void);
317 void gethungry(void);
318 void morehungry(int);
319 void lesshungry(int);
320 void unfaint(void);
321 int  poisonous(struct obj *);
322 
323 /* hack.end.c */
324 void done1(int);
325 int  done2(void);
326 void done_intr(int);
327 void done_hangup(int);
328 void done_in_by(struct monst *);
329 void done(char *);
330 void clearlocks(void);
331 char *eos(char *);
332 void charcat(char *, char);
333 void prscore(int, char **);
334 
335 /* hack.engrave.c */
336 struct engr *engr_at(xchar, xchar);
337 int  sengr_at(char *, xchar, xchar);
338 void u_wipe_engr(int);
339 void wipe_engr_at(xchar, xchar, xchar);
340 void read_engr_at(int, int);
341 void make_engr_at(int, int, char *);
342 int  doengrave(void);
343 void save_engravings(int);
344 void rest_engravings(int);
345 
346 /* hack.fight.c */
347 int  hitmm(struct monst *, struct monst *);
348 void mondied(struct monst *);
349 int  fightm(struct monst *);
350 int  thitu(int, int, char *);
351 boolean hmon(struct monst *, struct obj *, int);
352 boolean attack(struct monst *);
353 
354 /* hack.invent.c */
355 struct obj *addinv(struct obj *);
356 void useup(struct obj *);
357 void freeinv(struct obj *);
358 void delobj(struct obj *);
359 void freeobj(struct obj *);
360 void freegold(struct gold *);
361 void deltrap(struct trap *);
362 struct monst *m_at(int, int);
363 struct obj   *o_at(int, int);
364 struct obj   *sobj_at(int, int, int);
365 int  carried(struct obj *);
366 boolean carrying(int);
367 struct obj *o_on(unsigned int, struct obj *);
368 struct trap *t_at(int, int);
369 struct gold *g_at(int, int);
370 struct obj *mkgoldobj(long);
371 struct obj *getobj(char *, char *);
372 int  ckunpaid(struct obj *);
373 int  ggetobj(char *, int (*fn)(struct obj *), int);
374 int  askchain(struct obj *, char *, int, int (*fn)(struct obj *),
375     int (*ckfn)(struct obj *), int);
376 void prinv(struct obj *);
377 int  ddoinv(void);
378 int  dotypeinv(void);
379 int  dolook(void);
380 void stackobj(struct obj *);
381 int  countgold(void);
382 int  doprgold(void);
383 int  doprwep(void);
384 int  doprarm(void);
385 int  doprring(void);
386 
387 /* hack.ioctl.c */
388 void getioctls(void);
389 void setioctls(void);
390 #ifdef SUSPEND
391 int  dosuspend(void);
392 #endif
393 
394 /* hack.lev.c */
395 void savelev(int, xchar);
396 void bwrite(int, const void *, ssize_t);
397 void saveobjchn(int, struct obj *);
398 void savemonchn(int, struct monst *);
399 void savegoldchn(int, struct gold *);
400 void savetrapchn(int, struct trap *);
401 void getlev(int, int, xchar);
402 void mread(int, char *, unsigned);
403 void mklev(void);
404 
405 /* hack.main.c */
406 void glo(int);
407 void askname(void);
408 void impossible(const char *, ...) __attribute__((__format__ (printf, 1, 2)));
409 /* ... stuff: fix in files; printf-like ones have spec _attrib or
410  * something */
411 void stop_occupation(void);
412 
413 /* hack.makemon.c */
414 struct monst *makemon(struct permonst *, int, int);
415 coord enexto(xchar, xchar);
416 int  goodpos(int, int);
417 void rloc(struct monst *);
418 struct monst *mkmon_at(char, int, int);
419 
420 /* hack.mhitu.c */
421 int  mhitu(struct monst *);
422 int  hitu(struct monst *, int);
423 
424 /* hack.mklev.c */
425 void makelevel(void);
426 int  makerooms(void);
427 void mktrap(int, int, struct mkroom *);
428 
429 /* hack.mkmaze.c */
430 void makemaz(void);
431 coord mazexy(void);
432 
433 /* hack/mkobj.c */
434 struct obj * mkobj_at(int, int, int);
435 void mksobj_at(int, int, int);
436 struct obj *mkobj(int);
437 struct obj *mksobj(int);
438 int  letter(int);
439 int  weight(struct obj *);
440 void mkgold(long, int, int);
441 
442 /* hack.mkshop.c */
443 #ifndef QUEST
444 void mkshop(void);
445 void mkzoo(int);
446 struct permonst *morguemon(void);
447 void mkswamp(void);
448 #endif
449 
450 /* hack.mon.c */
451 void movemon(void);
452 void justswld(struct monst *, char *);
453 void youswld(struct monst *, int, int, char *);
454 int  dochug(struct monst *);
455 int  m_move(struct monst *, int);
456 int  mfndpos(struct monst *, coord pos[9], int info[9], int);
457 int  dist(int, int);
458 void poisoned(char *, char *);
459 void mondead(struct monst *);
460 void replmon(struct monst *, struct monst *);
461 void relmon(struct monst *);
462 void monfree(struct monst *);
463 void unstuck(struct monst *);
464 void killed(struct monst *);
465 void kludge(char *, char *);
466 void rescham(void);
467 int  newcham(struct monst *, struct permonst *);
468 void mnexto(struct monst *);
469 void setmangry(struct monst *);
470 int  canseemon(struct monst *);
471 
472 /* hack.o_init.c */
473 int  letindex(char);
474 void init_objects(void);
475 int  probtype(char);
476 void oinit(void);
477 void savenames(int);
478 void restnames(int);
479 int  dodiscovered(void);
480 
481 /* hack.objnam.c */
482 char *strprepend(char *, char *);
483 char *typename(int);
484 char *xname(struct obj *);
485 char *doname(struct obj *);
486 void setan(char *, char *, size_t);
487 char *aobjnam(struct obj *, char *);
488 char *Doname(struct obj *);
489 struct obj *readobjnam(char *, size_t);
490 
491 /* hack.options.c */
492 void initoptions(void);
493 int  doset(void);
494 
495 /* hack.pager.c */
496 int  dowhatis(void);
497 void intruph(int);
498 void set_whole_screen(void);
499 #ifdef NEWS
500 int  readnews(void);
501 #endif
502 void set_pager(int);
503 int  page_line(char *);
504 void cornline(int, char *);
505 int  dohelp(void);
506 int  page_file(char *, boolean);
507 #ifdef UNIX
508 #ifdef SHELL
509 int  dosh(void);
510 #endif
511 int  child(int);
512 #endif
513 
514 /* hack.potion.c */
515 int  dodrink(void);
516 void pluslvl(void);
517 void strange_feeling(struct obj *, char *);
518 void potionhit(struct monst *, struct obj *);
519 void potionbreathe(struct obj *);
520 int  dodip(void);
521 
522 /* hack.pri.c */
523 void swallowed(void);
524 void panic(const char *, ...) __attribute__((__format__ (printf, 1, 2)));
525 void atl(int, int, int);
526 void on_scr(int, int);
527 void tmp_at(schar, schar);
528 void Tmp_at(schar, schar);
529 void setclipped(void);
530 void at(xchar, xchar, char);
531 void prme(void);
532 int  doredraw(void);
533 void docrt(void);
534 void docorner(int, int);
535 void curs_on_u(void);
536 void pru(void);
537 void prl(int, int);
538 char news0(xchar, xchar);
539 void newsym(int, int);
540 void mnewsym(int, int);
541 void nosee(int, int);
542 #ifndef QUEST
543 void prl1(int, int);
544 void nose1(int, int);
545 #endif
546 int  vism_at(int, int);
547 void unpobj(struct obj *);
548 void seeobjs(void);
549 void seemons(void);
550 void pmon(struct monst *);
551 void unpmon(struct monst *);
552 void nscr(void);
553 void bot(void);
554 void cls(void);
555 
556 /* hack.read.c */
557 int  doread(void);
558 int  identify(struct obj *);
559 void litroom(boolean);
560 
561 /* hack.rip.c */
562 void outrip(void);
563 
564 /* hack.rumors.c */
565 void outrumor(void);
566 
567 /* hack.save.c */
568 int  dosave(void);
569 __dead void hackhangup(int);
570 int  dorecover(int);
571 struct obj *restobjchn(int);
572 struct monst *restmonchn(int);
573 
574 /* hack.search.c */
575 int  findit(void);
576 int  dosearch(void);
577 int  doidtrap(void);
578 void wakeup(struct monst *);
579 void seemimic(struct monst *);
580 
581 /* hack.shk.c */
582 char *shkname(struct monst *);
583 void shkdead(struct monst *);
584 void replshk(struct monst *, struct monst *);
585 int  inshop(void);
586 void obfree(struct obj *, struct obj *);
587 int  dopay(void);
588 void paybill(void);
589 void addtobill(struct obj *);
590 void splitbill(struct obj *, struct obj *);
591 void subfrombill(struct obj *);
592 int  doinvbill(int);
593 int  shkcatch(struct obj *);
594 int  shk_move(struct monst *);
595 void shopdig(int);
596 int  online(int, int);
597 int  follower(struct monst *);
598 
599 /* hack.shknam.c */
600 void findname(char *, size_t, char);
601 
602 /* hack.steal.c */
603 long somegold(void);
604 void stealgold(struct monst *);
605 void stealarm(void);
606 int  steal(struct monst *);
607 void mpickobj(struct monst *, struct obj *);
608 int  stealamulet(struct monst *);
609 void relobj(struct monst *, int);
610 
611 /* hack.termcap.c */
612 void startup(void);
613 void start_screen(void);
614 void end_screen(void);
615 void start_screen(void);
616 void curs(int, int);
617 void cl_end(void);
618 void clr_screen(void);
619 void home(void);
620 void standoutbeg(void);
621 void standoutend(void);
622 void backsp(void);
623 void hackbell(void);
624 void cl_eos(void);
625 
626 /* hack.timeout.c */
627 void hacktimeout(void);
628 
629 /* hack.topl.c */
630 int  doredotopl(void);
631 void remember_topl(void);
632 void addtopl(char *);
633 void more(void);
634 void cmore(char *);
635 void clrlin(void);
636 void pline(const char *, ...) __attribute__((__format__ (printf, 1, 2)));
637 void vpline(const char *, va_list) __attribute__((__format__ (printf, 1, 0)));
638 void putsym(char);
639 void putstr(char *);
640 
641 /* hack.track.c */
642 void initrack(void);
643 void settrack(void);
644 coord *gettrack(int, int);
645 
646 /* hack.trap.c */
647 struct trap *maketrap(int, int, int);
648 void dotrap(struct trap *);
649 int  mintrap(struct monst *);
650 void selftouch(char *);
651 void float_up(void);
652 int  float_down(void);
653 void tele(void);
654 int  dotele(void);
655 void placebc(int);
656 void unplacebc(void);
657 void level_tele(void);
658 void drown(void);
659 
660 /* hack.tty.c */
661 void gettty(void);
662 void settty(char *);
663 void setftty(void);
664 __dead void error(const char *, ...) __attribute__((__format__ (printf, 1, 2)));
665 void getlin(char *);
666 void getret(void);
667 void cgetret(char *);
668 void xwaitforspace(char *);
669 char *parse(void);
670 char readchar(void);
671 void end_of_input(void);
672 
673 /* hack.u_init.c */
674 void u_init(void);
675 void plnamesuffix(void);
676 
677 /* hack.unix.c */
678 int  getyear(void);
679 char *getdate(void);
680 int  phase_of_the_moon(void);
681 int  night(void);
682 int  midnight(void);
683 void getlock(void);
684 #ifdef MAIL
685 void getmailstatus(void);
686 void ckmailstatus(void);
687 void readmail(void);
688 #endif
689 void regularize(char *);
690 
691 /* hack.vault.c */
692 void setgd(void);
693 void invault(void);
694 int  gd_move(void);
695 void gddead(void);
696 void replgd(struct monst *, struct monst *);
697 
698 /* hack.version.c */
699 int  doversion(void);
700 
701 /* hack.wield.c */
702 void setuwep(struct obj *);
703 int  dowield(void);
704 void corrode_weapon(void);
705 int  chwepon(struct obj *, int);
706 
707 /* hack.wizard.c */
708 void amulet(void);
709 int  wiz_hit(struct monst *);
710 void inrange(struct monst *);
711 void aggravate(void);
712 
713 /* hack.worm.c */
714 #ifndef NOWORM
715 int  getwn(struct monst *);
716 void initworm(struct monst *);
717 void worm_move(struct monst *);
718 void worm_nomove(struct monst *);
719 void wormdead(struct monst *);
720 void wormhit(struct monst *);
721 void wormsee(unsigned);
722 void pwseg(struct wseg *);
723 void cutworm(struct monst *, xchar, xchar, uchar);
724 #endif
725 
726 /* hack.worn.c */
727 void setworn(struct obj *, long);
728 void setnotworn(struct obj *);
729 
730 /* hack.zap.c */
731 void bhitm(struct monst *, struct obj *);
732 boolean bhito(struct obj *, struct obj *);
733 int  dozap(void);
734 char *exclam(int);
735 void hit(char *, struct monst *, char *);
736 void miss(char *, struct monst *);
737 struct monst *bhit(int, int, int, char,
738     void (*fhitm)(struct monst *, struct obj *),
739     boolean (*fhito)(struct obj *, struct obj *), struct obj *);
740 struct monst *boomhit(int, int);
741 void buzz(int, xchar, xchar, int, int);
742 void fracture_rock(struct obj *);
743 
744 /* rnd.c */
745 int  rn1(int, int);
746 int  rn2(int);
747 int  rnd(int);
748 int  d(int, int);
749