-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleananimation.cpp
39 lines (31 loc) · 1.1 KB
/
cleananimation.cpp
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
#include "brick.h"
#include "cleananimation.h"
static char cleananimation_line = 0;
void cleananimation_init() {
cleananimation_line = 0;
}
int cleananimation() {
char line_to_draw = cleananimation_line;
char field_to_draw = BRICK_FIELD_OCCUPIED;
int i;
if (cleananimation_line < BRICK_PLAYFIELD_HEIGHT) {
line_to_draw = BRICK_PLAYFIELD_HEIGHT - cleananimation_line - 1;
} else if (cleananimation_line < BRICK_PLAYFIELD_HEIGHT * 2) {
line_to_draw = cleananimation_line - BRICK_PLAYFIELD_HEIGHT;
field_to_draw = BRICK_FIELD_EMPTY;
} else {
return CLEANANIMATION_DONE;
}
for (i = 0; i < BRICK_PLAYFIELD_WIDTH; i++) {
brick_s.playfield[i][line_to_draw] = field_to_draw;
}
brick_s.rr.left = 0;
brick_s.rr.right = BRICK_PLAYFIELD_WIDTH - 1;
if (brick_s.rr.top > line_to_draw)
brick_s.rr.top = line_to_draw;
if (brick_s.rr.bottom < line_to_draw)
brick_s.rr.bottom = line_to_draw;
brick_s.rr.clean = 0;
cleananimation_line++;
return CLEANANIMATION_PROGRESS;
}