1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 2 /* hack.h - version 1.0.3 */ 3 /* $DragonFly: src/games/hack/hack.h,v 1.3 2005/05/22 03:37:05 y0netan1 Exp $ */ 4 5 #include "config.h" 6 #include <string.h> 7 8 #ifndef BSD 9 #define index strchr 10 #define rindex strrchr 11 #endif /* BSD */ 12 13 #define Null(type) ((struct type *) 0) 14 15 #include "def.objclass.h" 16 17 typedef struct { 18 xchar x,y; 19 } coord; 20 21 #include "def.monst.h" /* uses coord */ 22 #include "def.gold.h" 23 #include "def.trap.h" 24 #include "def.obj.h" 25 #include "def.flag.h" 26 27 #define plur(x) (((x) == 1) ? "" : "s") 28 29 #define BUFSZ 256 /* for getlin buffers */ 30 #define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ 31 32 #include "def.rm.h" 33 #include "def.permonst.h" 34 35 extern long *alloc(); 36 37 extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ 38 39 extern xchar dlevel; 40 #define newstring(x) (char *) alloc((unsigned)(x)) 41 #include "hack.onames.h" 42 43 #define ON 1 44 #define OFF 0 45 46 extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg, 47 *uleft, *uright, *fcobj; 48 extern struct obj *uchain; /* defined iff PUNISHED */ 49 extern struct obj *uball; /* defined if PUNISHED */ 50 struct obj *o_at(), *getobj(), *sobj_at(); 51 52 struct prop { 53 #define TIMEOUT 007777 /* mask */ 54 #define LEFT_RING W_RINGL /* 010000L */ 55 #define RIGHT_RING W_RINGR /* 020000L */ 56 #define INTRINSIC 040000L 57 #define LEFT_SIDE LEFT_RING 58 #define RIGHT_SIDE RIGHT_RING 59 #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) 60 long p_flgs; 61 int (*p_tofn)(); /* called after timeout */ 62 }; 63 64 struct you { 65 xchar ux, uy; 66 schar dx, dy, dz; /* direction of move (or zap or ... ) */ 67 #ifdef QUEST 68 schar di; /* direction of FF */ 69 xchar ux0, uy0; /* initial position FF */ 70 #endif /* QUEST */ 71 xchar udisx, udisy; /* last display pos */ 72 char usym; /* usually '@' */ 73 schar uluck; 74 #define LUCKMAX 10 /* on moonlit nights 11 */ 75 #define LUCKMIN (-10) 76 int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */ 77 /* +: turn right, -: turn left */ 78 unsigned udispl:1; /* @ on display */ 79 unsigned ulevel:4; /* 1 - 14 */ 80 #ifdef QUEST 81 unsigned uhorizon:7; 82 #endif /* QUEST */ 83 unsigned utrap:3; /* trap timeout */ 84 unsigned utraptype:1; /* defined if utrap nonzero */ 85 #define TT_BEARTRAP 0 86 #define TT_PIT 1 87 unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */ 88 89 90 /* perhaps these #define's should also be generated by makedefs */ 91 #define TELEPAT LAST_RING /* not a ring */ 92 #define Telepat u.uprops[TELEPAT].p_flgs 93 #define FAST (LAST_RING+1) /* not a ring */ 94 #define Fast u.uprops[FAST].p_flgs 95 #define CONFUSION (LAST_RING+2) /* not a ring */ 96 #define Confusion u.uprops[CONFUSION].p_flgs 97 #define INVIS (LAST_RING+3) /* not a ring */ 98 #define Invis u.uprops[INVIS].p_flgs 99 #define Invisible (Invis && !See_invisible) 100 #define GLIB (LAST_RING+4) /* not a ring */ 101 #define Glib u.uprops[GLIB].p_flgs 102 #define PUNISHED (LAST_RING+5) /* not a ring */ 103 #define Punished u.uprops[PUNISHED].p_flgs 104 #define SICK (LAST_RING+6) /* not a ring */ 105 #define Sick u.uprops[SICK].p_flgs 106 #define BLIND (LAST_RING+7) /* not a ring */ 107 #define Blind u.uprops[BLIND].p_flgs 108 #define WOUNDED_LEGS (LAST_RING+8) /* not a ring */ 109 #define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs 110 #define STONED (LAST_RING+9) /* not a ring */ 111 #define Stoned u.uprops[STONED].p_flgs 112 #define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ 113 unsigned umconf:1; 114 const char *usick_cause; 115 struct prop uprops[LAST_RING+10]; 116 117 unsigned uswallow:1; /* set if swallowed by a monster */ 118 unsigned uswldtim:4; /* time you have been swallowed */ 119 unsigned uhs:3; /* hunger state - see hack.eat.c */ 120 schar ustr,ustrmax; 121 schar udaminc; 122 schar uac; 123 int uhp,uhpmax; 124 long int ugold,ugold0,uexp,urexp; 125 int uhunger; /* refd only in eat.c and shk.c */ 126 int uinvault; 127 struct monst *ustuck; 128 int nr_killed[CMNUM+2]; /* used for experience bookkeeping */ 129 }; 130 131 extern struct you u; 132 133 extern const char *traps[]; 134 extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(), 135 *doname(), *aobjnam(); 136 extern char readchar(); 137 extern char vowels[]; 138 139 extern xchar curx,cury; /* cursor location on screen */ 140 141 extern coord bhitpos; /* place where thrown weapon falls to the ground */ 142 143 extern xchar seehx,seelx,seehy,seely; /* where to see*/ 144 extern const char *save_cm, *killer, *nomovemsg; 145 146 extern xchar dlevel, maxdlevel; /* dungeon level */ 147 148 extern long moves; 149 150 extern int multi; 151 152 153 extern char lock[]; 154 155 extern const char *occtxt; 156 extern const char *hu_stat[]; 157 158 const char *exclam(int); 159 void gethdate(const char *); 160 void done(const char *); 161 162 #define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2))) 163 164 #define PL_CSIZ 20 /* sizeof pl_character */ 165 #define MAX_CARR_CAP 120 /* so that boulders can be heavier */ 166 #define MAXLEVEL 40 167 #define FAR (COLNO+2) /* position outside screen */ 168