Revision a2d58d3e main.c

View differences:

main.c
171 171
			for(uint8_t delay = 0; delay < TICKS; delay++){
172 172
				drawGameArea((player_t*)&player[playerNumber]);
173 173
				if(delay%20 == 0){
174
					handleGamepadInput((player_t*)&player[playerNumber], ((~PIN(D))&(0b11110000))>>4);
174
					handleGamepadInput((player_t*)&player[playerNumber],
175
								((~PIN(CONTROLLER_PORT))&
176
									( (1<<CONTROLLER_LEFT)
177
									| (1<<CONTROLLER_DOWN)
178
									| (1<<CONTROLLER_RIGHT)
179
									| (1<<CONTROLLER_ROTATE))
180
								)>>4);
175 181
				}
176 182
			}
177 183
			moveSpriteDown((sprite_t*)&(player[playerNumber].sprite));
......
252 258
	switch(input){
253 259
		// move > rotate > down
254 260
		case (LEFT | DOWN | RIGHT | ROTATE):
261
			keypressCounter+=2;
255 262
		case (DOWN | ROTATE):
256 263
			rotateLeft((sprite_t*)&((*player).sprite));
257 264
			rawToBlock((uint16_t*)(*player).sprite.block, (*player).sprite.raw, (*player).sprite.offset);
258 265
			moveSpriteDown((sprite_t*)&((*player).sprite));
259 266
			keypressCounter+=2;
260 267
			break;
261
		case (DOWN):
262 268
		case (LEFT | DOWN | RIGHT):
269
			keypressCounter+=2;
270
		case (DOWN):
263 271
			moveSpriteDown((sprite_t*)&((*player).sprite));
264 272
			keypressCounter+=1;
265 273
			break;
......
267 275
			moveSpriteHorizontal((sprite_t*)&((*player).sprite), -1);
268 276
			keypressCounter+=1;
269 277
			break;
278
		case (LEFT | RIGHT | ROTATE):
279
			keypressCounter+=1;
270 280
		case (RIGHT | ROTATE):
271 281
			moveSpriteHorizontal((sprite_t*)&((*player).sprite), -1);
272 282
			keypressCounter+=1;
273 283
		case (ROTATE):
274
		case (LEFT | RIGHT | ROTATE):
275 284
			rotateLeft((sprite_t*)&((*player).sprite));
276 285
			rawToBlock((uint16_t*)(*player).sprite.block, (*player).sprite.raw, (*player).sprite.offset);
277 286
			keypressCounter+=1;

Also available in: Unified diff