Ver código fonte

* 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
master
jylam 18 anos atrás
pai
commit
5408e81f3b
1 arquivos alterados com 15 adições e 12 exclusões
  1. +15
    -12
      src/main.c

+ 15
- 12
src/main.c Ver arquivo

@@ -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;
}

Carregando…
Cancelar
Salvar