aboutsummaryrefslogtreecommitdiff
path: root/wave.c
diff options
context:
space:
mode:
Diffstat (limited to 'wave.c')
-rw-r--r--wave.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/wave.c b/wave.c
index 93b43f4..e6f4e44 100644
--- a/wave.c
+++ b/wave.c
@@ -1,4 +1,4 @@
-#include "enemy.h"
+#include "spawner.h"
#include "standard.h"
#include "wave.h"
#include "world.h"
@@ -13,9 +13,34 @@ static const Wave waves[] = {
{ 3, 5 },
{ 15, 15 },
}
+ }
+ },
+ 1,
+ 2
+ },
+ {
+ {
+ {
+ 20,
+ 2,
+ {
+ { 3, 5 },
+ { 15, 15 },
+ }
+ },
+ {
+ 200,
+ 4,
+ {
+ { 30, 30 },
+ { 15, 20 },
+ { 23, 5 },
+ { 6, 4 },
+ }
},
},
- 1
+ 2,
+ 6
}
};
@@ -25,8 +50,18 @@ void init_waver(Waver* waver) {
waver->timer = 0;
}
+void start_wave(struct World* world) {
+ world->wave_started = 1;
+ world->enemies_killed = 0;
+}
+
+int wave_enemy_count(const Waver* waver) {
+ return waves[waver->idx].kill_requirement;
+}
+
void next_wave(Waver* waver) {
waver->idx++;
+ waver->sidx = 0;
}
void update_waver(Waver* waver, World* world) {
@@ -45,7 +80,7 @@ void update_waver(Waver* waver, World* world) {
if (waver->timer >= subwave->frame) {
for (i = 0; i < subwave->count; i++) {
spawn = &subwave->spawns[i];
- new_skull(
+ new_spawner(
world,
(spawn->x * map_tile_size) << fbits,
(spawn->y * map_tile_size) << fbits
@@ -54,3 +89,7 @@ void update_waver(Waver* waver, World* world) {
waver->sidx++;
}
}
+
+int get_wave_count() {
+ return sizeof waves / sizeof *waves;
+}