1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005, 2006 Ben Basha (Paprica)
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #include "configfile.h" /* Part of libplugin */
26 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
28 #define QUIT BUTTON_OFF
29 #define LEFT BUTTON_LEFT
30 #define RIGHT BUTTON_RIGHT
31 #define SELECT BUTTON_SELECT
33 #define DOWN BUTTON_DOWN
35 #define RC_QUIT BUTTON_RC_STOP
37 /* Only iPod have scroll events */
38 #define SCROLL_FWD(x) (0)
39 #define SCROLL_BACK(x) (0)
41 #elif CONFIG_KEYPAD == ONDIO_PAD
43 #define QUIT BUTTON_OFF
44 #define LEFT BUTTON_LEFT
45 #define RIGHT BUTTON_RIGHT
46 #define SELECT BUTTON_MENU
48 #define DOWN BUTTON_DOWN
50 /* Only iPod have scroll events */
51 #define SCROLL_FWD(x) (0)
52 #define SCROLL_BACK(x) (0)
54 #elif CONFIG_KEYPAD == RECORDER_PAD
56 #define QUIT BUTTON_OFF
57 #define LEFT BUTTON_LEFT
58 #define RIGHT BUTTON_RIGHT
59 #define SELECT BUTTON_PLAY
61 #define DOWN BUTTON_DOWN
63 /* Only iPod have scroll events */
64 #define SCROLL_FWD(x) (0)
65 #define SCROLL_BACK(x) (0)
67 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
69 #define QUIT BUTTON_OFF
70 #define LEFT BUTTON_LEFT
71 #define RIGHT BUTTON_RIGHT
72 #define SELECT BUTTON_SELECT
74 #define DOWN BUTTON_DOWN
76 /* Only iPod have scroll events */
77 #define SCROLL_FWD(x) (0)
78 #define SCROLL_BACK(x) (0)
80 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
81 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
82 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
84 #define QUIT BUTTON_MENU
85 #define LEFT BUTTON_LEFT
86 #define RIGHT BUTTON_RIGHT
87 #define SELECT BUTTON_SELECT
88 #define UP BUTTON_SCROLL_BACK
89 #define DOWN BUTTON_SCROLL_FWD
91 #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
92 #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
94 #elif (CONFIG_KEYPAD == GIGABEAT_PAD)
96 #define QUIT BUTTON_POWER
97 #define LEFT BUTTON_LEFT
98 #define RIGHT BUTTON_RIGHT
99 #define SELECT BUTTON_SELECT
101 #define DOWN BUTTON_DOWN
103 #define SCROLL_FWD(x) (0)
104 #define SCROLL_BACK(x) (0)
106 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD /* grayscale at the moment */
108 #define QUIT BUTTON_POWER
109 #define LEFT BUTTON_LEFT
110 #define RIGHT BUTTON_RIGHT
111 #define SELECT BUTTON_PLAY
113 #define DOWN BUTTON_DOWN
115 /* Only iPod have scroll events */
116 #define SCROLL_FWD(x) (0)
117 #define SCROLL_BACK(x) (0)
119 #elif CONFIG_KEYPAD == SANSA_E200_PAD
121 #define QUIT BUTTON_POWER
122 #define LEFT BUTTON_LEFT
123 #define RIGHT BUTTON_RIGHT
124 #define SELECT BUTTON_SELECT
125 #define UP BUTTON_SCROLL_UP
126 #define DOWN BUTTON_SCROLL_DOWN
128 #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_DOWN)
129 #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_UP)
131 #elif CONFIG_KEYPAD == IRIVER_H10_PAD /* grayscale at the moment */
133 #define QUIT BUTTON_POWER
134 #define LEFT BUTTON_LEFT
135 #define RIGHT BUTTON_RIGHT
136 #define SELECT BUTTON_PLAY
137 #define UP BUTTON_SCROLL_UP
138 #define DOWN BUTTON_SCROLL_DOWN
140 /* Only iPod have scroll events */
141 #define SCROLL_FWD(x) (0)
142 #define SCROLL_BACK(x) (0)
145 #error Unsupported keypad
148 static struct plugin_api
* rb
;
162 /* External bitmaps */
163 #if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
164 extern const fb_data brickmania_menu_bg
[];
165 extern const fb_data brickmania_gameover
[];
167 extern const fb_data brickmania_menu_items
[];
168 extern const fb_data brickmania_ball
[];
169 #ifdef HAVE_LCD_COLOR
170 extern const fb_data brickmania_break
[];
173 /* normal, glue, fire */
174 extern const fb_data brickmania_pads
[];
176 /* +life, -life, glue, fire, normal */
177 extern const fb_data brickmania_powerups
[];
179 /* purple, red, blue, pink, green, yellow orange */
180 extern const fb_data brickmania_bricks
[];
182 #if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
184 /* The time (in ms) for one iteration through the game loop - decrease this
185 to speed up the game - note that current_tick is (currently) only accurate
190 #define GAMESCREEN_HEIGHT LCD_HEIGHT
194 #define PAD_POS_Y LCD_HEIGHT - 7
195 #define BRICK_HEIGHT 12
196 #define BRICK_WIDTH 32
202 #define MENU_BMPHEIGHT 20
203 #define MENU_BMPWIDTH 112
205 #define BMPHEIGHT_powerup 10
206 #define BMPWIDTH_powerup 16
208 #define BMPHEIGHT_menu LCD_HEIGHT
209 #define BMPWIDTH_menu LCD_WIDTH
211 #define BMPXOFS_start 105
212 #define BMPYOFS_start 110
213 #define BMPXOFS_resume 112
214 #define BMPYOFS_resume 132
215 #define BMPXOFS_help 142
216 #define BMPYOFS_help 150
217 #define BMPXOFS_quit 143
218 #define BMPYOFS_quit 170
219 #define HIGHSCORE_XPOS 57
220 #define HIGHSCORE_YPOS 88
222 #define STRINGPOS_finsh 140
223 #define STRINGPOS_congrats 157
224 #define STRINGPOS_navi 150
225 #define STRINGPOS_flipsides 150
227 #elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
229 /* The time (in ms) for one iteration through the game loop - decrease this
230 to speed up the game - note that current_tick is (currently) only accurate
235 /* Offsets for LCDS > 220x176 */
237 #define GAMESCREEN_HEIGHT 176
241 #define PAD_POS_Y GAMESCREEN_HEIGHT - 7
242 #define BRICK_HEIGHT 8
243 #define BRICK_WIDTH 21
246 #define LEFTMARGIN (LCD_WIDTH-220)/2 + 5
249 #define XOFS ((LCD_WIDTH-220)/BRICK_WIDTH/2)*BRICK_WIDTH
250 #define YOFS ((LCD_HEIGHT-176)/BRICK_HEIGHT/2)*BRICK_HEIGHT
252 #define MENU_BMPHEIGHT 20
253 #define MENU_BMPWIDTH 112
255 #define BMPHEIGHT_powerup 6
256 #define BMPWIDTH_powerup 10
258 #define BMPHEIGHT_menu LCD_HEIGHT
259 #define BMPWIDTH_menu LCD_WIDTH
261 #define BMPXOFS_start (55+XOFS)
262 #define BMPYOFS_start (78+YOFS)
263 #define BMPXOFS_resume (62+XOFS)
264 #define BMPYOFS_resume (100+YOFS)
265 #define BMPXOFS_help (92+XOFS)
266 #define BMPYOFS_help (118+YOFS)
267 #define BMPXOFS_quit (93+XOFS)
268 #define BMPYOFS_quit (138+YOFS)
269 #define HIGHSCORE_XPOS (7+XOFS)
270 #define HIGHSCORE_YPOS (56+YOFS)
272 #define STRINGPOS_finsh 140
273 #define STRINGPOS_congrats 157
274 #define STRINGPOS_navi 150
275 #define STRINGPOS_flipsides 150
277 #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128)
278 /* The time (in ms) for one iteration through the game loop - decrease this
279 to speed up the game - note that current_tick is (currently) only accurate
284 #define GAMESCREEN_HEIGHT LCD_HEIGHT
288 #define PAD_POS_Y LCD_HEIGHT - 7
289 #define BRICK_HEIGHT 7
290 #define BRICK_WIDTH 15
296 #define MENU_BMPHEIGHT 17
297 #define MENU_BMPWIDTH 88
299 #define BMPHEIGHT_powerup 6
300 #define BMPWIDTH_powerup 10
303 #define BMPHEIGHT_menu 128
305 #define BMPHEIGHT_menu 45
307 #define BMPWIDTH_menu 160
310 #define BMPXOFS_start 38
311 #define BMPYOFS_start 56
312 #define BMPXOFS_resume 42
313 #define BMPYOFS_resume 72
314 #define BMPXOFS_help 65
315 #define BMPYOFS_help 85
316 #define BMPXOFS_quit 66
317 #define BMPYOFS_quit 99
319 #define BMPXOFS_start 34
320 #define BMPYOFS_start 64
321 #define BMPXOFS_resume 38
322 #define BMPYOFS_resume 77
323 #define BMPXOFS_help 64
324 #define BMPYOFS_help 90
325 #define BMPXOFS_quit 64
326 #define BMPYOFS_quit 103
328 #define HIGHSCORE_XPOS 7
329 #define HIGHSCORE_YPOS 36
331 #define STRINGPOS_finsh 110
332 #define STRINGPOS_congrats 100
333 #define STRINGPOS_navi 100
334 #define STRINGPOS_flipsides 100
337 #elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
338 /* The time (in ms) for one iteration through the game loop - decrease this
339 to speed up the game - note that current_tick is (currently) only accurate
344 #define GAMESCREEN_HEIGHT LCD_HEIGHT
348 #define PAD_POS_Y LCD_HEIGHT - 5
349 #define BRICK_HEIGHT 7
350 #define BRICK_WIDTH 13
356 #define MENU_BMPHEIGHT 17
357 #define MENU_BMPWIDTH 88
359 #define BMPHEIGHT_powerup 6
360 #define BMPWIDTH_powerup 10
362 #define BMPHEIGHT_menu 45
363 #define BMPWIDTH_menu 160
365 #define BMPXOFS_start 28
366 #define BMPYOFS_start 41
367 #define BMPXOFS_resume 33
368 #define BMPYOFS_resume 58
369 #define BMPXOFS_help 56
370 #define BMPYOFS_help 74
371 #define BMPXOFS_quit 56
372 #define BMPYOFS_quit 90
373 #define HIGHSCORE_XPOS 76
374 #define HIGHSCORE_YPOS 22
376 #define STRINGPOS_finsh 54
377 #define STRINGPOS_congrats 44
378 #define STRINGPOS_navi 44
379 #define STRINGPOS_flipsides 44
382 #elif (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
383 /* The time (in ms) for one iteration through the game loop - decrease this
384 to speed up the game - note that current_tick is (currently) only accurate
389 #define GAMESCREEN_HEIGHT LCD_HEIGHT
393 #define PAD_POS_Y LCD_HEIGHT - 5
394 #define BRICK_HEIGHT 4
395 #define BRICK_WIDTH 11
401 #define MENU_BMPHEIGHT 9
402 #define MENU_BMPWIDTH 80
404 #define BMPHEIGHT_powerup 6
405 #define BMPWIDTH_powerup 7
407 #define BMPXOFS_start 12
408 #define BMPYOFS_start 20
409 #define BMPXOFS_resume 18
410 #define BMPYOFS_resume 31
411 #define BMPXOFS_help 39
412 #define BMPYOFS_help 42
413 #define BMPXOFS_quit 40
414 #define BMPYOFS_quit 53
415 #define HIGHSCORE_XPOS 0
416 #define HIGHSCORE_YPOS 0
418 #define STRINGPOS_finsh 54
419 #define STRINGPOS_congrats 44
420 #define STRINGPOS_navi 44
421 #define STRINGPOS_flipsides 44
424 #elif (LCD_WIDTH == 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH==16)
425 /* The time (in ms) for one iteration through the game loop - decrease this
426 to speed up the game - note that current_tick is (currently) only accurate
432 #if (LCD_HEIGHT == 220)
433 #define GAMESCREEN_HEIGHT 132
435 #define GAMESCREEN_HEIGHT LCD_HEIGHT
440 #define PAD_POS_Y GAMESCREEN_HEIGHT - 7
441 #define BRICK_HEIGHT 7
442 #define BRICK_WIDTH 17
448 #define MENU_BMPHEIGHT 16
449 #define MENU_BMPWIDTH 89
451 #define BMPHEIGHT_powerup 6
452 #define BMPWIDTH_powerup 10
454 #define BMPHEIGHT_menu 132
455 #define BMPWIDTH_menu 176
457 #define BMPXOFS_start 44
458 #define BMPYOFS_start 58
459 #define BMPXOFS_resume 50
460 #define BMPYOFS_resume 75
461 #define BMPXOFS_help 74
462 #define BMPYOFS_help 89
463 #define BMPXOFS_quit 75
464 #define BMPYOFS_quit 104
465 #define HIGHSCORE_XPOS 7
466 #define HIGHSCORE_YPOS 36
468 #define STRINGPOS_finsh 110
469 #define STRINGPOS_congrats 110
470 #define STRINGPOS_navi 100
471 #define STRINGPOS_flipsides 100
474 #error Unsupported LCD Size
479 static unsigned char levels
[29][8][10] = {
481 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
482 {0x2,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x2},
483 {0x0,0x2,0x1,0x0,0x0,0x0,0x0,0x1,0x2,0x0},
484 {0x0,0x0,0x2,0x1,0x0,0x0,0x1,0x2,0x0,0x0},
485 {0x0,0x0,0x0,0x2,0x1,0x1,0x2,0x0,0x0,0x0},
486 {0x7,0x0,0x0,0x7,0x2,0x2,0x7,0x0,0x0,0x7},
487 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
488 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
491 {0x0,0x0,0x7,0x7,0x1,0x1,0x7,0x7,0x0,0x0},
492 {0x0,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x0},
493 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
494 {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1},
495 {0x1,0x1,0x2,0x1,0x0,0x0,0x1,0x2,0x1,0x1},
496 {0x1,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x2,0x1},
497 {0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x2,0x1,0x0},
498 {0x0,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x0}
501 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
502 {0x3,0x23,0x23,0x3,0x0,0x0,0x2,0x22,0x22,0x2},
503 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
504 {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
505 {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
506 {0x5,0x5,0x5,0x5,0x0,0x0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,0x6,0x0,0x0},
624 {0x2,0x1,0x1,0x2,0x1,0x1,0x1,0x5,0x0,0x0},
625 {0x2,0x1,0x2,0x2,0x2,0x1,0x1,0x6,0x0,0x0},
626 {0x2,0x1,0x2,0x2,0x2,0x1,0x3,0x5,0x3,0x0},
627 {0x2,0x1,0x1,0x2,0x1,0x1,0x1,0x6,0x0,0x0},
628 {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}
630 {/* level 16 (Rockbox) by ts-x */
631 {0x2,0x2,0x3,0x3,0x3,0x4,0x4,0x5,0x0,0x5},
632 {0x2,0x0,0x3,0x0,0x3,0x4,0x0,0x5,0x5,0x0},
633 {0x2,0x0,0x3,0x3,0x3,0x4,0x4,0x5,0x0,0x5},
634 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
635 {0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
636 {0x7,0x7,0x7,0x1,0x1,0x1,0x2,0x0,0x2,0x0},
637 {0x7,0x0,0x7,0x1,0x0,0x1,0x0,0x2,0x0,0x0},
638 {0x7,0x7,0x7,0x1,0x1,0x1,0x2,0x0,0x2,0x0}
640 {/* level 17 (Alien) by ts-x */
641 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
642 {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2},
643 {0x1,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x1},
644 {0x2,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x2},
645 {0x1,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x1},
646 {0x2,0x0,0x0,0x1,0x2,0x2,0x1,0x0,0x0,0x2},
647 {0x2,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x2},
648 {0x2,0x2,0x1,0x0,0x1,0x1,0x0,0x1,0x2,0x2}
650 {/* level 18 (Tetris) by ts-x */
651 {0x0,0x2,0x0,0x0,0x3,0x4,0x0,0x2,0x2,0x0},
652 {0x0,0x2,0x7,0x0,0x3,0x4,0x0,0x2,0x2,0x0},
653 {0x2,0x2,0x7,0x0,0x3,0x4,0x0,0x6,0x2,0x2},
654 {0x2,0x2,0x7,0x7,0x3,0x4,0x0,0x6,0x2,0x2},
655 {0x2,0x1,0x7,0x7,0x3,0x4,0x4,0x6,0x5,0x5},
656 {0x2,0x1,0x0,0x7,0x3,0x4,0x4,0x6,0x5,0x5},
657 {0x1,0x1,0x1,0x7,0x3,0x0,0x6,0x6,0x5,0x5},
658 {0x1,0x1,0x1,0x0,0x3,0x0,0x6,0x6,0x5,0x5}
660 { /* level 19 (Stalactites) by ts-x */
661 {0x5,0x2,0x6,0x3,0x4,0x7,0x5,0x3,0x1,0x2},
662 {0x5,0x2,0x6,0x3,0x4,0x7,0x5,0x3,0x1,0x2},
663 {0x5,0x0,0x6,0x3,0x4,0x7,0x5,0x0,0x1,0x2},
664 {0x5,0x2,0x6,0x3,0x4,0x0,0x5,0x3,0x1,0x2},
665 {0x5,0x0,0x6,0x0,0x4,0x7,0x5,0x0,0x1,0x0},
666 {0x5,0x0,0x0,0x3,0x4,0x0,0x0,0x0,0x1,0x2},
667 {0x0,0x0,0x6,0x0,0x0,0x0,0x5,0x0,0x0,0x0},
668 {0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0}
670 { /* level 20 (Maze) by ts-x */
671 {0x1,0x1,0x21,0x1,0x1,0x1,0x1,0x1,0x1,0x21},
672 {0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x31,0x1},
673 {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x31,0x0,0x1},
674 {0x21,0x0,0x21,0x3,0x0,0x3,0x0,0x3,0x0,0x2},
675 {0x1,0x0,0x1,0x21,0x0,0x12,0x0,0x0,0x0,0x0},
676 {0x31,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0},
677 {0x1,0x0,0x1,0x0,0x1,0x1,0x31,0x1,0x1,0x2},
678 {0x22,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x21}
680 { /* level 21 (Dentist) by ts-x */
681 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0},
682 {0x2,0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x2,0x2},
683 {0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x2},
684 {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x2},
685 {0x2,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x2},
686 {0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x2},
687 {0x2,0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x2,0x2},
688 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}
690 { /* level 22 (Spider) by ts-x */
691 {0x31,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x31},
692 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
693 {0x33,0x1,0x1,0x36,0x1,0x1,0x36,0x1,0x1,0x33},
694 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
695 {0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0},
696 {0x21,0x3,0x1,0x21,0x2,0x2,0x21,0x1,0x3,0x21},
697 {0x0,0x0,0x0,0x1,0x21,0x1,0x1,0x0,0x0,0x0},
698 {0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3}
700 { /* level 23 (Pool) by ts-x */
701 {0x0,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x7,0x0},
702 {0x0,0x0,0x5,0x0,0x2,0x0,0x0,0x0,0x2,0x0},
703 {0x7,0x3,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x7},
704 {0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x5,0x0,0x7},
705 {0x7,0x0,0x4,0x0,0x0,0x3,0x0,0x0,0x0,0x7},
706 {0x7,0x0,0x0,0x6,0x0,0x0,0x0,0x0,0x4,0x7},
707 {0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
708 {0x0,0x7,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x0}
710 { /* level 24 (Vorbis Fish) by ts-x */
711 {0x0,0x0,0x4,0x4,0x5,0x5,0x5,0x0,0x0,0x5},
712 {0x0,0x4,0x6,0x4,0x4,0x5,0x5,0x5,0x0,0x5},
713 {0x5,0x6,0x0,0x6,0x4,0x4,0x4,0x5,0x5,0x5},
714 {0x5,0x6,0x0,0x6,0x4,0x4,0x4,0x4,0x5,0x5},
715 {0x0,0x5,0x6,0x4,0x4,0x5,0x5,0x4,0x5,0x0},
716 {0x5,0x5,0x4,0x4,0x5,0x5,0x5,0x4,0x5,0x5},
717 {0x5,0x4,0x4,0x4,0x5,0x5,0x4,0x4,0x5,0x5},
718 {0x0,0x0,0x4,0x4,0x4,0x4,0x4,0x5,0x0,0x5}
720 {/* level 25 (Rainbow) by ts-x */
721 {0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0},
722 {0x24,0x1,0x3,0x1,0x0,0x0,0x21,0x3,0x1,0x24},
723 {0x1,0x23,0x5,0x3,0x1,0x21,0x3,0x5,0x3,0x21},
724 {0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3},
725 {0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5},
726 {0x6,0x7,0x2,0x27,0x6,0x6,0x27,0x2,0x7,0x6},
727 {0x7,0x2,0x0,0x2,0x27,0x27,0x2,0x0,0x2,0x7},
728 {0x32,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x32}
730 { /* level 26 (Bowtie) by ts-x */
731 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5},
732 {0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1},
733 {0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5},
734 {0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1},
735 {0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1},
736 {0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5},
737 {0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1},
738 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}
740 { /* level 27 (Frog) by ts-x */
741 {0x0,0x5,0x25,0x0,0x0,0x0,0x0,0x25,0x5,0x0},
742 {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
743 {0x25,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x25},
744 {0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5},
745 {0x5,0x0,0x31,0x0,0x6,0x6,0x0,0x31,0x0,0x5},
746 {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5},
747 {0x5,0x5,0x5,0x35,0x0,0x0,0x35,0x5,0x5,0x5},
748 {0x0,0x25,0x5,0x0,0x4,0x4,0x0,0x5,0x25,0x0}
750 { /* level 28 (DigDug) by ts-x */
751 {0x35,0x5,0x5,0x25,0x0,0x25,0x25,0x5,0x5,0x35},
752 {0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6},
753 {0x7,0x0,0x37,0x37,0x0,0x37,0x37,0x7,0x0,0x7},
754 {0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7},
755 {0x4,0x4,0x4,0x24,0x0,0x24,0x4,0x0,0x0,0x4},
756 {0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4},
757 {0x24,0x24,0x4,0x4,0x4,0x4,0x0,0x0,0x24,0x4},
758 {0x1,0x1,0x1,0x1,0x1,0x1,0x21,0x21,0x1,0x1}
761 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
762 {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
763 {0x22,0x0,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
764 {0x22,0x22,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
765 {0x22,0x22,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
766 {0x22,0x0,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
767 {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
768 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
774 int x
[MAX_BALLS
],y
[MAX_BALLS
];
776 int start_game
,con_game
;
778 int score
=0,vscore
=0;
779 bool flip_sides
=false;
781 int brick_on_board
=0;
784 typedef struct cube
{
795 typedef struct balls
{
805 balls ball
[MAX_BALLS
];
807 typedef struct sfire
{
815 #define MAX_POINTS 200000 /* i dont think it needs to be more */
816 static struct configdata config
[] =
818 {TYPE_INT
, 0, MAX_POINTS
, &highscore
, "highscore", NULL
, NULL
}
821 void int_game(int new_game
)
825 pad_pos_x
=LCD_WIDTH
/2-PAD_WIDTH
/2;
827 for(i
=0;i
<MAX_BALLS
;i
++) {
832 ball
[i
].pos_y
=PAD_POS_Y
-BALL
;
833 ball
[i
].pos_x
=pad_pos_x
+(PAD_WIDTH
/2)-2;
849 brick
[i
*10+j
].poweruse
=(levels
[cur_level
][i
][j
]==0?0:1);
853 brick
[i
*10+j
].power
=rb
->rand()%25;
854 /* +8 make the game with less powerups */
856 brick
[i
*10+j
].hits
=levels
[cur_level
][i
][j
]>=10?
857 levels
[cur_level
][i
][j
]/16-1:0;
858 brick
[i
*10+j
].hiteffect
=0;
859 brick
[i
*10+j
].powertop
=TOPMARGIN
+i
*BRICK_HEIGHT
+BRICK_HEIGHT
;
860 brick
[i
*10+j
].used
=(levels
[cur_level
][i
][j
]==0?0:1);
861 brick
[i
*10+j
].color
=(levels
[cur_level
][i
][j
]>=10?
862 levels
[cur_level
][i
][j
]%16:
863 levels
[cur_level
][i
][j
])-1;
864 if (levels
[cur_level
][i
][j
]!=0)
873 /* sleep timer counting the score */
874 void sleep (int secs
)
884 rb
->snprintf(s
, sizeof(s
), "%d", vscore
);
885 rb
->lcd_getstringsize(s
, &sw
, &w
);
886 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
887 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 0, s
);
889 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 2, s
);
891 rb
->lcd_update_rect(0,0,LCD_WIDTH
,w
+2);
894 count
=*rb
->current_tick
+HZ
*secs
;
895 if (*rb
->current_tick
>=count
)
903 #define HIGH_SCORE "brickmania.score"
904 #define MENU_LENGTH 4
905 int game_menu(int when
)
909 rb
->lcd_clear_display();
910 #if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
911 rb
->lcd_bitmap(brickmania_menu_bg
, 0, 0, BMPWIDTH_menu
, BMPHEIGHT_menu
);
914 for(i
=0;i
<MENU_LENGTH
;i
++) {
915 #ifdef HAVE_LCD_COLOR
917 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
918 MENU_BMPHEIGHT
* BM_SEL_START
, MENU_BMPWIDTH
,
919 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
922 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
923 MENU_BMPHEIGHT
* BM_START
, MENU_BMPWIDTH
,
924 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
929 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
930 MENU_BMPHEIGHT
* BM_SEL_RESUME
, MENU_BMPWIDTH
,
931 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
934 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
935 MENU_BMPHEIGHT
* BM_RESUME
, MENU_BMPWIDTH
,
936 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
940 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
941 MENU_BMPHEIGHT
* BM_NO_RESUME
, MENU_BMPWIDTH
,
942 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
948 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
949 MENU_BMPHEIGHT
* BM_SEL_HELP
, MENU_BMPWIDTH
,
950 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
953 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
954 MENU_BMPHEIGHT
* BM_HELP
, MENU_BMPWIDTH
,
955 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
959 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
960 MENU_BMPHEIGHT
* BM_SEL_QUIT
, MENU_BMPWIDTH
,
961 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
964 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
965 MENU_BMPHEIGHT
* BM_QUIT
, MENU_BMPWIDTH
,
966 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
970 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
971 MENU_BMPHEIGHT
* BM_SEL_START
, MENU_BMPWIDTH
,
972 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
975 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
976 MENU_BMPHEIGHT
* BM_START
, MENU_BMPWIDTH
,
977 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
982 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
983 MENU_BMPHEIGHT
* BM_SEL_RESUME
, MENU_BMPWIDTH
,
984 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
987 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
988 MENU_BMPHEIGHT
* BM_RESUME
, MENU_BMPWIDTH
,
989 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
993 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
994 MENU_BMPHEIGHT
* BM_NO_RESUME
, MENU_BMPWIDTH
,
995 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
1001 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1002 MENU_BMPHEIGHT
* BM_SEL_HELP
, MENU_BMPWIDTH
,
1003 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
1006 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1007 MENU_BMPHEIGHT
* BM_HELP
, MENU_BMPWIDTH
,
1008 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
1012 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1013 MENU_BMPHEIGHT
* BM_SEL_QUIT
, MENU_BMPWIDTH
,
1014 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
1017 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1018 MENU_BMPHEIGHT
* BM_QUIT
, MENU_BMPWIDTH
,
1019 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
1023 rb
->lcd_set_drawmode(DRMODE_FG
);
1025 #ifdef HAVE_LCD_COLOR
1026 rb
->lcd_set_background(LCD_RGBPACK(0,0,140));
1027 rb
->lcd_set_foreground(LCD_WHITE
);
1029 rb
->lcd_putsxy(HIGHSCORE_XPOS
, HIGHSCORE_YPOS
, "High Score");
1030 rb
->snprintf(str
, sizeof(str
), "%d", highscore
);
1031 rb
->lcd_getstringsize("High Score", &sw
, NULL
);
1032 rb
->lcd_getstringsize(str
, &w
, NULL
);
1033 rb
->lcd_putsxy(HIGHSCORE_XPOS
+sw
/2-w
/2, HIGHSCORE_YPOS
+9, str
);
1034 rb
->lcd_set_drawmode(DRMODE_SOLID
);
1038 button
= rb
->button_get(true);
1041 case UP
| BUTTON_REPEAT
:
1043 cur
= MENU_LENGTH
-1;
1046 if (when
==0 && cur
==1) {
1052 case DOWN
| BUTTON_REPEAT
:
1053 if (cur
==MENU_LENGTH
-1)
1057 if (when
==0 && cur
==1) {
1068 } else if (cur
==1 && when
==1) {
1070 } else if (cur
==2) {
1072 } else if (cur
==3) {
1084 if(rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
1097 /* set the maximum x and y in the helpscreen
1098 dont forget to update, if you change text */
1103 #ifdef HAVE_LCD_COLOR
1104 rb
->lcd_set_background(LCD_BLACK
);
1105 rb
->lcd_clear_display();
1106 rb
->lcd_set_background(LCD_BLACK
);
1107 rb
->lcd_set_foreground(LCD_WHITE
);
1109 rb
->lcd_clear_display();
1112 rb
->lcd_getstringsize("BrickMania", &w
, &h
);
1113 rb
->lcd_putsxy(LCD_WIDTH
/2-w
/2+xoffset
, 1+yoffset
, "BrickMania");
1115 #ifdef HAVE_LCD_COLOR
1116 rb
->lcd_set_foreground(LCD_RGBPACK(245,0,0));
1117 rb
->lcd_putsxy(1+xoffset
, 1*(h
+2)+yoffset
,"Aim");
1118 rb
->lcd_set_foreground(LCD_WHITE
);
1120 rb
->lcd_putsxy(1+xoffset
, 1*(h
+2)+yoffset
,"Aim");
1122 rb
->lcd_putsxy(1+xoffset
, 2*(h
+2)+yoffset
,
1123 "destroy all the bricks by bouncing");
1124 rb
->lcd_putsxy(1+xoffset
, 3*(h
+2)+yoffset
,
1125 "the ball of them using the paddle.");
1126 #ifdef HAVE_LCD_COLOR
1127 rb
->lcd_set_foreground(LCD_RGBPACK(245,0,0));
1128 rb
->lcd_putsxy(1+xoffset
, 5*(h
+2)+yoffset
,"Controls");
1129 rb
->lcd_set_foreground(LCD_WHITE
);
1131 rb
->lcd_putsxy(1+xoffset
, 5*(h
+2)+yoffset
,"Controls");
1133 rb
->lcd_putsxy(1+xoffset
, 6*(h
+2)+yoffset
,"< & > Move the paddle");
1134 #if CONFIG_KEYPAD == ONDIO_PAD
1135 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1136 "MENU Releases the ball/Fire!");
1137 #elif CONFIG_KEYPAD == RECORDER_PAD
1138 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1139 "PLAY Releases the ball/Fire!");
1140 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
1141 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1142 "NAVI Releases the ball/Fire!");
1144 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1145 "SELECT Releases the ball/Fire!");
1147 rb
->lcd_putsxy(1+xoffset
, 8*(h
+2)+yoffset
, "STOP Opens menu/Quit");
1148 #ifdef HAVE_LCD_COLOR
1149 rb
->lcd_set_foreground(LCD_RGBPACK(245,0,0));
1150 rb
->lcd_putsxy(1+xoffset
, 10*(h
+2)+yoffset
, "Specials");
1151 rb
->lcd_set_foreground(LCD_WHITE
);
1153 rb
->lcd_putsxy(1+xoffset
, 10*(h
+2)+yoffset
, "Specials");
1155 rb
->lcd_putsxy(1+xoffset
, 11*(h
+2)+yoffset
,
1156 "N Normal:returns paddle to normal");
1157 rb
->lcd_putsxy(1+xoffset
, 12*(h
+2)+yoffset
, "D DIE!:loses a life");
1158 rb
->lcd_putsxy(1+xoffset
, 13*(h
+2)+yoffset
,
1159 "L Life:gains a life/power up");
1160 rb
->lcd_putsxy(1+xoffset
, 14*(h
+2)+yoffset
,
1161 "F Fire:allows you to shoot bricks");
1162 rb
->lcd_putsxy(1+xoffset
, 15*(h
+2)+yoffset
,
1163 "G Glue:ball sticks to paddle");
1164 rb
->lcd_putsxy(1+xoffset
, 16*(h
+2)+yoffset
,
1165 "B Ball:generates another ball");
1166 rb
->lcd_putsxy(1+xoffset
, 17*(h
+2)+yoffset
,
1167 "FL Flip:flips left / right movement");
1170 button
=rb
->button_get(true);
1176 switch (game_menu(when
)) {
1196 case LEFT
| BUTTON_REPEAT
:
1201 case RIGHT
| BUTTON_REPEAT
:
1202 if(xoffset
+maxX
> LCD_WIDTH
)
1206 case UP
| BUTTON_REPEAT
:
1211 case DOWN
| BUTTON_REPEAT
:
1212 if(yoffset
+maxY
> LCD_HEIGHT
)
1217 if(rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
1225 int pad_check(int ballxc
, int mode
, int pon
,int ballnum
)
1227 /* pon: positive(1) or negative(0) */
1235 if (ball
[ballnum
].x
> 0)
1242 int fire_space(void)
1246 if (fire
[t
].top
+7 < 0)
1254 int j
,i
,k
,bricky
,brickx
;
1256 int sec_count
=0,num_count
=10;
1259 rb
->srand( *rb
->current_tick
);
1261 configfile_init(rb
);
1262 configfile_load(HIGH_SCORE
,config
,1,0);
1264 switch(game_menu(0)) {
1274 if (help(0) == 1) return 1;
1282 /* Convert CYCLETIME (in ms) to HZ */
1283 end
= *rb
->current_tick
+ (CYCLETIME
* HZ
) / 1000;
1286 #ifdef HAVE_LCD_COLOR
1287 rb
->lcd_set_background(LCD_BLACK
);
1288 rb
->lcd_set_drawmode(DRMODE_SOLID
);
1289 rb
->lcd_clear_display();
1290 rb
->lcd_set_background(LCD_BLACK
);
1291 #if LCD_HEIGHT > GAMESCREEN_HEIGHT
1292 rb
->lcd_set_foreground(rb
->global_settings
->bg_color
);
1293 rb
->lcd_fillrect(0, GAMESCREEN_HEIGHT
, LCD_WIDTH
,
1294 LCD_HEIGHT
- GAMESCREEN_HEIGHT
);
1296 rb
->lcd_set_foreground(LCD_WHITE
);
1298 rb
->lcd_clear_display();
1302 if (*rb
->current_tick
>=sec_count
) {
1303 sec_count
=*rb
->current_tick
+HZ
;
1309 rb
->snprintf(s
, sizeof(s
), "%d", num_count
);
1310 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1311 rb
->lcd_putsxy(LCD_WIDTH
/2-2, STRINGPOS_flipsides
, s
);
1314 /* write life num */
1315 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1316 rb
->snprintf(s
, sizeof(s
), "L:%d", life
);
1317 rb
->lcd_putsxy(0, 0, s
);
1319 rb
->snprintf(s
, sizeof(s
), "Life: %d", life
);
1320 rb
->lcd_putsxy(2, 2, s
);
1323 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1324 rb
->snprintf(s
, sizeof(s
), "L%d", cur_level
+1);
1325 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1326 rb
->lcd_putsxy(LCD_WIDTH
-sw
, 0, s
);
1328 rb
->snprintf(s
, sizeof(s
), "Level %d", cur_level
+1);
1329 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1330 rb
->lcd_putsxy(LCD_WIDTH
-sw
-2, 2, s
);
1333 if (vscore
<score
) vscore
++;
1334 rb
->snprintf(s
, sizeof(s
), "%d", vscore
);
1335 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1336 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1337 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 0, s
);
1339 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 2, s
);
1343 if (con_game
== 1 && start_game
!=1) {
1344 #if CONFIG_KEYPAD == ONDIO_PAD
1345 rb
->snprintf(s
, sizeof(s
), "MENU To Continue");
1346 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
1347 rb
->snprintf(s
, sizeof(s
), "Press NAVI To Continue");
1349 rb
->snprintf(s
, sizeof(s
), "Press SELECT To Continue");
1351 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1352 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_navi
, s
);
1354 sec_count
=*rb
->current_tick
+HZ
;
1358 for(i
=0;i
<used_balls
;i
++)
1359 rb
->lcd_bitmap(brickmania_ball
,ball
[i
].pos_x
, ball
[i
].pos_y
,
1362 if (brick_on_board
==0)
1365 /* if the pad is fire */
1366 for(i
=0;i
<=30;i
++) {
1367 if (fire
[i
].top
+7>0) {
1370 rb
->lcd_vline(fire
[i
].left
, fire
[i
].top
, fire
[i
].top
+7);
1375 for (i
=0;i
<=7;i
++) {
1376 for (j
=0;j
<=9;j
++) {
1377 if (brick
[i
*10+j
].power
<7) {
1378 if (brick
[i
*10+j
].poweruse
==2) {
1380 brick
[i
*10+j
].powertop
+=2;
1381 rb
->lcd_bitmap_part(brickmania_powerups
,0,
1382 BMPHEIGHT_powerup
*brick
[i
*10+j
1385 LEFTMARGIN
+j
*BRICK_WIDTH
+
1387 BMPWIDTH_powerup
/2),
1388 brick
[i
*10+j
].powertop
,
1394 if ((pad_pos_x
<LEFTMARGIN
+j
*BRICK_WIDTH
+5 &&
1395 pad_pos_x
+PAD_WIDTH
>LEFTMARGIN
+j
*BRICK_WIDTH
+5) &&
1396 brick
[i
*10+j
].powertop
+6>=PAD_POS_Y
&&
1397 brick
[i
*10+j
].poweruse
==2) {
1398 switch(brick
[i
*10+j
].power
) {
1417 for(k
=0;k
<used_balls
;k
++)
1423 for(k
=0;k
<used_balls
;k
++)
1429 sec_count
=*rb
->current_tick
+HZ
;
1431 flip_sides
=!flip_sides
;
1436 ball
[used_balls
-1].x
= rb
->rand()%1 == 0 ?
1438 ball
[used_balls
-1].y
= -4;
1441 brick
[i
*10+j
].poweruse
=1;
1444 if (brick
[i
*10+j
].powertop
>PAD_POS_Y
)
1445 brick
[i
*10+j
].poweruse
=1;
1447 brickx
=LEFTMARGIN
+j
*BRICK_WIDTH
;
1448 bricky
=TOPMARGIN
+i
*BRICK_HEIGHT
;
1450 for (k
=0;k
<=30;k
++) {
1451 if (fire
[k
].top
+7>0) {
1452 if (brick
[i
*10+j
].used
==1 &&
1453 (fire
[k
].left
+1 >= brickx
&&
1454 fire
[k
].left
+1 <= brickx
+BRICK_WIDTH
) &&
1455 (bricky
+BRICK_HEIGHT
>fire
[k
].top
)) {
1458 if (brick
[i
*10+j
].hits
> 0) {
1459 brick
[i
*10+j
].hits
--;
1460 brick
[i
*10+j
].hiteffect
++;
1464 brick
[i
*10+j
].used
=0;
1465 if (brick
[i
*10+j
].power
!=10)
1466 brick
[i
*10+j
].poweruse
=2;
1474 if (brick
[i
*10+j
].used
==1) {
1475 rb
->lcd_bitmap_part(brickmania_bricks
,0,
1476 BRICK_HEIGHT
*brick
[i
*10+j
].color
,
1478 LEFTMARGIN
+j
*BRICK_WIDTH
,
1479 TOPMARGIN
+i
*BRICK_HEIGHT
,
1480 BRICK_WIDTH
, BRICK_HEIGHT
);
1481 #ifdef HAVE_LCD_COLOR /* No transparent effect for greyscale lcds for now */
1482 if (brick
[i
*10+j
].hiteffect
>0)
1483 rb
->lcd_bitmap_transparent_part(brickmania_break
,
1485 BRICK_HEIGHT
*brick
[i
*10+j
].hiteffect
,
1487 LEFTMARGIN
+j
*BRICK_WIDTH
,
1488 TOPMARGIN
+i
*BRICK_HEIGHT
,
1494 for(k
=0;k
<used_balls
;k
++) {
1495 if (ball
[k
].pos_y
<160) {
1496 if (brick
[i
*10+j
].used
==1) {
1497 if ((ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
>=
1499 ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
<=
1500 brickx
+BRICK_WIDTH
) &&
1501 ((bricky
-4<ball
[k
].pos_y
+BALL
&&
1502 bricky
>ball
[k
].pos_y
+BALL
) ||
1503 (bricky
+4>ball
[k
].pos_y
+BALL
+BALL
&&
1504 bricky
<ball
[k
].pos_y
+BALL
+BALL
)) &&
1506 ball
[k
].tempy
=bricky
-ball
[k
].pos_y
-BALL
;
1508 else if ((ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
>=
1510 ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
<=
1511 brickx
+BRICK_WIDTH
) &&
1512 ((bricky
+BRICK_HEIGHT
+4>ball
[k
].pos_y
&&
1513 bricky
+BRICK_HEIGHT
<ball
[k
].pos_y
) ||
1514 (bricky
+BRICK_HEIGHT
-4<ball
[k
].pos_y
-BALL
&&
1515 bricky
+BRICK_HEIGHT
>ball
[k
].pos_y
-BALL
)) &&
1518 -(ball
[k
].pos_y
-(bricky
+BRICK_HEIGHT
));
1521 if ((ball
[k
].pos_y
+HALFBALL
>=
1523 ball
[k
].pos_y
+HALFBALL
<=
1524 bricky
+BRICK_HEIGHT
) &&
1525 ((brickx
-4<ball
[k
].pos_x
+BALL
&&
1526 brickx
>ball
[k
].pos_x
+BALL
) ||
1527 (brickx
+4>ball
[k
].pos_x
+BALL
+BALL
&&
1528 brickx
<ball
[k
].pos_x
+BALL
+BALL
)) &&
1530 ball
[k
].tempx
=brickx
-ball
[k
].pos_x
-BALL
;
1532 else if ((ball
[k
].pos_y
+ball
[k
].y
+HALFBALL
>=
1534 ball
[k
].pos_y
+ball
[k
].y
+HALFBALL
<=
1535 bricky
+BRICK_HEIGHT
) &&
1536 ((brickx
+BRICK_WIDTH
+4>ball
[k
].pos_x
&&
1537 brickx
+BRICK_WIDTH
<ball
[k
].pos_x
) ||
1538 (brickx
+BRICK_WIDTH
-4<ball
[k
].pos_x
-
1540 brickx
+BRICK_WIDTH
>ball
[k
].pos_x
-
1541 BALL
)) && (ball
[k
].x
<0)) {
1543 -(ball
[k
].pos_x
-(brickx
+BRICK_WIDTH
));
1546 if ((ball
[k
].pos_x
+HALFBALL
>= brickx
&&
1547 ball
[k
].pos_x
+HALFBALL
<=
1548 brickx
+BRICK_WIDTH
) &&
1549 ((bricky
+BRICK_HEIGHT
==ball
[k
].pos_y
) ||
1550 (bricky
+BRICK_HEIGHT
-6<=ball
[k
].pos_y
&&
1551 bricky
+BRICK_HEIGHT
>ball
[k
].pos_y
)) &&
1552 (ball
[k
].y
<0)) { /* bottom line */
1553 if (brick
[i
*10+j
].hits
> 0) {
1554 brick
[i
*10+j
].hits
--;
1555 brick
[i
*10+j
].hiteffect
++;
1559 brick
[i
*10+j
].used
=0;
1560 if (brick
[i
*10+j
].power
!=10)
1561 brick
[i
*10+j
].poweruse
=2;
1564 ball
[k
].y
= ball
[k
].y
*-1;
1566 else if ((ball
[k
].pos_x
+HALFBALL
>= brickx
&&
1567 ball
[k
].pos_x
+HALFBALL
<=
1568 brickx
+BRICK_WIDTH
) &&
1569 ((bricky
==ball
[k
].pos_y
+BALL
) ||
1570 (bricky
+6>=ball
[k
].pos_y
+BALL
&&
1571 bricky
<ball
[k
].pos_y
+BALL
)) &&
1572 (ball
[k
].y
>0)) { /* top line */
1573 if (brick
[i
*10+j
].hits
> 0) {
1574 brick
[i
*10+j
].hits
--;
1575 brick
[i
*10+j
].hiteffect
++;
1579 brick
[i
*10+j
].used
=0;
1580 if (brick
[i
*10+j
].power
!=10)
1581 brick
[i
*10+j
].poweruse
=2;
1584 ball
[k
].y
= ball
[k
].y
*-1;
1587 if ((ball
[k
].pos_y
+HALFBALL
>= bricky
&&
1588 ball
[k
].pos_y
+HALFBALL
<=
1589 bricky
+BRICK_HEIGHT
) &&
1590 ((brickx
==ball
[k
].pos_x
+BALL
) ||
1591 (brickx
+6>=ball
[k
].pos_x
+BALL
&&
1592 brickx
<ball
[k
].pos_x
+BALL
)) &&
1593 (ball
[k
].x
> 0)) { /* left line */
1594 if (brick
[i
*10+j
].hits
> 0) {
1595 brick
[i
*10+j
].hits
--;
1596 brick
[i
*10+j
].hiteffect
++;
1600 brick
[i
*10+j
].used
=0;
1601 if (brick
[i
*10+j
].power
!=10)
1602 brick
[i
*10+j
].poweruse
=2;
1604 ball
[k
].x
= ball
[k
].x
*-1;
1607 else if ((ball
[k
].pos_y
+HALFBALL
>= bricky
&&
1608 ball
[k
].pos_y
+HALFBALL
<=
1609 bricky
+BRICK_HEIGHT
) &&
1610 ((brickx
+BRICK_WIDTH
==
1612 (brickx
+BRICK_WIDTH
-6<=
1616 (ball
[k
].x
< 0)) { /* Right line */
1617 if (brick
[i
*10+j
].hits
> 0) {
1618 brick
[i
*10+j
].hits
--;
1619 brick
[i
*10+j
].hiteffect
++;
1623 brick
[i
*10+j
].used
=0;
1624 if (brick
[i
*10+j
].power
!=10)
1625 brick
[i
*10+j
].poweruse
=2;
1628 ball
[k
].x
= ball
[k
].x
*-1;
1631 if (brick
[i
*10+j
].used
==0) {
1642 rb
->lcd_bitmap_part(brickmania_pads
,0,pad_type
*PAD_HEIGHT
,
1643 PAD_WIDTH
,pad_pos_x
, PAD_POS_Y
, PAD_WIDTH
,
1646 for(k
=0;k
<used_balls
;k
++) {
1648 if ((ball
[k
].pos_x
>= pad_pos_x
&&
1649 ball
[k
].pos_x
<= pad_pos_x
+PAD_WIDTH
) &&
1650 (PAD_POS_Y
-4<ball
[k
].pos_y
+BALL
&&
1651 PAD_POS_Y
>ball
[k
].pos_y
+BALL
) && (ball
[k
].y
>0))
1652 ball
[k
].tempy
=PAD_POS_Y
-ball
[k
].pos_y
-BALL
;
1653 else if ((4>ball
[k
].pos_y
&& 0<ball
[k
].pos_y
) &&
1655 ball
[k
].tempy
=-ball
[k
].pos_y
;
1656 if ((LCD_WIDTH
-4<ball
[k
].pos_x
+BALL
&&
1657 LCD_WIDTH
>ball
[k
].pos_x
+BALL
) && (ball
[k
].x
>0))
1658 ball
[k
].tempx
=LCD_WIDTH
-ball
[k
].pos_x
-BALL
;
1659 else if ((4>ball
[k
].pos_x
&& 0<ball
[k
].pos_x
) &&
1661 ball
[k
].tempx
=-ball
[k
].pos_x
;
1664 if (ball
[k
].pos_y
<= 0)
1665 ball
[k
].y
= ball
[k
].y
*-1;
1667 else if (ball
[k
].pos_y
+BALL
>= GAMESCREEN_HEIGHT
) {
1670 ball
[k
].pos_x
= ball
[used_balls
].pos_x
;
1671 ball
[k
].pos_y
= ball
[used_balls
].pos_y
;
1672 ball
[k
].y
= ball
[used_balls
].y
;
1673 ball
[k
].tempy
= ball
[used_balls
].tempy
;
1674 ball
[k
].x
= ball
[used_balls
].x
;
1675 ball
[k
].tempx
= ball
[used_balls
].tempx
;
1676 ball
[k
].glue
= ball
[used_balls
].glue
;
1678 ball
[used_balls
].x
=0;
1679 ball
[used_balls
].y
=0;
1680 ball
[used_balls
].tempy
=0;
1681 ball
[used_balls
].tempx
=0;
1682 ball
[used_balls
].pos_y
=PAD_POS_Y
-BALL
;
1683 ball
[used_balls
].pos_x
=pad_pos_x
+(PAD_WIDTH
/2)-2;
1696 /* left line ,right line */
1697 if ((ball
[k
].pos_x
<= 0) ||
1698 (ball
[k
].pos_x
+BALL
>= LCD_WIDTH
)) {
1699 ball
[k
].x
= ball
[k
].x
*-1;
1700 ball
[k
].pos_x
= ball
[k
].pos_x
<= 0 ? 0 : LCD_WIDTH
-BALL
;
1703 if ((ball
[k
].pos_y
+BALL
>= PAD_POS_Y
&&
1704 (ball
[k
].pos_x
>= pad_pos_x
&&
1705 ball
[k
].pos_x
<= pad_pos_x
+PAD_WIDTH
)) &&
1706 start_game
!= 1 && !ball
[k
].glue
) {
1708 if ((ball
[k
].pos_x
+HALFBALL
>= pad_pos_x
&&
1709 ball
[k
].pos_x
+HALFBALL
<=
1710 pad_pos_x
+(PAD_WIDTH
/2/4)) ||
1711 (ball
[k
].pos_x
+HALFBALL
>=
1712 pad_pos_x
+(PAD_WIDTH
-(PAD_WIDTH
/2/4)) &&
1713 ball
[k
].pos_x
+HALFBALL
<= pad_pos_x
+PAD_WIDTH
)) {
1716 if (ball
[k
].pos_x
!= 0 &&
1717 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1718 ball
[k
].x
= pad_check(6,0,ball
[k
].pos_x
+2<=
1719 pad_pos_x
+(PAD_WIDTH
/2)?
1723 else if ((ball
[k
].pos_x
+HALFBALL
>=
1724 pad_pos_x
+(PAD_WIDTH
/2/4) &&
1725 ball
[k
].pos_x
+HALFBALL
<=
1726 pad_pos_x
+2*(PAD_WIDTH
/2/4)) ||
1727 (ball
[k
].pos_x
+HALFBALL
>=
1728 pad_pos_x
+(PAD_WIDTH
-2*(PAD_WIDTH
/2/4)) &&
1729 ball
[k
].pos_x
+HALFBALL
<=
1730 pad_pos_x
+(PAD_WIDTH
-(PAD_WIDTH
/2/4)) )) {
1733 if (ball
[k
].pos_x
!= 0 &&
1734 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1735 ball
[k
].x
= pad_check(4,0,ball
[k
].pos_x
+2<=
1736 pad_pos_x
+(PAD_WIDTH
/2)?
1740 else if ((ball
[k
].pos_x
+HALFBALL
>=
1741 pad_pos_x
+2*(PAD_WIDTH
/2/4) &&
1742 ball
[k
].pos_x
+HALFBALL
<=
1743 pad_pos_x
+3*(PAD_WIDTH
/2/4)) ||
1745 pad_pos_x
+(PAD_WIDTH
-3*(PAD_WIDTH
/2/4)) &&
1747 pad_pos_x
+ ((PAD_WIDTH
/2)-2*(PAD_WIDTH
/2/4)) )) {
1750 if (ball
[k
].pos_x
!= 0 &&
1751 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1752 ball
[k
].x
= pad_check(3,0,ball
[k
].pos_x
+2<=
1753 pad_pos_x
+(PAD_WIDTH
/2)?
1757 else if ((ball
[k
].pos_x
+HALFBALL
>=
1758 pad_pos_x
+3*(PAD_WIDTH
/2/4) &&
1759 ball
[k
].pos_x
+HALFBALL
<=
1760 pad_pos_x
+4*(PAD_WIDTH
/2/4)-2) ||
1761 (ball
[k
].pos_x
+2 >= pad_pos_x
+(PAD_WIDTH
/2+2) &&
1763 pad_pos_x
+(PAD_WIDTH
-3*(PAD_WIDTH
/2/4)) )) {
1766 if (ball
[k
].pos_x
!= 0 &&
1767 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1768 ball
[k
].x
= pad_check(2,1,0,k
);
1776 if (!ball
[k
].glue
) {
1777 ball
[k
].pos_x
+=ball
[k
].tempx
!=0?ball
[k
].tempx
:ball
[k
].x
;
1778 ball
[k
].pos_y
+=ball
[k
].tempy
!=0?ball
[k
].tempy
:ball
[k
].y
;
1784 if (ball
[k
].pos_y
+5 >= PAD_POS_Y
&&
1785 (pad_type
==1 && !ball
[k
].glue
) &&
1786 (ball
[k
].pos_x
>= pad_pos_x
&&
1787 ball
[k
].pos_x
<= pad_pos_x
+PAD_WIDTH
)) {
1789 ball
[k
].pos_y
=PAD_POS_Y
-BALL
;
1796 if (brick_on_board
< 0) {
1797 if (cur_level
+1<levels_num
) {
1804 rb
->lcd_getstringsize("Congratulations!", &sw
, NULL
);
1805 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_congrats
,
1806 "Congratulations!");
1807 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1808 rb
->lcd_getstringsize("No more levels", &sw
, NULL
);
1809 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_finsh
,
1812 rb
->lcd_getstringsize("You have finished the game!",
1814 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_finsh
,
1815 "You have finished the game!");
1819 if (score
>highscore
) {
1822 rb
->splash(HZ
*2, "New High Score");
1828 switch(game_menu(0)) {
1838 if (help(0)==1) return 1;
1847 int move_button
,button
;
1848 int button_right
,button_left
;
1849 button
=rb
->button_get(false);
1851 #ifdef HAS_BUTTON_HOLD
1852 if (rb
->button_hold())
1856 move_button
=rb
->button_status();
1858 button_right
=((move_button
& RIGHT
) || (SCROLL_FWD(button
)));
1859 button_left
=((move_button
& LEFT
) || (SCROLL_BACK(button
)));
1860 if ((con_game
== 1 && start_game
!=1) && (button_right
|| button_left
))
1862 if ((button_right
&& flip_sides
==false) ||
1863 (button_left
&& flip_sides
==true)) {
1864 if (pad_pos_x
+8+PAD_WIDTH
> LCD_WIDTH
) {
1865 for(k
=0;k
<used_balls
;k
++)
1866 if (start_game
==1 || ball
[k
].glue
)
1867 ball
[k
].pos_x
+=LCD_WIDTH
-pad_pos_x
-PAD_WIDTH
;
1868 pad_pos_x
+=LCD_WIDTH
-pad_pos_x
-PAD_WIDTH
;
1871 for(k
=0;k
<used_balls
;k
++)
1872 if ((start_game
==1 || ball
[k
].glue
))
1877 else if ((button_left
&& flip_sides
==false) ||
1878 (button_right
&& flip_sides
==true)) {
1879 if (pad_pos_x
-8 < 0) {
1880 for(k
=0;k
<used_balls
;k
++)
1881 if (start_game
==1 || ball
[k
].glue
)
1882 ball
[k
].pos_x
-=pad_pos_x
;
1883 pad_pos_x
-=pad_pos_x
;
1886 for(k
=0;k
<used_balls
;k
++)
1887 if (start_game
==1 || ball
[k
].glue
)
1897 if (start_game
==1 && con_game
!=1 && pad_type
!=1) {
1898 for(k
=0;k
<used_balls
;k
++) {
1900 ball
[k
].x
=pad_pos_x
+(PAD_WIDTH
/2)-2>=
1905 else if (pad_type
==1) {
1906 for(k
=0;k
<used_balls
;k
++) {
1909 else if (start_game
==1) {
1915 if (start_game
!=1 && con_game
==1) {
1919 } else if (pad_type
==2 && con_game
!=1) {
1922 fire
[tfire
].top
=PAD_POS_Y
-7;
1923 fire
[tfire
].left
=pad_pos_x
+1;
1925 fire
[tfire
].top
=PAD_POS_Y
-7;
1926 fire
[tfire
].left
=pad_pos_x
+PAD_WIDTH
-1;
1927 } else if (con_game
==1 && start_game
!=1) {
1928 for(k
=0;k
<used_balls
;k
++) {
1939 switch(game_menu(1)) {
1946 for(k
=0;k
<used_balls
;k
++)
1947 if (ball
[k
].x
!=0 && ball
[k
].y
!=0)
1959 for(k
=0;k
<used_balls
;k
++) {
1971 if(rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
1977 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1978 rb
->splash(HZ
*2, "Game Over");
1980 rb
->lcd_bitmap(brickmania_gameover
,LCD_WIDTH
/2-55,LCD_HEIGHT
-87,
1984 if (score
>highscore
) {
1987 rb
->splash(HZ
*2, "New High Score");
1992 for(k
=0;k
<used_balls
;k
++) {
1997 switch(game_menu(0)) {
2015 if (end
> *rb
->current_tick
)
2016 rb
->sleep(end
-*rb
->current_tick
);
2022 /* this is the plugin entry point */
2023 enum plugin_status
plugin_start(struct plugin_api
* api
, void* parameter
)
2028 rb
->lcd_setfont(FONT_SYSFIXED
);
2030 rb
->lcd_set_backdrop(NULL
);
2032 /* Permanently enable the backlight (unless the user has turned it off) */
2033 if (rb
->global_settings
->backlight_timeout
> 0)
2034 rb
->backlight_set_timeout(1);
2036 /* now go ahead and have fun! */
2037 while (game_loop()!=1);
2039 configfile_save(HIGH_SCORE
,config
,1,0);
2041 /* Restore user's original backlight setting */
2042 rb
->lcd_setfont(FONT_UI
);
2043 rb
->backlight_set_timeout(rb
->global_settings
->backlight_timeout
);