1
0
Fork 0
forked from len0rd/rockbox

Brickmania: Simplify movement of pad (and any balls that are sticked to it)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25356 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomer Shalev 2010-03-27 18:17:58 +00:00
parent be730dce0c
commit 8e8d2c2a5b

View file

@ -2238,7 +2238,7 @@ static int brickmania_game_loop(void)
else
#endif
{
int button_right, button_left;
int button_right, button_left, dx;
#ifdef ALTRIGHT
button_right = move_button & (RIGHT | ALTRIGHT);
button_left = move_button & (LEFT | ALTLEFT);
@ -2248,40 +2248,31 @@ static int brickmania_game_loop(void)
#endif
if ((game_state==ST_PAUSE) && (button_right || button_left))
continue;
if ((button_right && !flip_sides) ||
(button_left && flip_sides))
if (button_left || button_right)
{
if (pad_pos_x+SPEED_PAD+pad_width > GAMESCREEN_WIDTH)
if ((button_right && !flip_sides) ||
(button_left && flip_sides))
{
for(k=0;k<used_balls;k++)
if (game_state==ST_READY || ball[k].glue)
ball[k].pos_x += GAMESCREEN_WIDTH-pad_pos_x -
pad_width;
pad_pos_x += GAMESCREEN_WIDTH - pad_pos_x - pad_width;
if (pad_pos_x+SPEED_PAD+pad_width > GAMESCREEN_WIDTH)
dx = GAMESCREEN_WIDTH - pad_pos_x - pad_width;
else
dx = SPEED_PAD;
}
else {
for(k=0;k<used_balls;k++)
if ((game_state==ST_READY || ball[k].glue))
ball[k].pos_x+=SPEED_PAD;
pad_pos_x+=SPEED_PAD;
}
}
else if ((button_left && !flip_sides) ||
(button_right && flip_sides))
{
if (pad_pos_x-SPEED_PAD < 0)
else if ((button_left && !flip_sides) ||
(button_right && flip_sides))
{
for(k=0;k<used_balls;k++)
if (game_state==ST_READY || ball[k].glue)
ball[k].pos_x-=pad_pos_x;
pad_pos_x -= pad_pos_x;
if (pad_pos_x-SPEED_PAD < 0)
dx = -pad_pos_x;
else
dx = -SPEED_PAD;
}
else
pad_pos_x+=dx;
for(k=0;k<used_balls;k++)
{
for(k=0;k<used_balls;k++)
if (game_state==ST_READY || ball[k].glue)
ball[k].pos_x-=SPEED_PAD;
pad_pos_x-=SPEED_PAD;
if (game_state==ST_READY || ball[k].glue)
ball[k].pos_x+=dx;
}
}
}