|
|
@@ -23,6 +23,8 @@ int main(int argc, char *argv[]) |
|
|
|
unsigned char lost = 0; |
|
|
|
unsigned int score = 0; |
|
|
|
unsigned int lines = 0; |
|
|
|
unsigned char level = 0; |
|
|
|
unsigned char total_lines = 0; |
|
|
|
|
|
|
|
field = cucul_create_canvas(0, 0); |
|
|
|
infos = cucul_create_canvas(0, 0); |
|
|
@@ -128,7 +130,7 @@ int main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
/* Populate info canvas */ |
|
|
|
infos_populate(infos, score); |
|
|
|
infos_populate(infos, score, level); |
|
|
|
/* Draw everything on playfield */ |
|
|
|
put_piece(current_piece, x ,y, rotation); |
|
|
|
playfield_draw(field); |
|
|
@@ -157,8 +159,15 @@ int main(int argc, char *argv[]) |
|
|
|
lines = maybe_remove_line(); |
|
|
|
if(lines) |
|
|
|
{ |
|
|
|
score += (lines*40); |
|
|
|
|
|
|
|
score += points[level+(lines-1)*LEVEL_COUNT]; |
|
|
|
total_lines += lines; |
|
|
|
if(total_lines >=10 && level<=10) |
|
|
|
{ |
|
|
|
level++; |
|
|
|
total_lines = 0; |
|
|
|
speed+=2; |
|
|
|
memset(playfield, 0, FIELD_WIDTH*FIELD_HEIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(!baseTime) |
|
|
@@ -175,23 +184,26 @@ int main(int argc, char *argv[]) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void infos_populate(cucul_canvas_t *inf, unsigned int score) |
|
|
|
void infos_populate(cucul_canvas_t *inf, unsigned int score, unsigned char level) |
|
|
|
{ |
|
|
|
unsigned int i; |
|
|
|
char scoreline[1024]; |
|
|
|
char levelline[1024]; |
|
|
|
|
|
|
|
sprintf(scoreline, " Score : %05d ", score); |
|
|
|
sprintf(levelline, " Level : %02d ", level); |
|
|
|
|
|
|
|
cucul_set_color(inf, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); |
|
|
|
cucul_putstr(inf, 0, 0," =Cacatris= "); |
|
|
|
cucul_putstr(inf, 0, 1," Arrows : move "); |
|
|
|
cucul_putstr(inf, 0, 2," Space : pouf "); |
|
|
|
cucul_putstr(inf, 0, 3," __________________ "); |
|
|
|
cucul_putstr(inf, 0, 4," "); |
|
|
|
cucul_putstr(inf, 0, 5,scoreline); |
|
|
|
cucul_putstr(inf, 0, 6," Time : XX:XX "); |
|
|
|
|
|
|
|
for(i = 6; i < cucul_get_canvas_height(inf); i++) |
|
|
|
cucul_putstr(inf, 0, 0, " =Cacatris= "); |
|
|
|
cucul_putstr(inf, 0, 1, " Arrows : move "); |
|
|
|
cucul_putstr(inf, 0, 2, " Space : pouf "); |
|
|
|
cucul_putstr(inf, 0, 3, " __________________ "); |
|
|
|
cucul_putstr(inf, 0, 4, " "); |
|
|
|
cucul_putstr(inf, 0, 5, levelline); |
|
|
|
cucul_putstr(inf, 0, 6, scoreline); |
|
|
|
cucul_putstr(inf, 0, 7, " Time : XX:XX "); |
|
|
|
|
|
|
|
for(i = 7; i < cucul_get_canvas_height(inf); i++) |
|
|
|
{ |
|
|
|
cucul_putstr(inf, 0, i," "); |
|
|
|
} |
|
|
|