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