xref: /dragonfly/games/hack/extern.h (revision bb54c3a2)
1 /*	$NetBSD: extern.h,v 1.18 2011/08/27 23:42:33 joerg 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 void *alloc(size_t);
38 
39 /* hack.apply.c */
40 int doapply(void);
41 int holetime(void);
42 void dighole(void);
43 
44 /* hack.bones.c */
45 void savebones(void);
46 int getbones(void);
47 
48 /* hack.c */
49 void unsee(void);
50 void seeoff(int);
51 void domove(void);
52 int dopickup(void);
53 void pickup(int);
54 void lookaround(void);
55 int monster_nearby(void);
56 int rroom(int, int);
57 int cansee(xchar, xchar);
58 int sgn(int);
59 void setsee(void);
60 void nomul(int);
61 int abon(void);
62 int dbon(void);
63 void losestr(int);
64 void losehp(int, const char *);
65 void losehp_m(int, struct monst *);
66 void losexp(void);
67 int inv_weight(void);
68 long newuexp(void);
69 
70 /* hack.cmd.c */
71 void rhack(const char *);
72 int movecmd(int);
73 int getdir(boolean);
74 void confdir(void);
75 int finddir(void);
76 int isroom(int, int);
77 int isok(int, int);
78 
79 /* hack.do.c */
80 int dodrop(void);
81 void dropx(struct obj *);
82 int doddrop(void);
83 int dodown(void);
84 int doup(void);
85 void goto_level(int, boolean);
86 int donull(void);
87 int dopray(void);
88 int dothrow(void);
89 struct obj *splitobj(struct obj *, int);
90 void more_experienced(int, int);
91 void set_wounded_legs(long, int);
92 void heal_legs(void);
93 
94 /* hack.do_name.c */
95 coord getpos(int, const char *);
96 int do_mname(void);
97 int ddocall(void);
98 void docall(struct obj *);
99 char *monnam(struct monst *);
100 char *Monnam(struct monst *);
101 char *amonnam(struct monst *, const char *);
102 char *Amonnam(struct monst *, const char *);
103 char *Xmonnam(struct monst *);
104 
105 /* hack.do_wear.c */
106 int doremarm(void);
107 int doremring(void);
108 int armoroff(struct obj *);
109 int doweararm(void);
110 int dowearring(void);
111 void ringoff(struct obj *);
112 void find_ac(void);
113 void glibr(void);
114 struct obj *some_armor(void);
115 void corrode_armor(void);
116 
117 /* hack.dog.c */
118 void makedog(void);
119 void losedogs(void);
120 void keepdogs(void);
121 void fall_down(struct monst *);
122 int dog_move(struct monst *, int);
123 int inroom(xchar, xchar);
124 int tamedog(struct monst *, struct obj *);
125 
126 /* hack.eat.c */
127 void init_uhunger(void);
128 int doeat(void);
129 void gethungry(void);
130 void morehungry(int);
131 void lesshungry(int);
132 int poisonous(struct obj *);
133 
134 /* hack.end.c */
135 int dodone(void);
136 void done1(int);
137 void done_in_by(struct monst *);
138 void done(const char *);
139 void clearlocks(void);
140 void hang_up(int) __dead2;
141 char *eos(char *);
142 void charcat(char *, int);
143 void prscore(int, char **);
144 
145 /* hack.engrave.c */
146 int sengr_at(const char *, xchar, xchar);
147 void u_wipe_engr(int);
148 void wipe_engr_at(xchar, xchar, xchar);
149 void read_engr_at(int, int);
150 void make_engr_at(int, int, const char *);
151 int doengrave(void);
152 void save_engravings(int);
153 void rest_engravings(int);
154 
155 /* hack.fight.c */
156 int hitmm(struct monst *, struct monst *);
157 void mondied(struct monst *);
158 int fightm(struct monst *);
159 int thitu(int, int, const char *);
160 boolean hmon(struct monst *, struct obj *, int);
161 int attack(struct monst *);
162 
163 /* hack.invent.c */
164 struct obj *addinv(struct obj *);
165 void useup(struct obj *);
166 void freeinv(struct obj *);
167 void delobj(struct obj *);
168 void freeobj(struct obj *);
169 void freegold(struct gold *);
170 void deltrap(struct trap *);
171 struct monst *m_at(int, int);
172 struct obj *o_at(int, int);
173 struct obj *sobj_at(int, int, int);
174 int carried(struct obj *);
175 int carrying(int);
176 struct obj *o_on(unsigned int, struct obj *);
177 struct trap *t_at(int, int);
178 struct gold *g_at(int, int);
179 struct obj *getobj(const char *, const char *);
180 int ggetobj(const char *, int (*fn)(struct obj *), int);
181 int askchain(struct obj *, char *, int, int (*)(struct obj *),
182     int (*)(struct obj *), int);
183 void prinv(struct obj *);
184 int ddoinv(void);
185 int dotypeinv(void);
186 int dolook(void);
187 void stackobj(struct obj *);
188 int doprgold(void);
189 int doprwep(void);
190 int doprarm(void);
191 int doprring(void);
192 int digit(int);
193 
194 /* hack.ioctl.c */
195 void getioctls(void);
196 void setioctls(void);
197 int dosuspend(void);
198 
199 /* hack.lev.c */
200 void savelev(int, xchar);
201 void bwrite(int, const void *, size_t);
202 void saveobjchn(int, struct obj *);
203 void savemonchn(int, struct monst *);
204 void getlev(int, int, xchar);
205 void mread(int, void *, size_t);
206 void mklev(void);
207 
208 /* hack.main.c */
209 void glo(int);
210 void askname(void);
211 void impossible(const char *, ...) __printflike(1, 2);
212 void stop_occupation(void);
213 
214 /* hack.makemon.c */
215 struct monst *makemon(const struct permonst *, int, int);
216 coord enexto(xchar, xchar);
217 int goodpos(int, int);
218 void rloc(struct monst *);
219 struct monst *mkmon_at(int, int, int);
220 
221 /* hack.mhitu.c */
222 int mhitu(struct monst *);
223 int hitu(struct monst *, int);
224 
225 /* hack.mklev.c */
226 struct mkroom;
227 void makelevel(void);
228 void mktrap(int, int, struct mkroom *);
229 
230 /* hack.mkmaze.c */
231 void makemaz(void);
232 coord mazexy(void);
233 
234 /* hack.mkobj.c */
235 struct obj *mkobj_at(int, int, int);
236 void mksobj_at(int, int, int);
237 struct obj *mkobj(int);
238 struct obj *mksobj(int);
239 int letter(int);
240 int weight(struct obj *);
241 void mkgold(long, int, int);
242 
243 /* hack.mkshop.c */
244 void mkshop(void);
245 void mkzoo(int);
246 void mkswamp(void);
247 
248 /* hack.mon.c */
249 void movemon(void);
250 void justswld(struct monst *, const char *);
251 void youswld(struct monst *, int, unsigned int, const char *);
252 int dochug(struct monst *);
253 int m_move(struct monst *, int);
254 int mfndpos(struct monst *, coord[9 ], int[9 ], int);
255 int dist(int, int);
256 void poisoned(const char *, const char *);
257 void mondead(struct monst *);
258 void replmon(struct monst *, struct monst *);
259 void relmon(struct monst *);
260 void monfree(struct monst *);
261 void unstuck(struct monst *);
262 void killed(struct monst *);
263 void kludge(const char *, const char *);
264 void rescham(void);
265 int newcham(struct monst *, const struct permonst *);
266 void mnexto(struct monst *);
267 void setmangry(struct monst *);
268 int canseemon(struct monst *);
269 
270 /* hack.monst.c */
271 
272 /* hack.o_init.c */
273 int letindex(int);
274 void init_objects(void);
275 int probtype(int);
276 void oinit(void);
277 void savenames(int);
278 void restnames(int);
279 int dodiscovered(void);
280 
281 /* hack.objnam.c */
282 char *typename(int);
283 char *xname(struct obj *);
284 char *doname(struct obj *);
285 void setan(const char *, char *, size_t);
286 char *aobjnam(struct obj *, const char *);
287 char *Doname(struct obj *);
288 struct obj *readobjnam(char *);
289 
290 /* hack.options.c */
291 void initoptions(void);
292 int doset(void);
293 
294 /* hack.pager.c */
295 int dowhatis(void);
296 void set_whole_screen(void);
297 int readnews(void);
298 void set_pager(int);
299 int page_line(const char *);
300 void cornline(int, const char *);
301 int dohelp(void);
302 int dosh(void);
303 
304 /* hack.potion.c */
305 int dodrink(void);
306 void pluslvl(void);
307 void strange_feeling(struct obj *, const char *);
308 void potionhit(struct monst *, struct obj *);
309 void potionbreathe(struct obj *);
310 int dodip(void);
311 
312 /* hack.pri.c */
313 void swallowed(void);
314 void panic(const char *, ...) __printflike(1, 2);
315 void atl(int, int, int);
316 void on_scr(int, int);
317 void tmp_at(schar, schar);
318 void Tmp_at(schar, schar);
319 void setclipped(void) __dead2;
320 void at(xchar, xchar, int);
321 void prme(void);
322 int doredraw(void);
323 void docrt(void);
324 void docorner(int, int);
325 void curs_on_u(void);
326 void pru(void);
327 void prl(int, int);
328 char news0(xchar, xchar);
329 void newsym(int, int);
330 void mnewsym(int, int);
331 void nosee(int, int);
332 void prl1(int, int);
333 void nose1(int, int);
334 int vism_at(int, int);
335 void pobj(struct obj *);
336 void unpobj(struct obj *);
337 void seeobjs(void);
338 void seemons(void);
339 void pmon(struct monst *);
340 void unpmon(struct monst *);
341 void nscr(void);
342 void bot(void);
343 void mstatusline(struct monst *);
344 void cls(void);
345 
346 /* hack.read.c */
347 int doread(void);
348 void litroom(boolean);
349 
350 /* hack.rip.c */
351 void outrip(void);
352 
353 /* hack.rumors.c */
354 void outrumor(void);
355 
356 /* hack.save.c */
357 int dosave(void);
358 int dorecover(int);
359 struct obj *restobjchn(int);
360 struct monst *restmonchn(int);
361 
362 /* hack.search.c */
363 int findit(void);
364 int dosearch(void);
365 int doidtrap(void);
366 void wakeup(struct monst *);
367 void seemimic(struct monst *);
368 
369 /* hack.shk.c */
370 void obfree(struct obj *, struct obj *);
371 void paybill(void);
372 char *shkname(struct monst *);
373 void shkdead(struct monst *);
374 void replshk(struct monst *, struct monst *);
375 int inshop(void);
376 int dopay(void);
377 struct bill_x;
378 void addtobill(struct obj *);
379 void splitbill(struct obj *, struct obj *);
380 void subfrombill(struct obj *);
381 int doinvbill(int);
382 int shkcatch(struct obj *);
383 int shk_move(struct monst *);
384 void shopdig(int);
385 int online(int, int);
386 int follower(struct monst *);
387 
388 /* hack.shknam.c */
389 void findname(char *, int);
390 
391 /* hack.steal.c */
392 long somegold(void);
393 void stealgold(struct monst *);
394 int steal(struct monst *);
395 void mpickobj(struct monst *, struct obj *);
396 int stealamulet(struct monst *);
397 void relobj(struct monst *, int);
398 
399 /* hack.termcap.c */
400 void startup(void);
401 void startscreen(void);
402 void endscreen(void);
403 void curs(int, int);
404 void cl_end(void);
405 void clearscreen(void);
406 void home(void);
407 void standoutbeg(void);
408 void standoutend(void);
409 void backsp(void);
410 void sound_bell(void);
411 void delay_output(void);
412 void cl_eos(void);
413 
414 /* hack.timeout.c */
415 void timeout(void);
416 
417 /* hack.topl.c */
418 int doredotopl(void);
419 void remember_topl(void);
420 void addtopl(const char *);
421 void more(void);
422 void cmore(const char *);
423 void clrlin(void);
424 void pline(const char *, ...) __printflike(1, 2);
425 void vpline(const char *, va_list) __printflike(1, 0);
426 void putsym(int);
427 void putstr(const char *);
428 
429 /* hack.track.c */
430 void initrack(void);
431 void settrack(void);
432 coord *gettrack(int, int);
433 
434 /* hack.trap.c */
435 struct trap *maketrap(int, int, int);
436 void dotrap(struct trap *);
437 int mintrap(struct monst *);
438 void selftouch(const char *);
439 void float_up(void);
440 void float_down(void);
441 void tele(void);
442 int dotele(void);
443 void placebc(int);
444 void unplacebc(void);
445 void level_tele(void);
446 void drown(void);
447 
448 /* hack.tty.c */
449 void gettty(void);
450 void settty(const char *);
451 void setftty(void);
452 void error(const char *, ...) __printflike(1, 2) __dead2;
453 void getlin(char *);
454 void getret(void);
455 void cgetret(const char *);
456 void xwaitforspace(const char *);
457 char *parse(void);
458 char readchar(void);
459 void end_of_input(void) __dead2;
460 
461 /* hack.u_init.c */
462 void u_init(void);
463 struct trobj;
464 void plnamesuffix(void);
465 
466 /* hack.unix.c */
467 void setrandom(void);
468 int getyear(void);
469 char *getdatestr(void);
470 int phase_of_the_moon(void);
471 int night(void);
472 int midnight(void);
473 void gethdate(char *);
474 int uptodate(int);
475 void getlock(void);
476 void getmailstatus(void);
477 void ckmailstatus(void);
478 void newmail(void);
479 void mdrush(struct monst *, boolean);
480 void readmail(void);
481 void regularize(char *);
482 
483 /* hack.vault.c */
484 void setgd(void);
485 int gd_move(void);
486 void gddead(void);
487 void replgd(struct monst *, struct monst *);
488 void invault(void);
489 
490 /* hack.version.c */
491 int doversion(void);
492 
493 /* hack.wield.c */
494 void setuwep(struct obj *);
495 int dowield(void);
496 void corrode_weapon(void);
497 int chwepon(struct obj *, int);
498 
499 /* hack.wizard.c */
500 void amulet(void);
501 int wiz_hit(struct monst *);
502 void inrange(struct monst *);
503 
504 /* hack.worm.c */
505 #ifndef NOWORM
506 int getwn(struct monst *);
507 void initworm(struct monst *);
508 void worm_move(struct monst *);
509 void worm_nomove(struct monst *);
510 void wormdead(struct monst *);
511 void wormhit(struct monst *);
512 void wormsee(unsigned);
513 struct wseg;
514 void pwseg(struct wseg *);
515 void cutworm(struct monst *, xchar, xchar, uchar);
516 #endif
517 
518 /* hack.worn.c */
519 void setworn(struct obj *, long);
520 void setnotworn(struct obj *);
521 
522 /* hack.zap.c */
523 int dozap(void);
524 const char *exclam(int);
525 void hit(const char *, struct monst *, const char *);
526 void miss(const char *, struct monst *);
527 struct monst *bhit(int, int, int, int,
528     void (*)(struct monst *, struct obj *),
529     int (*)(struct obj *, struct obj *),
530     struct obj *);
531 struct monst *boomhit(int, int);
532 void buzz(int, xchar, xchar, int, int);
533 void fracture_rock(struct obj *);
534 
535 /* rnd.c */
536 int rn1(int, int);
537 int rn2(int);
538 int rnd(int);
539 int d(int, int);
540 #endif /* _EXTERN_H_ */
541