1
0
Fork 0
forked from len0rd/rockbox

Add break effect + Bigger bricks

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8526 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Ben Basha 2006-02-01 18:25:24 +00:00
parent f5f000fe03
commit db83601b3c
6 changed files with 24 additions and 6 deletions

View file

@ -119,6 +119,8 @@ static const struct plugin_api rockbox_api = {
lcd_get_background, lcd_get_background,
lcd_bitmap_part, lcd_bitmap_part,
lcd_bitmap, lcd_bitmap,
lcd_bitmap_transparent_part,
lcd_bitmap_transparent,
#endif #endif
lcd_putsxy, lcd_putsxy,
lcd_puts_style, lcd_puts_style,

View file

@ -161,6 +161,10 @@ struct plugin_api {
int stride, int x, int y, int width, int height); int stride, int x, int y, int width, int height);
void (*lcd_bitmap)(const fb_data *src, int x, int y, int width, void (*lcd_bitmap)(const fb_data *src, int x, int y, int width,
int height); int height);
void (*lcd_bitmap_transparent_part)(const fb_data *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y,
int width, int height);
#endif #endif
void (*lcd_putsxy)(int x, int y, const unsigned char *string); void (*lcd_putsxy)(int x, int y, const unsigned char *string);
void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);

View file

@ -37,6 +37,7 @@ brickmania_sel_resume.220x176x16.bmp
brickmania_sel_quit.220x176x16.bmp brickmania_sel_quit.220x176x16.bmp
brickmania_sel_start.220x176x16.bmp brickmania_sel_start.220x176x16.bmp
brickmania_start.220x176x16.bmp brickmania_start.220x176x16.bmp
brickmania_break.220x176x16.bmp
#endif #endif
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before After
Before After

View file

@ -72,6 +72,7 @@ extern const fb_data brickmania_sel_quit[];
extern const fb_data brickmania_sel_resume[]; extern const fb_data brickmania_sel_resume[];
extern const fb_data brickmania_sel_start[]; extern const fb_data brickmania_sel_start[];
extern const fb_data brickmania_start[]; extern const fb_data brickmania_start[];
extern const fb_data brickmania_break[];
/* normal, glue, fire */ /* normal, glue, fire */
extern const fb_data brickmania_pads[]; extern const fb_data brickmania_pads[];
@ -93,8 +94,9 @@ extern const fb_data brickmania_bricks[];
#define PAD_HEIGHT 5 #define PAD_HEIGHT 5
#define PAD_POS_Y LCD_HEIGHT - 7 #define PAD_POS_Y LCD_HEIGHT - 7
#define BRICK_HEIGHT 8 #define BRICK_HEIGHT 8
#define BRICK_WIDTH 20 #define BRICK_WIDTH 21
#define BALL 5 #define BALL 5
#define LEFTMARGIN 5
#define BMPHEIGHT_help 19 #define BMPHEIGHT_help 19
#define BMPWIDTH_help 37 #define BMPWIDTH_help 37
@ -458,6 +460,7 @@ typedef struct cube {
char used; char used;
int color; int color;
int hits; int hits;
int hiteffect;
} cube; } cube;
cube brick[80]; cube brick[80];
@ -505,6 +508,7 @@ void int_game(int new_game)
brick[i*10+j].power=rb->rand()%25; /* +8 make the game with less powerups */ 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? brick[i*10+j].hits=levels[cur_level][i][j]>=10?
levels[cur_level][i][j]/16-1:0; levels[cur_level][i][j]/16-1:0;
brick[i*10+j].hiteffect=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]>=10? brick[i*10+j].color=(levels[cur_level][i][j]>=10?
@ -813,12 +817,12 @@ int game_loop(void){
brick[i*10+j].powertop+=2; brick[i*10+j].powertop+=2;
rb->lcd_bitmap_part(brickmania_powerups,0, rb->lcd_bitmap_part(brickmania_powerups,0,
BMPHEIGHT_powerup*brick[i*10+j].power, BMPHEIGHT_powerup*brick[i*10+j].power,
BMPWIDTH_powerup,10+j*BRICK_WIDTH+5, BMPWIDTH_powerup,LEFTMARGIN+j*BRICK_WIDTH+5,
brick[i*10+j].powertop, 10, 6); brick[i*10+j].powertop, 10, 6);
} }
} }
if ((pad_pos_x<10+j*BRICK_WIDTH+5 && pad_pos_x+PAD_WIDTH>10+j*BRICK_WIDTH+5) && brick[i*10+j].powertop+6>=PAD_POS_Y && brick[i*10+j].poweruse==2) { if ((pad_pos_x<LEFTMARGIN+j*BRICK_WIDTH+5 && pad_pos_x+PAD_WIDTH>LEFTMARGIN+j*BRICK_WIDTH+5) && brick[i*10+j].powertop+6>=PAD_POS_Y && brick[i*10+j].poweruse==2) {
switch(brick[i*10+j].power) { switch(brick[i*10+j].power) {
case 0: case 0:
life++; life++;
@ -859,7 +863,7 @@ int game_loop(void){
if (brick[i*10+j].powertop>PAD_POS_Y) if (brick[i*10+j].powertop>PAD_POS_Y)
brick[i*10+j].poweruse=1; brick[i*10+j].poweruse=1;
brickx=10+j*BRICK_WIDTH; brickx=LEFTMARGIN+j*BRICK_WIDTH;
bricky=30+i*8; bricky=30+i*8;
if (pad_type==2) { if (pad_type==2) {
for (k=0;k<=30;k++) { for (k=0;k<=30;k++) {
@ -869,6 +873,7 @@ int game_loop(void){
fire[k].top=-16; fire[k].top=-16;
if (brick[i*10+j].hits > 0){ if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--; brick[i*10+j].hits--;
brick[i*10+j].hiteffect++;
score+=3; score+=3;
} }
else { else {
@ -881,8 +886,10 @@ int game_loop(void){
} }
} }
if (brick[i*10+j].used==1) if (brick[i*10+j].used==1){
rb->lcd_bitmap_part(brickmania_bricks,0,BRICK_HEIGHT*brick[i*10+j].color,BRICK_WIDTH,10+j*BRICK_WIDTH, 30+i*8, BRICK_WIDTH, BRICK_HEIGHT); rb->lcd_bitmap_part(brickmania_bricks,0,BRICK_HEIGHT*brick[i*10+j].color,BRICK_WIDTH,LEFTMARGIN+j*BRICK_WIDTH, 30+i*8, BRICK_WIDTH, BRICK_HEIGHT);
rb->lcd_bitmap_transparent_part(brickmania_break,0,BRICK_HEIGHT*brick[i*10+j].hiteffect,BRICK_WIDTH,LEFTMARGIN+j*BRICK_WIDTH, 30+i*8, BRICK_WIDTH, BRICK_HEIGHT);
}
if (ball_pos_y <100) { if (ball_pos_y <100) {
if (brick[i*10+j].used==1) { if (brick[i*10+j].used==1) {
if ((ball_pos_x+ballx+3 >= brickx && ball_pos_x+ballx+3 <= brickx+BRICK_WIDTH) && ((bricky-4<ball_pos_y+BALL && bricky>ball_pos_y+BALL) || (bricky+4>ball_pos_y+BALL+BALL && bricky<ball_pos_y+BALL+BALL)) && (bally >0)){ if ((ball_pos_x+ballx+3 >= brickx && ball_pos_x+ballx+3 <= brickx+BRICK_WIDTH) && ((bricky-4<ball_pos_y+BALL && bricky>ball_pos_y+BALL) || (bricky+4>ball_pos_y+BALL+BALL && bricky<ball_pos_y+BALL+BALL)) && (bally >0)){
@ -900,6 +907,7 @@ int game_loop(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 */
if (brick[i*10+j].hits > 0){ if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--; brick[i*10+j].hits--;
brick[i*10+j].hiteffect++;
score+=2; score+=2;
} }
else { else {
@ -912,6 +920,7 @@ int game_loop(void){
} 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 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){ if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--; brick[i*10+j].hits--;
brick[i*10+j].hiteffect++;
score+=2; score+=2;
} }
else { else {
@ -926,6 +935,7 @@ int game_loop(void){
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 */
if (brick[i*10+j].hits > 0){ if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--; brick[i*10+j].hits--;
brick[i*10+j].hiteffect++;
score+=2; score+=2;
} }
else { else {
@ -938,6 +948,7 @@ int game_loop(void){
} 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 */
if (brick[i*10+j].hits > 0){ if (brick[i*10+j].hits > 0){
brick[i*10+j].hits--; brick[i*10+j].hits--;
brick[i*10+j].hiteffect++;
score+=2; score+=2;
} }
else { else {