diff options
20 files changed, 250 insertions, 452 deletions
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 64e59577b4..b523faef3a 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES | |||
@@ -6,9 +6,6 @@ brickmania_gameover.112x54x16.bmp | |||
6 | 6 | ||
7 | #if LCD_WIDTH >= 640 /* M:Robe 500 */ | 7 | #if LCD_WIDTH >= 640 /* M:Robe 500 */ |
8 | brickmania_ball.15x15x16.bmp | 8 | brickmania_ball.15x15x16.bmp |
9 | brickmania_menu_items.640x480x16.bmp | ||
10 | |||
11 | brickmania_menu_bg.640x480x16.bmp | ||
12 | brickmania_bricks.640x480x16.bmp | 9 | brickmania_bricks.640x480x16.bmp |
13 | brickmania_pads.640x480x16.bmp | 10 | brickmania_pads.640x480x16.bmp |
14 | brickmania_break.640x480x16.bmp | 11 | brickmania_break.640x480x16.bmp |
@@ -16,9 +13,6 @@ brickmania_powerups.640x480x16.bmp | |||
16 | 13 | ||
17 | #elif LCD_WIDTH >= 480 /* M:Robe 500 */ | 14 | #elif LCD_WIDTH >= 480 /* M:Robe 500 */ |
18 | brickmania_ball.11x11x16.bmp | 15 | brickmania_ball.11x11x16.bmp |
19 | brickmania_menu_items.480x640x16.bmp | ||
20 | |||
21 | brickmania_menu_bg.480x640x16.bmp | ||
22 | brickmania_bricks.480x640x16.bmp | 16 | brickmania_bricks.480x640x16.bmp |
23 | brickmania_pads.480x640x16.bmp | 17 | brickmania_pads.480x640x16.bmp |
24 | brickmania_break.480x640x16.bmp | 18 | brickmania_break.480x640x16.bmp |
@@ -26,8 +20,6 @@ brickmania_powerups.480x640x16.bmp | |||
26 | 20 | ||
27 | #elif LCD_WIDTH >= 320 /* Ipod Video */ | 21 | #elif LCD_WIDTH >= 320 /* Ipod Video */ |
28 | brickmania_ball.5x5x16.bmp | 22 | brickmania_ball.5x5x16.bmp |
29 | brickmania_menu_items.220x176x16.bmp | ||
30 | brickmania_menu_bg.320x240x16.bmp | ||
31 | brickmania_bricks.320x240x16.bmp | 23 | brickmania_bricks.320x240x16.bmp |
32 | brickmania_pads.320x240x16.bmp | 24 | brickmania_pads.320x240x16.bmp |
33 | brickmania_break.320x240x16.bmp | 25 | brickmania_break.320x240x16.bmp |
@@ -35,54 +27,42 @@ brickmania_powerups.320x240x16.bmp | |||
35 | 27 | ||
36 | #elif LCD_WIDTH >= 220 | 28 | #elif LCD_WIDTH >= 220 |
37 | brickmania_ball.5x5x16.bmp | 29 | brickmania_ball.5x5x16.bmp |
38 | brickmania_menu_items.220x176x16.bmp | ||
39 | brickmania_bricks.220x176x16.bmp | 30 | brickmania_bricks.220x176x16.bmp |
40 | brickmania_pads.220x176x16.bmp | 31 | brickmania_pads.220x176x16.bmp |
41 | brickmania_break.220x176x16.bmp | 32 | brickmania_break.220x176x16.bmp |
42 | brickmania_powerups.220x176x16.bmp | 33 | brickmania_powerups.220x176x16.bmp |
43 | #if LCD_HEIGHT >= 320 | ||
44 | brickmania_menu_bg.240x320x16.bmp | ||
45 | #elif LCD_HEIGHT == 176 | ||
46 | brickmania_menu_bg.220x176x16.bmp | ||
47 | #endif | ||
48 | 34 | ||
49 | #elif LCD_WIDTH >= 176 | 35 | #elif LCD_WIDTH >= 176 |
50 | brickmania_ball.5x5x16.bmp | 36 | brickmania_ball.5x5x16.bmp |
51 | brickmania_menu_items.176x132x16.bmp | ||
52 | brickmania_bricks.176x132x16.bmp | 37 | brickmania_bricks.176x132x16.bmp |
53 | brickmania_menu_bg.176x132x16.bmp | ||
54 | brickmania_pads.176x132x16.bmp | 38 | brickmania_pads.176x132x16.bmp |
55 | brickmania_powerups.176x132x16.bmp | 39 | brickmania_powerups.176x132x16.bmp |
56 | brickmania_break.176x132x16.bmp | 40 | brickmania_break.176x132x16.bmp |
41 | |||
57 | #elif LCD_WIDTH >= 160 | 42 | #elif LCD_WIDTH >= 160 |
58 | brickmania_ball.5x5x16.bmp | 43 | brickmania_ball.5x5x16.bmp |
59 | brickmania_menu_items.160x128x16.bmp | ||
60 | brickmania_bricks.160x128x16.bmp | 44 | brickmania_bricks.160x128x16.bmp |
61 | brickmania_menu_bg.160x128x16.bmp | ||
62 | brickmania_pads.160x128x16.bmp | 45 | brickmania_pads.160x128x16.bmp |
63 | brickmania_powerups.160x128x16.bmp | 46 | brickmania_powerups.160x128x16.bmp |
64 | brickmania_break.160x128x16.bmp | 47 | brickmania_break.160x128x16.bmp |
48 | |||
65 | #elif LCD_WIDTH >= 132 | 49 | #elif LCD_WIDTH >= 132 |
66 | brickmania_ball.4x4x16.bmp | 50 | brickmania_ball.4x4x16.bmp |
67 | brickmania_menu_items.132x80x16.bmp | ||
68 | brickmania_bricks.132x80x16.bmp | 51 | brickmania_bricks.132x80x16.bmp |
69 | brickmania_menu_bg.132x80x16.bmp | ||
70 | brickmania_pads.132x80x16.bmp | 52 | brickmania_pads.132x80x16.bmp |
71 | brickmania_powerups.132x80x16.bmp | 53 | brickmania_powerups.132x80x16.bmp |
72 | brickmania_break.132x80x16.bmp | 54 | brickmania_break.132x80x16.bmp |
55 | |||
73 | #elif LCD_WIDTH >= 128 | 56 | #elif LCD_WIDTH >= 128 |
74 | brickmania_ball.4x4x16.bmp | 57 | brickmania_ball.4x4x16.bmp |
75 | brickmania_menu_items.132x80x16.bmp | ||
76 | brickmania_bricks.128x128x16.bmp | 58 | brickmania_bricks.128x128x16.bmp |
77 | brickmania_menu_bg.128x128x16.bmp | ||
78 | brickmania_pads.132x80x16.bmp | 59 | brickmania_pads.132x80x16.bmp |
79 | brickmania_powerups.132x80x16.bmp | 60 | brickmania_powerups.132x80x16.bmp |
80 | brickmania_break.132x80x16.bmp | 61 | brickmania_break.132x80x16.bmp |
81 | #endif /* different colour displays */ | 62 | #endif /* different colour displays */ |
63 | |||
82 | #elif LCD_DEPTH > 1 | 64 | #elif LCD_DEPTH > 1 |
83 | brickmania_gameover.86x43x2.bmp | 65 | brickmania_gameover.86x43x2.bmp |
84 | brickmania_menu_items.160x128x2.bmp | ||
85 | brickmania_menu_bg.160x128x2.bmp | ||
86 | brickmania_pads.160x128x2.bmp | 66 | brickmania_pads.160x128x2.bmp |
87 | brickmania_powerups.160x128x2.bmp | 67 | brickmania_powerups.160x128x2.bmp |
88 | #if (LCD_WIDTH >= 160) | 68 | #if (LCD_WIDTH >= 160) |
@@ -97,7 +77,6 @@ brickmania_bricks.128x96x2.bmp | |||
97 | #endif | 77 | #endif |
98 | #else /* mono */ | 78 | #else /* mono */ |
99 | brickmania_gameover.59x30x1.bmp | 79 | brickmania_gameover.59x30x1.bmp |
100 | brickmania_menu_items.112x64x1.bmp | ||
101 | brickmania_bricks.112x64x1.bmp | 80 | brickmania_bricks.112x64x1.bmp |
102 | brickmania_ball.3x3x1.bmp | 81 | brickmania_ball.3x3x1.bmp |
103 | brickmania_pads.112x64x1.bmp | 82 | brickmania_pads.112x64x1.bmp |
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.128x128x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.128x128x16.bmp deleted file mode 100644 index 30373baa2f..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.128x128x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.132x80x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.132x80x16.bmp deleted file mode 100644 index e4ca574636..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.132x80x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x16.bmp deleted file mode 100644 index ee213efe6e..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x2.bmp deleted file mode 100644 index 40e6a21685..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.160x128x2.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.176x132x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.176x132x16.bmp deleted file mode 100644 index 14aa8db052..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.176x132x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.220x176x16.bmp deleted file mode 100644 index afee59713a..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.220x176x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.240x320x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.240x320x16.bmp deleted file mode 100644 index 16c5549c7d..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.240x320x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.320x240x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.320x240x16.bmp deleted file mode 100644 index f2639cd65d..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.320x240x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.480x640x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.480x640x16.bmp deleted file mode 100644 index 3bf4333bfa..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.480x640x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_bg.640x480x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_bg.640x480x16.bmp deleted file mode 100644 index 87c927faa0..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_bg.640x480x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.112x64x1.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.112x64x1.bmp deleted file mode 100644 index e341c67dfe..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.112x64x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.132x80x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.132x80x16.bmp deleted file mode 100644 index 2594e86f45..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.132x80x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.160x128x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.160x128x16.bmp deleted file mode 100644 index 77dac8377f..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.160x128x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.160x128x2.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.160x128x2.bmp deleted file mode 100644 index 5a8710a370..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.160x128x2.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.176x132x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.176x132x16.bmp deleted file mode 100644 index d7c6e554a2..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.176x132x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.220x176x16.bmp deleted file mode 100644 index c82912a073..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.220x176x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.480x640x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.480x640x16.bmp deleted file mode 100644 index e3ece2e7a9..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.480x640x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_menu_items.640x480x16.bmp b/apps/plugins/bitmaps/native/brickmania_menu_items.640x480x16.bmp deleted file mode 100644 index 6d8ff9dc02..0000000000 --- a/apps/plugins/bitmaps/native/brickmania_menu_items.640x480x16.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index ca27df6298..61d0f17bf1 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -20,27 +20,25 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/configfile.h" /* Part of libplugin */ | 23 | #include "lib/configfile.h" |
24 | #include "lib/helper.h" | ||
25 | #include "lib/display_text.h" | 24 | #include "lib/display_text.h" |
25 | #include "lib/helper.h" | ||
26 | #include "lib/highscore.h" | ||
27 | #include "lib/playback_control.h" | ||
26 | 28 | ||
27 | PLUGIN_HEADER | 29 | PLUGIN_HEADER |
28 | 30 | ||
29 | 31 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | |
30 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 32 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
31 | |||
32 | #define QUIT BUTTON_OFF | 33 | #define QUIT BUTTON_OFF |
33 | #define LEFT BUTTON_LEFT | 34 | #define LEFT BUTTON_LEFT |
34 | #define RIGHT BUTTON_RIGHT | 35 | #define RIGHT BUTTON_RIGHT |
35 | #define SELECT BUTTON_SELECT | 36 | #define SELECT BUTTON_SELECT |
36 | #define UP BUTTON_UP | 37 | #define UP BUTTON_UP |
37 | #define DOWN BUTTON_DOWN | 38 | #define DOWN BUTTON_DOWN |
38 | |||
39 | #define RC_QUIT BUTTON_RC_STOP | 39 | #define RC_QUIT BUTTON_RC_STOP |
40 | 40 | ||
41 | |||
42 | #elif CONFIG_KEYPAD == ONDIO_PAD | 41 | #elif CONFIG_KEYPAD == ONDIO_PAD |
43 | |||
44 | #define QUIT BUTTON_OFF | 42 | #define QUIT BUTTON_OFF |
45 | #define LEFT BUTTON_LEFT | 43 | #define LEFT BUTTON_LEFT |
46 | #define RIGHT BUTTON_RIGHT | 44 | #define RIGHT BUTTON_RIGHT |
@@ -48,9 +46,7 @@ PLUGIN_HEADER | |||
48 | #define UP BUTTON_UP | 46 | #define UP BUTTON_UP |
49 | #define DOWN BUTTON_DOWN | 47 | #define DOWN BUTTON_DOWN |
50 | 48 | ||
51 | |||
52 | #elif CONFIG_KEYPAD == RECORDER_PAD | 49 | #elif CONFIG_KEYPAD == RECORDER_PAD |
53 | |||
54 | #define QUIT BUTTON_OFF | 50 | #define QUIT BUTTON_OFF |
55 | #define LEFT BUTTON_LEFT | 51 | #define LEFT BUTTON_LEFT |
56 | #define RIGHT BUTTON_RIGHT | 52 | #define RIGHT BUTTON_RIGHT |
@@ -58,9 +54,7 @@ PLUGIN_HEADER | |||
58 | #define UP BUTTON_UP | 54 | #define UP BUTTON_UP |
59 | #define DOWN BUTTON_DOWN | 55 | #define DOWN BUTTON_DOWN |
60 | 56 | ||
61 | |||
62 | #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD | 57 | #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD |
63 | |||
64 | #define QUIT BUTTON_OFF | 58 | #define QUIT BUTTON_OFF |
65 | #define LEFT BUTTON_LEFT | 59 | #define LEFT BUTTON_LEFT |
66 | #define RIGHT BUTTON_RIGHT | 60 | #define RIGHT BUTTON_RIGHT |
@@ -68,24 +62,19 @@ PLUGIN_HEADER | |||
68 | #define UP BUTTON_UP | 62 | #define UP BUTTON_UP |
69 | #define DOWN BUTTON_DOWN | 63 | #define DOWN BUTTON_DOWN |
70 | 64 | ||
71 | |||
72 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 65 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
73 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ | 66 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ |
74 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) | 67 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) |
75 | |||
76 | #define QUIT BUTTON_MENU | 68 | #define QUIT BUTTON_MENU |
77 | #define LEFT BUTTON_LEFT | 69 | #define LEFT BUTTON_LEFT |
78 | #define RIGHT BUTTON_RIGHT | 70 | #define RIGHT BUTTON_RIGHT |
79 | #define SELECT BUTTON_SELECT | 71 | #define SELECT BUTTON_SELECT |
80 | #define UP BUTTON_SCROLL_BACK | 72 | #define UP BUTTON_SCROLL_BACK |
81 | #define DOWN BUTTON_SCROLL_FWD | 73 | #define DOWN BUTTON_SCROLL_FWD |
82 | |||
83 | #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) | 74 | #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) |
84 | #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) | 75 | #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) |
85 | 76 | ||
86 | |||
87 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) | 77 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) |
88 | |||
89 | #define QUIT BUTTON_POWER | 78 | #define QUIT BUTTON_POWER |
90 | #define LEFT BUTTON_LEFT | 79 | #define LEFT BUTTON_LEFT |
91 | #define RIGHT BUTTON_RIGHT | 80 | #define RIGHT BUTTON_RIGHT |
@@ -93,9 +82,7 @@ PLUGIN_HEADER | |||
93 | #define UP BUTTON_UP | 82 | #define UP BUTTON_UP |
94 | #define DOWN BUTTON_DOWN | 83 | #define DOWN BUTTON_DOWN |
95 | 84 | ||
96 | |||
97 | #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD | 85 | #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD |
98 | |||
99 | #define QUIT BUTTON_POWER | 86 | #define QUIT BUTTON_POWER |
100 | #define LEFT BUTTON_LEFT | 87 | #define LEFT BUTTON_LEFT |
101 | #define RIGHT BUTTON_RIGHT | 88 | #define RIGHT BUTTON_RIGHT |
@@ -103,28 +90,24 @@ PLUGIN_HEADER | |||
103 | #define UP BUTTON_UP | 90 | #define UP BUTTON_UP |
104 | #define DOWN BUTTON_DOWN | 91 | #define DOWN BUTTON_DOWN |
105 | 92 | ||
106 | |||
107 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) | 93 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) |
108 | 94 | #define QUIT BUTTON_POWER | |
109 | #define QUIT BUTTON_POWER | 95 | #define LEFT BUTTON_LEFT |
110 | #define LEFT BUTTON_LEFT | 96 | #define RIGHT BUTTON_RIGHT |
111 | #define RIGHT BUTTON_RIGHT | 97 | #define SELECT BUTTON_SELECT |
112 | #define SELECT BUTTON_SELECT | 98 | #define UP BUTTON_UP |
113 | #define UP BUTTON_SCROLL_BACK | 99 | #define DOWN BUTTON_DOWN |
114 | #define DOWN BUTTON_SCROLL_FWD | ||
115 | |||
116 | #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) | 100 | #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) |
117 | #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) | 101 | #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) |
118 | 102 | ||
119 | 103 | ||
120 | #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD) | 104 | #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD) |
121 | |||
122 | #define QUIT (BUTTON_HOME|BUTTON_REPEAT) | 105 | #define QUIT (BUTTON_HOME|BUTTON_REPEAT) |
123 | #define LEFT BUTTON_LEFT | 106 | #define LEFT BUTTON_LEFT |
124 | #define RIGHT BUTTON_RIGHT | 107 | #define RIGHT BUTTON_RIGHT |
125 | #define SELECT BUTTON_SELECT | 108 | #define SELECT BUTTON_SELECT |
126 | #define UP BUTTON_SCROLL_BACK | 109 | #define UP BUTTON_UP |
127 | #define DOWN BUTTON_SCROLL_FWD | 110 | #define DOWN BUTTON_DOWN |
128 | 111 | ||
129 | #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) | 112 | #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) |
130 | #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) | 113 | #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) |
@@ -133,7 +116,6 @@ PLUGIN_HEADER | |||
133 | #elif CONFIG_KEYPAD == SANSA_C200_PAD || \ | 116 | #elif CONFIG_KEYPAD == SANSA_C200_PAD || \ |
134 | CONFIG_KEYPAD == SANSA_CLIP_PAD || \ | 117 | CONFIG_KEYPAD == SANSA_CLIP_PAD || \ |
135 | CONFIG_KEYPAD == SANSA_M200_PAD | 118 | CONFIG_KEYPAD == SANSA_M200_PAD |
136 | |||
137 | #define QUIT BUTTON_POWER | 119 | #define QUIT BUTTON_POWER |
138 | #define LEFT BUTTON_LEFT | 120 | #define LEFT BUTTON_LEFT |
139 | #define RIGHT BUTTON_RIGHT | 121 | #define RIGHT BUTTON_RIGHT |
@@ -143,9 +125,7 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
143 | #define UP BUTTON_UP | 125 | #define UP BUTTON_UP |
144 | #define DOWN BUTTON_DOWN | 126 | #define DOWN BUTTON_DOWN |
145 | 127 | ||
146 | |||
147 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD | 128 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD |
148 | |||
149 | #define QUIT BUTTON_POWER | 129 | #define QUIT BUTTON_POWER |
150 | #define LEFT BUTTON_LEFT | 130 | #define LEFT BUTTON_LEFT |
151 | #define RIGHT BUTTON_RIGHT | 131 | #define RIGHT BUTTON_RIGHT |
@@ -154,7 +134,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
154 | #define DOWN BUTTON_SCROLL_DOWN | 134 | #define DOWN BUTTON_SCROLL_DOWN |
155 | 135 | ||
156 | #elif CONFIG_KEYPAD == GIGABEAT_S_PAD | 136 | #elif CONFIG_KEYPAD == GIGABEAT_S_PAD |
157 | |||
158 | #define QUIT BUTTON_BACK | 137 | #define QUIT BUTTON_BACK |
159 | #define LEFT BUTTON_LEFT | 138 | #define LEFT BUTTON_LEFT |
160 | #define RIGHT BUTTON_RIGHT | 139 | #define RIGHT BUTTON_RIGHT |
@@ -163,7 +142,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
163 | #define DOWN BUTTON_DOWN | 142 | #define DOWN BUTTON_DOWN |
164 | 143 | ||
165 | #elif (CONFIG_KEYPAD == MROBE100_PAD) | 144 | #elif (CONFIG_KEYPAD == MROBE100_PAD) |
166 | |||
167 | #define QUIT BUTTON_POWER | 145 | #define QUIT BUTTON_POWER |
168 | #define LEFT BUTTON_LEFT | 146 | #define LEFT BUTTON_LEFT |
169 | #define RIGHT BUTTON_RIGHT | 147 | #define RIGHT BUTTON_RIGHT |
@@ -172,21 +150,15 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
172 | #define DOWN BUTTON_DOWN | 150 | #define DOWN BUTTON_DOWN |
173 | 151 | ||
174 | #elif CONFIG_KEYPAD == IAUDIO_M3_PAD | 152 | #elif CONFIG_KEYPAD == IAUDIO_M3_PAD |
175 | |||
176 | #define QUIT BUTTON_RC_REC | 153 | #define QUIT BUTTON_RC_REC |
177 | #define LEFT BUTTON_RC_REW | 154 | #define LEFT BUTTON_RC_REW |
178 | #define RIGHT BUTTON_RC_FF | 155 | #define RIGHT BUTTON_RC_FF |
179 | #define SELECT BUTTON_RC_PLAY | 156 | #define SELECT BUTTON_RC_PLAY |
180 | #define UP BUTTON_RC_VOL_UP | 157 | #define UP BUTTON_RC_VOL_UP |
181 | #define DOWN BUTTON_RC_VOL_DOWN | 158 | #define DOWN BUTTON_RC_VOL_DOWN |
182 | |||
183 | #define RC_QUIT BUTTON_REC | 159 | #define RC_QUIT BUTTON_REC |
184 | 160 | ||
185 | #elif CONFIG_KEYPAD == COWOND2_PAD | ||
186 | #define QUIT BUTTON_POWER | ||
187 | |||
188 | #elif CONFIG_KEYPAD == CREATIVEZVM_PAD | 161 | #elif CONFIG_KEYPAD == CREATIVEZVM_PAD |
189 | |||
190 | #define QUIT BUTTON_BACK | 162 | #define QUIT BUTTON_BACK |
191 | #define LEFT BUTTON_LEFT | 163 | #define LEFT BUTTON_LEFT |
192 | #define RIGHT BUTTON_RIGHT | 164 | #define RIGHT BUTTON_RIGHT |
@@ -195,7 +167,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
195 | #define DOWN BUTTON_DOWN | 167 | #define DOWN BUTTON_DOWN |
196 | 168 | ||
197 | #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD | 169 | #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD |
198 | |||
199 | #define QUIT BUTTON_POWER | 170 | #define QUIT BUTTON_POWER |
200 | #define LEFT BUTTON_LEFT | 171 | #define LEFT BUTTON_LEFT |
201 | #define RIGHT BUTTON_RIGHT | 172 | #define RIGHT BUTTON_RIGHT |
@@ -203,6 +174,9 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
203 | #define UP BUTTON_UP | 174 | #define UP BUTTON_UP |
204 | #define DOWN BUTTON_DOWN | 175 | #define DOWN BUTTON_DOWN |
205 | 176 | ||
177 | #elif CONFIG_KEYPAD == COWOND2_PAD | ||
178 | #define QUIT BUTTON_POWER | ||
179 | |||
206 | #elif CONFIG_KEYPAD == ONDAVX747_PAD | 180 | #elif CONFIG_KEYPAD == ONDAVX747_PAD |
207 | #define QUIT BUTTON_POWER | 181 | #define QUIT BUTTON_POWER |
208 | #define LEFT BUTTON_VOL_DOWN | 182 | #define LEFT BUTTON_VOL_DOWN |
@@ -239,24 +213,10 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
239 | #define SCROLL_BACK(x) (0) | 213 | #define SCROLL_BACK(x) (0) |
240 | #endif | 214 | #endif |
241 | 215 | ||
242 | |||
243 | enum menu_items { | ||
244 | BM_START, | ||
245 | BM_SEL_START, | ||
246 | BM_RESUME, | ||
247 | BM_SEL_RESUME, | ||
248 | BM_NO_RESUME, | ||
249 | BM_HELP, | ||
250 | BM_SEL_HELP, | ||
251 | BM_QUIT, | ||
252 | BM_SEL_QUIT, | ||
253 | }; | ||
254 | |||
255 | #include "pluginbitmaps/brickmania_pads.h" | 216 | #include "pluginbitmaps/brickmania_pads.h" |
256 | #include "pluginbitmaps/brickmania_bricks.h" | 217 | #include "pluginbitmaps/brickmania_bricks.h" |
257 | #include "pluginbitmaps/brickmania_powerups.h" | 218 | #include "pluginbitmaps/brickmania_powerups.h" |
258 | #include "pluginbitmaps/brickmania_ball.h" | 219 | #include "pluginbitmaps/brickmania_ball.h" |
259 | #include "pluginbitmaps/brickmania_menu_items.h" | ||
260 | #include "pluginbitmaps/brickmania_gameover.h" | 220 | #include "pluginbitmaps/brickmania_gameover.h" |
261 | 221 | ||
262 | #define PAD_WIDTH BMPWIDTH_brickmania_pads | 222 | #define PAD_WIDTH BMPWIDTH_brickmania_pads |
@@ -268,18 +228,9 @@ enum menu_items { | |||
268 | #define POWERUP_WIDTH BMPWIDTH_brickmania_powerups | 228 | #define POWERUP_WIDTH BMPWIDTH_brickmania_powerups |
269 | #define BALL BMPHEIGHT_brickmania_ball | 229 | #define BALL BMPHEIGHT_brickmania_ball |
270 | #define HALFBALL ((BALL+1)/2) | 230 | #define HALFBALL ((BALL+1)/2) |
271 | #define MENU_ITEMXOFS ((LCD_WIDTH - BMPWIDTH_brickmania_menu_items)/2) | ||
272 | #define MENU_ITEMHEIGHT (BMPHEIGHT_brickmania_menu_items/9) | ||
273 | #define MENU_ITEMWIDTH BMPWIDTH_brickmania_menu_items | ||
274 | #define GAMEOVER_WIDTH BMPWIDTH_brickmania_gameover | 231 | #define GAMEOVER_WIDTH BMPWIDTH_brickmania_gameover |
275 | #define GAMEOVER_HEIGHT BMPHEIGHT_brickmania_gameover | 232 | #define GAMEOVER_HEIGHT BMPHEIGHT_brickmania_gameover |
276 | 233 | ||
277 | #if LCD_DEPTH > 1 /* currently no background bmp for mono screens */ | ||
278 | #include "pluginbitmaps/brickmania_menu_bg.h" | ||
279 | #define MENU_BGHEIGHT BMPHEIGHT_brickmania_menu_bg | ||
280 | #define MENU_BGWIDTH BMPWIDTH_brickmania_menu_bg | ||
281 | #endif | ||
282 | |||
283 | #ifdef HAVE_LCD_COLOR /* currently no transparency for non-colour */ | 234 | #ifdef HAVE_LCD_COLOR /* currently no transparency for non-colour */ |
284 | #include "pluginbitmaps/brickmania_break.h" | 235 | #include "pluginbitmaps/brickmania_break.h" |
285 | #endif | 236 | #endif |
@@ -317,19 +268,8 @@ enum menu_items { | |||
317 | /*calculate paddle y-position */ | 268 | /*calculate paddle y-position */ |
318 | #define PAD_POS_Y (GAMESCREEN_HEIGHT - PAD_HEIGHT - 1) | 269 | #define PAD_POS_Y (GAMESCREEN_HEIGHT - PAD_HEIGHT - 1) |
319 | 270 | ||
320 | #ifdef HAVE_TOUCHSCREEN | ||
321 | #include "lib/touchscreen.h" | ||
322 | |||
323 | static struct ts_mapping main_menu_items[4] = | ||
324 | { | ||
325 | {MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH, MENU_ITEMHEIGHT}, | ||
326 | {MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, MENU_ITEMHEIGHT}, | ||
327 | {MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH, MENU_ITEMHEIGHT}, | ||
328 | {MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH, MENU_ITEMHEIGHT} | ||
329 | }; | ||
330 | static struct ts_mappings main_menu = {main_menu_items, 4}; | ||
331 | #endif | ||
332 | 271 | ||
272 | #define MARGIN 5 | ||
333 | 273 | ||
334 | int levels_num = 29; | 274 | int levels_num = 29; |
335 | 275 | ||
@@ -627,6 +567,11 @@ static unsigned char levels[29][8][10] = { | |||
627 | }; | 567 | }; |
628 | 568 | ||
629 | #define MAX_BALLS 10 | 569 | #define MAX_BALLS 10 |
570 | |||
571 | enum difficulty_options { | ||
572 | EASY, HARD | ||
573 | }; | ||
574 | |||
630 | int pad_pos_x; | 575 | int pad_pos_x; |
631 | int x[MAX_BALLS],y[MAX_BALLS]; | 576 | int x[MAX_BALLS],y[MAX_BALLS]; |
632 | int life; | 577 | int life; |
@@ -634,9 +579,12 @@ int start_game,con_game; | |||
634 | int pad_type; | 579 | int pad_type; |
635 | int score=0,vscore=0; | 580 | int score=0,vscore=0; |
636 | bool flip_sides=false; | 581 | bool flip_sides=false; |
637 | int cur_level=0; | 582 | int level=0; |
638 | int brick_on_board=0; | 583 | int brick_on_board=0; |
639 | int used_balls=1; | 584 | int used_balls=1; |
585 | bool saved_game=false; | ||
586 | int l_score=0; | ||
587 | int difficulty = EASY; | ||
640 | 588 | ||
641 | typedef struct cube { | 589 | typedef struct cube { |
642 | int powertop; | 590 | int powertop; |
@@ -667,15 +615,22 @@ typedef struct sfire { | |||
667 | } sfire; | 615 | } sfire; |
668 | sfire fire[30]; | 616 | sfire fire[30]; |
669 | 617 | ||
618 | #define CONFIG_FILE_NAME "brickmania.cfg" | ||
670 | 619 | ||
671 | int highscore; | 620 | static struct configdata config[] = { |
672 | #define MAX_POINTS 200000 /* i dont think it needs to be more */ | 621 | {TYPE_INT, 0, 1, { .int_p = &difficulty }, "difficulty", NULL}, |
673 | static struct configdata config[] = | 622 | {TYPE_BOOL, 0, 1, { .bool_p = &saved_game }, "saved_game", NULL}, |
674 | { | 623 | {TYPE_INT, 0, 40000, { .int_p = &l_score }, "l_score", NULL}, |
675 | {TYPE_INT, 0, MAX_POINTS, { .int_p = &highscore }, "highscore", NULL} | 624 | {TYPE_INT, 0, 29, { .int_p = &level }, "level", NULL}, |
625 | {TYPE_INT, 0, 30, { .int_p = &life }, "life", NULL}, | ||
676 | }; | 626 | }; |
677 | 627 | ||
678 | void int_game(int new_game) | 628 | #define HIGH_SCORE PLUGIN_GAMES_DIR "/brickmania.score" |
629 | #define NUM_SCORES 5 | ||
630 | |||
631 | struct highscore highest[NUM_SCORES]; | ||
632 | |||
633 | static void brickmania_int_game(int new_game) | ||
679 | { | 634 | { |
680 | int i,j; | 635 | int i,j; |
681 | 636 | ||
@@ -698,27 +653,32 @@ void int_game(int new_game) | |||
698 | 653 | ||
699 | flip_sides=false; | 654 | flip_sides=false; |
700 | 655 | ||
701 | if (new_game==1) | 656 | if (new_game==1) { |
702 | brick_on_board=0; | 657 | brick_on_board=0; |
703 | 658 | /* add one life per achieved level */ | |
659 | if (difficulty==EASY && life<2) { | ||
660 | score-=100; | ||
661 | life++; | ||
662 | } | ||
663 | } | ||
704 | for(i=0;i<=7;i++) { | 664 | for(i=0;i<=7;i++) { |
705 | for(j=0;j<=9;j++) { | 665 | for(j=0;j<=9;j++) { |
706 | brick[i*10+j].poweruse=(levels[cur_level][i][j]==0?0:1); | 666 | brick[i*10+j].poweruse=(levels[level][i][j]==0?0:1); |
707 | if (i*10+j<=30) | 667 | if (i*10+j<=30) |
708 | fire[i*10+j].top=-8; | 668 | fire[i*10+j].top=-8; |
709 | if (new_game==1) { | 669 | if (new_game==1) { |
710 | brick[i*10+j].power=rb->rand()%25; | 670 | brick[i*10+j].power=rb->rand()%25; |
711 | /* +8 make the game with less powerups */ | 671 | /* +8 make the game with less powerups */ |
712 | 672 | ||
713 | brick[i*10+j].hits=levels[cur_level][i][j]>=10? | 673 | brick[i*10+j].hits=levels[level][i][j]>=10? |
714 | levels[cur_level][i][j]/16-1:0; | 674 | levels[level][i][j]/16-1:0; |
715 | brick[i*10+j].hiteffect=0; | 675 | brick[i*10+j].hiteffect=0; |
716 | brick[i*10+j].powertop=TOPMARGIN+i*BRICK_HEIGHT+BRICK_HEIGHT; | 676 | brick[i*10+j].powertop=TOPMARGIN+i*BRICK_HEIGHT+BRICK_HEIGHT; |
717 | brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1); | 677 | brick[i*10+j].used=(levels[level][i][j]==0?0:1); |
718 | brick[i*10+j].color=(levels[cur_level][i][j]>=10? | 678 | brick[i*10+j].color=(levels[level][i][j]>=10? |
719 | levels[cur_level][i][j]%16: | 679 | levels[level][i][j]%16: |
720 | levels[cur_level][i][j])-1; | 680 | levels[level][i][j])-1; |
721 | if (levels[cur_level][i][j]!=0) | 681 | if (levels[level][i][j]!=0) |
722 | brick_on_board++; | 682 | brick_on_board++; |
723 | } | 683 | } |
724 | } | 684 | } |
@@ -727,17 +687,24 @@ void int_game(int new_game) | |||
727 | 687 | ||
728 | int sw,i,w; | 688 | int sw,i,w; |
729 | 689 | ||
730 | /* sleep timer counting the score */ | 690 | /* brickmania_sleep timer counting the score */ |
731 | void sleep (int secs) | 691 | static void brickmania_sleep(int secs) |
732 | { | 692 | { |
733 | bool done=false; | 693 | bool done=false; |
734 | char s[20]; | 694 | char s[20]; |
735 | int count=0; | 695 | int count=0; |
736 | 696 | ||
737 | while (!done) { | 697 | while (!done) { |
738 | 698 | if (vscore == score) { | |
739 | if (vscore<score) { | 699 | if (count==0) |
740 | vscore++; | 700 | count=*rb->current_tick+HZ*secs; |
701 | if (*rb->current_tick>=count) | ||
702 | done=true; | ||
703 | } else { | ||
704 | if (vscore<score) | ||
705 | vscore++; | ||
706 | if (vscore>score) | ||
707 | vscore--; | ||
741 | rb->snprintf(s, sizeof(s), "%d", vscore); | 708 | rb->snprintf(s, sizeof(s), "%d", vscore); |
742 | rb->lcd_getstringsize(s, &sw, &w); | 709 | rb->lcd_getstringsize(s, &sw, &w); |
743 | #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) | 710 | #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) |
@@ -746,304 +713,172 @@ void sleep (int secs) | |||
746 | rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 2, s); | 713 | rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 2, s); |
747 | #endif | 714 | #endif |
748 | rb->lcd_update_rect(0,0,LCD_WIDTH,w+2); | 715 | rb->lcd_update_rect(0,0,LCD_WIDTH,w+2); |
749 | } else { | ||
750 | if (count==0) | ||
751 | count=*rb->current_tick+HZ*secs; | ||
752 | if (*rb->current_tick>=count) | ||
753 | done=true; | ||
754 | } | ||
755 | rb->yield(); | ||
756 | } | ||
757 | |||
758 | } | ||
759 | |||
760 | #define HIGH_SCORE "brickmania.score" | ||
761 | #define MENU_LENGTH 4 | ||
762 | int game_menu(int when) | ||
763 | { | ||
764 | int button,cur=0; | ||
765 | char str[10]; | ||
766 | rb->lcd_clear_display(); | ||
767 | #if LCD_DEPTH > 1 /* currently no background bmp for mono screens */ | ||
768 | rb->lcd_bitmap(brickmania_menu_bg, 0, 0, MENU_BGWIDTH, MENU_BGHEIGHT); | ||
769 | #endif | ||
770 | while (true) { | ||
771 | for(i=0;i<MENU_LENGTH;i++) { | ||
772 | #ifdef HAVE_LCD_COLOR | ||
773 | if (cur==0) | ||
774 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
775 | MENU_ITEMHEIGHT * BM_SEL_START, MENU_ITEMWIDTH, | ||
776 | MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH, | ||
777 | MENU_ITEMHEIGHT); | ||
778 | else | ||
779 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
780 | MENU_ITEMHEIGHT * BM_START, MENU_ITEMWIDTH, | ||
781 | MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH, | ||
782 | MENU_ITEMHEIGHT); | ||
783 | |||
784 | if (when==1) { | ||
785 | if (cur==1) | ||
786 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
787 | MENU_ITEMHEIGHT * BM_SEL_RESUME, MENU_ITEMWIDTH, | ||
788 | MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, | ||
789 | MENU_ITEMHEIGHT); | ||
790 | else | ||
791 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
792 | MENU_ITEMHEIGHT * BM_RESUME, MENU_ITEMWIDTH, | ||
793 | MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, | ||
794 | MENU_ITEMHEIGHT); | ||
795 | |||
796 | } else { | ||
797 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
798 | MENU_ITEMHEIGHT * BM_NO_RESUME, MENU_ITEMWIDTH, | ||
799 | MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, | ||
800 | MENU_ITEMHEIGHT); | ||
801 | } | ||
802 | |||
803 | |||
804 | if (cur==2) | ||
805 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
806 | MENU_ITEMHEIGHT * BM_SEL_HELP, MENU_ITEMWIDTH, | ||
807 | MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH, | ||
808 | MENU_ITEMHEIGHT); | ||
809 | else | ||
810 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
811 | MENU_ITEMHEIGHT * BM_HELP, MENU_ITEMWIDTH, | ||
812 | MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH, | ||
813 | MENU_ITEMHEIGHT); | ||
814 | |||
815 | if (cur==3) | ||
816 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
817 | MENU_ITEMHEIGHT * BM_SEL_QUIT, MENU_ITEMWIDTH, | ||
818 | MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH, | ||
819 | MENU_ITEMHEIGHT); | ||
820 | else | ||
821 | rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, | ||
822 | MENU_ITEMHEIGHT * BM_QUIT, MENU_ITEMWIDTH, | ||
823 | MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH, | ||
824 | MENU_ITEMHEIGHT); | ||
825 | #else | ||
826 | if (cur==0) | ||
827 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
828 | MENU_ITEMHEIGHT * BM_SEL_START, MENU_ITEMWIDTH, | ||
829 | MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH, | ||
830 | MENU_ITEMHEIGHT); | ||
831 | else | ||
832 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
833 | MENU_ITEMHEIGHT * BM_START, MENU_ITEMWIDTH, | ||
834 | MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH, | ||
835 | MENU_ITEMHEIGHT); | ||
836 | |||
837 | if (when==1) { | ||
838 | if (cur==1) | ||
839 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
840 | MENU_ITEMHEIGHT * BM_SEL_RESUME, MENU_ITEMWIDTH, | ||
841 | MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, | ||
842 | MENU_ITEMHEIGHT); | ||
843 | else | ||
844 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
845 | MENU_ITEMHEIGHT * BM_RESUME, MENU_ITEMWIDTH, | ||
846 | MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, | ||
847 | MENU_ITEMHEIGHT); | ||
848 | |||
849 | } else { | ||
850 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
851 | MENU_ITEMHEIGHT * BM_NO_RESUME, MENU_ITEMWIDTH, | ||
852 | MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH, | ||
853 | MENU_ITEMHEIGHT); | ||
854 | } | ||
855 | |||
856 | |||
857 | if (cur==2) | ||
858 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
859 | MENU_ITEMHEIGHT * BM_SEL_HELP, MENU_ITEMWIDTH, | ||
860 | MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH, | ||
861 | MENU_ITEMHEIGHT); | ||
862 | else | ||
863 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
864 | MENU_ITEMHEIGHT * BM_HELP, MENU_ITEMWIDTH, | ||
865 | MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH, | ||
866 | MENU_ITEMHEIGHT); | ||
867 | |||
868 | if (cur==3) | ||
869 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
870 | MENU_ITEMHEIGHT * BM_SEL_QUIT, MENU_ITEMWIDTH, | ||
871 | MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH, | ||
872 | MENU_ITEMHEIGHT); | ||
873 | else | ||
874 | rb->lcd_bitmap_part(brickmania_menu_items, 0, | ||
875 | MENU_ITEMHEIGHT * BM_QUIT, MENU_ITEMWIDTH, | ||
876 | MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH, | ||
877 | MENU_ITEMHEIGHT); | ||
878 | #endif | ||
879 | } | ||
880 | rb->lcd_set_drawmode(DRMODE_FG); | ||
881 | /* high score */ | ||
882 | #ifdef HAVE_LCD_COLOR | ||
883 | rb->lcd_set_background(LCD_RGBPACK(0,0,140)); | ||
884 | rb->lcd_set_foreground(LCD_WHITE); | ||
885 | #endif | ||
886 | rb->lcd_putsxy(HIGHSCORE_XPOS, HIGHSCORE_YPOS, "High Score"); | ||
887 | rb->snprintf(str, sizeof(str), "%d", highscore); | ||
888 | rb->lcd_getstringsize("High Score", &sw, NULL); | ||
889 | rb->lcd_getstringsize(str, &w, NULL); | ||
890 | rb->lcd_putsxy(HIGHSCORE_XPOS+sw/2-w/2, HIGHSCORE_YPOS+9, str); | ||
891 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
892 | |||
893 | rb->lcd_update(); | ||
894 | |||
895 | button = rb->button_get(true); | ||
896 | #ifdef HAVE_TOUCHSCREEN | ||
897 | if(button & BUTTON_TOUCHSCREEN) | ||
898 | { | ||
899 | unsigned int result = | ||
900 | touchscreen_map(&main_menu, rb->button_get_data() >> 16, | ||
901 | rb->button_get_data() & 0xffff); | ||
902 | |||
903 | if(result != (unsigned)-1 && button & BUTTON_REL) | ||
904 | { | ||
905 | if(cur == (signed)result) | ||
906 | button = SELECT; | ||
907 | cur = result; | ||
908 | } | ||
909 | } | 716 | } |
910 | #endif | ||
911 | switch(button) { | ||
912 | case UP: | ||
913 | case UP | BUTTON_REPEAT: | ||
914 | if (cur==0) | ||
915 | cur = MENU_LENGTH-1; | ||
916 | else | ||
917 | cur--; | ||
918 | if (when==0 && cur==1) { | ||
919 | cur = 0; | ||
920 | } | ||
921 | break; | ||
922 | |||
923 | case DOWN: | ||
924 | case DOWN | BUTTON_REPEAT: | ||
925 | if (cur==MENU_LENGTH-1) | ||
926 | cur = 0; | ||
927 | else | ||
928 | cur++; | ||
929 | if (when==0 && cur==1) { | ||
930 | cur=2; | ||
931 | } | ||
932 | break; | ||
933 | |||
934 | case RIGHT: | ||
935 | case SELECT: | ||
936 | if (cur==0) { | ||
937 | score=0; | ||
938 | vscore=0; | ||
939 | return 0; | ||
940 | } else if (cur==1 && when==1) { | ||
941 | return 1; | ||
942 | } else if (cur==2) { | ||
943 | return 2; | ||
944 | } else if (cur==3) { | ||
945 | return 3; | ||
946 | } | ||
947 | break; | ||
948 | #ifdef RC_QUIT | ||
949 | case RC_QUIT: | ||
950 | #endif | ||
951 | case QUIT: | ||
952 | return 3; | ||
953 | break; | ||
954 | |||
955 | default: | ||
956 | if(rb->default_event_handler(button) == SYS_USB_CONNECTED) | ||
957 | return 3; | ||
958 | break; | ||
959 | } | ||
960 | |||
961 | rb->yield(); | 717 | rb->yield(); |
962 | } | 718 | } |
963 | } | 719 | } |
964 | 720 | ||
965 | int help(void) | 721 | static int brickmania_help(void) |
966 | { | 722 | { |
967 | int button; | 723 | rb->lcd_setfont(FONT_UI); |
968 | #define WORDS (sizeof help_text / sizeof (char*)) | 724 | #define WORDS (sizeof help_text / sizeof (char*)) |
969 | static char* help_text[] = { | 725 | static char *help_text[] = { |
970 | "BrickMania", "", "Aim", "", | 726 | "Brickmania", "", "Aim", "", |
971 | "Destroy", "all", "the", "bricks", "by", "bouncing", | 727 | "Destroy", "all", "the", "bricks", "by", "bouncing", |
972 | "the", "ball", "of", "them", "using", "the", "paddle.", "", "", | 728 | "the", "ball", "of", "them", "using", "the", "paddle.", "", "", |
973 | "Controls", "", | 729 | "Controls", "", |
974 | "< & >", "Move", "the", "paddle", "", | 730 | "< & >", "Moves", "the", "paddle", "", |
975 | #if CONFIG_KEYPAD == ONDIO_PAD | 731 | #if CONFIG_KEYPAD == ONDIO_PAD |
976 | "MENU", | 732 | "MENU:", |
977 | #elif (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IAUDIO_M3_PAD) | 733 | #elif (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IAUDIO_M3_PAD) |
978 | "PLAY", | 734 | "PLAY:", |
979 | #elif CONFIG_KEYPAD == IRIVER_H300_PAD | 735 | #elif CONFIG_KEYPAD == IRIVER_H300_PAD |
980 | "NAVI", | 736 | "NAVI:", |
981 | #else | 737 | #else |
982 | "SELECT", | 738 | "SELECT:", |
983 | #endif | 739 | #endif |
984 | "Releases", "the", "ball/", "Fire!", "", | 740 | "Releases", "the", "ball/Fire!", "", |
985 | #if CONFIG_KEYPAD == IAUDIO_M3_PAD | 741 | #if CONFIG_KEYPAD == IAUDIO_M3_PAD |
986 | "REC", | 742 | "REC:", |
987 | #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \ | 743 | #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \ |
988 | (CONFIG_KEYPAD == CREATIVEZVM_PAD) | 744 | (CONFIG_KEYPAD == CREATIVEZVM_PAD) |
989 | "BACK", | 745 | "BACK:", |
990 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 746 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
991 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ | 747 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ |
992 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) | 748 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \ |
993 | "MENU", | 749 | (CONFIG_KEYPAD == SANSA_FUZE_PAD) |
750 | "MENU:", | ||
994 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 751 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
995 | (CONFIG_KEYPAD == IRIVER_H300_PAD) || \ | 752 | (CONFIG_KEYPAD == IRIVER_H300_PAD) || \ |
996 | (CONFIG_KEYPAD == ONDIO_PAD) || \ | 753 | (CONFIG_KEYPAD == ONDIO_PAD) || \ |
997 | (CONFIG_KEYPAD == RECORDER_PAD) || \ | 754 | (CONFIG_KEYPAD == RECORDER_PAD) || \ |
998 | (CONFIG_KEYPAD == ARCHOS_AV300_PAD) | 755 | (CONFIG_KEYPAD == ARCHOS_AV300_PAD) |
999 | "STOP", | 756 | "STOP:", |
1000 | #else | 757 | #else |
1001 | "POWER", | 758 | "POWER:", |
1002 | #endif | 759 | #endif |
1003 | "Opens", "menu/", "Quit", "", "", | 760 | "Returns", "to", "menu", "", "", |
1004 | "Specials", "", | 761 | "Specials", "", |
1005 | "N", "Normal:", "returns", "paddle", "to", "normal", "", | 762 | "N", "Normal:", "returns", "paddle", "to", "normal", "", |
1006 | "D", "DIE!:", "loses", "a", "life", "", | 763 | "D", "DIE!:", "loses", "a", "life", "", |
1007 | "L", "Life:", "gains", "a", "life/", "power", "up", "", | 764 | "L", "Life:", "gains", "a", "life/power", "up", "", |
1008 | "F", "Fire:", "allows", "you", "to", "shoot", "bricks", "", | 765 | "F", "Fire:", "allows", "you", "to", "shoot", "bricks", "", |
1009 | "G", "Glue:", "ball", "sticks", "to", "paddle", "", | 766 | "G", "Glue:", "ball", "sticks", "to", "paddle", "", |
1010 | "B", "Ball:", "generates", "another", "ball", "", | 767 | "B", "Ball:", "generates", "another", "ball", "", |
1011 | "FL", "Flip:", "flips", "left /", "right", "movement", | 768 | "FL", "Flip:", "flips", "left / right", "movement", "", |
1012 | }; | 769 | }; |
1013 | static struct style_text formation[]={ | 770 | static struct style_text formation[]={ |
1014 | { 0, TEXT_CENTER|TEXT_UNDERLINE }, | 771 | { 0, TEXT_CENTER|TEXT_UNDERLINE }, |
1015 | { 2, C_RED }, | 772 | { 2, C_RED }, |
1016 | { 19, C_RED }, | 773 | { 19, C_RED }, |
1017 | { 38, C_RED }, | 774 | { 37, C_RED }, |
1018 | { 40, C_BLUE }, | 775 | { 39, C_BLUE }, |
1019 | { 47, C_RED }, | 776 | { 46, C_RED }, |
1020 | { 53, C_GREEN }, | 777 | { 52, C_GREEN }, |
1021 | { 61, C_ORANGE }, | 778 | { 59, C_ORANGE }, |
1022 | { 69, C_GREEN }, | 779 | { 67, C_GREEN }, |
1023 | { 76, C_YELLOW }, | 780 | { 74, C_YELLOW }, |
1024 | { 82, C_RED }, | 781 | { 80, C_RED }, |
1025 | { -1, 0 } | ||
1026 | }; | 782 | }; |
1027 | 783 | ||
1028 | #ifdef HAVE_LCD_COLOR | 784 | if (display_text(WORDS, help_text, formation, NULL)==PLUGIN_USB_CONNECTED) |
1029 | rb->lcd_set_background(LCD_BLACK); | 785 | return PLUGIN_USB_CONNECTED; |
1030 | rb->lcd_set_foreground(LCD_WHITE); | 786 | int button; |
1031 | #endif | ||
1032 | |||
1033 | rb->lcd_setfont(FONT_UI); | ||
1034 | if (display_text(WORDS, help_text, formation, NULL)) | ||
1035 | return 1; | ||
1036 | do { | 787 | do { |
1037 | button = rb->button_get(true); | 788 | button = rb->button_get(true); |
1038 | if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED ) | 789 | if (button == SYS_USB_CONNECTED) { |
1039 | return 1; | 790 | return PLUGIN_USB_CONNECTED; |
791 | } | ||
1040 | } while( ( button == BUTTON_NONE ) | 792 | } while( ( button == BUTTON_NONE ) |
1041 | || ( button & (BUTTON_REL|BUTTON_REPEAT) ) ); | 793 | || ( button & (BUTTON_REL|BUTTON_REPEAT) ) ); |
1042 | rb->lcd_setfont(FONT_SYSFIXED); | 794 | rb->lcd_setfont(FONT_SYSFIXED); |
1043 | return 0; | 795 | return 0; |
1044 | } | 796 | } |
1045 | 797 | ||
1046 | int pad_check(int ballxc, int mode, int pon ,int ballnum) | 798 | static bool _ingame; |
799 | static int brickmania_menu_cb(int action, const struct menu_item_ex *this_item) | ||
800 | { | ||
801 | if(action == ACTION_REQUEST_MENUITEM | ||
802 | && !_ingame && ((intptr_t)this_item)==0) | ||
803 | return ACTION_EXIT_MENUITEM; | ||
804 | return action; | ||
805 | } | ||
806 | |||
807 | static int brickmania_menu(bool ingame) | ||
808 | { | ||
809 | rb->button_clear_queue(); | ||
810 | int choice = 0; | ||
811 | |||
812 | _ingame = ingame; | ||
813 | |||
814 | static struct opt_items options[] = { | ||
815 | { "Easy", -1 }, | ||
816 | { "Hard", -1 }, | ||
817 | }; | ||
818 | |||
819 | MENUITEM_STRINGLIST (main_menu, "Brickmania Menu", brickmania_menu_cb, | ||
820 | "Resume Game", | ||
821 | "Start New Game", | ||
822 | "Difficulty", | ||
823 | "Help", | ||
824 | "High Score", | ||
825 | "Playback Control", | ||
826 | "Quit"); | ||
827 | |||
828 | while (true) { | ||
829 | switch (rb->do_menu(&main_menu, &choice, NULL, false)) { | ||
830 | case 0: | ||
831 | if (saved_game) { | ||
832 | saved_game = false; | ||
833 | vscore=l_score-1; | ||
834 | score=l_score; | ||
835 | brickmania_int_game(1); | ||
836 | } else { | ||
837 | int i; | ||
838 | for(i=0;i<used_balls;i++) | ||
839 | if (ball[i].x!=0 && ball[i].y !=0) | ||
840 | con_game=1; | ||
841 | } | ||
842 | return 0; | ||
843 | case 1: | ||
844 | score=0; | ||
845 | vscore=0; | ||
846 | life=2; | ||
847 | level=0; | ||
848 | brickmania_int_game(1); | ||
849 | return 0; | ||
850 | case 2: | ||
851 | rb->set_option("Difficulty", &difficulty, INT, options, 2, NULL); | ||
852 | break; | ||
853 | case 3: | ||
854 | if (brickmania_help()) | ||
855 | return 1; | ||
856 | break; | ||
857 | case 4: | ||
858 | highscore_show(NUM_SCORES, highest, NUM_SCORES); | ||
859 | break; | ||
860 | case 5: | ||
861 | playback_control(NULL); | ||
862 | break; | ||
863 | case 6: | ||
864 | if (level>0 && ingame) { | ||
865 | saved_game=true; | ||
866 | rb->splash(HZ*1, "Saving last achieved level ..."); | ||
867 | configfile_save(CONFIG_FILE_NAME,config,5,0); | ||
868 | } else { | ||
869 | saved_game=false; | ||
870 | configfile_save(CONFIG_FILE_NAME,config,1,0); | ||
871 | } | ||
872 | return 1; | ||
873 | case MENU_ATTACHED_USB: | ||
874 | return 1; | ||
875 | default: | ||
876 | break; | ||
877 | } | ||
878 | } | ||
879 | } | ||
880 | |||
881 | static int brickmania_pad_check(int ballxc, int mode, int pon ,int ballnum) | ||
1047 | { | 882 | { |
1048 | /* pon: positive(1) or negative(0) */ | 883 | /* pon: positive(1) or negative(0) */ |
1049 | 884 | ||
@@ -1060,7 +895,7 @@ int pad_check(int ballxc, int mode, int pon ,int ballnum) | |||
1060 | } | 895 | } |
1061 | } | 896 | } |
1062 | 897 | ||
1063 | int fire_space(void) | 898 | static int brickmania_fire_space(void) |
1064 | { | 899 | { |
1065 | int t; | 900 | int t; |
1066 | for(t=0;t<=30;t++) | 901 | for(t=0;t<=30;t++) |
@@ -1070,28 +905,25 @@ int fire_space(void) | |||
1070 | return 0; | 905 | return 0; |
1071 | } | 906 | } |
1072 | 907 | ||
1073 | int game_loop(void) | 908 | static int brickmania_game_loop(void) |
1074 | { | 909 | { |
1075 | int j,i,k,bricky,brickx; | 910 | int j,i,k,bricky,brickx; |
1076 | char s[30]; | 911 | char s[30]; |
1077 | int sec_count=0,num_count=10; | 912 | int sec_count=0,num_count=10; |
1078 | int end; | 913 | int end; |
914 | int position; | ||
915 | |||
916 | configfile_load(CONFIG_FILE_NAME,config,5,0); | ||
1079 | 917 | ||
1080 | switch(game_menu(0)) { | 918 | rb->srand( *rb->current_tick ); |
1081 | case 0: | 919 | if (saved_game) { |
1082 | cur_level = 0; | 920 | if (brickmania_menu(true)!=0) { |
1083 | life = 2; | 921 | return 1; |
1084 | int_game(1); | 922 | } |
1085 | break; | 923 | } else { |
1086 | case 1: | 924 | if (brickmania_menu(false)!=0) { |
1087 | con_game = 1; | ||
1088 | break; | ||
1089 | case 2: | ||
1090 | return help(); | ||
1091 | break; | ||
1092 | case 3: | ||
1093 | return 1; | 925 | return 1; |
1094 | break; | 926 | } |
1095 | } | 927 | } |
1096 | 928 | ||
1097 | while(true) { | 929 | while(true) { |
@@ -1137,11 +969,11 @@ int game_loop(void) | |||
1137 | #endif | 969 | #endif |
1138 | 970 | ||
1139 | #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) | 971 | #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) |
1140 | rb->snprintf(s, sizeof(s), "L%d", cur_level+1); | 972 | rb->snprintf(s, sizeof(s), "L%d", level+1); |
1141 | rb->lcd_getstringsize(s, &sw, NULL); | 973 | rb->lcd_getstringsize(s, &sw, NULL); |
1142 | rb->lcd_putsxy(LCD_WIDTH-sw, 0, s); | 974 | rb->lcd_putsxy(LCD_WIDTH-sw, 0, s); |
1143 | #else | 975 | #else |
1144 | rb->snprintf(s, sizeof(s), "Level %d", cur_level+1); | 976 | rb->snprintf(s, sizeof(s), "Level %d", level+1); |
1145 | rb->lcd_getstringsize(s, &sw, NULL); | 977 | rb->lcd_getstringsize(s, &sw, NULL); |
1146 | rb->lcd_putsxy(LCD_WIDTH-sw-2, 2, s); | 978 | rb->lcd_putsxy(LCD_WIDTH-sw-2, 2, s); |
1147 | #endif | 979 | #endif |
@@ -1221,8 +1053,8 @@ int game_loop(void) | |||
1221 | case 1: | 1053 | case 1: |
1222 | life--; | 1054 | life--; |
1223 | if (life>=0) { | 1055 | if (life>=0) { |
1224 | int_game(0); | 1056 | brickmania_int_game(0); |
1225 | sleep(2); | 1057 | brickmania_sleep(2); |
1226 | } | 1058 | } |
1227 | break; | 1059 | break; |
1228 | case 2: | 1060 | case 2: |
@@ -1308,7 +1140,6 @@ int game_loop(void) | |||
1308 | BRICK_HEIGHT); | 1140 | BRICK_HEIGHT); |
1309 | #endif | 1141 | #endif |
1310 | } | 1142 | } |
1311 | |||
1312 | /* Somewhere in here collision checking is done b/w ball and | 1143 | /* Somewhere in here collision checking is done b/w ball and |
1313 | * brick. | 1144 | * brick. |
1314 | */ | 1145 | */ |
@@ -1508,8 +1339,8 @@ int game_loop(void) | |||
1508 | } else { | 1339 | } else { |
1509 | life--; | 1340 | life--; |
1510 | if (life>=0) { | 1341 | if (life>=0) { |
1511 | int_game(0); | 1342 | brickmania_int_game(0); |
1512 | sleep(2); | 1343 | brickmania_sleep(2); |
1513 | } | 1344 | } |
1514 | } | 1345 | } |
1515 | } | 1346 | } |
@@ -1536,7 +1367,7 @@ int game_loop(void) | |||
1536 | ball[k].y = -2; | 1367 | ball[k].y = -2; |
1537 | if (ball[k].pos_x != 0 && | 1368 | if (ball[k].pos_x != 0 && |
1538 | ball[k].pos_x+BALL!=LCD_WIDTH) | 1369 | ball[k].pos_x+BALL!=LCD_WIDTH) |
1539 | ball[k].x = pad_check(6,0,ball[k].pos_x+2<= | 1370 | ball[k].x = brickmania_pad_check(6,0,ball[k].pos_x+2<= |
1540 | pad_pos_x+(PAD_WIDTH/2)? | 1371 | pad_pos_x+(PAD_WIDTH/2)? |
1541 | 0:1,k); | 1372 | 0:1,k); |
1542 | 1373 | ||
@@ -1553,7 +1384,7 @@ int game_loop(void) | |||
1553 | ball[k].y = -3; | 1384 | ball[k].y = -3; |
1554 | if (ball[k].pos_x != 0 && | 1385 | if (ball[k].pos_x != 0 && |
1555 | ball[k].pos_x+BALL!=LCD_WIDTH) | 1386 | ball[k].pos_x+BALL!=LCD_WIDTH) |
1556 | ball[k].x = pad_check(4,0,ball[k].pos_x+2<= | 1387 | ball[k].x = brickmania_pad_check(4,0,ball[k].pos_x+2<= |
1557 | pad_pos_x+(PAD_WIDTH/2)? | 1388 | pad_pos_x+(PAD_WIDTH/2)? |
1558 | 0:1,k); | 1389 | 0:1,k); |
1559 | 1390 | ||
@@ -1570,7 +1401,7 @@ int game_loop(void) | |||
1570 | ball[k].y = -4; | 1401 | ball[k].y = -4; |
1571 | if (ball[k].pos_x != 0 && | 1402 | if (ball[k].pos_x != 0 && |
1572 | ball[k].pos_x+BALL!=LCD_WIDTH) | 1403 | ball[k].pos_x+BALL!=LCD_WIDTH) |
1573 | ball[k].x = pad_check(3,0,ball[k].pos_x+2<= | 1404 | ball[k].x = brickmania_pad_check(3,0,ball[k].pos_x+2<= |
1574 | pad_pos_x+(PAD_WIDTH/2)? | 1405 | pad_pos_x+(PAD_WIDTH/2)? |
1575 | 0:1,k); | 1406 | 0:1,k); |
1576 | 1407 | ||
@@ -1586,7 +1417,7 @@ int game_loop(void) | |||
1586 | ball[k].y = -4; | 1417 | ball[k].y = -4; |
1587 | if (ball[k].pos_x != 0 && | 1418 | if (ball[k].pos_x != 0 && |
1588 | ball[k].pos_x+BALL!=LCD_WIDTH) | 1419 | ball[k].pos_x+BALL!=LCD_WIDTH) |
1589 | ball[k].x = pad_check(2,1,0,k); | 1420 | ball[k].x = brickmania_pad_check(2,1,0,k); |
1590 | 1421 | ||
1591 | } | 1422 | } |
1592 | else { | 1423 | else { |
@@ -1615,11 +1446,13 @@ int game_loop(void) | |||
1615 | rb->lcd_update(); | 1446 | rb->lcd_update(); |
1616 | 1447 | ||
1617 | if (brick_on_board < 0) { | 1448 | if (brick_on_board < 0) { |
1618 | if (cur_level+1<levels_num) { | 1449 | if (level+1<levels_num) { |
1619 | cur_level++; | 1450 | level++; |
1620 | score+=100; | 1451 | if (difficulty==HARD) |
1621 | int_game(1); | 1452 | score+=100; |
1622 | sleep(2); | 1453 | l_score=score; |
1454 | brickmania_int_game(1); | ||
1455 | brickmania_sleep(2); | ||
1623 | } | 1456 | } |
1624 | else { | 1457 | else { |
1625 | rb->lcd_getstringsize("Congratulations!", &sw, NULL); | 1458 | rb->lcd_getstringsize("Congratulations!", &sw, NULL); |
@@ -1636,17 +1469,22 @@ int game_loop(void) | |||
1636 | "You have finished the game!"); | 1469 | "You have finished the game!"); |
1637 | #endif | 1470 | #endif |
1638 | vscore=score; | 1471 | vscore=score; |
1472 | rb->lcd_clear_display(); | ||
1639 | rb->lcd_update(); | 1473 | rb->lcd_update(); |
1640 | if (score>highscore) { | 1474 | rb->sleep(2); |
1641 | sleep(2); | 1475 | position=highscore_update(score, level+1, "", |
1642 | highscore=score; | 1476 | highest,NUM_SCORES); |
1477 | if (position == 0) { | ||
1643 | rb->splash(HZ*2, "New High Score"); | 1478 | rb->splash(HZ*2, "New High Score"); |
1644 | } | 1479 | } |
1645 | else { | 1480 | if (position != -1) { |
1646 | sleep(3); | 1481 | highscore_show(position, highest, NUM_SCORES); |
1482 | } else { | ||
1483 | brickmania_sleep(3); | ||
1484 | } | ||
1485 | if (brickmania_menu(false)!=0) { | ||
1486 | return 0; | ||
1647 | } | 1487 | } |
1648 | |||
1649 | return 0; | ||
1650 | } | 1488 | } |
1651 | } | 1489 | } |
1652 | 1490 | ||
@@ -1757,10 +1595,10 @@ int game_loop(void) | |||
1757 | } | 1595 | } |
1758 | } else if (pad_type==2 && con_game!=1) { | 1596 | } else if (pad_type==2 && con_game!=1) { |
1759 | int tfire; | 1597 | int tfire; |
1760 | tfire=fire_space(); | 1598 | tfire=brickmania_fire_space(); |
1761 | fire[tfire].top=PAD_POS_Y-7; | 1599 | fire[tfire].top=PAD_POS_Y-7; |
1762 | fire[tfire].left=pad_pos_x+1; | 1600 | fire[tfire].left=pad_pos_x+1; |
1763 | tfire=fire_space(); | 1601 | tfire=brickmania_fire_space(); |
1764 | fire[tfire].top=PAD_POS_Y-7; | 1602 | fire[tfire].top=PAD_POS_Y-7; |
1765 | fire[tfire].left=pad_pos_x+PAD_WIDTH-1; | 1603 | fire[tfire].left=pad_pos_x+PAD_WIDTH-1; |
1766 | } else if (con_game==1 && start_game!=1) { | 1604 | } else if (con_game==1 && start_game!=1) { |
@@ -1775,28 +1613,8 @@ int game_loop(void) | |||
1775 | case RC_QUIT: | 1613 | case RC_QUIT: |
1776 | #endif | 1614 | #endif |
1777 | case QUIT: | 1615 | case QUIT: |
1778 | while(1) { | 1616 | if (brickmania_menu(true)!=0) { |
1779 | switch(game_menu(1)) { | 1617 | return 1; |
1780 | case 0: | ||
1781 | life=2; | ||
1782 | cur_level=0; | ||
1783 | int_game(1); | ||
1784 | break; | ||
1785 | case 1: | ||
1786 | for(k=0;k<used_balls;k++) | ||
1787 | if (ball[k].x!=0 && ball[k].y !=0) | ||
1788 | con_game=1; | ||
1789 | break; | ||
1790 | case 2: | ||
1791 | if (help()==1) | ||
1792 | return 1; | ||
1793 | continue; | ||
1794 | break; | ||
1795 | case 3: | ||
1796 | return 1; | ||
1797 | break; | ||
1798 | } | ||
1799 | break; | ||
1800 | } | 1618 | } |
1801 | 1619 | ||
1802 | for(k=0;k<used_balls;k++) { | 1620 | for(k=0;k<used_balls;k++) { |
@@ -1828,12 +1646,15 @@ int game_loop(void) | |||
1828 | GAMEOVER_WIDTH,GAMEOVER_HEIGHT); | 1646 | GAMEOVER_WIDTH,GAMEOVER_HEIGHT); |
1829 | #endif | 1647 | #endif |
1830 | rb->lcd_update(); | 1648 | rb->lcd_update(); |
1831 | if (score>highscore) { | 1649 | brickmania_sleep(2); |
1832 | sleep(2); | 1650 | position=highscore_update(score, level+1, "", highest, NUM_SCORES); |
1833 | highscore=score; | 1651 | if (position == 0) { |
1834 | rb->splash(HZ*2, "New High Score"); | 1652 | rb->splash(HZ*2, "New High Score"); |
1653 | } | ||
1654 | if (position != -1) { | ||
1655 | highscore_show(position, highest, NUM_SCORES); | ||
1835 | } else { | 1656 | } else { |
1836 | sleep(3); | 1657 | brickmania_sleep(3); |
1837 | } | 1658 | } |
1838 | 1659 | ||
1839 | for(k=0;k<used_balls;k++) { | 1660 | for(k=0;k<used_balls;k++) { |
@@ -1841,7 +1662,9 @@ int game_loop(void) | |||
1841 | ball[k].y=0; | 1662 | ball[k].y=0; |
1842 | } | 1663 | } |
1843 | 1664 | ||
1844 | return 0; | 1665 | if (brickmania_menu(false)!=0) { |
1666 | return 0; | ||
1667 | } | ||
1845 | } | 1668 | } |
1846 | if (end > *rb->current_tick) | 1669 | if (end > *rb->current_tick) |
1847 | rb->sleep(end-*rb->current_tick); | 1670 | rb->sleep(end-*rb->current_tick); |
@@ -1855,6 +1678,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
1855 | { | 1678 | { |
1856 | (void)parameter; | 1679 | (void)parameter; |
1857 | 1680 | ||
1681 | highscore_load(HIGH_SCORE,highest,NUM_SCORES); | ||
1858 | rb->lcd_setfont(FONT_SYSFIXED); | 1682 | rb->lcd_setfont(FONT_SYSFIXED); |
1859 | #if LCD_DEPTH > 1 | 1683 | #if LCD_DEPTH > 1 |
1860 | rb->lcd_set_backdrop(NULL); | 1684 | rb->lcd_set_backdrop(NULL); |
@@ -1862,15 +1686,10 @@ enum plugin_status plugin_start(const void* parameter) | |||
1862 | /* Turn off backlight timeout */ | 1686 | /* Turn off backlight timeout */ |
1863 | backlight_force_on(); /* backlight control in lib/helper.c */ | 1687 | backlight_force_on(); /* backlight control in lib/helper.c */ |
1864 | 1688 | ||
1865 | rb->srand( *rb->current_tick ); | ||
1866 | |||
1867 | configfile_load(HIGH_SCORE,config,1,0); | ||
1868 | |||
1869 | /* now go ahead and have fun! */ | 1689 | /* now go ahead and have fun! */ |
1870 | while (game_loop()!=1); | 1690 | brickmania_game_loop(); |
1871 | |||
1872 | configfile_save(HIGH_SCORE,config,1,0); | ||
1873 | 1691 | ||
1692 | highscore_save(HIGH_SCORE,highest,NUM_SCORES); | ||
1874 | /* Restore user's original backlight setting */ | 1693 | /* Restore user's original backlight setting */ |
1875 | rb->lcd_setfont(FONT_UI); | 1694 | rb->lcd_setfont(FONT_UI); |
1876 | /* Turn on backlight timeout (revert to settings) */ | 1695 | /* Turn on backlight timeout (revert to settings) */ |