Mercurial > molko
comparison examples/example-battle/main.c @ 298:196264679079
misc: remove usage of bool
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 10 Mar 2021 18:49:08 +0100 |
parents | 5d8700074dd7 |
children | 3638b39ef2bf |
comparison
equal
deleted
inserted
replaced
297:6151152d009c | 298:196264679079 |
---|---|
141 }; | 141 }; |
142 | 142 |
143 static void | 143 static void |
144 init(void) | 144 init(void) |
145 { | 145 { |
146 if (!core_init("fr.malikania", "battle") || !ui_init() || !rpg_init()) | 146 if (core_init("fr.malikania", "battle") < 0 || ui_init() < 0 || rpg_init() < 0) |
147 panic(); | 147 panic(); |
148 if (!window_open("Example - Battle", W, H)) | 148 if (window_open("Example - Battle", W, H) < 0) |
149 panic(); | 149 panic(); |
150 | 150 |
151 registry_init(); | 151 registry_init(); |
152 | 152 |
153 /* Set cursor in default theme. */ | 153 /* Set cursor in default theme. */ |
180 bt->background = ®istry_images[REGISTRY_IMAGE_BATTLE_BACKGROUND]; | 180 bt->background = ®istry_images[REGISTRY_IMAGE_BATTLE_BACKGROUND]; |
181 | 181 |
182 battle_start(bt); | 182 battle_start(bt); |
183 | 183 |
184 fight_state.data = bt; | 184 fight_state.data = bt; |
185 game_switch(&fight_state, false); | 185 game_switch(&fight_state, 0); |
186 } | 186 } |
187 | 187 |
188 | 188 |
189 static void | 189 static void |
190 empty_handle(struct state *st, const union event *ev) | 190 empty_handle(struct state *st, const union event *ev) |
237 fight_update(struct state *st, unsigned int ticks) | 237 fight_update(struct state *st, unsigned int ticks) |
238 { | 238 { |
239 struct battle *bt = st->data; | 239 struct battle *bt = st->data; |
240 | 240 |
241 if (battle_update(bt, ticks)) | 241 if (battle_update(bt, ticks)) |
242 game_switch(&empty_state, false); | 242 game_switch(&empty_state, 0); |
243 } | 243 } |
244 | 244 |
245 static void | 245 static void |
246 fight_draw(struct state *st) | 246 fight_draw(struct state *st) |
247 { | 247 { |
266 }; | 266 }; |
267 | 267 |
268 static void | 268 static void |
269 run(void) | 269 run(void) |
270 { | 270 { |
271 game_switch(&empty_state, true); | 271 game_switch(&empty_state, 1); |
272 game_loop(); | 272 game_loop(); |
273 } | 273 } |
274 | 274 |
275 static void | 275 static void |
276 quit(void) | 276 quit(void) |