diff --git a/src/game/tetromino/placing.c b/src/game/tetromino/placing.c index c468df5..85c2bce 100644 --- a/src/game/tetromino/placing.c +++ b/src/game/tetromino/placing.c @@ -39,12 +39,15 @@ void tmp_set_all(GameData* game_data) { } void tmp_set_random(GameData* game_data) { - ShapeId id = rand() % TETROMINO_COUNT; - static int finished = 0; if (finished) return; finished = 1; - set_shape(game_data->row, shape_from_id(id), colour_from_id(id), 1, 1); + for (uint8_t y = 0; y <= ROWS - SHAPE_HEIGHT; y += SHAPE_HEIGHT) { + for (uint8_t x = 0; x <= COLUMNS - SHAPE_WIDTH; x += SHAPE_WIDTH) { + const ShapeId id = (rand() % TETROMINO_COUNT) ; + set_shape(game_data->row, shape_from_id(id), colour_from_id(id), x, y); + } + } } diff --git a/src/game/tetromino/shapes.h b/src/game/tetromino/shapes.h index 5808835..0c7eb37 100644 --- a/src/game/tetromino/shapes.h +++ b/src/game/tetromino/shapes.h @@ -21,8 +21,8 @@ enum { TETROMINO_ROTATED_270 = 24, }; -#define SHAPE_WIDTH ((uint8_t)(sizeof(Shape) * 8 / 2)) -#define SHAPE_HEIGHT ((uint8_t)(sizeof(Shape) * 8 / 2)) +#define SHAPE_WIDTH 4 +#define SHAPE_HEIGHT 4 #define TETROMINO_COUNT 7