summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/bitmaps/native/SOURCES39
-rw-r--r--apps/plugins/bitmaps/native/snake2_bottom.160x128x16.bmpbin0 -> 4856 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_bottom.160x128x2.bmpbin0 -> 918 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_bottom.176x132x16.bmpbin0 -> 5336 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_bottom.220x176x16.bmpbin0 -> 6654 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_bottom.240x320x16.bmpbin0 -> 7256 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_bottom.320x240x16.bmpbin0 -> 9656 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header1.160x128x16.bmpbin0 -> 18296 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header1.160x128x2.bmpbin0 -> 3158 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header1.176x132x16.bmpbin0 -> 20120 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header1.220x176x16.bmpbin0 -> 25136 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header1.240x320x16.bmpbin0 -> 27416 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header1.320x240x16.bmpbin0 -> 36536 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header2.160x128x16.bmpbin0 -> 18296 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header2.160x128x2.bmpbin0 -> 3158 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header2.176x132x16.bmpbin0 -> 20120 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header2.220x176x16.bmpbin0 -> 25136 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header2.240x320x16.bmpbin0 -> 27416 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_header2.320x240x16.bmpbin0 -> 36536 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_left.160x128x16.bmpbin0 -> 2616 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_left.160x128x2.bmpbin0 -> 758 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_left.176x132x16.bmpbin0 -> 2744 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_left.220x176x16.bmpbin0 -> 4150 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_left.240x320x16.bmpbin0 -> 3894 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_left.320x240x16.bmpbin0 -> 6200 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_right.160x128x16.bmpbin0 -> 2616 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_right.160x128x2.bmpbin0 -> 758 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_right.176x132x16.bmpbin0 -> 2744 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_right.220x176x16.bmpbin0 -> 4150 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_right.240x320x16.bmpbin0 -> 3894 bytes
-rw-r--r--apps/plugins/bitmaps/native/snake2_right.320x240x16.bmpbin0 -> 6200 bytes
-rw-r--r--apps/plugins/snake2.c748
-rw-r--r--docs/CREDITS1
33 files changed, 334 insertions, 454 deletions
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index 0718ffab86..d019cb8924 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -61,6 +61,45 @@ jewels.220x176x16.bmp
jewels.320x240x16.bmp
#endif
+/* Snake2 */
+#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16)
+snake2_header1.320x240x16.bmp
+snake2_header2.320x240x16.bmp
+snake2_left.320x240x16.bmp
+snake2_right.320x240x16.bmp
+snake2_bottom.320x240x16.bmp
+#elif (LCD_WIDTH >= 240) && (LCD_HEIGHT >= 192) && (LCD_DEPTH >= 16)
+snake2_header1.240x320x16.bmp
+snake2_header2.240x320x16.bmp
+snake2_left.240x320x16.bmp
+snake2_right.240x320x16.bmp
+snake2_bottom.240x320x16.bmp
+#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH >= 16)
+snake2_header1.220x176x16.bmp
+snake2_header2.220x176x16.bmp
+snake2_left.220x176x16.bmp
+snake2_right.220x176x16.bmp
+snake2_bottom.220x176x16.bmp
+#elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH >= 16)
+snake2_header1.176x132x16.bmp
+snake2_header2.176x132x16.bmp
+snake2_left.176x132x16.bmp
+snake2_right.176x132x16.bmp
+snake2_bottom.176x132x16.bmp
+#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >= 16)
+snake2_header1.160x128x16.bmp
+snake2_header2.160x128x16.bmp
+snake2_left.160x128x16.bmp
+snake2_right.160x128x16.bmp
+snake2_bottom.160x128x16.bmp
+#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >= 1)
+snake2_header1.160x128x2.bmp
+snake2_header2.160x128x2.bmp
+snake2_left.160x128x2.bmp
+snake2_right.160x128x2.bmp
+snake2_bottom.160x128x2.bmp
+#endif
+
/* Solitaire */
#ifdef HAVE_LCD_COLOR
#if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
diff --git a/apps/plugins/bitmaps/native/snake2_bottom.160x128x16.bmp b/apps/plugins/bitmaps/native/snake2_bottom.160x128x16.bmp
new file mode 100644
index 0000000000..9a4bda83eb
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_bottom.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_bottom.160x128x2.bmp b/apps/plugins/bitmaps/native/snake2_bottom.160x128x2.bmp
new file mode 100644
index 0000000000..9b03cd0791
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_bottom.160x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_bottom.176x132x16.bmp b/apps/plugins/bitmaps/native/snake2_bottom.176x132x16.bmp
new file mode 100644
index 0000000000..6849276b0c
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_bottom.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_bottom.220x176x16.bmp b/apps/plugins/bitmaps/native/snake2_bottom.220x176x16.bmp
new file mode 100644
index 0000000000..51af40dd83
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_bottom.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_bottom.240x320x16.bmp b/apps/plugins/bitmaps/native/snake2_bottom.240x320x16.bmp
new file mode 100644
index 0000000000..dae961a5e3
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_bottom.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_bottom.320x240x16.bmp b/apps/plugins/bitmaps/native/snake2_bottom.320x240x16.bmp
new file mode 100644
index 0000000000..8eaa4ed3fb
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_bottom.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header1.160x128x16.bmp b/apps/plugins/bitmaps/native/snake2_header1.160x128x16.bmp
new file mode 100644
index 0000000000..8950429641
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header1.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header1.160x128x2.bmp b/apps/plugins/bitmaps/native/snake2_header1.160x128x2.bmp
new file mode 100644
index 0000000000..5174f5ce02
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header1.160x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header1.176x132x16.bmp b/apps/plugins/bitmaps/native/snake2_header1.176x132x16.bmp
new file mode 100644
index 0000000000..3f38d11129
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header1.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header1.220x176x16.bmp b/apps/plugins/bitmaps/native/snake2_header1.220x176x16.bmp
new file mode 100644
index 0000000000..6e13c6b00d
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header1.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header1.240x320x16.bmp b/apps/plugins/bitmaps/native/snake2_header1.240x320x16.bmp
new file mode 100644
index 0000000000..d1b87728dd
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header1.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header1.320x240x16.bmp b/apps/plugins/bitmaps/native/snake2_header1.320x240x16.bmp
new file mode 100644
index 0000000000..54c0026219
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header1.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header2.160x128x16.bmp b/apps/plugins/bitmaps/native/snake2_header2.160x128x16.bmp
new file mode 100644
index 0000000000..2d1c318799
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header2.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header2.160x128x2.bmp b/apps/plugins/bitmaps/native/snake2_header2.160x128x2.bmp
new file mode 100644
index 0000000000..2b5e726d52
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header2.160x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header2.176x132x16.bmp b/apps/plugins/bitmaps/native/snake2_header2.176x132x16.bmp
new file mode 100644
index 0000000000..73b031be8d
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header2.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header2.220x176x16.bmp b/apps/plugins/bitmaps/native/snake2_header2.220x176x16.bmp
new file mode 100644
index 0000000000..3f71108eb7
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header2.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header2.240x320x16.bmp b/apps/plugins/bitmaps/native/snake2_header2.240x320x16.bmp
new file mode 100644
index 0000000000..32e40227f1
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header2.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_header2.320x240x16.bmp b/apps/plugins/bitmaps/native/snake2_header2.320x240x16.bmp
new file mode 100644
index 0000000000..a7b9fe82cd
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_header2.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_left.160x128x16.bmp b/apps/plugins/bitmaps/native/snake2_left.160x128x16.bmp
new file mode 100644
index 0000000000..1f35a950f6
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_left.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_left.160x128x2.bmp b/apps/plugins/bitmaps/native/snake2_left.160x128x2.bmp
new file mode 100644
index 0000000000..32078ee995
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_left.160x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_left.176x132x16.bmp b/apps/plugins/bitmaps/native/snake2_left.176x132x16.bmp
new file mode 100644
index 0000000000..3cf57d9d4d
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_left.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_left.220x176x16.bmp b/apps/plugins/bitmaps/native/snake2_left.220x176x16.bmp
new file mode 100644
index 0000000000..aacb0dd9e2
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_left.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_left.240x320x16.bmp b/apps/plugins/bitmaps/native/snake2_left.240x320x16.bmp
new file mode 100644
index 0000000000..a3a78a6b63
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_left.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_left.320x240x16.bmp b/apps/plugins/bitmaps/native/snake2_left.320x240x16.bmp
new file mode 100644
index 0000000000..1a2eac252f
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_left.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_right.160x128x16.bmp b/apps/plugins/bitmaps/native/snake2_right.160x128x16.bmp
new file mode 100644
index 0000000000..ccedcbde39
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_right.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_right.160x128x2.bmp b/apps/plugins/bitmaps/native/snake2_right.160x128x2.bmp
new file mode 100644
index 0000000000..53361d7014
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_right.160x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_right.176x132x16.bmp b/apps/plugins/bitmaps/native/snake2_right.176x132x16.bmp
new file mode 100644
index 0000000000..7a6a01af49
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_right.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_right.220x176x16.bmp b/apps/plugins/bitmaps/native/snake2_right.220x176x16.bmp
new file mode 100644
index 0000000000..a7f60aba64
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_right.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_right.240x320x16.bmp b/apps/plugins/bitmaps/native/snake2_right.240x320x16.bmp
new file mode 100644
index 0000000000..8fa2d95270
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_right.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/snake2_right.320x240x16.bmp b/apps/plugins/bitmaps/native/snake2_right.320x240x16.bmp
new file mode 100644
index 0000000000..9fd9884195
--- /dev/null
+++ b/apps/plugins/bitmaps/native/snake2_right.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c
index da83c00f7d..1cfbdf972b 100644
--- a/apps/plugins/snake2.c
+++ b/apps/plugins/snake2.c
@@ -20,7 +20,7 @@
/*
Snake2!
-Board consists of a WIDTHxHEIGHT grid. If board element is 0 then nothing is
+Board consists of a WIDTHxHEIGHT grid. If board element is 0 then nothing is
there otherwise it is part of the snake or a wall.
Head and Tail are stored
@@ -35,16 +35,106 @@ PLUGIN_HEADER
#define WIDTH 28
#define HEIGHT 16
-#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
- #define MULTIPLIER 5 /*Modifier for porting on other screens*/
+#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240)
+ #define MULTIPLIER 10 /*Modifier for porting on other screens*/
+ #define MODIFIER_1 10
+ #define MODIFIER_2 8
+ #define CENTER_X 20
+ #define CENTER_Y 55
+ #define TOP_X1 34 /* x-coord of the upperleft item (game type) */
+ #define TOP_X2 281 /* x-coord of the upperright item (maze type) */
+ #define TOP_X3 42 /* x-coord of the lowerleft item (speed) */
+ #define TOP_X4 274 /* x-coord of the lowerright item (hi-score) */
+ #define TOP_Y1 4 /* y-coord of the top row of items */
+ #define TOP_Y2 25 /* y-coord of the bottom row of items */
+ #define BMPHEIGHT_snake2_header 38
+ #define BMPWIDTH_snake2_header 320
+ #define BMPHEIGHT_snake2_right 192
+ #define BMPWIDTH_snake2_right 10
+ #define BMPHEIGHT_snake2_left 192
+ #define BMPWIDTH_snake2_left 10
+ #define BMPHEIGHT_snake2_bottom 10
+ #define BMPWIDTH_snake2_bottom 320
+#elif (LCD_WIDTH >= 240) && (LCD_HEIGHT >= 168)
+ #define MULTIPLIER 8
+ #define MODIFIER_1 8
+ #define MODIFIER_2 6
+ #define CENTER_X 8
+ #define CENTER_Y 34
+ #define TOP_X1 34
+ #define TOP_X2 201
+ #define TOP_X3 42
+ #define TOP_X4 194
+ #define TOP_Y1 4
+ #define TOP_Y2 25
+ #define BMPHEIGHT_snake2_header 38
+ #define BMPWIDTH_snake2_header 240
+ #define BMPHEIGHT_snake2_right 120
+ #define BMPWIDTH_snake2_right 10
+ #define BMPHEIGHT_snake2_left 120
+ #define BMPWIDTH_snake2_left 10
+ #define BMPHEIGHT_snake2_bottom 10
+ #define BMPWIDTH_snake2_bottom 240
+#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
+ #define MULTIPLIER 7
+ #define MODIFIER_1 7
+ #define MODIFIER_2 5
+ #define CENTER_X 12
+ #define CENTER_Y 46
+ #define TOP_X1 34
+ #define TOP_X2 181
+ #define TOP_X3 42
+ #define TOP_X4 174
+ #define TOP_Y1 4
+ #define TOP_Y2 25
+ #define BMPHEIGHT_snake2_header 38
+ #define BMPWIDTH_snake2_header 220
+ #define BMPHEIGHT_snake2_right 128
+ #define BMPWIDTH_snake2_right 10
+ #define BMPHEIGHT_snake2_left 128
+ #define BMPWIDTH_snake2_left 10
+ #define BMPHEIGHT_snake2_bottom 10
+ #define BMPWIDTH_snake2_bottom 220
+#elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132)
+ #define MULTIPLIER 5
+ #define MODIFIER_1 5
+ #define MODIFIER_2 3
+ #define CENTER_X 18
+ #define CENTER_Y 40
+ #define TOP_X1 34
+ #define TOP_X2 137
+ #define TOP_X3 42
+ #define TOP_X4 130
+ #define TOP_Y1 4
+ #define TOP_Y2 25
+ #define BMPHEIGHT_snake2_header 38
+ #define BMPWIDTH_snake2_header 176
+ #define BMPHEIGHT_snake2_right 84
+ #define BMPWIDTH_snake2_right 10
+ #define BMPHEIGHT_snake2_left 84
+ #define BMPWIDTH_snake2_left 10
+ #define BMPHEIGHT_snake2_bottom 10
+ #define BMPWIDTH_snake2_bottom 176
+#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128)
+ #define MULTIPLIER 5
#define MODIFIER_1 5
#define MODIFIER_2 3
#define CENTER_X 10
#define CENTER_Y 38
- #define BMPHEIGHT_snakebmp 128
- #define BMPWIDTH_snakebmp 160
- #define BMPHEIGHT_snakeupbmp 36
- #define BMPWIDTH_snakeupbmp 160
+ #define TOP_X1 34
+ #define TOP_X2 121
+ #define TOP_X3 42
+ #define TOP_X4 114
+ #define TOP_Y1 4
+ #define TOP_Y2 25
+ #define BMPHEIGHT_snake2_header 38
+ #define BMPWIDTH_snake2_header 160
+ #define BMPHEIGHT_snake2_right 80
+ #define BMPWIDTH_snake2_right 10
+ #define BMPHEIGHT_snake2_left 80
+ #define BMPWIDTH_snake2_left 10
+ #define BMPHEIGHT_snake2_bottom 10
+ #define BMPWIDTH_snake2_bottom 160
#else
#define MULTIPLIER 4
#define MODIFIER_1 4
@@ -54,21 +144,18 @@ PLUGIN_HEADER
#endif
-
-
-
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define SNAKE2_UP BUTTON_UP
#define SNAKE2_DOWN BUTTON_DOWN
#define SNAKE2_QUIT BUTTON_OFF
#define SNAKE2_LEVEL_UP BUTTON_UP
-#define SNAKE2_LEVEL_UP2 BUTTON_RIGHT
#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
-#define SNAKE2_LEVEL_DOWN2 BUTTON_LEFT
-#define SNAKE2_SELECT_MAZE BUTTON_F1
+#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
+#define SNAKE2_MAZE_LAST BUTTON_LEFT
#define SNAKE2_SELECT_TYPE BUTTON_F3
#define SNAKE2_PLAYPAUSE BUTTON_PLAY
+#define SNAKE2_PLAYPAUSE_TEXT "Play"
#elif CONFIG_KEYPAD == ONDIO_PAD
#define SNAKE2_UP BUTTON_UP
@@ -76,9 +163,10 @@ PLUGIN_HEADER
#define SNAKE2_QUIT BUTTON_OFF
#define SNAKE2_LEVEL_UP BUTTON_UP
#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
-#define SNAKE2_SELECT_MAZE BUTTON_LEFT
-#define SNAKE2_SELECT_TYPE BUTTON_RIGHT
+#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
+#define SNAKE2_SELECT_TYPE BUTTON_LEFT
#define SNAKE2_PLAYPAUSE BUTTON_MENU
+#define SNAKE2_PLAYPAUSE_TEXT "Menu"
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_PAD)
@@ -86,12 +174,12 @@ PLUGIN_HEADER
#define SNAKE2_DOWN BUTTON_DOWN
#define SNAKE2_QUIT BUTTON_OFF
#define SNAKE2_LEVEL_UP BUTTON_UP
-#define SNAKE2_LEVEL_UP2 BUTTON_RIGHT
#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
-#define SNAKE2_LEVEL_DOWN2 BUTTON_LEFT
-#define SNAKE2_SELECT_MAZE BUTTON_REC
+#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
+#define SNAKE2_MAZE_LAST BUTTON_LEFT
#define SNAKE2_SELECT_TYPE BUTTON_MODE
#define SNAKE2_PLAYPAUSE BUTTON_ON
+#define SNAKE2_PLAYPAUSE_TEXT "Play"
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_3G_PAD)
@@ -100,31 +188,35 @@ PLUGIN_HEADER
#define SNAKE2_QUIT (BUTTON_SELECT | BUTTON_MENU)
#define SNAKE2_LEVEL_UP BUTTON_SCROLL_FWD
#define SNAKE2_LEVEL_DOWN BUTTON_SCROLL_BACK
-#define SNAKE2_SELECT_MAZE BUTTON_LEFT
-#define SNAKE2_SELECT_TYPE BUTTON_RIGHT
+#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
+#define SNAKE2_MAZE_LAST BUTTON_LEFT
+#define SNAKE2_SELECT_TYPE BUTTON_PLAY
#define SNAKE2_PLAYPAUSE BUTTON_SELECT
+#define SNAKE2_PLAYPAUSE_TEXT "Select"
#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
#define SNAKE2_UP BUTTON_UP
#define SNAKE2_DOWN BUTTON_DOWN
#define SNAKE2_QUIT BUTTON_POWER
-#define SNAKE2_LEVEL_UP BUTTON_REC
-#define SNAKE2_LEVEL_DOWN BUTTON_PLAY
-#define SNAKE2_SELECT_MAZE BUTTON_LEFT
-#define SNAKE2_SELECT_TYPE BUTTON_RIGHT
+#define SNAKE2_LEVEL_UP BUTTON_UP
+#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
+#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
+#define SNAKE2_MAZE_LAST BUTTON_LEFT
+#define SNAKE2_SELECT_TYPE BUTTON_PLAY
#define SNAKE2_PLAYPAUSE BUTTON_SELECT
+#define SNAKE2_PLAYPAUSE_TEXT "Select"
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
#define SNAKE2_UP BUTTON_UP
#define SNAKE2_DOWN BUTTON_DOWN
#define SNAKE2_QUIT BUTTON_A
#define SNAKE2_LEVEL_UP BUTTON_UP
-#define SNAKE2_LEVEL_UP2 BUTTON_RIGHT
#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
-#define SNAKE2_LEVEL_DOWN2 BUTTON_LEFT
-#define SNAKE2_SELECT_MAZE BUTTON_POWER
+#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
+#define SNAKE2_MAZE_LAST BUTTON_LEFT
#define SNAKE2_SELECT_TYPE BUTTON_MENU
#define SNAKE2_PLAYPAUSE BUTTON_SELECT
+#define SNAKE2_PLAYPAUSE_TEXT "Select"
#else
#error "lacks keymapping"
@@ -136,7 +228,7 @@ static char (*level_cache)[HEIGHT][WIDTH];
/*Board itself - 2D int array*/
static int board[WIDTH][HEIGHT];
/*
- Buffer for sorting movement (in case user presses two movements during a
+ Buffer for sorting movement (in case user presses two movements during a
single frame
*/
static int ardirectionbuffer[2];
@@ -148,308 +240,38 @@ static int dir;
static int frames;
static int apple;
static int level = 4, speed = 5,dead = 0, quit = 0;
-static int sillydir = 0, num_levels = 0;
-static int level_from_file = 1;
+static int sillydir = 0, num_levels = 0;
+static int level_from_file = 0;
static struct plugin_api* rb;
static int headx, heady, tailx, taily, applecountdown = 5;
static int game_type = 0;
static int num_apples_to_get=1;
static int num_apples_to_got=0;
-static int game_b_level=1;
+static int game_b_level=0;
static int applecount=0;
static char phscore[30];
-
-#ifdef BMPHEIGHT_snakebmp
-const unsigned char snakebmp[] = {
-0x00, 0x00, 0x00, 0xe0, 0x20, 0xa0, 0xa0, 0x00, 0xe0, 0xa0, 0xa0, 0xe0, 0x00,
-0xe0, 0x40, 0x80, 0x40, 0xe0, 0x00, 0xe0, 0xa0, 0xa0, 0xa0, 0x00, 0x00, 0xf0,
-0x08, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
-0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x04, 0x08, 0xf0, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80,
-0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80,
-0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x08, 0x04, 0x02, 0x02, 0x02, 0x02,
-0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
-0x02, 0x04, 0x08, 0xf0, 0x00, 0x00, 0xe0, 0x40, 0x80, 0x40, 0xe0, 0x00, 0xe0,
-0xa0, 0xa0, 0xe0, 0x00, 0x20, 0xa0, 0xa0, 0x60, 0x00, 0xe0, 0xa0, 0xa0, 0xa0,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
-0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0xc3, 0x22, 0x22, 0x22, 0xc0, 0x00, 0x07,
-0x08, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x08, 0x07, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x27, 0x4c, 0x4c, 0x79, 0x3b,
-0x00, 0x40, 0x7f, 0x47, 0x0e, 0x1c, 0x38, 0x7f, 0x00, 0x40, 0x70, 0x5c, 0x13,
-0x13, 0x5f, 0x7c, 0x70, 0x40, 0x40, 0x7f, 0x7f, 0x48, 0x0c, 0x3e, 0x79, 0x60,
-0x40, 0x40, 0x7f, 0x7f, 0x44, 0x4e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x20, 0x20, 0x20, 0x20,
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
-0x20, 0x10, 0x08, 0x07, 0x00, 0xe0, 0x13, 0x10, 0x10, 0xe0, 0x03, 0x00, 0x03,
-0x00, 0x00, 0x03, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x03, 0x02, 0x02, 0x02,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
-0x80, 0x98, 0xa4, 0xa4, 0x98, 0x80, 0x81, 0x02, 0x82, 0x82, 0x01, 0x00, 0x00,
-0x00, 0x17, 0x15, 0x15, 0x1d, 0x80, 0x5f, 0x45, 0x45, 0x42, 0x40, 0x5f, 0x55,
-0x55, 0x55, 0x40, 0x5f, 0x55, 0x55, 0x55, 0x40, 0x5f, 0x51, 0x51, 0x4e, 0x40,
-0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0, 0xf0, 0x10,
-0x00, 0x10, 0xf0, 0xf0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x04, 0x1f, 0x80, 0x51,
-0x5f, 0x51, 0x44, 0x44, 0x44, 0x40, 0x57, 0x55, 0x55, 0x5d, 0x40, 0x5f, 0x51,
-0x51, 0x51, 0x40, 0x5f, 0x51, 0x51, 0x5f, 0x40, 0x5f, 0x45, 0x4d, 0x92, 0x00,
-0x1f, 0x15, 0x15, 0x15, 0x00, 0x00, 0x01, 0x81, 0x81, 0x00, 0x98, 0xa4, 0xa4,
-0x98, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x30, 0xf8, 0x8c, 0x1a, 0x7f, 0xc0,
-0x90, 0x60, 0xc7, 0xce, 0x4c, 0x8f, 0x00, 0x47, 0x0e, 0x1e, 0x57, 0x90, 0xe0,
-0x00, 0x10, 0x28, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0f, 0x0f, 0x08,
-0x00, 0x08, 0x0f, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xc6, 0x28, 0x10, 0x00, 0xe0, 0x90, 0x57, 0x1e, 0x0e, 0x47, 0x00, 0x8f, 0x4c,
-0xce, 0xc7, 0x60, 0x90, 0xc0, 0x7f, 0x1a, 0x8c, 0xf8, 0x30, 0x20, 0xc0, 0x00,
-0x00, 0x00, 0x00, 0x00,
-0x80, 0xf0, 0x9c, 0x16, 0x57, 0x4d, 0xe9, 0xa1, 0xf5, 0xfc, 0x36, 0x3b, 0x39,
-0x37, 0x33, 0x31, 0x30, 0x31, 0x32, 0x35, 0x35, 0x35, 0x35, 0x33, 0x30, 0x30,
-0x30, 0x30, 0x30, 0x30, 0x31, 0x32, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
-0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
-0x34, 0x34, 0x32, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
-0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x32, 0x34,
-0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
-0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x32, 0x31,
-0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x35, 0x35, 0x35, 0x35, 0x32, 0x31,
-0x30, 0x31, 0x33, 0x37, 0x39, 0x3b, 0x36, 0xfc, 0xf5, 0xa1, 0xe9, 0x4d, 0x57,
-0x16, 0x9c, 0xf0, 0x80,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
-0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
-0x25, 0xad, 0x88, 0xff,
-0x0f, 0x1c, 0x39, 0x6d, 0x77, 0xda, 0x8c, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3,
-0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e,
-0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e,
-0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e,
-0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3,
-0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8,
-0x8e, 0xb8, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8,
-0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3,
-0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e,
-0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e,
-0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e,
-0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8c, 0x5a, 0x77,
-0x6d, 0x39, 0x1c, 0x0f,
-
-};
+#if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128)
+#ifdef HAVE_LCD_COLOR
+extern const unsigned short snake2_header1[];
+extern const unsigned short snake2_header2[];
+extern const unsigned short snake2_left[];
+extern const unsigned short snake2_right[];
+extern const unsigned short snake2_bottom[];
+#else
+extern const unsigned char snake2_header1[];
+extern const unsigned char snake2_header2[];
+extern const unsigned char snake2_left[];
+extern const unsigned char snake2_right[];
+extern const unsigned char snake2_bottom[];
#endif
-
-#ifdef BMPHEIGHT_snakeupbmp
-const unsigned char snakeupbmp[] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
-0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80,
-0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xc0, 0x40, 0x40, 0xc0, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0xc0, 0x40, 0x40,
-0x80, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x00, 0xc0,
-0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x27, 0x4c, 0x4c, 0x79,
-0x3b, 0x00, 0x40, 0x7f, 0x47, 0x0e, 0x1c, 0x38, 0x7f, 0x00, 0x40, 0x70, 0x5c,
-0x13, 0x13, 0x5f, 0x7c, 0x70, 0x40, 0x40, 0x7f, 0x7f, 0x48, 0x0c, 0x3e, 0x79,
-0x60, 0x40, 0x40, 0x7f, 0x7f, 0x44, 0x4e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x00, 0xc0,
-0x40, 0x40, 0xc0, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0xc0, 0x40, 0x40, 0x40,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
-0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00,
-0x07, 0x01, 0x01, 0x07, 0x00, 0x87, 0x41, 0x41, 0x40, 0x40, 0x47, 0x41, 0x41,
-0x40, 0x40, 0x47, 0x44, 0x44, 0x44, 0x40, 0x47, 0x45, 0x45, 0x45, 0x40, 0x45,
-0x45, 0x45, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0, 0xf0,
-0x10, 0x00, 0x10, 0xf0, 0xf0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40,
-0x40, 0x40, 0x45, 0x45, 0x45, 0x47, 0x40, 0x47, 0x44, 0x44, 0x44, 0x40, 0x47,
-0x44, 0x44, 0x47, 0x40, 0x47, 0x41, 0x43, 0x44, 0x40, 0x47, 0x45, 0x85, 0x05,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80,
-0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x30, 0xf8, 0x8c, 0x1a, 0x7f, 0xc0,
-0x90, 0x60, 0xc7, 0xce, 0x4c, 0x8f, 0x00, 0x47, 0x0e, 0x1e, 0x57, 0x90, 0xe0,
-0x00, 0x10, 0x28, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0f, 0x0f,
-0x08, 0x00, 0x08, 0x0f, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-0xc6, 0x28, 0x10, 0x00, 0xe0, 0x90, 0x57, 0x1e, 0x0e, 0x47, 0x00, 0x8f, 0x4c,
-0xce, 0xc7, 0x60, 0x90, 0xc0, 0x7f, 0x1a, 0x8c, 0xf8, 0x30, 0x20, 0xc0, 0x00,
-0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0c, 0x06, 0x07, 0x0d, 0x09, 0x01, 0x05, 0x0c, 0x06, 0x0b, 0x09,
-0x07, 0x03, 0x01, 0x00, 0x01, 0x02, 0x05, 0x05, 0x05, 0x05, 0x03, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04,
-0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
-0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02, 0x01,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x05, 0x05, 0x05, 0x02, 0x01,
-0x00, 0x01, 0x03, 0x07, 0x09, 0x0b, 0x06, 0x0c, 0x05, 0x01, 0x09, 0x0d, 0x07,
-0x06, 0x0c, 0x00, 0x00,
-
-};
#endif
-#define NORTH 1
-#define EAST 2
-#define SOUTH 4
-#define WEST 8
-#define HEAD 16
+#define NORTH 1
+#define EAST 2
+#define SOUTH 4
+#define WEST 8
+#define HEAD 16
#define EAST_NORTH 32
#define EAST_SOUTH 64
@@ -478,7 +300,7 @@ int load_all_levels(void)
max_levels = size / (HEIGHT*WIDTH);
num_levels = 0;
-
+
/* open file */
if ((fd = rb->open(LEVELS_FILE, O_RDONLY)) < 0)
{
@@ -532,8 +354,8 @@ void iohiscore(void)
rb->fdprintf(fd, "%d\n", hiscore);
}
else
- hiscore = compare;
-
+ hiscore = compare;
+
rb->close(fd);
}
@@ -545,9 +367,9 @@ void clear_board( void)
{
int x,y;
- for (x = 0; x < WIDTH; x++)
+ for (x = 0; x < WIDTH; x++)
{
- for (y = 0; y < HEIGHT; y++)
+ for (y = 0; y < HEIGHT; y++)
{
board[x][y] = 0;
}
@@ -606,7 +428,7 @@ void get_direction( void )
}
/*
-** Sets the direction
+** Sets the direction
*/
void set_direction(int newdir)
{
@@ -640,7 +462,7 @@ void new_level(int level)
tailx = headx - 4;
taily = heady;
applecountdown = 0;
- /*Create a small snake to start off with*/
+ /*Create a small snake to start off with*/
board[headx][heady] = dir;
board[headx-1][heady] = dir;
board[headx-2][heady] = dir;
@@ -669,21 +491,18 @@ void draw_apple( void )
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
char pscore[5], counter[4];
- rb->lcd_set_drawmode(DRMODE_FG);
- rb->lcd_mono_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp);
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
- rb->lcd_set_drawmode(DRMODE_FG);
- rb->lcd_mono_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
- rb->lcd_set_drawmode(DRMODE_SOLID);
+ rb->lcd_bitmap(snake2_header2,0,0,BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header);
+ rb->lcd_bitmap(snake2_left,0,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_left, BMPHEIGHT_snake2_left);
+ rb->lcd_bitmap(snake2_right,LCD_WIDTH-BMPWIDTH_snake2_right,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_right, BMPHEIGHT_snake2_right);
+ rb->lcd_bitmap(snake2_bottom,0,BMPHEIGHT_snake2_header+BMPHEIGHT_snake2_left,BMPWIDTH_snake2_bottom, BMPHEIGHT_snake2_bottom);
rb->snprintf(counter,sizeof(counter),"%d",applecount);
rb->lcd_getstringsize(counter,&strwdt,&strhgt);
- rb->lcd_putsxy(42-strwdt/2,25,counter);
+ rb->lcd_putsxy(TOP_X3-strwdt/2,TOP_Y2,counter);
rb->snprintf(pscore,sizeof(pscore),"%d",score);
rb->lcd_getstringsize(pscore,&strwdt,&strhgt);
- rb->lcd_putsxy(116-strwdt/2,25,pscore);
+ rb->lcd_putsxy(TOP_X4-strwdt/2,TOP_Y2,pscore);
#endif
if (!apple)
@@ -821,7 +640,7 @@ void draw_s_to_w_bit(int x, int y)
void draw_boundary ( void )
{
int x, y;
-
+
/*TODO: Load levels from file!*/
/*top and bottom line*/
@@ -830,7 +649,7 @@ void draw_boundary ( void )
board[x][0] = EAST;
board[x][HEIGHT-1] = WEST;
}
-
+
/*left and right lines*/
for(y=0; y < HEIGHT; y++)
{
@@ -851,13 +670,12 @@ void draw_boundary ( void )
void redraw (void)
{
int x,y;
- rb->lcd_clear_display();
-
- for (x = 0; x < WIDTH; x++)
+
+ for (x = 0; x < WIDTH; x++)
{
- for (y = 0; y < HEIGHT; y++)
+ for (y = 0; y < HEIGHT; y++)
{
- switch (board[x][y])
+ switch (board[x][y])
{
case -1:
rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1,CENTER_Y+y*MULTIPLIER,MODIFIER_2,MODIFIER_1);
@@ -865,25 +683,23 @@ void redraw (void)
break;
case 0:
break;
-
+
case NORTH:
case SOUTH:
draw_vertical_bit(x,y);
break;
-
+
case EAST:
case WEST:
draw_horizontal_bit(x,y);
break;
-
+
default:
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER,CENTER_Y+y*MULTIPLIER,MODIFIER_1,MODIFIER_1);
break;
}
}
}
- rb->lcd_update();
-
}
/*
@@ -905,7 +721,7 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
case(NORTH):
draw_vertical_bit(x,y);
break;
-
+
case(EAST):
draw_e_to_n_bit(x,y);
break;
@@ -922,8 +738,8 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
case(WEST):
case(EAST):
draw_horizontal_bit(x,y);
- break;
-
+ break;
+
case(NORTH):
draw_n_to_e_bit(x,y);
break;
@@ -941,7 +757,7 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
case(NORTH):
draw_vertical_bit(x,y);
break;
-
+
case(EAST):
draw_e_to_s_bit(x,y);
break;
@@ -952,13 +768,13 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
}
break;
- case(WEST):
+ case(WEST):
switch(previousbit)
{
case(EAST):
- case(WEST):
+ case(WEST):
draw_horizontal_bit(x,y);
- break;
+ break;
case(SOUTH):
draw_s_to_w_bit(x,y);
@@ -977,50 +793,53 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
*/
void die (void)
{
- int n=100;
- int count;
- char pscore[18];
- /*Flashy death sequence (flashy as in 'flashes')*/
- for(count=0;count<24;count++)
- {
- rb->sleep(HZ/n);
- rb->lcd_clear_display();
- draw_apple();
- rb->lcd_update();
+ int button;
+ bool done=false;
+ char pscore[20];
+
+ rb->splash(HZ*2, true, "Oops!");
- rb->sleep(HZ/n);
- redraw();
- rb->lcd_update();
- }
-
- rb->lcd_clear_display();
- draw_apple();
- rb->lcd_update();
rb->lcd_clear_display();
-
+
applecount=0;
- rb->lcd_getstringsize("Dead",&strwdt,&strhgt);
- rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt,"Dead");
-
- rb->snprintf(pscore,sizeof(pscore),"Your Score %d",score);
+ rb->lcd_getstringsize("You died!",&strwdt,&strhgt);
+ rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt,"You died!");
+
+ rb->snprintf(pscore,sizeof(pscore),"Your score: %d",score);
rb->lcd_getstringsize(pscore,&strwdt,&strhgt);
rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 2 + 2,pscore);
if (score>hiscore)
{
hiscore=score;
- rb->lcd_getstringsize("New High Score!",&strwdt,&strhgt);
- rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 4 + 2,"New High Score!");
+ rb->lcd_getstringsize("New high score!",&strwdt,&strhgt);
+ rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 4 + 2,"New high score!");
}
- else
+ else
{
- rb->snprintf(phscore,sizeof(phscore),"High Score: %d",hiscore);
+ rb->snprintf(phscore,sizeof(phscore),"High score: %d",hiscore);
rb->lcd_getstringsize(phscore,&strwdt,&strhgt);
- rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 6,phscore);
+ rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 5,phscore);
}
+
+ rb->snprintf(phscore,sizeof(phscore),"Press %s...",SNAKE2_PLAYPAUSE_TEXT);
+ rb->lcd_getstringsize(phscore,&strwdt,&strhgt);
+ rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 7,phscore);
+
rb->lcd_update();
- rb->sleep(3*HZ);
+
+ while(!done)
+ {
+ button=rb->button_get(true);
+ switch(button)
+ {
+ case SNAKE2_PLAYPAUSE:
+ done = true;
+ break;
+ }
+ }
+
dead=1;
}
@@ -1034,17 +853,17 @@ void collision ( int x, int y )
int bdeath=0;
- switch (board[x][y])
+ switch (board[x][y])
{
case 0:
- break;
+ break;
case -1:
score = score + (1 * level);
apple=0;
applecountdown=2;
applecount++;
-
+
if(game_type==1)
{
if(num_apples_to_get == num_apples_to_got)
@@ -1061,7 +880,9 @@ void collision ( int x, int y )
rb->splash(HZ, true, "Level Completed!");
rb->lcd_clear_display();
new_level(level_from_file);
+ rb->lcd_clear_display();
redraw();
+ rb->lcd_update();
}
else
num_apples_to_got++;
@@ -1086,7 +907,7 @@ void move( void )
/*this actually sets the dir variable.*/
get_direction();
/*draw head*/
- switch (dir)
+ switch (dir)
{
case (NORTH):
board[headx][heady]=NORTH;
@@ -1094,7 +915,7 @@ void move( void )
break;
case (EAST):
board[headx][heady]=EAST;
- headx++;
+ headx++;
break;
case (SOUTH):
board[headx][heady]=SOUTH;
@@ -1105,7 +926,7 @@ void move( void )
headx--;
break;
}
-
+
if(headx == WIDTH)
headx = 0;
else if(headx < 0)
@@ -1115,11 +936,11 @@ void move( void )
heady = 0;
else if(heady < 0)
heady = HEIGHT-1;
-
+
rb->lcd_fillrect(CENTER_X+headx*MULTIPLIER,CENTER_Y+heady*MULTIPLIER,MODIFIER_1,MODIFIER_1);
-
+
/*clear tail*/
- if(applecountdown <= 0)
+ if(applecountdown <= 0)
{
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
rb->lcd_fillrect(CENTER_X+tailx*MULTIPLIER,CENTER_Y+taily*MULTIPLIER,MODIFIER_1,MODIFIER_1);
@@ -1146,7 +967,7 @@ void move( void )
tailx--;
break;
}
-
+
if(tailx == WIDTH)
tailx = 0;
else if(tailx < 0)
@@ -1166,7 +987,7 @@ void frame (void)
int olddir, noldx, noldy, temp;
noldx = headx;
noldy = heady;
- olddir = 0;
+ olddir = 0;
switch(dir)
{
case(NORTH):
@@ -1174,7 +995,7 @@ void frame (void)
temp = 0;
else
temp = heady + 1;
-
+
olddir = board[headx][temp];
break;
@@ -1207,34 +1028,36 @@ void frame (void)
}
move();
-
+
/*
now redraw the bit that was
the tail, to something snake-like:
*/
- draw_snake_bit(dir, olddir, noldx, noldy);
-
+ draw_snake_bit(dir, olddir, noldx, noldy);
+
collision(headx, heady);
-
+
rb->lcd_update();
}
-void game_pause (void)
+void game_pause (void)
{
int button;
rb->lcd_clear_display();
rb->lcd_getstringsize("Paused",&strwdt,&strhgt);
rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,LCD_HEIGHT/2,"Paused");
-
+
rb->lcd_update();
- while (1)
+ while (1)
{
button = rb->button_get(true);
switch (button)
{
case SNAKE2_PLAYPAUSE:
+ rb->lcd_clear_display();
redraw();
+ rb->lcd_update();
rb->sleep(HZ/2);
return;
@@ -1249,21 +1072,23 @@ void game_pause (void)
}
}
-void game (void)
+void game (void)
{
int button;
+ rb->lcd_clear_display();
redraw();
+ rb->lcd_update();
/*main loop:*/
- while (1)
+ while (1)
{
- if(frames==5)
+ if(frames==5)
{
frame();
if(frames>0) frames=0;
}
frames++;
-
+
if(frames == 0)
{
die();
@@ -1279,24 +1104,24 @@ void game (void)
}
}
}
-
+
if (dead) return;
-
+
draw_apple();
-
+
rb->sleep(HZ/speed);
button = rb->button_get(false);
switch (button)
{
case SNAKE2_UP:
- case SNAKE2_UP | BUTTON_REPEAT:
+ case SNAKE2_UP | BUTTON_REPEAT:
if (dir != SOUTH) set_direction(NORTH);
break;
case BUTTON_RIGHT:
case BUTTON_RIGHT | BUTTON_REPEAT:
- if (dir != WEST) set_direction(EAST);
+ if (dir != WEST) set_direction(EAST);
break;
case SNAKE2_DOWN:
@@ -1328,7 +1153,7 @@ void game (void)
}
-void game_init(void)
+void game_init(void)
{
int button;
char plevel[30];
@@ -1340,41 +1165,42 @@ void game_init(void)
clear_board();
load_level( level_from_file );
-
- while (1)
- {
- rb->lcd_clear_display();
- redraw();
+ rb->lcd_clear_display();
+ redraw();
+ rb->lcd_update();
+ while (1)
+ {
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
- rb->lcd_set_drawmode(DRMODE_FG);
- rb->lcd_mono_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp);
- rb->lcd_set_drawmode(DRMODE_SOLID);
+ rb->lcd_bitmap(snake2_header1,0,0,BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header);
+ rb->lcd_bitmap(snake2_left,0,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_left, BMPHEIGHT_snake2_left);
+ rb->lcd_bitmap(snake2_right,LCD_WIDTH-BMPWIDTH_snake2_right,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_right, BMPHEIGHT_snake2_right);
+ rb->lcd_bitmap(snake2_bottom,0,BMPHEIGHT_snake2_header+BMPHEIGHT_snake2_left,BMPWIDTH_snake2_bottom, BMPHEIGHT_snake2_bottom);
rb->snprintf(plevel,sizeof(plevel),"%d",level);
rb->lcd_getstringsize(plevel,&strwdt,&strhgt);
- rb->lcd_putsxy(42-strwdt/2,25, plevel);
+ rb->lcd_putsxy(TOP_X3-strwdt/2,TOP_Y2, plevel);
rb->snprintf(plevel,sizeof(plevel),"%d",level_from_file);
rb->lcd_getstringsize(plevel,&strwdt,&strhgt);
- rb->lcd_putsxy(121-strwdt/2,4, plevel);
-
- if(game_type==0){
- rb->lcd_getstringsize("A",&strwdt,&strhgt);
- rb->lcd_putsxy(34,4,"A");
- }
- else{
- rb->lcd_getstringsize("B",&strwdt,&strhgt);
- rb->lcd_putsxy(34,4,"B");
+ rb->lcd_putsxy(TOP_X2-strwdt/2,TOP_Y1, plevel);
+
+ if(game_type==0){
+ rb->lcd_getstringsize("A",&strwdt,&strhgt);
+ rb->lcd_putsxy(TOP_X1,TOP_Y1,"A");
+ }
+ else{
+ rb->lcd_getstringsize("B",&strwdt,&strhgt);
+ rb->lcd_putsxy(TOP_X1,TOP_Y1,"B");
}
rb->snprintf(phscore,sizeof(phscore),"%d",hiscore);
rb->lcd_getstringsize(phscore,&strwdt,&strhgt);
- rb->lcd_putsxy(114-strwdt/2,25, phscore);
-
+ rb->lcd_putsxy(TOP_X4-strwdt/2,TOP_Y2, phscore);
+
#else
- rb->snprintf(plevel,sizeof(plevel),"Speed: %d",level);
+ rb->snprintf(plevel,sizeof(plevel),"Speed: %02d",level);
rb->lcd_getstringsize("Speed: 00",&strwdt,&strhgt);
rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt+4, plevel);
@@ -1385,7 +1211,7 @@ void game_init(void)
if(game_type==0){
rb->lcd_getstringsize("Game Type: A ",&strwdt,&strhgt);
rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt*3+4,"Game Type: A");
- }
+ }
else{
rb->lcd_getstringsize("Game Type: B ",&strwdt,&strhgt);
rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt*3+4,"Game Type: B");
@@ -1402,16 +1228,12 @@ void game_init(void)
switch (button)
{
case SNAKE2_LEVEL_UP:
-#ifdef SNAKE2_LEVEL_UP2
- case SNAKE2_LEVEL_UP2:
-#endif
- if (level<10)
+ case SNAKE2_LEVEL_UP|BUTTON_REPEAT:
+ if (level<10)
level+=1;
break;
case SNAKE2_LEVEL_DOWN:
-#ifdef SNAKE2_LEVEL_DOWN2
- case SNAKE2_LEVEL_DOWN2:
-#endif
+ case SNAKE2_LEVEL_DOWN|BUTTON_REPEAT:
if (level>1)
level-=1;
break;
@@ -1426,17 +1248,32 @@ void game_init(void)
case SNAKE2_SELECT_TYPE:
if(game_type==0)game_type=1; else game_type=0;
break;
- case SNAKE2_SELECT_MAZE:
-
- level_from_file++;
- if(level_from_file > num_levels)
- {
- level_from_file = 1;
- }
-
+ case SNAKE2_MAZE_NEXT:
+ rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(CENTER_X, CENTER_Y, CENTER_X+WIDTH*MULTIPLIER,
+ CENTER_Y+HEIGHT*MULTIPLIER);
+ rb->lcd_set_drawmode(DRMODE_SOLID);
+ if(level_from_file < num_levels)
+ level_from_file++;
+ else
+ level_from_file = 0;
+ load_level( level_from_file );
+ redraw();
+ break;
+#ifdef SNAKE2_MAZE_LAST
+ case SNAKE2_MAZE_LAST:
+ rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(CENTER_X, CENTER_Y, CENTER_X+WIDTH*MULTIPLIER,
+ CENTER_Y+HEIGHT*MULTIPLIER);
+ rb->lcd_set_drawmode(DRMODE_SOLID);
+ if(level_from_file > 0)
+ level_from_file--;
+ else
+ level_from_file = num_levels;
load_level( level_from_file );
-
+ redraw();
break;
+#endif
default:
if (rb->default_event_handler(button)==SYS_USB_CONNECTED) {
quit = 2;
@@ -1455,6 +1292,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* Lets use the default font */
rb->lcd_setfont(FONT_SYSFIXED);
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(LCD_WHITE);
+#endif
load_all_levels();
if (num_levels == 0) {
@@ -1466,19 +1306,19 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
while(quit==0)
{
- game_init();
+ game_init();
rb->lcd_clear_display();
frames=1;
-
+
if(quit==0)
{
init_snake();
-
+
/*Start Game:*/
game();
}
}
-
+
iohiscore();
return (quit==1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED;
}
diff --git a/docs/CREDITS b/docs/CREDITS
index 3f66170da8..732ab26e67 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -194,3 +194,4 @@ Dominik Riebeling
Alexander Bondar
Peter Cawley
Rani Hod
+Tom Ross