Angband
game-event.h
Go to the documentation of this file.
1 
19 #ifndef INCLUDED_GAME_EVENT_H
20 #define INCLUDED_GAME_EVENT_H
21 
22 #include "z-type.h"
23 
27 typedef enum game_event_type
28 {
29  EVENT_MAP = 0, /* Some part of the map has changed. */
30 
31  EVENT_STATS, /* One or more of the stats. */
32  EVENT_HP, /* HP or MaxHP. */
33  EVENT_MANA, /* Mana or MaxMana. */
34  EVENT_AC, /* Armour Class. */
35  EVENT_EXPERIENCE, /* Experience or MaxExperience. */
36  EVENT_PLAYERLEVEL, /* Player's level has changed */
37  EVENT_PLAYERTITLE, /* Player's title has changed */
38  EVENT_GOLD, /* Player's gold amount. */
39  EVENT_MONSTERHEALTH, /* Observed monster's health level. */
40  EVENT_DUNGEONLEVEL, /* Dungeon depth */
41  EVENT_PLAYERSPEED, /* Player's speed */
42  EVENT_RACE_CLASS, /* Race or Class */
43  EVENT_STUDYSTATUS, /* "Study" availability */
44  EVENT_STATUS, /* Status */
45  EVENT_DETECTIONSTATUS, /* Trap detection status */
46  EVENT_STATE, /* The three 'R's: Resting, Repeating and
47  Searching */
48 
50  EVENT_SEEFLOOR, /* When the player would "see" floor objects */
54 
64  EVENT_STORECHANGED, /* Triggered on a successful buy/retrieve or sell/drop */
65 
74 
75  EVENT_INITSTATUS, /* New status message for initialisation */
76  EVENT_BIRTHPOINTS, /* Change in the birth points */
77 
78  /* Changing of the game state/context. */
89 
90  EVENT_END /* Can be sent at the end of a series of events */
92 
93 #define N_GAME_EVENTS EVENT_END + 1
94 
95 typedef union
96 {
97  struct loc point;
98 
99  const char *string;
100 
101  bool flag;
102 
103  struct {
104  const char *msg;
105  int type;
106  } message;
107 
108  struct
109  {
110  bool reset;
111  const char *hint;
114  const char **choices;
115  const char **helptexts;
116  void *xtra;
117  } birthstage;
118 
119  struct
120  {
121  int *stats;
123  } birthstats;
124 
125  struct
126  {
127  int gf_type;
131  struct loc *blast_grid;
132  struct loc centre;
133  } explosion;
134 
135  struct
136  {
137  int gf_type;
138  bool seen;
139  bool beam;
140  int oy;
141  int ox;
142  int y;
143  int x;
144  } bolt;
145 
146  struct
147  {
148  struct object *obj;
149  bool seen;
150  int y;
151  int x;
152  } missile;
153 
155 
156 
164 
167 void event_remove_all_handlers(void);
168 void event_add_handler_set(game_event_type *type, size_t n_types, game_event_handler *fn, void *user);
169 void event_remove_handler_set(game_event_type *type, size_t n_types, game_event_handler *fn, void *user);
170 
171 void event_signal_birthpoints(int stats[6], int remaining);
172 
173 void event_signal_point(game_event_type, int x, int y);
174 void event_signal_string(game_event_type, const char *s);
175 void event_signal_message(game_event_type type, int t, const char *s);
179  int gf_type,
180  int num_grids,
181  int *distance_to_grid,
182  bool *player_sees_grid,
183  struct loc *blast_grid,
184  struct loc centre);
186  int gf_type,
187  bool seen,
188  bool beam,
189  int oy,
190  int ox,
191  int y,
192  int x);
194  struct object *obj,
195  bool seen,
196  int y,
197  int x);
198 
199 #endif /* INCLUDED_GAME_EVENT_H */