From 70467cf2a7ab58e58723708be77ed31cc4aa33bd Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sun, 19 May 2024 21:53:57 +0200 Subject: [PATCH] also random very first stone --- game-ctrl/shapes.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/game-ctrl/shapes.c b/game-ctrl/shapes.c index 1e8e503..194e6b2 100644 --- a/game-ctrl/shapes.c +++ b/game-ctrl/shapes.c @@ -354,14 +354,18 @@ const orientation_t nextOrientation[5][4] = { // 5 = number of directions to mov stone_t stone; shape_t nextShape; +static shape_t randomNextShape() { + return ((shape_t[]){ e_I, e_O, e_T, e_Z, e_S, e_L, e_J })[myRandGet() % e_ShapeInvalid]; +} + void shapesInit() { stone.shape = e_ShapeInvalid; - nextShape = e_Z; + nextShape = randomNextShape(); } void stoneCreate() { stone.shape = nextShape; - nextShape = ((shape_t[]){ e_I, e_O, e_T, e_Z, e_S, e_L, e_J })[myRandGet() % e_ShapeInvalid]; + nextShape = randomNextShape(); stone.orientation = e_0; stone.x = 4; stone.y = 0;