diff options
18 files changed, 1137 insertions, 0 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 98ffcc2be8..0b9f68bc0b 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -27,6 +27,10 @@ plasma.c | |||
27 | #endif | 27 | #endif |
28 | bejeweled.c | 28 | bejeweled.c |
29 | bounce.c | 29 | bounce.c |
30 | /* H300 and iPod Color/Video only */ | ||
31 | #if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH == 16) | ||
32 | brickmania.c | ||
33 | #endif | ||
30 | calculator.c | 34 | calculator.c |
31 | chip8.c | 35 | chip8.c |
32 | demystify.c | 36 | demystify.c |
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 140df739a9..ecd8334f3e 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES | |||
@@ -15,4 +15,24 @@ sudoku_normal.220x176x16.bmp | |||
15 | sudoku_inverse.220x176x16.bmp | 15 | sudoku_inverse.220x176x16.bmp |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | /* Brickmania */ | ||
19 | |||
20 | #if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH == 16) | ||
21 | brickmania_ball.220x176x16.bmp | ||
22 | brickmania_bricks.220x176x16.bmp | ||
23 | brickmania_gameover.220x176x16.bmp | ||
24 | brickmania_help.220x176x16.bmp | ||
25 | brickmania_menu_bg.220x176x16.bmp | ||
26 | brickmania_no_resume.220x176x16.bmp | ||
27 | brickmania_pads.220x176x16.bmp | ||
28 | brickmania_powerups.220x176x16.bmp | ||
29 | brickmania_quit.220x176x16.bmp | ||
30 | brickmania_resume.220x176x16.bmp | ||
31 | brickmania_sel_help.220x176x16.bmp | ||
32 | brickmania_sel_resume.220x176x16.bmp | ||
33 | brickmania_sel_quit.220x176x16.bmp | ||
34 | brickmania_sel_start.220x176x16.bmp | ||
35 | brickmania_start.220x176x16.bmp | ||
36 | #endif | ||
37 | |||
18 | #endif /* HAVE_LCD_BITMAP */ | 38 | #endif /* HAVE_LCD_BITMAP */ |
diff --git a/apps/plugins/bitmaps/native/brickmania_ball.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_ball.220x176x16.bmp new file mode 100644 index 0000000000..97da97f4a7 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_ball.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_bricks.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_bricks.220x176x16.bmp new file mode 100644 index 0000000000..1cf951b16f --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_bricks.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_gameover.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_gameover.220x176x16.bmp new file mode 100644 index 0000000000..d004433b5f --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_gameover.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_help.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_help.220x176x16.bmp new file mode 100644 index 0000000000..4798886090 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_help.220x176x16.bmp | |||
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 new file mode 100644 index 0000000000..f5765b84ca --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_menu_bg.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_no_resume.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_no_resume.220x176x16.bmp new file mode 100644 index 0000000000..81b3cf83b8 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_no_resume.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_pads.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_pads.220x176x16.bmp new file mode 100644 index 0000000000..5bd1e5dc57 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_pads.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_powerups.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_powerups.220x176x16.bmp new file mode 100644 index 0000000000..aadd37095c --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_powerups.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_quit.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_quit.220x176x16.bmp new file mode 100644 index 0000000000..262650544f --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_quit.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_resume.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_resume.220x176x16.bmp new file mode 100644 index 0000000000..fd8753f57d --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_resume.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_sel_help.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_sel_help.220x176x16.bmp new file mode 100644 index 0000000000..c738b1f68c --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_sel_help.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_sel_quit.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_sel_quit.220x176x16.bmp new file mode 100644 index 0000000000..58ee4a3f77 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_sel_quit.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_sel_resume.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_sel_resume.220x176x16.bmp new file mode 100644 index 0000000000..9b2c144714 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_sel_resume.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_sel_start.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_sel_start.220x176x16.bmp new file mode 100644 index 0000000000..d9265863b0 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_sel_start.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/brickmania_start.220x176x16.bmp b/apps/plugins/bitmaps/native/brickmania_start.220x176x16.bmp new file mode 100644 index 0000000000..8d5bfb2ec9 --- /dev/null +++ b/apps/plugins/bitmaps/native/brickmania_start.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c new file mode 100644 index 0000000000..eec290f507 --- /dev/null +++ b/apps/plugins/brickmania.c | |||
@@ -0,0 +1,1113 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 Ben Basha (Paprica) | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "plugin.h" | ||
21 | #include "configfile.h" /* Part of libplugin */ | ||
22 | |||
23 | PLUGIN_HEADER | ||
24 | |||
25 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
26 | |||
27 | #define QUIT BUTTON_OFF | ||
28 | #define LEFT BUTTON_LEFT | ||
29 | #define RIGHT BUTTON_RIGHT | ||
30 | #define SELECT BUTTON_SELECT | ||
31 | #define UP BUTTON_UP | ||
32 | #define DOWN BUTTON_DOWN | ||
33 | |||
34 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) | ||
35 | |||
36 | #define QUIT BUTTON_MENU | ||
37 | #define LEFT BUTTON_LEFT | ||
38 | #define RIGHT BUTTON_RIGHT | ||
39 | #define SELECT BUTTON_SELECT | ||
40 | #define UP BUTTON_SCROLL_BACK | ||
41 | #define DOWN BUTTON_SCROLL_FWD | ||
42 | |||
43 | #else | ||
44 | #error Unsupported keypad | ||
45 | #endif | ||
46 | |||
47 | static struct plugin_api* rb; | ||
48 | |||
49 | /* External bitmaps */ | ||
50 | extern const fb_data brickmania_ball[]; | ||
51 | extern const fb_data brickmania_gameover[]; | ||
52 | extern const fb_data brickmania_help[]; | ||
53 | extern const fb_data brickmania_menu_bg[]; | ||
54 | extern const fb_data brickmania_no_resume[]; | ||
55 | extern const fb_data brickmania_quit[]; | ||
56 | extern const fb_data brickmania_resume[]; | ||
57 | extern const fb_data brickmania_sel_help[]; | ||
58 | extern const fb_data brickmania_sel_quit[]; | ||
59 | extern const fb_data brickmania_sel_resume[]; | ||
60 | extern const fb_data brickmania_sel_start[]; | ||
61 | extern const fb_data brickmania_start[]; | ||
62 | |||
63 | /* normal, glue, fire */ | ||
64 | extern const fb_data brickmania_pads[]; | ||
65 | |||
66 | /* +life, -life, glue, fire, normal */ | ||
67 | extern const fb_data brickmania_powerups[]; | ||
68 | |||
69 | /* purple, red, blue, pink, green, yellow orange */ | ||
70 | extern const fb_data brickmania_bricks[]; | ||
71 | |||
72 | /* TO DO: This needs adjusting correctly for larger than 220x176 LCDS */ | ||
73 | #if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) | ||
74 | #define PAD_WIDTH 40 | ||
75 | #define PAD_HEIGHT 5 | ||
76 | #define PAD_POS_Y LCD_HEIGHT - 7 | ||
77 | #define BRICK_HEIGHT 8 | ||
78 | #define BRICK_WIDTH 20 | ||
79 | #define BALL 5 | ||
80 | |||
81 | #define BMPHEIGHT_help 19 | ||
82 | #define BMPWIDTH_help 37 | ||
83 | |||
84 | #define BMPHEIGHT_sel_help 19 | ||
85 | #define BMPWIDTH_sel_help 37 | ||
86 | |||
87 | #define BMPHEIGHT_resume 17 | ||
88 | #define BMPWIDTH_resume 96 | ||
89 | |||
90 | #define BMPHEIGHT_no_resume 17 | ||
91 | #define BMPWIDTH_no_resume 96 | ||
92 | |||
93 | #define BMPHEIGHT_quit 19 | ||
94 | #define BMPWIDTH_quit 33 | ||
95 | |||
96 | #define BMPHEIGHT_sel_quit 19 | ||
97 | #define BMPWIDTH_sel_quit 33 | ||
98 | |||
99 | #define BMPHEIGHT_sel_resume 17 | ||
100 | #define BMPWIDTH_sel_resume 96 | ||
101 | |||
102 | #define BMPHEIGHT_sel_start 20 | ||
103 | #define BMPWIDTH_sel_start 112 | ||
104 | |||
105 | #define BMPHEIGHT_start 20 | ||
106 | #define BMPWIDTH_start 112 | ||
107 | |||
108 | #define BMPHEIGHT_powerup 6 | ||
109 | #define BMPWIDTH_powerup 10 | ||
110 | |||
111 | #else | ||
112 | #error Unsupported LCD Size | ||
113 | #endif | ||
114 | |||
115 | int levels_num = 29; | ||
116 | |||
117 | static unsigned char levels[29][8][10] = { | ||
118 | { /* level1 */ | ||
119 | {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, | ||
120 | {0x2,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x2}, | ||
121 | {0x0,0x2,0x1,0x0,0x0,0x0,0x0,0x1,0x2,0x0}, | ||
122 | {0x0,0x0,0x2,0x1,0x0,0x0,0x1,0x2,0x0,0x0}, | ||
123 | {0x0,0x0,0x0,0x2,0x1,0x1,0x2,0x0,0x0,0x0}, | ||
124 | {0x7,0x0,0x0,0x7,0x2,0x2,0x7,0x0,0x0,0x7}, | ||
125 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
126 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} | ||
127 | }, | ||
128 | { /* level2 */ | ||
129 | {0x0,0x0,0x7,0x7,0x1,0x1,0x7,0x7,0x0,0x0}, | ||
130 | {0x0,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x0}, | ||
131 | {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, | ||
132 | {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1}, | ||
133 | {0x1,0x1,0x2,0x1,0x0,0x0,0x1,0x2,0x1,0x1}, | ||
134 | {0x1,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x2,0x1}, | ||
135 | {0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x2,0x1,0x0}, | ||
136 | {0x0,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x0} | ||
137 | }, | ||
138 | { /* level3 */ | ||
139 | {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, | ||
140 | {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, | ||
141 | {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2}, | ||
142 | {0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0}, | ||
143 | {0x0,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x0}, | ||
144 | {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}, | ||
145 | {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}, | ||
146 | {0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6} | ||
147 | }, | ||
148 | { /* level4 */ | ||
149 | {0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0}, | ||
150 | {0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0}, | ||
151 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, | ||
152 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, | ||
153 | {0x6,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x6}, | ||
154 | {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, | ||
155 | {0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0}, | ||
156 | {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1} | ||
157 | }, | ||
158 | { /* level5 */ | ||
159 | {0x1,0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4}, | ||
160 | {0x0,0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0}, | ||
161 | {0x2,0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5}, | ||
162 | {0x2,0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5}, | ||
163 | {0x0,0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0}, | ||
164 | {0x3,0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6}, | ||
165 | {0x3,0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x6}, | ||
166 | {0x0,0x4,0x4,0x0,0x5,0x5,0x0,0x6,0x6,0x0} | ||
167 | }, | ||
168 | { /* level6 */ | ||
169 | {0x0,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x0}, | ||
170 | {0x3,0x1,0x3,0x7,0x0,0x0,0x7,0x3,0x1,0x3}, | ||
171 | {0x3,0x1,0x3,0x7,0x7,0x7,0x7,0x3,0x1,0x3}, | ||
172 | {0x0,0x0,0x0,0x2,0x2,0x2,0x2,0x0,0x0,0x0}, | ||
173 | {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5}, | ||
174 | {0x5,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x5}, | ||
175 | {0x0,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x0}, | ||
176 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} | ||
177 | }, | ||
178 | { /* level7 */ | ||
179 | {0x0,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x0}, | ||
180 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
181 | {0x6,0x0,0x0,0x2,0x2,0x2,0x2,0x0,0x0,0x6}, | ||
182 | {0x6,0x0,0x0,0x2,0x2,0x2,0x2,0x0,0x0,0x6}, | ||
183 | {0x6,0x6,0x6,0x0,0x0,0x0,0x0,0x6,0x6,0x6}, | ||
184 | {0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0}, | ||
185 | {0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0}, | ||
186 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} | ||
187 | }, | ||
188 | { /* level8 */ | ||
189 | {0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x0}, | ||
190 | {0x0,0x0,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x0}, | ||
191 | {0x6,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x6}, | ||
192 | {0x0,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x0}, | ||
193 | {0x0,0x6,0x6,0x0,0x0,0x0,0x0,0x6,0x6,0x0}, | ||
194 | {0x0,0x0,0x0,0x5,0x5,0x5,0x5,0x0,0x0,0x0}, | ||
195 | {0x0,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x0}, | ||
196 | {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5} | ||
197 | }, | ||
198 | { /* level9 */ | ||
199 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, | ||
200 | {0x2,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x2}, | ||
201 | {0x2,0x0,0x3,0x0,0x1,0x1,0x0,0x3,0x0,0x2}, | ||
202 | {0x2,0x0,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x2}, | ||
203 | {0x2,0x0,0x1,0x0,0x3,0x3,0x0,0x1,0x0,0x2}, | ||
204 | {0x2,0x0,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x2}, | ||
205 | {0x2,0x2,0x0,0x0,0x1,0x1,0x0,0x0,0x2,0x2}, | ||
206 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2} | ||
207 | }, | ||
208 | { /* level10 */ | ||
209 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
210 | {0x0,0x5,0x0,0x5,0x0,0x5,0x0,0x5,0x0,0x5}, | ||
211 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
212 | {0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0}, | ||
213 | {0x0,0x0,0x0,0x4,0x1,0x1,0x4,0x0,0x0,0x0}, | ||
214 | {0x0,0x0,0x3,0x4,0x1,0x1,0x4,0x3,0x0,0x0}, | ||
215 | {0x0,0x2,0x3,0x4,0x1,0x1,0x4,0x3,0x2,0x0}, | ||
216 | {0x1,0x2,0x3,0x4,0x1,0x1,0x4,0x3,0x2,0x1} | ||
217 | }, | ||
218 | { /* level11 */ | ||
219 | {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3}, | ||
220 | {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2}, | ||
221 | {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2}, | ||
222 | {0x2,0x0,0x0,0x0,0x7,0x7,0x0,0x0,0x0,0x2}, | ||
223 | {0x2,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x2}, | ||
224 | {0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x0}, | ||
225 | {0x0,0x2,0x0,0x1,0x0,0x0,0x1,0x0,0x2,0x0}, | ||
226 | {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5} | ||
227 | }, | ||
228 | { /* level 12 */ | ||
229 | {0x2,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x2}, | ||
230 | {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1}, | ||
231 | {0x1,0x1,0x1,0x0,0x1,0x1,0x0,0x1,0x1,0x1}, | ||
232 | {0x0,0x1,0x0,0x1,0x6,0x6,0x1,0x0,0x1,0x0}, | ||
233 | {0x0,0x0,0x1,0x1,0x6,0x6,0x1,0x1,0x0,0x0}, | ||
234 | {0x1,0x1,0x1,0x7,0x0,0x0,0x7,0x1,0x1,0x1}, | ||
235 | {0x1,0x1,0x7,0x1,0x0,0x0,0x1,0x7,0x1,0x1}, | ||
236 | {0x2,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x2,0x2} | ||
237 | }, | ||
238 | {/* levell13 */ | ||
239 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, | ||
240 | {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2}, | ||
241 | {0x2,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x2}, | ||
242 | {0x2,0x0,0x2,0x3,0x3,0x3,0x3,0x3,0x0,0x2}, | ||
243 | {0x2,0x0,0x2,0x4,0x4,0x4,0x4,0x4,0x0,0x2}, | ||
244 | {0x2,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}, | ||
245 | {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
246 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2} | ||
247 | }, | ||
248 | {/* level14 */ | ||
249 | {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, | ||
250 | {0x4,0x4,0x4,0x4,0x2,0x2,0x4,0x4,0x4,0x4}, | ||
251 | {0x4,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x4}, | ||
252 | {0x4,0x0,0x0,0x2,0x3,0x3,0x2,0x0,0x0,0x4}, | ||
253 | {0x4,0x0,0x2,0x3,0x3,0x3,0x3,0x2,0x0,0x4}, | ||
254 | {0x4,0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x4}, | ||
255 | {0x4,0x0,0x6,0x1,0x5,0x5,0x1,0x6,0x0,0x4}, | ||
256 | {0x4,0x6,0x1,0x1,0x5,0x5,0x1,0x1,0x6,0x4} | ||
257 | }, | ||
258 | {/* level 15 */ | ||
259 | {0x4,0x4,0x4,0x4,0x4,0x3,0x3,0x3,0x3,0x3}, | ||
260 | {0x2,0x2,0x1,0x1,0x1,0x1,0x1,0x5,0x0,0x0}, | ||
261 | {0x2,0x2,0x1,0x1,0x1,0x0,0x1,0x6,0x0,0x0}, | ||
262 | {0x2,0x1,0x1,0x2,0x1,0x1,0x1,0x5,0x0,0x0}, | ||
263 | {0x2,0x1,0x2,0x2,0x2,0x1,0x1,0x6,0x0,0x0}, | ||
264 | {0x2,0x1,0x2,0x2,0x2,0x1,0x3,0x5,0x3,0x0}, | ||
265 | {0x2,0x1,0x1,0x2,0x1,0x1,0x1,0x6,0x0,0x0}, | ||
266 | {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2} | ||
267 | }, | ||
268 | {/* level 16 (Rockbox) by ts-x */ | ||
269 | {0x2,0x2,0x3,0x3,0x3,0x4,0x4,0x5,0x0,0x5}, | ||
270 | {0x2,0x0,0x3,0x0,0x3,0x4,0x0,0x5,0x5,0x0}, | ||
271 | {0x2,0x0,0x3,0x3,0x3,0x4,0x4,0x5,0x0,0x5}, | ||
272 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
273 | {0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
274 | {0x7,0x7,0x7,0x1,0x1,0x1,0x2,0x0,0x2,0x0}, | ||
275 | {0x7,0x0,0x7,0x1,0x0,0x1,0x0,0x2,0x0,0x0}, | ||
276 | {0x7,0x7,0x7,0x1,0x1,0x1,0x2,0x0,0x2,0x0} | ||
277 | }, | ||
278 | {/* level 17 (Alien) by ts-x */ | ||
279 | {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, | ||
280 | {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2}, | ||
281 | {0x1,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x1}, | ||
282 | {0x2,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x2}, | ||
283 | {0x1,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x1}, | ||
284 | {0x2,0x0,0x0,0x1,0x2,0x2,0x1,0x0,0x0,0x2}, | ||
285 | {0x2,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x2}, | ||
286 | {0x2,0x2,0x1,0x0,0x1,0x1,0x0,0x1,0x2,0x2} | ||
287 | }, | ||
288 | {/* level 18 (Tetris) by ts-x */ | ||
289 | {0x0,0x2,0x0,0x0,0x3,0x4,0x0,0x2,0x2,0x0}, | ||
290 | {0x0,0x2,0x7,0x0,0x3,0x4,0x0,0x2,0x2,0x0}, | ||
291 | {0x2,0x2,0x7,0x0,0x3,0x4,0x0,0x6,0x2,0x2}, | ||
292 | {0x2,0x2,0x7,0x7,0x3,0x4,0x0,0x6,0x2,0x2}, | ||
293 | {0x2,0x1,0x7,0x7,0x3,0x4,0x4,0x6,0x5,0x5}, | ||
294 | {0x2,0x1,0x0,0x7,0x3,0x4,0x4,0x6,0x5,0x5}, | ||
295 | {0x1,0x1,0x1,0x7,0x3,0x0,0x6,0x6,0x5,0x5}, | ||
296 | {0x1,0x1,0x1,0x0,0x3,0x0,0x6,0x6,0x5,0x5} | ||
297 | }, | ||
298 | { /* level 19 (Stalactites) by ts-x */ | ||
299 | {0x5,0x2,0x6,0x3,0x4,0x7,0x5,0x3,0x1,0x2}, | ||
300 | {0x5,0x2,0x6,0x3,0x4,0x7,0x5,0x3,0x1,0x2}, | ||
301 | {0x5,0x0,0x6,0x3,0x4,0x7,0x5,0x0,0x1,0x2}, | ||
302 | {0x5,0x2,0x6,0x3,0x4,0x0,0x5,0x3,0x1,0x2}, | ||
303 | {0x5,0x0,0x6,0x0,0x4,0x7,0x5,0x0,0x1,0x0}, | ||
304 | {0x5,0x0,0x0,0x3,0x4,0x0,0x0,0x0,0x1,0x2}, | ||
305 | {0x0,0x0,0x6,0x0,0x0,0x0,0x5,0x0,0x0,0x0}, | ||
306 | {0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0} | ||
307 | }, | ||
308 | { /* level 20 (Maze) by ts-x */ | ||
309 | {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1}, | ||
310 | {0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x1,0x1}, | ||
311 | {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1}, | ||
312 | {0x1,0x0,0x1,0x3,0x0,0x3,0x0,0x3,0x0,0x2}, | ||
313 | {0x1,0x0,0x1,0x1,0x0,0x1,0x0,0x0,0x0,0x0}, | ||
314 | {0x1,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0}, | ||
315 | {0x1,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x2}, | ||
316 | {0x2,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x1} | ||
317 | }, | ||
318 | { /* level 21 (Dentist) by ts-x */ | ||
319 | {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}, | ||
320 | {0x2,0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x2,0x2}, | ||
321 | {0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x2}, | ||
322 | {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x2}, | ||
323 | {0x2,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x2}, | ||
324 | {0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x2}, | ||
325 | {0x2,0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x2,0x2}, | ||
326 | {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0} | ||
327 | }, | ||
328 | { /* level 22 (Spider) by ts-x */ | ||
329 | {0x1,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x1}, | ||
330 | {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, | ||
331 | {0x3,0x1,0x1,0x6,0x1,0x1,0x6,0x1,0x1,0x3}, | ||
332 | {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0}, | ||
333 | {0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0}, | ||
334 | {0x1,0x3,0x1,0x1,0x2,0x2,0x1,0x1,0x3,0x1}, | ||
335 | {0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0}, | ||
336 | {0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3} | ||
337 | }, | ||
338 | { /* level 23 (Pool) by ts-x */ | ||
339 | {0x0,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x7,0x0}, | ||
340 | {0x0,0x0,0x5,0x0,0x2,0x0,0x0,0x0,0x2,0x0}, | ||
341 | {0x7,0x3,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x7}, | ||
342 | {0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x5,0x0,0x7}, | ||
343 | {0x7,0x0,0x4,0x0,0x0,0x3,0x0,0x0,0x0,0x7}, | ||
344 | {0x7,0x0,0x0,0x6,0x0,0x0,0x0,0x0,0x4,0x7}, | ||
345 | {0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
346 | {0x0,0x7,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x0} | ||
347 | }, | ||
348 | { /* level 24 (Vorbis Fish) by ts-x */ | ||
349 | {0x0,0x0,0x4,0x4,0x5,0x5,0x5,0x0,0x0,0x5}, | ||
350 | {0x0,0x4,0x6,0x4,0x4,0x5,0x5,0x5,0x0,0x5}, | ||
351 | {0x5,0x6,0x0,0x6,0x4,0x4,0x4,0x5,0x5,0x5}, | ||
352 | {0x5,0x6,0x0,0x6,0x4,0x4,0x4,0x4,0x5,0x5}, | ||
353 | {0x0,0x5,0x6,0x4,0x4,0x5,0x5,0x4,0x5,0x0}, | ||
354 | {0x5,0x5,0x4,0x4,0x5,0x5,0x5,0x4,0x5,0x5}, | ||
355 | {0x5,0x4,0x4,0x4,0x5,0x5,0x4,0x4,0x5,0x5}, | ||
356 | {0x0,0x0,0x4,0x4,0x4,0x4,0x4,0x5,0x0,0x5} | ||
357 | }, | ||
358 | {/* level 25 (Rainbow) by ts-x */ | ||
359 | {0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0}, | ||
360 | {0x4,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x4}, | ||
361 | {0x1,0x3,0x5,0x3,0x1,0x1,0x3,0x5,0x3,0x1}, | ||
362 | {0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3}, | ||
363 | {0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5}, | ||
364 | {0x6,0x7,0x2,0x7,0x6,0x6,0x7,0x2,0x7,0x6}, | ||
365 | {0x7,0x2,0x0,0x2,0x7,0x7,0x2,0x0,0x2,0x7}, | ||
366 | {0x2,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x2} | ||
367 | }, | ||
368 | { /* level 26 (Bowtie) by ts-x */ | ||
369 | {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}, | ||
370 | {0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1}, | ||
371 | {0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5}, | ||
372 | {0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1}, | ||
373 | {0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1}, | ||
374 | {0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5}, | ||
375 | {0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1}, | ||
376 | {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5} | ||
377 | }, | ||
378 | { /* level 27 (Frog) by ts-x */ | ||
379 | {0x0,0x5,0x5,0x0,0x0,0x0,0x0,0x5,0x5,0x0}, | ||
380 | {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5}, | ||
381 | {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5}, | ||
382 | {0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5}, | ||
383 | {0x5,0x0,0x1,0x0,0x6,0x6,0x0,0x1,0x0,0x5}, | ||
384 | {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5}, | ||
385 | {0x5,0x5,0x5,0x5,0x0,0x0,0x5,0x5,0x5,0x5}, | ||
386 | {0x0,0x5,0x5,0x0,0x4,0x4,0x0,0x5,0x5,0x0} | ||
387 | }, | ||
388 | { /* level 28 (DigDug) by ts-x */ | ||
389 | {0x5,0x5,0x5,0x5,0x0,0x5,0x5,0x5,0x5,0x5}, | ||
390 | {0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6}, | ||
391 | {0x7,0x0,0x7,0x7,0x0,0x7,0x7,0x7,0x0,0x7}, | ||
392 | {0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7}, | ||
393 | {0x4,0x4,0x4,0x4,0x0,0x4,0x4,0x0,0x0,0x4}, | ||
394 | {0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4}, | ||
395 | {0x4,0x4,0x4,0x4,0x4,0x4,0x0,0x0,0x4,0x4}, | ||
396 | {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1} | ||
397 | }, | ||
398 | { /* TheEnd */ | ||
399 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, | ||
400 | {0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0}, | ||
401 | {0x2,0x0,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0}, | ||
402 | {0x2,0x2,0x6,0x6,0x0,0x6,0x4,0x0,0x4,0x0}, | ||
403 | {0x2,0x2,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0}, | ||
404 | {0x2,0x0,0x6,0x0,0x6,0x6,0x4,0x0,0x4,0x0}, | ||
405 | {0x2,0x2,0x6,0x0,0x0,0x6,0x4,0x4,0x0,0x0}, | ||
406 | {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0} | ||
407 | } | ||
408 | }; | ||
409 | |||
410 | int pad_pos_x,x,y; | ||
411 | int ball_pos_x; | ||
412 | int ball_pos_y; | ||
413 | int bally,balltempy; | ||
414 | int ballx,balltempx; | ||
415 | int life; | ||
416 | int start_game,con_game; | ||
417 | int pad_type; | ||
418 | int on_the_pad=0; /* for glue pad */ | ||
419 | int score=0,vscore=0; | ||
420 | |||
421 | int cur_level=0; | ||
422 | int brick_on_board=0; | ||
423 | |||
424 | typedef struct cube { | ||
425 | int powertop; | ||
426 | int power; | ||
427 | char poweruse; | ||
428 | char used; | ||
429 | int color; | ||
430 | } cube; | ||
431 | cube brick[80]; | ||
432 | |||
433 | |||
434 | |||
435 | typedef struct sfire { | ||
436 | int top; | ||
437 | int left; | ||
438 | } sfire; | ||
439 | sfire fire[30]; | ||
440 | |||
441 | |||
442 | int highscore; | ||
443 | #define MAX_POINTS 200000 /* i dont think it needs to be more */ | ||
444 | static struct configdata config[] = | ||
445 | { | ||
446 | {TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL} | ||
447 | }; | ||
448 | |||
449 | |||
450 | void int_game(int new_game) | ||
451 | { | ||
452 | int i,j; | ||
453 | ballx=0; | ||
454 | bally=0; | ||
455 | pad_pos_x=LCD_WIDTH/2-PAD_WIDTH/2; | ||
456 | ball_pos_y=PAD_POS_Y-BALL; | ||
457 | ball_pos_x=pad_pos_x+(PAD_WIDTH/2)-2; | ||
458 | start_game =1; | ||
459 | con_game =0; | ||
460 | pad_type=0; | ||
461 | on_the_pad=0; | ||
462 | balltempy=0; | ||
463 | balltempx=0; | ||
464 | if (new_game==1) | ||
465 | brick_on_board=0; | ||
466 | |||
467 | for(i=0;i<=7;i++){ | ||
468 | for(j=0;j<=9;j++){ | ||
469 | brick[i*10+j].poweruse=(levels[cur_level][i][j]==0?0:1); | ||
470 | if (i*10+j<=30) fire[i*10+j].top=-8; | ||
471 | if (new_game==1) { | ||
472 | |||
473 | brick[i*10+j].power=rb->rand()%17; | ||
474 | |||
475 | brick[i*10+j].powertop=30+i*10+BRICK_HEIGHT; | ||
476 | brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1); | ||
477 | brick[i*10+j].color=levels[cur_level][i][j]-1; | ||
478 | if (levels[cur_level][i][j]!=0) brick_on_board++; | ||
479 | } | ||
480 | } | ||
481 | } | ||
482 | |||
483 | |||
484 | } | ||
485 | |||
486 | |||
487 | #define HIGH_SCORE "highscore.cfg" | ||
488 | |||
489 | #define MENU_LENGTH 4 | ||
490 | int sw,i,w; | ||
491 | |||
492 | int game_menu(int when) | ||
493 | { | ||
494 | int button,cur=0; | ||
495 | char str[10]; | ||
496 | |||
497 | rb->lcd_clear_display(); | ||
498 | rb->lcd_bitmap(brickmania_menu_bg,0,0,220,176); | ||
499 | while (true) { | ||
500 | for(i=0;i<MENU_LENGTH;i++) { | ||
501 | if (cur==0) | ||
502 | rb->lcd_bitmap(brickmania_sel_start,55,78, | ||
503 | BMPWIDTH_sel_start,BMPHEIGHT_sel_start); | ||
504 | else | ||
505 | rb->lcd_bitmap(brickmania_start,55,78, | ||
506 | BMPWIDTH_start,BMPHEIGHT_start); | ||
507 | |||
508 | if (when==1) { | ||
509 | if (cur==1) | ||
510 | rb->lcd_bitmap(brickmania_sel_resume,62,100, | ||
511 | BMPWIDTH_sel_resume,BMPHEIGHT_sel_resume); | ||
512 | else | ||
513 | rb->lcd_bitmap(brickmania_resume,62,100, | ||
514 | BMPWIDTH_resume,BMPHEIGHT_resume); | ||
515 | |||
516 | } else { | ||
517 | rb->lcd_bitmap(brickmania_no_resume,62,100, | ||
518 | BMPWIDTH_no_resume,BMPHEIGHT_no_resume); | ||
519 | } | ||
520 | |||
521 | |||
522 | if (cur==2) | ||
523 | rb->lcd_bitmap(brickmania_sel_help,92,118, | ||
524 | BMPWIDTH_sel_help,BMPHEIGHT_sel_help); | ||
525 | else | ||
526 | rb->lcd_bitmap(brickmania_help,92,118, | ||
527 | BMPWIDTH_help,BMPHEIGHT_help); | ||
528 | |||
529 | |||
530 | if (cur==3) | ||
531 | rb->lcd_bitmap(brickmania_sel_quit,93,138, | ||
532 | BMPWIDTH_sel_quit,BMPHEIGHT_sel_quit); | ||
533 | else | ||
534 | rb->lcd_bitmap(brickmania_quit,93,138, | ||
535 | BMPWIDTH_quit,BMPHEIGHT_quit); | ||
536 | } | ||
537 | |||
538 | /* high score */ | ||
539 | rb->lcd_setfont(FONT_SYSFIXED); | ||
540 | rb->lcd_set_background(LCD_RGBPACK(0,0,140)); | ||
541 | rb->lcd_set_foreground(LCD_WHITE); | ||
542 | rb->lcd_putsxy(7, 56, "High Score"); | ||
543 | rb->snprintf(str, sizeof(str), "%d", highscore); | ||
544 | rb->lcd_getstringsize("High Score", &sw, NULL); | ||
545 | rb->lcd_getstringsize(str, &w, NULL); | ||
546 | rb->lcd_putsxy(7+sw/2-w/2, 65, str); | ||
547 | rb->lcd_setfont(FONT_UI); | ||
548 | |||
549 | rb->lcd_update(); | ||
550 | |||
551 | button = rb->button_get(true); | ||
552 | switch(button){ | ||
553 | case UP: | ||
554 | if (cur==0) | ||
555 | cur = MENU_LENGTH-1; | ||
556 | else | ||
557 | cur--; | ||
558 | if (when==0 && cur==1) { | ||
559 | cur = 0; | ||
560 | }; | ||
561 | break; | ||
562 | |||
563 | case DOWN: | ||
564 | if (cur==MENU_LENGTH-1) | ||
565 | cur = 0; | ||
566 | else | ||
567 | cur++; | ||
568 | if (when==0 && cur==1) { | ||
569 | cur=2; | ||
570 | }; | ||
571 | break; | ||
572 | |||
573 | case SELECT: | ||
574 | if (cur==0) { | ||
575 | score=0; | ||
576 | vscore=0; | ||
577 | return 0; | ||
578 | } else if (cur==1 && when==1) { | ||
579 | return 1; | ||
580 | } else if (cur==2) { | ||
581 | return 2; | ||
582 | } else if (cur==3) { | ||
583 | return 3; | ||
584 | } | ||
585 | break; | ||
586 | case QUIT: | ||
587 | return 3; | ||
588 | break; | ||
589 | } | ||
590 | } | ||
591 | } | ||
592 | |||
593 | int help(int when) | ||
594 | { | ||
595 | int w,h; | ||
596 | int button; | ||
597 | |||
598 | while(true){ | ||
599 | rb->lcd_setfont(FONT_SYSFIXED); | ||
600 | rb->lcd_set_background(LCD_BLACK); | ||
601 | rb->lcd_clear_display(); | ||
602 | rb->lcd_set_background(LCD_BLACK); | ||
603 | rb->lcd_set_foreground(LCD_WHITE); | ||
604 | |||
605 | rb->lcd_getstringsize("BrickMania", &w, &h); | ||
606 | rb->lcd_putsxy(LCD_WIDTH/2-w/2, 1, "BrickMania"); | ||
607 | |||
608 | rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); | ||
609 | rb->lcd_putsxy(1, 1*(h+2),"Aim"); | ||
610 | rb->lcd_set_foreground(LCD_WHITE); | ||
611 | rb->lcd_putsxy(1, 2*(h+2),"destroy all the bricks by bouncing"); | ||
612 | rb->lcd_putsxy(1, 3*(h+2),"the ball of them using the paddle."); | ||
613 | |||
614 | rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); | ||
615 | rb->lcd_putsxy(1, 5*(h+2),"Controls"); | ||
616 | rb->lcd_set_foreground(LCD_WHITE); | ||
617 | rb->lcd_putsxy(1, 6*(h+2),"< & > Move the paddle"); | ||
618 | rb->lcd_putsxy(1, 7*(h+2),"NAVI Releases the ball/Fire!"); | ||
619 | rb->lcd_putsxy(1, 8*(h+2),"STOP Opens menu/Quit"); | ||
620 | |||
621 | rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); | ||
622 | rb->lcd_putsxy(1, 10*(h+2),"Specials"); | ||
623 | rb->lcd_set_foreground(LCD_WHITE); | ||
624 | rb->lcd_putsxy(1, 11*(h+2),"N Normal:returns paddle to normal"); | ||
625 | rb->lcd_putsxy(1, 12*(h+2),"D DIE!:loses a life"); | ||
626 | rb->lcd_putsxy(1, 13*(h+2),"L Life:gains a life/power up"); | ||
627 | rb->lcd_putsxy(1, 14*(h+2),"F Fire:allows you to shoot bricks"); | ||
628 | rb->lcd_putsxy(1, 15*(h+2),"G Glue:ball sticks to paddle"); | ||
629 | rb->lcd_update(); | ||
630 | |||
631 | button=rb->button_get(true); | ||
632 | switch (button) { | ||
633 | case QUIT: | ||
634 | rb->lcd_setfont(FONT_UI); | ||
635 | switch (game_menu(when)) { | ||
636 | case 0: | ||
637 | cur_level=0; | ||
638 | life=2; | ||
639 | int_game(1); | ||
640 | break; | ||
641 | case 1: | ||
642 | con_game=1; | ||
643 | break; | ||
644 | case 2: | ||
645 | if (help(when)==1) return 1; | ||
646 | break; | ||
647 | case 3: | ||
648 | return 1; | ||
649 | break; | ||
650 | } | ||
651 | return NULL; | ||
652 | break; | ||
653 | } | ||
654 | } | ||
655 | return NULL; | ||
656 | } | ||
657 | |||
658 | int pad_check(int ballxc,int mode,int pon) | ||
659 | { | ||
660 | /* pon: positive(1) or negative(0) */ | ||
661 | |||
662 | if (mode==0) { | ||
663 | if (pon == 0) | ||
664 | return -ballxc; | ||
665 | else | ||
666 | return ballxc; | ||
667 | } else { | ||
668 | if (ballx > 0) | ||
669 | return ballxc; | ||
670 | else | ||
671 | return ballxc*-1; | ||
672 | } | ||
673 | } | ||
674 | |||
675 | int fire_space(void) | ||
676 | { | ||
677 | int t; | ||
678 | for(t=0;t<=30;t++) | ||
679 | if (fire[t].top+7 < 0) | ||
680 | return t; | ||
681 | |||
682 | return NULL; | ||
683 | } | ||
684 | |||
685 | int dxball_game(void){ | ||
686 | int j,i,k,bricky,brickx; | ||
687 | char s[20]; | ||
688 | |||
689 | rb->srand( *rb->current_tick ); | ||
690 | |||
691 | configfile_init(rb); | ||
692 | configfile_load(HIGH_SCORE,config,1,0); | ||
693 | |||
694 | switch(game_menu(0)){ | ||
695 | case 0: | ||
696 | cur_level = 0; | ||
697 | life = 2; | ||
698 | int_game(1); | ||
699 | break; | ||
700 | case 1: | ||
701 | con_game = 1; | ||
702 | break; | ||
703 | case 2: | ||
704 | if (help(0) == 1) return 1; | ||
705 | break; | ||
706 | case 3: | ||
707 | return 1; | ||
708 | break; | ||
709 | } | ||
710 | |||
711 | while(true) { | ||
712 | if (life >= 0) { | ||
713 | rb->lcd_set_background(LCD_BLACK); | ||
714 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
715 | rb->lcd_clear_display(); | ||
716 | rb->lcd_set_background(LCD_BLACK); | ||
717 | |||
718 | /* write life num */ | ||
719 | rb->lcd_set_foreground(LCD_WHITE); | ||
720 | rb->snprintf(s, sizeof(s), "Life: %d", life); | ||
721 | rb->lcd_putsxy(2, 2, s); | ||
722 | |||
723 | rb->snprintf(s, sizeof(s), "Level %d", cur_level+1); | ||
724 | rb->lcd_getstringsize(s, &sw, NULL); | ||
725 | rb->lcd_putsxy(LCD_WIDTH-sw-2, 2, s); | ||
726 | |||
727 | |||
728 | if (vscore<score) vscore++; | ||
729 | rb->snprintf(s, sizeof(s), "%d", vscore); | ||
730 | rb->lcd_getstringsize(s, &sw, NULL); | ||
731 | rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 2, s); | ||
732 | |||
733 | /* continue game */ | ||
734 | if (con_game== 1 && start_game!=1) { | ||
735 | rb->lcd_getstringsize("Press NAVI To Continue", &sw, NULL); | ||
736 | rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 150, "Press NAVI to continue"); | ||
737 | } | ||
738 | |||
739 | /* draw the ball */ | ||
740 | rb->lcd_bitmap(brickmania_ball,ball_pos_x, ball_pos_y, BALL, BALL); | ||
741 | |||
742 | if (brick_on_board==0) brick_on_board--; | ||
743 | |||
744 | /* if the pad is fire */ | ||
745 | for(i=0;i<=30;i++) { | ||
746 | if (fire[i].top+7>0) { | ||
747 | if (con_game!=1) | ||
748 | fire[i].top-=4; | ||
749 | rb->lcd_vline(fire[i].left, fire[i].top, fire[i].top+7); | ||
750 | } | ||
751 | } | ||
752 | |||
753 | /* the bricks */ | ||
754 | for (i=0;i<=7;i++) { | ||
755 | for (j=0;j<=9;j++) { | ||
756 | if (brick[i*10+j].power<5) { | ||
757 | if (brick[i*10+j].poweruse==2) { | ||
758 | if (con_game!=1) | ||
759 | brick[i*10+j].powertop+=2; | ||
760 | rb->lcd_bitmap_part(brickmania_powerups,0, | ||
761 | BMPHEIGHT_powerup*brick[i*10+j].power, | ||
762 | BMPWIDTH_powerup,10+j*BRICK_WIDTH+5, | ||
763 | brick[i*10+j].powertop, 10, 6); | ||
764 | } | ||
765 | } | ||
766 | |||
767 | 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) { | ||
768 | switch(brick[i*10+j].power) { | ||
769 | case 0: | ||
770 | life++; | ||
771 | score+=50; | ||
772 | break; | ||
773 | case 1: | ||
774 | life--; | ||
775 | if (life>=0) { | ||
776 | int_game(0); | ||
777 | rb->sleep(HZ*2); | ||
778 | } | ||
779 | break; | ||
780 | case 2: | ||
781 | score+=34; | ||
782 | pad_type=1; | ||
783 | break; | ||
784 | case 3: | ||
785 | score+=47; | ||
786 | pad_type=2; | ||
787 | on_the_pad=0; | ||
788 | break; | ||
789 | case 4: | ||
790 | score+=23; | ||
791 | pad_type=0; | ||
792 | on_the_pad=0; | ||
793 | break; | ||
794 | } | ||
795 | brick[i*10+j].poweruse=1; | ||
796 | } | ||
797 | |||
798 | if (brick[i*10+j].powertop>PAD_POS_Y) | ||
799 | brick[i*10+j].poweruse=1; | ||
800 | |||
801 | brickx=10+j*BRICK_WIDTH; | ||
802 | bricky=30+i*8; | ||
803 | if (pad_type==2) { | ||
804 | for (k=0;k<=30;k++) { | ||
805 | if (fire[k].top+7>0) { | ||
806 | if (brick[i*10+j].used==1 && (fire[k].left+1 >= brickx && fire[k].left+1 <= brickx+BRICK_WIDTH) && (bricky+BRICK_HEIGHT>fire[k].top)){ | ||
807 | score+=13; | ||
808 | fire[k].top=-16; | ||
809 | brick[i*10+j].used=0; | ||
810 | if (brick[i*10+j].power!=10) brick[i*10+j].poweruse=2; | ||
811 | brick_on_board--; | ||
812 | } | ||
813 | } | ||
814 | } | ||
815 | } | ||
816 | |||
817 | if (brick[i*10+j].used==1) | ||
818 | 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); | ||
819 | if (ball_pos_y <100) { | ||
820 | if (brick[i*10+j].used==1) { | ||
821 | 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)){ | ||
822 | balltempy=bricky-ball_pos_y-BALL; | ||
823 | } else if ((ball_pos_x+ballx+3 >= brickx && ball_pos_x+ballx+3 <= brickx+BRICK_WIDTH) && ((bricky+BRICK_HEIGHT+4>ball_pos_y && bricky+BRICK_HEIGHT<ball_pos_y) || (bricky+BRICK_HEIGHT-4<ball_pos_y-BALL && bricky+BRICK_HEIGHT>ball_pos_y-BALL)) && (bally <0)){ | ||
824 | balltempy=-(ball_pos_y-(bricky+BRICK_HEIGHT)); | ||
825 | } | ||
826 | |||
827 | if ((ball_pos_y+3 >= bricky && ball_pos_y+3 <= bricky+BRICK_HEIGHT) && ((brickx-4<ball_pos_x+BALL && brickx>ball_pos_x+BALL) || (brickx+4>ball_pos_x+BALL+BALL && brickx<ball_pos_x+BALL+BALL)) && (ballx >0)) { | ||
828 | balltempx=brickx-ball_pos_x-BALL; | ||
829 | } else if ((ball_pos_y+bally+3 >= bricky && ball_pos_y+bally+3 <= bricky+BRICK_HEIGHT) && ((brickx+BRICK_WIDTH+4>ball_pos_x && brickx+BRICK_WIDTH<ball_pos_x) || (brickx+BRICK_WIDTH-4<ball_pos_x-BALL && brickx+BRICK_WIDTH>ball_pos_x-BALL)) && (ballx <0)) { | ||
830 | balltempx=-(ball_pos_x-(brickx+BRICK_WIDTH)); | ||
831 | } | ||
832 | |||
833 | 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 */ | ||
834 | brick[i*10+j].used=0; | ||
835 | bally = bally*-1; | ||
836 | if (brick[i*10+j].power!=10) { | ||
837 | brick[i*10+j].poweruse=2; | ||
838 | } | ||
839 | } 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 */ | ||
840 | brick[i*10+j].used=0; | ||
841 | bally = bally*-1; | ||
842 | if (brick[i*10+j].power!=10) | ||
843 | brick[i*10+j].poweruse=2; | ||
844 | } | ||
845 | |||
846 | 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 */ | ||
847 | brick[i*10+j].used=0; | ||
848 | ballx = ballx*-1; | ||
849 | if (brick[i*10+j].power!=10) | ||
850 | brick[i*10+j].poweruse=2; | ||
851 | } 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 */ | ||
852 | brick[i*10+j].used=0; | ||
853 | ballx = ballx*-1; | ||
854 | if (brick[i*10+j].power!=10) | ||
855 | brick[i*10+j].poweruse=2; | ||
856 | } | ||
857 | |||
858 | if (brick[i*10+j].used==0){ | ||
859 | brick_on_board--; | ||
860 | score+=8; | ||
861 | } | ||
862 | } | ||
863 | } | ||
864 | } | ||
865 | } | ||
866 | |||
867 | /* draw the pad */ | ||
868 | rb->lcd_bitmap_part(brickmania_pads,0,pad_type*PAD_HEIGHT,PAD_WIDTH,pad_pos_x, PAD_POS_Y, PAD_WIDTH, PAD_HEIGHT); | ||
869 | |||
870 | if ((ball_pos_x >= pad_pos_x && ball_pos_x <= pad_pos_x+PAD_WIDTH) && (PAD_POS_Y-4<ball_pos_y+BALL && PAD_POS_Y>ball_pos_y+BALL) && (bally >0)) | ||
871 | balltempy=PAD_POS_Y-ball_pos_y-BALL; | ||
872 | else if ((4>ball_pos_y && 0<ball_pos_y) && (bally <0)) | ||
873 | balltempy=-ball_pos_y; | ||
874 | if ((LCD_WIDTH-4<ball_pos_x+BALL && LCD_WIDTH>ball_pos_x+BALL) && (ballx >0)) | ||
875 | balltempx=LCD_WIDTH-ball_pos_x-BALL; | ||
876 | else if ((4>ball_pos_x && 0<ball_pos_x) && (ballx <0)) | ||
877 | balltempx=-ball_pos_x; | ||
878 | |||
879 | /* top line */ | ||
880 | if (ball_pos_y<= 0) | ||
881 | bally = bally*-1; | ||
882 | /* bottom line */ | ||
883 | else if (ball_pos_y+BALL >= LCD_HEIGHT) { | ||
884 | life--; | ||
885 | if (life>=0){ | ||
886 | int_game(0); | ||
887 | rb->sleep(HZ*2); | ||
888 | } | ||
889 | } | ||
890 | |||
891 | /* left line ,right line */ | ||
892 | if ((ball_pos_x <= 0) || (ball_pos_x+BALL >= LCD_WIDTH)) | ||
893 | ballx = ballx*-1; | ||
894 | |||
895 | if ((ball_pos_y+5 >= PAD_POS_Y && (ball_pos_x >= pad_pos_x && ball_pos_x <= pad_pos_x+PAD_WIDTH)) && | ||
896 | start_game != 1 && on_the_pad==0) { | ||
897 | if ((ball_pos_x+3 >= pad_pos_x && ball_pos_x+3 <= pad_pos_x+5) || (ball_pos_x +2>= pad_pos_x+35 && ball_pos_x+2 <= pad_pos_x+40)) { | ||
898 | bally = 2*-1; | ||
899 | if (ball_pos_x != 0 && ball_pos_x+BALL!=LCD_WIDTH) | ||
900 | ballx = pad_check(6,0,ball_pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1); | ||
901 | } else if ((ball_pos_x+3 >= pad_pos_x+5 && ball_pos_x+3 <= pad_pos_x+10) || (ball_pos_x+2 >= pad_pos_x+30 && ball_pos_x+2 <= pad_pos_x+35)) { | ||
902 | bally = 3*-1; | ||
903 | |||
904 | if (ball_pos_x != 0 && ball_pos_x+BALL!=LCD_WIDTH) | ||
905 | ballx = pad_check(4,0,ball_pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1); | ||
906 | } else if ((ball_pos_x+3 >= pad_pos_x+10 && ball_pos_x+3 <= pad_pos_x+15) || (ball_pos_x+2 >= pad_pos_x+25 && ball_pos_x+2 <= pad_pos_x+30)) { | ||
907 | bally = 4*-1; | ||
908 | |||
909 | if (ball_pos_x != 0 && ball_pos_x+BALL!=LCD_WIDTH) | ||
910 | ballx = pad_check(3,0,ball_pos_x+2<=pad_pos_x+(PAD_WIDTH/2)?0:1); | ||
911 | } else if ((ball_pos_x+3 >= pad_pos_x+13 && ball_pos_x+3 <= pad_pos_x+18) || (ball_pos_x+2 >= pad_pos_x+22 && ball_pos_x+2 <= pad_pos_x+25)) { | ||
912 | bally = 4*-1; | ||
913 | if (ball_pos_x != 0 && ball_pos_x+BALL!=LCD_WIDTH) | ||
914 | ballx = pad_check(2,1,NULL); | ||
915 | } else { | ||
916 | bally = 4*-1; | ||
917 | } | ||
918 | } | ||
919 | |||
920 | if (on_the_pad!=1) { | ||
921 | ball_pos_x+=balltempx!=0?balltempx:ballx; | ||
922 | ball_pos_y+=balltempy!=0?balltempy:bally; | ||
923 | |||
924 | balltempy=0; | ||
925 | balltempx=0; | ||
926 | } | ||
927 | |||
928 | if (ball_pos_y+5 >= PAD_POS_Y && (pad_type==1 && on_the_pad==0) && | ||
929 | (ball_pos_x >= pad_pos_x && ball_pos_x <= pad_pos_x+PAD_WIDTH)){ | ||
930 | bally=0; | ||
931 | on_the_pad=1; | ||
932 | } | ||
933 | |||
934 | rb->lcd_update(); | ||
935 | |||
936 | if (brick_on_board < 0) { | ||
937 | if (cur_level+1<levels_num) { | ||
938 | rb->sleep(HZ * 2); | ||
939 | cur_level++; | ||
940 | score+=100; | ||
941 | int_game(1); | ||
942 | } else { | ||
943 | rb->lcd_getstringsize("Congratulations!", &sw, NULL); | ||
944 | rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 140, "Congratulations!"); | ||
945 | rb->lcd_getstringsize("You have finished the game!", &sw, NULL); | ||
946 | rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 157, "You have finished the game!"); | ||
947 | vscore=score; | ||
948 | rb->lcd_update(); | ||
949 | if (score>highscore) { | ||
950 | rb->sleep(HZ*2); | ||
951 | highscore=score; | ||
952 | rb->splash(HZ*2,true,"New High Score"); | ||
953 | } else { | ||
954 | rb->sleep(HZ * 4); | ||
955 | } | ||
956 | |||
957 | switch(game_menu(0)){ | ||
958 | case 0: | ||
959 | life=2; | ||
960 | cur_level=0; | ||
961 | int_game(1); | ||
962 | break; | ||
963 | case 1: | ||
964 | con_game=1; | ||
965 | break; | ||
966 | case 2: | ||
967 | if (help(0)==1) return 1; | ||
968 | break; | ||
969 | case 3: | ||
970 | return 1; | ||
971 | break; | ||
972 | }; | ||
973 | } | ||
974 | } | ||
975 | |||
976 | int move_button,button; | ||
977 | int time = 3; /* number of ticks this function will loop reading keys */ | ||
978 | int start = *rb->current_tick; | ||
979 | int end = start + time; | ||
980 | button=rb->button_get_w_tmo(end - *rb->current_tick); | ||
981 | move_button=rb->button_status(); | ||
982 | |||
983 | if (move_button & RIGHT) { | ||
984 | if (pad_pos_x+8+PAD_WIDTH > LCD_WIDTH) { | ||
985 | if (start_game==1 || on_the_pad==1) ball_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH; | ||
986 | pad_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH; | ||
987 | } else { | ||
988 | if ((start_game==1 || on_the_pad==1)) | ||
989 | ball_pos_x+=8; | ||
990 | pad_pos_x+=8; | ||
991 | } | ||
992 | } else if (move_button & LEFT) { | ||
993 | if (pad_pos_x-8 < 0) { | ||
994 | if (start_game==1 || on_the_pad==1) ball_pos_x-=pad_pos_x; | ||
995 | pad_pos_x-=pad_pos_x; | ||
996 | } else { | ||
997 | if (start_game==1 || on_the_pad==1) ball_pos_x-=8; | ||
998 | pad_pos_x-=8; | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | |||
1003 | switch(button){ | ||
1004 | case SELECT: | ||
1005 | if (start_game==1 && con_game!=1 && pad_type!=1) { | ||
1006 | bally=-4; | ||
1007 | ballx=pad_pos_x+(PAD_WIDTH/2)-2>=LCD_WIDTH/2?2:-2; | ||
1008 | start_game =0; | ||
1009 | } else if (pad_type==1 && on_the_pad==1) { | ||
1010 | on_the_pad=0; | ||
1011 | if (start_game!=1 && con_game==1) { | ||
1012 | start_game =0; | ||
1013 | con_game=0; | ||
1014 | } | ||
1015 | } else if (pad_type==2 && con_game!=1) { | ||
1016 | int tfire; | ||
1017 | tfire=fire_space(); | ||
1018 | fire[tfire].top=PAD_POS_Y-7; | ||
1019 | fire[tfire].left=pad_pos_x+1; | ||
1020 | tfire=fire_space(); | ||
1021 | fire[tfire].top=PAD_POS_Y-7; | ||
1022 | fire[tfire].left=pad_pos_x+PAD_WIDTH-1; | ||
1023 | } else if (con_game==1 && start_game!=1) { | ||
1024 | ballx=x; | ||
1025 | bally=y; | ||
1026 | con_game=0; | ||
1027 | } | ||
1028 | break; | ||
1029 | case QUIT: | ||
1030 | switch(game_menu(1)){ | ||
1031 | case 0: | ||
1032 | life=2; | ||
1033 | cur_level=0; | ||
1034 | int_game(1); | ||
1035 | break; | ||
1036 | case 1: | ||
1037 | if (ballx!=0 && bally !=0) | ||
1038 | con_game=1; | ||
1039 | break; | ||
1040 | case 2: | ||
1041 | if (help(1)==1) return 1; | ||
1042 | break; | ||
1043 | case 3: | ||
1044 | return 1; | ||
1045 | break; | ||
1046 | }; | ||
1047 | if (ballx!=0) x=ballx; | ||
1048 | ballx=0; | ||
1049 | if (bally!=0) y=bally; | ||
1050 | bally=0; | ||
1051 | break; | ||
1052 | } | ||
1053 | } else { | ||
1054 | rb->lcd_bitmap(brickmania_gameover,LCD_WIDTH/2-55,LCD_HEIGHT-87,110,52); | ||
1055 | rb->lcd_update(); | ||
1056 | if (score>highscore) { | ||
1057 | rb->sleep(HZ*2); | ||
1058 | highscore=score; | ||
1059 | rb->splash(HZ*2,true,"New High Score"); | ||
1060 | } else { | ||
1061 | rb->sleep(HZ * 3); | ||
1062 | } | ||
1063 | |||
1064 | ballx=0; | ||
1065 | bally=0; | ||
1066 | |||
1067 | switch(game_menu(0)){ | ||
1068 | case 0: | ||
1069 | cur_level=0; | ||
1070 | life=2; | ||
1071 | int_game(1); | ||
1072 | break; | ||
1073 | case 1: | ||
1074 | con_game=1; | ||
1075 | break; | ||
1076 | case 2: | ||
1077 | if (help(0)==1) return 1; | ||
1078 | break; | ||
1079 | case 3: | ||
1080 | return 1; | ||
1081 | break; | ||
1082 | } | ||
1083 | } | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1087 | /* this is the plugin entry point */ | ||
1088 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
1089 | { | ||
1090 | (void)parameter; | ||
1091 | rb = api; | ||
1092 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
1093 | rb->cpu_boost(true); | ||
1094 | #endif | ||
1095 | |||
1096 | bally=0; | ||
1097 | ballx=0; | ||
1098 | |||
1099 | rb->backlight_set_timeout(1); | ||
1100 | |||
1101 | /* now go ahead and have fun! */ | ||
1102 | while (dxball_game()!=1); | ||
1103 | |||
1104 | configfile_save(HIGH_SCORE,config,1,0); | ||
1105 | |||
1106 | rb->backlight_set_timeout(15); | ||
1107 | |||
1108 | #if !defined(SIMULATOR) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | ||
1109 | rb->cpu_boost(false); | ||
1110 | #endif | ||
1111 | |||
1112 | return PLUGIN_OK; | ||
1113 | } | ||