PageRenderTime 48ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/src/object.h

https://github.com/NickMcConnell/Beleriand
C Header | 269 lines | 210 code | 30 blank | 29 comment | 0 complexity | 65b2439eefbd783b7f695d13cd5c240a MD5 | raw file
  1. #ifndef INCLUDED_OBJECT_H
  2. #define INCLUDED_OBJECT_H
  3. #include "angband.h"
  4. #include "z-textblock.h"
  5. /** Maximum number of scroll titles generated */
  6. #define MAX_TITLES 60
  7. /* Power calculation */
  8. #define INHIBIT_POWER 20000
  9. struct player;
  10. /*** Constants ***/
  11. /*** Object origin kinds ***/
  12. enum
  13. {
  14. ORIGIN_NONE = 0,
  15. ORIGIN_MIXED, /* stack with mixed origins */
  16. ORIGIN_BIRTH, /* objects created at character birth */
  17. ORIGIN_STORE, /* something you bought */
  18. ORIGIN_FLOOR, /* found on the dungeon floor */
  19. ORIGIN_DROP, /* normal monster drops */
  20. ORIGIN_DROP_UNKNOWN, /* drops from unseen foes */
  21. ORIGIN_ACQUIRE, /* called forth by scroll */
  22. ORIGIN_CHEAT, /* created by wizard mode */
  23. ORIGIN_CHEST, /* found in a chest */
  24. ORIGIN_RUBBLE, /* found under rubble */
  25. ORIGIN_VAULT, /* on the floor of a vault */
  26. ORIGIN_CHAOS /* created chaotically */
  27. };
  28. /**
  29. * Modes for object_desc().
  30. */
  31. typedef enum
  32. {
  33. ODESC_BASE = 0x00, /*!< Only describe the base name */
  34. ODESC_COMBAT = 0x01, /*!< Also show combat bonuses */
  35. ODESC_EXTRA = 0x02, /*!< Show charges/inscriptions/pvals */
  36. ODESC_FULL = ODESC_COMBAT | ODESC_EXTRA,
  37. /*!< Show entire description */
  38. ODESC_PLURAL = 0x08, /*!< Always pluralise */
  39. ODESC_SINGULAR = 0x10, /*!< Always singular */
  40. ODESC_SPOIL = 0x20, /*!< Display regardless of player knowledge */
  41. ODESC_PREFIX = 0x40, /* */
  42. ODESC_CAPITAL = 0x80 /*!< Capitalise object name */
  43. } odesc_detail_t;
  44. /**
  45. * Modes for item lists in "show_inven()" "show_equip()" and "show_floor()"
  46. */
  47. typedef enum
  48. {
  49. OLIST_NONE = 0x00, /* No options */
  50. OLIST_WINDOW = 0x01, /* Display list in a sub-term (left-align) */
  51. OLIST_QUIVER = 0x02, /* Display quiver lines */
  52. OLIST_GOLD = 0x04, /* Include gold in the list */
  53. OLIST_WEIGHT = 0x08, /* Show item weight */
  54. OLIST_PRICE = 0x10, /* Show item price */
  55. OLIST_FAIL = 0x20 /* Show device failure */
  56. } olist_detail_t;
  57. /**
  58. * Modes for object_info()
  59. */
  60. typedef enum
  61. {
  62. OINFO_NONE = 0x00, /* No options */
  63. OINFO_TERSE = 0x01, /* Keep descriptions brief, e.g. for dumps */
  64. OINFO_SUBJ = 0x02, /* Describe object from the character's POV */
  65. OINFO_FULL = 0x04, /* Treat object as if fully IDd */
  66. OINFO_DUMMY = 0x08, /* Object does not exist (e.g. knowledge menu) */
  67. OINFO_EGO = 0x10, /* Describe ego random powers */
  68. } oinfo_detail_t;
  69. /**
  70. * Modes for stacking by object_similar()
  71. */
  72. typedef enum
  73. {
  74. OSTACK_NONE = 0x00, /* No options (this does NOT mean no stacking) */
  75. OSTACK_STORE = 0x01, /* Store stacking */
  76. OSTACK_PACK = 0x02, /* Inventory and home */
  77. OSTACK_LIST = 0x04, /* Object list */
  78. OSTACK_MONSTER = 0x08, /* Monster carrying objects */
  79. OSTACK_FLOOR = 0x10, /* Floor stacking */
  80. OSTACK_QUIVER = 0x20 /* Quiver */
  81. } object_stack_t;
  82. /**
  83. * Pseudo-ID markers.
  84. */
  85. typedef enum
  86. {
  87. INSCRIP_NULL = 0, /*!< No pseudo-ID status */
  88. INSCRIP_STRANGE = 1, /*!< Item that has mixed combat bonuses */
  89. INSCRIP_AVERAGE = 2, /*!< Item with no interesting features */
  90. INSCRIP_MAGICAL = 3, /*!< Item with combat bonuses */
  91. INSCRIP_SPLENDID = 4, /*!< Obviously good item */
  92. INSCRIP_EXCELLENT = 5, /*!< Ego-item */
  93. INSCRIP_SPECIAL = 6, /*!< Artifact */
  94. INSCRIP_UNKNOWN = 7,
  95. INSCRIP_MAX /*!< Maximum number of pseudo-ID markers */
  96. } obj_pseudo_t;
  97. /*** Functions ***/
  98. /* identify.c */
  99. bool item_dubious(const object_type *o_ptr, bool unknown);
  100. int value_check_aux1(object_type *o_ptr);
  101. /* SJGU */
  102. int value_check_aux2(object_type *o_ptr);
  103. bool has_ego_properties(const object_type *o_ptr);
  104. void notice_curse(int curse_flag, int item);
  105. void notice_obj(int obj_flag, int item);
  106. void notice_other(int other_flag, int item);
  107. void object_known(object_type *o_ptr);
  108. void object_aware(object_type *o_ptr);
  109. void object_tried(object_type *o_ptr);
  110. /* jewel.c */
  111. bool design_ring_or_amulet(object_type *o_ptr, int lev);
  112. /* obj-desc.c */
  113. void object_kind_name(char *buf, size_t max, int k_idx, bool easy_know);
  114. size_t object_desc(char *buf, size_t max, const object_type *o_ptr, odesc_detail_t mode);
  115. /* obj-info.c */
  116. textblock *object_info(const object_type *o_ptr, oinfo_detail_t mode);
  117. textblock *object_info_ego(struct ego_item *ego);
  118. void object_info_spoil(ang_file *f, const object_type *o_ptr, int wrap);
  119. void object_info_chardump(const object_type *o_ptr, char_attr_line **line,
  120. int *current_line, int indent, int wrap);
  121. /* obj-make.c */
  122. s16b get_obj_num(int level);
  123. void object_prep(object_type *o_ptr, int k_idx, aspect rand_aspect);
  124. void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great);
  125. bool make_object(object_type *j_ptr, bool good, bool great, bool exact_kind);
  126. bool make_gold(object_type *j_ptr);
  127. void place_object(int y, int x, bool good, bool great, bool exact_kind, byte origin);
  128. void place_gold(int y, int x);
  129. /* obj-util.c */
  130. object_kind *objkind_get(int tval, int sval);
  131. void flavor_init(void);
  132. byte proc_list_color_hack(object_type *o_ptr);
  133. void reset_visuals(bool prefs);
  134. char index_to_label(int i);
  135. s16b label_to_inven(int c);
  136. s16b label_to_equip(int c);
  137. bool wearable_p(const object_type *o_ptr);
  138. s16b wield_slot_ammo(const object_type *o_ptr);
  139. s16b wield_slot(const object_type *o_ptr);
  140. bool slot_can_wield_item(int slot, const object_type *o_ptr);
  141. const char *mention_use(int slot);
  142. const char *describe_use(int i);
  143. bool item_tester_okay(const object_type *o_ptr);
  144. int scan_floor(int *items, int max_size, int y, int x, int mode);
  145. void excise_object_idx(int o_idx);
  146. void delete_object_idx(int o_idx);
  147. void delete_object(int y, int x);
  148. void compact_objects(int size);
  149. void wipe_o_list(void);
  150. s16b o_pop(void);
  151. object_type *get_first_object(int y, int x);
  152. object_type *get_next_object(const object_type *o_ptr);
  153. s32b object_value(const object_type *o_ptr);
  154. bool object_similar(const object_type *o_ptr, const object_type *j_ptr, object_stack_t mode);
  155. void object_absorb(object_type *o_ptr, const object_type *j_ptr);
  156. void object_wipe(object_type *o_ptr);
  157. void object_copy(object_type *o_ptr, const object_type *j_ptr);
  158. void object_copy_amt(object_type *o_ptr, object_type *j_ptr, int amt);
  159. s16b floor_carry(int y, int x, object_type *j_ptr);
  160. void drop_near(object_type *j_ptr, int chance, int y, int x, bool verbose);
  161. void acquirement(int y1, int x1, int num, bool great);
  162. void inven_item_charges(int item);
  163. void inven_item_describe(int item);
  164. void inven_item_increase(int item, int num);
  165. void save_quiver_size(struct player *p);
  166. void inven_item_optimize(int item);
  167. void floor_item_charges(int item);
  168. void floor_item_describe(int item);
  169. void floor_item_increase(int item, int num);
  170. void floor_item_optimize(int item);
  171. bool inven_carry_okay(const object_type *o_ptr);
  172. s16b inven_carry(struct player *p, struct object *o);
  173. bool inven_stack_okay(const object_type *o_ptr);
  174. s16b inven_takeoff(int item, int amt);
  175. void inven_drop(int item, int amt);
  176. void combine_pack(void);
  177. void reorder_pack(void);
  178. void open_quiver_slot(int slot);
  179. void sort_quiver(void);
  180. int get_use_device_chance(const object_type *o_ptr);
  181. void distribute_charges(object_type *o_ptr, object_type *q_ptr, int amt);
  182. void reduce_charges(object_type *o_ptr, int amt);
  183. int number_charging(const object_type *o_ptr);
  184. bool recharge_timeout(object_type *o_ptr);
  185. unsigned check_for_inscrip(const object_type *o_ptr, const char *inscrip);
  186. int lookup_kind(int tval, int sval);
  187. bool lookup_reverse(s16b k_idx, int *tval, int *sval);
  188. int lookup_name(int tval, const char *name);
  189. int lookup_artifact_name(const char *name);
  190. int lookup_sval(int tval, const char *name);
  191. int tval_find_idx(const char *name);
  192. const char *tval_find_name(int tval);
  193. artifact_type *artifact_of(const object_type *o_ptr);
  194. object_kind *object_kind_of(const object_type *o_ptr);
  195. bool obj_is_staff(const object_type *o_ptr);
  196. bool obj_is_wand(const object_type *o_ptr);
  197. bool obj_is_rod(const object_type *o_ptr);
  198. bool obj_is_potion(const object_type *o_ptr);
  199. bool obj_is_scroll(const object_type *o_ptr);
  200. bool obj_is_food(const object_type *o_ptr);
  201. bool obj_is_light(const object_type *o_ptr);
  202. bool obj_is_ring(const object_type *o_ptr);
  203. bool obj_is_ammo(const object_type *o_ptr);
  204. bool obj_is_quiver_obj(const object_type * o_ptr);
  205. bool obj_has_charges(const object_type *o_ptr);
  206. bool obj_can_zap(const object_type *o_ptr);
  207. bool obj_is_activatable(const object_type *o_ptr);
  208. bool obj_can_activate(const object_type *o_ptr);
  209. bool obj_can_refill(const object_type *o_ptr);
  210. bool obj_can_browse(const object_type *o_ptr);
  211. bool obj_can_cast_from(const object_type *o_ptr);
  212. bool obj_can_study(const object_type *o_ptr);
  213. bool obj_can_takeoff(const object_type *o_ptr);
  214. bool obj_think_can_takeoff(const object_type *o_ptr);
  215. bool obj_can_wear(const object_type *o_ptr);
  216. bool obj_can_fire(const object_type *o_ptr);
  217. bool obj_can_throw(const object_type *o_ptr);
  218. bool obj_has_inscrip(const object_type *o_ptr);
  219. u16b object_effect(const object_type *o_ptr);
  220. object_type *object_from_item_idx(int item);
  221. bool obj_needs_aim(object_type *o_ptr);
  222. bool get_item_okay(int item);
  223. int scan_items(int *item_list, size_t item_list_max, int mode);
  224. bool item_is_available(int item, bool (*tester)(const object_type *), int mode);
  225. void display_itemlist(void);
  226. void display_object_idx_recall(s16b o_idx);
  227. void display_object_kind_recall(s16b k_idx);
  228. bool check_set(byte s_idx);
  229. void apply_set(int s_idx);
  230. void remove_set(int s_idx);
  231. bool pack_is_full(void);
  232. void pack_overflow(void);
  233. /* obj-ui.c */
  234. void show_inven(olist_detail_t mode);
  235. void show_equip(olist_detail_t mode);
  236. void show_floor(const int *floor_list, int floor_num, olist_detail_t mode);
  237. bool verify_item(const char *prompt, int item);
  238. bool get_item(int *cp, const char *pmt, const char *str, cmd_code cmd, int mode);
  239. #endif /* !INCLUDED_OBJECT_H */