Browse Source

NUM_COLS and NUM_ROWS were mixed up at some places

feature/2015
Christian Kroll 11 years ago
parent
commit
4fd59d8edf
  1. 10
      src/games/breakout/playfield.c
  2. 2
      src/games/breakout/rebound.h

10
src/games/breakout/playfield.c

@ -67,7 +67,7 @@ static void brick_damage (int8_t in_x, int8_t in_y)
void playfield_set (uint8_t in_x, uint8_t in_y, game_field_t in_field) void playfield_set (uint8_t in_x, uint8_t in_y, game_field_t in_field)
{ {
if (in_x >= NUM_ROWS || in_y >= NUM_COLS) if (in_x >= NUM_COLS || in_y >= NUM_ROWS)
{ {
return; return;
} }
@ -78,10 +78,10 @@ int8_t check_bounce (int8_t in_x, int8_t in_y)
{ {
int8_t ov = 0; int8_t ov = 0;
/* overflow check */ /* overflow check */
if (in_x >= NUM_ROWS || in_x < 0) if (in_x >= NUM_COLS || in_x < 0)
ov |= BOUNCE_X; ov |= BOUNCE_X;
if (in_y >= NUM_COLS || in_y < 0) if (in_y >= NUM_ROWS || in_y < 0)
ov |= BOUNCE_Y; ov |= BOUNCE_Y;
if (ov) if (ov)
@ -119,9 +119,9 @@ void playfield_draw ()
{ {
uint8_t x,y; uint8_t x,y;
for (x=0;x<NUM_ROWS;x++) for (x=0;x<NUM_COLS;x++)
{ {
for (y=0;y<NUM_COLS;y++) for (y=0;y<NUM_ROWS;y++)
{ {
draw_single_field (x,y, (*playfield)[x][y]); draw_single_field (x,y, (*playfield)[x][y]);
} }

2
src/games/breakout/rebound.h

@ -30,7 +30,7 @@ inline static uint8_t rebound_getpos ()
inline static void rebound_init() inline static void rebound_init()
{ {
rbpos = (NUM_ROWS / 2) - (REBOUND_SIZE / 2); rbpos = (NUM_COLS / 2) - (REBOUND_SIZE / 2);
rebound_draw(); rebound_draw();
} }

Loading…
Cancel
Save