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>
This commit is contained in:
parent
4263f67e4b
commit
575cb63a92
1 changed files with 4 additions and 1 deletions
|
@ -753,6 +753,7 @@ static struct _rockblox_status
|
||||||
int cf;
|
int cf;
|
||||||
int co;
|
int co;
|
||||||
int nf;
|
int nf;
|
||||||
|
bool dropped;
|
||||||
short board[BOARD_HEIGHT][BOARD_WIDTH]; /* 20 rows of 10 blocks */
|
short board[BOARD_HEIGHT][BOARD_WIDTH]; /* 20 rows of 10 blocks */
|
||||||
} rockblox_status;
|
} rockblox_status;
|
||||||
|
|
||||||
|
@ -1234,7 +1235,7 @@ static void draw_next_block (void)
|
||||||
/* move the block to a relative location */
|
/* move the block to a relative location */
|
||||||
static void move_block (int x, int y, int o)
|
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.cy += y;
|
||||||
rockblox_status.cx += x;
|
rockblox_status.cx += x;
|
||||||
rockblox_status.co = o;
|
rockblox_status.co = o;
|
||||||
|
@ -1251,6 +1252,7 @@ static void new_block (void)
|
||||||
rockblox_status.nf = t_rand (BLOCKS_NUM);
|
rockblox_status.nf = t_rand (BLOCKS_NUM);
|
||||||
rockblox_status.gameover = !canMoveTo (rockblox_status.cx,
|
rockblox_status.gameover = !canMoveTo (rockblox_status.cx,
|
||||||
rockblox_status.cy, rockblox_status.co);
|
rockblox_status.cy, rockblox_status.co);
|
||||||
|
rockblox_status.dropped = false;
|
||||||
|
|
||||||
draw_next_block ();
|
draw_next_block ();
|
||||||
}
|
}
|
||||||
|
@ -1511,6 +1513,7 @@ static int rockblox_loop (void)
|
||||||
#endif
|
#endif
|
||||||
while (canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co))
|
while (canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co))
|
||||||
move_block (0, 1, rockblox_status.co);
|
move_block (0, 1, rockblox_status.co);
|
||||||
|
rockblox_status.dropped = true;
|
||||||
break;
|
break;
|
||||||
#ifdef ROCKBLOX_RESTART
|
#ifdef ROCKBLOX_RESTART
|
||||||
case ROCKBLOX_RESTART:
|
case ROCKBLOX_RESTART:
|
||||||
|
|
Loading…
Reference in a new issue