summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Zerzouri <maxdamantus@gmail.com>2013-05-18 19:28:40 +1200
committerThomas Martitz <kugel@rockbox.org>2013-06-09 21:44:01 +0200
commit575cb63a929b00c84d1b8615ce78db18420ef600 (patch)
tree25c2c8c7928e0ca35b5bf52e85c86039776162ed
parent4263f67e4b556607ad4c49915f90ddb11e5a3d92 (diff)
Fix rockblox instadrop behaviour
Prevents the player from moving an instadropped block (could happen before the next game tick when using left/right buttons anticipatorily). Change-Id: Id62168842d8458f864a2e05c5d236f054bf54f65 Reviewed-on: http://gerrit.rockbox.org/473 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
-rw-r--r--apps/plugins/rockblox.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 6676ace8b1..025e3b4e25 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -753,6 +753,7 @@ static struct _rockblox_status
int cf;
int co;
int nf;
+ bool dropped;
short board[BOARD_HEIGHT][BOARD_WIDTH]; /* 20 rows of 10 blocks */
} rockblox_status;
@@ -1234,7 +1235,7 @@ static void draw_next_block (void)
/* move the block to a relative location */
static void move_block (int x, int y, int o)
{
- if (canMoveTo (rockblox_status.cx + x, rockblox_status.cy + y, o)) {
+ if (!rockblox_status.dropped && canMoveTo (rockblox_status.cx + x, rockblox_status.cy + y, o)) {
rockblox_status.cy += y;
rockblox_status.cx += x;
rockblox_status.co = o;
@@ -1251,6 +1252,7 @@ static void new_block (void)
rockblox_status.nf = t_rand (BLOCKS_NUM);
rockblox_status.gameover = !canMoveTo (rockblox_status.cx,
rockblox_status.cy, rockblox_status.co);
+ rockblox_status.dropped = false;
draw_next_block ();
}
@@ -1511,6 +1513,7 @@ static int rockblox_loop (void)
#endif
while (canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co))
move_block (0, 1, rockblox_status.co);
+ rockblox_status.dropped = true;
break;
#ifdef ROCKBLOX_RESTART
case ROCKBLOX_RESTART: