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