diff options
| author | Tomer Shalev <shalev.tomer@gmail.com> | 2010-02-27 08:02:12 +0000 |
|---|---|---|
| committer | Tomer Shalev <shalev.tomer@gmail.com> | 2010-02-27 08:02:12 +0000 |
| commit | 45a14f31d06c3a83f91064e22851ae944bce25bd (patch) | |
| tree | 5ad11fa087c8d0df0f848a15ced8c65727b8d29b /apps/plugins | |
| parent | e96f05822f9514046908ce027ba8834faa72da20 (diff) | |
| download | rockbox-45a14f31d06c3a83f91064e22851ae944bce25bd.zip rockbox-45a14f31d06c3a83f91064e22851ae944bce25bd.tar.gz rockbox-45a14f31d06c3a83f91064e22851ae944bce25bd.tar.bz2 rockbox-45a14f31d06c3a83f91064e22851ae944bce25bd.tar.xz | |
Brickmania: Use static whenever possible
- Also fix some code styling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24933 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/brickmania.c | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index 9648df3..dbc75bc 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -454,7 +454,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = You could do the same with the 3, just replace the 2 with a 3 for it to take three hits to break it apart. */ { - { /* level1 */ + { /* level 1 */ {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, {0x2,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x2}, {0x0,0x2,0x1,0x0,0x0,0x0,0x0,0x1,0x2,0x0}, @@ -464,7 +464,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} }, - { /* level2 */ + { /* level 2 */ {0x0,0x0,0x7,0x7,0x1,0x1,0x7,0x7,0x0,0x0}, {0x0,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x0}, {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, @@ -474,7 +474,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x2,0x1,0x0}, {0x0,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x0} }, - { /* level3 */ + { /* level 3 */ {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}, @@ -484,7 +484,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x5,0x25,0x25,0x5,0x0,0x0,0x6,0x26,0x26,0x6}, {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6} }, - { /* level4 */ + { /* level 4 */ {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}, @@ -494,7 +494,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0}, {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1} }, - { /* level5 */ + { /* level 5 */ {0x1,0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4}, {0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0}, {0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5}, @@ -504,7 +504,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x36}, {0x0,0x24,0x24,0x0,0x25,0x25,0x0,0x26,0x26,0x0} }, - { /* level6 */ + { /* level 6 */ {0x0,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x0}, {0x3,0x1,0x3,0x7,0x0,0x0,0x7,0x3,0x1,0x3}, {0x3,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x3}, @@ -514,7 +514,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x0}, {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} }, - { /* level7 */ + { /* level 7 */ {0x0,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x0}, {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, {0x6,0x0,0x0,0x2,0x2,0x2,0x2,0x0,0x0,0x6}, @@ -524,7 +524,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0}, {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} }, - { /* level8 */ + { /* level 8 */ {0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x0}, {0x0,0x0,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x0}, {0x6,0x6,0x0,0x2,0x32,0x32,0x2,0x0,0x6,0x6}, @@ -534,7 +534,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x5,0x5,0x25,0x5,0x5,0x25,0x5,0x5,0x0}, {0x5,0x5,0x25,0x5,0x5,0x5,0x5,0x25,0x5,0x5} }, - { /* level9 */ + { /* level 9 */ {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, {0x2,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x2}, {0x2,0x0,0x3,0x0,0x1,0x1,0x0,0x3,0x0,0x2}, @@ -544,7 +544,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x2,0x2,0x0,0x0,0x1,0x1,0x0,0x0,0x2,0x2}, {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2} }, - { /* level10 */ + { /* level 10 */ {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, {0x0,0x5,0x0,0x5,0x0,0x5,0x0,0x5,0x0,0x5}, {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, @@ -554,7 +554,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x0,0x2,0x3,0x4,0x1,0x1,0x4,0x3,0x2,0x0}, {0x1,0x2,0x3,0x4,0x1,0x1,0x4,0x3,0x2,0x1} }, - { /* level11 */ + { /* level 11 */ {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3}, {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2}, {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2}, @@ -584,7 +584,7 @@ static unsigned char levels[NUM_LEVELS][NUM_BRICKS_ROWS][NUM_BRICKS_COLS] = {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2} }, - {/* level14 */ + {/* level 14 */ {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, {0x4,0x4,0x4,0x4,0x2,0x2,0x4,0x4,0x4,0x4}, {0x4,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x4}, @@ -893,11 +893,12 @@ enum game_state ST_PAUSE }; -enum { +enum paddle_type +{ PADDLE_TYPE_NORMAL = 0, PADDLE_TYPE_STICKY, PADDLE_TYPE_SHOOTER, -} paddle_type; +}; struct brick { @@ -929,7 +930,8 @@ struct fire int x_pos; /* This stores the fire x position, it is a whole number */ }; -struct power { +struct power +{ int top; /* This stores the powerup y position, it is a fixed point num */ int x_pos; /* This stores the (middle of) powerup x position, it is a whole number */ enum power_types type; /* This stores the powerup type */ @@ -954,25 +956,26 @@ struct line * */ -enum game_state game_state = ST_READY; -int pad_pos_x; -int life; -int score=0,vscore=0; -bool flip_sides=false; -int level=0; -int brick_on_board=0; -int used_balls=1; -int used_fires=0; -int used_powers=0; -int difficulty = NORMAL; -int pad_width; -int flip_sides_delay; -bool resume = false; -bool resume_file = false; -struct brick brick[NUM_BRICKS_ROWS][NUM_BRICKS_COLS]; -struct ball ball[MAX_BALLS]; -struct fire fire[MAX_FIRES]; -struct power power[MAX_POWERS]; +static enum game_state game_state = ST_READY; +static int pad_pos_x; +static int life; +static int score=0,vscore=0; +static bool flip_sides=false; +static int level=0; +static int brick_on_board=0; +static int used_balls=1; +static int used_fires=0; +static int used_powers=0; +static int difficulty = NORMAL; +static int pad_width; +static int flip_sides_delay; +static bool resume = false; +static bool resume_file = false; +static struct brick brick[NUM_BRICKS_ROWS][NUM_BRICKS_COLS]; +static struct ball ball[MAX_BALLS]; +static struct fire fire[MAX_FIRES]; +static struct power power[MAX_POWERS]; +static enum paddle_type paddle_type; static struct configdata config[] = { @@ -1012,7 +1015,8 @@ struct highscore highest[NUM_HIGH_SCORES]; */ #define LINE_PREC 7 -int check_lines(struct line *line1, struct line *line2, struct point *hitp) +static int check_lines(struct line *line1, struct line *line2, + struct point *hitp) { /* Introduction: * This code is based on the solution of these two input equations: @@ -1403,7 +1407,7 @@ static int brickmania_menu(void) #endif } -void brick_hit(int i, int j) +static void brick_hit(int i, int j) { if(!brick[i][j].used) return; |