1
0
Fork 0
forked from len0rd/rockbox

Patch #1415757 by Ben Basha - Brickmania update, Flip powerup plus some bricks need several hits to break

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8461 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2006-01-26 23:31:00 +00:00
parent ea8bbe3df6
commit 3325d99154
2 changed files with 145 additions and 86 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,014 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

@ -137,20 +137,20 @@ static unsigned char levels[29][8][10] = {
}, },
{ /* level3 */ { /* level3 */
{0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
{0x3,0x23,0x23,0x3,0x0,0x0,0x2,0x22,0x22,0x2},
{0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
{0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
{0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0}, {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
{0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0},
{0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6},
{0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}, {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6},
{0x5,0x25,0x25,0x5,0x0,0x0,0x6,0x26,0x26,0x6},
{0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6} {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}
}, },
{ /* level4 */ { /* level4 */
{0x0,0x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0x5,0x5,0x5,0x5,0x5} {0x5,0x5,0x25,0x5,0x5,0x5,0x5,0x25,0x5,0x5}
}, },
{ /* level9 */ { /* level9 */
{0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
@ -250,9 +250,9 @@ static unsigned char levels[29][8][10] = {
{0x4,0x4,0x4,0x4,0x2,0x2,0x4,0x4,0x4,0x4}, {0x4,0x4,0x4,0x4,0x2,0x2,0x4,0x4,0x4,0x4},
{0x4,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x4}, {0x4,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x4},
{0x4,0x0,0x0,0x2,0x3,0x3,0x2,0x0,0x0,0x4}, {0x4,0x0,0x0,0x2,0x3,0x3,0x2,0x0,0x0,0x4},
{0x4,0x0,0x2,0x3,0x3,0x3,0x3,0x2,0x0,0x4}, {0x4,0x0,0x2,0x23,0x3,0x3,0x23,0x2,0x0,0x4},
{0x4,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x4}, {0x4,0x0,0x2,0x22,0x2,0x2,0x22,0x2,0x0,0x4},
{0x4,0x0,0x6,0x1,0x5,0x5,0x1,0x6,0x0,0x4}, {0x4,0x0,0x6,0x21,0x5,0x5,0x21,0x6,0x0,0x4},
{0x4,0x6,0x1,0x1,0x5,0x5,0x1,0x1,0x6,0x4} {0x4,0x6,0x1,0x1,0x5,0x5,0x1,0x1,0x6,0x4}
}, },
{/* level 15 */ {/* level 15 */
@ -306,14 +306,14 @@ static unsigned char levels[29][8][10] = {
{0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0} {0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0}
}, },
{ /* level 20 (Maze) by ts-x */ { /* level 20 (Maze) by ts-x */
{0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, {0x1,0x1,0x21,0x1,0x1,0x1,0x1,0x1,0x1,0x21},
{0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x1,0x1}, {0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x31,0x1},
{0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1}, {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x31,0x0,0x1},
{0x1,0x0,0x1,0x3,0x0,0x3,0x0,0x3,0x0,0x2}, {0x21,0x0,0x21,0x3,0x0,0x3,0x0,0x3,0x0,0x2},
{0x1,0x0,0x1,0x1,0x0,0x1,0x0,0x0,0x0,0x0}, {0x1,0x0,0x1,0x21,0x0,0x12,0x0,0x0,0x0,0x0},
{0x1,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0}, {0x31,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0},
{0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x2}, {0x1,0x0,0x1,0x0,0x1,0x1,0x31,0x1,0x1,0x2},
{0x2,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x1} {0x22,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x21}
}, },
{ /* level 21 (Dentist) by ts-x */ { /* level 21 (Dentist) by ts-x */
{0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}, {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0},
@ -326,13 +326,13 @@ static unsigned char levels[29][8][10] = {
{0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0} {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}
}, },
{ /* level 22 (Spider) by ts-x */ { /* level 22 (Spider) by ts-x */
{0x1,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x1}, {0x31,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x31},
{0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
{0x3,0x1,0x1,0x6,0x1,0x1,0x6,0x1,0x1,0x3}, {0x33,0x1,0x1,0x36,0x1,0x1,0x36,0x1,0x1,0x33},
{0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
{0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0}, {0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0},
{0x1,0x3,0x1,0x1,0x2,0x2,0x1,0x1,0x3,0x1}, {0x21,0x3,0x1,0x21,0x2,0x2,0x21,0x1,0x3,0x21},
{0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0}, {0x0,0x0,0x0,0x1,0x21,0x1,0x1,0x0,0x0,0x0},
{0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3} {0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3}
}, },
{ /* level 23 (Pool) by ts-x */ { /* level 23 (Pool) by ts-x */
@ -357,13 +357,13 @@ static unsigned char levels[29][8][10] = {
}, },
{/* level 25 (Rainbow) by ts-x */ {/* level 25 (Rainbow) by ts-x */
{0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0}, {0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0},
{0x4,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x4}, {0x24,0x1,0x3,0x1,0x0,0x0,0x21,0x3,0x1,0x24},
{0x1,0x3,0x5,0x3,0x1,0x1,0x3,0x5,0x3,0x1}, {0x1,0x23,0x5,0x3,0x1,0x21,0x3,0x5,0x3,0x21},
{0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3}, {0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3},
{0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5}, {0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5},
{0x6,0x7,0x2,0x7,0x6,0x6,0x7,0x2,0x7,0x6}, {0x6,0x7,0x2,0x27,0x6,0x6,0x27,0x2,0x7,0x6},
{0x7,0x2,0x0,0x2,0x7,0x7,0x2,0x0,0x2,0x7}, {0x7,0x2,0x0,0x2,0x27,0x27,0x2,0x0,0x2,0x7},
{0x2,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x2} {0x32,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x32}
}, },
{ /* level 26 (Bowtie) by ts-x */ { /* level 26 (Bowtie) by ts-x */
{0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}, {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5},
@ -376,33 +376,33 @@ static unsigned char levels[29][8][10] = {
{0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5} {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}
}, },
{ /* level 27 (Frog) by ts-x */ { /* level 27 (Frog) by ts-x */
{0x0,0x5,0x5,0x0,0x0,0x0,0x0,0x5,0x5,0x0}, {0x0,0x5,0x25,0x0,0x0,0x0,0x0,0x25,0x5,0x0},
{0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5}, {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
{0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5}, {0x25,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x25},
{0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5}, {0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5},
{0x5,0x0,0x1,0x0,0x6,0x6,0x0,0x1,0x0,0x5}, {0x5,0x0,0x31,0x0,0x6,0x6,0x0,0x31,0x0,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0,0x0,0x0,0x0}, {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
{0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0}, {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
{0x2,0x0,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0}, {0x22,0x0,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
{0x2,0x2,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0}, {0x22,0x22,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
{0x2,0x2,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0}, {0x22,0x22,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
{0x2,0x0,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0}, {0x22,0x0,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
{0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0}, {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
} }
}; };
@ -417,7 +417,7 @@ int start_game,con_game;
int pad_type; int pad_type;
int on_the_pad=0; /* for glue pad */ int on_the_pad=0; /* for glue pad */
int score=0,vscore=0; int score=0,vscore=0;
bool flip_sides=false;
int cur_level=0; int cur_level=0;
int brick_on_board=0; int brick_on_board=0;
@ -427,6 +427,7 @@ typedef struct cube {
char poweruse; char poweruse;
char used; char used;
int color; int color;
int hits;
} cube; } cube;
cube brick[80]; cube brick[80];
@ -446,7 +447,6 @@ static struct configdata config[] =
{TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL} {TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL}
}; };
void int_game(int new_game) void int_game(int new_game)
{ {
int i,j; int i,j;
@ -461,6 +461,8 @@ void int_game(int new_game)
on_the_pad=0; on_the_pad=0;
balltempy=0; balltempy=0;
balltempx=0; balltempx=0;
flip_sides=false;
if (new_game==1) if (new_game==1)
brick_on_board=0; brick_on_board=0;
@ -470,11 +472,13 @@ void int_game(int new_game)
if (i*10+j<=30) fire[i*10+j].top=-8; if (i*10+j<=30) fire[i*10+j].top=-8;
if (new_game==1) { if (new_game==1) {
brick[i*10+j].power=rb->rand()%17; brick[i*10+j].power=rb->rand()%25; /* +8 make the game with less powerups */
brick[i*10+j].hits=levels[cur_level][i][j]>=10?
levels[cur_level][i][j]/16-1:0;
brick[i*10+j].powertop=30+i*10+BRICK_HEIGHT; brick[i*10+j].powertop=30+i*10+BRICK_HEIGHT;
brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1); brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1);
brick[i*10+j].color=levels[cur_level][i][j]-1; brick[i*10+j].color=(levels[cur_level][i][j]>=10?
levels[cur_level][i][j]%16:levels[cur_level][i][j])-1;
if (levels[cur_level][i][j]!=0) brick_on_board++; if (levels[cur_level][i][j]!=0) brick_on_board++;
} }
} }
@ -682,9 +686,10 @@ int fire_space(void)
return NULL; return NULL;
} }
int dxball_game(void){ int game_loop(void){
int j,i,k,bricky,brickx; int j,i,k,bricky,brickx;
char s[20]; char s[20];
int sec_count=0,num_count=10;
rb->srand( *rb->current_tick ); rb->srand( *rb->current_tick );
@ -714,9 +719,22 @@ int dxball_game(void){
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_set_background(LCD_BLACK); rb->lcd_set_background(LCD_BLACK);
rb->lcd_set_foreground(LCD_WHITE);
if (flip_sides) {
if (*rb->current_tick>=sec_count){
sec_count=*rb->current_tick+HZ;
if (num_count!=0)
num_count--;
else
flip_sides=false;
}
rb->snprintf(s, sizeof(s), "%d", num_count);
rb->lcd_getstringsize(s, &sw, NULL);
rb->lcd_putsxy(LCD_WIDTH/2-2, 150, s);
}
/* write life num */ /* write life num */
rb->lcd_set_foreground(LCD_WHITE);
rb->snprintf(s, sizeof(s), "Life: %d", life); rb->snprintf(s, sizeof(s), "Life: %d", life);
rb->lcd_putsxy(2, 2, s); rb->lcd_putsxy(2, 2, s);
@ -734,6 +752,7 @@ int dxball_game(void){
if (con_game== 1 && start_game!=1) { if (con_game== 1 && start_game!=1) {
rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL); rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL);
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue"); rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue");
sec_count=*rb->current_tick+HZ;
} }
/* draw the ball */ /* draw the ball */
@ -753,7 +772,7 @@ int dxball_game(void){
/* the bricks */ /* the bricks */
for (i=0;i<=7;i++) { for (i=0;i<=7;i++) {
for (j=0;j<=9;j++) { for (j=0;j<=9;j++) {
if (brick[i*10+j].power<5) { if (brick[i*10+j].power<6) {
if (brick[i*10+j].poweruse==2) { if (brick[i*10+j].poweruse==2) {
if (con_game!=1) if (con_game!=1)
brick[i*10+j].powertop+=2; brick[i*10+j].powertop+=2;
@ -790,6 +809,13 @@ int dxball_game(void){
score+=23; score+=23;
pad_type=0; pad_type=0;
on_the_pad=0; on_the_pad=0;
flip_sides=false;
break;
case 5:
score+=23;
sec_count=*rb->current_tick+HZ;
num_count=10;
flip_sides=!flip_sides;
break; break;
} }
brick[i*10+j].poweruse=1; brick[i*10+j].poweruse=1;
@ -806,9 +832,15 @@ int dxball_game(void){
if (brick[i*10+j].used==1 && (fire[k].left+1 >= brickx && fire[k].left+1 <= brickx+BRICK_WIDTH) && (bricky+BRICK_HEIGHT>fire[k].top)){ if (brick[i*10+j].used==1 && (fire[k].left+1 >= brickx && fire[k].left+1 <= brickx+BRICK_WIDTH) && (bricky+BRICK_HEIGHT>fire[k].top)){
score+=13; score+=13;
fire[k].top=-16; fire[k].top=-16;
brick[i*10+j].used=0; if (brick[i*10+j].hits > 0){
if (brick[i*10+j].power!=10) brick[i*10+j].poweruse=2; brick[i*10+j].hits--;
brick_on_board--; score+=3;
}
else {
brick[i*10+j].used=0;
if (brick[i*10+j].power!=10) brick[i*10+j].poweruse=2;
brick_on_board--;
}
} }
} }
} }
@ -831,28 +863,55 @@ int dxball_game(void){
} }
if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky+BRICK_HEIGHT==ball_pos_y) || (bricky+BRICK_HEIGHT-6<=ball_pos_y && bricky+BRICK_HEIGHT>ball_pos_y)) && (bally <0)) { /* bottom line */ if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky+BRICK_HEIGHT==ball_pos_y) || (bricky+BRICK_HEIGHT-6<=ball_pos_y && bricky+BRICK_HEIGHT>ball_pos_y)) && (bally <0)) { /* bottom line */
brick[i*10+j].used=0; if (brick[i*10+j].hits > 0){
bally = bally*-1; brick[i*10+j].hits--;
if (brick[i*10+j].power!=10) { score+=2;
brick[i*10+j].poweruse=2;
} }
} else if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky==ball_pos_y+BALL) || (bricky+6>=ball_pos_y+BALL && bricky<ball_pos_y+BALL)) && (bally >0)) { /* top line */ else {
brick[i*10+j].used=0; brick[i*10+j].used=0;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
}
bally = bally*-1;
} else if ((ball_pos_x+3 >= brickx && ball_pos_x+3 <= brickx+BRICK_WIDTH) && ((bricky==ball_pos_y+BALL) || (bricky+6>=ball_pos_y+BALL && bricky<ball_pos_y+BALL)) && (bally >0)) { /* top line */
if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--;
score+=2;
}
else {
brick[i*10+j].used=0;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
}
bally = bally*-1; bally = bally*-1;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
} }
if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx==ball_pos_x+BALL) || (brickx+6>=ball_pos_x+BALL && brickx<ball_pos_x+BALL)) && (ballx > 0)) { /* left line */ if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx==ball_pos_x+BALL) || (brickx+6>=ball_pos_x+BALL && brickx<ball_pos_x+BALL)) && (ballx > 0)) { /* left line */
brick[i*10+j].used=0; if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--;
score+=2;
}
else {
brick[i*10+j].used=0;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
}
ballx = ballx*-1; ballx = ballx*-1;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
} else if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx+BRICK_WIDTH==ball_pos_x) || (brickx+BRICK_WIDTH-6<=ball_pos_x && brickx+BRICK_WIDTH>ball_pos_x)) && (ballx < 0)) { /* Right line */ } else if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx+BRICK_WIDTH==ball_pos_x) || (brickx+BRICK_WIDTH-6<=ball_pos_x && brickx+BRICK_WIDTH>ball_pos_x)) && (ballx < 0)) { /* Right line */
brick[i*10+j].used=0; if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--;
score+=2;
}
else {
brick[i*10+j].used=0;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
}
ballx = ballx*-1; ballx = ballx*-1;
if (brick[i*10+j].power!=10)
brick[i*10+j].poweruse=2;
} }
if (brick[i*10+j].used==0){ if (brick[i*10+j].used==0){
@ -980,7 +1039,7 @@ int dxball_game(void){
button=rb->button_get_w_tmo(end - *rb->current_tick); button=rb->button_get_w_tmo(end - *rb->current_tick);
move_button=rb->button_status(); move_button=rb->button_status();
if (move_button & RIGHT) { if ((move_button & RIGHT && flip_sides==false) || (flip_sides==true && move_button & LEFT)) {
if (pad_pos_x+8+PAD_WIDTH > LCD_WIDTH) { if (pad_pos_x+8+PAD_WIDTH > LCD_WIDTH) {
if (start_game==1 || on_the_pad==1) ball_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH; if (start_game==1 || on_the_pad==1) ball_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH;
pad_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH; pad_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH;
@ -989,7 +1048,7 @@ int dxball_game(void){
ball_pos_x+=8; ball_pos_x+=8;
pad_pos_x+=8; pad_pos_x+=8;
} }
} else if (move_button & LEFT) { } else if ((move_button & LEFT && flip_sides==false) || (flip_sides==true && move_button & RIGHT)) {
if (pad_pos_x-8 < 0) { if (pad_pos_x-8 < 0) {
if (start_game==1 || on_the_pad==1) ball_pos_x-=pad_pos_x; if (start_game==1 || on_the_pad==1) ball_pos_x-=pad_pos_x;
pad_pos_x-=pad_pos_x; pad_pos_x-=pad_pos_x;
@ -1101,7 +1160,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->backlight_set_timeout(1); rb->backlight_set_timeout(1);
/* now go ahead and have fun! */ /* now go ahead and have fun! */
while (dxball_game()!=1); while (game_loop()!=1);
configfile_save(HIGH_SCORE,config,1,0); configfile_save(HIGH_SCORE,config,1,0);