-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenemies.c
36 lines (30 loc) · 996 Bytes
/
enemies.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdint.h>
#include <yaul.h>
#include "enemies.h"
#include "spritecode.h"
#include "graphics/objects.h"
void
enemies_lvl_process(const lvl_t *lvl)
{
const object_t * const objects = (object_t *)((uintptr_t)lvl +
sizeof(lvl_t) +
lvl->playfield_byte_size +
lvl->near_byte_size +
lvl->far_byte_size +
lvl->overlap_byte_size);
const uint32_t objects_count = lvl->objects_byte_size / sizeof(object_t);
float_init();
worm_init();
for (uint32_t i = 0; i < objects_count; i++) {
switch (objects[i].id) {
case OBJECT_ID_FLOAT:
float_load();
float_make(objects[i].x, objects[i].y);
break;
case OBJECT_ID_WORM:
worm_load();
worm_make(objects[i].x, objects[i].y);
break;
}
}
}