home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / HACKSRC.ZIP / HACK.H < prev    next >
C/C++ Source or Header  |  1985-10-16  |  5KB  |  165 lines

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