1
0
Fork 0
forked from len0rd/rockbox

Brickmania: Hopefully prevent dissappearing of the ball

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24810 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomer Shalev 2010-02-21 17:16:07 +00:00
parent 3dc9d111b3
commit cd08122e4e

View file

@ -1851,14 +1851,15 @@ static int brickmania_game_loop(void)
} }
} }
if (game_state != ST_READY && !ball[k].glue)
{
/* Check if the ball hit the left side */ /* Check if the ball hit the left side */
screen_edge.p1.x = 0; screen_edge.p1.x = 0;
screen_edge.p1.y = 0; screen_edge.p1.y = 0;
screen_edge.p2.x = 0; screen_edge.p2.x = 0;
screen_edge.p2.y = GAMESCREEN_HEIGHT; screen_edge.p2.y = GAMESCREEN_HEIGHT;
if ( !ball[k].glue && if (check_lines(&misc_line, &screen_edge, &pt_hit))
check_lines(&misc_line, &screen_edge, &pt_hit))
{ {
/* Reverse direction */ /* Reverse direction */
ball[k].speedx = -ball[k].speedx; ball[k].speedx = -ball[k].speedx;
@ -1874,8 +1875,7 @@ static int brickmania_game_loop(void)
screen_edge.p2.x = GAMESCREEN_WIDTH; screen_edge.p2.x = GAMESCREEN_WIDTH;
screen_edge.p2.y = GAMESCREEN_HEIGHT; screen_edge.p2.y = GAMESCREEN_HEIGHT;
if ( !ball[k].glue && if (check_lines(&misc_line, &screen_edge, &pt_hit))
check_lines(&misc_line, &screen_edge, &pt_hit))
{ {
/* Reverse direction */ /* Reverse direction */
ball[k].speedx = -ball[k].speedx; ball[k].speedx = -ball[k].speedx;
@ -1888,8 +1888,7 @@ static int brickmania_game_loop(void)
/* Did the ball hit the paddle? Depending on where the ball /* Did the ball hit the paddle? Depending on where the ball
* Hit set the x/y speed appropriately. * Hit set the x/y speed appropriately.
*/ */
if( game_state!=ST_READY && !ball[k].glue && if(check_lines(&misc_line, &pad_line, &pt_hit) )
check_lines(&misc_line, &pad_line, &pt_hit) )
{ {
/* Re-position ball based on collision */ /* Re-position ball based on collision */
ball[k].tempy = ON_PAD_POS_Y; ball[k].tempy = ON_PAD_POS_Y;
@ -1974,6 +1973,7 @@ static int brickmania_game_loop(void)
ball[k].tempy = ON_PAD_POS_Y; ball[k].tempy = ON_PAD_POS_Y;
} }
} }
}
/* Update the ball position */ /* Update the ball position */
if (!ball[k].glue) if (!ball[k].glue)