Revision 3619f712 main.c

View differences:

main.c
93 93
uint8_t checkPlayerSpriteForCollision(player_t* player, uint16_t block[4], int8_t lookahead); // lookahead -1 -> look down
94 94
void moveSpriteHorizontal(volatile sprite_t *sprite, int8_t dir); // -1 if left, 1 if right
95 95
void handleGamepadInput(player_t* player, uint8_t input);
96
inline void printLine(int16_t line, uint8_t round, sprite_t* sprite);
96
inline void printLine(int16_t line, uint8_t round, sprite_t* sprite, uint8_t player_number);
97 97
static inline void drawGameArea(player_t player[NUMBER_OF_PLAYERS]);
98 98
void gameOver(player_t* player);
99 99
void setNewSprite(volatile sprite_t* sprite);
......
228 228
	PORT(ADDRESS_PORT) = 0;
229 229
	for(uint8_t round = 0; round < 16; /*round++*/){
230 230
		for(int16_t line = player[1].gameAreaStart; line <= player[1].gameAreaEnd; line++){
231
			printLine(line, 15-round/2, (sprite_t*)&(player[1].sprite));
231
			printLine(line, 15-round/2, (sprite_t*)&(player[1].sprite), 1);
232 232
		}
233 233
		printGreenBar();
234 234
		for(int16_t line = 0; line < 8 ; line++){ //player[1].gameAreaEnd; line < player[0].gameAreaStart; line--){
......
240 240
				printScoreFontLine((player[1].score)&0x0f,10-round, 1);
241 241
				break;
242 242
			}
243
			//printLine(line, 15-round, (sprite_t*)&(player[1].sprite));
244 243
			if(round == 5){
245 244
				printYellowBar();
246 245
			}
......
287 286
		}
288 287
		printRedBar();
289 288
		for(int16_t line = player[0].gameAreaEnd; line >= player[0].gameAreaStart; line--){
290
			printLine(line, 15-round/2, (sprite_t*)&(player[0].sprite));
289
			printLine(line, 15-round/2, (sprite_t*)&(player[0].sprite), 0);
291 290
		}
292 291

  
293 292
		OE();
......
299 298
	}
300 299
}
301 300

  
302
inline void printLine(int16_t line, uint8_t round, sprite_t* sprite){
301
inline void printLine(int16_t line, uint8_t round, sprite_t* sprite, uint8_t player_number){
303 302
	if((1<<round) & lines[line]){
304 303
		yellowDot();
305 304
		yellowDot();
......
307 306
	else{
308 307
		if((*sprite).yLowerPos <= line && (*sprite).yLowerPos+4 > line){
309 308
			if((1<<round) & (*sprite).block[line-(*sprite).yLowerPos]){
310
				greenDot();
311
				greenDot();
309
				switch(player_number){
310
					case 0:
311
						redDot();
312
						redDot();
313
						break;
314
					case 1:
315
						greenDot();
316
						greenDot();
317
						break;
318
					default:
319
						yellowDot();
320
						yellowDot();
321
						break;
322
				}
312 323
			}
313 324
			else{
314 325
				noDot();

Also available in: Unified diff