From 5408e81f3bf9802f3b67c71b93972797d3414264 Mon Sep 17 00:00:00 2001 From: jylam Date: Thu, 28 Sep 2006 08:11:08 +0000 Subject: [PATCH] * Adjusted default speed, line removing now works correctly git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/cacatris/trunk@1124 92316355-f0b4-4df1-b90c-862c8a59935f --- src/main.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main.c b/src/main.c index 180681d..c536e28 100644 --- a/src/main.c +++ b/src/main.c @@ -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; }