-
Notifications
You must be signed in to change notification settings - Fork 0
/
threads.h
87 lines (76 loc) · 1.72 KB
/
threads.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
DWORD WINAPI UpdateRocket(LPVOID rpointer)
{
rocket *curr = (rocket *) rpointer;
while(curr->dead_time < 0.5 && core->alive)
{
if(!core->pause)
{
if(curr->alive)
{
curr->x += sin(curr->angle)*curr->speed;
curr->y -= cos(curr->angle)*curr->speed;
curr->speed += 0.05;
curr->trail->MoveTo(curr->x-sin(curr->angle)*12, curr->y+cos(curr->angle)*12);
}
if((curr->x < -30 || curr->x > 830 || curr->y < -30) && curr->alive)
{
curr->alive = false;
curr->trail->Stop();
}
if(!curr->alive)
{
curr->dead_time += hge->Timer_GetDelta();
}
curr->trail->Update(hge->Timer_GetDelta());
}
Sleep(9);
}
curr->dead_time = 1;
return 0;
}
DWORD WINAPI UpdateBomb(LPVOID bpointer)
{
bomb *curr = (bomb *)bpointer;
while(curr->dead_time < 0.9 && core->alive)
{
if(!core->pause)
{
if(curr->alive)
{
curr->x += sin(curr->angle)*curr->speed;
curr->y -= cos(curr->angle)*curr->speed;
if(curr->curved)
{
curr->angle += sin(curr->angle_offset)/100*curr->curve_dir;
curr->angle_offset += 0.02;
if(curr->angle_offset > 6.28) curr->angle_offset = 0;
}
curr->trail->MoveTo(curr->x-sin(curr->angle)*12, curr->y+cos(curr->angle)*12);
}
if(curr->y > 440)
{
core->colors[0]++;
core->colors[1]--;
core->colors[2]--;
core->colors[3]++;
core->colors[4]--;
core->colors[5]--;
}
// explode reaching bombs
if(curr->y >= 500 && curr->alive)
{
curr->explode();
curr->fatal = true;
}
if(!curr->alive)
{
curr->dead_time += hge->Timer_GetDelta();
}
curr->trail->Update(hge->Timer_GetDelta());
curr->explosion->Update(hge->Timer_GetDelta());
}
Sleep(9);
}
curr->dead_time = 1;
return 0;
}