summaryrefslogtreecommitdiff
path: root/apps/plugins/snake2.c
diff options
context:
space:
mode:
authorZakk Roberts <midk@rockbox.org>2006-04-09 09:39:16 +0000
committerZakk Roberts <midk@rockbox.org>2006-04-09 09:39:16 +0000
commitd47e87e6ac3ddee0e45c16e24a22d9bc05c07bdd (patch)
treef80d8a7ac3b91427eec05bfa5b8a054c55031c7d /apps/plugins/snake2.c
parent72232bdc663f6437d77e8495c8b8c0ec1245f808 (diff)
downloadrockbox-d47e87e6ac3ddee0e45c16e24a22d9bc05c07bdd.tar.gz
rockbox-d47e87e6ac3ddee0e45c16e24a22d9bc05c07bdd.zip
Patch FS#4952 by Tom Ross, with changes by me: Snake 2 now uses external bitmaps for build, and is fully adapted to larger LCDs. Also some keymapping changes and usability adjustments.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9572 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/snake2.c')
-rw-r--r--apps/plugins/snake2.c748
1 files changed, 294 insertions, 454 deletions
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 @@
20/* 20/*
21Snake2! 21Snake2!
22 22
23Board consists of a WIDTHxHEIGHT grid. If board element is 0 then nothing is 23Board consists of a WIDTHxHEIGHT grid. If board element is 0 then nothing is
24there otherwise it is part of the snake or a wall. 24there otherwise it is part of the snake or a wall.
25 25
26Head and Tail are stored 26Head and Tail are stored
@@ -35,16 +35,106 @@ PLUGIN_HEADER
35#define WIDTH 28 35#define WIDTH 28
36#define HEIGHT 16 36#define HEIGHT 16
37 37
38#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128 38#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240)
39 #define MULTIPLIER 5 /*Modifier for porting on other screens*/ 39 #define MULTIPLIER 10 /*Modifier for porting on other screens*/
40 #define MODIFIER_1 10
41 #define MODIFIER_2 8
42 #define CENTER_X 20
43 #define CENTER_Y 55
44 #define TOP_X1 34 /* x-coord of the upperleft item (game type) */
45 #define TOP_X2 281 /* x-coord of the upperright item (maze type) */
46 #define TOP_X3 42 /* x-coord of the lowerleft item (speed) */
47 #define TOP_X4 274 /* x-coord of the lowerright item (hi-score) */
48 #define TOP_Y1 4 /* y-coord of the top row of items */
49 #define TOP_Y2 25 /* y-coord of the bottom row of items */
50 #define BMPHEIGHT_snake2_header 38
51 #define BMPWIDTH_snake2_header 320
52 #define BMPHEIGHT_snake2_right 192
53 #define BMPWIDTH_snake2_right 10
54 #define BMPHEIGHT_snake2_left 192
55 #define BMPWIDTH_snake2_left 10
56 #define BMPHEIGHT_snake2_bottom 10
57 #define BMPWIDTH_snake2_bottom 320
58#elif (LCD_WIDTH >= 240) && (LCD_HEIGHT >= 168)
59 #define MULTIPLIER 8
60 #define MODIFIER_1 8
61 #define MODIFIER_2 6
62 #define CENTER_X 8
63 #define CENTER_Y 34
64 #define TOP_X1 34
65 #define TOP_X2 201
66 #define TOP_X3 42
67 #define TOP_X4 194
68 #define TOP_Y1 4
69 #define TOP_Y2 25
70 #define BMPHEIGHT_snake2_header 38
71 #define BMPWIDTH_snake2_header 240
72 #define BMPHEIGHT_snake2_right 120
73 #define BMPWIDTH_snake2_right 10
74 #define BMPHEIGHT_snake2_left 120
75 #define BMPWIDTH_snake2_left 10
76 #define BMPHEIGHT_snake2_bottom 10
77 #define BMPWIDTH_snake2_bottom 240
78#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
79 #define MULTIPLIER 7
80 #define MODIFIER_1 7
81 #define MODIFIER_2 5
82 #define CENTER_X 12
83 #define CENTER_Y 46
84 #define TOP_X1 34
85 #define TOP_X2 181
86 #define TOP_X3 42
87 #define TOP_X4 174
88 #define TOP_Y1 4
89 #define TOP_Y2 25
90 #define BMPHEIGHT_snake2_header 38
91 #define BMPWIDTH_snake2_header 220
92 #define BMPHEIGHT_snake2_right 128
93 #define BMPWIDTH_snake2_right 10
94 #define BMPHEIGHT_snake2_left 128
95 #define BMPWIDTH_snake2_left 10
96 #define BMPHEIGHT_snake2_bottom 10
97 #define BMPWIDTH_snake2_bottom 220
98#elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132)
99 #define MULTIPLIER 5
100 #define MODIFIER_1 5
101 #define MODIFIER_2 3
102 #define CENTER_X 18
103 #define CENTER_Y 40
104 #define TOP_X1 34
105 #define TOP_X2 137
106 #define TOP_X3 42
107 #define TOP_X4 130
108 #define TOP_Y1 4
109 #define TOP_Y2 25
110 #define BMPHEIGHT_snake2_header 38
111 #define BMPWIDTH_snake2_header 176
112 #define BMPHEIGHT_snake2_right 84
113 #define BMPWIDTH_snake2_right 10
114 #define BMPHEIGHT_snake2_left 84
115 #define BMPWIDTH_snake2_left 10
116 #define BMPHEIGHT_snake2_bottom 10
117 #define BMPWIDTH_snake2_bottom 176
118#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128)
119 #define MULTIPLIER 5
40 #define MODIFIER_1 5 120 #define MODIFIER_1 5
41 #define MODIFIER_2 3 121 #define MODIFIER_2 3
42 #define CENTER_X 10 122 #define CENTER_X 10
43 #define CENTER_Y 38 123 #define CENTER_Y 38
44 #define BMPHEIGHT_snakebmp 128 124 #define TOP_X1 34
45 #define BMPWIDTH_snakebmp 160 125 #define TOP_X2 121
46 #define BMPHEIGHT_snakeupbmp 36 126 #define TOP_X3 42
47 #define BMPWIDTH_snakeupbmp 160 127 #define TOP_X4 114
128 #define TOP_Y1 4
129 #define TOP_Y2 25
130 #define BMPHEIGHT_snake2_header 38
131 #define BMPWIDTH_snake2_header 160
132 #define BMPHEIGHT_snake2_right 80
133 #define BMPWIDTH_snake2_right 10
134 #define BMPHEIGHT_snake2_left 80
135 #define BMPWIDTH_snake2_left 10
136 #define BMPHEIGHT_snake2_bottom 10
137 #define BMPWIDTH_snake2_bottom 160
48#else 138#else
49 #define MULTIPLIER 4 139 #define MULTIPLIER 4
50 #define MODIFIER_1 4 140 #define MODIFIER_1 4
@@ -54,21 +144,18 @@ PLUGIN_HEADER
54 144
55#endif 145#endif
56 146
57
58
59
60/* variable button definitions */ 147/* variable button definitions */
61#if CONFIG_KEYPAD == RECORDER_PAD 148#if CONFIG_KEYPAD == RECORDER_PAD
62#define SNAKE2_UP BUTTON_UP 149#define SNAKE2_UP BUTTON_UP
63#define SNAKE2_DOWN BUTTON_DOWN 150#define SNAKE2_DOWN BUTTON_DOWN
64#define SNAKE2_QUIT BUTTON_OFF 151#define SNAKE2_QUIT BUTTON_OFF
65#define SNAKE2_LEVEL_UP BUTTON_UP 152#define SNAKE2_LEVEL_UP BUTTON_UP
66#define SNAKE2_LEVEL_UP2 BUTTON_RIGHT
67#define SNAKE2_LEVEL_DOWN BUTTON_DOWN 153#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
68#define SNAKE2_LEVEL_DOWN2 BUTTON_LEFT 154#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
69#define SNAKE2_SELECT_MAZE BUTTON_F1 155#define SNAKE2_MAZE_LAST BUTTON_LEFT
70#define SNAKE2_SELECT_TYPE BUTTON_F3 156#define SNAKE2_SELECT_TYPE BUTTON_F3
71#define SNAKE2_PLAYPAUSE BUTTON_PLAY 157#define SNAKE2_PLAYPAUSE BUTTON_PLAY
158#define SNAKE2_PLAYPAUSE_TEXT "Play"
72 159
73#elif CONFIG_KEYPAD == ONDIO_PAD 160#elif CONFIG_KEYPAD == ONDIO_PAD
74#define SNAKE2_UP BUTTON_UP 161#define SNAKE2_UP BUTTON_UP
@@ -76,9 +163,10 @@ PLUGIN_HEADER
76#define SNAKE2_QUIT BUTTON_OFF 163#define SNAKE2_QUIT BUTTON_OFF
77#define SNAKE2_LEVEL_UP BUTTON_UP 164#define SNAKE2_LEVEL_UP BUTTON_UP
78#define SNAKE2_LEVEL_DOWN BUTTON_DOWN 165#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
79#define SNAKE2_SELECT_MAZE BUTTON_LEFT 166#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
80#define SNAKE2_SELECT_TYPE BUTTON_RIGHT 167#define SNAKE2_SELECT_TYPE BUTTON_LEFT
81#define SNAKE2_PLAYPAUSE BUTTON_MENU 168#define SNAKE2_PLAYPAUSE BUTTON_MENU
169#define SNAKE2_PLAYPAUSE_TEXT "Menu"
82 170
83#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ 171#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
84 (CONFIG_KEYPAD == IRIVER_H300_PAD) 172 (CONFIG_KEYPAD == IRIVER_H300_PAD)
@@ -86,12 +174,12 @@ PLUGIN_HEADER
86#define SNAKE2_DOWN BUTTON_DOWN 174#define SNAKE2_DOWN BUTTON_DOWN
87#define SNAKE2_QUIT BUTTON_OFF 175#define SNAKE2_QUIT BUTTON_OFF
88#define SNAKE2_LEVEL_UP BUTTON_UP 176#define SNAKE2_LEVEL_UP BUTTON_UP
89#define SNAKE2_LEVEL_UP2 BUTTON_RIGHT
90#define SNAKE2_LEVEL_DOWN BUTTON_DOWN 177#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
91#define SNAKE2_LEVEL_DOWN2 BUTTON_LEFT 178#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
92#define SNAKE2_SELECT_MAZE BUTTON_REC 179#define SNAKE2_MAZE_LAST BUTTON_LEFT
93#define SNAKE2_SELECT_TYPE BUTTON_MODE 180#define SNAKE2_SELECT_TYPE BUTTON_MODE
94#define SNAKE2_PLAYPAUSE BUTTON_ON 181#define SNAKE2_PLAYPAUSE BUTTON_ON
182#define SNAKE2_PLAYPAUSE_TEXT "Play"
95 183
96#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ 184#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
97 (CONFIG_KEYPAD == IPOD_3G_PAD) 185 (CONFIG_KEYPAD == IPOD_3G_PAD)
@@ -100,31 +188,35 @@ PLUGIN_HEADER
100#define SNAKE2_QUIT (BUTTON_SELECT | BUTTON_MENU) 188#define SNAKE2_QUIT (BUTTON_SELECT | BUTTON_MENU)
101#define SNAKE2_LEVEL_UP BUTTON_SCROLL_FWD 189#define SNAKE2_LEVEL_UP BUTTON_SCROLL_FWD
102#define SNAKE2_LEVEL_DOWN BUTTON_SCROLL_BACK 190#define SNAKE2_LEVEL_DOWN BUTTON_SCROLL_BACK
103#define SNAKE2_SELECT_MAZE BUTTON_LEFT 191#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
104#define SNAKE2_SELECT_TYPE BUTTON_RIGHT 192#define SNAKE2_MAZE_LAST BUTTON_LEFT
193#define SNAKE2_SELECT_TYPE BUTTON_PLAY
105#define SNAKE2_PLAYPAUSE BUTTON_SELECT 194#define SNAKE2_PLAYPAUSE BUTTON_SELECT
195#define SNAKE2_PLAYPAUSE_TEXT "Select"
106 196
107#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) 197#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
108#define SNAKE2_UP BUTTON_UP 198#define SNAKE2_UP BUTTON_UP
109#define SNAKE2_DOWN BUTTON_DOWN 199#define SNAKE2_DOWN BUTTON_DOWN
110#define SNAKE2_QUIT BUTTON_POWER 200#define SNAKE2_QUIT BUTTON_POWER
111#define SNAKE2_LEVEL_UP BUTTON_REC 201#define SNAKE2_LEVEL_UP BUTTON_UP
112#define SNAKE2_LEVEL_DOWN BUTTON_PLAY 202#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
113#define SNAKE2_SELECT_MAZE BUTTON_LEFT 203#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
114#define SNAKE2_SELECT_TYPE BUTTON_RIGHT 204#define SNAKE2_MAZE_LAST BUTTON_LEFT
205#define SNAKE2_SELECT_TYPE BUTTON_PLAY
115#define SNAKE2_PLAYPAUSE BUTTON_SELECT 206#define SNAKE2_PLAYPAUSE BUTTON_SELECT
207#define SNAKE2_PLAYPAUSE_TEXT "Select"
116 208
117#elif (CONFIG_KEYPAD == GIGABEAT_PAD) 209#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
118#define SNAKE2_UP BUTTON_UP 210#define SNAKE2_UP BUTTON_UP
119#define SNAKE2_DOWN BUTTON_DOWN 211#define SNAKE2_DOWN BUTTON_DOWN
120#define SNAKE2_QUIT BUTTON_A 212#define SNAKE2_QUIT BUTTON_A
121#define SNAKE2_LEVEL_UP BUTTON_UP 213#define SNAKE2_LEVEL_UP BUTTON_UP
122#define SNAKE2_LEVEL_UP2 BUTTON_RIGHT
123#define SNAKE2_LEVEL_DOWN BUTTON_DOWN 214#define SNAKE2_LEVEL_DOWN BUTTON_DOWN
124#define SNAKE2_LEVEL_DOWN2 BUTTON_LEFT 215#define SNAKE2_MAZE_NEXT BUTTON_RIGHT
125#define SNAKE2_SELECT_MAZE BUTTON_POWER 216#define SNAKE2_MAZE_LAST BUTTON_LEFT
126#define SNAKE2_SELECT_TYPE BUTTON_MENU 217#define SNAKE2_SELECT_TYPE BUTTON_MENU
127#define SNAKE2_PLAYPAUSE BUTTON_SELECT 218#define SNAKE2_PLAYPAUSE BUTTON_SELECT
219#define SNAKE2_PLAYPAUSE_TEXT "Select"
128 220
129#else 221#else
130#error "lacks keymapping" 222#error "lacks keymapping"
@@ -136,7 +228,7 @@ static char (*level_cache)[HEIGHT][WIDTH];
136/*Board itself - 2D int array*/ 228/*Board itself - 2D int array*/
137static int board[WIDTH][HEIGHT]; 229static int board[WIDTH][HEIGHT];
138/* 230/*
139 Buffer for sorting movement (in case user presses two movements during a 231 Buffer for sorting movement (in case user presses two movements during a
140 single frame 232 single frame
141*/ 233*/
142static int ardirectionbuffer[2]; 234static int ardirectionbuffer[2];
@@ -148,308 +240,38 @@ static int dir;
148static int frames; 240static int frames;
149static int apple; 241static int apple;
150static int level = 4, speed = 5,dead = 0, quit = 0; 242static int level = 4, speed = 5,dead = 0, quit = 0;
151static int sillydir = 0, num_levels = 0; 243static int sillydir = 0, num_levels = 0;
152static int level_from_file = 1; 244static int level_from_file = 0;
153static struct plugin_api* rb; 245static struct plugin_api* rb;
154static int headx, heady, tailx, taily, applecountdown = 5; 246static int headx, heady, tailx, taily, applecountdown = 5;
155static int game_type = 0; 247static int game_type = 0;
156static int num_apples_to_get=1; 248static int num_apples_to_get=1;
157static int num_apples_to_got=0; 249static int num_apples_to_got=0;
158static int game_b_level=1; 250static int game_b_level=0;
159static int applecount=0; 251static int applecount=0;
160static char phscore[30]; 252static char phscore[30];
161 253
162 254#if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128)
163#ifdef BMPHEIGHT_snakebmp 255#ifdef HAVE_LCD_COLOR
164const unsigned char snakebmp[] = { 256extern const unsigned short snake2_header1[];
1650x00, 0x00, 0x00, 0xe0, 0x20, 0xa0, 0xa0, 0x00, 0xe0, 0xa0, 0xa0, 0xe0, 0x00, 257extern const unsigned short snake2_header2[];
1660xe0, 0x40, 0x80, 0x40, 0xe0, 0x00, 0xe0, 0xa0, 0xa0, 0xa0, 0x00, 0x00, 0xf0, 258extern const unsigned short snake2_left[];
1670x08, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 259extern const unsigned short snake2_right[];
1680x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x04, 0x08, 0xf0, 0x00, 0x00, 0x00, 260extern const unsigned short snake2_bottom[];
1690x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 261#else
1700x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 262extern const unsigned char snake2_header1[];
1710x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 263extern const unsigned char snake2_header2[];
1720x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 264extern const unsigned char snake2_left[];
1730x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x08, 0x04, 0x02, 0x02, 0x02, 0x02, 265extern const unsigned char snake2_right[];
1740x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 266extern const unsigned char snake2_bottom[];
1750x02, 0x04, 0x08, 0xf0, 0x00, 0x00, 0xe0, 0x40, 0x80, 0x40, 0xe0, 0x00, 0xe0,
1760xa0, 0xa0, 0xe0, 0x00, 0x20, 0xa0, 0xa0, 0x60, 0x00, 0xe0, 0xa0, 0xa0, 0xa0,
1770x00, 0x00, 0x00, 0x00,
1780x00, 0x00, 0x00, 0x03, 0x02, 0x02, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00,
1790x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0xc3, 0x22, 0x22, 0x22, 0xc0, 0x00, 0x07,
1800x08, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1810x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x08, 0x07, 0x00, 0x00, 0x00,
1820x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x27, 0x4c, 0x4c, 0x79, 0x3b,
1830x00, 0x40, 0x7f, 0x47, 0x0e, 0x1c, 0x38, 0x7f, 0x00, 0x40, 0x70, 0x5c, 0x13,
1840x13, 0x5f, 0x7c, 0x70, 0x40, 0x40, 0x7f, 0x7f, 0x48, 0x0c, 0x3e, 0x79, 0x60,
1850x40, 0x40, 0x7f, 0x7f, 0x44, 0x4e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1860x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x20, 0x20, 0x20, 0x20,
1870x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1880x20, 0x10, 0x08, 0x07, 0x00, 0xe0, 0x13, 0x10, 0x10, 0xe0, 0x03, 0x00, 0x03,
1890x00, 0x00, 0x03, 0x00, 0x03, 0x02, 0x02, 0x02, 0x00, 0x03, 0x02, 0x02, 0x02,
1900x00, 0x00, 0x00, 0x00,
1910x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
1920x80, 0x98, 0xa4, 0xa4, 0x98, 0x80, 0x81, 0x02, 0x82, 0x82, 0x01, 0x00, 0x00,
1930x00, 0x17, 0x15, 0x15, 0x1d, 0x80, 0x5f, 0x45, 0x45, 0x42, 0x40, 0x5f, 0x55,
1940x55, 0x55, 0x40, 0x5f, 0x55, 0x55, 0x55, 0x40, 0x5f, 0x51, 0x51, 0x4e, 0x40,
1950x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0, 0xf0, 0x10,
1970x00, 0x10, 0xf0, 0xf0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1980x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x04, 0x1f, 0x80, 0x51,
1990x5f, 0x51, 0x44, 0x44, 0x44, 0x40, 0x57, 0x55, 0x55, 0x5d, 0x40, 0x5f, 0x51,
2000x51, 0x51, 0x40, 0x5f, 0x51, 0x51, 0x5f, 0x40, 0x5f, 0x45, 0x4d, 0x92, 0x00,
2010x1f, 0x15, 0x15, 0x15, 0x00, 0x00, 0x01, 0x81, 0x81, 0x00, 0x98, 0xa4, 0xa4,
2020x98, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2030x00, 0x00, 0x00, 0x00,
2040x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x30, 0xf8, 0x8c, 0x1a, 0x7f, 0xc0,
2050x90, 0x60, 0xc7, 0xce, 0x4c, 0x8f, 0x00, 0x47, 0x0e, 0x1e, 0x57, 0x90, 0xe0,
2060x00, 0x10, 0x28, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2070x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2080x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2090x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0f, 0x0f, 0x08,
2100x00, 0x08, 0x0f, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2110x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
2120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2130x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2140xc6, 0x28, 0x10, 0x00, 0xe0, 0x90, 0x57, 0x1e, 0x0e, 0x47, 0x00, 0x8f, 0x4c,
2150xce, 0xc7, 0x60, 0x90, 0xc0, 0x7f, 0x1a, 0x8c, 0xf8, 0x30, 0x20, 0xc0, 0x00,
2160x00, 0x00, 0x00, 0x00,
2170x80, 0xf0, 0x9c, 0x16, 0x57, 0x4d, 0xe9, 0xa1, 0xf5, 0xfc, 0x36, 0x3b, 0x39,
2180x37, 0x33, 0x31, 0x30, 0x31, 0x32, 0x35, 0x35, 0x35, 0x35, 0x33, 0x30, 0x30,
2190x30, 0x30, 0x30, 0x30, 0x31, 0x32, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
2200x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
2210x34, 0x34, 0x32, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
2220x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
2230x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
2240x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x32, 0x34,
2250x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34,
2260x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x32, 0x31,
2270x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x33, 0x35, 0x35, 0x35, 0x35, 0x32, 0x31,
2280x30, 0x31, 0x33, 0x37, 0x39, 0x3b, 0x36, 0xfc, 0xf5, 0xa1, 0xe9, 0x4d, 0x57,
2290x16, 0x9c, 0xf0, 0x80,
2300xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
2310x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2330x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2340x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2350x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2370x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2380x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2390x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
2420x25, 0xad, 0x88, 0xff,
2430xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
2440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2450x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2460x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2470x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2490x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2500x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2510x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2530x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2540x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
2550x25, 0xad, 0x88, 0xff,
2560xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
2570x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2580x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2590x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2610x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2620x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2630x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2640x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2650x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2660x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2670x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
2680x25, 0xad, 0x88, 0xff,
2690xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
2700x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2710x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2720x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2730x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2740x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2750x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2770x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2780x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2790x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
2810x25, 0xad, 0x88, 0xff,
2820xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
2830x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2840x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2850x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2860x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2870x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2890x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2900x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2910x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2920x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
2940x25, 0xad, 0x88, 0xff,
2950xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
2960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2970x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2980x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2990x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3010x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3020x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3030x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3040x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3060x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
3070x25, 0xad, 0x88, 0xff,
3080xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
3090x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3100x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3110x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3130x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3140x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3150x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3170x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3180x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3190x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
3200x25, 0xad, 0x88, 0xff,
3210xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
3220x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3230x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3250x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3260x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3270x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3290x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3300x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3310x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
3330x25, 0xad, 0x88, 0xff,
3340xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0x00, 0x00, 0x00,
3350x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3370x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3380x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3390x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3420x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3430x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3450x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
3460x25, 0xad, 0x88, 0xff,
3470xff, 0x88, 0xad, 0x25, 0x77, 0x52, 0xda, 0x88, 0xff, 0xff, 0xc0, 0xc0, 0xc0,
3480xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3490xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3500xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3510xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3520xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3530xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3540xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3550xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3560xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3570xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
3580xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0x88, 0xda, 0x52, 0x77,
3590x25, 0xad, 0x88, 0xff,
3600x0f, 0x1c, 0x39, 0x6d, 0x77, 0xda, 0x8c, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3,
3610xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e,
3620xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e,
3630xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e,
3640xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3,
3650x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8,
3660x8e, 0xb8, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8,
3670xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3,
3680xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e,
3690xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e,
3700xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e,
3710xe3, 0xb8, 0x8e, 0xb8, 0xe3, 0x8e, 0xb8, 0x8e, 0xe3, 0xb8, 0x8c, 0x5a, 0x77,
3720x6d, 0x39, 0x1c, 0x0f,
373
374};
375#endif 267#endif
376
377#ifdef BMPHEIGHT_snakeupbmp
378const unsigned char snakeupbmp[] = {
3790x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3810x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3820x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3830x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00,
3840x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
3850x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80,
3860x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
3870x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3890x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3900x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3910x00, 0x00, 0x00, 0x00,
3920x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3940xc0, 0x40, 0x40, 0xc0, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0xc0, 0x40, 0x40,
3950x80, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x00, 0xc0,
3960x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x27, 0x4c, 0x4c, 0x79,
3970x3b, 0x00, 0x40, 0x7f, 0x47, 0x0e, 0x1c, 0x38, 0x7f, 0x00, 0x40, 0x70, 0x5c,
3980x13, 0x13, 0x5f, 0x7c, 0x70, 0x40, 0x40, 0x7f, 0x7f, 0x48, 0x0c, 0x3e, 0x79,
3990x60, 0x40, 0x40, 0x7f, 0x7f, 0x44, 0x4e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00,
4000x00, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x00, 0xc0, 0x40, 0x40, 0x40, 0x00, 0xc0,
4010x40, 0x40, 0xc0, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0xc0, 0x40, 0x40, 0x40,
4020x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4030x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4040x00, 0x00, 0x00, 0x00,
4050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
4060x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00,
4070x07, 0x01, 0x01, 0x07, 0x00, 0x87, 0x41, 0x41, 0x40, 0x40, 0x47, 0x41, 0x41,
4080x40, 0x40, 0x47, 0x44, 0x44, 0x44, 0x40, 0x47, 0x45, 0x45, 0x45, 0x40, 0x45,
4090x45, 0x45, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4100x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0, 0xf0,
4110x10, 0x00, 0x10, 0xf0, 0xf0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40,
4130x40, 0x40, 0x45, 0x45, 0x45, 0x47, 0x40, 0x47, 0x44, 0x44, 0x44, 0x40, 0x47,
4140x44, 0x44, 0x47, 0x40, 0x47, 0x41, 0x43, 0x44, 0x40, 0x47, 0x45, 0x85, 0x05,
4150x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80,
4160x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4170x00, 0x00, 0x00, 0x00,
4180x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x30, 0xf8, 0x8c, 0x1a, 0x7f, 0xc0,
4190x90, 0x60, 0xc7, 0xce, 0x4c, 0x8f, 0x00, 0x47, 0x0e, 0x1e, 0x57, 0x90, 0xe0,
4200x00, 0x10, 0x28, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4210x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4220x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4230x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0f, 0x0f,
4240x08, 0x00, 0x08, 0x0f, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4250x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
4260x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4270x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
4280xc6, 0x28, 0x10, 0x00, 0xe0, 0x90, 0x57, 0x1e, 0x0e, 0x47, 0x00, 0x8f, 0x4c,
4290xce, 0xc7, 0x60, 0x90, 0xc0, 0x7f, 0x1a, 0x8c, 0xf8, 0x30, 0x20, 0xc0, 0x00,
4300x00, 0x00, 0x00, 0x00,
4310x00, 0x00, 0x0c, 0x06, 0x07, 0x0d, 0x09, 0x01, 0x05, 0x0c, 0x06, 0x0b, 0x09,
4320x07, 0x03, 0x01, 0x00, 0x01, 0x02, 0x05, 0x05, 0x05, 0x05, 0x03, 0x00, 0x00,
4330x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
4340x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
4350x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4370x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4380x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04,
4390x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
4400x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x02, 0x01,
4410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x05, 0x05, 0x05, 0x02, 0x01,
4420x00, 0x01, 0x03, 0x07, 0x09, 0x0b, 0x06, 0x0c, 0x05, 0x01, 0x09, 0x0d, 0x07,
4430x06, 0x0c, 0x00, 0x00,
444
445};
446#endif 268#endif
447 269
448#define NORTH 1 270#define NORTH 1
449#define EAST 2 271#define EAST 2
450#define SOUTH 4 272#define SOUTH 4
451#define WEST 8 273#define WEST 8
452#define HEAD 16 274#define HEAD 16
453 275
454#define EAST_NORTH 32 276#define EAST_NORTH 32
455#define EAST_SOUTH 64 277#define EAST_SOUTH 64
@@ -478,7 +300,7 @@ int load_all_levels(void)
478 max_levels = size / (HEIGHT*WIDTH); 300 max_levels = size / (HEIGHT*WIDTH);
479 301
480 num_levels = 0; 302 num_levels = 0;
481 303
482 /* open file */ 304 /* open file */
483 if ((fd = rb->open(LEVELS_FILE, O_RDONLY)) < 0) 305 if ((fd = rb->open(LEVELS_FILE, O_RDONLY)) < 0)
484 { 306 {
@@ -532,8 +354,8 @@ void iohiscore(void)
532 rb->fdprintf(fd, "%d\n", hiscore); 354 rb->fdprintf(fd, "%d\n", hiscore);
533 } 355 }
534 else 356 else
535 hiscore = compare; 357 hiscore = compare;
536 358
537 rb->close(fd); 359 rb->close(fd);
538 360
539} 361}
@@ -545,9 +367,9 @@ void clear_board( void)
545{ 367{
546 int x,y; 368 int x,y;
547 369
548 for (x = 0; x < WIDTH; x++) 370 for (x = 0; x < WIDTH; x++)
549 { 371 {
550 for (y = 0; y < HEIGHT; y++) 372 for (y = 0; y < HEIGHT; y++)
551 { 373 {
552 board[x][y] = 0; 374 board[x][y] = 0;
553 } 375 }
@@ -606,7 +428,7 @@ void get_direction( void )
606} 428}
607 429
608/* 430/*
609** Sets the direction 431** Sets the direction
610*/ 432*/
611void set_direction(int newdir) 433void set_direction(int newdir)
612{ 434{
@@ -640,7 +462,7 @@ void new_level(int level)
640 tailx = headx - 4; 462 tailx = headx - 4;
641 taily = heady; 463 taily = heady;
642 applecountdown = 0; 464 applecountdown = 0;
643 /*Create a small snake to start off with*/ 465 /*Create a small snake to start off with*/
644 board[headx][heady] = dir; 466 board[headx][heady] = dir;
645 board[headx-1][heady] = dir; 467 board[headx-1][heady] = dir;
646 board[headx-2][heady] = dir; 468 board[headx-2][heady] = dir;
@@ -669,21 +491,18 @@ void draw_apple( void )
669#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128 491#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
670 char pscore[5], counter[4]; 492 char pscore[5], counter[4];
671 493
672 rb->lcd_set_drawmode(DRMODE_FG); 494 rb->lcd_bitmap(snake2_header2,0,0,BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header);
673 rb->lcd_mono_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp); 495 rb->lcd_bitmap(snake2_left,0,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_left, BMPHEIGHT_snake2_left);
674 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 496 rb->lcd_bitmap(snake2_right,LCD_WIDTH-BMPWIDTH_snake2_right,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_right, BMPHEIGHT_snake2_right);
675 rb->lcd_fillrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp); 497 rb->lcd_bitmap(snake2_bottom,0,BMPHEIGHT_snake2_header+BMPHEIGHT_snake2_left,BMPWIDTH_snake2_bottom, BMPHEIGHT_snake2_bottom);
676 rb->lcd_set_drawmode(DRMODE_FG);
677 rb->lcd_mono_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
678 rb->lcd_set_drawmode(DRMODE_SOLID);
679 498
680 rb->snprintf(counter,sizeof(counter),"%d",applecount); 499 rb->snprintf(counter,sizeof(counter),"%d",applecount);
681 rb->lcd_getstringsize(counter,&strwdt,&strhgt); 500 rb->lcd_getstringsize(counter,&strwdt,&strhgt);
682 rb->lcd_putsxy(42-strwdt/2,25,counter); 501 rb->lcd_putsxy(TOP_X3-strwdt/2,TOP_Y2,counter);
683 502
684 rb->snprintf(pscore,sizeof(pscore),"%d",score); 503 rb->snprintf(pscore,sizeof(pscore),"%d",score);
685 rb->lcd_getstringsize(pscore,&strwdt,&strhgt); 504 rb->lcd_getstringsize(pscore,&strwdt,&strhgt);
686 rb->lcd_putsxy(116-strwdt/2,25,pscore); 505 rb->lcd_putsxy(TOP_X4-strwdt/2,TOP_Y2,pscore);
687#endif 506#endif
688 507
689 if (!apple) 508 if (!apple)
@@ -821,7 +640,7 @@ void draw_s_to_w_bit(int x, int y)
821void draw_boundary ( void ) 640void draw_boundary ( void )
822{ 641{
823 int x, y; 642 int x, y;
824 643
825 /*TODO: Load levels from file!*/ 644 /*TODO: Load levels from file!*/
826 645
827 /*top and bottom line*/ 646 /*top and bottom line*/
@@ -830,7 +649,7 @@ void draw_boundary ( void )
830 board[x][0] = EAST; 649 board[x][0] = EAST;
831 board[x][HEIGHT-1] = WEST; 650 board[x][HEIGHT-1] = WEST;
832 } 651 }
833 652
834 /*left and right lines*/ 653 /*left and right lines*/
835 for(y=0; y < HEIGHT; y++) 654 for(y=0; y < HEIGHT; y++)
836 { 655 {
@@ -851,13 +670,12 @@ void draw_boundary ( void )
851void redraw (void) 670void redraw (void)
852{ 671{
853 int x,y; 672 int x,y;
854 rb->lcd_clear_display(); 673
855 674 for (x = 0; x < WIDTH; x++)
856 for (x = 0; x < WIDTH; x++)
857 { 675 {
858 for (y = 0; y < HEIGHT; y++) 676 for (y = 0; y < HEIGHT; y++)
859 { 677 {
860 switch (board[x][y]) 678 switch (board[x][y])
861 { 679 {
862 case -1: 680 case -1:
863 rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1,CENTER_Y+y*MULTIPLIER,MODIFIER_2,MODIFIER_1); 681 rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1,CENTER_Y+y*MULTIPLIER,MODIFIER_2,MODIFIER_1);
@@ -865,25 +683,23 @@ void redraw (void)
865 break; 683 break;
866 case 0: 684 case 0:
867 break; 685 break;
868 686
869 case NORTH: 687 case NORTH:
870 case SOUTH: 688 case SOUTH:
871 draw_vertical_bit(x,y); 689 draw_vertical_bit(x,y);
872 break; 690 break;
873 691
874 case EAST: 692 case EAST:
875 case WEST: 693 case WEST:
876 draw_horizontal_bit(x,y); 694 draw_horizontal_bit(x,y);
877 break; 695 break;
878 696
879 default: 697 default:
880 rb->lcd_fillrect(CENTER_X+x*MULTIPLIER,CENTER_Y+y*MULTIPLIER,MODIFIER_1,MODIFIER_1); 698 rb->lcd_fillrect(CENTER_X+x*MULTIPLIER,CENTER_Y+y*MULTIPLIER,MODIFIER_1,MODIFIER_1);
881 break; 699 break;
882 } 700 }
883 } 701 }
884 } 702 }
885 rb->lcd_update();
886
887} 703}
888 704
889/* 705/*
@@ -905,7 +721,7 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
905 case(NORTH): 721 case(NORTH):
906 draw_vertical_bit(x,y); 722 draw_vertical_bit(x,y);
907 break; 723 break;
908 724
909 case(EAST): 725 case(EAST):
910 draw_e_to_n_bit(x,y); 726 draw_e_to_n_bit(x,y);
911 break; 727 break;
@@ -922,8 +738,8 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
922 case(WEST): 738 case(WEST):
923 case(EAST): 739 case(EAST):
924 draw_horizontal_bit(x,y); 740 draw_horizontal_bit(x,y);
925 break; 741 break;
926 742
927 case(NORTH): 743 case(NORTH):
928 draw_n_to_e_bit(x,y); 744 draw_n_to_e_bit(x,y);
929 break; 745 break;
@@ -941,7 +757,7 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
941 case(NORTH): 757 case(NORTH):
942 draw_vertical_bit(x,y); 758 draw_vertical_bit(x,y);
943 break; 759 break;
944 760
945 case(EAST): 761 case(EAST):
946 draw_e_to_s_bit(x,y); 762 draw_e_to_s_bit(x,y);
947 break; 763 break;
@@ -952,13 +768,13 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
952 } 768 }
953 break; 769 break;
954 770
955 case(WEST): 771 case(WEST):
956 switch(previousbit) 772 switch(previousbit)
957 { 773 {
958 case(EAST): 774 case(EAST):
959 case(WEST): 775 case(WEST):
960 draw_horizontal_bit(x,y); 776 draw_horizontal_bit(x,y);
961 break; 777 break;
962 778
963 case(SOUTH): 779 case(SOUTH):
964 draw_s_to_w_bit(x,y); 780 draw_s_to_w_bit(x,y);
@@ -977,50 +793,53 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
977*/ 793*/
978void die (void) 794void die (void)
979{ 795{
980 int n=100; 796 int button;
981 int count; 797 bool done=false;
982 char pscore[18]; 798 char pscore[20];
983 /*Flashy death sequence (flashy as in 'flashes')*/ 799
984 for(count=0;count<24;count++) 800 rb->splash(HZ*2, true, "Oops!");
985 {
986 rb->sleep(HZ/n);
987 rb->lcd_clear_display();
988 draw_apple();
989 rb->lcd_update();
990 801
991 rb->sleep(HZ/n);
992 redraw();
993 rb->lcd_update();
994 }
995
996 rb->lcd_clear_display();
997 draw_apple();
998 rb->lcd_update();
999 rb->lcd_clear_display(); 802 rb->lcd_clear_display();
1000 803
1001 applecount=0; 804 applecount=0;
1002 805
1003 rb->lcd_getstringsize("Dead",&strwdt,&strhgt); 806 rb->lcd_getstringsize("You died!",&strwdt,&strhgt);
1004 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt,"Dead"); 807 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt,"You died!");
1005 808
1006 rb->snprintf(pscore,sizeof(pscore),"Your Score %d",score); 809 rb->snprintf(pscore,sizeof(pscore),"Your score: %d",score);
1007 rb->lcd_getstringsize(pscore,&strwdt,&strhgt); 810 rb->lcd_getstringsize(pscore,&strwdt,&strhgt);
1008 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 2 + 2,pscore); 811 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 2 + 2,pscore);
1009 812
1010 if (score>hiscore) 813 if (score>hiscore)
1011 { 814 {
1012 hiscore=score; 815 hiscore=score;
1013 rb->lcd_getstringsize("New High Score!",&strwdt,&strhgt); 816 rb->lcd_getstringsize("New high score!",&strwdt,&strhgt);
1014 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 4 + 2,"New High Score!"); 817 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 4 + 2,"New high score!");
1015 } 818 }
1016 else 819 else
1017 { 820 {
1018 rb->snprintf(phscore,sizeof(phscore),"High Score: %d",hiscore); 821 rb->snprintf(phscore,sizeof(phscore),"High score: %d",hiscore);
1019 rb->lcd_getstringsize(phscore,&strwdt,&strhgt); 822 rb->lcd_getstringsize(phscore,&strwdt,&strhgt);
1020 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 6,phscore); 823 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 5,phscore);
1021 } 824 }
825
826 rb->snprintf(phscore,sizeof(phscore),"Press %s...",SNAKE2_PLAYPAUSE_TEXT);
827 rb->lcd_getstringsize(phscore,&strwdt,&strhgt);
828 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt * 7,phscore);
829
1022 rb->lcd_update(); 830 rb->lcd_update();
1023 rb->sleep(3*HZ); 831
832 while(!done)
833 {
834 button=rb->button_get(true);
835 switch(button)
836 {
837 case SNAKE2_PLAYPAUSE:
838 done = true;
839 break;
840 }
841 }
842
1024 dead=1; 843 dead=1;
1025} 844}
1026 845
@@ -1034,17 +853,17 @@ void collision ( int x, int y )
1034 int bdeath=0; 853 int bdeath=0;
1035 854
1036 855
1037 switch (board[x][y]) 856 switch (board[x][y])
1038 { 857 {
1039 case 0: 858 case 0:
1040 859
1041 break; 860 break;
1042 case -1: 861 case -1:
1043 score = score + (1 * level); 862 score = score + (1 * level);
1044 apple=0; 863 apple=0;
1045 applecountdown=2; 864 applecountdown=2;
1046 applecount++; 865 applecount++;
1047 866
1048 if(game_type==1) 867 if(game_type==1)
1049 { 868 {
1050 if(num_apples_to_get == num_apples_to_got) 869 if(num_apples_to_get == num_apples_to_got)
@@ -1061,7 +880,9 @@ void collision ( int x, int y )
1061 rb->splash(HZ, true, "Level Completed!"); 880 rb->splash(HZ, true, "Level Completed!");
1062 rb->lcd_clear_display(); 881 rb->lcd_clear_display();
1063 new_level(level_from_file); 882 new_level(level_from_file);
883 rb->lcd_clear_display();
1064 redraw(); 884 redraw();
885 rb->lcd_update();
1065 } 886 }
1066 else 887 else
1067 num_apples_to_got++; 888 num_apples_to_got++;
@@ -1086,7 +907,7 @@ void move( void )
1086 /*this actually sets the dir variable.*/ 907 /*this actually sets the dir variable.*/
1087 get_direction(); 908 get_direction();
1088 /*draw head*/ 909 /*draw head*/
1089 switch (dir) 910 switch (dir)
1090 { 911 {
1091 case (NORTH): 912 case (NORTH):
1092 board[headx][heady]=NORTH; 913 board[headx][heady]=NORTH;
@@ -1094,7 +915,7 @@ void move( void )
1094 break; 915 break;
1095 case (EAST): 916 case (EAST):
1096 board[headx][heady]=EAST; 917 board[headx][heady]=EAST;
1097 headx++; 918 headx++;
1098 break; 919 break;
1099 case (SOUTH): 920 case (SOUTH):
1100 board[headx][heady]=SOUTH; 921 board[headx][heady]=SOUTH;
@@ -1105,7 +926,7 @@ void move( void )
1105 headx--; 926 headx--;
1106 break; 927 break;
1107 } 928 }
1108 929
1109 if(headx == WIDTH) 930 if(headx == WIDTH)
1110 headx = 0; 931 headx = 0;
1111 else if(headx < 0) 932 else if(headx < 0)
@@ -1115,11 +936,11 @@ void move( void )
1115 heady = 0; 936 heady = 0;
1116 else if(heady < 0) 937 else if(heady < 0)
1117 heady = HEIGHT-1; 938 heady = HEIGHT-1;
1118 939
1119 rb->lcd_fillrect(CENTER_X+headx*MULTIPLIER,CENTER_Y+heady*MULTIPLIER,MODIFIER_1,MODIFIER_1); 940 rb->lcd_fillrect(CENTER_X+headx*MULTIPLIER,CENTER_Y+heady*MULTIPLIER,MODIFIER_1,MODIFIER_1);
1120 941
1121 /*clear tail*/ 942 /*clear tail*/
1122 if(applecountdown <= 0) 943 if(applecountdown <= 0)
1123 { 944 {
1124 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 945 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1125 rb->lcd_fillrect(CENTER_X+tailx*MULTIPLIER,CENTER_Y+taily*MULTIPLIER,MODIFIER_1,MODIFIER_1); 946 rb->lcd_fillrect(CENTER_X+tailx*MULTIPLIER,CENTER_Y+taily*MULTIPLIER,MODIFIER_1,MODIFIER_1);
@@ -1146,7 +967,7 @@ void move( void )
1146 tailx--; 967 tailx--;
1147 break; 968 break;
1148 } 969 }
1149 970
1150 if(tailx == WIDTH) 971 if(tailx == WIDTH)
1151 tailx = 0; 972 tailx = 0;
1152 else if(tailx < 0) 973 else if(tailx < 0)
@@ -1166,7 +987,7 @@ void frame (void)
1166 int olddir, noldx, noldy, temp; 987 int olddir, noldx, noldy, temp;
1167 noldx = headx; 988 noldx = headx;
1168 noldy = heady; 989 noldy = heady;
1169 olddir = 0; 990 olddir = 0;
1170 switch(dir) 991 switch(dir)
1171 { 992 {
1172 case(NORTH): 993 case(NORTH):
@@ -1174,7 +995,7 @@ void frame (void)
1174 temp = 0; 995 temp = 0;
1175 else 996 else
1176 temp = heady + 1; 997 temp = heady + 1;
1177 998
1178 olddir = board[headx][temp]; 999 olddir = board[headx][temp];
1179 break; 1000 break;
1180 1001
@@ -1207,34 +1028,36 @@ void frame (void)
1207 } 1028 }
1208 1029
1209 move(); 1030 move();
1210 1031
1211 /* 1032 /*
1212 now redraw the bit that was 1033 now redraw the bit that was
1213 the tail, to something snake-like: 1034 the tail, to something snake-like:
1214 */ 1035 */
1215 draw_snake_bit(dir, olddir, noldx, noldy); 1036 draw_snake_bit(dir, olddir, noldx, noldy);
1216 1037
1217 collision(headx, heady); 1038 collision(headx, heady);
1218 1039
1219 rb->lcd_update(); 1040 rb->lcd_update();
1220} 1041}
1221 1042
1222void game_pause (void) 1043void game_pause (void)
1223{ 1044{
1224 int button; 1045 int button;
1225 1046
1226 rb->lcd_clear_display(); 1047 rb->lcd_clear_display();
1227 rb->lcd_getstringsize("Paused",&strwdt,&strhgt); 1048 rb->lcd_getstringsize("Paused",&strwdt,&strhgt);
1228 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,LCD_HEIGHT/2,"Paused"); 1049 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,LCD_HEIGHT/2,"Paused");
1229 1050
1230 rb->lcd_update(); 1051 rb->lcd_update();
1231 while (1) 1052 while (1)
1232 { 1053 {
1233 button = rb->button_get(true); 1054 button = rb->button_get(true);
1234 switch (button) 1055 switch (button)
1235 { 1056 {
1236 case SNAKE2_PLAYPAUSE: 1057 case SNAKE2_PLAYPAUSE:
1058 rb->lcd_clear_display();
1237 redraw(); 1059 redraw();
1060 rb->lcd_update();
1238 rb->sleep(HZ/2); 1061 rb->sleep(HZ/2);
1239 return; 1062 return;
1240 1063
@@ -1249,21 +1072,23 @@ void game_pause (void)
1249 } 1072 }
1250} 1073}
1251 1074
1252void game (void) 1075void game (void)
1253{ 1076{
1254 int button; 1077 int button;
1255 1078
1079 rb->lcd_clear_display();
1256 redraw(); 1080 redraw();
1081 rb->lcd_update();
1257 /*main loop:*/ 1082 /*main loop:*/
1258 while (1) 1083 while (1)
1259 { 1084 {
1260 if(frames==5) 1085 if(frames==5)
1261 { 1086 {
1262 frame(); 1087 frame();
1263 if(frames>0) frames=0; 1088 if(frames>0) frames=0;
1264 } 1089 }
1265 frames++; 1090 frames++;
1266 1091
1267 if(frames == 0) 1092 if(frames == 0)
1268 { 1093 {
1269 die(); 1094 die();
@@ -1279,24 +1104,24 @@ void game (void)
1279 } 1104 }
1280 } 1105 }
1281 } 1106 }
1282 1107
1283 if (dead) return; 1108 if (dead) return;
1284 1109
1285 draw_apple(); 1110 draw_apple();
1286 1111
1287 rb->sleep(HZ/speed); 1112 rb->sleep(HZ/speed);
1288 1113
1289 button = rb->button_get(false); 1114 button = rb->button_get(false);
1290 switch (button) 1115 switch (button)
1291 { 1116 {
1292 case SNAKE2_UP: 1117 case SNAKE2_UP:
1293 case SNAKE2_UP | BUTTON_REPEAT: 1118 case SNAKE2_UP | BUTTON_REPEAT:
1294 if (dir != SOUTH) set_direction(NORTH); 1119 if (dir != SOUTH) set_direction(NORTH);
1295 break; 1120 break;
1296 1121
1297 case BUTTON_RIGHT: 1122 case BUTTON_RIGHT:
1298 case BUTTON_RIGHT | BUTTON_REPEAT: 1123 case BUTTON_RIGHT | BUTTON_REPEAT:
1299 if (dir != WEST) set_direction(EAST); 1124 if (dir != WEST) set_direction(EAST);
1300 break; 1125 break;
1301 1126
1302 case SNAKE2_DOWN: 1127 case SNAKE2_DOWN:
@@ -1328,7 +1153,7 @@ void game (void)
1328 1153
1329} 1154}
1330 1155
1331void game_init(void) 1156void game_init(void)
1332{ 1157{
1333 int button; 1158 int button;
1334 char plevel[30]; 1159 char plevel[30];
@@ -1340,41 +1165,42 @@ void game_init(void)
1340 1165
1341 clear_board(); 1166 clear_board();
1342 load_level( level_from_file ); 1167 load_level( level_from_file );
1343 1168 rb->lcd_clear_display();
1344 while (1) 1169 redraw();
1345 { 1170 rb->lcd_update();
1346 rb->lcd_clear_display();
1347 redraw();
1348 1171
1172 while (1)
1173 {
1349#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128 1174#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
1350 1175
1351 rb->lcd_set_drawmode(DRMODE_FG); 1176 rb->lcd_bitmap(snake2_header1,0,0,BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header);
1352 rb->lcd_mono_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp); 1177 rb->lcd_bitmap(snake2_left,0,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_left, BMPHEIGHT_snake2_left);
1353 rb->lcd_set_drawmode(DRMODE_SOLID); 1178 rb->lcd_bitmap(snake2_right,LCD_WIDTH-BMPWIDTH_snake2_right,BMPHEIGHT_snake2_header,BMPWIDTH_snake2_right, BMPHEIGHT_snake2_right);
1179 rb->lcd_bitmap(snake2_bottom,0,BMPHEIGHT_snake2_header+BMPHEIGHT_snake2_left,BMPWIDTH_snake2_bottom, BMPHEIGHT_snake2_bottom);
1354 1180
1355 rb->snprintf(plevel,sizeof(plevel),"%d",level); 1181 rb->snprintf(plevel,sizeof(plevel),"%d",level);
1356 rb->lcd_getstringsize(plevel,&strwdt,&strhgt); 1182 rb->lcd_getstringsize(plevel,&strwdt,&strhgt);
1357 rb->lcd_putsxy(42-strwdt/2,25, plevel); 1183 rb->lcd_putsxy(TOP_X3-strwdt/2,TOP_Y2, plevel);
1358 1184
1359 rb->snprintf(plevel,sizeof(plevel),"%d",level_from_file); 1185 rb->snprintf(plevel,sizeof(plevel),"%d",level_from_file);
1360 rb->lcd_getstringsize(plevel,&strwdt,&strhgt); 1186 rb->lcd_getstringsize(plevel,&strwdt,&strhgt);
1361 rb->lcd_putsxy(121-strwdt/2,4, plevel); 1187 rb->lcd_putsxy(TOP_X2-strwdt/2,TOP_Y1, plevel);
1362 1188
1363 if(game_type==0){ 1189 if(game_type==0){
1364 rb->lcd_getstringsize("A",&strwdt,&strhgt); 1190 rb->lcd_getstringsize("A",&strwdt,&strhgt);
1365 rb->lcd_putsxy(34,4,"A"); 1191 rb->lcd_putsxy(TOP_X1,TOP_Y1,"A");
1366 } 1192 }
1367 else{ 1193 else{
1368 rb->lcd_getstringsize("B",&strwdt,&strhgt); 1194 rb->lcd_getstringsize("B",&strwdt,&strhgt);
1369 rb->lcd_putsxy(34,4,"B"); 1195 rb->lcd_putsxy(TOP_X1,TOP_Y1,"B");
1370 } 1196 }
1371 1197
1372 rb->snprintf(phscore,sizeof(phscore),"%d",hiscore); 1198 rb->snprintf(phscore,sizeof(phscore),"%d",hiscore);
1373 rb->lcd_getstringsize(phscore,&strwdt,&strhgt); 1199 rb->lcd_getstringsize(phscore,&strwdt,&strhgt);
1374 rb->lcd_putsxy(114-strwdt/2,25, phscore); 1200 rb->lcd_putsxy(TOP_X4-strwdt/2,TOP_Y2, phscore);
1375 1201
1376#else 1202#else
1377 rb->snprintf(plevel,sizeof(plevel),"Speed: %d",level); 1203 rb->snprintf(plevel,sizeof(plevel),"Speed: %02d",level);
1378 rb->lcd_getstringsize("Speed: 00",&strwdt,&strhgt); 1204 rb->lcd_getstringsize("Speed: 00",&strwdt,&strhgt);
1379 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt+4, plevel); 1205 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt+4, plevel);
1380 1206
@@ -1385,7 +1211,7 @@ void game_init(void)
1385 if(game_type==0){ 1211 if(game_type==0){
1386 rb->lcd_getstringsize("Game Type: A ",&strwdt,&strhgt); 1212 rb->lcd_getstringsize("Game Type: A ",&strwdt,&strhgt);
1387 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt*3+4,"Game Type: A"); 1213 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt*3+4,"Game Type: A");
1388 } 1214 }
1389 else{ 1215 else{
1390 rb->lcd_getstringsize("Game Type: B ",&strwdt,&strhgt); 1216 rb->lcd_getstringsize("Game Type: B ",&strwdt,&strhgt);
1391 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt*3+4,"Game Type: B"); 1217 rb->lcd_putsxy((LCD_WIDTH - strwdt)/2,strhgt*3+4,"Game Type: B");
@@ -1402,16 +1228,12 @@ void game_init(void)
1402 switch (button) 1228 switch (button)
1403 { 1229 {
1404 case SNAKE2_LEVEL_UP: 1230 case SNAKE2_LEVEL_UP:
1405#ifdef SNAKE2_LEVEL_UP2 1231 case SNAKE2_LEVEL_UP|BUTTON_REPEAT:
1406 case SNAKE2_LEVEL_UP2: 1232 if (level<10)
1407#endif
1408 if (level<10)
1409 level+=1; 1233 level+=1;
1410 break; 1234 break;
1411 case SNAKE2_LEVEL_DOWN: 1235 case SNAKE2_LEVEL_DOWN:
1412#ifdef SNAKE2_LEVEL_DOWN2 1236 case SNAKE2_LEVEL_DOWN|BUTTON_REPEAT:
1413 case SNAKE2_LEVEL_DOWN2:
1414#endif
1415 if (level>1) 1237 if (level>1)
1416 level-=1; 1238 level-=1;
1417 break; 1239 break;
@@ -1426,17 +1248,32 @@ void game_init(void)
1426 case SNAKE2_SELECT_TYPE: 1248 case SNAKE2_SELECT_TYPE:
1427 if(game_type==0)game_type=1; else game_type=0; 1249 if(game_type==0)game_type=1; else game_type=0;
1428 break; 1250 break;
1429 case SNAKE2_SELECT_MAZE: 1251 case SNAKE2_MAZE_NEXT:
1430 1252 rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID);
1431 level_from_file++; 1253 rb->lcd_fillrect(CENTER_X, CENTER_Y, CENTER_X+WIDTH*MULTIPLIER,
1432 if(level_from_file > num_levels) 1254 CENTER_Y+HEIGHT*MULTIPLIER);
1433 { 1255 rb->lcd_set_drawmode(DRMODE_SOLID);
1434 level_from_file = 1; 1256 if(level_from_file < num_levels)
1435 } 1257 level_from_file++;
1436 1258 else
1259 level_from_file = 0;
1260 load_level( level_from_file );
1261 redraw();
1262 break;
1263#ifdef SNAKE2_MAZE_LAST
1264 case SNAKE2_MAZE_LAST:
1265 rb->lcd_set_drawmode(DRMODE_BG|DRMODE_INVERSEVID);
1266 rb->lcd_fillrect(CENTER_X, CENTER_Y, CENTER_X+WIDTH*MULTIPLIER,
1267 CENTER_Y+HEIGHT*MULTIPLIER);
1268 rb->lcd_set_drawmode(DRMODE_SOLID);
1269 if(level_from_file > 0)
1270 level_from_file--;
1271 else
1272 level_from_file = num_levels;
1437 load_level( level_from_file ); 1273 load_level( level_from_file );
1438 1274 redraw();
1439 break; 1275 break;
1276#endif
1440 default: 1277 default:
1441 if (rb->default_event_handler(button)==SYS_USB_CONNECTED) { 1278 if (rb->default_event_handler(button)==SYS_USB_CONNECTED) {
1442 quit = 2; 1279 quit = 2;
@@ -1455,6 +1292,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1455 1292
1456 /* Lets use the default font */ 1293 /* Lets use the default font */
1457 rb->lcd_setfont(FONT_SYSFIXED); 1294 rb->lcd_setfont(FONT_SYSFIXED);
1295#ifdef HAVE_LCD_COLOR
1296 rb->lcd_set_background(LCD_WHITE);
1297#endif
1458 load_all_levels(); 1298 load_all_levels();
1459 1299
1460 if (num_levels == 0) { 1300 if (num_levels == 0) {
@@ -1466,19 +1306,19 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1466 1306
1467 while(quit==0) 1307 while(quit==0)
1468 { 1308 {
1469 game_init(); 1309 game_init();
1470 rb->lcd_clear_display(); 1310 rb->lcd_clear_display();
1471 frames=1; 1311 frames=1;
1472 1312
1473 if(quit==0) 1313 if(quit==0)
1474 { 1314 {
1475 init_snake(); 1315 init_snake();
1476 1316
1477 /*Start Game:*/ 1317 /*Start Game:*/
1478 game(); 1318 game();
1479 } 1319 }
1480 } 1320 }
1481 1321
1482 iohiscore(); 1322 iohiscore();
1483 return (quit==1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED; 1323 return (quit==1) ? PLUGIN_OK : PLUGIN_USB_CONNECTED;
1484} 1324}