home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / NetHack 3.1.3 / source / include / objclass.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-01  |  5.0 KB  |  162 lines  |  [TEXT/R*ch]

  1. /*    SCCS Id: @(#)objclass.h    3.1    92/10/18    */
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #ifndef OBJCLASS_H
  6. #define OBJCLASS_H
  7.  
  8. /* definition of a class of objects */
  9.  
  10. struct objclass {
  11.     short    oc_name_idx;        /* index of actual name */
  12.     short    oc_descr_idx;        /* description when name unknown */
  13.     char *    oc_uname;        /* called by user */
  14.     Bitfield(oc_name_known,1);
  15.     Bitfield(oc_merge,1);    /* merge otherwise equal objects */
  16.     Bitfield(oc_uses_known,1); /* obj->known affects full decription */
  17.                 /* otherwise, obj->dknown and obj->bknown */
  18.                 /* tell all, and obj->known should always */
  19.                 /* be set for proper merging behavior */
  20.     Bitfield(oc_magic,1);    /* inherently magical object */
  21.     Bitfield(oc_charged,1);    /* may have +n or (n) charges */
  22.     Bitfield(oc_unique,1);    /* special one-of-a-kind object */
  23.     Bitfield(oc_nowish,1);    /* cannot wish for this object */
  24.     Bitfield(oc_big,1);
  25. #define oc_bimanual    oc_big    /* for weapons */
  26. #define oc_bulky    oc_big    /* for armor */
  27.  
  28.     Bitfield(oc_dir,2);
  29. #define    NODIR        1
  30. #define    IMMEDIATE    2
  31. #define    RAY        3
  32.  
  33.     Bitfield(oc_material,5);
  34. #define LIQUID        1    /* currently only for venom */
  35. #define WAX        2
  36. #define VEGGY        3    /* foodstuffs */
  37. #define FLESH        4    /*   ditto    */
  38. #define PAPER        5
  39. #define CLOTH        6
  40. #define LEATHER        7
  41. #define WOOD        8
  42. #define BONE        9
  43. #define DRAGON_HIDE    10    /* not leather! */
  44. #define IRON        11    /* Fe - includes steel */
  45. #define METAL        12    /* Sn, &c. */
  46. #define COPPER        13    /* Cu - includes brass */
  47. #define SILVER        14    /* Ag */
  48. #define GOLD        15    /* Au */
  49. #define PLATINUM    16    /* Pt */
  50. #define MITHRIL        17
  51. #define PLASTIC        18
  52. #define GLASS        19
  53. #define GEMSTONE    20
  54. #define MINERAL        21
  55.  
  56. #define is_organic(otmp)    (objects[otmp->otyp].oc_material <= WOOD)
  57. #define is_metallic(otmp)    (objects[otmp->otyp].oc_material >= IRON && \
  58.                  objects[otmp->otyp].oc_material <= PLATINUM)
  59. #define is_corrodeable(otmp)    (objects[otmp->otyp].oc_material == COPPER)
  60. #define is_rustprone(otmp)    (objects[otmp->otyp].oc_material == IRON)
  61.  
  62.     uchar    oc_oprop;        /* property (invis, &c.) conveyed */
  63.     char    oc_class;        /* object class */
  64.     schar    oc_delay;        /* delay when using such an object */
  65. #ifdef TEXTCOLOR
  66.     uchar    oc_color;        /* display color of the object */
  67. #endif /* TEXTCOLOR */
  68.     short    oc_prob;        /* probability, used in mkobj() */
  69.     unsigned short    oc_weight;    /* encumbrance (1 cn = 0.1 lb.) */
  70.     short    oc_cost;        /* base cost in shops */
  71. /* Check the AD&D rules!  The FIRST is small monster damage. */
  72. /* for weapons, and tools, rocks, and gems useful as weapons */
  73.     schar    oc_wsdam, oc_wldam;    /* max small/large monster damage */
  74.     schar    oc_oc1, oc_oc2;
  75. #define    oc_hitbon    oc_oc1        /* weapons: "to hit" bonus */
  76. #define w_propellor    oc_oc2        /* weapons: negative value = bow */
  77. #define WP_BOW        1
  78. #define WP_SLING    2
  79. #define WP_CROSSBOW    3
  80.  
  81. #define    a_ac        oc_oc1    /* armor class, used in ARM_BONUS in do.c */
  82. #define    a_can        oc_oc2        /* armor: used in mhitu.c */
  83. #define oc_level    oc_oc2        /* books: spell level */
  84.  
  85.     unsigned short    oc_nutrition;    /* food value */
  86. };
  87.  
  88. struct objdescr {
  89.     const char *oc_name;        /* actual name */
  90.     const char *oc_descr;        /* description when name unknown */
  91. };
  92.  
  93. extern NEARDATA struct objclass objects[];
  94. extern NEARDATA struct objdescr obj_descr[];
  95.  
  96. /*
  97.  * All objects have a class. Make sure that all classes have a corresponding
  98.  * symbol below.
  99.  */
  100. #define    RANDOM_CLASS     0    /* used for generating random objects */
  101. #define    ILLOBJ_CLASS     1
  102. #define    WEAPON_CLASS     2
  103. #define    ARMOR_CLASS     3
  104. #define    RING_CLASS     4
  105. #define    AMULET_CLASS     5
  106. #define    TOOL_CLASS     6
  107. #define    FOOD_CLASS     7
  108. #define    POTION_CLASS     8
  109. #define    SCROLL_CLASS     9
  110. #define    SPBOOK_CLASS    10    /* actually SPELL-book */
  111. #define    WAND_CLASS    11
  112. #define    GOLD_CLASS    12
  113. #define    GEM_CLASS    13
  114. #define    ROCK_CLASS    14
  115. #define    BALL_CLASS    15
  116. #define    CHAIN_CLASS    16
  117. #define    VENOM_CLASS    17
  118. #define MAXOCLASSES     18
  119.  
  120. #define ALLOW_COUNT    (MAXOCLASSES+1)    /* Can be used in the object class */
  121. #define ALL_CLASSES    (MAXOCLASSES+2)    /* input to getobj().           */
  122. #define ALLOW_NONE    (MAXOCLASSES+3)    /*                   */
  123.  
  124. #if 0    /* moved to decl.h so that makedefs.c won't see them */
  125. extern const char def_oc_syms[MAXOCLASSES];    /* default class symbols */
  126. extern uchar oc_syms[MAXOCLASSES];        /* current class symbols */
  127. #endif
  128.  
  129. /* Default definitions of all object-symbols (must match classes above). */
  130.  
  131. #define    ILLOBJ_SYM    ']'    /* should be same as S_MIMIC_DEF      */
  132. #define    WEAPON_SYM    ')'
  133. #define    ARMOR_SYM    '['
  134. #define    RING_SYM    '='
  135. #define    AMULET_SYM    '"'
  136. #define    TOOL_SYM    '('
  137. #define    FOOD_SYM    '%'
  138. #define    POTION_SYM    '!'
  139. #define    SCROLL_SYM    '?'
  140. #define    SPBOOK_SYM    '+'
  141. #define    WAND_SYM    '/'
  142. #define    GOLD_SYM    '$'
  143. #define    GEM_SYM        '*'
  144. #define    ROCK_SYM    '`'
  145. #define    BALL_SYM    '0'
  146. #define    CHAIN_SYM    '_'
  147. #define    VENOM_SYM    '.'
  148.  
  149. #ifdef TUTTI_FRUTTI
  150. struct fruit {
  151.     char fname[PL_FSIZ];
  152.     int fid;
  153.     struct fruit *nextf;
  154. };
  155. #define newfruit() (struct fruit *)alloc(sizeof(struct fruit))
  156. #define dealloc_fruit(rind) free((genericptr_t) (rind))
  157. #endif
  158.  
  159. #define OBJ_NAME(obj)  (obj_descr[(obj).oc_name_idx].oc_name)
  160. #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
  161. #endif /* OBJCLASS_H */
  162.