-
Notifications
You must be signed in to change notification settings - Fork 0
/
boom.c
82 lines (66 loc) · 1.59 KB
/
boom.c
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
/*****************************************
Mroczna Harmonia
boom.c xxxxxxxxxxxx
(C) 2001, 2023 M. Feliks
*****************************************/
#include <math.h>
#include "globals.h"
#define PI 3.14159265359
void w_inicjuj_sincos(void)
{
int i, r;
for (r = 10; r < 40; r++) {
for (i = 0; i < 360; i += 6) {
b_punkt[r - 10][i / 6][0] = (int)(cos(i * PI / 180) * r);
b_punkt[r - 10][i / 6][1] = (int)(sin(i * PI / 180) * r);
}
}
}
void w_nadaj0(void)
{
int i;
WYBUCH* b;
for (i = 0; i < MAX_BUM; i++) {
b = &wybuch[i];
b->aktywny = 0;
}
}
void w_inicjuj(int x0, int y0,
unsigned char kolor1, unsigned char kolor2)
{
int i;
WYBUCH* b;
for (i = 0; i < 10; i++) {
b = &wybuch[i];
if (!b->aktywny) {
b->x = x0;
b->y = y0;
b->r = 3;
b->kolor1 = kolor1;
b->kolor2 = kolor2;
b->r_pom = 0;
b->aktywny = 1;
break;
}
}
}
void w_wykonaj(WYBUCH* bum)
{
int j, x1, y1, x2, y2;
if (bum->aktywny) {
for (j = 1; j < 60; j++) {
x1 = bum->x + b_punkt[bum->r][j][0];
y1 = bum->y - b_punkt[bum->r][j][1];
pixel(x1, y1, bum->kolor1);
x2 = bum->x + b_punkt[bum->r - 2][j][0];
y2 = bum->y - b_punkt[bum->r - 2][j][1];
pixel(x2, y2, bum->kolor2);
}
if ((bum->r_pom++) == 2) {
bum->r++;
bum->r_pom = 0;
}
if (bum->r > 28)
bum->aktywny = 0;
}
}