summaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index ea98bec..13b4432 100644
--- a/src/game.c
+++ b/src/game.c
@@ -39,9 +39,19 @@ game_update(Game *this)
}
for (__auto_type i = 0; i < MAX_ENTITIES; i++) {
const __auto_type e = &this->entities[i];
+ if (e->type != 0 && e->update_begin != NULL)
+ e->update_begin(e, this);
+ }
+ for (__auto_type i = 0; i < MAX_ENTITIES; i++) {
+ const __auto_type e = &this->entities[i];
if (e->type != 0 && e->update != NULL)
e->update(e, this);
}
+ for (__auto_type i = 0; i < MAX_ENTITIES; i++) {
+ const __auto_type e = &this->entities[i];
+ if (e->type != 0 && e->update_end != NULL)
+ e->update_end(e, this);
+ }
}
void
@@ -50,9 +60,19 @@ game_draw(Game *this)
map_draw();
for (int i = 0; i < MAX_ENTITIES; i++) {
const __auto_type e = &this->entities[i];
+ if (e->type != 0 && e->draw_begin != NULL)
+ e->draw_begin(e, this);
+ }
+ for (int i = 0; i < MAX_ENTITIES; i++) {
+ const __auto_type e = &this->entities[i];
if (e->type != 0 && e->draw != NULL)
e->draw(e, this);
}
+ for (int i = 0; i < MAX_ENTITIES; i++) {
+ const __auto_type e = &this->entities[i];
+ if (e->type != 0 && e->draw_end != NULL)
+ e->draw_end(e, this);
+ }
}
void