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