Revision 4603a6d1

View differences:

main.c
48 48
#define RIGHT  0b0010
49 49
#define ROTATE 0b1000
50 50

  
51
// note NOGAMEAREA needs has to be one pixel bigger
52
// because we are lazy in moveSpriteHorizontal (forward check)
53
#define NOGAMEAREA 0b111111111
51 54
#define TICKS 40
52 55
#define NUMBER_OF_PLAYERS 2
53 56

  
......
154 157
void setNewSprite(sprite_t* sprite){
155 158
	(*sprite).yLowerPos = (*((*sprite).owner)).gameAreaEnd-2;
156 159
	(*sprite).raw = pgm_read_word(bricks+(keypressCounter%(sizeof(bricks)/sizeof(uint16_t))));
157
	(*sprite).offset = 6;
160
	(*sprite).offset = 10;
158 161
	rawToBlock((uint16_t*)(*sprite).block, (*sprite).raw, (*sprite).offset);
159 162
	keypressCounter++;
160 163
}
......
312 315

  
313 316
void clearCompleteLines(player_t* player){
314 317
	for(uint8_t line = (*player).gameAreaStart; line <= (*player).gameAreaEnd; line++){
315
		if(lines[line] == 0xffff){
316
			lines[line] = 0x00;
318
		if((lines[line] & (0xffff & ~(NOGAMEAREA>>1))) == (0xffff & ~(NOGAMEAREA>>1))){
319
			lines[line] ^= (0xffff & ~(NOGAMEAREA>>1));
317 320
			(*player).score++;
318 321
		}
319 322
	}
320 323
}
321 324

  
322
void moveFlyingRowsDown(player_t* player){
325
void moveFlyingRowsDown(player_t* player){ // TODO needs fix becase we don't want to touch nogamearea
323 326
	for(uint8_t line = (*player).gameAreaStart; line <= (*player).gameAreaEnd-1; line++){
324 327
		if(lines[line] == 0x0000){ // TODO maybe add clear effect with green line?
325 328
			lines[line] = lines[line+1];
......
384 387
		}
385 388
	}
386 389
	else{
387
		// check if block[*] is uneven, so we cant move right
388 390
		for(uint8_t i = 0; i < 4; i++){
389
			if((*sprite).block[i] % 2){
391
			if(((*sprite).block[i] & (NOGAMEAREA)) != 0x0000){
390 392
				return;
391 393
			}
392 394
		}
......
454 456
			}
455 457
		}
456 458
		else if((*sprite).offset > 0){
457
			if(((block[i]>>((*sprite).offset)) ^ ((tmp&((0xf)<<(i*4)))>>(i*4))) != 0){
459
			if((((block[i]>>((*sprite).offset)) ^ ((tmp&((0xf)<<(i*4)))>>(i*4))) != 0) || ((block[i] & (NOGAMEAREA>>1)) != 0x0000)){
458 460
				return;
459 461
			}
460 462
		}

Also available in: Unified diff