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