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)
downloadrockbox-575cb63a929b00c84d1b8615ce78db18420ef600.tar.gz
rockbox-575cb63a929b00c84d1b8615ce78db18420ef600.zip
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
753 int cf; 753 int cf;
754 int co; 754 int co;
755 int nf; 755 int nf;
756 bool dropped;
756 short board[BOARD_HEIGHT][BOARD_WIDTH]; /* 20 rows of 10 blocks */ 757 short board[BOARD_HEIGHT][BOARD_WIDTH]; /* 20 rows of 10 blocks */
757} rockblox_status; 758} rockblox_status;
758 759
@@ -1234,7 +1235,7 @@ static void draw_next_block (void)
1234/* move the block to a relative location */ 1235/* move the block to a relative location */
1235static void move_block (int x, int y, int o) 1236static void move_block (int x, int y, int o)
1236{ 1237{
1237 if (canMoveTo (rockblox_status.cx + x, rockblox_status.cy + y, o)) { 1238 if (!rockblox_status.dropped && canMoveTo (rockblox_status.cx + x, rockblox_status.cy + y, o)) {
1238 rockblox_status.cy += y; 1239 rockblox_status.cy += y;
1239 rockblox_status.cx += x; 1240 rockblox_status.cx += x;
1240 rockblox_status.co = o; 1241 rockblox_status.co = o;
@@ -1251,6 +1252,7 @@ static void new_block (void)
1251 rockblox_status.nf = t_rand (BLOCKS_NUM); 1252 rockblox_status.nf = t_rand (BLOCKS_NUM);
1252 rockblox_status.gameover = !canMoveTo (rockblox_status.cx, 1253 rockblox_status.gameover = !canMoveTo (rockblox_status.cx,
1253 rockblox_status.cy, rockblox_status.co); 1254 rockblox_status.cy, rockblox_status.co);
1255 rockblox_status.dropped = false;
1254 1256
1255 draw_next_block (); 1257 draw_next_block ();
1256} 1258}
@@ -1511,6 +1513,7 @@ static int rockblox_loop (void)
1511#endif 1513#endif
1512 while (canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co)) 1514 while (canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co))
1513 move_block (0, 1, rockblox_status.co); 1515 move_block (0, 1, rockblox_status.co);
1516 rockblox_status.dropped = true;
1514 break; 1517 break;
1515#ifdef ROCKBLOX_RESTART 1518#ifdef ROCKBLOX_RESTART
1516 case ROCKBLOX_RESTART: 1519 case ROCKBLOX_RESTART: