Changeset 1124 for cacatris/trunk


Ignore:
Timestamp:
Sep 28, 2006, 10:11:08 AM (14 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Adjusted default speed, line removing now works correctly
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cacatris/trunk/src/main.c

    r1117 r1124  
    1919    unsigned char left = 0, right = 0, down = 0;
    2020    unsigned long long int curTime = 0;
    21     unsigned int speed = 32;
     21    unsigned int speed = 16;
    2222    unsigned int fixed_y = 0;
    2323    unsigned char lost = 0;
     
    310310unsigned char maybe_remove_line(void)
    311311{
    312     int x, v=0;
    313     unsigned char *p = &playfield[(FIELD_HEIGHT-1)*FIELD_WIDTH];
     312    int y, x, v=0;
     313    unsigned char *p = playfield;
    314314    int ret = 0;
    315     for(x = 0; x < FIELD_WIDTH ; x++)
    316         if(*p++)
    317             v++;
    318 
    319     if(v==FIELD_WIDTH) {
    320         memmove(&playfield[FIELD_WIDTH], playfield, (FIELD_HEIGHT-1)*FIELD_WIDTH);
    321         ret++;
    322         ret += maybe_remove_line();
    323         return ret;
    324     }
     315
     316    for(y = 0; y < FIELD_HEIGHT ; y++)
     317    {
     318        for(x = 0; x < FIELD_WIDTH ; x++)
     319            if(*p++)
     320                v++;
     321        if(v==FIELD_WIDTH) {
     322            memmove(&playfield[FIELD_WIDTH], playfield, (y)*FIELD_WIDTH);
     323            ret++;
     324        }
     325        v=0;
     326    }
     327
    325328    return ret;
    326329}
Note: See TracChangeset for help on using the changeset viewer.