|
|
@@ -18,7 +18,7 @@ int main(int argc, char *argv[]) |
|
|
|
unsigned char last_has_landed = 1; |
|
|
|
unsigned char left = 0, right = 0, down = 0; |
|
|
|
unsigned long long int curTime = 0; |
|
|
|
unsigned int speed = 32; |
|
|
|
unsigned int speed = 16; |
|
|
|
unsigned int fixed_y = 0; |
|
|
|
unsigned char lost = 0; |
|
|
|
unsigned int score = 0; |
|
|
@@ -309,18 +309,21 @@ unsigned char has_landed(unsigned int id, unsigned int x, unsigned int y, unsign |
|
|
|
|
|
|
|
unsigned char maybe_remove_line(void) |
|
|
|
{ |
|
|
|
int x, v=0; |
|
|
|
unsigned char *p = &playfield[(FIELD_HEIGHT-1)*FIELD_WIDTH]; |
|
|
|
int y, x, v=0; |
|
|
|
unsigned char *p = playfield; |
|
|
|
int ret = 0; |
|
|
|
for(x = 0; x < FIELD_WIDTH ; x++) |
|
|
|
if(*p++) |
|
|
|
v++; |
|
|
|
|
|
|
|
if(v==FIELD_WIDTH) { |
|
|
|
memmove(&playfield[FIELD_WIDTH], playfield, (FIELD_HEIGHT-1)*FIELD_WIDTH); |
|
|
|
ret++; |
|
|
|
ret += maybe_remove_line(); |
|
|
|
return ret; |
|
|
|
|
|
|
|
for(y = 0; y < FIELD_HEIGHT ; y++) |
|
|
|
{ |
|
|
|
for(x = 0; x < FIELD_WIDTH ; x++) |
|
|
|
if(*p++) |
|
|
|
v++; |
|
|
|
if(v==FIELD_WIDTH) { |
|
|
|
memmove(&playfield[FIELD_WIDTH], playfield, (y)*FIELD_WIDTH); |
|
|
|
ret++; |
|
|
|
} |
|
|
|
v=0; |
|
|
|
} |
|
|
|
|
|
|
|
return ret; |
|
|
|
} |