diff options
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/plugins/brickmania.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index a28eaf0..a4adcc2 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -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; - } - 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; + if (pad_pos_x+SPEED_PAD+pad_width > GAMESCREEN_WIDTH) + dx = GAMESCREEN_WIDTH - pad_pos_x - pad_width; + else + dx = 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; } } } |