Home | History | Annotate | Line # | Download | only in hack
extern.h revision 1.13
      1 /*	$NetBSD: extern.h,v 1.13 2010/02/03 15:34:38 roy 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 
     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) __attribute__((__noreturn__));
    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, char *, unsigned);
    206 void mklev(void);
    207 
    208 /* hack.main.c */
    209 void glo(int);
    210 void askname(void);
    211 void impossible(const char *, ...)
    212     __attribute__((__format__(__printf__, 1, 2)));
    213 void stop_occupation(void);
    214 
    215 /* hack.makemon.c */
    216 struct monst *makemon(const struct permonst *, int, int);
    217 coord enexto(xchar, xchar);
    218 int goodpos(int, int);
    219 void rloc(struct monst *);
    220 struct monst *mkmon_at(int, int, int);
    221 
    222 /* hack.mhitu.c */
    223 int mhitu(struct monst *);
    224 int hitu(struct monst *, int);
    225 
    226 /* hack.mklev.c */
    227 struct mkroom;
    228 void makelevel(void);
    229 void mktrap(int, int, struct mkroom *);
    230 
    231 /* hack.mkmaze.c */
    232 void makemaz(void);
    233 coord mazexy(void);
    234 
    235 /* hack.mkobj.c */
    236 struct obj *mkobj_at(int, int, int);
    237 void mksobj_at(int, int, int);
    238 struct obj *mkobj(int);
    239 struct obj *mksobj(int);
    240 int letter(int);
    241 int weight(struct obj *);
    242 void mkgold(long, int, int);
    243 
    244 /* hack.mkshop.c */
    245 void mkshop(void);
    246 void mkzoo(int);
    247 void mkswamp(void);
    248 
    249 /* hack.mon.c */
    250 void movemon(void);
    251 void justswld(struct monst *, const char *);
    252 void youswld(struct monst *, int, int, const char *);
    253 int dochug(struct monst *);
    254 int m_move(struct monst *, int);
    255 int mfndpos(struct monst *, coord[9 ], int[9 ], int);
    256 int dist(int, int);
    257 void poisoned(const char *, const char *);
    258 void mondead(struct monst *);
    259 void replmon(struct monst *, struct monst *);
    260 void relmon(struct monst *);
    261 void monfree(struct monst *);
    262 void unstuck(struct monst *);
    263 void killed(struct monst *);
    264 void kludge(const char *, const char *);
    265 void rescham(void);
    266 int newcham(struct monst *, const struct permonst *);
    267 void mnexto(struct monst *);
    268 void setmangry(struct monst *);
    269 int canseemon(struct monst *);
    270 
    271 /* hack.monst.c */
    272 
    273 /* hack.o_init.c */
    274 int letindex(int);
    275 void init_objects(void);
    276 int probtype(int);
    277 void oinit(void);
    278 void savenames(int);
    279 void restnames(int);
    280 int dodiscovered(void);
    281 
    282 /* hack.objnam.c */
    283 char *typename(int);
    284 char *xname(struct obj *);
    285 char *doname(struct obj *);
    286 void setan(const char *, char *, size_t);
    287 char *aobjnam(struct obj *, const char *);
    288 char *Doname(struct obj *);
    289 struct obj *readobjnam(char *);
    290 
    291 /* hack.options.c */
    292 void initoptions(void);
    293 int doset(void);
    294 
    295 /* hack.pager.c */
    296 int dowhatis(void);
    297 void set_whole_screen(void);
    298 int readnews(void);
    299 void set_pager(int);
    300 int page_line(const char *);
    301 void cornline(int, const char *);
    302 int dohelp(void);
    303 int dosh(void);
    304 
    305 /* hack.potion.c */
    306 int dodrink(void);
    307 void pluslvl(void);
    308 void strange_feeling(struct obj *, const char *);
    309 void potionhit(struct monst *, struct obj *);
    310 void potionbreathe(struct obj *);
    311 int dodip(void);
    312 
    313 /* hack.pri.c */
    314 void swallowed(void);
    315 void panic(const char *, ...)
    316     __attribute__((__format__(__printf__, 1, 2)));
    317 void atl(int, int, int);
    318 void on_scr(int, int);
    319 void tmp_at(schar, schar);
    320 void Tmp_at(schar, schar);
    321 void setclipped(void) __attribute__((__noreturn__));
    322 void at(xchar, xchar, int);
    323 void prme(void);
    324 int doredraw(void);
    325 void docrt(void);
    326 void docorner(int, int);
    327 void curs_on_u(void);
    328 void pru(void);
    329 void prl(int, int);
    330 char news0(xchar, xchar);
    331 void newsym(int, int);
    332 void mnewsym(int, int);
    333 void nosee(int, int);
    334 void prl1(int, int);
    335 void nose1(int, int);
    336 int vism_at(int, int);
    337 void pobj(struct obj *);
    338 void unpobj(struct obj *);
    339 void seeobjs(void);
    340 void seemons(void);
    341 void pmon(struct monst *);
    342 void unpmon(struct monst *);
    343 void nscr(void);
    344 void bot(void);
    345 void mstatusline(struct monst *);
    346 void cls(void);
    347 
    348 /* hack.read.c */
    349 int doread(void);
    350 void litroom(boolean);
    351 
    352 /* hack.rip.c */
    353 void outrip(void);
    354 
    355 /* hack.rumors.c */
    356 void outrumor(void);
    357 
    358 /* hack.save.c */
    359 int dosave(void);
    360 int dorecover(int);
    361 struct obj *restobjchn(int);
    362 struct monst *restmonchn(int);
    363 
    364 /* hack.search.c */
    365 int findit(void);
    366 int dosearch(void);
    367 int doidtrap(void);
    368 void wakeup(struct monst *);
    369 void seemimic(struct monst *);
    370 
    371 /* hack.shk.c */
    372 void obfree(struct obj *, struct obj *);
    373 void paybill(void);
    374 char *shkname(struct monst *);
    375 void shkdead(struct monst *);
    376 void replshk(struct monst *, struct monst *);
    377 int inshop(void);
    378 int dopay(void);
    379 struct bill_x;
    380 void addtobill(struct obj *);
    381 void splitbill(struct obj *, struct obj *);
    382 void subfrombill(struct obj *);
    383 int doinvbill(int);
    384 int shkcatch(struct obj *);
    385 int shk_move(struct monst *);
    386 void shopdig(int);
    387 int online(int, int);
    388 int follower(struct monst *);
    389 
    390 /* hack.shknam.c */
    391 void findname(char *, int);
    392 
    393 /* hack.steal.c */
    394 long somegold(void);
    395 void stealgold(struct monst *);
    396 int steal(struct monst *);
    397 void mpickobj(struct monst *, struct obj *);
    398 int stealamulet(struct monst *);
    399 void relobj(struct monst *, int);
    400 
    401 /* hack.termcap.c */
    402 void startup(void);
    403 void startscreen(void);
    404 void endscreen(void);
    405 void curs(int, int);
    406 void cl_end(void);
    407 void clearscreen(void);
    408 void home(void);
    409 void standoutbeg(void);
    410 void standoutend(void);
    411 void backsp(void);
    412 void sound_bell(void);
    413 void delay_output(void);
    414 void cl_eos(void);
    415 
    416 /* hack.timeout.c */
    417 void timeout(void);
    418 
    419 /* hack.topl.c */
    420 int doredotopl(void);
    421 void remember_topl(void);
    422 void addtopl(const char *);
    423 void more(void);
    424 void cmore(const char *);
    425 void clrlin(void);
    426 void pline(const char *, ...)
    427     __attribute__((__format__(__printf__, 1, 2)));
    428 void vpline(const char *, va_list)
    429     __attribute__((__format__(__printf__, 1, 0)));
    430 void putsym(int);
    431 void putstr(const char *);
    432 
    433 /* hack.track.c */
    434 void initrack(void);
    435 void settrack(void);
    436 coord *gettrack(int, int);
    437 
    438 /* hack.trap.c */
    439 struct trap *maketrap(int, int, int);
    440 void dotrap(struct trap *);
    441 int mintrap(struct monst *);
    442 void selftouch(const char *);
    443 void float_up(void);
    444 void float_down(void);
    445 void tele(void);
    446 int dotele(void);
    447 void placebc(int);
    448 void unplacebc(void);
    449 void level_tele(void);
    450 void drown(void);
    451 
    452 /* hack.tty.c */
    453 void gettty(void);
    454 void settty(const char *);
    455 void setftty(void);
    456 void error(const char *, ...)
    457     __attribute__((__format__(__printf__, 1, 2),__noreturn__));
    458 void getlin(char *);
    459 void getret(void);
    460 void cgetret(const char *);
    461 void xwaitforspace(const char *);
    462 char *parse(void);
    463 char readchar(void);
    464 void end_of_input(void) __attribute__((__noreturn__));
    465 
    466 /* hack.u_init.c */
    467 void u_init(void);
    468 struct trobj;
    469 void plnamesuffix(void);
    470 
    471 /* hack.unix.c */
    472 void setrandom(void);
    473 int getyear(void);
    474 char *getdatestr(void);
    475 int phase_of_the_moon(void);
    476 int night(void);
    477 int midnight(void);
    478 void gethdate(char *);
    479 int uptodate(int);
    480 void getlock(void);
    481 void getmailstatus(void);
    482 void ckmailstatus(void);
    483 void newmail(void);
    484 void mdrush(struct monst *, boolean);
    485 void readmail(void);
    486 void regularize(char *);
    487 
    488 /* hack.vault.c */
    489 void setgd(void);
    490 int gd_move(void);
    491 void gddead(void);
    492 void replgd(struct monst *, struct monst *);
    493 void invault(void);
    494 
    495 /* hack.version.c */
    496 int doversion(void);
    497 
    498 /* hack.wield.c */
    499 void setuwep(struct obj *);
    500 int dowield(void);
    501 void corrode_weapon(void);
    502 int chwepon(struct obj *, int);
    503 
    504 /* hack.wizard.c */
    505 void amulet(void);
    506 int wiz_hit(struct monst *);
    507 void inrange(struct monst *);
    508 
    509 /* hack.worm.c */
    510 #ifndef NOWORM
    511 int getwn(struct monst *);
    512 void initworm(struct monst *);
    513 void worm_move(struct monst *);
    514 void worm_nomove(struct monst *);
    515 void wormdead(struct monst *);
    516 void wormhit(struct monst *);
    517 void wormsee(unsigned);
    518 struct wseg;
    519 void pwseg(struct wseg *);
    520 void cutworm(struct monst *, xchar, xchar, uchar);
    521 #endif
    522 
    523 /* hack.worn.c */
    524 void setworn(struct obj *, long);
    525 void setnotworn(struct obj *);
    526 
    527 /* hack.zap.c */
    528 int dozap(void);
    529 const char *exclam(int);
    530 void hit(const char *, struct monst *, const char *);
    531 void miss(const char *, struct monst *);
    532 struct monst *bhit(int, int, int, int,
    533     void (*)(struct monst *, struct obj *),
    534     int (*)(struct obj *, struct obj *),
    535     struct obj *);
    536 struct monst *boomhit(int, int);
    537 void buzz(int, xchar, xchar, int, int);
    538 void fracture_rock(struct obj *);
    539 
    540 /* rnd.c */
    541 int rn1(int, int);
    542 int rn2(int);
    543 int rnd(int);
    544 int d(int, int);
    545 #endif /* _EXTERN_H_ */
    546