diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-07-19 16:48:02 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-07-19 16:48:02 +0000 |
commit | 79442c8fbd5b2b8aac46a14b30c3dcdec715e37f (patch) | |
tree | 22c3e6de6db4268f93c962db55e118620aa61fd7 /apps/plugins/sokoban.c | |
parent | f3c427291994126426b8f8cc37df27f1d929ef2f (diff) | |
download | rockbox-79442c8fbd5b2b8aac46a14b30c3dcdec715e37f.tar.gz rockbox-79442c8fbd5b2b8aac46a14b30c3dcdec715e37f.zip |
Sokoban: Use greyscale for walls, proper scaling of the player graphic, show button assignments on iriver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7199 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/sokoban.c')
-rw-r--r-- | apps/plugins/sokoban.c | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index fcadc93897..70f616d406 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -58,6 +58,14 @@ | |||
58 | #define SOKOBAN_LEVEL_REPEAT BUTTON_SELECT | 58 | #define SOKOBAN_LEVEL_REPEAT BUTTON_SELECT |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #if LCD_DEPTH > 1 | ||
62 | #if HAVE_LCD_COLOR | ||
63 | #define MEDIUM_GRAY ((struct rgb){LCD_MAX_RED/2, LCD_MAX_GREEN/2, LCD_MAX_BLUE/2}) | ||
64 | #else | ||
65 | #define MEDIUM_GRAY (LCD_MAX_LEVEL/2) | ||
66 | #endif | ||
67 | #endif | ||
68 | |||
61 | static void init_undo(void); | 69 | static void init_undo(void); |
62 | static void undo(void); | 70 | static void undo(void); |
63 | static void add_undo(int button); | 71 | static void add_undo(int button); |
@@ -391,7 +399,6 @@ static void update_screen(void) | |||
391 | { | 399 | { |
392 | int b = 0, c = 0; | 400 | int b = 0, c = 0; |
393 | int rows = 0, cols = 0; | 401 | int rows = 0, cols = 0; |
394 | int i, j; | ||
395 | char s[25]; | 402 | char s[25]; |
396 | 403 | ||
397 | #if LCD_HEIGHT >= 128 | 404 | #if LCD_HEIGHT >= 128 |
@@ -411,10 +418,19 @@ static void update_screen(void) | |||
411 | break; | 418 | break; |
412 | 419 | ||
413 | case '#': /* this is a wall */ | 420 | case '#': /* this is a wall */ |
414 | for (i = c; i < c + magnify; i++) | 421 | #if LCD_DEPTH > 1 |
415 | for (j = b; j < b + magnify; j++) | 422 | rb->lcd_set_foreground(MEDIUM_GRAY); |
416 | if ((i ^ j) & 1) | 423 | rb->lcd_fillrect(c, b, magnify, magnify); |
417 | rb->lcd_drawpixel(i, j); | 424 | rb->lcd_set_foreground(LCD_BLACK); |
425 | #else | ||
426 | { | ||
427 | int i, j; | ||
428 | for (i = c; i < c + magnify; i++) | ||
429 | for (j = b; j < b + magnify; j++) | ||
430 | if ((i ^ j) & 1) | ||
431 | rb->lcd_drawpixel(i, j); | ||
432 | } | ||
433 | #endif | ||
418 | break; | 434 | break; |
419 | 435 | ||
420 | case '.': /* this is a home location */ | 436 | case '.': /* this is a home location */ |
@@ -427,12 +443,20 @@ static void update_screen(void) | |||
427 | break; | 443 | break; |
428 | 444 | ||
429 | case '@': /* this is you */ | 445 | case '@': /* this is you */ |
430 | rb->lcd_drawline(c+1, b, c+2, b); | 446 | { |
431 | rb->lcd_drawline(c, b+1, c+3, b+1); | 447 | int max = magnify - 1; |
432 | rb->lcd_drawline(c+1, b+2, c+2, b+2); | 448 | int middle = max / 2; |
433 | 449 | int ldelta = (middle + 1) / 2; | |
434 | rb->lcd_drawpixel(c, b+3); | 450 | |
435 | rb->lcd_drawpixel(c+3, b+3); | 451 | rb->lcd_drawline(c, b+middle, c+max, b+middle); |
452 | rb->lcd_drawline(c+middle, b, c+middle, b+max-ldelta); | ||
453 | rb->lcd_drawline(c+max-middle, b, | ||
454 | c+max-middle, b+max-ldelta); | ||
455 | rb->lcd_drawline(c+middle, b+max-ldelta, | ||
456 | c+middle-ldelta, b+max); | ||
457 | rb->lcd_drawline(c+max-middle, b+max-ldelta, | ||
458 | c+max-middle+ldelta, b+max); | ||
459 | } | ||
436 | break; | 460 | break; |
437 | 461 | ||
438 | case '%': /* this is a box on a home spot */ | 462 | case '%': /* this is a box on a home spot */ |
@@ -893,6 +917,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
893 | rb->lcd_putsxy(3, 26, "[M-LEFT] - Level"); | 917 | rb->lcd_putsxy(3, 26, "[M-LEFT] - Level"); |
894 | rb->lcd_putsxy(3, 36, "[M-UP] Same Level"); | 918 | rb->lcd_putsxy(3, 36, "[M-UP] Same Level"); |
895 | rb->lcd_putsxy(3, 46, "[M-RIGHT] + Level"); | 919 | rb->lcd_putsxy(3, 46, "[M-RIGHT] + Level"); |
920 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | ||
921 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
922 | rb->lcd_putsxy(3, 6, "[STOP] To Stop"); | ||
923 | rb->lcd_putsxy(3, 16, "[PLAY] To Undo"); | ||
924 | rb->lcd_putsxy(3, 26, "[REC] - Level"); | ||
925 | rb->lcd_putsxy(3, 36, "[SELECT] Same Level"); | ||
926 | rb->lcd_putsxy(3, 46, "[MODE] + Level"); | ||
896 | #endif | 927 | #endif |
897 | 928 | ||
898 | rb->lcd_update(); | 929 | rb->lcd_update(); |