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_FEELING, /* Object level feeling */
47  EVENT_LIGHT, /* Light level */
48  EVENT_STATE, /* The two 'R's: Resting and Repeating */
49 
51  EVENT_SEEFLOOR, /* When the player would "see" floor objects */
55 
66  EVENT_STORECHANGED, /* Triggered on a successful buy/retrieve or sell/drop */
67 
76 
77  EVENT_INITSTATUS, /* New status message for initialisation */
78  EVENT_BIRTHPOINTS, /* Change in the birth points */
79 
80  /* Changing of the game state/context. */
93 
94  EVENT_END /* Can be sent at the end of a series of events */
96 
97 #define N_GAME_EVENTS EVENT_END + 1
98 
99 typedef union
100 {
101  struct loc point;
102 
103  const char *string;
104 
105  bool flag;
106 
107  struct {
108  const char *msg;
109  int type;
110  } message;
111 
112  struct
113  {
114  bool reset;
115  const char *hint;
118  const char **choices;
119  const char **helptexts;
120  void *xtra;
121  } birthstage;
122 
123  struct
124  {
125  int *stats;
127  } birthstats;
128 
129  struct
130  {
134  bool drawing;
136  struct loc *blast_grid;
137  struct loc centre;
138  } explosion;
139 
140  struct
141  {
142  int proj_type;
143  bool drawing;
144  bool seen;
145  bool beam;
146  int oy;
147  int ox;
148  int y;
149  int x;
150  } bolt;
151 
152  struct
153  {
154  struct object *obj;
155  bool seen;
156  int y;
157  int x;
158  } missile;
159 
161 
162 
170 
174 void event_remove_all_handlers(void);
175 void event_add_handler_set(game_event_type *type, size_t n_types, game_event_handler *fn, void *user);
176 void event_remove_handler_set(game_event_type *type, size_t n_types, game_event_handler *fn, void *user);
177 
178 void event_signal_birthpoints(int stats[6], int remaining);
179 
180 void event_signal_point(game_event_type, int x, int y);
181 void event_signal_string(game_event_type, const char *s);
182 void event_signal_message(game_event_type type, int t, const char *s);
186  int proj_type,
187  int num_grids,
188  int *distance_to_grid,
189  bool seen,
190  bool *player_sees_grid,
191  struct loc *blast_grid,
192  struct loc centre);
194  int proj_type,
195  bool drawing,
196  bool seen,
197  bool beam,
198  int oy,
199  int ox,
200  int y,
201  int x);
203  struct object *obj,
204  bool seen,
205  int y,
206  int x);
207 
208 #endif /* INCLUDED_GAME_EVENT_H */
void * xtra
Definition: game-event.h:120
Definition: game-event.h:69
Definition: game-event.h:36
Definition: game-event.h:90
void event_signal_missile(game_event_type type, struct object *obj, bool seen, int y, int x)
Definition: game-event.c:237
static int stats[STAT_MAX]
All of these should be in some kind of 'birth state' struct somewhere else
Definition: player-birth.c:118
Definition: game-event.h:83
void event_remove_handler(game_event_type type, game_event_handler *fn, void *user)
Definition: game-event.c:64
Definition: game-event.h:29
int proj_type
Definition: game-event.h:131
Definition: z-type.h:24
void event_remove_handler_type(game_event_type type)
Definition: game-event.c:93
struct object * obj
Definition: game-event.h:154
Definition: game-event.h:84
Definition: game-event.h:56
const char ** helptexts
Definition: game-event.h:119
const char * string
Definition: game-event.h:103
void event_remove_handler_set(game_event_type *type, size_t n_types, game_event_handler *fn, void *user)
Definition: game-event.c:129
void event_signal_string(game_event_type, const char *s)
Definition: game-event.c:164
png_infop png_uint_32 flag
Definition: libpng12/png.h:2191
int * stats
Definition: game-event.h:125
static term_data data[MAX_TERM_DATA]
Definition: main-nds.c:156
void event_signal_birthpoints(int stats[6], int remaining)
Definition: game-event.c:183
Definition: game-event.h:35
Definition: game-event.h:64
Definition: game-event.h:47
Definition: game-event.h:39
struct loc * blast_grid
Definition: game-event.h:136
Definition: game-event.h:46
Definition: game-event.h:60
bool beam
Definition: game-event.h:145
Definition: game-event.h:92
Definition: game-event.h:86
void event_signal(game_event_type)
Definition: game-event.c:140
Definition: game-event.h:58
int initial_choice
Definition: game-event.h:117
Definition: game-event.h:82
Definition: game-event.h:87
Definition: game-event.h:34
Definition: game-event.h:65
game_event_type
The various events we can send signals about.
Definition: game-event.h:27
int n_choices
Definition: game-event.h:116
Definition: game-event.h:51
int oy
Definition: game-event.h:146
Object information, for a specific object.
Definition: object.h:399
int num_grids
Definition: game-event.h:132
void event_remove_all_handlers(void)
Definition: game-event.c:105
Definition: game-event.h:57
Definition: game-event.h:63
bool reset
Definition: game-event.h:114
Definition: game-event.h:74
Definition: game-event.h:59
Definition: game-event.h:31
Definition: game-event.h:44
const char ** choices
Definition: game-event.h:118
int x
Definition: z-type.h:25
Definition: game-event.h:81
Definition: game-event.h:94
Definition: game-event.h:62
Definition: game-event.h:66
int type
Definition: mon-msg.c:80
int y
Definition: z-type.h:26
Definition: game-event.h:53
int remaining
Definition: game-event.h:126
void event_signal_blast(game_event_type type, int proj_type, int num_grids, int *distance_to_grid, bool seen, bool *player_sees_grid, struct loc *blast_grid, struct loc centre)
Definition: game-event.c:193
int * distance_to_grid
Definition: game-event.h:133
Definition: game-event.h:75
Definition: game-event.h:72
Definition: game-event.h:32
Definition: game-event.h:85
Definition: game-event.h:54
static int oy
Definition: player-path.c:52
Definition: game-event.h:88
int x
Definition: game-event.h:149
Support various data types.
void event_signal_point(game_event_type, int x, int y)
Definition: game-event.c:154
void game_event_handler(game_event_type type, game_event_data *data, void *user)
A function called when a game event occurs - these are registered to be called by event_add_handler o...
Definition: game-event.h:169
Definition: game-event.h:68
bool drawing
Definition: game-event.h:134
void event_add_handler(game_event_type type, game_event_handler *fn, void *user)
Definition: game-event.c:48
Definition: game-event.h:42
Definition: game-event.h:48
void event_signal_bolt(game_event_type type, int proj_type, bool drawing, bool seen, bool beam, int oy, int ox, int y, int x)
Definition: game-event.c:214
Definition: game-event.h:43
Definition: game-event.h:37
Definition: game-event.h:73
int y
Definition: game-event.h:148
Definition: game-event.h:33
int ox
Definition: game-event.h:147
static int ox
Definition: player-path.c:52
Definition: game-event.h:70
Definition: game-event.h:78
int type
Definition: game-event.h:109
Definition: game-event.h:40
Definition: game-event.h:99
bool * player_sees_grid
Definition: game-event.h:135
void event_add_handler_set(game_event_type *type, size_t n_types, game_event_handler *fn, void *user)
Definition: game-event.c:121
bool seen
Definition: game-event.h:144
bool flag
Definition: game-event.h:105
Definition: game-event.h:91
Definition: game-event.h:71
Definition: game-event.h:89
void event_signal_message(game_event_type type, int t, const char *s)
Definition: game-event.c:172
const char * msg
Definition: game-event.h:108
Definition: game-event.h:41
Definition: game-event.h:50
Definition: game-event.h:45
Definition: game-event.h:61
Definition: game-event.h:38
Definition: game-event.h:52
Definition: game-event.h:77
const char * hint
Definition: game-event.h:115
void event_signal_flag(game_event_type type, bool flag)
Definition: game-event.c:145