-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefenses.h
106 lines (95 loc) · 2.03 KB
/
defenses.h
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* File: defenses.h
* Author: Jayson Rhynas, 20299211
* Created: January 14, 2011
*
* Declares defense types and functions.
*/
#ifndef _DEFENSES_H_
#define _DEFENSES_H_
#include "list.h"
typedef enum {
WOOD,
BRICK,
IRON,
STEEL,
HEALTH, // not actually a castle, just an upgrade
NUM_CASTLE // for counting
} CType;
typedef struct {
CType type;
int maxHealth;
int curHealth;
int showHealth;
} Castle;
void upgradeCastle(CType type, Castle *c);
void drawCastle(Castle *c, int x, int y);
typedef enum {
/* TRAPS */
MUD,
ACID,
SPIKE,
BEAR_TRAP,
TRAP_DOOR,
NUM_TRAPS, // for counting
/* TURRETS */
GUN,
SHOTGUN,
MACHINE_GUN,
ROCKET,
//TASER,
//LASER,
//FLAMETHROWER,
NUM_TURRETS_PLUS_GUN // for counting
} DType;
typedef struct {
// Type
DType type;
Node *container;
int id;
// Position
int floor;
int col;
int x;
int y;
// misc paramaters
int selected;
int triggered;
float aim; // angle in radians
float cur_aim;
float aim_speed;
int bulletSpeed;
int damage;
long long reload_time; // in milliseconds
long long last_shot_time; // in milliseconds
} Defense;
Defense* createDefense(DType type, int f, int c, int id);
void selectDefense(int x, int y);
void placeDefense(int x, int y, DType type);
void aimDefense(void *vd, int targetX, int targetY, int targetSize);
void moveDefense(void *vd);
void targetDefenses();
void drawDefense(void *vd);
void drawTurrets();
void moveTraps();
void drawTraps();
void checkTraps();
void triggerTrap(void *vd, void *ve);
void shootDefense(void *vd);
typedef struct {
DType type;
Node *container;
int floor;
int x;
int y;
float a;
int s;
int r;
int dmg;
} Bullet;
Bullet* createBullet(DType type, int f, int x, int y, float a, int s, int d);
void moveBullet(void *vb);
void checkCollisions();
void drawBullet(void *vb);
void cleanupBullets();
#endif /* _DEFENSES_H_ */