summaryrefslogtreecommitdiff
path: root/apps/plugins/brickmania.c
diff options
context:
space:
mode:
authorMarianne Arnold <pixelma@rockbox.org>2007-12-30 14:56:51 +0000
committerMarianne Arnold <pixelma@rockbox.org>2007-12-30 14:56:51 +0000
commit2e5f8f5c0655bd1d8c2acf759898637902fc29d5 (patch)
tree9d6d230326a33c81deb9a060a1bb069011b51e90 /apps/plugins/brickmania.c
parent282c9d6e1b17f6d586d93a96eea9cb805d69d3b1 (diff)
downloadrockbox-2e5f8f5c0655bd1d8c2acf759898637902fc29d5.tar.gz
rockbox-2e5f8f5c0655bd1d8c2acf759898637902fc29d5.zip
Brickmania for Sansa c200 and the small H10 with new graphics. While at it reduce the number of necessary per screen definition by letting the plugin retrieve the bitmap heights and widths from the file, therefore 'clean up' some graphics e.g. the menu items one, also make some backgrounds a bit nicer. Rearrange bitmaps/native/SOURCES and rename some graphics to reduce the number of duplicated bitmaps which only had a different name e.g. the ball - and tweak the gameover bitmap (on colour displays it uses transparency, and adapt the already existing mono bitmap to be usable). There might be minor differences in the 'looks' for existing ports but almost not noticeable with the exception that the gameover graphic is now centered. Introduce an alternative left and right key for c200 (volume up/down) for easier control. Manual update will follow.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15981 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/brickmania.c')
-rw-r--r--apps/plugins/brickmania.c523
1 files changed, 228 insertions, 295 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index d4b774a93d..f03b227426 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -35,9 +35,6 @@ PLUGIN_HEADER
35 35
36#define RC_QUIT BUTTON_RC_STOP 36#define RC_QUIT BUTTON_RC_STOP
37 37
38/* Only iPod have scroll events */
39#define SCROLL_FWD(x) (0)
40#define SCROLL_BACK(x) (0)
41 38
42#elif CONFIG_KEYPAD == ONDIO_PAD 39#elif CONFIG_KEYPAD == ONDIO_PAD
43 40
@@ -48,9 +45,6 @@ PLUGIN_HEADER
48#define UP BUTTON_UP 45#define UP BUTTON_UP
49#define DOWN BUTTON_DOWN 46#define DOWN BUTTON_DOWN
50 47
51/* Only iPod have scroll events */
52#define SCROLL_FWD(x) (0)
53#define SCROLL_BACK(x) (0)
54 48
55#elif CONFIG_KEYPAD == RECORDER_PAD 49#elif CONFIG_KEYPAD == RECORDER_PAD
56 50
@@ -61,9 +55,6 @@ PLUGIN_HEADER
61#define UP BUTTON_UP 55#define UP BUTTON_UP
62#define DOWN BUTTON_DOWN 56#define DOWN BUTTON_DOWN
63 57
64/* Only iPod have scroll events */
65#define SCROLL_FWD(x) (0)
66#define SCROLL_BACK(x) (0)
67 58
68#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD 59#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
69 60
@@ -74,9 +65,6 @@ PLUGIN_HEADER
74#define UP BUTTON_UP 65#define UP BUTTON_UP
75#define DOWN BUTTON_DOWN 66#define DOWN BUTTON_DOWN
76 67
77/* Only iPod have scroll events */
78#define SCROLL_FWD(x) (0)
79#define SCROLL_BACK(x) (0)
80 68
81#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ 69#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
82 (CONFIG_KEYPAD == IPOD_3G_PAD) || \ 70 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
@@ -92,6 +80,7 @@ PLUGIN_HEADER
92#define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD) 80#define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
93#define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK) 81#define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
94 82
83
95#elif (CONFIG_KEYPAD == GIGABEAT_PAD) 84#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
96 85
97#define QUIT BUTTON_POWER 86#define QUIT BUTTON_POWER
@@ -101,10 +90,8 @@ PLUGIN_HEADER
101#define UP BUTTON_UP 90#define UP BUTTON_UP
102#define DOWN BUTTON_DOWN 91#define DOWN BUTTON_DOWN
103 92
104#define SCROLL_FWD(x) (0)
105#define SCROLL_BACK(x) (0)
106 93
107#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD /* grayscale at the moment */ 94#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
108 95
109#define QUIT BUTTON_POWER 96#define QUIT BUTTON_POWER
110#define LEFT BUTTON_LEFT 97#define LEFT BUTTON_LEFT
@@ -113,9 +100,6 @@ PLUGIN_HEADER
113#define UP BUTTON_UP 100#define UP BUTTON_UP
114#define DOWN BUTTON_DOWN 101#define DOWN BUTTON_DOWN
115 102
116/* Only iPod have scroll events */
117#define SCROLL_FWD(x) (0)
118#define SCROLL_BACK(x) (0)
119 103
120#elif CONFIG_KEYPAD == SANSA_E200_PAD 104#elif CONFIG_KEYPAD == SANSA_E200_PAD
121 105
@@ -126,10 +110,20 @@ PLUGIN_HEADER
126#define UP BUTTON_SCROLL_UP 110#define UP BUTTON_SCROLL_UP
127#define DOWN BUTTON_SCROLL_DOWN 111#define DOWN BUTTON_SCROLL_DOWN
128 112
129#define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_DOWN)
130#define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_UP)
131 113
132#elif CONFIG_KEYPAD == IRIVER_H10_PAD /* grayscale at the moment */ 114#elif CONFIG_KEYPAD == SANSA_C200_PAD
115
116#define QUIT BUTTON_POWER
117#define LEFT BUTTON_LEFT
118#define RIGHT BUTTON_RIGHT
119#define ALTLEFT BUTTON_VOL_DOWN
120#define ALTRIGHT BUTTON_VOL_UP
121#define SELECT BUTTON_SELECT
122#define UP BUTTON_UP
123#define DOWN BUTTON_DOWN
124
125
126#elif CONFIG_KEYPAD == IRIVER_H10_PAD
133 127
134#define QUIT BUTTON_POWER 128#define QUIT BUTTON_POWER
135#define LEFT BUTTON_LEFT 129#define LEFT BUTTON_LEFT
@@ -138,14 +132,17 @@ PLUGIN_HEADER
138#define UP BUTTON_SCROLL_UP 132#define UP BUTTON_SCROLL_UP
139#define DOWN BUTTON_SCROLL_DOWN 133#define DOWN BUTTON_SCROLL_DOWN
140 134
141/* Only iPod have scroll events */
142#define SCROLL_FWD(x) (0)
143#define SCROLL_BACK(x) (0)
144 135
145#else 136#else
146#error Unsupported keypad 137#error Unsupported keypad
147#endif 138#endif
148 139
140#ifndef SCROLL_FWD
141#define SCROLL_FWD(x) (0)
142#define SCROLL_BACK(x) (0)
143#endif
144
145
149static struct plugin_api* rb; 146static struct plugin_api* rb;
150 147
151enum menu_items { 148enum menu_items {
@@ -180,6 +177,35 @@ extern const fb_data brickmania_powerups[];
180/* purple, red, blue, pink, green, yellow orange */ 177/* purple, red, blue, pink, green, yellow orange */
181extern const fb_data brickmania_bricks[]; 178extern const fb_data brickmania_bricks[];
182 179
180#include "brickmania_pads.h"
181#include "brickmania_bricks.h"
182#include "brickmania_powerups.h"
183#include "brickmania_ball.h"
184#include "brickmania_menu_items.h"
185#include "brickmania_gameover.h"
186
187#define PAD_WIDTH BMPWIDTH_brickmania_pads
188#define PAD_HEIGHT (BMPHEIGHT_brickmania_pads/3)
189#define BRICK_HEIGHT (BMPHEIGHT_brickmania_bricks/7)
190#define BRICK_WIDTH BMPWIDTH_brickmania_bricks
191#define LEFTMARGIN ((LCD_WIDTH-10*BRICK_WIDTH)/2)
192#define POWERUP_HEIGHT (BMPHEIGHT_brickmania_powerups/7)
193#define POWERUP_WIDTH BMPWIDTH_brickmania_powerups
194#define BALL BMPHEIGHT_brickmania_ball
195#define HALFBALL ((BALL+1)/2)
196#define MENU_ITEMXOFS ((LCD_WIDTH - BMPWIDTH_brickmania_menu_items)/2)
197#define MENU_ITEMHEIGHT (BMPHEIGHT_brickmania_menu_items/9)
198#define MENU_ITEMWIDTH BMPWIDTH_brickmania_menu_items
199#define GAMEOVER_WIDTH BMPWIDTH_brickmania_gameover
200#define GAMEOVER_HEIGHT BMPHEIGHT_brickmania_gameover
201
202#if LCD_DEPTH > 1 /* currently no background bmp for mono screens */
203#include "brickmania_menu_bg.h"
204#define MENU_BGHEIGHT BMPHEIGHT_brickmania_menu_bg
205#define MENU_BGWIDTH BMPWIDTH_brickmania_menu_bg
206#endif
207
208
183#if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) 209#if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
184 210
185/* The time (in ms) for one iteration through the game loop - decrease this 211/* The time (in ms) for one iteration through the game loop - decrease this
@@ -188,42 +214,16 @@ extern const fb_data brickmania_bricks[];
188*/ 214*/
189#define CYCLETIME 30 215#define CYCLETIME 30
190 216
191#define GAMESCREEN_HEIGHT LCD_HEIGHT
192
193#define PAD_WIDTH 56
194#define PAD_HEIGHT 7
195#define PAD_POS_Y LCD_HEIGHT - 7
196#define BRICK_HEIGHT 12
197#define BRICK_WIDTH 32
198#define BALL 5
199#define HALFBALL 3
200#define LEFTMARGIN 0
201#define TOPMARGIN 30 217#define TOPMARGIN 30
202 218
203#define MENU_BMPHEIGHT 20
204#define MENU_BMPWIDTH 112
205
206#define BMPHEIGHT_powerup 10
207#define BMPWIDTH_powerup 16
208
209#define BMPHEIGHT_menu LCD_HEIGHT
210#define BMPWIDTH_menu LCD_WIDTH
211
212#define BMPXOFS_start 105
213#define BMPYOFS_start 110 219#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 220#define HIGHSCORE_XPOS 57
221#define HIGHSCORE_YPOS 88 221#define HIGHSCORE_YPOS 88
222 222
223#define STRINGPOS_finsh 140 223#define STRINGPOS_FINISH 140
224#define STRINGPOS_congrats 157 224#define STRINGPOS_CONGRATS 157
225#define STRINGPOS_navi 150 225#define STRINGPOS_NAVI 150
226#define STRINGPOS_flipsides 150 226#define STRINGPOS_FLIP 150
227 227
228#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) 228#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
229 229
@@ -236,44 +236,19 @@ extern const fb_data brickmania_bricks[];
236/* Offsets for LCDS > 220x176 */ 236/* Offsets for LCDS > 220x176 */
237 237
238#define GAMESCREEN_HEIGHT 176 238#define GAMESCREEN_HEIGHT 176
239
240#define PAD_WIDTH 40
241#define PAD_HEIGHT 5
242#define PAD_POS_Y GAMESCREEN_HEIGHT - 7
243#define BRICK_HEIGHT 8
244#define BRICK_WIDTH 21
245#define BALL 5
246#define HALFBALL 3
247#define LEFTMARGIN (LCD_WIDTH-220)/2 + 5
248#define TOPMARGIN 30 239#define TOPMARGIN 30
249 240
250#define XOFS ((LCD_WIDTH-220)/BRICK_WIDTH/2)*BRICK_WIDTH 241#define XOFS ((LCD_WIDTH-220)/BRICK_WIDTH/2)*BRICK_WIDTH
251#define YOFS ((LCD_HEIGHT-176)/BRICK_HEIGHT/2)*BRICK_HEIGHT 242#define YOFS ((LCD_HEIGHT-176)/BRICK_HEIGHT/2)*BRICK_HEIGHT
252 243
253#define MENU_BMPHEIGHT 20
254#define MENU_BMPWIDTH 112
255
256#define BMPHEIGHT_powerup 6
257#define BMPWIDTH_powerup 10
258
259#define BMPHEIGHT_menu LCD_HEIGHT
260#define BMPWIDTH_menu LCD_WIDTH
261
262#define BMPXOFS_start (55+XOFS)
263#define BMPYOFS_start (78+YOFS) 244#define BMPYOFS_start (78+YOFS)
264#define BMPXOFS_resume (62+XOFS) 245#define HIGHSCORE_XPOS (17+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) 246#define HIGHSCORE_YPOS (56+YOFS)
272 247
273#define STRINGPOS_finsh 140 248#define STRINGPOS_FINISH 140
274#define STRINGPOS_congrats 157 249#define STRINGPOS_CONGRATS 157
275#define STRINGPOS_navi 150 250#define STRINGPOS_NAVI 150
276#define STRINGPOS_flipsides 150 251#define STRINGPOS_FLIP 150
277 252
278#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) 253#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128)
279/* The time (in ms) for one iteration through the game loop - decrease this 254/* The time (in ms) for one iteration through the game loop - decrease this
@@ -282,144 +257,97 @@ extern const fb_data brickmania_bricks[];
282*/ 257*/
283#define CYCLETIME 50 258#define CYCLETIME 50
284 259
285#define GAMESCREEN_HEIGHT LCD_HEIGHT
286
287#define PAD_WIDTH 30
288#define PAD_HEIGHT 5
289#define PAD_POS_Y LCD_HEIGHT - 7
290#define BRICK_HEIGHT 7
291#define BRICK_WIDTH 15
292#define BALL 5
293#define HALFBALL 3
294#define LEFTMARGIN 5
295#define TOPMARGIN 21 260#define TOPMARGIN 21
296 261
297#define MENU_BMPHEIGHT 17 262#if LCD_DEPTH > 2
298#define MENU_BMPWIDTH 88 263#define BMPYOFS_start 58
299
300#define BMPHEIGHT_powerup 6
301#define BMPWIDTH_powerup 10
302
303#if LCD_DEPTH == 16
304#define BMPHEIGHT_menu 128
305#else
306#define BMPHEIGHT_menu 45
307#endif
308#define BMPWIDTH_menu 160
309
310#if LCD_DEPTH == 16
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
319#else 264#else
320#define BMPXOFS_start 34 265#define BMPYOFS_start 66
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
328#endif 266#endif
329#define HIGHSCORE_XPOS 7 267#define HIGHSCORE_XPOS 10
330#define HIGHSCORE_YPOS 36 268#define HIGHSCORE_YPOS 38
331 269
332#define STRINGPOS_finsh 110 270#define STRINGPOS_FINISH 110
333#define STRINGPOS_congrats 100 271#define STRINGPOS_CONGRATS 100
334#define STRINGPOS_navi 100 272#define STRINGPOS_NAVI 100
335#define STRINGPOS_flipsides 100 273#define STRINGPOS_FLIP 100
274
275#elif (LCD_WIDTH == 132) && (LCD_HEIGHT == 80)
336 276
337/* iPod Mini */
338#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
339/* The time (in ms) for one iteration through the game loop - decrease this 277/* 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 278 to speed up the game - note that current_tick is (currently) only accurate
341 to 10ms. 279 to 10ms.
342*/ 280*/
343#define CYCLETIME 50 281#define CYCLETIME 50
344 282
345#define GAMESCREEN_HEIGHT LCD_HEIGHT
346
347#define PAD_WIDTH 30
348#define PAD_HEIGHT 5
349#define PAD_POS_Y LCD_HEIGHT - 5
350#define BRICK_HEIGHT 7
351#define BRICK_WIDTH 13
352#define BALL 5
353#define HALFBALL 3
354#define LEFTMARGIN 4
355#define TOPMARGIN 10 283#define TOPMARGIN 10
356 284
357#define MENU_BMPHEIGHT 17 285#define BMPYOFS_start 30
358#define MENU_BMPWIDTH 88 286#define HIGHSCORE_XPOS 68
287#define HIGHSCORE_YPOS 8
359 288
360#define BMPHEIGHT_powerup 6 289#define STRINGPOS_FINISH 55
361#define BMPWIDTH_powerup 10 290#define STRINGPOS_CONGRATS 45
291#define STRINGPOS_NAVI 60
292#define STRINGPOS_FLIP 60
362 293
363#define BMPHEIGHT_menu 45 294#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 128)
364#define BMPWIDTH_menu 160
365 295
366#define BMPXOFS_start 28 296/* The time (in ms) for one iteration through the game loop - decrease this
367#define BMPYOFS_start 41 297 to speed up the game - note that current_tick is (currently) only accurate
368#define BMPXOFS_resume 33 298 to 10ms.
369#define BMPYOFS_resume 58 299*/
370#define BMPXOFS_help 56 300#define CYCLETIME 50
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
376 301
377#define STRINGPOS_finsh 54 302#define GAMESCREEN_HEIGHT 100
378#define STRINGPOS_congrats 44 303#define TOPMARGIN 15
379#define STRINGPOS_navi 44
380#define STRINGPOS_flipsides 44
381 304
305#define BMPYOFS_start 70
306#define HIGHSCORE_XPOS 8
307#define HIGHSCORE_YPOS 36
382 308
383#elif (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) 309#define STRINGPOS_FINISH 55
310#define STRINGPOS_CONGRATS 45
311#define STRINGPOS_NAVI 60
312#define STRINGPOS_FLIP 60
313
314/* iPod Mini */
315#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
384/* The time (in ms) for one iteration through the game loop - decrease this 316/* 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 317 to speed up the game - note that current_tick is (currently) only accurate
386 to 10ms. 318 to 10ms.
387*/ 319*/
388#define CYCLETIME 75 320#define CYCLETIME 50
389
390#define GAMESCREEN_HEIGHT LCD_HEIGHT
391 321
392#define PAD_WIDTH 30
393#define PAD_HEIGHT 3
394#define PAD_POS_Y LCD_HEIGHT - 5
395#define BRICK_HEIGHT 4
396#define BRICK_WIDTH 11
397#define BALL 3
398#define HALFBALL 2
399#define LEFTMARGIN 1
400#define TOPMARGIN 10 322#define TOPMARGIN 10
401 323
402#define MENU_BMPHEIGHT 9 324#define BMPYOFS_start 51
403#define MENU_BMPWIDTH 80 325#define HIGHSCORE_XPOS 73
326#define HIGHSCORE_YPOS 25
404 327
405#define BMPHEIGHT_powerup 6 328#define STRINGPOS_FINISH 54
406#define BMPWIDTH_powerup 7 329#define STRINGPOS_CONGRATS 44
330#define STRINGPOS_NAVI 44
331#define STRINGPOS_FLIP 44
407 332
408#define BMPXOFS_start 12 333
409#define BMPYOFS_start 20 334#elif (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
410#define BMPXOFS_resume 18 335/* The time (in ms) for one iteration through the game loop - decrease this
411#define BMPYOFS_resume 31 336 to speed up the game - note that current_tick is (currently) only accurate
412#define BMPXOFS_help 39 337 to 10ms.
413#define BMPYOFS_help 42 338*/
414#define BMPXOFS_quit 40 339#define CYCLETIME 75
415#define BMPYOFS_quit 53 340
341#define TOPMARGIN 10
342
343#define BMPYOFS_start 22
416#define HIGHSCORE_XPOS 0 344#define HIGHSCORE_XPOS 0
417#define HIGHSCORE_YPOS 0 345#define HIGHSCORE_YPOS 0
418 346
419#define STRINGPOS_finsh 54 347#define STRINGPOS_FINISH 54
420#define STRINGPOS_congrats 44 348#define STRINGPOS_CONGRATS 44
421#define STRINGPOS_navi 44 349#define STRINGPOS_NAVI 44
422#define STRINGPOS_flipsides 44 350#define STRINGPOS_FLIP 44
423 351
424/* nano and sansa */ 352/* nano and sansa */
425#elif (LCD_WIDTH == 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH==16) 353#elif (LCD_WIDTH == 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH==16)
@@ -430,51 +358,40 @@ extern const fb_data brickmania_bricks[];
430 358
431#define CYCLETIME 30 359#define CYCLETIME 30
432 360
433#if (LCD_HEIGHT == 220)
434#define GAMESCREEN_HEIGHT 132 361#define GAMESCREEN_HEIGHT 132
435#else
436#define GAMESCREEN_HEIGHT LCD_HEIGHT
437#endif
438
439#define PAD_WIDTH 40
440#define PAD_HEIGHT 5
441#define PAD_POS_Y GAMESCREEN_HEIGHT - 7
442#define BRICK_HEIGHT 7
443#define BRICK_WIDTH 17
444#define BALL 5
445#define HALFBALL 3
446#define LEFTMARGIN 3
447#define TOPMARGIN 21 362#define TOPMARGIN 21
448 363
449#define MENU_BMPHEIGHT 16
450#define MENU_BMPWIDTH 89
451
452#define BMPHEIGHT_powerup 6
453#define BMPWIDTH_powerup 10
454
455#define BMPHEIGHT_menu 132
456#define BMPWIDTH_menu 176
457
458#define BMPXOFS_start 44
459#define BMPYOFS_start 58 364#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 365#define HIGHSCORE_XPOS 7
467#define HIGHSCORE_YPOS 36 366#define HIGHSCORE_YPOS 36
468 367
469#define STRINGPOS_finsh 110 368#define STRINGPOS_FINISH 110
470#define STRINGPOS_congrats 110 369#define STRINGPOS_CONGRATS 110
471#define STRINGPOS_navi 100 370#define STRINGPOS_NAVI 100
472#define STRINGPOS_flipsides 100 371#define STRINGPOS_FLIP 100
473 372
474#else 373#else
475#error Unsupported LCD Size 374#error Unsupported LCD Size
476#endif 375#endif
477 376
377
378#ifndef GAMESCREEN_HEIGHT
379#define GAMESCREEN_HEIGHT LCD_HEIGHT
380#endif
381
382/* calculate menu item offsets from the first defined and the height*/
383#define BMPYOFS_resume (BMPYOFS_start + MENU_ITEMHEIGHT)
384#define BMPYOFS_help (BMPYOFS_start + 2*MENU_ITEMHEIGHT)
385#define BMPYOFS_quit (BMPYOFS_start + 3*MENU_ITEMHEIGHT)
386
387/*calculate paddle y-position */
388#if GAMESCREEN_HEIGHT >= 128
389#define PAD_POS_Y GAMESCREEN_HEIGHT -PAD_HEIGHT - 2
390#else
391#define PAD_POS_Y GAMESCREEN_HEIGHT -PAD_HEIGHT - 1
392#endif
393
394
478int levels_num = 29; 395int levels_num = 29;
479 396
480static unsigned char levels[29][8][10] = { 397static unsigned char levels[29][8][10] = {
@@ -909,116 +826,116 @@ int game_menu(int when)
909 char str[10]; 826 char str[10];
910 rb->lcd_clear_display(); 827 rb->lcd_clear_display();
911#if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64) 828#if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
912 rb->lcd_bitmap(brickmania_menu_bg, 0, 0, BMPWIDTH_menu, BMPHEIGHT_menu); 829 rb->lcd_bitmap(brickmania_menu_bg, 0, 0, MENU_BGWIDTH, MENU_BGHEIGHT);
913#endif 830#endif
914 while (true) { 831 while (true) {
915 for(i=0;i<MENU_LENGTH;i++) { 832 for(i=0;i<MENU_LENGTH;i++) {
916#ifdef HAVE_LCD_COLOR 833#ifdef HAVE_LCD_COLOR
917 if (cur==0) 834 if (cur==0)
918 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 835 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
919 MENU_BMPHEIGHT * BM_SEL_START, MENU_BMPWIDTH, 836 MENU_ITEMHEIGHT * BM_SEL_START, MENU_ITEMWIDTH,
920 BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH, 837 MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH,
921 MENU_BMPHEIGHT); 838 MENU_ITEMHEIGHT);
922 else 839 else
923 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 840 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
924 MENU_BMPHEIGHT * BM_START, MENU_BMPWIDTH, 841 MENU_ITEMHEIGHT * BM_START, MENU_ITEMWIDTH,
925 BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH, 842 MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH,
926 MENU_BMPHEIGHT); 843 MENU_ITEMHEIGHT);
927 844
928 if (when==1) { 845 if (when==1) {
929 if (cur==1) 846 if (cur==1)
930 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 847 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
931 MENU_BMPHEIGHT * BM_SEL_RESUME, MENU_BMPWIDTH, 848 MENU_ITEMHEIGHT * BM_SEL_RESUME, MENU_ITEMWIDTH,
932 BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH, 849 MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH,
933 MENU_BMPHEIGHT); 850 MENU_ITEMHEIGHT);
934 else 851 else
935 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 852 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
936 MENU_BMPHEIGHT * BM_RESUME, MENU_BMPWIDTH, 853 MENU_ITEMHEIGHT * BM_RESUME, MENU_ITEMWIDTH,
937 BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH, 854 MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH,
938 MENU_BMPHEIGHT); 855 MENU_ITEMHEIGHT);
939 856
940 } else { 857 } else {
941 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 858 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
942 MENU_BMPHEIGHT * BM_NO_RESUME, MENU_BMPWIDTH, 859 MENU_ITEMHEIGHT * BM_NO_RESUME, MENU_ITEMWIDTH,
943 BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH, 860 MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH,
944 MENU_BMPHEIGHT); 861 MENU_ITEMHEIGHT);
945 } 862 }
946 863
947 864
948 if (cur==2) 865 if (cur==2)
949 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 866 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
950 MENU_BMPHEIGHT * BM_SEL_HELP, MENU_BMPWIDTH, 867 MENU_ITEMHEIGHT * BM_SEL_HELP, MENU_ITEMWIDTH,
951 BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH, 868 MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH,
952 MENU_BMPHEIGHT); 869 MENU_ITEMHEIGHT);
953 else 870 else
954 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 871 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
955 MENU_BMPHEIGHT * BM_HELP, MENU_BMPWIDTH, 872 MENU_ITEMHEIGHT * BM_HELP, MENU_ITEMWIDTH,
956 BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH, 873 MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH,
957 MENU_BMPHEIGHT); 874 MENU_ITEMHEIGHT);
958 875
959 if (cur==3) 876 if (cur==3)
960 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 877 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
961 MENU_BMPHEIGHT * BM_SEL_QUIT, MENU_BMPWIDTH, 878 MENU_ITEMHEIGHT * BM_SEL_QUIT, MENU_ITEMWIDTH,
962 BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH, 879 MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH,
963 MENU_BMPHEIGHT); 880 MENU_ITEMHEIGHT);
964 else 881 else
965 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0, 882 rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
966 MENU_BMPHEIGHT * BM_QUIT, MENU_BMPWIDTH, 883 MENU_ITEMHEIGHT * BM_QUIT, MENU_ITEMWIDTH,
967 BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH, 884 MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH,
968 MENU_BMPHEIGHT); 885 MENU_ITEMHEIGHT);
969#else 886#else
970 if (cur==0) 887 if (cur==0)
971 rb->lcd_bitmap_part(brickmania_menu_items, 0, 888 rb->lcd_bitmap_part(brickmania_menu_items, 0,
972 MENU_BMPHEIGHT * BM_SEL_START, MENU_BMPWIDTH, 889 MENU_ITEMHEIGHT * BM_SEL_START, MENU_ITEMWIDTH,
973 BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH, 890 MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH,
974 MENU_BMPHEIGHT); 891 MENU_ITEMHEIGHT);
975 else 892 else
976 rb->lcd_bitmap_part(brickmania_menu_items, 0, 893 rb->lcd_bitmap_part(brickmania_menu_items, 0,
977 MENU_BMPHEIGHT * BM_START, MENU_BMPWIDTH, 894 MENU_ITEMHEIGHT * BM_START, MENU_ITEMWIDTH,
978 BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH, 895 MENU_ITEMXOFS, BMPYOFS_start, MENU_ITEMWIDTH,
979 MENU_BMPHEIGHT); 896 MENU_ITEMHEIGHT);
980 897
981 if (when==1) { 898 if (when==1) {
982 if (cur==1) 899 if (cur==1)
983 rb->lcd_bitmap_part(brickmania_menu_items, 0, 900 rb->lcd_bitmap_part(brickmania_menu_items, 0,
984 MENU_BMPHEIGHT * BM_SEL_RESUME, MENU_BMPWIDTH, 901 MENU_ITEMHEIGHT * BM_SEL_RESUME, MENU_ITEMWIDTH,
985 BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH, 902 MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH,
986 MENU_BMPHEIGHT); 903 MENU_ITEMHEIGHT);
987 else 904 else
988 rb->lcd_bitmap_part(brickmania_menu_items, 0, 905 rb->lcd_bitmap_part(brickmania_menu_items, 0,
989 MENU_BMPHEIGHT * BM_RESUME, MENU_BMPWIDTH, 906 MENU_ITEMHEIGHT * BM_RESUME, MENU_ITEMWIDTH,
990 BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH, 907 MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH,
991 MENU_BMPHEIGHT); 908 MENU_ITEMHEIGHT);
992 909
993 } else { 910 } else {
994 rb->lcd_bitmap_part(brickmania_menu_items, 0, 911 rb->lcd_bitmap_part(brickmania_menu_items, 0,
995 MENU_BMPHEIGHT * BM_NO_RESUME, MENU_BMPWIDTH, 912 MENU_ITEMHEIGHT * BM_NO_RESUME, MENU_ITEMWIDTH,
996 BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH, 913 MENU_ITEMXOFS, BMPYOFS_resume, MENU_ITEMWIDTH,
997 MENU_BMPHEIGHT); 914 MENU_ITEMHEIGHT);
998 } 915 }
999 916
1000 917
1001 if (cur==2) 918 if (cur==2)
1002 rb->lcd_bitmap_part(brickmania_menu_items, 0, 919 rb->lcd_bitmap_part(brickmania_menu_items, 0,
1003 MENU_BMPHEIGHT * BM_SEL_HELP, MENU_BMPWIDTH, 920 MENU_ITEMHEIGHT * BM_SEL_HELP, MENU_ITEMWIDTH,
1004 BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH, 921 MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH,
1005 MENU_BMPHEIGHT); 922 MENU_ITEMHEIGHT);
1006 else 923 else
1007 rb->lcd_bitmap_part(brickmania_menu_items, 0, 924 rb->lcd_bitmap_part(brickmania_menu_items, 0,
1008 MENU_BMPHEIGHT * BM_HELP, MENU_BMPWIDTH, 925 MENU_ITEMHEIGHT * BM_HELP, MENU_ITEMWIDTH,
1009 BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH, 926 MENU_ITEMXOFS, BMPYOFS_help, MENU_ITEMWIDTH,
1010 MENU_BMPHEIGHT); 927 MENU_ITEMHEIGHT);
1011 928
1012 if (cur==3) 929 if (cur==3)
1013 rb->lcd_bitmap_part(brickmania_menu_items, 0, 930 rb->lcd_bitmap_part(brickmania_menu_items, 0,
1014 MENU_BMPHEIGHT * BM_SEL_QUIT, MENU_BMPWIDTH, 931 MENU_ITEMHEIGHT * BM_SEL_QUIT, MENU_ITEMWIDTH,
1015 BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH, 932 MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH,
1016 MENU_BMPHEIGHT); 933 MENU_ITEMHEIGHT);
1017 else 934 else
1018 rb->lcd_bitmap_part(brickmania_menu_items, 0, 935 rb->lcd_bitmap_part(brickmania_menu_items, 0,
1019 MENU_BMPHEIGHT * BM_QUIT, MENU_BMPWIDTH, 936 MENU_ITEMHEIGHT * BM_QUIT, MENU_ITEMWIDTH,
1020 BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH, 937 MENU_ITEMXOFS, BMPYOFS_quit, MENU_ITEMWIDTH,
1021 MENU_BMPHEIGHT); 938 MENU_ITEMHEIGHT);
1022#endif 939#endif
1023 } 940 }
1024 rb->lcd_set_drawmode(DRMODE_FG); 941 rb->lcd_set_drawmode(DRMODE_FG);
@@ -1195,11 +1112,19 @@ int help(int when)
1195 break; 1112 break;
1196 case LEFT: 1113 case LEFT:
1197 case LEFT | BUTTON_REPEAT: 1114 case LEFT | BUTTON_REPEAT:
1115#ifdef ALTLEFT
1116 case ALTLEFT:
1117 case ALTLEFT | BUTTON_REPEAT:
1118#endif
1198 if( xoffset<0) 1119 if( xoffset<0)
1199 xoffset+=2; 1120 xoffset+=2;
1200 break; 1121 break;
1201 case RIGHT: 1122 case RIGHT:
1202 case RIGHT | BUTTON_REPEAT: 1123 case RIGHT | BUTTON_REPEAT:
1124#ifdef ALTRIGHT
1125 case ALTRIGHT:
1126 case ALTRIGHT | BUTTON_REPEAT:
1127#endif
1203 if(xoffset+maxX > LCD_WIDTH) 1128 if(xoffset+maxX > LCD_WIDTH)
1204 xoffset-=2; 1129 xoffset-=2;
1205 break; 1130 break;
@@ -1309,7 +1234,7 @@ int game_loop(void)
1309 } 1234 }
1310 rb->snprintf(s, sizeof(s), "%d", num_count); 1235 rb->snprintf(s, sizeof(s), "%d", num_count);
1311 rb->lcd_getstringsize(s, &sw, NULL); 1236 rb->lcd_getstringsize(s, &sw, NULL);
1312 rb->lcd_putsxy(LCD_WIDTH/2-2, STRINGPOS_flipsides, s); 1237 rb->lcd_putsxy(LCD_WIDTH/2-2, STRINGPOS_FLIP, s);
1313 } 1238 }
1314 1239
1315 /* write life num */ 1240 /* write life num */
@@ -1350,7 +1275,7 @@ int game_loop(void)
1350 rb->snprintf(s, sizeof(s), "Press SELECT To Continue"); 1275 rb->snprintf(s, sizeof(s), "Press SELECT To Continue");
1351#endif 1276#endif
1352 rb->lcd_getstringsize(s, &sw, NULL); 1277 rb->lcd_getstringsize(s, &sw, NULL);
1353 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_navi, s); 1278 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_NAVI, s);
1354 1279
1355 sec_count=*rb->current_tick+HZ; 1280 sec_count=*rb->current_tick+HZ;
1356 } 1281 }
@@ -1380,15 +1305,15 @@ int game_loop(void)
1380 if (con_game!=1) 1305 if (con_game!=1)
1381 brick[i*10+j].powertop+=2; 1306 brick[i*10+j].powertop+=2;
1382 rb->lcd_bitmap_part(brickmania_powerups,0, 1307 rb->lcd_bitmap_part(brickmania_powerups,0,
1383 BMPHEIGHT_powerup*brick[i*10+j 1308 POWERUP_HEIGHT*brick[i*10+j
1384 ].power, 1309 ].power,
1385 BMPWIDTH_powerup, 1310 POWERUP_WIDTH,
1386 LEFTMARGIN+j*BRICK_WIDTH+ 1311 LEFTMARGIN+j*BRICK_WIDTH+
1387 (BRICK_WIDTH/2- 1312 (BRICK_WIDTH/2-
1388 BMPWIDTH_powerup/2), 1313 POWERUP_WIDTH/2),
1389 brick[i*10+j].powertop, 1314 brick[i*10+j].powertop,
1390 BMPWIDTH_powerup, 1315 POWERUP_WIDTH,
1391 BMPHEIGHT_powerup); 1316 POWERUP_HEIGHT);
1392 } 1317 }
1393 } 1318 }
1394 1319
@@ -1803,16 +1728,16 @@ int game_loop(void)
1803 } 1728 }
1804 else { 1729 else {
1805 rb->lcd_getstringsize("Congratulations!", &sw, NULL); 1730 rb->lcd_getstringsize("Congratulations!", &sw, NULL);
1806 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_congrats, 1731 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_CONGRATS,
1807 "Congratulations!"); 1732 "Congratulations!");
1808#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) 1733#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
1809 rb->lcd_getstringsize("No more levels", &sw, NULL); 1734 rb->lcd_getstringsize("No more levels", &sw, NULL);
1810 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_finsh, 1735 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_FINISH,
1811 "No more levels"); 1736 "No more levels");
1812#else 1737#else
1813 rb->lcd_getstringsize("You have finished the game!", 1738 rb->lcd_getstringsize("You have finished the game!",
1814 &sw, NULL); 1739 &sw, NULL);
1815 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_finsh, 1740 rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_FINISH,
1816 "You have finished the game!"); 1741 "You have finished the game!");
1817#endif 1742#endif
1818 vscore=score; 1743 vscore=score;
@@ -1855,9 +1780,13 @@ int game_loop(void)
1855#endif 1780#endif
1856 1781
1857 move_button=rb->button_status(); 1782 move_button=rb->button_status();
1858 1783#ifdef ALTRIGHT
1784 button_right=((move_button & RIGHT) || (move_button & ALTRIGHT));
1785 button_left=((move_button & LEFT) || (move_button & ALTLEFT));
1786#else
1859 button_right=((move_button & RIGHT) || (SCROLL_FWD(button))); 1787 button_right=((move_button & RIGHT) || (SCROLL_FWD(button)));
1860 button_left=((move_button & LEFT) || (SCROLL_BACK(button))); 1788 button_left=((move_button & LEFT) || (SCROLL_BACK(button)));
1789#endif
1861 if ((con_game== 1 && start_game!=1) && (button_right || button_left)) 1790 if ((con_game== 1 && start_game!=1) && (button_right || button_left))
1862 continue; 1791 continue;
1863 if ((button_right && flip_sides==false) || 1792 if ((button_right && flip_sides==false) ||
@@ -1975,13 +1904,17 @@ int game_loop(void)
1975 } 1904 }
1976 } 1905 }
1977 else { 1906 else {
1978#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) 1907#ifdef HAVE_LCD_COLOR
1979 rb->splash(HZ*2, "Game Over"); 1908 rb->lcd_bitmap_transparent(brickmania_gameover,
1980#else 1909 (LCD_WIDTH - GAMEOVER_WIDTH)/2,
1981 rb->lcd_bitmap(brickmania_gameover,LCD_WIDTH/2-55,LCD_HEIGHT-87, 1910 (GAMESCREEN_HEIGHT - GAMEOVER_HEIGHT)/2,
1982 110,52); 1911 GAMEOVER_WIDTH,GAMEOVER_HEIGHT);
1983 rb->lcd_update(); 1912#else /* greyscale and mono */
1913 rb->lcd_bitmap(brickmania_gameover,(LCD_WIDTH - GAMEOVER_WIDTH)/2,
1914 (GAMESCREEN_HEIGHT - GAMEOVER_HEIGHT)/2,
1915 GAMEOVER_WIDTH,GAMEOVER_HEIGHT);
1984#endif 1916#endif
1917 rb->lcd_update();
1985 if (score>highscore) { 1918 if (score>highscore) {
1986 sleep(2); 1919 sleep(2);
1987 highscore=score; 1920 highscore=score;