1 /**
2  * \file player-calcs.h
3  * \brief Player temporary status structures.
4  *
5  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6  * Copyright (c) 2014 Nick McConnell
7  *
8  * This work is free software; you can redistribute it and/or modify it
9  * under the terms of either:
10  *
11  * a) the GNU General Public License as published by the Free Software
12  *    Foundation, version 2, or
13  *
14  * b) the "Angband licence":
15  *    This software may be copied and distributed for educational, research,
16  *    and not for profit purposes provided that this copyright and statement
17  *    are included in all such copies.  Other copyrights may also apply.
18  */
19 
20 #ifndef PLAYER_CALCS_H
21 #define PLAYER_CALCS_H
22 
23 #include "player.h"
24 
25 /**
26  * Bit flags for the "player->upkeep->notice" variable
27  */
28 #define PN_COMBINE      0x00000001L    /* Combine the pack */
29 #define PN_IGNORE       0x00000002L    /* Ignore stuff */
30 #define PN_MON_MESSAGE	0x00000004L	   /* flush monster pain messages */
31 
32 
33 /**
34  * Bit flags for the "player->upkeep->update" variable
35  */
36 #define PU_BONUS		0x00000001L	/* Calculate bonuses */
37 #define PU_TORCH		0x00000002L	/* Calculate torch radius */
38 #define PU_HP			0x00000004L	/* Calculate chp and mhp */
39 #define PU_MANA			0x00000008L	/* Calculate csp and msp */
40 #define PU_SPELLS		0x00000010L	/* Calculate spells */
41 #define PU_UPDATE_VIEW	0x00000020L	/* Update field of view */
42 #define PU_MONSTERS		0x00000040L	/* Update monsters */
43 #define PU_DISTANCE		0x00000080L	/* Update distances */
44 #define PU_PANEL		0x00000100L	/* Update panel */
45 #define PU_INVEN		0x00000200L	/* Update inventory */
46 
47 
48 /**
49  * Bit flags for the "player->upkeep->redraw" variable
50  */
51 #define PR_MISC			0x00000001L	/* Display Race/Class */
52 #define PR_TITLE		0x00000002L	/* Display Title */
53 #define PR_LEV			0x00000004L	/* Display Level */
54 #define PR_EXP			0x00000008L	/* Display Experience */
55 #define PR_STATS		0x00000010L	/* Display Stats */
56 #define PR_ARMOR		0x00000020L	/* Display Armor */
57 #define PR_HP			0x00000040L	/* Display Hitpoints */
58 #define PR_MANA			0x00000080L	/* Display Mana */
59 #define PR_GOLD			0x00000100L	/* Display Gold */
60 #define PR_HEALTH		0x00000200L	/* Display Health Bar */
61 #define PR_SPEED		0x00000400L	/* Display Extra (Speed) */
62 #define PR_STUDY		0x00000800L	/* Display Extra (Study) */
63 #define PR_DEPTH		0x00001000L	/* Display Depth */
64 #define PR_STATUS		0x00002000L
65 #define PR_DTRAP		0x00004000L /* Trap detection indicator */
66 #define PR_STATE		0x00008000L	/* Display Extra (State) */
67 #define PR_MAP			0x00010000L	/* Redraw whole map */
68 #define PR_INVEN		0x00020000L /* Display inven/equip */
69 #define PR_EQUIP		0x00040000L /* Display equip/inven */
70 #define PR_MESSAGE		0x00080000L /* Display messages */
71 #define PR_MONSTER		0x00100000L /* Display monster recall */
72 #define PR_OBJECT		0x00200000L /* Display object recall */
73 #define PR_MONLIST		0x00400000L /* Display monster list */
74 #define PR_ITEMLIST		0x00800000L /* Display item list */
75 #define PR_FEELING		0x01000000L /* Display level feeling */
76 #define PR_LIGHT		0x02000000L /* Display light level */
77 
78 /**
79  * Display Basic Info
80  */
81 #define PR_BASIC \
82 	(PR_MISC | PR_TITLE | PR_STATS | PR_LEV |\
83 	 PR_EXP | PR_GOLD | PR_ARMOR | PR_HP |\
84 	 PR_MANA | PR_DEPTH | PR_HEALTH | PR_SPEED)
85 
86 /**
87  * Display Extra Info
88  */
89 #define PR_EXTRA \
90 	(PR_STATUS | PR_STATE | PR_STUDY)
91 
92 /**
93  * Display Subwindow Info
94  */
95 #define PR_SUBWINDOW \
96 	(PR_MONSTER | PR_OBJECT | PR_MONLIST | PR_ITEMLIST)
97 
98 
99 extern const int adj_dex_th[STAT_RANGE];
100 extern const int adj_str_td[STAT_RANGE];
101 extern const int adj_str_blow[STAT_RANGE];
102 extern const int adj_dex_safe[STAT_RANGE];
103 extern const int adj_con_fix[STAT_RANGE];
104 extern const int adj_str_hold[STAT_RANGE];
105 
106 bool earlier_object(struct object *orig, struct object *new, bool store);
107 int equipped_item_slot(struct player_body body, struct object *obj);
108 void calc_inventory(struct player_upkeep *upkeep, struct object *gear,
109 					struct player_body body);
110 void calc_bonuses(struct player *p, struct player_state *state, bool known_only,
111 				  bool update);
112 void calc_digging_chances(struct player_state *state, int chances[DIGGING_MAX]);
113 int calc_blows(struct player *p, const struct object *obj,
114 			   struct player_state *state, int extra_blows);
115 
116 void health_track(struct player_upkeep *upkeep, struct monster *mon);
117 void monster_race_track(struct player_upkeep *upkeep,
118 						struct monster_race *race);
119 void track_object(struct player_upkeep *upkeep, struct object *obj);
120 void track_object_kind(struct player_upkeep *upkeep, struct object_kind *kind);
121 void track_object_cancel(struct player_upkeep *upkeep);
122 bool tracked_object_is(struct player_upkeep *upkeep, struct object *obj);
123 
124 void notice_stuff(struct player *p);
125 void update_stuff(struct player *p);
126 void redraw_stuff(struct player *p);
127 void handle_stuff(struct player *p);
128 int weight_remaining(struct player *p);
129 
130 #endif /* !PLAYER_CALCS_H */
131