132488Sbostic /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 232488Sbostic /* hack.h - version 1.0.3 */ 332488Sbostic 432488Sbostic #include "config.h" 5*42018Sbostic #include <string.h> 632488Sbostic 7*42018Sbostic #ifndef BSD 832488Sbostic #define index strchr 932488Sbostic #define rindex strrchr 1032488Sbostic #endif BSD 1132488Sbostic 1232488Sbostic #define Null(type) ((struct type *) 0) 1332488Sbostic 1432488Sbostic #include "def.objclass.h" 1532488Sbostic 1632488Sbostic typedef struct { 1732488Sbostic xchar x,y; 1832488Sbostic } coord; 1932488Sbostic 2032488Sbostic #include "def.monst.h" /* uses coord */ 2132488Sbostic #include "def.gold.h" 2232488Sbostic #include "def.trap.h" 2332488Sbostic #include "def.obj.h" 2432488Sbostic #include "def.flag.h" 2532488Sbostic 2632488Sbostic #define plur(x) (((x) == 1) ? "" : "s") 2732488Sbostic 2832488Sbostic #define BUFSZ 256 /* for getlin buffers */ 2932488Sbostic #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ 3032488Sbostic 3132488Sbostic #include "def.rm.h" 3232488Sbostic #include "def.permonst.h" 3332488Sbostic 3432488Sbostic extern long *alloc(); 3532488Sbostic 3632488Sbostic extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ 3732488Sbostic 3832488Sbostic extern xchar dlevel; 3932488Sbostic #define newstring(x) (char *) alloc((unsigned)(x)) 4032488Sbostic #include "hack.onames.h" 4132488Sbostic 4232488Sbostic #define ON 1 4332488Sbostic #define OFF 0 4432488Sbostic 4532488Sbostic extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg, 4632488Sbostic *uleft, *uright, *fcobj; 4732488Sbostic extern struct obj *uchain; /* defined iff PUNISHED */ 4832488Sbostic extern struct obj *uball; /* defined if PUNISHED */ 4932488Sbostic struct obj *o_at(), *getobj(), *sobj_at(); 5032488Sbostic 5132488Sbostic struct prop { 5232488Sbostic #define TIMEOUT 007777 /* mask */ 5332488Sbostic #define LEFT_RING W_RINGL /* 010000L */ 5432488Sbostic #define RIGHT_RING W_RINGR /* 020000L */ 5532488Sbostic #define INTRINSIC 040000L 5632488Sbostic #define LEFT_SIDE LEFT_RING 5732488Sbostic #define RIGHT_SIDE RIGHT_RING 5832488Sbostic #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) 5932488Sbostic long p_flgs; 6032488Sbostic int (*p_tofn)(); /* called after timeout */ 6132488Sbostic }; 6232488Sbostic 6332488Sbostic struct you { 6432488Sbostic xchar ux, uy; 6532488Sbostic schar dx, dy, dz; /* direction of move (or zap or ... ) */ 6632488Sbostic #ifdef QUEST 6732488Sbostic schar di; /* direction of FF */ 6832488Sbostic xchar ux0, uy0; /* initial position FF */ 6932488Sbostic #endif QUEST 7032488Sbostic xchar udisx, udisy; /* last display pos */ 7132488Sbostic char usym; /* usually '@' */ 7232488Sbostic schar uluck; 7332488Sbostic #define LUCKMAX 10 /* on moonlit nights 11 */ 7432488Sbostic #define LUCKMIN (-10) 7532488Sbostic int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */ 7632488Sbostic /* +: turn right, -: turn left */ 7732488Sbostic unsigned udispl:1; /* @ on display */ 7832488Sbostic unsigned ulevel:4; /* 1 - 14 */ 7932488Sbostic #ifdef QUEST 8032488Sbostic unsigned uhorizon:7; 8132488Sbostic #endif QUEST 8232488Sbostic unsigned utrap:3; /* trap timeout */ 8332488Sbostic unsigned utraptype:1; /* defined if utrap nonzero */ 8432488Sbostic #define TT_BEARTRAP 0 8532488Sbostic #define TT_PIT 1 8632488Sbostic unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */ 8732488Sbostic 8832488Sbostic 8932488Sbostic /* perhaps these #define's should also be generated by makedefs */ 9032488Sbostic #define TELEPAT LAST_RING /* not a ring */ 9132488Sbostic #define Telepat u.uprops[TELEPAT].p_flgs 9232488Sbostic #define FAST (LAST_RING+1) /* not a ring */ 9332488Sbostic #define Fast u.uprops[FAST].p_flgs 9432488Sbostic #define CONFUSION (LAST_RING+2) /* not a ring */ 9532488Sbostic #define Confusion u.uprops[CONFUSION].p_flgs 9632488Sbostic #define INVIS (LAST_RING+3) /* not a ring */ 9732488Sbostic #define Invis u.uprops[INVIS].p_flgs 9832488Sbostic #define Invisible (Invis && !See_invisible) 9932488Sbostic #define GLIB (LAST_RING+4) /* not a ring */ 10032488Sbostic #define Glib u.uprops[GLIB].p_flgs 10132488Sbostic #define PUNISHED (LAST_RING+5) /* not a ring */ 10232488Sbostic #define Punished u.uprops[PUNISHED].p_flgs 10332488Sbostic #define SICK (LAST_RING+6) /* not a ring */ 10432488Sbostic #define Sick u.uprops[SICK].p_flgs 10532488Sbostic #define BLIND (LAST_RING+7) /* not a ring */ 10632488Sbostic #define Blind u.uprops[BLIND].p_flgs 10732488Sbostic #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */ 10832488Sbostic #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs 10932488Sbostic #define STONED (LAST_RING+9) /* not a ring */ 11032488Sbostic #define Stoned u.uprops[STONED].p_flgs 11132488Sbostic #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ 11232488Sbostic unsigned umconf:1; 11332488Sbostic char *usick_cause; 11432488Sbostic struct prop uprops[LAST_RING+10]; 11532488Sbostic 11632488Sbostic unsigned uswallow:1; /* set if swallowed by a monster */ 11732488Sbostic unsigned uswldtim:4; /* time you have been swallowed */ 11832488Sbostic unsigned uhs:3; /* hunger state - see hack.eat.c */ 11932488Sbostic schar ustr,ustrmax; 12032488Sbostic schar udaminc; 12132488Sbostic schar uac; 12232488Sbostic int uhp,uhpmax; 12332488Sbostic long int ugold,ugold0,uexp,urexp; 12432488Sbostic int uhunger; /* refd only in eat.c and shk.c */ 12532488Sbostic int uinvault; 12632488Sbostic struct monst *ustuck; 12732488Sbostic int nr_killed[CMNUM+2]; /* used for experience bookkeeping */ 12832488Sbostic }; 12932488Sbostic 13032488Sbostic extern struct you u; 13132488Sbostic 13232488Sbostic extern char *traps[]; 13332488Sbostic extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(), 13432488Sbostic *doname(), *aobjnam(); 13532488Sbostic extern char readchar(); 13632488Sbostic extern char vowels[]; 13732488Sbostic 13832488Sbostic extern xchar curx,cury; /* cursor location on screen */ 13932488Sbostic 14032488Sbostic extern coord bhitpos; /* place where thrown weapon falls to the ground */ 14132488Sbostic 14232488Sbostic extern xchar seehx,seelx,seehy,seely; /* where to see*/ 14332488Sbostic extern char *save_cm,*killer; 14432488Sbostic 14532488Sbostic extern xchar dlevel, maxdlevel; /* dungeon level */ 14632488Sbostic 14732488Sbostic extern long moves; 14832488Sbostic 14932488Sbostic extern int multi; 15032488Sbostic 15132488Sbostic 15232488Sbostic extern char lock[]; 15332488Sbostic 15432488Sbostic 15532488Sbostic #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2))) 15632488Sbostic 15732488Sbostic #define PL_CSIZ 20 /* sizeof pl_character */ 15832488Sbostic #define MAX_CARR_CAP 120 /* so that boulders can be heavier */ 15932488Sbostic #define MAXLEVEL 40 16032488Sbostic #define FAR (COLNO+2) /* position outside screen */ 161