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:
parent
ea8bbe3df6
commit
3325d99154
2 changed files with 145 additions and 86 deletions
|
|
@ -113,7 +113,7 @@ extern const fb_data brickmania_bricks[];
|
|||
#endif
|
||||
|
||||
int levels_num = 29;
|
||||
|
||||
|
||||
static unsigned char levels[29][8][10] = {
|
||||
{ /* level1 */
|
||||
{0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
|
||||
|
|
@ -137,20 +137,20 @@ static unsigned char levels[29][8][10] = {
|
|||
},
|
||||
{ /* level3 */
|
||||
{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},
|
||||
{0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0},
|
||||
{0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0},
|
||||
{0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6},
|
||||
{0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
|
||||
{0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
|
||||
{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}
|
||||
},
|
||||
{ /* level4 */
|
||||
{0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0},
|
||||
{0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0},
|
||||
{0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
|
||||
{0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
|
||||
{0x6,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x6},
|
||||
{0x0,0x0,0x0,0x27,0x27,0x27,0x27,0x0,0x0,0x0},
|
||||
{0x0,0x0,0x0,0x27,0x7,0x7,0x27,0x0,0x0,0x0},
|
||||
{0x22,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x22},
|
||||
{0x22,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x22},
|
||||
{0x26,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x26},
|
||||
{0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
|
||||
{0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0},
|
||||
{0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1}
|
||||
|
|
@ -160,10 +160,10 @@ static unsigned char levels[29][8][10] = {
|
|||
{0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0},
|
||||
{0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5},
|
||||
{0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5},
|
||||
{0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0},
|
||||
{0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6},
|
||||
{0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x6},
|
||||
{0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x6,0x0}
|
||||
{0x0,0x33,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0},
|
||||
{0x3,0x33,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x36},
|
||||
{0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x36},
|
||||
{0x0,0x24,0x24,0x0,0x25,0x25,0x0,0x26,0x26,0x0}
|
||||
},
|
||||
{ /* level6 */
|
||||
{0x0,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x0},
|
||||
|
|
@ -188,12 +188,12 @@ static unsigned char levels[29][8][10] = {
|
|||
{ /* level8 */
|
||||
{0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x0},
|
||||
{0x0,0x0,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x0},
|
||||
{0x6,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x6},
|
||||
{0x6,0x6,0x0,0x2,0x32,0x32,0x2,0x0,0x6,0x6},
|
||||
{0x0,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x0},
|
||||
{0x0,0x6,0x6,0x0,0x0,0x0,0x0,0x6,0x6,0x0},
|
||||
{0x0,0x0,0x0,0x5,0x5,0x5,0x5,0x0,0x0,0x0},
|
||||
{0x0,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x0},
|
||||
{0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5}
|
||||
{0x0,0x0,0x0,0x5,0x25,0x25,0x5,0x0,0x0,0x0},
|
||||
{0x0,0x5,0x5,0x25,0x5,0x5,0x25,0x5,0x5,0x0},
|
||||
{0x5,0x5,0x25,0x5,0x5,0x5,0x5,0x25,0x5,0x5}
|
||||
},
|
||||
{ /* level9 */
|
||||
{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,0x0,0x0,0x0,0x2,0x2,0x0,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,0x2,0x2,0x2,0x2,0x2,0x0,0x4},
|
||||
{0x4,0x0,0x6,0x1,0x5,0x5,0x1,0x6,0x0,0x4},
|
||||
{0x4,0x0,0x2,0x23,0x3,0x3,0x23,0x2,0x0,0x4},
|
||||
{0x4,0x0,0x2,0x22,0x2,0x2,0x22,0x2,0x0,0x4},
|
||||
{0x4,0x0,0x6,0x21,0x5,0x5,0x21,0x6,0x0,0x4},
|
||||
{0x4,0x6,0x1,0x1,0x5,0x5,0x1,0x1,0x6,0x4}
|
||||
},
|
||||
{/* level 15 */
|
||||
|
|
@ -306,14 +306,14 @@ static unsigned char levels[29][8][10] = {
|
|||
{0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0}
|
||||
},
|
||||
{ /* level 20 (Maze) by ts-x */
|
||||
{0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
|
||||
{0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x1,0x1},
|
||||
{0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1},
|
||||
{0x1,0x0,0x1,0x3,0x0,0x3,0x0,0x3,0x0,0x2},
|
||||
{0x1,0x0,0x1,0x1,0x0,0x1,0x0,0x0,0x0,0x0},
|
||||
{0x1,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0},
|
||||
{0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x2},
|
||||
{0x2,0x0,0x2,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,0x31,0x1},
|
||||
{0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x31,0x0,0x1},
|
||||
{0x21,0x0,0x21,0x3,0x0,0x3,0x0,0x3,0x0,0x2},
|
||||
{0x1,0x0,0x1,0x21,0x0,0x12,0x0,0x0,0x0,0x0},
|
||||
{0x31,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0},
|
||||
{0x1,0x0,0x1,0x0,0x1,0x1,0x31,0x1,0x1,0x2},
|
||||
{0x22,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x21}
|
||||
},
|
||||
{ /* level 21 (Dentist) by ts-x */
|
||||
{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}
|
||||
},
|
||||
{ /* 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},
|
||||
{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,0x0,0x0,0x1,0x1,0x0,0x0},
|
||||
{0x1,0x3,0x1,0x1,0x2,0x2,0x1,0x1,0x3,0x1},
|
||||
{0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0},
|
||||
{0x21,0x3,0x1,0x21,0x2,0x2,0x21,0x1,0x3,0x21},
|
||||
{0x0,0x0,0x0,0x1,0x21,0x1,0x1,0x0,0x0,0x0},
|
||||
{0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3}
|
||||
},
|
||||
{ /* level 23 (Pool) by ts-x */
|
||||
|
|
@ -357,13 +357,13 @@ static unsigned char levels[29][8][10] = {
|
|||
},
|
||||
{/* level 25 (Rainbow) by ts-x */
|
||||
{0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0},
|
||||
{0x4,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x4},
|
||||
{0x1,0x3,0x5,0x3,0x1,0x1,0x3,0x5,0x3,0x1},
|
||||
{0x24,0x1,0x3,0x1,0x0,0x0,0x21,0x3,0x1,0x24},
|
||||
{0x1,0x23,0x5,0x3,0x1,0x21,0x3,0x5,0x3,0x21},
|
||||
{0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3},
|
||||
{0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5},
|
||||
{0x6,0x7,0x2,0x7,0x6,0x6,0x7,0x2,0x7,0x6},
|
||||
{0x7,0x2,0x0,0x2,0x7,0x7,0x2,0x0,0x2,0x7},
|
||||
{0x2,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x2}
|
||||
{0x6,0x7,0x2,0x27,0x6,0x6,0x27,0x2,0x7,0x6},
|
||||
{0x7,0x2,0x0,0x2,0x27,0x27,0x2,0x0,0x2,0x7},
|
||||
{0x32,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x32}
|
||||
},
|
||||
{ /* level 26 (Bowtie) by ts-x */
|
||||
{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}
|
||||
},
|
||||
{ /* 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,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,0x1,0x0,0x6,0x6,0x0,0x1,0x0,0x5},
|
||||
{0x5,0x0,0x31,0x0,0x6,0x6,0x0,0x31,0x0,0x5},
|
||||
{0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5},
|
||||
{0x5,0x5,0x5,0x5,0x0,0x0,0x5,0x5,0x5,0x5},
|
||||
{0x0,0x5,0x5,0x0,0x4,0x4,0x0,0x5,0x5,0x0}
|
||||
{0x5,0x5,0x5,0x35,0x0,0x0,0x35,0x5,0x5,0x5},
|
||||
{0x0,0x25,0x5,0x0,0x4,0x4,0x0,0x5,0x25,0x0}
|
||||
},
|
||||
{ /* level 28 (DigDug) by ts-x */
|
||||
{0x5,0x5,0x5,0x5,0x0,0x5,0x5,0x5,0x5,0x5},
|
||||
{0x35,0x5,0x5,0x25,0x0,0x25,0x25,0x5,0x5,0x35},
|
||||
{0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6},
|
||||
{0x7,0x0,0x7,0x7,0x0,0x7,0x7,0x7,0x0,0x7},
|
||||
{0x7,0x0,0x37,0x37,0x0,0x37,0x37,0x7,0x0,0x7},
|
||||
{0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7},
|
||||
{0x4,0x4,0x4,0x4,0x0,0x4,0x4,0x0,0x0,0x4},
|
||||
{0x4,0x4,0x4,0x24,0x0,0x24,0x4,0x0,0x0,0x4},
|
||||
{0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4},
|
||||
{0x4,0x4,0x4,0x4,0x4,0x4,0x0,0x0,0x4,0x4},
|
||||
{0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}
|
||||
{0x24,0x24,0x4,0x4,0x4,0x4,0x0,0x0,0x24,0x4},
|
||||
{0x1,0x1,0x1,0x1,0x1,0x1,0x21,0x21,0x1,0x1}
|
||||
},
|
||||
{ /* TheEnd */
|
||||
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
|
||||
{0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0},
|
||||
{0x2,0x0,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0},
|
||||
{0x2,0x2,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0},
|
||||
{0x2,0x2,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0},
|
||||
{0x2,0x0,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0},
|
||||
{0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0},
|
||||
{0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
|
||||
{0x22,0x0,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
|
||||
{0x22,0x22,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
|
||||
{0x22,0x22,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
|
||||
{0x22,0x0,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
|
||||
{0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,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 on_the_pad=0; /* for glue pad */
|
||||
int score=0,vscore=0;
|
||||
|
||||
bool flip_sides=false;
|
||||
int cur_level=0;
|
||||
int brick_on_board=0;
|
||||
|
||||
|
|
@ -427,6 +427,7 @@ typedef struct cube {
|
|||
char poweruse;
|
||||
char used;
|
||||
int color;
|
||||
int hits;
|
||||
} cube;
|
||||
cube brick[80];
|
||||
|
||||
|
|
@ -446,7 +447,6 @@ static struct configdata config[] =
|
|||
{TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
void int_game(int new_game)
|
||||
{
|
||||
int i,j;
|
||||
|
|
@ -461,6 +461,8 @@ void int_game(int new_game)
|
|||
on_the_pad=0;
|
||||
balltempy=0;
|
||||
balltempx=0;
|
||||
flip_sides=false;
|
||||
|
||||
if (new_game==1)
|
||||
brick_on_board=0;
|
||||
|
||||
|
|
@ -470,15 +472,17 @@ void int_game(int new_game)
|
|||
if (i*10+j<=30) fire[i*10+j].top=-8;
|
||||
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].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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -682,10 +686,11 @@ int fire_space(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int dxball_game(void){
|
||||
int game_loop(void){
|
||||
int j,i,k,bricky,brickx;
|
||||
char s[20];
|
||||
|
||||
int sec_count=0,num_count=10;
|
||||
|
||||
rb->srand( *rb->current_tick );
|
||||
|
||||
configfile_init(rb);
|
||||
|
|
@ -708,15 +713,28 @@ int dxball_game(void){
|
|||
break;
|
||||
}
|
||||
|
||||
while(true) {
|
||||
while(true) {
|
||||
if (life >= 0) {
|
||||
rb->lcd_set_background(LCD_BLACK);
|
||||
rb->lcd_set_drawmode(DRMODE_SOLID);
|
||||
rb->lcd_clear_display();
|
||||
rb->lcd_set_background(LCD_BLACK);
|
||||
|
||||
/* write life num */
|
||||
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 */
|
||||
rb->snprintf(s, sizeof(s), "Life: %d", life);
|
||||
rb->lcd_putsxy(2, 2, s);
|
||||
|
||||
|
|
@ -734,6 +752,7 @@ int dxball_game(void){
|
|||
if (con_game== 1 && start_game!=1) {
|
||||
rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL);
|
||||
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue");
|
||||
sec_count=*rb->current_tick+HZ;
|
||||
}
|
||||
|
||||
/* draw the ball */
|
||||
|
|
@ -753,7 +772,7 @@ int dxball_game(void){
|
|||
/* the bricks */
|
||||
for (i=0;i<=7;i++) {
|
||||
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 (con_game!=1)
|
||||
brick[i*10+j].powertop+=2;
|
||||
|
|
@ -790,7 +809,14 @@ int dxball_game(void){
|
|||
score+=23;
|
||||
pad_type=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;
|
||||
}
|
||||
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)){
|
||||
score+=13;
|
||||
fire[k].top=-16;
|
||||
brick[i*10+j].used=0;
|
||||
if (brick[i*10+j].power!=10) brick[i*10+j].poweruse=2;
|
||||
brick_on_board--;
|
||||
if (brick[i*10+j].hits > 0){
|
||||
brick[i*10+j].hits--;
|
||||
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 */
|
||||
brick[i*10+j].used=0;
|
||||
bally = bally*-1;
|
||||
if (brick[i*10+j].power!=10) {
|
||||
brick[i*10+j].poweruse=2;
|
||||
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;
|
||||
}
|
||||
} 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 */
|
||||
brick[i*10+j].used=0;
|
||||
|
||||
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;
|
||||
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 */
|
||||
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;
|
||||
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 */
|
||||
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;
|
||||
if (brick[i*10+j].power!=10)
|
||||
brick[i*10+j].poweruse=2;
|
||||
}
|
||||
|
||||
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);
|
||||
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 (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;
|
||||
|
|
@ -989,7 +1048,7 @@ int dxball_game(void){
|
|||
ball_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 (start_game==1 || on_the_pad==1) ball_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);
|
||||
|
||||
/* now go ahead and have fun! */
|
||||
while (dxball_game()!=1);
|
||||
while (game_loop()!=1);
|
||||
|
||||
configfile_save(HIGH_SCORE,config,1,0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue