summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-02-19 07:28:49 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-02-19 07:28:49 +0000
commita745fab8ce602a2d7844518a42f64110a5da064a (patch)
tree47fbbc120a2e68fd0a4526f68de7e1010a1c348e /apps/plugins
parent75919d5f3dff341e9e54dff15b32a4f5ea6debf2 (diff)
downloadrockbox-a745fab8ce602a2d7844518a42f64110a5da064a.zip
rockbox-a745fab8ce602a2d7844518a42f64110a5da064a.tar.gz
rockbox-a745fab8ce602a2d7844518a42f64110a5da064a.tar.bz2
rockbox-a745fab8ce602a2d7844518a42f64110a5da064a.tar.xz
Brickmania: Use constants for number of bricks rows and columns, and for number of levels
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24766 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/brickmania.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index 9694ff5..4966266 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -362,10 +362,12 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define PAD_POS_Y (GAMESCREEN_HEIGHT - PAD_HEIGHT - 1)
/* change to however many levels there are, i.e. how many arrays there are total */
-int levels_num = 40;
+#define NUM_LEVELS 40
+#define NUM_BRICKS_ROWS 8
+#define NUM_BRICKS_COLS 10
-/* change the first number in [ ] to however many levels there are (levels_num) */
-static unsigned char levels[40][8][10] =
+/* change the first number in [ ] to however many levels there are */
+static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] =
/* You can set up new levels with the level editor
( http://plugbox.rockbox-lounge.com/brickmania.htm ).
With 0x1, it refers to the first brick in the bitmap, 0x2 would refer to the
@@ -996,9 +998,9 @@ static void brickmania_init_game(bool new_game)
fire[i].top=-1;
}
- for(i=0;i<=7;i++) {
- for(j=0;j<=9;j++) {
- int bnum = i*10+j;
+ for(i=0;i<NUM_BRICKS_ROWS;i++) {
+ for(j=0;j<NUM_BRICKS_COLS;j++) {
+ int bnum = i*NUM_BRICKS_COLS+j;
brick[bnum].poweruse = false;
if (new_game) {
brick[bnum].power=rb->rand()%25;
@@ -1442,12 +1444,12 @@ static int brickmania_game_loop(void)
pad_line.p2.y = PAD_POS_Y;
/* handle all of the bricks/powerups */
- for (i=0; i<=7; i++)
+ for (i=0; i<NUM_BRICKS_ROWS; i++)
{
- for (j=0; j<=9 ;j++)
+ for (j=0; j<NUM_BRICKS_COLS ;j++)
{
int brickx;
- int bnum = i*10+j;
+ int bnum = i*NUM_BRICKS_COLS+j;
/* This brick is not really a brick, it is a powerup if
* poweruse is set. Perform appropriate powerup checks.
@@ -1986,7 +1988,7 @@ static int brickmania_game_loop(void)
if (brick_on_board < 0)
{
- if (level+1<levels_num)
+ if (level+1<NUM_LEVELS)
{
level++;
if (difficulty==NORMAL)