summaryrefslogtreecommitdiff
path: root/dat.h
blob: 71bf8e8f6c5ee43cfb0011129c1fb8bc842c7b12 (plain)
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
71
72
73
74
#define BULLET_SIZE  2
#define ENTITY_SIZE  8

typedef struct {
	vec2 pos;
	vec2 size;
	vec2 vel;
} Body;

typedef struct {
	enum {
		EPLAYER,
		EGHOST,
		EBULLET,
		ETELEPORTER,
		LASTEntity,
	} type;

	bool active;
	Body body;
	float time;
	float life;
	bool alive;

	int telex, teley;
} Entity;

typedef struct {
	Entity *self;
	Entity *target;
} EntityCollision;

typedef void (EntityCollisionProc)(Entity *self, Entity *other);
typedef void (EntityUpdateProc)(Entity *self, float delta);

void entphysics(float delta);
void entupdate(float delta);
void entinit(void);

void             enqcoll(EntityCollision *c);
EntityCollision *deqcoll(void);

Entity *allocentity(void);
void    freeentity(Entity *);

void entrestart(void);

extern Entity entitybuffer[2048];
extern int    ebufi;

extern char map_data[];
extern int  map_width, map_height;
extern float player_x, player_y;
extern int ghostcount;
extern float ghostpositions[][2];

extern struct {
	int ftx, fty;
	int ttx, tty;
} telemap[];
extern int telemapsize;

extern struct {
	float x, y;
} teles[];
extern int telessize;

extern Entity *player;

extern bool shot;
extern int shotx, shoty;

extern bool moveleft, moveright, moveup, movedown;