aboutsummaryrefslogtreecommitdiff
path: root/world.h
blob: 59faa69b7eccc8c6d84f147b768bd8a32b6bf580 (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef world_h
#define world_h

#include "map.h"
#include "obj.h"

#define max_particles 16
#define max_enemies 16
#define max_deathzones 16
#define max_effects 16
#define max_projectiles 16

struct Renderer;

typedef struct World {
	Particle particles[max_particles];
	Enemy enemies[max_enemies];
	Deathzone deathzones[max_deathzones];
	Effect effects[max_effects];
	Projectile projectiles[max_projectiles];
	int particle_count, enemy_count, effect_count;
	int deathzone_count, projectile_count;
	Player player;
	Laser laser;
	Map map;
	int frame, freeze, kills;
} World;

void init_world(World* w);
Particle* inst_particle(
	World* w,
	int x,
	int y,
	int anim,
	int bmp
);
Enemy* inst_enemy(
	World* w,
	Enemy_Type t,
	int x,
	int y
);
Deathzone* inst_deathzone(
	World* w,
	const Rect* r,
	int vx,
	int vy,
	int hp,
	int life,
	int friendly
);
Effect* inst_effect(
	World* w,
	int x,
	int y,
	int vx,
	int vy,
	int c
);
Projectile* inst_projectile(
	World* w,
	int x,
	int y,
	const Rect* r,
	int anim
);
void update_world(World* w, const struct App* a);
void ren_world(const World* w, struct Renderer* r);

#endif