summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/brickmania.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index cdb2545572..3709decced 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -368,6 +368,18 @@ CONFIG_KEYPAD == SANSA_M200_PAD
368#define NUM_BRICKS_COLS 10 368#define NUM_BRICKS_COLS 10
369#define FLIP_SIDES_DELAY 10 369#define FLIP_SIDES_DELAY 10
370 370
371#define SCORE_BALL_HIT_BRICK 2
372#define SCORE_BALL_DEMOLISHED_BRICK 8
373#define SCORE_FIRE_HIT_BRICK 13
374#define SCORE_LEVEL_COMPLETED 100
375#define SCORE_POWER_EXTRA_LIFE 50
376#define SCORE_POWER_STICKY 34
377#define SCORE_POWER_SHOOTER 47
378#define SCORE_POWER_NORMAL 23
379#define SCORE_POWER_FLIP 23
380#define SCORE_POWER_EXTRA_BALL 23
381#define SCORE_POWER_LONG_PADDLE 23
382
371/* change the first number in [ ] to however many levels there are */ 383/* change the first number in [ ] to however many levels there are */
372static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = 384static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] =
373/* You can set up new levels with the level editor 385/* You can set up new levels with the level editor
@@ -847,14 +859,14 @@ sfire fire[MAX_FIRES];
847 859
848#define CONFIG_FILE_NAME "brickmania.cfg" 860#define CONFIG_FILE_NAME "brickmania.cfg"
849#define SAVE_FILE PLUGIN_GAMES_DIR "/brickmania.save" 861#define SAVE_FILE PLUGIN_GAMES_DIR "/brickmania.save"
850#define HIGH_SCORE PLUGIN_GAMES_DIR "/brickmania.score" 862#define HIGH_SCORE_FILE PLUGIN_GAMES_DIR "/brickmania.score"
851#define NUM_SCORES 5 863#define NUM_HIGH_SCORES 5
852 864
853static struct configdata config[] = { 865static struct configdata config[] = {
854 {TYPE_INT, 0, 1, { .int_p = &difficulty }, "difficulty", NULL}, 866 {TYPE_INT, 0, 1, { .int_p = &difficulty }, "difficulty", NULL},
855}; 867};
856 868
857struct highscore highest[NUM_SCORES]; 869struct highscore highest[NUM_HIGH_SCORES];
858 870
859typedef struct point 871typedef struct point
860{ 872{
@@ -990,7 +1002,7 @@ static void brickmania_init_game(bool new_game)
990 brick_on_board=0; 1002 brick_on_board=0;
991 /* add one life per achieved level */ 1003 /* add one life per achieved level */
992 if (difficulty==EASY && life<2) { 1004 if (difficulty==EASY && life<2) {
993 score-=100; 1005 score+=SCORE_LEVEL_COMPLETED;
994 life++; 1006 life++;
995 } 1007 }
996 } 1008 }
@@ -1270,7 +1282,7 @@ static int brickmania_menu(void)
1270 return 1; 1282 return 1;
1271 break; 1283 break;
1272 case 4: 1284 case 4:
1273 highscore_show(NUM_SCORES, highest, NUM_SCORES, true); 1285 highscore_show(NUM_HIGH_SCORES, highest, NUM_HIGH_SCORES, true);
1274 break; 1286 break;
1275 case 5: 1287 case 5:
1276 if (playback_control(NULL)) 1288 if (playback_control(NULL))
@@ -1317,7 +1329,7 @@ void brick_hit(int brick_number)
1317 if (brick[brick_number].hits > 0) { 1329 if (brick[brick_number].hits > 0) {
1318 brick[brick_number].hits--; 1330 brick[brick_number].hits--;
1319 brick[brick_number].hiteffect++; 1331 brick[brick_number].hiteffect++;
1320 score+=2; 1332 score+=SCORE_BALL_HIT_BRICK;
1321 } 1333 }
1322 else { 1334 else {
1323 brick[brick_number].used=false; 1335 brick[brick_number].used=false;
@@ -1327,7 +1339,7 @@ void brick_hit(int brick_number)
1327 brick[brick_number].poweruse = true; 1339 brick[brick_number].poweruse = true;
1328 } 1340 }
1329 brick_on_board--; 1341 brick_on_board--;
1330 score+=8; 1342 score+=SCORE_BALL_DEMOLISHED_BRICK;
1331 } 1343 }
1332} 1344}
1333 1345
@@ -1492,7 +1504,7 @@ static int brickmania_game_loop(void)
1492 switch(brick[bnum].power) { 1504 switch(brick[bnum].power) {
1493 case 0: /* Extra Life */ 1505 case 0: /* Extra Life */
1494 life++; 1506 life++;
1495 score += 50; 1507 score += SCORE_POWER_EXTRA_LIFE;
1496 break; 1508 break;
1497 case 1: /* Loose a life */ 1509 case 1: /* Loose a life */
1498 life--; 1510 life--;
@@ -1503,17 +1515,17 @@ static int brickmania_game_loop(void)
1503 } 1515 }
1504 break; 1516 break;
1505 case 2: /* Make the paddle sticky */ 1517 case 2: /* Make the paddle sticky */
1506 score += 34; 1518 score += SCORE_POWER_STICKY;
1507 pad_type = STICKY; 1519 pad_type = STICKY;
1508 break; 1520 break;
1509 case 3: /* Give the paddle shooter */ 1521 case 3: /* Give the paddle shooter */
1510 score += 47; 1522 score += SCORE_POWER_SHOOTER;
1511 pad_type = SHOOTER; 1523 pad_type = SHOOTER;
1512 for(k=0;k<used_balls;k++) 1524 for(k=0;k<used_balls;k++)
1513 ball[k].glue=false; 1525 ball[k].glue=false;
1514 break; 1526 break;
1515 case 4: /* Normal brick */ 1527 case 4: /* Normal brick */
1516 score += 23; 1528 score += SCORE_POWER_NORMAL;
1517 pad_type = PLAIN; 1529 pad_type = PLAIN;
1518 for(k=0;k<used_balls;k++) 1530 for(k=0;k<used_balls;k++)
1519 ball[k].glue=false; 1531 ball[k].glue=false;
@@ -1523,13 +1535,13 @@ static int brickmania_game_loop(void)
1523 pad_width = PAD_WIDTH; 1535 pad_width = PAD_WIDTH;
1524 break; 1536 break;
1525 case 5: /* Flip the paddle */ 1537 case 5: /* Flip the paddle */
1526 score += 23; 1538 score += SCORE_POWER_FLIP;
1527 sec_count = *rb->current_tick+HZ; 1539 sec_count = *rb->current_tick+HZ;
1528 flip_sides_delay = FLIP_SIDES_DELAY; 1540 flip_sides_delay = FLIP_SIDES_DELAY;
1529 flip_sides = true; 1541 flip_sides = true;
1530 break; 1542 break;
1531 case 6: /* Extra Ball */ 1543 case 6: /* Extra Ball */
1532 score += 23; 1544 score += SCORE_POWER_EXTRA_BALL;
1533 if(used_balls<MAX_BALLS) 1545 if(used_balls<MAX_BALLS)
1534 { 1546 {
1535 /* Set the speed */ 1547 /* Set the speed */
@@ -1546,7 +1558,7 @@ static int brickmania_game_loop(void)
1546 } 1558 }
1547 break; 1559 break;
1548 case 7: /* Long paddle */ 1560 case 7: /* Long paddle */
1549 score+=23; 1561 score+=SCORE_POWER_LONG_PADDLE;
1550 if (pad_width==PAD_WIDTH) 1562 if (pad_width==PAD_WIDTH)
1551 { 1563 {
1552 pad_width = LONG_PAD_WIDTH; 1564 pad_width = LONG_PAD_WIDTH;
@@ -1642,7 +1654,7 @@ static int brickmania_game_loop(void)
1642 if (check_lines(&misc_line, &bot_brick, 1654 if (check_lines(&misc_line, &bot_brick,
1643 &pt_hit)) 1655 &pt_hit))
1644 { 1656 {
1645 score+=13; 1657 score+=SCORE_FIRE_HIT_BRICK;
1646 /* De-activate the fire */ 1658 /* De-activate the fire */
1647 fire[k].top=-1; 1659 fire[k].top=-1;
1648 brick_hit(bnum); 1660 brick_hit(bnum);
@@ -1994,7 +2006,7 @@ static int brickmania_game_loop(void)
1994 { 2006 {
1995 level++; 2007 level++;
1996 if (difficulty==NORMAL) 2008 if (difficulty==NORMAL)
1997 score+=100; 2009 score+=SCORE_LEVEL_COMPLETED;
1998 brickmania_init_game(true); 2010 brickmania_init_game(true);
1999 brickmania_sleep(2); 2011 brickmania_sleep(2);
2000 rb->button_clear_queue(); 2012 rb->button_clear_queue();
@@ -2208,7 +2220,7 @@ enum plugin_status plugin_start(const void* parameter)
2208 (void)parameter; 2220 (void)parameter;
2209 int last_difficulty; 2221 int last_difficulty;
2210 2222
2211 highscore_load(HIGH_SCORE,highest,NUM_SCORES); 2223 highscore_load(HIGH_SCORE_FILE,highest,NUM_HIGH_SCORES);
2212 configfile_load(CONFIG_FILE_NAME,config,1,0); 2224 configfile_load(CONFIG_FILE_NAME,config,1,0);
2213 last_difficulty = difficulty; 2225 last_difficulty = difficulty;
2214 2226
@@ -2232,7 +2244,7 @@ enum plugin_status plugin_start(const void* parameter)
2232 if(!resume) 2244 if(!resume)
2233 { 2245 {
2234 int position = highscore_update(score, level+1, "", highest, 2246 int position = highscore_update(score, level+1, "", highest,
2235 NUM_SCORES); 2247 NUM_HIGH_SCORES);
2236 if (position == 0) 2248 if (position == 0)
2237 { 2249 {
2238 rb->splash(HZ*2, "New High Score"); 2250 rb->splash(HZ*2, "New High Score");
@@ -2240,7 +2252,7 @@ enum plugin_status plugin_start(const void* parameter)
2240 2252
2241 if (position != -1) 2253 if (position != -1)
2242 { 2254 {
2243 highscore_show(position, highest, NUM_SCORES, true); 2255 highscore_show(position, highest, NUM_HIGH_SCORES, true);
2244 } 2256 }
2245 else 2257 else
2246 { 2258 {
@@ -2249,7 +2261,7 @@ enum plugin_status plugin_start(const void* parameter)
2249 } 2261 }
2250 } 2262 }
2251 2263
2252 highscore_save(HIGH_SCORE,highest,NUM_SCORES); 2264 highscore_save(HIGH_SCORE_FILE,highest,NUM_HIGH_SCORES);
2253 if(last_difficulty != difficulty) 2265 if(last_difficulty != difficulty)
2254 configfile_save(CONFIG_FILE_NAME,config,1,0); 2266 configfile_save(CONFIG_FILE_NAME,config,1,0);
2255 /* Restore user's original backlight setting */ 2267 /* Restore user's original backlight setting */