]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/extern.h
18cd2540cb76c00ad8caa8cb5760f7670ed58ceb
[bsdgames-darwin.git] / hack / extern.h
1 /* $NetBSD: extern.h,v 1.10 2009/05/06 02:59:12 ginsbach Exp $ */
2
3 /*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31 #ifndef _EXTERN_H_
32 #define _EXTERN_H_
33 #include <stdarg.h>
34 #include <stdio.h>
35
36 /* alloc.c */
37 long *alloc(unsigned);
38 long *enlarge(char *, unsigned);
39
40 /* hack.apply.c */
41 int doapply(void);
42 int holetime(void);
43 void dighole(void);
44
45 /* hack.bones.c */
46 void savebones(void);
47 int getbones(void);
48
49 /* hack.c */
50 void unsee(void);
51 void seeoff(int);
52 void domove(void);
53 void movobj(struct obj *, int, int);
54 int dopickup(void);
55 void pickup(int);
56 void lookaround(void);
57 int monster_nearby(void);
58 int rroom(int, int);
59 int cansee(xchar, xchar);
60 int sgn(int);
61 void setsee(void);
62 void nomul(int);
63 int abon(void);
64 int dbon(void);
65 void losestr(int);
66 void losehp(int, const char *);
67 void losehp_m(int, struct monst *);
68 void losexp(void);
69 int inv_weight(void);
70 int inv_cnt(void);
71 long newuexp(void);
72
73 /* hack.cmd.c */
74 void rhack(const char *);
75 int doextcmd(void);
76 char lowc(int);
77 char unctrl(int);
78 int movecmd(int);
79 int getdir(boolean);
80 void confdir(void);
81 int finddir(void);
82 int isroom(int, int);
83 int isok(int, int);
84
85 /* hack.do.c */
86 int dodrop(void);
87 void dropx(struct obj *);
88 void dropy(struct obj *);
89 int doddrop(void);
90 int dodown(void);
91 int doup(void);
92 void goto_level(int, boolean);
93 int donull(void);
94 int dopray(void);
95 int dothrow(void);
96 struct obj *splitobj(struct obj *, int);
97 void more_experienced(int, int);
98 void set_wounded_legs(long, int);
99 void heal_legs(void);
100
101 /* hack.do_name.c */
102 coord getpos(int, const char *);
103 int do_mname(void);
104 void do_oname(struct obj *);
105 int ddocall(void);
106 void docall(struct obj *);
107 char *xmonnam(struct monst *, int);
108 char *lmonnam(struct monst *);
109 char *monnam(struct monst *);
110 char *Monnam(struct monst *);
111 char *amonnam(struct monst *, const char *);
112 char *Amonnam(struct monst *, const char *);
113 char *Xmonnam(struct monst *);
114 char *visctrl(int);
115
116 /* hack.do_wear.c */
117 void off_msg(struct obj *);
118 int doremarm(void);
119 int doremring(void);
120 int dorr(struct obj *);
121 int cursed(struct obj *);
122 int armoroff(struct obj *);
123 int doweararm(void);
124 int dowearring(void);
125 void ringoff(struct obj *);
126 void find_ac(void);
127 void glibr(void);
128 struct obj *some_armor(void);
129 void corrode_armor(void);
130
131 /* hack.dog.c */
132 void makedog(void);
133 void initedog(struct monst *);
134 void losedogs(void);
135 void keepdogs(void);
136 void fall_down(struct monst *);
137 int dogfood(struct obj *);
138 int dog_move(struct monst *, int);
139 int inroom(xchar, xchar);
140 int tamedog(struct monst *, struct obj *);
141
142 /* hack.eat.c */
143 void init_uhunger(void);
144 int opentin(void);
145 int Meatdone(void);
146 int doeat(void);
147 void gethungry(void);
148 void morehungry(int);
149 void lesshungry(int);
150 int unfaint(void);
151 void newuhs(boolean);
152 int poisonous(struct obj *);
153 int eatcorpse(struct obj *);
154
155 /* hack.end.c */
156 int dodone(void);
157 void done1(int);
158 void done_intr(int);
159 void done_hangup(int);
160 void done_in_by(struct monst *);
161 void done(const char *);
162 void topten(void);
163 void outheader(void);
164 struct toptenentry;
165 int outentry(int, struct toptenentry *, int);
166 char *itoa(int);
167 const char *ordin(int);
168 void clearlocks(void);
169 void hangup(int) __attribute__((__noreturn__));
170 char *eos(char *);
171 void charcat(char *, int);
172 void prscore(int, char **);
173
174 /* hack.engrave.c */
175 struct engr *engr_at(xchar, xchar);
176 int sengr_at(const char *, xchar, xchar);
177 void u_wipe_engr(int);
178 void wipe_engr_at(xchar, xchar, xchar);
179 void read_engr_at(int, int);
180 void make_engr_at(int, int, const char *);
181 int doengrave(void);
182 void save_engravings(int);
183 void rest_engravings(int);
184 void del_engr(struct engr *);
185
186 /* hack.fight.c */
187 int hitmm(struct monst *, struct monst *);
188 void mondied(struct monst *);
189 void monstone(struct monst *);
190 int fightm(struct monst *);
191 int thitu(int, int, const char *);
192 boolean hmon(struct monst *, struct obj *, int);
193 int attack(struct monst *);
194
195 /* hack.invent.c */
196 struct obj *addinv(struct obj *);
197 void useup(struct obj *);
198 void freeinv(struct obj *);
199 void delobj(struct obj *);
200 void freeobj(struct obj *);
201 void freegold(struct gold *);
202 void deltrap(struct trap *);
203 struct monst *m_at(int, int);
204 struct obj *o_at(int, int);
205 struct obj *sobj_at(int, int, int);
206 int carried(struct obj *);
207 int carrying(int);
208 struct obj *o_on(unsigned int, struct obj *);
209 struct trap *t_at(int, int);
210 struct gold *g_at(int, int);
211 struct obj *mkgoldobj(long);
212 struct obj *getobj(const char *, const char *);
213 int ckunpaid(struct obj *);
214 int ggetobj(const char *, int (*fn)(struct obj *), int);
215 int askchain(struct obj *, char *, int, int (*)(struct obj *),
216 int (*)(struct obj *), int);
217 char obj_to_let(struct obj *);
218 void prinv(struct obj *);
219 int ddoinv(void);
220 void doinv(char *);
221 int dotypeinv(void);
222 int dolook(void);
223 void stackobj(struct obj *);
224 int merged(struct obj *, struct obj *, int);
225 int countgold(void);
226 int doprgold(void);
227 int doprwep(void);
228 int doprarm(void);
229 int doprring(void);
230 int digit(int);
231
232 /* hack.ioctl.c */
233 void getioctls(void);
234 void setioctls(void);
235 int dosuspend(void);
236
237 /* hack.lev.c */
238 void savelev(int, xchar);
239 void bwrite(int, const void *, size_t);
240 void saveobjchn(int, struct obj *);
241 void savemonchn(int, struct monst *);
242 void savegoldchn(int, struct gold *);
243 void savetrapchn(int, struct trap *);
244 void getlev(int, int, xchar);
245 void mread(int, char *, unsigned);
246 void mklev(void);
247
248 /* hack.main.c */
249 void glo(int);
250 void askname(void);
251 void impossible(const char *, ...)
252 __attribute__((__format__(__printf__, 1, 2)));
253 void stop_occupation(void);
254
255 /* hack.makemon.c */
256 struct monst *makemon(const struct permonst *, int, int);
257 coord enexto(xchar, xchar);
258 int goodpos(int, int);
259 void rloc(struct monst *);
260 struct monst *mkmon_at(int, int, int);
261
262 /* hack.mhitu.c */
263 int mhitu(struct monst *);
264 int hitu(struct monst *, int);
265
266 /* hack.mklev.c */
267 void makelevel(void);
268 int makerooms(void);
269 void addrs(int, int, int, int);
270 void addrsx(int, int, int, int, boolean);
271 struct mkroom;
272 int comp(const void *, const void *);
273 coord finddpos(int, int, int, int);
274 int okdoor(int, int);
275 void dodoor(int, int, struct mkroom *);
276 void dosdoor(int, int, struct mkroom *, int);
277 int maker(schar, schar, schar, schar);
278 void makecorridors(void);
279 void join(int, int);
280 void make_niches(void);
281 void makevtele(void);
282 void makeniche(boolean);
283 void mktrap(int, int, struct mkroom *);
284
285 /* hack.mkmaze.c */
286 void makemaz(void);
287 void walkfrom(int, int);
288 void move(int *, int *, int);
289 int okay(int, int, int);
290 coord mazexy(void);
291
292 /* hack.mkobj.c */
293 struct obj *mkobj_at(int, int, int);
294 void mksobj_at(int, int, int);
295 struct obj *mkobj(int);
296 struct obj *mksobj(int);
297 int letter(int);
298 int weight(struct obj *);
299 void mkgold(long, int, int);
300
301 /* hack.mkshop.c */
302 void mkshop(void);
303 void mkzoo(int);
304 const struct permonst *morguemon(void);
305 void mkswamp(void);
306 int nexttodoor(int, int);
307 int has_dnstairs(struct mkroom *);
308 int has_upstairs(struct mkroom *);
309 int isbig(struct mkroom *);
310 int dist2(int, int, int, int);
311 int sq(int);
312
313 /* hack.mon.c */
314 void movemon(void);
315 void justswld(struct monst *, const char *);
316 void youswld(struct monst *, int, int, const char *);
317 int dochugw(struct monst *);
318 int dochug(struct monst *);
319 int m_move(struct monst *, int);
320 void mpickgold(struct monst *);
321 void mpickgems(struct monst *);
322 int mfndpos(struct monst *, coord[9 ], int[9 ], int);
323 int dist(int, int);
324 void poisoned(const char *, const char *);
325 void mondead(struct monst *);
326 void replmon(struct monst *, struct monst *);
327 void relmon(struct monst *);
328 void monfree(struct monst *);
329 void dmonsfree(void);
330 void unstuck(struct monst *);
331 void killed(struct monst *);
332 void kludge(const char *, const char *);
333 void rescham(void);
334 int newcham(struct monst *, const struct permonst *);
335 void mnexto(struct monst *);
336 int ishuman(struct monst *);
337 void setmangry(struct monst *);
338 int canseemon(struct monst *);
339
340 /* hack.monst.c */
341
342 /* hack.o_init.c */
343 int letindex(int);
344 void init_objects(void);
345 int probtype(int);
346 void setgemprobs(void);
347 void oinit(void);
348 void savenames(int);
349 void restnames(int);
350 int dodiscovered(void);
351 int interesting_to_discover(int);
352
353 /* hack.objnam.c */
354 char *strprepend(char *, char *);
355 char *sitoa(int);
356 char *typename(int);
357 char *xname(struct obj *);
358 char *doname(struct obj *);
359 void setan(const char *, char *);
360 char *aobjnam(struct obj *, const char *);
361 char *Doname(struct obj *);
362 struct obj *readobjnam(char *);
363
364 /* hack.options.c */
365 void initoptions(void);
366 void parseoptions(char *, boolean);
367 int doset(void);
368
369 /* hack.pager.c */
370 int dowhatis(void);
371 void intruph(int);
372 void page_more(FILE *, int);
373 void set_whole_screen(void);
374 int readnews(void);
375 void set_pager(int);
376 int page_line(const char *);
377 void cornline(int, const char *);
378 int dohelp(void);
379 int page_file(const char *, boolean);
380 int dosh(void);
381 int child(int);
382
383 /* hack.potion.c */
384 int dodrink(void);
385 void pluslvl(void);
386 void strange_feeling(struct obj *, const char *);
387 void potionhit(struct monst *, struct obj *);
388 void potionbreathe(struct obj *);
389 int dodip(void);
390 void ghost_from_bottle(void);
391
392 /* hack.pri.c */
393 void swallowed(void);
394 void panic(const char *, ...)
395 __attribute__((__format__(__printf__, 1, 2)));
396 void atl(int, int, int);
397 void on_scr(int, int);
398 void tmp_at(schar, schar);
399 void Tmp_at(schar, schar);
400 void setclipped(void) __attribute__((__noreturn__));
401 void at(xchar, xchar, int);
402 void prme(void);
403 int doredraw(void);
404 void docrt(void);
405 void docorner(int, int);
406 void curs_on_u(void);
407 void pru(void);
408 void prl(int, int);
409 char news0(xchar, xchar);
410 void newsym(int, int);
411 void mnewsym(int, int);
412 void nosee(int, int);
413 void prl1(int, int);
414 void nose1(int, int);
415 int vism_at(int, int);
416 void pobj(struct obj *);
417 void unpobj(struct obj *);
418 void seeobjs(void);
419 void seemons(void);
420 void pmon(struct monst *);
421 void unpmon(struct monst *);
422 void nscr(void);
423 void cornbot(int);
424 void bot(void);
425 void mstatusline(struct monst *);
426 void cls(void);
427
428 /* hack.read.c */
429 int doread(void);
430 int identify(struct obj *);
431 void litroom(boolean);
432 int monstersym(int);
433
434 /* hack.rip.c */
435 void outrip(void);
436 void center(int, char *);
437
438 /* hack.rumors.c */
439 void init_rumors(FILE *);
440 int skipline(FILE *);
441 void outline(FILE *);
442 void outrumor(void);
443 int used(int);
444
445 /* hack.save.c */
446 int dosave(void);
447 int dosave0(int);
448 int dorecover(int);
449 struct obj *restobjchn(int);
450 struct monst *restmonchn(int);
451
452 /* hack.search.c */
453 int findit(void);
454 int dosearch(void);
455 int doidtrap(void);
456 void wakeup(struct monst *);
457 void seemimic(struct monst *);
458
459 /* hack.shk.c */
460 void obfree(struct obj *, struct obj *);
461 void paybill(void);
462 char *shkname(struct monst *);
463 void shkdead(struct monst *);
464 void replshk(struct monst *, struct monst *);
465 int inshop(void);
466 int dopay(void);
467 struct bill_x;
468 struct obj *bp_to_obj(struct bill_x *);
469 void addtobill(struct obj *);
470 void splitbill(struct obj *, struct obj *);
471 void subfrombill(struct obj *);
472 int doinvbill(int);
473 int shkcatch(struct obj *);
474 int shk_move(struct monst *);
475 void shopdig(int);
476 int online(int, int);
477 int follower(struct monst *);
478
479 /* hack.shknam.c */
480 void findname(char *, int);
481
482 /* hack.steal.c */
483 long somegold(void);
484 void stealgold(struct monst *);
485 int stealarm(void);
486 int steal(struct monst *);
487 void mpickobj(struct monst *, struct obj *);
488 int stealamulet(struct monst *);
489 void relobj(struct monst *, int);
490
491 /* hack.termcap.c */
492 void startup(void);
493 void start_screen(void);
494 void end_screen(void);
495 void curs(int, int);
496 void nocmov(int, int);
497 void cmov(int, int);
498 int xputc(int);
499 void xputs(const char *);
500 void cl_end(void);
501 void clear_screen(void);
502 void home(void);
503 void standoutbeg(void);
504 void standoutend(void);
505 void backsp(void);
506 void bell(void);
507 void delay_output(void);
508 void cl_eos(void);
509
510 /* hack.timeout.c */
511 void timeout(void);
512 void stoned_dialogue(void);
513
514 /* hack.topl.c */
515 int doredotopl(void);
516 void redotoplin(void);
517 void remember_topl(void);
518 void addtopl(const char *);
519 void xmore(const char *);
520 void more(void);
521 void cmore(const char *);
522 void clrlin(void);
523 void pline(const char *, ...)
524 __attribute__((__format__(__printf__, 1, 2)));
525 void vpline(const char *, va_list)
526 __attribute__((__format__(__printf__, 1, 0)));
527 void putsym(int);
528 void putstr(const char *);
529
530 /* hack.track.c */
531 void initrack(void);
532 void settrack(void);
533 coord *gettrack(int, int);
534
535 /* hack.trap.c */
536 struct trap *maketrap(int, int, int);
537 void dotrap(struct trap *);
538 int mintrap(struct monst *);
539 void selftouch(const char *);
540 void float_up(void);
541 void float_down(void);
542 void vtele(void);
543 void tele(void);
544 void teleds(int, int);
545 int teleok(int, int);
546 int dotele(void);
547 void placebc(int);
548 void unplacebc(void);
549 void level_tele(void);
550 void drown(void);
551
552 /* hack.tty.c */
553 void gettty(void);
554 void settty(const char *);
555 void setctty(void);
556 void setftty(void);
557 void error(const char *, ...)
558 __attribute__((__format__(__printf__, 1, 2),__noreturn__));
559 void getlin(char *);
560 void getret(void);
561 void cgetret(const char *);
562 void xwaitforspace(const char *);
563 char *parse(void);
564 char readchar(void);
565 void end_of_input(void) __attribute__((__noreturn__));
566
567 /* hack.u_init.c */
568 void u_init(void);
569 struct trobj;
570 void ini_inv(struct trobj *);
571 void wiz_inv(void);
572 void plnamesuffix(void);
573 int role_index(int);
574
575 /* hack.unix.c */
576 void setrandom(void);
577 struct tm *getlt(void);
578 int getyear(void);
579 char *getdatestr(void);
580 int phase_of_the_moon(void);
581 int night(void);
582 int midnight(void);
583 void gethdate(char *);
584 int uptodate(int);
585 int veryold(int);
586 void getlock(void);
587 void getmailstatus(void);
588 void ckmailstatus(void);
589 void newmail(void);
590 void mdrush(struct monst *, boolean);
591 void readmail(void);
592 void regularize(char *);
593
594 /* hack.vault.c */
595 void setgd(void);
596 int gd_move(void);
597 void gddead(void);
598 void replgd(struct monst *, struct monst *);
599 void invault(void);
600
601 /* hack.version.c */
602 int doversion(void);
603
604 /* hack.wield.c */
605 void setuwep(struct obj *);
606 int dowield(void);
607 void corrode_weapon(void);
608 int chwepon(struct obj *, int);
609
610 /* hack.wizard.c */
611 void amulet(void);
612 int wiz_hit(struct monst *);
613 void inrange(struct monst *);
614 void aggravate(void);
615 void clonewiz(struct monst *);
616
617 /* hack.worm.c */
618 #ifndef NOWORM
619 int getwn(struct monst *);
620 void initworm(struct monst *);
621 void worm_move(struct monst *);
622 void worm_nomove(struct monst *);
623 void wormdead(struct monst *);
624 void wormhit(struct monst *);
625 void wormsee(unsigned);
626 struct wseg;
627 void pwseg(struct wseg *);
628 void cutworm(struct monst *, xchar, xchar, uchar);
629 void remseg(struct wseg *);
630 #endif
631
632 /* hack.worn.c */
633 void setworn(struct obj *, long);
634 void setnotworn(struct obj *);
635
636 /* hack.zap.c */
637 void bhitm(struct monst *, struct obj *);
638 int bhito(struct obj *, struct obj *);
639 int dozap(void);
640 const char *exclam(int);
641 void hit(const char *, struct monst *, const char *);
642 void miss(const char *, struct monst *);
643 struct monst *bhit(int, int, int, int,
644 void (*)(struct monst *, struct obj *),
645 int (*)(struct obj *, struct obj *),
646 struct obj *);
647 struct monst *boomhit(int, int);
648 char dirlet(int, int);
649 void buzz(int, xchar, xchar, int, int);
650 int zhit(struct monst *, int);
651 int revive(struct obj *);
652 void rloco(struct obj *);
653 void fracture_rock(struct obj *);
654 void burn_scrolls(void);
655
656 /* rnd.c */
657 int rn1(int, int);
658 int rn2(int);
659 int rnd(int);
660 int d(int, int);
661 #endif /* _EXTERN_H_ */