summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-03-27 18:17:58 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-03-27 18:17:58 +0000
commit8e8d2c2a5b9550307f97e4396cacdfd00caabf21 (patch)
treec743f16b4862f261b94e8548928083a833a6920b /apps/plugins
parentbe730dce0ccb9ce5c848b7295f5f81493470a5bd (diff)
downloadrockbox-8e8d2c2a5b9550307f97e4396cacdfd00caabf21.tar.gz
rockbox-8e8d2c2a5b9550307f97e4396cacdfd00caabf21.zip
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
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/brickmania.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index a28eaf084f..a4adcc29d0 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -2238,7 +2238,7 @@ static int brickmania_game_loop(void)
2238 else 2238 else
2239#endif 2239#endif
2240 { 2240 {
2241 int button_right, button_left; 2241 int button_right, button_left, dx;
2242#ifdef ALTRIGHT 2242#ifdef ALTRIGHT
2243 button_right = move_button & (RIGHT | ALTRIGHT); 2243 button_right = move_button & (RIGHT | ALTRIGHT);
2244 button_left = move_button & (LEFT | ALTLEFT); 2244 button_left = move_button & (LEFT | ALTLEFT);
@@ -2248,40 +2248,31 @@ static int brickmania_game_loop(void)
2248#endif 2248#endif
2249 if ((game_state==ST_PAUSE) && (button_right || button_left)) 2249 if ((game_state==ST_PAUSE) && (button_right || button_left))
2250 continue; 2250 continue;
2251 if ((button_right && !flip_sides) || 2251
2252 (button_left && flip_sides)) 2252 if (button_left || button_right)
2253 { 2253 {
2254 if (pad_pos_x+SPEED_PAD+pad_width > GAMESCREEN_WIDTH) 2254 if ((button_right && !flip_sides) ||
2255 (button_left && flip_sides))
2255 { 2256 {
2256 for(k=0;k<used_balls;k++) 2257 if (pad_pos_x+SPEED_PAD+pad_width > GAMESCREEN_WIDTH)
2257 if (game_state==ST_READY || ball[k].glue) 2258 dx = GAMESCREEN_WIDTH - pad_pos_x - pad_width;
2258 ball[k].pos_x += GAMESCREEN_WIDTH-pad_pos_x - 2259 else
2259 pad_width; 2260 dx = SPEED_PAD;
2260 pad_pos_x += GAMESCREEN_WIDTH - pad_pos_x - pad_width;
2261 }
2262 else {
2263 for(k=0;k<used_balls;k++)
2264 if ((game_state==ST_READY || ball[k].glue))
2265 ball[k].pos_x+=SPEED_PAD;
2266 pad_pos_x+=SPEED_PAD;
2267 } 2261 }
2268 } 2262 else if ((button_left && !flip_sides) ||
2269 else if ((button_left && !flip_sides) || 2263 (button_right && flip_sides))
2270 (button_right && flip_sides))
2271 {
2272 if (pad_pos_x-SPEED_PAD < 0)
2273 { 2264 {
2274 for(k=0;k<used_balls;k++) 2265 if (pad_pos_x-SPEED_PAD < 0)
2275 if (game_state==ST_READY || ball[k].glue) 2266 dx = -pad_pos_x;
2276 ball[k].pos_x-=pad_pos_x; 2267 else
2277 pad_pos_x -= pad_pos_x; 2268 dx = -SPEED_PAD;
2278 } 2269 }
2279 else 2270
2271 pad_pos_x+=dx;
2272 for(k=0;k<used_balls;k++)
2280 { 2273 {
2281 for(k=0;k<used_balls;k++) 2274 if (game_state==ST_READY || ball[k].glue)
2282 if (game_state==ST_READY || ball[k].glue) 2275 ball[k].pos_x+=dx;
2283 ball[k].pos_x-=SPEED_PAD;
2284 pad_pos_x-=SPEED_PAD;
2285 } 2276 }
2286 } 2277 }
2287 } 2278 }