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 */
27 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
29 #define QUIT BUTTON_OFF
30 #define LEFT BUTTON_LEFT
31 #define RIGHT BUTTON_RIGHT
32 #define SELECT BUTTON_SELECT
34 #define DOWN BUTTON_DOWN
36 #define RC_QUIT BUTTON_RC_STOP
38 /* Only iPod have scroll events */
39 #define SCROLL_FWD(x) (0)
40 #define SCROLL_BACK(x) (0)
42 #elif CONFIG_KEYPAD == ONDIO_PAD
44 #define QUIT BUTTON_OFF
45 #define LEFT BUTTON_LEFT
46 #define RIGHT BUTTON_RIGHT
47 #define SELECT BUTTON_MENU
49 #define DOWN BUTTON_DOWN
51 /* Only iPod have scroll events */
52 #define SCROLL_FWD(x) (0)
53 #define SCROLL_BACK(x) (0)
55 #elif CONFIG_KEYPAD == RECORDER_PAD
57 #define QUIT BUTTON_OFF
58 #define LEFT BUTTON_LEFT
59 #define RIGHT BUTTON_RIGHT
60 #define SELECT BUTTON_PLAY
62 #define DOWN BUTTON_DOWN
64 /* Only iPod have scroll events */
65 #define SCROLL_FWD(x) (0)
66 #define SCROLL_BACK(x) (0)
68 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
70 #define QUIT BUTTON_OFF
71 #define LEFT BUTTON_LEFT
72 #define RIGHT BUTTON_RIGHT
73 #define SELECT BUTTON_SELECT
75 #define DOWN BUTTON_DOWN
77 /* Only iPod have scroll events */
78 #define SCROLL_FWD(x) (0)
79 #define SCROLL_BACK(x) (0)
81 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
82 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
83 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
85 #define QUIT BUTTON_MENU
86 #define LEFT BUTTON_LEFT
87 #define RIGHT BUTTON_RIGHT
88 #define SELECT BUTTON_SELECT
89 #define UP BUTTON_SCROLL_BACK
90 #define DOWN BUTTON_SCROLL_FWD
92 #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
93 #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
95 #elif (CONFIG_KEYPAD == GIGABEAT_PAD)
97 #define QUIT BUTTON_POWER
98 #define LEFT BUTTON_LEFT
99 #define RIGHT BUTTON_RIGHT
100 #define SELECT BUTTON_SELECT
102 #define DOWN BUTTON_DOWN
104 #define SCROLL_FWD(x) (0)
105 #define SCROLL_BACK(x) (0)
107 #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD /* grayscale at the moment */
109 #define QUIT BUTTON_POWER
110 #define LEFT BUTTON_LEFT
111 #define RIGHT BUTTON_RIGHT
112 #define SELECT BUTTON_PLAY
114 #define DOWN BUTTON_DOWN
116 /* Only iPod have scroll events */
117 #define SCROLL_FWD(x) (0)
118 #define SCROLL_BACK(x) (0)
120 #elif CONFIG_KEYPAD == SANSA_E200_PAD
122 #define QUIT BUTTON_POWER
123 #define LEFT BUTTON_LEFT
124 #define RIGHT BUTTON_RIGHT
125 #define SELECT BUTTON_SELECT
126 #define UP BUTTON_SCROLL_UP
127 #define DOWN BUTTON_SCROLL_DOWN
129 #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_DOWN)
130 #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_UP)
132 #elif CONFIG_KEYPAD == IRIVER_H10_PAD /* grayscale at the moment */
134 #define QUIT BUTTON_POWER
135 #define LEFT BUTTON_LEFT
136 #define RIGHT BUTTON_RIGHT
137 #define SELECT BUTTON_PLAY
138 #define UP BUTTON_SCROLL_UP
139 #define DOWN BUTTON_SCROLL_DOWN
141 /* Only iPod have scroll events */
142 #define SCROLL_FWD(x) (0)
143 #define SCROLL_BACK(x) (0)
146 #error Unsupported keypad
149 static struct plugin_api
* rb
;
163 /* External bitmaps */
164 #if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
165 extern const fb_data brickmania_menu_bg
[];
166 extern const fb_data brickmania_gameover
[];
168 extern const fb_data brickmania_menu_items
[];
169 extern const fb_data brickmania_ball
[];
170 #ifdef HAVE_LCD_COLOR
171 extern const fb_data brickmania_break
[];
174 /* normal, glue, fire */
175 extern const fb_data brickmania_pads
[];
177 /* +life, -life, glue, fire, normal */
178 extern const fb_data brickmania_powerups
[];
180 /* purple, red, blue, pink, green, yellow orange */
181 extern const fb_data brickmania_bricks
[];
183 #if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
185 /* The time (in ms) for one iteration through the game loop - decrease this
186 to speed up the game - note that current_tick is (currently) only accurate
191 #define GAMESCREEN_HEIGHT LCD_HEIGHT
195 #define PAD_POS_Y LCD_HEIGHT - 7
196 #define BRICK_HEIGHT 12
197 #define BRICK_WIDTH 32
203 #define MENU_BMPHEIGHT 20
204 #define MENU_BMPWIDTH 112
206 #define BMPHEIGHT_powerup 10
207 #define BMPWIDTH_powerup 16
209 #define BMPHEIGHT_menu LCD_HEIGHT
210 #define BMPWIDTH_menu LCD_WIDTH
212 #define BMPXOFS_start 105
213 #define BMPYOFS_start 110
214 #define BMPXOFS_resume 112
215 #define BMPYOFS_resume 132
216 #define BMPXOFS_help 142
217 #define BMPYOFS_help 150
218 #define BMPXOFS_quit 143
219 #define BMPYOFS_quit 170
220 #define HIGHSCORE_XPOS 57
221 #define HIGHSCORE_YPOS 88
223 #define STRINGPOS_finsh 140
224 #define STRINGPOS_congrats 157
225 #define STRINGPOS_navi 150
226 #define STRINGPOS_flipsides 150
228 #elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
230 /* The time (in ms) for one iteration through the game loop - decrease this
231 to speed up the game - note that current_tick is (currently) only accurate
236 /* Offsets for LCDS > 220x176 */
238 #define GAMESCREEN_HEIGHT 176
242 #define PAD_POS_Y GAMESCREEN_HEIGHT - 7
243 #define BRICK_HEIGHT 8
244 #define BRICK_WIDTH 21
247 #define LEFTMARGIN (LCD_WIDTH-220)/2 + 5
250 #define XOFS ((LCD_WIDTH-220)/BRICK_WIDTH/2)*BRICK_WIDTH
251 #define YOFS ((LCD_HEIGHT-176)/BRICK_HEIGHT/2)*BRICK_HEIGHT
253 #define MENU_BMPHEIGHT 20
254 #define MENU_BMPWIDTH 112
256 #define BMPHEIGHT_powerup 6
257 #define BMPWIDTH_powerup 10
259 #define BMPHEIGHT_menu LCD_HEIGHT
260 #define BMPWIDTH_menu LCD_WIDTH
262 #define BMPXOFS_start (55+XOFS)
263 #define BMPYOFS_start (78+YOFS)
264 #define BMPXOFS_resume (62+XOFS)
265 #define BMPYOFS_resume (100+YOFS)
266 #define BMPXOFS_help (92+XOFS)
267 #define BMPYOFS_help (118+YOFS)
268 #define BMPXOFS_quit (93+XOFS)
269 #define BMPYOFS_quit (138+YOFS)
270 #define HIGHSCORE_XPOS (7+XOFS)
271 #define HIGHSCORE_YPOS (56+YOFS)
273 #define STRINGPOS_finsh 140
274 #define STRINGPOS_congrats 157
275 #define STRINGPOS_navi 150
276 #define STRINGPOS_flipsides 150
278 #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128)
279 /* The time (in ms) for one iteration through the game loop - decrease this
280 to speed up the game - note that current_tick is (currently) only accurate
285 #define GAMESCREEN_HEIGHT LCD_HEIGHT
289 #define PAD_POS_Y LCD_HEIGHT - 7
290 #define BRICK_HEIGHT 7
291 #define BRICK_WIDTH 15
297 #define MENU_BMPHEIGHT 17
298 #define MENU_BMPWIDTH 88
300 #define BMPHEIGHT_powerup 6
301 #define BMPWIDTH_powerup 10
304 #define BMPHEIGHT_menu 128
306 #define BMPHEIGHT_menu 45
308 #define BMPWIDTH_menu 160
311 #define BMPXOFS_start 38
312 #define BMPYOFS_start 56
313 #define BMPXOFS_resume 42
314 #define BMPYOFS_resume 72
315 #define BMPXOFS_help 65
316 #define BMPYOFS_help 85
317 #define BMPXOFS_quit 66
318 #define BMPYOFS_quit 99
320 #define BMPXOFS_start 34
321 #define BMPYOFS_start 64
322 #define BMPXOFS_resume 38
323 #define BMPYOFS_resume 77
324 #define BMPXOFS_help 64
325 #define BMPYOFS_help 90
326 #define BMPXOFS_quit 64
327 #define BMPYOFS_quit 103
329 #define HIGHSCORE_XPOS 7
330 #define HIGHSCORE_YPOS 36
332 #define STRINGPOS_finsh 110
333 #define STRINGPOS_congrats 100
334 #define STRINGPOS_navi 100
335 #define STRINGPOS_flipsides 100
338 #elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
339 /* The time (in ms) for one iteration through the game loop - decrease this
340 to speed up the game - note that current_tick is (currently) only accurate
345 #define GAMESCREEN_HEIGHT LCD_HEIGHT
349 #define PAD_POS_Y LCD_HEIGHT - 5
350 #define BRICK_HEIGHT 7
351 #define BRICK_WIDTH 13
357 #define MENU_BMPHEIGHT 17
358 #define MENU_BMPWIDTH 88
360 #define BMPHEIGHT_powerup 6
361 #define BMPWIDTH_powerup 10
363 #define BMPHEIGHT_menu 45
364 #define BMPWIDTH_menu 160
366 #define BMPXOFS_start 28
367 #define BMPYOFS_start 41
368 #define BMPXOFS_resume 33
369 #define BMPYOFS_resume 58
370 #define BMPXOFS_help 56
371 #define BMPYOFS_help 74
372 #define BMPXOFS_quit 56
373 #define BMPYOFS_quit 90
374 #define HIGHSCORE_XPOS 76
375 #define HIGHSCORE_YPOS 22
377 #define STRINGPOS_finsh 54
378 #define STRINGPOS_congrats 44
379 #define STRINGPOS_navi 44
380 #define STRINGPOS_flipsides 44
383 #elif (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
384 /* The time (in ms) for one iteration through the game loop - decrease this
385 to speed up the game - note that current_tick is (currently) only accurate
390 #define GAMESCREEN_HEIGHT LCD_HEIGHT
394 #define PAD_POS_Y LCD_HEIGHT - 5
395 #define BRICK_HEIGHT 4
396 #define BRICK_WIDTH 11
402 #define MENU_BMPHEIGHT 9
403 #define MENU_BMPWIDTH 80
405 #define BMPHEIGHT_powerup 6
406 #define BMPWIDTH_powerup 7
408 #define BMPXOFS_start 12
409 #define BMPYOFS_start 20
410 #define BMPXOFS_resume 18
411 #define BMPYOFS_resume 31
412 #define BMPXOFS_help 39
413 #define BMPYOFS_help 42
414 #define BMPXOFS_quit 40
415 #define BMPYOFS_quit 53
416 #define HIGHSCORE_XPOS 0
417 #define HIGHSCORE_YPOS 0
419 #define STRINGPOS_finsh 54
420 #define STRINGPOS_congrats 44
421 #define STRINGPOS_navi 44
422 #define STRINGPOS_flipsides 44
425 #elif (LCD_WIDTH == 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH==16)
426 /* The time (in ms) for one iteration through the game loop - decrease this
427 to speed up the game - note that current_tick is (currently) only accurate
433 #if (LCD_HEIGHT == 220)
434 #define GAMESCREEN_HEIGHT 132
436 #define GAMESCREEN_HEIGHT LCD_HEIGHT
441 #define PAD_POS_Y GAMESCREEN_HEIGHT - 7
442 #define BRICK_HEIGHT 7
443 #define BRICK_WIDTH 17
449 #define MENU_BMPHEIGHT 16
450 #define MENU_BMPWIDTH 89
452 #define BMPHEIGHT_powerup 6
453 #define BMPWIDTH_powerup 10
455 #define BMPHEIGHT_menu 132
456 #define BMPWIDTH_menu 176
458 #define BMPXOFS_start 44
459 #define BMPYOFS_start 58
460 #define BMPXOFS_resume 50
461 #define BMPYOFS_resume 75
462 #define BMPXOFS_help 74
463 #define BMPYOFS_help 89
464 #define BMPXOFS_quit 75
465 #define BMPYOFS_quit 104
466 #define HIGHSCORE_XPOS 7
467 #define HIGHSCORE_YPOS 36
469 #define STRINGPOS_finsh 110
470 #define STRINGPOS_congrats 110
471 #define STRINGPOS_navi 100
472 #define STRINGPOS_flipsides 100
475 #error Unsupported LCD Size
480 static unsigned char levels
[29][8][10] = {
482 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
483 {0x2,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x2},
484 {0x0,0x2,0x1,0x0,0x0,0x0,0x0,0x1,0x2,0x0},
485 {0x0,0x0,0x2,0x1,0x0,0x0,0x1,0x2,0x0,0x0},
486 {0x0,0x0,0x0,0x2,0x1,0x1,0x2,0x0,0x0,0x0},
487 {0x7,0x0,0x0,0x7,0x2,0x2,0x7,0x0,0x0,0x7},
488 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
489 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
492 {0x0,0x0,0x7,0x7,0x1,0x1,0x7,0x7,0x0,0x0},
493 {0x0,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x0},
494 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
495 {0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1},
496 {0x1,0x1,0x2,0x1,0x0,0x0,0x1,0x2,0x1,0x1},
497 {0x1,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x2,0x1},
498 {0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x2,0x1,0x0},
499 {0x0,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x0}
502 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
503 {0x3,0x23,0x23,0x3,0x0,0x0,0x2,0x22,0x22,0x2},
504 {0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
505 {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
506 {0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
507 {0x5,0x5,0x5,0x5,0x0,0x0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,0x6,0x0,0x0},
625 {0x2,0x1,0x1,0x2,0x1,0x1,0x1,0x5,0x0,0x0},
626 {0x2,0x1,0x2,0x2,0x2,0x1,0x1,0x6,0x0,0x0},
627 {0x2,0x1,0x2,0x2,0x2,0x1,0x3,0x5,0x3,0x0},
628 {0x2,0x1,0x1,0x2,0x1,0x1,0x1,0x6,0x0,0x0},
629 {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2}
631 {/* level 16 (Rockbox) by ts-x */
632 {0x2,0x2,0x3,0x3,0x3,0x4,0x4,0x5,0x0,0x5},
633 {0x2,0x0,0x3,0x0,0x3,0x4,0x0,0x5,0x5,0x0},
634 {0x2,0x0,0x3,0x3,0x3,0x4,0x4,0x5,0x0,0x5},
635 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
636 {0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
637 {0x7,0x7,0x7,0x1,0x1,0x1,0x2,0x0,0x2,0x0},
638 {0x7,0x0,0x7,0x1,0x0,0x1,0x0,0x2,0x0,0x0},
639 {0x7,0x7,0x7,0x1,0x1,0x1,0x2,0x0,0x2,0x0}
641 {/* level 17 (Alien) by ts-x */
642 {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
643 {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2},
644 {0x1,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x1},
645 {0x2,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x2},
646 {0x1,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x1},
647 {0x2,0x0,0x0,0x1,0x2,0x2,0x1,0x0,0x0,0x2},
648 {0x2,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x2},
649 {0x2,0x2,0x1,0x0,0x1,0x1,0x0,0x1,0x2,0x2}
651 {/* level 18 (Tetris) by ts-x */
652 {0x0,0x2,0x0,0x0,0x3,0x4,0x0,0x2,0x2,0x0},
653 {0x0,0x2,0x7,0x0,0x3,0x4,0x0,0x2,0x2,0x0},
654 {0x2,0x2,0x7,0x0,0x3,0x4,0x0,0x6,0x2,0x2},
655 {0x2,0x2,0x7,0x7,0x3,0x4,0x0,0x6,0x2,0x2},
656 {0x2,0x1,0x7,0x7,0x3,0x4,0x4,0x6,0x5,0x5},
657 {0x2,0x1,0x0,0x7,0x3,0x4,0x4,0x6,0x5,0x5},
658 {0x1,0x1,0x1,0x7,0x3,0x0,0x6,0x6,0x5,0x5},
659 {0x1,0x1,0x1,0x0,0x3,0x0,0x6,0x6,0x5,0x5}
661 { /* level 19 (Stalactites) by ts-x */
662 {0x5,0x2,0x6,0x3,0x4,0x7,0x5,0x3,0x1,0x2},
663 {0x5,0x2,0x6,0x3,0x4,0x7,0x5,0x3,0x1,0x2},
664 {0x5,0x0,0x6,0x3,0x4,0x7,0x5,0x0,0x1,0x2},
665 {0x5,0x2,0x6,0x3,0x4,0x0,0x5,0x3,0x1,0x2},
666 {0x5,0x0,0x6,0x0,0x4,0x7,0x5,0x0,0x1,0x0},
667 {0x5,0x0,0x0,0x3,0x4,0x0,0x0,0x0,0x1,0x2},
668 {0x0,0x0,0x6,0x0,0x0,0x0,0x5,0x0,0x0,0x0},
669 {0x5,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x1,0x0}
671 { /* level 20 (Maze) by ts-x */
672 {0x1,0x1,0x21,0x1,0x1,0x1,0x1,0x1,0x1,0x21},
673 {0x1,0x0,0x0,0x3,0x0,0x0,0x3,0x1,0x31,0x1},
674 {0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x31,0x0,0x1},
675 {0x21,0x0,0x21,0x3,0x0,0x3,0x0,0x3,0x0,0x2},
676 {0x1,0x0,0x1,0x21,0x0,0x12,0x0,0x0,0x0,0x0},
677 {0x31,0x0,0x1,0x0,0x0,0x1,0x0,0x0,0x3,0x0},
678 {0x1,0x0,0x1,0x0,0x1,0x1,0x31,0x1,0x1,0x2},
679 {0x22,0x0,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x21}
681 { /* level 21 (Dentist) by ts-x */
682 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0},
683 {0x2,0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x2,0x2},
684 {0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x2},
685 {0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x2},
686 {0x2,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x2},
687 {0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x2},
688 {0x2,0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x2,0x2},
689 {0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}
691 { /* level 22 (Spider) by ts-x */
692 {0x31,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x31},
693 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
694 {0x33,0x1,0x1,0x36,0x1,0x1,0x36,0x1,0x1,0x33},
695 {0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
696 {0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0},
697 {0x21,0x3,0x1,0x21,0x2,0x2,0x21,0x1,0x3,0x21},
698 {0x0,0x0,0x0,0x1,0x21,0x1,0x1,0x0,0x0,0x0},
699 {0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3}
701 { /* level 23 (Pool) by ts-x */
702 {0x0,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x7,0x0},
703 {0x0,0x0,0x5,0x0,0x2,0x0,0x0,0x0,0x2,0x0},
704 {0x7,0x3,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x7},
705 {0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x5,0x0,0x7},
706 {0x7,0x0,0x4,0x0,0x0,0x3,0x0,0x0,0x0,0x7},
707 {0x7,0x0,0x0,0x6,0x0,0x0,0x0,0x0,0x4,0x7},
708 {0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
709 {0x0,0x7,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x0}
711 { /* level 24 (Vorbis Fish) by ts-x */
712 {0x0,0x0,0x4,0x4,0x5,0x5,0x5,0x0,0x0,0x5},
713 {0x0,0x4,0x6,0x4,0x4,0x5,0x5,0x5,0x0,0x5},
714 {0x5,0x6,0x0,0x6,0x4,0x4,0x4,0x5,0x5,0x5},
715 {0x5,0x6,0x0,0x6,0x4,0x4,0x4,0x4,0x5,0x5},
716 {0x0,0x5,0x6,0x4,0x4,0x5,0x5,0x4,0x5,0x0},
717 {0x5,0x5,0x4,0x4,0x5,0x5,0x5,0x4,0x5,0x5},
718 {0x5,0x4,0x4,0x4,0x5,0x5,0x4,0x4,0x5,0x5},
719 {0x0,0x0,0x4,0x4,0x4,0x4,0x4,0x5,0x0,0x5}
721 {/* level 25 (Rainbow) by ts-x */
722 {0x0,0x4,0x1,0x0,0x0,0x0,0x0,0x1,0x4,0x0},
723 {0x24,0x1,0x3,0x1,0x0,0x0,0x21,0x3,0x1,0x24},
724 {0x1,0x23,0x5,0x3,0x1,0x21,0x3,0x5,0x3,0x21},
725 {0x3,0x5,0x6,0x5,0x3,0x3,0x5,0x6,0x5,0x3},
726 {0x5,0x6,0x7,0x6,0x5,0x5,0x6,0x7,0x6,0x5},
727 {0x6,0x7,0x2,0x27,0x6,0x6,0x27,0x2,0x7,0x6},
728 {0x7,0x2,0x0,0x2,0x27,0x27,0x2,0x0,0x2,0x7},
729 {0x32,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x32}
731 { /* level 26 (Bowtie) by ts-x */
732 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5},
733 {0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1},
734 {0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5},
735 {0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1},
736 {0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1},
737 {0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5},
738 {0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1},
739 {0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}
741 { /* level 27 (Frog) by ts-x */
742 {0x0,0x5,0x25,0x0,0x0,0x0,0x0,0x25,0x5,0x0},
743 {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
744 {0x25,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x25},
745 {0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5},
746 {0x5,0x0,0x31,0x0,0x6,0x6,0x0,0x31,0x0,0x5},
747 {0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5},
748 {0x5,0x5,0x5,0x35,0x0,0x0,0x35,0x5,0x5,0x5},
749 {0x0,0x25,0x5,0x0,0x4,0x4,0x0,0x5,0x25,0x0}
751 { /* level 28 (DigDug) by ts-x */
752 {0x35,0x5,0x5,0x25,0x0,0x25,0x25,0x5,0x5,0x35},
753 {0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6},
754 {0x7,0x0,0x37,0x37,0x0,0x37,0x37,0x7,0x0,0x7},
755 {0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7},
756 {0x4,0x4,0x4,0x24,0x0,0x24,0x4,0x0,0x0,0x4},
757 {0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4},
758 {0x24,0x24,0x4,0x4,0x4,0x4,0x0,0x0,0x24,0x4},
759 {0x1,0x1,0x1,0x1,0x1,0x1,0x21,0x21,0x1,0x1}
762 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
763 {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
764 {0x22,0x0,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
765 {0x22,0x22,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
766 {0x22,0x22,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
767 {0x22,0x0,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
768 {0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
769 {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
775 int x
[MAX_BALLS
],y
[MAX_BALLS
];
777 int start_game
,con_game
;
779 int score
=0,vscore
=0;
780 bool flip_sides
=false;
782 int brick_on_board
=0;
785 typedef struct cube
{
796 typedef struct balls
{
806 balls ball
[MAX_BALLS
];
808 typedef struct sfire
{
816 #define MAX_POINTS 200000 /* i dont think it needs to be more */
817 static struct configdata config
[] =
819 {TYPE_INT
, 0, MAX_POINTS
, &highscore
, "highscore", NULL
, NULL
}
822 void int_game(int new_game
)
826 pad_pos_x
=LCD_WIDTH
/2-PAD_WIDTH
/2;
828 for(i
=0;i
<MAX_BALLS
;i
++) {
833 ball
[i
].pos_y
=PAD_POS_Y
-BALL
;
834 ball
[i
].pos_x
=pad_pos_x
+(PAD_WIDTH
/2)-2;
850 brick
[i
*10+j
].poweruse
=(levels
[cur_level
][i
][j
]==0?0:1);
854 brick
[i
*10+j
].power
=rb
->rand()%25;
855 /* +8 make the game with less powerups */
857 brick
[i
*10+j
].hits
=levels
[cur_level
][i
][j
]>=10?
858 levels
[cur_level
][i
][j
]/16-1:0;
859 brick
[i
*10+j
].hiteffect
=0;
860 brick
[i
*10+j
].powertop
=TOPMARGIN
+i
*BRICK_HEIGHT
+BRICK_HEIGHT
;
861 brick
[i
*10+j
].used
=(levels
[cur_level
][i
][j
]==0?0:1);
862 brick
[i
*10+j
].color
=(levels
[cur_level
][i
][j
]>=10?
863 levels
[cur_level
][i
][j
]%16:
864 levels
[cur_level
][i
][j
])-1;
865 if (levels
[cur_level
][i
][j
]!=0)
874 /* sleep timer counting the score */
875 void sleep (int secs
)
885 rb
->snprintf(s
, sizeof(s
), "%d", vscore
);
886 rb
->lcd_getstringsize(s
, &sw
, &w
);
887 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
888 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 0, s
);
890 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 2, s
);
892 rb
->lcd_update_rect(0,0,LCD_WIDTH
,w
+2);
895 count
=*rb
->current_tick
+HZ
*secs
;
896 if (*rb
->current_tick
>=count
)
904 #define HIGH_SCORE "brickmania.score"
905 #define MENU_LENGTH 4
906 int game_menu(int when
)
910 rb
->lcd_clear_display();
911 #if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
912 rb
->lcd_bitmap(brickmania_menu_bg
, 0, 0, BMPWIDTH_menu
, BMPHEIGHT_menu
);
915 for(i
=0;i
<MENU_LENGTH
;i
++) {
916 #ifdef HAVE_LCD_COLOR
918 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
919 MENU_BMPHEIGHT
* BM_SEL_START
, MENU_BMPWIDTH
,
920 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
923 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
924 MENU_BMPHEIGHT
* BM_START
, MENU_BMPWIDTH
,
925 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
930 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
931 MENU_BMPHEIGHT
* BM_SEL_RESUME
, MENU_BMPWIDTH
,
932 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
935 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
936 MENU_BMPHEIGHT
* BM_RESUME
, MENU_BMPWIDTH
,
937 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
941 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
942 MENU_BMPHEIGHT
* BM_NO_RESUME
, MENU_BMPWIDTH
,
943 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
949 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
950 MENU_BMPHEIGHT
* BM_SEL_HELP
, MENU_BMPWIDTH
,
951 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
954 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
955 MENU_BMPHEIGHT
* BM_HELP
, MENU_BMPWIDTH
,
956 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
960 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
961 MENU_BMPHEIGHT
* BM_SEL_QUIT
, MENU_BMPWIDTH
,
962 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
965 rb
->lcd_bitmap_transparent_part(brickmania_menu_items
, 0,
966 MENU_BMPHEIGHT
* BM_QUIT
, MENU_BMPWIDTH
,
967 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
971 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
972 MENU_BMPHEIGHT
* BM_SEL_START
, MENU_BMPWIDTH
,
973 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
976 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
977 MENU_BMPHEIGHT
* BM_START
, MENU_BMPWIDTH
,
978 BMPXOFS_start
, BMPYOFS_start
, MENU_BMPWIDTH
,
983 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
984 MENU_BMPHEIGHT
* BM_SEL_RESUME
, MENU_BMPWIDTH
,
985 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
988 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
989 MENU_BMPHEIGHT
* BM_RESUME
, MENU_BMPWIDTH
,
990 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
994 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
995 MENU_BMPHEIGHT
* BM_NO_RESUME
, MENU_BMPWIDTH
,
996 BMPXOFS_resume
, BMPYOFS_resume
, MENU_BMPWIDTH
,
1002 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1003 MENU_BMPHEIGHT
* BM_SEL_HELP
, MENU_BMPWIDTH
,
1004 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
1007 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1008 MENU_BMPHEIGHT
* BM_HELP
, MENU_BMPWIDTH
,
1009 BMPXOFS_help
, BMPYOFS_help
, MENU_BMPWIDTH
,
1013 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1014 MENU_BMPHEIGHT
* BM_SEL_QUIT
, MENU_BMPWIDTH
,
1015 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
1018 rb
->lcd_bitmap_part(brickmania_menu_items
, 0,
1019 MENU_BMPHEIGHT
* BM_QUIT
, MENU_BMPWIDTH
,
1020 BMPXOFS_quit
, BMPYOFS_quit
, MENU_BMPWIDTH
,
1024 rb
->lcd_set_drawmode(DRMODE_FG
);
1026 #ifdef HAVE_LCD_COLOR
1027 rb
->lcd_set_background(LCD_RGBPACK(0,0,140));
1028 rb
->lcd_set_foreground(LCD_WHITE
);
1030 rb
->lcd_putsxy(HIGHSCORE_XPOS
, HIGHSCORE_YPOS
, "High Score");
1031 rb
->snprintf(str
, sizeof(str
), "%d", highscore
);
1032 rb
->lcd_getstringsize("High Score", &sw
, NULL
);
1033 rb
->lcd_getstringsize(str
, &w
, NULL
);
1034 rb
->lcd_putsxy(HIGHSCORE_XPOS
+sw
/2-w
/2, HIGHSCORE_YPOS
+9, str
);
1035 rb
->lcd_set_drawmode(DRMODE_SOLID
);
1039 button
= rb
->button_get(true);
1042 case UP
| BUTTON_REPEAT
:
1044 cur
= MENU_LENGTH
-1;
1047 if (when
==0 && cur
==1) {
1053 case DOWN
| BUTTON_REPEAT
:
1054 if (cur
==MENU_LENGTH
-1)
1058 if (when
==0 && cur
==1) {
1069 } else if (cur
==1 && when
==1) {
1071 } else if (cur
==2) {
1073 } else if (cur
==3) {
1085 if(rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
1098 /* set the maximum x and y in the helpscreen
1099 dont forget to update, if you change text */
1104 #ifdef HAVE_LCD_COLOR
1105 rb
->lcd_set_background(LCD_BLACK
);
1106 rb
->lcd_clear_display();
1107 rb
->lcd_set_background(LCD_BLACK
);
1108 rb
->lcd_set_foreground(LCD_WHITE
);
1110 rb
->lcd_clear_display();
1113 rb
->lcd_getstringsize("BrickMania", &w
, &h
);
1114 rb
->lcd_putsxy(LCD_WIDTH
/2-w
/2+xoffset
, 1+yoffset
, "BrickMania");
1116 #ifdef HAVE_LCD_COLOR
1117 rb
->lcd_set_foreground(LCD_RGBPACK(245,0,0));
1118 rb
->lcd_putsxy(1+xoffset
, 1*(h
+2)+yoffset
,"Aim");
1119 rb
->lcd_set_foreground(LCD_WHITE
);
1121 rb
->lcd_putsxy(1+xoffset
, 1*(h
+2)+yoffset
,"Aim");
1123 rb
->lcd_putsxy(1+xoffset
, 2*(h
+2)+yoffset
,
1124 "destroy all the bricks by bouncing");
1125 rb
->lcd_putsxy(1+xoffset
, 3*(h
+2)+yoffset
,
1126 "the ball of them using the paddle.");
1127 #ifdef HAVE_LCD_COLOR
1128 rb
->lcd_set_foreground(LCD_RGBPACK(245,0,0));
1129 rb
->lcd_putsxy(1+xoffset
, 5*(h
+2)+yoffset
,"Controls");
1130 rb
->lcd_set_foreground(LCD_WHITE
);
1132 rb
->lcd_putsxy(1+xoffset
, 5*(h
+2)+yoffset
,"Controls");
1134 rb
->lcd_putsxy(1+xoffset
, 6*(h
+2)+yoffset
,"< & > Move the paddle");
1135 #if CONFIG_KEYPAD == ONDIO_PAD
1136 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1137 "MENU Releases the ball/Fire!");
1138 #elif CONFIG_KEYPAD == RECORDER_PAD
1139 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1140 "PLAY Releases the ball/Fire!");
1141 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
1142 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1143 "NAVI Releases the ball/Fire!");
1145 rb
->lcd_putsxy(1+xoffset
, 7*(h
+2)+yoffset
,
1146 "SELECT Releases the ball/Fire!");
1148 rb
->lcd_putsxy(1+xoffset
, 8*(h
+2)+yoffset
, "STOP Opens menu/Quit");
1149 #ifdef HAVE_LCD_COLOR
1150 rb
->lcd_set_foreground(LCD_RGBPACK(245,0,0));
1151 rb
->lcd_putsxy(1+xoffset
, 10*(h
+2)+yoffset
, "Specials");
1152 rb
->lcd_set_foreground(LCD_WHITE
);
1154 rb
->lcd_putsxy(1+xoffset
, 10*(h
+2)+yoffset
, "Specials");
1156 rb
->lcd_putsxy(1+xoffset
, 11*(h
+2)+yoffset
,
1157 "N Normal:returns paddle to normal");
1158 rb
->lcd_putsxy(1+xoffset
, 12*(h
+2)+yoffset
, "D DIE!:loses a life");
1159 rb
->lcd_putsxy(1+xoffset
, 13*(h
+2)+yoffset
,
1160 "L Life:gains a life/power up");
1161 rb
->lcd_putsxy(1+xoffset
, 14*(h
+2)+yoffset
,
1162 "F Fire:allows you to shoot bricks");
1163 rb
->lcd_putsxy(1+xoffset
, 15*(h
+2)+yoffset
,
1164 "G Glue:ball sticks to paddle");
1165 rb
->lcd_putsxy(1+xoffset
, 16*(h
+2)+yoffset
,
1166 "B Ball:generates another ball");
1167 rb
->lcd_putsxy(1+xoffset
, 17*(h
+2)+yoffset
,
1168 "FL Flip:flips left / right movement");
1171 button
=rb
->button_get(true);
1177 switch (game_menu(when
)) {
1197 case LEFT
| BUTTON_REPEAT
:
1202 case RIGHT
| BUTTON_REPEAT
:
1203 if(xoffset
+maxX
> LCD_WIDTH
)
1207 case UP
| BUTTON_REPEAT
:
1212 case DOWN
| BUTTON_REPEAT
:
1213 if(yoffset
+maxY
> LCD_HEIGHT
)
1218 if(rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
1226 int pad_check(int ballxc
, int mode
, int pon
,int ballnum
)
1228 /* pon: positive(1) or negative(0) */
1236 if (ball
[ballnum
].x
> 0)
1243 int fire_space(void)
1247 if (fire
[t
].top
+7 < 0)
1255 int j
,i
,k
,bricky
,brickx
;
1257 int sec_count
=0,num_count
=10;
1260 rb
->srand( *rb
->current_tick
);
1262 configfile_init(rb
);
1263 configfile_load(HIGH_SCORE
,config
,1,0);
1265 switch(game_menu(0)) {
1275 if (help(0) == 1) return 1;
1283 /* Convert CYCLETIME (in ms) to HZ */
1284 end
= *rb
->current_tick
+ (CYCLETIME
* HZ
) / 1000;
1287 #ifdef HAVE_LCD_COLOR
1288 rb
->lcd_set_background(LCD_BLACK
);
1289 rb
->lcd_set_drawmode(DRMODE_SOLID
);
1290 rb
->lcd_clear_display();
1291 rb
->lcd_set_background(LCD_BLACK
);
1292 #if LCD_HEIGHT > GAMESCREEN_HEIGHT
1293 rb
->lcd_set_foreground(rb
->global_settings
->bg_color
);
1294 rb
->lcd_fillrect(0, GAMESCREEN_HEIGHT
, LCD_WIDTH
,
1295 LCD_HEIGHT
- GAMESCREEN_HEIGHT
);
1297 rb
->lcd_set_foreground(LCD_WHITE
);
1299 rb
->lcd_clear_display();
1303 if (*rb
->current_tick
>=sec_count
) {
1304 sec_count
=*rb
->current_tick
+HZ
;
1310 rb
->snprintf(s
, sizeof(s
), "%d", num_count
);
1311 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1312 rb
->lcd_putsxy(LCD_WIDTH
/2-2, STRINGPOS_flipsides
, s
);
1315 /* write life num */
1316 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1317 rb
->snprintf(s
, sizeof(s
), "L:%d", life
);
1318 rb
->lcd_putsxy(0, 0, s
);
1320 rb
->snprintf(s
, sizeof(s
), "Life: %d", life
);
1321 rb
->lcd_putsxy(2, 2, s
);
1324 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1325 rb
->snprintf(s
, sizeof(s
), "L%d", cur_level
+1);
1326 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1327 rb
->lcd_putsxy(LCD_WIDTH
-sw
, 0, s
);
1329 rb
->snprintf(s
, sizeof(s
), "Level %d", cur_level
+1);
1330 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1331 rb
->lcd_putsxy(LCD_WIDTH
-sw
-2, 2, s
);
1334 if (vscore
<score
) vscore
++;
1335 rb
->snprintf(s
, sizeof(s
), "%d", vscore
);
1336 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1337 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1338 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 0, s
);
1340 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, 2, s
);
1344 if (con_game
== 1 && start_game
!=1) {
1345 #if CONFIG_KEYPAD == ONDIO_PAD
1346 rb
->snprintf(s
, sizeof(s
), "MENU To Continue");
1347 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
1348 rb
->snprintf(s
, sizeof(s
), "Press NAVI To Continue");
1350 rb
->snprintf(s
, sizeof(s
), "Press SELECT To Continue");
1352 rb
->lcd_getstringsize(s
, &sw
, NULL
);
1353 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_navi
, s
);
1355 sec_count
=*rb
->current_tick
+HZ
;
1359 for(i
=0;i
<used_balls
;i
++)
1360 rb
->lcd_bitmap(brickmania_ball
,ball
[i
].pos_x
, ball
[i
].pos_y
,
1363 if (brick_on_board
==0)
1366 /* if the pad is fire */
1367 for(i
=0;i
<=30;i
++) {
1368 if (fire
[i
].top
+7>0) {
1371 rb
->lcd_vline(fire
[i
].left
, fire
[i
].top
, fire
[i
].top
+7);
1376 for (i
=0;i
<=7;i
++) {
1377 for (j
=0;j
<=9;j
++) {
1378 if (brick
[i
*10+j
].power
<7) {
1379 if (brick
[i
*10+j
].poweruse
==2) {
1381 brick
[i
*10+j
].powertop
+=2;
1382 rb
->lcd_bitmap_part(brickmania_powerups
,0,
1383 BMPHEIGHT_powerup
*brick
[i
*10+j
1386 LEFTMARGIN
+j
*BRICK_WIDTH
+
1388 BMPWIDTH_powerup
/2),
1389 brick
[i
*10+j
].powertop
,
1395 if ((pad_pos_x
<LEFTMARGIN
+j
*BRICK_WIDTH
+5 &&
1396 pad_pos_x
+PAD_WIDTH
>LEFTMARGIN
+j
*BRICK_WIDTH
+5) &&
1397 brick
[i
*10+j
].powertop
+6>=PAD_POS_Y
&&
1398 brick
[i
*10+j
].poweruse
==2) {
1399 switch(brick
[i
*10+j
].power
) {
1418 for(k
=0;k
<used_balls
;k
++)
1424 for(k
=0;k
<used_balls
;k
++)
1430 sec_count
=*rb
->current_tick
+HZ
;
1432 flip_sides
=!flip_sides
;
1437 ball
[used_balls
-1].x
= rb
->rand()%1 == 0 ?
1439 ball
[used_balls
-1].y
= -4;
1442 brick
[i
*10+j
].poweruse
=1;
1445 if (brick
[i
*10+j
].powertop
>PAD_POS_Y
)
1446 brick
[i
*10+j
].poweruse
=1;
1448 brickx
=LEFTMARGIN
+j
*BRICK_WIDTH
;
1449 bricky
=TOPMARGIN
+i
*BRICK_HEIGHT
;
1451 for (k
=0;k
<=30;k
++) {
1452 if (fire
[k
].top
+7>0) {
1453 if (brick
[i
*10+j
].used
==1 &&
1454 (fire
[k
].left
+1 >= brickx
&&
1455 fire
[k
].left
+1 <= brickx
+BRICK_WIDTH
) &&
1456 (bricky
+BRICK_HEIGHT
>fire
[k
].top
)) {
1459 if (brick
[i
*10+j
].hits
> 0) {
1460 brick
[i
*10+j
].hits
--;
1461 brick
[i
*10+j
].hiteffect
++;
1465 brick
[i
*10+j
].used
=0;
1466 if (brick
[i
*10+j
].power
!=10)
1467 brick
[i
*10+j
].poweruse
=2;
1475 if (brick
[i
*10+j
].used
==1) {
1476 rb
->lcd_bitmap_part(brickmania_bricks
,0,
1477 BRICK_HEIGHT
*brick
[i
*10+j
].color
,
1479 LEFTMARGIN
+j
*BRICK_WIDTH
,
1480 TOPMARGIN
+i
*BRICK_HEIGHT
,
1481 BRICK_WIDTH
, BRICK_HEIGHT
);
1482 #ifdef HAVE_LCD_COLOR /* No transparent effect for greyscale lcds for now */
1483 if (brick
[i
*10+j
].hiteffect
>0)
1484 rb
->lcd_bitmap_transparent_part(brickmania_break
,
1486 BRICK_HEIGHT
*brick
[i
*10+j
].hiteffect
,
1488 LEFTMARGIN
+j
*BRICK_WIDTH
,
1489 TOPMARGIN
+i
*BRICK_HEIGHT
,
1495 for(k
=0;k
<used_balls
;k
++) {
1496 if (ball
[k
].pos_y
<160) {
1497 if (brick
[i
*10+j
].used
==1) {
1498 if ((ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
>=
1500 ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
<=
1501 brickx
+BRICK_WIDTH
) &&
1502 ((bricky
-4<ball
[k
].pos_y
+BALL
&&
1503 bricky
>ball
[k
].pos_y
+BALL
) ||
1504 (bricky
+4>ball
[k
].pos_y
+BALL
+BALL
&&
1505 bricky
<ball
[k
].pos_y
+BALL
+BALL
)) &&
1507 ball
[k
].tempy
=bricky
-ball
[k
].pos_y
-BALL
;
1509 else if ((ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
>=
1511 ball
[k
].pos_x
+ball
[k
].x
+HALFBALL
<=
1512 brickx
+BRICK_WIDTH
) &&
1513 ((bricky
+BRICK_HEIGHT
+4>ball
[k
].pos_y
&&
1514 bricky
+BRICK_HEIGHT
<ball
[k
].pos_y
) ||
1515 (bricky
+BRICK_HEIGHT
-4<ball
[k
].pos_y
-BALL
&&
1516 bricky
+BRICK_HEIGHT
>ball
[k
].pos_y
-BALL
)) &&
1519 -(ball
[k
].pos_y
-(bricky
+BRICK_HEIGHT
));
1522 if ((ball
[k
].pos_y
+HALFBALL
>=
1524 ball
[k
].pos_y
+HALFBALL
<=
1525 bricky
+BRICK_HEIGHT
) &&
1526 ((brickx
-4<ball
[k
].pos_x
+BALL
&&
1527 brickx
>ball
[k
].pos_x
+BALL
) ||
1528 (brickx
+4>ball
[k
].pos_x
+BALL
+BALL
&&
1529 brickx
<ball
[k
].pos_x
+BALL
+BALL
)) &&
1531 ball
[k
].tempx
=brickx
-ball
[k
].pos_x
-BALL
;
1533 else if ((ball
[k
].pos_y
+ball
[k
].y
+HALFBALL
>=
1535 ball
[k
].pos_y
+ball
[k
].y
+HALFBALL
<=
1536 bricky
+BRICK_HEIGHT
) &&
1537 ((brickx
+BRICK_WIDTH
+4>ball
[k
].pos_x
&&
1538 brickx
+BRICK_WIDTH
<ball
[k
].pos_x
) ||
1539 (brickx
+BRICK_WIDTH
-4<ball
[k
].pos_x
-
1541 brickx
+BRICK_WIDTH
>ball
[k
].pos_x
-
1542 BALL
)) && (ball
[k
].x
<0)) {
1544 -(ball
[k
].pos_x
-(brickx
+BRICK_WIDTH
));
1547 if ((ball
[k
].pos_x
+HALFBALL
>= brickx
&&
1548 ball
[k
].pos_x
+HALFBALL
<=
1549 brickx
+BRICK_WIDTH
) &&
1550 ((bricky
+BRICK_HEIGHT
==ball
[k
].pos_y
) ||
1551 (bricky
+BRICK_HEIGHT
-6<=ball
[k
].pos_y
&&
1552 bricky
+BRICK_HEIGHT
>ball
[k
].pos_y
)) &&
1553 (ball
[k
].y
<0)) { /* bottom line */
1554 if (brick
[i
*10+j
].hits
> 0) {
1555 brick
[i
*10+j
].hits
--;
1556 brick
[i
*10+j
].hiteffect
++;
1560 brick
[i
*10+j
].used
=0;
1561 if (brick
[i
*10+j
].power
!=10)
1562 brick
[i
*10+j
].poweruse
=2;
1565 ball
[k
].y
= ball
[k
].y
*-1;
1567 else if ((ball
[k
].pos_x
+HALFBALL
>= brickx
&&
1568 ball
[k
].pos_x
+HALFBALL
<=
1569 brickx
+BRICK_WIDTH
) &&
1570 ((bricky
==ball
[k
].pos_y
+BALL
) ||
1571 (bricky
+6>=ball
[k
].pos_y
+BALL
&&
1572 bricky
<ball
[k
].pos_y
+BALL
)) &&
1573 (ball
[k
].y
>0)) { /* top line */
1574 if (brick
[i
*10+j
].hits
> 0) {
1575 brick
[i
*10+j
].hits
--;
1576 brick
[i
*10+j
].hiteffect
++;
1580 brick
[i
*10+j
].used
=0;
1581 if (brick
[i
*10+j
].power
!=10)
1582 brick
[i
*10+j
].poweruse
=2;
1585 ball
[k
].y
= ball
[k
].y
*-1;
1588 if ((ball
[k
].pos_y
+HALFBALL
>= bricky
&&
1589 ball
[k
].pos_y
+HALFBALL
<=
1590 bricky
+BRICK_HEIGHT
) &&
1591 ((brickx
==ball
[k
].pos_x
+BALL
) ||
1592 (brickx
+6>=ball
[k
].pos_x
+BALL
&&
1593 brickx
<ball
[k
].pos_x
+BALL
)) &&
1594 (ball
[k
].x
> 0)) { /* left line */
1595 if (brick
[i
*10+j
].hits
> 0) {
1596 brick
[i
*10+j
].hits
--;
1597 brick
[i
*10+j
].hiteffect
++;
1601 brick
[i
*10+j
].used
=0;
1602 if (brick
[i
*10+j
].power
!=10)
1603 brick
[i
*10+j
].poweruse
=2;
1605 ball
[k
].x
= ball
[k
].x
*-1;
1608 else if ((ball
[k
].pos_y
+HALFBALL
>= bricky
&&
1609 ball
[k
].pos_y
+HALFBALL
<=
1610 bricky
+BRICK_HEIGHT
) &&
1611 ((brickx
+BRICK_WIDTH
==
1613 (brickx
+BRICK_WIDTH
-6<=
1617 (ball
[k
].x
< 0)) { /* Right line */
1618 if (brick
[i
*10+j
].hits
> 0) {
1619 brick
[i
*10+j
].hits
--;
1620 brick
[i
*10+j
].hiteffect
++;
1624 brick
[i
*10+j
].used
=0;
1625 if (brick
[i
*10+j
].power
!=10)
1626 brick
[i
*10+j
].poweruse
=2;
1629 ball
[k
].x
= ball
[k
].x
*-1;
1632 if (brick
[i
*10+j
].used
==0) {
1643 rb
->lcd_bitmap_part(brickmania_pads
,0,pad_type
*PAD_HEIGHT
,
1644 PAD_WIDTH
,pad_pos_x
, PAD_POS_Y
, PAD_WIDTH
,
1647 for(k
=0;k
<used_balls
;k
++) {
1649 if ((ball
[k
].pos_x
>= pad_pos_x
&&
1650 ball
[k
].pos_x
<= pad_pos_x
+PAD_WIDTH
) &&
1651 (PAD_POS_Y
-4<ball
[k
].pos_y
+BALL
&&
1652 PAD_POS_Y
>ball
[k
].pos_y
+BALL
) && (ball
[k
].y
>0))
1653 ball
[k
].tempy
=PAD_POS_Y
-ball
[k
].pos_y
-BALL
;
1654 else if ((4>ball
[k
].pos_y
&& 0<ball
[k
].pos_y
) &&
1656 ball
[k
].tempy
=-ball
[k
].pos_y
;
1657 if ((LCD_WIDTH
-4<ball
[k
].pos_x
+BALL
&&
1658 LCD_WIDTH
>ball
[k
].pos_x
+BALL
) && (ball
[k
].x
>0))
1659 ball
[k
].tempx
=LCD_WIDTH
-ball
[k
].pos_x
-BALL
;
1660 else if ((4>ball
[k
].pos_x
&& 0<ball
[k
].pos_x
) &&
1662 ball
[k
].tempx
=-ball
[k
].pos_x
;
1665 if (ball
[k
].pos_y
<= 0)
1666 ball
[k
].y
= ball
[k
].y
*-1;
1668 else if (ball
[k
].pos_y
+BALL
>= GAMESCREEN_HEIGHT
) {
1671 ball
[k
].pos_x
= ball
[used_balls
].pos_x
;
1672 ball
[k
].pos_y
= ball
[used_balls
].pos_y
;
1673 ball
[k
].y
= ball
[used_balls
].y
;
1674 ball
[k
].tempy
= ball
[used_balls
].tempy
;
1675 ball
[k
].x
= ball
[used_balls
].x
;
1676 ball
[k
].tempx
= ball
[used_balls
].tempx
;
1677 ball
[k
].glue
= ball
[used_balls
].glue
;
1679 ball
[used_balls
].x
=0;
1680 ball
[used_balls
].y
=0;
1681 ball
[used_balls
].tempy
=0;
1682 ball
[used_balls
].tempx
=0;
1683 ball
[used_balls
].pos_y
=PAD_POS_Y
-BALL
;
1684 ball
[used_balls
].pos_x
=pad_pos_x
+(PAD_WIDTH
/2)-2;
1697 /* left line ,right line */
1698 if ((ball
[k
].pos_x
<= 0) ||
1699 (ball
[k
].pos_x
+BALL
>= LCD_WIDTH
)) {
1700 ball
[k
].x
= ball
[k
].x
*-1;
1701 ball
[k
].pos_x
= ball
[k
].pos_x
<= 0 ? 0 : LCD_WIDTH
-BALL
;
1704 if ((ball
[k
].pos_y
+BALL
>= PAD_POS_Y
&&
1705 (ball
[k
].pos_x
>= pad_pos_x
&&
1706 ball
[k
].pos_x
<= pad_pos_x
+PAD_WIDTH
)) &&
1707 start_game
!= 1 && !ball
[k
].glue
) {
1709 if ((ball
[k
].pos_x
+HALFBALL
>= pad_pos_x
&&
1710 ball
[k
].pos_x
+HALFBALL
<=
1711 pad_pos_x
+(PAD_WIDTH
/2/4)) ||
1712 (ball
[k
].pos_x
+HALFBALL
>=
1713 pad_pos_x
+(PAD_WIDTH
-(PAD_WIDTH
/2/4)) &&
1714 ball
[k
].pos_x
+HALFBALL
<= pad_pos_x
+PAD_WIDTH
)) {
1717 if (ball
[k
].pos_x
!= 0 &&
1718 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1719 ball
[k
].x
= pad_check(6,0,ball
[k
].pos_x
+2<=
1720 pad_pos_x
+(PAD_WIDTH
/2)?
1724 else if ((ball
[k
].pos_x
+HALFBALL
>=
1725 pad_pos_x
+(PAD_WIDTH
/2/4) &&
1726 ball
[k
].pos_x
+HALFBALL
<=
1727 pad_pos_x
+2*(PAD_WIDTH
/2/4)) ||
1728 (ball
[k
].pos_x
+HALFBALL
>=
1729 pad_pos_x
+(PAD_WIDTH
-2*(PAD_WIDTH
/2/4)) &&
1730 ball
[k
].pos_x
+HALFBALL
<=
1731 pad_pos_x
+(PAD_WIDTH
-(PAD_WIDTH
/2/4)) )) {
1734 if (ball
[k
].pos_x
!= 0 &&
1735 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1736 ball
[k
].x
= pad_check(4,0,ball
[k
].pos_x
+2<=
1737 pad_pos_x
+(PAD_WIDTH
/2)?
1741 else if ((ball
[k
].pos_x
+HALFBALL
>=
1742 pad_pos_x
+2*(PAD_WIDTH
/2/4) &&
1743 ball
[k
].pos_x
+HALFBALL
<=
1744 pad_pos_x
+3*(PAD_WIDTH
/2/4)) ||
1746 pad_pos_x
+(PAD_WIDTH
-3*(PAD_WIDTH
/2/4)) &&
1748 pad_pos_x
+ ((PAD_WIDTH
/2)-2*(PAD_WIDTH
/2/4)) )) {
1751 if (ball
[k
].pos_x
!= 0 &&
1752 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1753 ball
[k
].x
= pad_check(3,0,ball
[k
].pos_x
+2<=
1754 pad_pos_x
+(PAD_WIDTH
/2)?
1758 else if ((ball
[k
].pos_x
+HALFBALL
>=
1759 pad_pos_x
+3*(PAD_WIDTH
/2/4) &&
1760 ball
[k
].pos_x
+HALFBALL
<=
1761 pad_pos_x
+4*(PAD_WIDTH
/2/4)-2) ||
1762 (ball
[k
].pos_x
+2 >= pad_pos_x
+(PAD_WIDTH
/2+2) &&
1764 pad_pos_x
+(PAD_WIDTH
-3*(PAD_WIDTH
/2/4)) )) {
1767 if (ball
[k
].pos_x
!= 0 &&
1768 ball
[k
].pos_x
+BALL
!=LCD_WIDTH
)
1769 ball
[k
].x
= pad_check(2,1,0,k
);
1777 if (!ball
[k
].glue
) {
1778 ball
[k
].pos_x
+=ball
[k
].tempx
!=0?ball
[k
].tempx
:ball
[k
].x
;
1779 ball
[k
].pos_y
+=ball
[k
].tempy
!=0?ball
[k
].tempy
:ball
[k
].y
;
1785 if (ball
[k
].pos_y
+5 >= PAD_POS_Y
&&
1786 (pad_type
==1 && !ball
[k
].glue
) &&
1787 (ball
[k
].pos_x
>= pad_pos_x
&&
1788 ball
[k
].pos_x
<= pad_pos_x
+PAD_WIDTH
)) {
1790 ball
[k
].pos_y
=PAD_POS_Y
-BALL
;
1797 if (brick_on_board
< 0) {
1798 if (cur_level
+1<levels_num
) {
1805 rb
->lcd_getstringsize("Congratulations!", &sw
, NULL
);
1806 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_congrats
,
1807 "Congratulations!");
1808 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1809 rb
->lcd_getstringsize("No more levels", &sw
, NULL
);
1810 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_finsh
,
1813 rb
->lcd_getstringsize("You have finished the game!",
1815 rb
->lcd_putsxy(LCD_WIDTH
/2-sw
/2, STRINGPOS_finsh
,
1816 "You have finished the game!");
1820 if (score
>highscore
) {
1823 rb
->splash(HZ
*2, "New High Score");
1829 switch(game_menu(0)) {
1839 if (help(0)==1) return 1;
1848 int move_button
,button
;
1849 int button_right
,button_left
;
1850 button
=rb
->button_get(false);
1852 #ifdef HAS_BUTTON_HOLD
1853 if (rb
->button_hold())
1857 move_button
=rb
->button_status();
1859 button_right
=((move_button
& RIGHT
) || (SCROLL_FWD(button
)));
1860 button_left
=((move_button
& LEFT
) || (SCROLL_BACK(button
)));
1861 if ((con_game
== 1 && start_game
!=1) && (button_right
|| button_left
))
1863 if ((button_right
&& flip_sides
==false) ||
1864 (button_left
&& flip_sides
==true)) {
1865 if (pad_pos_x
+8+PAD_WIDTH
> LCD_WIDTH
) {
1866 for(k
=0;k
<used_balls
;k
++)
1867 if (start_game
==1 || ball
[k
].glue
)
1868 ball
[k
].pos_x
+=LCD_WIDTH
-pad_pos_x
-PAD_WIDTH
;
1869 pad_pos_x
+=LCD_WIDTH
-pad_pos_x
-PAD_WIDTH
;
1872 for(k
=0;k
<used_balls
;k
++)
1873 if ((start_game
==1 || ball
[k
].glue
))
1878 else if ((button_left
&& flip_sides
==false) ||
1879 (button_right
&& flip_sides
==true)) {
1880 if (pad_pos_x
-8 < 0) {
1881 for(k
=0;k
<used_balls
;k
++)
1882 if (start_game
==1 || ball
[k
].glue
)
1883 ball
[k
].pos_x
-=pad_pos_x
;
1884 pad_pos_x
-=pad_pos_x
;
1887 for(k
=0;k
<used_balls
;k
++)
1888 if (start_game
==1 || ball
[k
].glue
)
1898 if (start_game
==1 && con_game
!=1 && pad_type
!=1) {
1899 for(k
=0;k
<used_balls
;k
++) {
1901 ball
[k
].x
=pad_pos_x
+(PAD_WIDTH
/2)-2>=
1906 else if (pad_type
==1) {
1907 for(k
=0;k
<used_balls
;k
++) {
1910 else if (start_game
==1) {
1916 if (start_game
!=1 && con_game
==1) {
1920 } else if (pad_type
==2 && con_game
!=1) {
1923 fire
[tfire
].top
=PAD_POS_Y
-7;
1924 fire
[tfire
].left
=pad_pos_x
+1;
1926 fire
[tfire
].top
=PAD_POS_Y
-7;
1927 fire
[tfire
].left
=pad_pos_x
+PAD_WIDTH
-1;
1928 } else if (con_game
==1 && start_game
!=1) {
1929 for(k
=0;k
<used_balls
;k
++) {
1940 switch(game_menu(1)) {
1947 for(k
=0;k
<used_balls
;k
++)
1948 if (ball
[k
].x
!=0 && ball
[k
].y
!=0)
1960 for(k
=0;k
<used_balls
;k
++) {
1972 if(rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
1978 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1979 rb
->splash(HZ
*2, "Game Over");
1981 rb
->lcd_bitmap(brickmania_gameover
,LCD_WIDTH
/2-55,LCD_HEIGHT
-87,
1985 if (score
>highscore
) {
1988 rb
->splash(HZ
*2, "New High Score");
1993 for(k
=0;k
<used_balls
;k
++) {
1998 switch(game_menu(0)) {
2016 if (end
> *rb
->current_tick
)
2017 rb
->sleep(end
-*rb
->current_tick
);
2023 /* this is the plugin entry point */
2024 enum plugin_status
plugin_start(struct plugin_api
* api
, void* parameter
)
2029 rb
->lcd_setfont(FONT_SYSFIXED
);
2031 rb
->lcd_set_backdrop(NULL
);
2033 /* Turn off backlight timeout */
2034 backlight_force_on(rb
); /* backlight control in lib/helper.c */
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 /* Turn on backlight timeout (revert to settings) */
2044 backlight_use_settings(rb
); /* backlight control in lib/helper.c */