-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpredefine.h
174 lines (124 loc) · 2.54 KB
/
predefine.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
class CORE;
class dynamic_spr;
class rocket;
class bomb;
class nuke;
DWORD WINAPI UpdateRocket(LPVOID rpointer);
DWORD WINAPI UpdateBomb(LPVOID bpointer);
bool FrameFunc();
bool RenderFunc();
bool FrameFuncLost();
bool RenderFuncLost();
// common active object class
class dynamic_spr
{
public:
hgeSprite *body;
hgeParticleSystem *trail, *explosion;
float x, y;
float angle, speed;
float dead_time;
dynamic_spr *next, *prev;
bool alive;
HANDLE thread;
dynamic_spr(float nx, float ny, float nangle)
{
body = NULL;
trail = explosion = NULL;
next = prev = NULL;
x = nx;
y = ny;
angle = nangle;
speed = 0;
thread = 0;
alive = false;
}
int collides(dynamic_spr *obj)
{
if(abs(this->x - obj->x) < 16 && abs(this->y - obj->y) < 16 && obj->alive) return true;
return false;
}
};
// rocket class
class rocket: public dynamic_spr
{
public:
rocket(float x, float y, float angle);
void explode();
};
// bomb class
class bomb: public dynamic_spr
{
public:
bool fatal, curved;
float angle_offset;
int curve_dir;
bomb(float x, float y, float angle);
void explode();
};
// nuke class
class nuke: public dynamic_spr
{
public:
bool fatal, curved;
nuke(float x, float y, float angle);
void explode();
};
template <class Type>
class list
{
public:
Type *first, *last;
int length, max;
list(int nmax);
~list();
void add(Type *obj);
void del(Type *obj);
Type * get(int id);
void empty();
void render();
};
// core class
class CORE
{
public:
HMUSIC music;
HCHANNEL channel;
HTEXTURE
txGround, txSky,
txTurret, txGun,
txRocket, txRocketTrail,
txBomb, txBombTrail,
txNuke, txNukeTrail,
txExplosion,
txCrosshair,
txSign;
hgeSprite
*ground, *sky,
*turret, *gun,
*crosshair,
*rocketTrailPiece, *bombTrailPiece, *explosionPiece, *nukeTrailPiece,
*sign;
hgeFont *fnt;
list<rocket> *rockets;
list<bomb> *bombs;
list<nuke> *nukes;
struct { float x, y; } stars[100];
float turretAngle, mouseX, mouseY;
float bombTimer, nukeTimer, bombInterval, bombSpeedup;
float colors[6], starcolor, textalpha;
long score, fired, hit;
bool alive, pause, debug;
CORE();
~CORE();
int load_data();
void init();
void rotate_turret();
void fire_rocket();
void drop_bomb();
void drop_nuke();
void explode_bombs();
void repaint_sky();
void debug_render();
bool collect_garbage();
};