1*434d266eSdholland /* $NetBSD: hack.h,v 1.16 2011/08/06 20:18:26 dholland Exp $ */ 23ea4a95cSchristos 302ded532Smycroft /* 41c7f94e5Sjsm * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, 51c7f94e5Sjsm * Amsterdam 61c7f94e5Sjsm * All rights reserved. 71c7f94e5Sjsm * 81c7f94e5Sjsm * Redistribution and use in source and binary forms, with or without 91c7f94e5Sjsm * modification, are permitted provided that the following conditions are 101c7f94e5Sjsm * met: 111c7f94e5Sjsm * 121c7f94e5Sjsm * - Redistributions of source code must retain the above copyright notice, 131c7f94e5Sjsm * this list of conditions and the following disclaimer. 141c7f94e5Sjsm * 151c7f94e5Sjsm * - Redistributions in binary form must reproduce the above copyright 161c7f94e5Sjsm * notice, this list of conditions and the following disclaimer in the 171c7f94e5Sjsm * documentation and/or other materials provided with the distribution. 181c7f94e5Sjsm * 191c7f94e5Sjsm * - Neither the name of the Stichting Centrum voor Wiskunde en 201c7f94e5Sjsm * Informatica, nor the names of its contributors may be used to endorse or 211c7f94e5Sjsm * promote products derived from this software without specific prior 221c7f94e5Sjsm * written permission. 231c7f94e5Sjsm * 241c7f94e5Sjsm * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 251c7f94e5Sjsm * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 261c7f94e5Sjsm * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 271c7f94e5Sjsm * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 281c7f94e5Sjsm * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 291c7f94e5Sjsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 301c7f94e5Sjsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 311c7f94e5Sjsm * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 321c7f94e5Sjsm * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 331c7f94e5Sjsm * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 341c7f94e5Sjsm * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3502ded532Smycroft */ 361c7f94e5Sjsm 371c7f94e5Sjsm /* 381c7f94e5Sjsm * Copyright (c) 1982 Jay Fenlason <hack@gnu.org> 391c7f94e5Sjsm * All rights reserved. 401c7f94e5Sjsm * 411c7f94e5Sjsm * Redistribution and use in source and binary forms, with or without 421c7f94e5Sjsm * modification, are permitted provided that the following conditions 431c7f94e5Sjsm * are met: 441c7f94e5Sjsm * 1. Redistributions of source code must retain the above copyright 451c7f94e5Sjsm * notice, this list of conditions and the following disclaimer. 461c7f94e5Sjsm * 2. Redistributions in binary form must reproduce the above copyright 471c7f94e5Sjsm * notice, this list of conditions and the following disclaimer in the 481c7f94e5Sjsm * documentation and/or other materials provided with the distribution. 491c7f94e5Sjsm * 3. The name of the author may not be used to endorse or promote products 501c7f94e5Sjsm * derived from this software without specific prior written permission. 511c7f94e5Sjsm * 521c7f94e5Sjsm * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 531c7f94e5Sjsm * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 541c7f94e5Sjsm * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 551c7f94e5Sjsm * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 561c7f94e5Sjsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 571c7f94e5Sjsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 581c7f94e5Sjsm * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 591c7f94e5Sjsm * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 601c7f94e5Sjsm * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 611c7f94e5Sjsm * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 621c7f94e5Sjsm */ 631c7f94e5Sjsm 643ea4a95cSchristos #ifndef _HACK_H_ 653ea4a95cSchristos #define _HACK_H_ 6661f28255Scgd 6761f28255Scgd #include "config.h" 6832330650Smatt #include <stdlib.h> 6961f28255Scgd #include <string.h> 701a1e24f1Smrg #include <sys/time.h> 7161f28255Scgd 7261f28255Scgd #define Null(type) ((struct type *) 0) 7361f28255Scgd 7461f28255Scgd #include "def.objclass.h" 7561f28255Scgd 7661f28255Scgd typedef struct { 7761f28255Scgd xchar x,y; 7861f28255Scgd } coord; 7961f28255Scgd 8061f28255Scgd #include "def.monst.h" /* uses coord */ 8161f28255Scgd #include "def.gold.h" 8261f28255Scgd #include "def.trap.h" 8361f28255Scgd #include "def.obj.h" 8461f28255Scgd #include "def.flag.h" 8561f28255Scgd 8661f28255Scgd #define plur(x) (((x) == 1) ? "" : "s") 8761f28255Scgd 8861f28255Scgd #define BUFSZ 256 /* for getlin buffers */ 8961f28255Scgd #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ 9061f28255Scgd 9161f28255Scgd #include "def.rm.h" 9261f28255Scgd #include "def.permonst.h" 9361f28255Scgd 94*434d266eSdholland #define newstring(x) ((char *) alloc(x)) 9561f28255Scgd #include "hack.onames.h" 9661f28255Scgd 9761f28255Scgd #define ON 1 9861f28255Scgd #define OFF 0 9961f28255Scgd 10061f28255Scgd struct prop { 10161f28255Scgd #define TIMEOUT 007777 /* mask */ 10261f28255Scgd #define LEFT_RING W_RINGL /* 010000L */ 10361f28255Scgd #define RIGHT_RING W_RINGR /* 020000L */ 10461f28255Scgd #define INTRINSIC 040000L 10561f28255Scgd #define LEFT_SIDE LEFT_RING 10661f28255Scgd #define RIGHT_SIDE RIGHT_RING 10761f28255Scgd #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) 10861f28255Scgd long p_flgs; 109cb5fd834Sjsm void (*p_tofn)(void); /* called after timeout */ 11061f28255Scgd }; 11161f28255Scgd 11261f28255Scgd struct you { 11361f28255Scgd xchar ux, uy; 11461f28255Scgd schar dx, dy, dz; /* direction of move (or zap or ... ) */ 11561f28255Scgd #ifdef QUEST 11661f28255Scgd schar di; /* direction of FF */ 11761f28255Scgd xchar ux0, uy0; /* initial position FF */ 118d594ce93Scgd #endif /* QUEST */ 11961f28255Scgd xchar udisx, udisy; /* last display pos */ 12061f28255Scgd char usym; /* usually '@' */ 12161f28255Scgd schar uluck; 12261f28255Scgd #define LUCKMAX 10 /* on moonlit nights 11 */ 12361f28255Scgd #define LUCKMIN (-10) 12461f28255Scgd int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */ 12561f28255Scgd /* +: turn right, -: turn left */ 12661f28255Scgd unsigned udispl:1; /* @ on display */ 12761f28255Scgd unsigned ulevel:4; /* 1 - 14 */ 12861f28255Scgd #ifdef QUEST 12961f28255Scgd unsigned uhorizon:7; 130d594ce93Scgd #endif /* QUEST */ 13161f28255Scgd unsigned utrap:3; /* trap timeout */ 13261f28255Scgd unsigned utraptype:1; /* defined if utrap nonzero */ 13361f28255Scgd #define TT_BEARTRAP 0 13461f28255Scgd #define TT_PIT 1 13561f28255Scgd unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */ 13661f28255Scgd 13761f28255Scgd 13861f28255Scgd /* perhaps these #define's should also be generated by makedefs */ 13961f28255Scgd #define TELEPAT LAST_RING /* not a ring */ 14061f28255Scgd #define Telepat u.uprops[TELEPAT].p_flgs 14161f28255Scgd #define FAST (LAST_RING+1) /* not a ring */ 14261f28255Scgd #define Fast u.uprops[FAST].p_flgs 14361f28255Scgd #define CONFUSION (LAST_RING+2) /* not a ring */ 14461f28255Scgd #define Confusion u.uprops[CONFUSION].p_flgs 14561f28255Scgd #define INVIS (LAST_RING+3) /* not a ring */ 14661f28255Scgd #define Invis u.uprops[INVIS].p_flgs 14761f28255Scgd #define Invisible (Invis && !See_invisible) 14861f28255Scgd #define GLIB (LAST_RING+4) /* not a ring */ 14961f28255Scgd #define Glib u.uprops[GLIB].p_flgs 15061f28255Scgd #define PUNISHED (LAST_RING+5) /* not a ring */ 15161f28255Scgd #define Punished u.uprops[PUNISHED].p_flgs 15261f28255Scgd #define SICK (LAST_RING+6) /* not a ring */ 15361f28255Scgd #define Sick u.uprops[SICK].p_flgs 15461f28255Scgd #define BLIND (LAST_RING+7) /* not a ring */ 15561f28255Scgd #define Blind u.uprops[BLIND].p_flgs 15661f28255Scgd #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */ 15761f28255Scgd #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs 15861f28255Scgd #define STONED (LAST_RING+9) /* not a ring */ 15961f28255Scgd #define Stoned u.uprops[STONED].p_flgs 16061f28255Scgd #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ 16161f28255Scgd unsigned umconf:1; 162ab8b6343Sjsm const char *usick_cause; 16361f28255Scgd struct prop uprops[LAST_RING+10]; 16461f28255Scgd 16561f28255Scgd unsigned uswallow:1; /* set if swallowed by a monster */ 16661f28255Scgd unsigned uswldtim:4; /* time you have been swallowed */ 16761f28255Scgd unsigned uhs:3; /* hunger state - see hack.eat.c */ 16861f28255Scgd schar ustr,ustrmax; 16961f28255Scgd schar udaminc; 17061f28255Scgd schar uac; 17161f28255Scgd int uhp,uhpmax; 17261f28255Scgd long int ugold,ugold0,uexp,urexp; 17361f28255Scgd int uhunger; /* refd only in eat.c and shk.c */ 17461f28255Scgd int uinvault; 17561f28255Scgd struct monst *ustuck; 17661f28255Scgd int nr_killed[CMNUM+2]; /* used for experience bookkeeping */ 17761f28255Scgd }; 17861f28255Scgd 17961f28255Scgd #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2))) 18061f28255Scgd 18161f28255Scgd #define PL_CSIZ 20 /* sizeof pl_character */ 18261f28255Scgd #define MAX_CARR_CAP 120 /* so that boulders can be heavier */ 18361f28255Scgd #define MAXLEVEL 40 18461f28255Scgd #define FAR (COLNO+2) /* position outside screen */ 1853ea4a95cSchristos 1863ea4a95cSchristos extern boolean in_mklev; 1873ea4a95cSchristos extern boolean level_exists[]; 1883ea4a95cSchristos extern boolean restoring; 1893ea4a95cSchristos extern char *CD; 190ab8b6343Sjsm extern const char *catmore; 1913ea4a95cSchristos extern char *hname; 192ab8b6343Sjsm extern const char *const hu_stat[]; /* in eat.c */ 193ab8b6343Sjsm extern const char *nomovemsg; 194ab8b6343Sjsm extern const char *occtxt; 195b8c355d7Sdholland extern const char *save_cm; 196ab8b6343Sjsm extern const char *killer; 197ab8b6343Sjsm extern const char *const traps[]; 1983ea4a95cSchristos extern char SAVEF[]; 1993ea4a95cSchristos extern char fut_geno[60]; /* idem */ 2003ea4a95cSchristos extern char genocided[60]; /* defined in Decl.c */ 201165c915bSdholland extern char lock[PL_NSIZ + 4]; 202a7a3b831Sdholland extern const char mlarge[]; 2033ea4a95cSchristos extern char morc; 204a7a3b831Sdholland extern const char nul[]; 2053ea4a95cSchristos extern char plname[PL_NSIZ], pl_character[PL_CSIZ]; 206ab8b6343Sjsm extern const char quitchars[]; 2073ea4a95cSchristos extern char sdir[]; /* defined in hack.c */ 208ab8b6343Sjsm extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */ 209ab8b6343Sjsm extern const char vowels[]; 2103ea4a95cSchristos extern coord bhitpos; /* place where thrown weapon falls to the ground */ 211cb5fd834Sjsm extern int (*afternmv)(void); 212cb5fd834Sjsm extern int (*occupation)(void); 2133ea4a95cSchristos extern int CO, LI; /* usually COLNO and ROWNO+2 */ 2143ea4a95cSchristos extern int bases[]; 2153ea4a95cSchristos extern int doorindex; 2163ea4a95cSchristos extern int hackpid; 2173ea4a95cSchristos extern int multi; 2183ea4a95cSchristos extern int nroom; 2193ea4a95cSchristos extern long moves; 2203ea4a95cSchristos extern long wailmsg; 2213ea4a95cSchristos extern schar xdir[], ydir[]; /* idem */ 2223ea4a95cSchristos extern struct monst *mydogs; 2233ea4a95cSchristos extern struct monst youmonst; 2243ea4a95cSchristos extern struct obj *billobjs; 2253ea4a95cSchristos extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg; 2263ea4a95cSchristos extern struct obj *uleft, *uright, *fcobj; 2273ea4a95cSchristos extern struct obj *uball; /* defined if PUNISHED */ 2283ea4a95cSchristos extern struct obj *uchain; /* defined iff PUNISHED */ 2293ea4a95cSchristos extern struct obj zeroobj; 230ab8b6343Sjsm extern const struct permonst li_dog, dog, la_dog; 231ab8b6343Sjsm extern const struct permonst pm_eel; 232ab8b6343Sjsm extern const struct permonst pm_ghost; 233ab8b6343Sjsm extern const struct permonst pm_mail_daemon; 234ab8b6343Sjsm extern const struct permonst pm_wizard; 2353ea4a95cSchristos #ifndef NOWORM 2363ea4a95cSchristos extern long wgrowtime[32]; 2373ea4a95cSchristos extern struct wseg *m_atseg; 2383ea4a95cSchristos extern struct wseg *wsegs[32], *wheads[32]; 2393ea4a95cSchristos #endif 2403ea4a95cSchristos extern struct you u; 2413ea4a95cSchristos extern xchar curx, cury; /* cursor location on screen */ 2423ea4a95cSchristos extern xchar dlevel, maxdlevel; /* dungeon level */ 2433ea4a95cSchristos extern xchar seehx,seelx,seehy,seely; /* where to see*/ 2443ea4a95cSchristos extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ 2453ea4a95cSchristos #endif /* _HACK_H_ */ 246