summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Boot <rotator@gmail.com>2006-03-20 03:06:07 +0000
committerAdam Boot <rotator@gmail.com>2006-03-20 03:06:07 +0000
commitea4947a95f2478fd2d72c0af43829ebb6c4328a3 (patch)
treec85f3e62605afe4d8b7c95659b1643c45baaa34e
parentfce885d9ec3fe590ad8eed2d2ca961c14a601202 (diff)
downloadrockbox-ea4947a95f2478fd2d72c0af43829ebb6c4328a3.tar.gz
rockbox-ea4947a95f2478fd2d72c0af43829ebb6c4328a3.zip
New game plugin: bubbles, initial commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9126 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/SOURCES6
-rw-r--r--apps/plugins/bitmaps/mono/SOURCES12
-rwxr-xr-xapps/plugins/bitmaps/mono/bubbles_bubble.160x128x1.bmpbin0 -> 110 bytes
-rwxr-xr-xapps/plugins/bitmaps/mono/bubbles_bubble.220x176x1.bmpbin0 -> 126 bytes
-rwxr-xr-xapps/plugins/bitmaps/mono/bubbles_bubble.320x240x1.bmpbin0 -> 150 bytes
-rw-r--r--apps/plugins/bitmaps/native/SOURCES53
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_emblem.160x128x16.bmpbin0 -> 1590 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_emblem.160x128x2.bmpbin0 -> 1590 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_emblem.220x176x16.bmpbin0 -> 3510 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_emblem.320x240x16.bmpbin0 -> 6198 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_left.160x128x16.bmpbin0 -> 12854 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_left.176x132x16.bmpbin0 -> 15894 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_left.220x176x16.bmpbin0 -> 24694 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_left.240x320x16.bmpbin0 -> 53814 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_left.320x240x16.bmpbin0 -> 51894 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_right.160x128x16.bmpbin0 -> 12342 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_right.176x132x16.bmpbin0 -> 16422 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_right.220x176x16.bmpbin0 -> 25398 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_right.240x320x16.bmpbin0 -> 55094 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/bubbles_right.320x240x16.bmpbin0 -> 52854 bytes
-rwxr-xr-xapps/plugins/bubbles.c2537
21 files changed, 2592 insertions, 16 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index b01641aa17..d851d6a78a 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -30,9 +30,10 @@ mandelbrot.c
30plasma.c 30plasma.c
31#endif 31#endif
32 32
33jewels.c
34bounce.c 33bounce.c
35 34#if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128)
35bubbles.c
36#endif
36#if (LCD_WIDTH != 138) && (LCD_WIDTH != 128) 37#if (LCD_WIDTH != 138) && (LCD_WIDTH != 128)
37/* These need adjusting for the Mini's and iRiver if'p screen */ 38/* These need adjusting for the Mini's and iRiver if'p screen */
38brickmania.c 39brickmania.c
@@ -41,6 +42,7 @@ calculator.c
41chip8.c 42chip8.c
42demystify.c 43demystify.c
43flipit.c 44flipit.c
45jewels.c
44minesweeper.c 46minesweeper.c
45oscilloscope.c 47oscilloscope.c
46pong.c 48pong.c
diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES
index 0ee98f9c0f..34f0f4254b 100644
--- a/apps/plugins/bitmaps/mono/SOURCES
+++ b/apps/plugins/bitmaps/mono/SOURCES
@@ -1,5 +1,17 @@
1#ifdef HAVE_LCD_BITMAP 1#ifdef HAVE_LCD_BITMAP
2 2
3/* Bubbles */
4#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128)
5bubbles_bubble.160x128x1.bmp
6#elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 132)
7bubbles_bubble.160x128x1.bmp
8#elif ((LCD_WIDTH == 220) && (LCD_HEIGHT == 176)) || \
9 ((LCD_WIDTH == 240) && (LCD_HEIGHT == 320))
10bubbles_bubble.220x176x1.bmp
11#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
12bubbles_bubble.320x240x1.bmp
13#endif
14
3/* BrickMania */ 15/* BrickMania */
4#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) 16#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
5 17
diff --git a/apps/plugins/bitmaps/mono/bubbles_bubble.160x128x1.bmp b/apps/plugins/bitmaps/mono/bubbles_bubble.160x128x1.bmp
new file mode 100755
index 0000000000..8a3a514247
--- /dev/null
+++ b/apps/plugins/bitmaps/mono/bubbles_bubble.160x128x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/bubbles_bubble.220x176x1.bmp b/apps/plugins/bitmaps/mono/bubbles_bubble.220x176x1.bmp
new file mode 100755
index 0000000000..da84ba796c
--- /dev/null
+++ b/apps/plugins/bitmaps/mono/bubbles_bubble.220x176x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/bubbles_bubble.320x240x1.bmp b/apps/plugins/bitmaps/mono/bubbles_bubble.320x240x1.bmp
new file mode 100755
index 0000000000..2ba692b178
--- /dev/null
+++ b/apps/plugins/bitmaps/mono/bubbles_bubble.320x240x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index 6b6896d263..b267fc9dfa 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -1,24 +1,28 @@
1#ifdef HAVE_LCD_BITMAP 1#ifdef HAVE_LCD_BITMAP
2 2
3/* Bejeweled */ 3/* Bubbles */
4#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) 4#if (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR)
5jewels.112x64x1.bmp 5bubbles_emblem.160x128x2.bmp
6#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64)
7jewels.112x64x1.bmp
8#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
9jewels.138x110x1.bmp
10#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR)
11jewels.160x128x1.bmp
12#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && defined(HAVE_LCD_COLOR) 6#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && defined(HAVE_LCD_COLOR)
13jewels.160x128x16.bmp 7bubbles_emblem.160x128x16.bmp
8bubbles_left.160x128x16.bmp
9bubbles_right.160x128x16.bmp
14#elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 132) 10#elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 132)
15jewels.160x128x16.bmp 11bubbles_emblem.160x128x16.bmp
12bubbles_left.176x132x16.bmp
13bubbles_right.176x132x16.bmp
16#elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176) 14#elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176)
17jewels.220x176x16.bmp 15bubbles_emblem.220x176x16.bmp
16bubbles_left.220x176x16.bmp
17bubbles_right.220x176x16.bmp
18#elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320) 18#elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320)
19jewels.220x176x16.bmp 19bubbles_emblem.220x176x16.bmp
20bubbles_left.240x320x16.bmp
21bubbles_right.240x320x16.bmp
20#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) 22#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
21jewels.320x240x16.bmp 23bubbles_emblem.320x240x16.bmp
24bubbles_left.320x240x16.bmp
25bubbles_right.320x240x16.bmp
22#endif 26#endif
23 27
24/* ChessBox */ 28/* ChessBox */
@@ -34,6 +38,27 @@ chessbox_pieces.128x128x1.bmp
34chessbox_pieces.64x64x1.bmp 38chessbox_pieces.64x64x1.bmp
35#endif 39#endif
36 40
41/* Jewels */
42#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
43jewels.112x64x1.bmp
44#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64)
45jewels.112x64x1.bmp
46#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
47jewels.138x110x1.bmp
48#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR)
49jewels.160x128x1.bmp
50#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && defined(HAVE_LCD_COLOR)
51jewels.160x128x16.bmp
52#elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 132)
53jewels.160x128x16.bmp
54#elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176)
55jewels.220x176x16.bmp
56#elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320)
57jewels.220x176x16.bmp
58#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
59jewels.320x240x16.bmp
60#endif
61
37/* Solitaire */ 62/* Solitaire */
38#ifdef HAVE_LCD_COLOR 63#ifdef HAVE_LCD_COLOR
39solitaire_cardback.220x176x16.bmp 64solitaire_cardback.220x176x16.bmp
diff --git a/apps/plugins/bitmaps/native/bubbles_emblem.160x128x16.bmp b/apps/plugins/bitmaps/native/bubbles_emblem.160x128x16.bmp
new file mode 100755
index 0000000000..cda6ef4f74
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_emblem.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_emblem.160x128x2.bmp b/apps/plugins/bitmaps/native/bubbles_emblem.160x128x2.bmp
new file mode 100755
index 0000000000..ea803f6da7
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_emblem.160x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_emblem.220x176x16.bmp b/apps/plugins/bitmaps/native/bubbles_emblem.220x176x16.bmp
new file mode 100755
index 0000000000..92cb7d1be1
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_emblem.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_emblem.320x240x16.bmp b/apps/plugins/bitmaps/native/bubbles_emblem.320x240x16.bmp
new file mode 100755
index 0000000000..f32aff410b
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_emblem.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_left.160x128x16.bmp b/apps/plugins/bitmaps/native/bubbles_left.160x128x16.bmp
new file mode 100755
index 0000000000..15f78cfdf2
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_left.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_left.176x132x16.bmp b/apps/plugins/bitmaps/native/bubbles_left.176x132x16.bmp
new file mode 100755
index 0000000000..dbad0543a3
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_left.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_left.220x176x16.bmp b/apps/plugins/bitmaps/native/bubbles_left.220x176x16.bmp
new file mode 100755
index 0000000000..cbe38ca53c
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_left.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_left.240x320x16.bmp b/apps/plugins/bitmaps/native/bubbles_left.240x320x16.bmp
new file mode 100755
index 0000000000..25cf12ddbf
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_left.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_left.320x240x16.bmp b/apps/plugins/bitmaps/native/bubbles_left.320x240x16.bmp
new file mode 100755
index 0000000000..194bea0ff0
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_left.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_right.160x128x16.bmp b/apps/plugins/bitmaps/native/bubbles_right.160x128x16.bmp
new file mode 100755
index 0000000000..d065365e82
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_right.160x128x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_right.176x132x16.bmp b/apps/plugins/bitmaps/native/bubbles_right.176x132x16.bmp
new file mode 100755
index 0000000000..1093c17b2b
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_right.176x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_right.220x176x16.bmp b/apps/plugins/bitmaps/native/bubbles_right.220x176x16.bmp
new file mode 100755
index 0000000000..c0d8bef8ab
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_right.220x176x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_right.240x320x16.bmp b/apps/plugins/bitmaps/native/bubbles_right.240x320x16.bmp
new file mode 100755
index 0000000000..7f08389cc0
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_right.240x320x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/bubbles_right.320x240x16.bmp b/apps/plugins/bitmaps/native/bubbles_right.320x240x16.bmp
new file mode 100755
index 0000000000..5872fdc8ec
--- /dev/null
+++ b/apps/plugins/bitmaps/native/bubbles_right.320x240x16.bmp
Binary files differ
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c
new file mode 100755
index 0000000000..9e523fa744
--- /dev/null
+++ b/apps/plugins/bubbles.c
@@ -0,0 +1,2537 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2005 Adam Boot
11*
12* Color graphics from Frozen Bubble (http://www.frozen-bubble.org/)
13*
14* All files in this archive are subject to the GNU General Public License.
15* See the file COPYING in the source tree root for full license agreement.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include "plugin.h"
23#include "xlcd.h"
24
25#ifdef HAVE_LCD_BITMAP
26
27PLUGIN_HEADER
28
29/* files */
30#define SCORE_FILE PLUGIN_DIR "/bubbles.score"
31#define SAVE_FILE PLUGIN_DIR "/bubbles.save"
32
33/* final game return status */
34#define BB_NONE 5
35#define BB_WIN 4
36#define BB_END 3
37#define BB_USB 2
38#define BB_QUIT 1
39#define BB_LOSE 0
40
41/* play board dimension */
42#define BB_HEIGHT 12
43#define BB_WIDTH 8
44#define BB_LEVEL_HEIGHT BB_HEIGHT-2
45
46/* animation fps */
47#define MAX_FPS 20
48
49/* various amount */
50#define NUM_SCORES 10
51#define NUM_LEVELS 100
52#define NUM_QUEUE 2
53#define NUM_BUBBLES 8
54#define MIN_ANGLE -76
55#define MAX_ANGLE 76
56#define NUM_COMPRESS 9
57#define MAX_SHOTTIME 1000
58
59/* button definitions */
60#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
61#define BUBBLES_LEFT BUTTON_LEFT
62#define BUBBLES_RIGHT BUTTON_RIGHT
63#define BUBBLES_UP BUTTON_UP
64#define BUBBLES_DOWN BUTTON_DOWN
65#define BUBBLES_QUIT BUTTON_OFF
66#define BUBBLES_START BUTTON_ON
67#define BUBBLES_SELECT BUTTON_SELECT
68#define BUBBLES_RESUME BUTTON_MODE
69
70#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
71#define BUBBLES_LEFT BUTTON_SCROLL_BACK
72#define BUBBLES_RIGHT BUTTON_SCROLL_FWD
73#define BUBBLES_UP BUTTON_SCROLL_FWD
74#define BUBBLES_DOWN BUTTON_SCROLL_BACK
75#define BUBBLES_QUIT BUTTON_MENU|BUTTON_REL
76#define BUBBLES_START BUTTON_PLAY|BUTTON_REL
77#define BUBBLES_SELECT BUTTON_SELECT
78#define BUBBLES_RESUME BUTTON_RIGHT|BUTTON_LEFT
79
80#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
81#define BUBBLES_LEFT BUTTON_LEFT
82#define BUBBLES_RIGHT BUTTON_RIGHT
83#define BUBBLES_UP BUTTON_UP
84#define BUBBLES_DOWN BUTTON_DOWN
85#define BUBBLES_QUIT BUTTON_POWER
86#define BUBBLES_START BUTTON_PLAY
87#define BUBBLES_SELECT BUTTON_SELECT
88#define BUBBLES_RESUME BUTTON_REC
89
90#elif CONFIG_KEYPAD == GIGABEAT_PAD
91#define BUBBLES_LEFT BUTTON_LEFT
92#define BUBBLES_RIGHT BUTTON_RIGHT
93#define BUBBLES_UP BUTTON_UP
94#define BUBBLES_DOWN BUTTON_DOWN
95#define BUBBLES_QUIT BUTTON_A
96#define BUBBLES_START BUTTON_POWER
97#define BUBBLES_SELECT BUTTON_SELECT
98#define BUBBLES_RESUME BUTTON_MENU
99
100#else
101 #error BUBBLES: Unsupported keypad
102#endif
103
104/* bubbles will consume height of 10*ROW_HEIGHT+2*(BUBBLE_SZ-1)+BUBBLE_SZ/2 */
105/* 24x24 bubbles (iPod Video) */
106#if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320)
107#define BUBBLE_SZ 22
108#define EMBLEM_SZ 16
109#define XOFS 72
110#define ROW_HEIGHT 18
111#define ROW_INDENT 13
112
113/* 16x16 bubbles (H300, iPod Color) */
114#elif (LCD_HEIGHT == 176) && (LCD_WIDTH == 220)
115#define BUBBLE_SZ 16
116#define EMBLEM_SZ 12
117#define XOFS 46
118#define ROW_HEIGHT 14
119#define ROW_INDENT 8
120
121/* 16x16 bubbles (Gigabeat) */
122#elif (LCD_HEIGHT == 320) && (LCD_WIDTH == 240)
123#define BUBBLE_SZ 16
124#define EMBLEM_SZ 12
125#define XOFS 56
126#define ROW_HEIGHT 14
127#define ROW_INDENT 8
128
129/* 12x12 bubbles (iPod Nano) */
130#elif (LCD_HEIGHT == 132) && (LCD_WIDTH == 176)
131#define BUBBLE_SZ 12
132#define EMBLEM_SZ 8
133#define XOFS 40
134#define ROW_HEIGHT 10
135#define ROW_INDENT 6
136
137/* 12x12 bubbles (H100, iAudio X5, iPod 3G, iPod 4G grayscale) */
138#elif (LCD_HEIGHT == 128) && (LCD_WIDTH == 160)
139#define BUBBLE_SZ 12
140#define EMBLEM_SZ 8
141#define XOFS 33
142#define ROW_HEIGHT 10
143#define ROW_INDENT 6
144
145#else
146 #error BUBBLES: Unsupported LCD type
147#endif
148
149/* shot position */
150#define SHOTX XOFS+ROW_INDENT+BUBBLE_SZ*3
151#define SHOTY ROW_HEIGHT*(BB_HEIGHT-1)+BUBBLE_SZ/2
152
153/* collision distance squared */
154#define MIN_DISTANCE ((BUBBLE_SZ*8)/10)*((BUBBLE_SZ*8)/10)
155
156/* external bitmaps */
157extern const fb_data bubbles_bubble[];
158extern const fb_data bubbles_emblem[];
159#ifdef HAVE_LCD_COLOR
160extern const fb_data bubbles_left[];
161extern const fb_data bubbles_right[];
162#endif
163
164/* global rockbox api */
165static struct plugin_api* rb;
166
167/* levels */
168char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = {
169 {{ 6, 6, 4, 4, 2, 2, 3, 3},
170 { 6, 6, 4, 4, 2, 2, 3, -1},
171 { 2, 2, 3, 3, 6, 6, 4, 4},
172 { 2, 3, 3, 6, 6, 4, 4, -1},
173 {-1, -1, -1, -1, -1, -1, -1, -1},
174 {-1, -1, -1, -1, -1, -1, -1, -1},
175 {-1, -1, -1, -1, -1, -1, -1, -1},
176 {-1, -1, -1, -1, -1, -1, -1, -1},
177 {-1, -1, -1, -1, -1, -1, -1, -1},
178 {-1, -1, -1, -1, -1, -1, -1, -1}},
179 {{-1, 7, 7, 7, 7, 7, 7, -1},
180 {-1, 1, 1, 1, 1, 1, -1, -1},
181 {-1, -1, 2, 2, 2, 2, -1, -1},
182 {-1, -1, -1, 2, -1, -1, -1, -1},
183 {-1, -1, -1, 2, 2, -1, -1, -1},
184 {-1, -1, -1, 5, -1, -1, -1, -1},
185 {-1, -1, -1, 5, 5, -1, -1, -1},
186 {-1, -1, -1, -1, -1, -1, -1, -1},
187 {-1, -1, -1, -1, -1, -1, -1, -1},
188 {-1, -1, -1, -1, -1, -1, -1, -1}},
189 {{-1, -1, 7, -1, -1, 7, -1, -1},
190 {-1, -1, 7, 1, 7, -1, -1, -1},
191 {-1, -1, -1, 1, 2, -1, -1, -1},
192 {-1, -1, 1, 2, 1, -1, -1, -1},
193 {-1, -1, -1, 2, 5, -1, -1, -1},
194 {-1, -1, 3, 5, 3, -1, -1, -1},
195 {-1, -1, -1, 5, 3, -1, -1, -1},
196 {-1, -1, -1, 3, -1, -1, -1, -1},
197 {-1, -1, -1, -1, -1, -1, -1, -1},
198 {-1, -1, -1, -1, -1, -1, -1, -1}},
199 {{-1, -1, -1, 0, 0, -1, -1, -1},
200 {-1, -1, 5, 0, 1, -1, -1, -1},
201 {-1, -1, 3, 5, 1, 6, -1, -1},
202 {-1, 4, 3, -1, 6, 7, -1, -1},
203 {-1, 7, 4, -1, -1, 7, 4, -1},
204 { 6, 7, -1, -1, -1, 4, 3, -1},
205 { 1, 6, -1, -1, -1, -1, 3, 5},
206 { 1, -1, -1, -1, -1, -1, 5, -1},
207 {-1, -1, -1, -1, -1, -1, -1, -1},
208 {-1, -1, -1, -1, -1, -1, -1, -1}},
209 {{-1, -1, 0, 0, 0, 0, -1, -1},
210 {-1, 0, 1, 1, 1, 0, -1, -1},
211 {-1, 0, 1, 0, 0, 1, 0, -1},
212 {-1, 0, 1, 1, 1, 0, -1, -1},
213 {-1, -1, 0, 0, 0, 0, -1, -1},
214 {-1, -1, 7, -1, 7, -1, -1, -1},
215 {-1, -1, 7, 7, 7, 7, -1, -1},
216 {-1, -1, -1, -1, -1, -1, -1, -1},
217 {-1, -1, -1, -1, -1, -1, -1, -1},
218 {-1, -1, -1, -1, -1, -1, -1, -1}},
219 {{-1, 4, 4, 4, 6, 6, 6, -1},
220 { 4, -1, -1, -1, -1, -1, 6, -1},
221 {-1, 4, -1, -1, -1, -1, 6, -1},
222 { 4, 2, 3, 1, 2, 3, 6, -1},
223 {-1, 3, 1, 2, 3, 1, 2, -1},
224 {-1, -1, -1, -1, -1, -1, -1, -1},
225 {-1, -1, -1, -1, -1, -1, -1, -1},
226 {-1, -1, -1, -1, -1, -1, -1, -1},
227 {-1, -1, -1, -1, -1, -1, -1, -1},
228 {-1, -1, -1, -1, -1, -1, -1, -1}},
229 {{-1, 4, 4, 4, 6, 6, 6, -1},
230 { 4, -1, -1, -1, -1, -1, 6, -1},
231 {-1, 4, -1, -1, -1, -1, 6, -1},
232 { 4, 2, 3, 1, 2, 3, 6, -1},
233 {-1, 3, 1, 2, 3, 1, 2, -1},
234 {-1, 2, 3, 1, 2, 3, -1, -1},
235 {-1, -1, -1, -1, -1, -1, -1, -1},
236 {-1, -1, -1, -1, -1, -1, -1, -1},
237 {-1, -1, -1, -1, -1, -1, -1, -1},
238 {-1, -1, -1, -1, -1, -1, -1, -1}},
239 {{-1, 0, 0, -1, -1, 2, 2, -1},
240 {-1, 5, -1, -1, -1, 3, -1, -1},
241 {-1, 0, -1, -1, -1, 6, -1, -1},
242 {-1, 3, -1, -1, -1, 0, -1, -1},
243 {-1, 4, -1, -1, -1, 5, -1, -1},
244 {-1, 2, -1, -1, -1, 3, -1, -1},
245 {-1, 2, -1, -1, -1, 1, -1, -1},
246 {-1, 3, -1, -1, -1, 4, -1, -1},
247 {-1, -1, -1, -1, -1, -1, -1, -1},
248 {-1, -1, -1, -1, -1, -1, -1, -1}},
249 {{ 3, -1, -1, -1, -1, -1, -1, 3},
250 { 6, 3, 2, 4, 6, 3, 2, -1},
251 { 4, -1, -1, -1, -1, -1, -1, 4},
252 { 2, 4, 6, 3, 2, 4, 6, -1},
253 {-1, -1, -1, 6, -1, -1, -1, -1},
254 {-1, -1, -1, 3, -1, -1, -1, -1},
255 {-1, -1, -1, -1, -1, -1, -1, -1},
256 {-1, -1, -1, -1, -1, -1, -1, -1},
257 {-1, -1, -1, -1, -1, -1, -1, -1},
258 {-1, -1, -1, -1, -1, -1, -1, -1}},
259 {{-1, 2, -1, 1, -1, 1, -1, 2},
260 { 1, 2, -1, 2, 1, -1, 1, -1},
261 { 1, -1, 1, -1, 2, -1, 2, -1},
262 { 2, 1, -1, 1, 2, -1, 2, -1},
263 {-1, 2, -1, 2, -1, 2, -1, 2},
264 { 1, 2, -1, 2, 1, -1, 1, -1},
265 { 1, -1, 1, -1, 2, -1, 1, -1},
266 { 2, 2, -1, 1, 1, -1, 2, -1},
267 {-1, 2, -1, 1, -1, 1, -1, 1},
268 {-1, -1, -1, -1, -1, -1, -1, -1}},
269 {{-1, 7, 7, -1, -1, 5, 5, -1},
270 { 1, -1, -1, -1, -1, -1, 4, -1},
271 { 2, 1, -1, -1, -1, -1, 4, 3},
272 { 2, -1, -1, -1, -1, -1, 3, -1},
273 { 1, 2, -1, -1, -1, -1, 3, 4},
274 { 1, -1, -1, -1, -1, -1, 4, -1},
275 { 7, 1, -1, -1, -1, -1, 4, 5},
276 { 7, 7, -1, -1, -1, 5, 5, -1},
277 {-1, -1, -1, -1, -1, -1, -1, -1},
278 {-1, -1, -1, -1, -1, -1, -1, -1}},
279 {{ 7, 7, -1, -1, -1, -1, 5, 5},
280 { 1, 5, -1, -1, -1, 7, 4, -1},
281 { 2, 1, -1, -1, -1, -1, 4, 3},
282 { 2, -1, -1, -1, -1, -1, 3, -1},
283 { 1, 5, -1, -1, -1, -1, 7, 4},
284 { 1, -1, -1, -1, -1, -1, 4, -1},
285 { 7, 1, -1, -1, -1, -1, 4, 5},
286 { 7, 5, -1, -1, -1, 7, 5, -1},
287 {-1, -1, -1, -1, -1, -1, -1, -1},
288 {-1, -1, -1, -1, -1, -1, -1, -1}},
289 {{-1, -1, -1, 0, 0, -1, -1, -1},
290 {-1, -1, 5, 0, 1, -1, -1, -1},
291 {-1, -1, 3, 5, 1, 6, -1, -1},
292 {-1, 4, 3, 2, 6, 2, -1, -1},
293 {-1, 7, 4, 7, 2, 2, 4, -1},
294 { 6, 7, 7, 3, 3, 4, 3, -1},
295 { 1, 6, 1, 1, 1, 3, 3, 5},
296 { 1, 1, -1, -1, -1, -1, 5, -1},
297 {-1, -1, -1, -1, -1, -1, -1, -1},
298 {-1, -1, -1, -1, -1, -1, -1, -1}},
299 {{-1, -1, 0, -1, -1, 0, -1, -1},
300 {-1, 3, 3, -1, 3, 3, -1, -1},
301 {-1, 0, 2, 0, 0, 2, 0, -1},
302 {-1, 3, 3, -1, 3, 3, -1, -1},
303 {-1, -1, 0, -1, -1, 0, -1, -1},
304 {-1, -1, -1, -1, -1, -1, -1, -1},
305 {-1, -1, -1, -1, -1, -1, -1, -1},
306 {-1, -1, -1, -1, -1, -1, -1, -1},
307 {-1, -1, -1, -1, -1, -1, -1, -1},
308 {-1, -1, -1, -1, -1, -1, -1, -1}},
309 {{-1, -1, -1, 1, 1, -1, -1, -1},
310 {-1, -1, 2, 2, 2, -1, -1, -1},
311 {-1, -1, 3, 3, 3, 3, -1, -1},
312 {-1, 4, 4, 4, 4, 4, -1, -1},
313 {-1, 5, 5, 5, 5, 5, 5, -1},
314 {-1, -1, -1, 6, -1, -1, -1, -1},
315 {-1, -1, -1, 7, 7, -1, -1, -1},
316 {-1, -1, -1, 0, -1, -1, -1, -1},
317 {-1, -1, -1, -1, -1, -1, -1, -1},
318 {-1, -1, -1, -1, -1, -1, -1, -1}},
319 {{-1, -1, -1, 2, 5, -1, -1, -1},
320 {-1, 4, 3, -1, -1, -1, -1, -1},
321 { 6, 7, -1, 5, 2, -1, -1, -1},
322 {-1, -1, -1, -1, 3, 4, -1, -1},
323 {-1, -1, -1, 2, 5, -1, 7, 6},
324 {-1, 4, 3, -1, -1, -1, -1, -1},
325 { 6, 7, -1, 5, 2, -1, -1, -1},
326 {-1, -1, -1, -1, 3, 4, -1, -1},
327 {-1, -1, -1, -1, -1, -1, 7, 6},
328 {-1, -1, -1, -1, -1, -1, -1, -1}},
329 {{-1, -1, -1, 5, 5, -1, -1, -1},
330 {-1, -1, -1, 3, -1, -1, -1, -1},
331 {-1, -1, -1, 1, -1, -1, -1, -1},
332 {-1, -1, -1, 7, -1, -1, -1, -1},
333 {-1, -1, -1, 2, -1, -1, -1, -1},
334 {-1, -1, -1, 4, -1, -1, -1, -1},
335 {-1, -1, -1, 5, -1, -1, -1, -1},
336 {-1, -1, -1, 3, -1, -1, -1, -1},
337 {-1, -1, -1, -1, -1, -1, -1, -1},
338 {-1, -1, -1, -1, -1, -1, -1, -1}},
339 {{-1, -1, -1, 0, 1, -1, -1, -1},
340 {-1, -1, 0, 2, 7, 7, -1, -1},
341 {-1, -1, -1, 0, 1, 7, -1, -1},
342 {-1, 0, 0, 0, 0, -1, -1, -1},
343 {-1, 0, 0, 0, 1, 1, -1, -1},
344 { 0, 0, 0, 1, 1, 1, -1, -1},
345 {-1, 0, 0, 1, 1, 1, -1, -1},
346 {-1, 0, 0, 0, 7, 7, -1, -1},
347 {-1, -1, 7, 7, -1, -1, -1, -1},
348 {-1, -1, -1, -1, -1, -1, -1, -1}},
349 {{-1, 1, -1, -1, -1, -1, -1, -1},
350 { 1, -1, -1, -1, -1, -1, -1, -1},
351 {-1, 2, 3, 4, 7, 6, 5, -1},
352 {-1, -1, -1, -1, -1, -1, 1, -1},
353 {-1, -1, -1, -1, -1, -1, 1, -1},
354 {-1, 2, 3, 4, 7, 6, -1, -1},
355 {-1, 1, -1, -1, -1, -1, -1, -1},
356 { 1, -1, -1, -1, -1, -1, -1, -1},
357 {-1, 2, 3, 4, 7, 6, 5, -1},
358 {-1, -1, -1, -1, -1, -1, -1, -1}},
359 {{-1, 6, -1, -1, -1, -1, -1, -1},
360 { 5, -1, -1, -1, -1, -1, -1, -1},
361 { 2, 3, 4, 7, 6, 5, 2, 3},
362 {-1, -1, -1, -1, -1, -1, 4, -1},
363 {-1, -1, -1, -1, -1, -1, 7, -1},
364 {-1, 4, 3, 2, 5, 6, -1, -1},
365 {-1, 7, -1, -1, -1, -1, -1, -1},
366 { 6, -1, -1, -1, -1, -1, -1, -1},
367 { 5, 2, 3, 4, 7, 6, 5, -1},
368 {-1, -1, -1, -1, -1, -1, -1, -1}},
369 {{ 3, 2, 1, 0, 0, 1, 2, 3},
370 { 3, 2, 1, 0, 1, 2, 3, -1},
371 { 4, 3, 2, 1, 1, 2, 3, 4},
372 { 4, 3, 2, 1, 2, 3, 4, -1},
373 { 5, 4, 3, 2, 2, 3, 4, 5},
374 { 5, 4, 3, 2, 3, 4, 5, -1},
375 { 6, 5, 4, 3, 3, 4, 5, 6},
376 { 6, 5, 4, 3, 4, 5, 6, -1},
377 { 7, 6, 5, 4, 4, 5, 6, 7},
378 {-1, -1, -1, -1, -1, -1, -1, -1}},
379 {{-1, -1, -1, 5, 5, -1, -1, -1},
380 {-1, -1, -1, 3, -1, -1, -1, -1},
381 {-1, -1, -1, 2, 4, -1, -1, -1},
382 {-1, -1, -1, 6, -1, -1, -1, -1},
383 {-1, -1, -1, 2, 4, -1, -1, -1},
384 {-1, 2, -1, 5, -1, 4, -1, -1},
385 { 1, 0, 1, 0, 1, 0, 1, 0},
386 { 3, -1, 3, -1, 2, -1, 6, -1},
387 {-1, -1, -1, -1, -1, -1, -1, -1},
388 {-1, -1, -1, -1, -1, -1, -1, -1}},
389 {{-1, -1, -1, -1, 1, -1, -1, -1},
390 { 7, 4, 3, 5, -1, -1, -1, -1},
391 { 6, -1, -1, 1, -1, -1, -1, -1},
392 {-1, -1, -1, 5, 3, 4, 7, -1},
393 { 6, -1, -1, -1, 1, -1, -1, 6},
394 { 7, 4, 3, 5, -1, -1, -1, -1},
395 {-1, -1, -1, 1, -1, -1, -1, 6},
396 {-1, -1, -1, 5, 3, 4, 7, -1},
397 {-1, -1, -1, -1, -1, -1, -1, -1},
398 {-1, -1, -1, -1, -1, -1, -1, -1}},
399 {{-1, -1, -1, -1, 7, 3, 6, -1},
400 {-1, -1, 3, 7, 3, 6, 3, -1},
401 {-1, -1, 5, 7, 3, 6, 3, -1},
402 {-1, 6, 7, 3, 6, 7, -1, -1},
403 {-1, 7, 7, 3, 6, 1, -1, -1},
404 { 3, 7, 3, 6, 3, -1, -1, -1},
405 { 5, 6, 2, 7, 1, -1, -1, -1},
406 {-1, -1, -1, -1, -1, -1, -1, -1},
407 {-1, -1, -1, -1, -1, -1, -1, -1},
408 {-1, -1, -1, -1, -1, -1, -1, -1}},
409 {{ 5, -1, -1, -1, -1, -1, -1, 5},
410 { 5, -1, 6, 6, 6, -1, 5, -1},
411 {-1, 5, 4, -1, -1, 4, 5, -1},
412 {-1, 3, -1, -1, -1, 3, -1, -1},
413 {-1, 6, 0, -1, -1, 0, 6, -1},
414 {-1, 3, -1, -1, -1, 3, -1, -1},
415 {-1, -1, 4, -1, -1, 4, -1, -1},
416 {-1, -1, 6, 6, 6, -1, -1, -1},
417 {-1, -1, -1, -1, -1, -1, -1, -1},
418 {-1, -1, -1, -1, -1, -1, -1, -1}},
419 {{-1, 7, 0, -1, -1, 0, 7, -1},
420 { 7, -1, 0, -1, 0, -1, 7, -1},
421 { 7, 1, -1, 0, 0, -1, 1, 7},
422 { 7, 1, 2, 0, 2, 1, 7, -1},
423 { 7, 6, 3, 2, 2, 3, 6, 7},
424 { 7, -1, 3, 2, 3, -1, 7, -1},
425 {-1, 7, 7, 3, 3, 7, 7, -1},
426 {-1, -1, -1, 3, -1, -1, -1, -1},
427 {-1, -1, -1, -1, -1, -1, -1, -1},
428 {-1, -1, -1, -1, -1, -1, -1, -1}},
429 {{-1, 3, -1, 1, -1, 7, -1, 6},
430 { 5, -1, 7, -1, 7, -1, 6, -1},
431 { 6, -1, 0, -1, 5, -1, 3, -1},
432 {-1, 2, -1, 1, -1, 5, -1, -1},
433 {-1, 4, -1, 3, -1, 4, -1, -1},
434 { 2, -1, 3, -1, 2, -1, -1, -1},
435 {-1, -1, 4, -1, 6, -1, -1, -1},
436 {-1, -1, -1, 5, -1, -1, -1, -1},
437 {-1, -1, -1, -1, -1, -1, -1, -1},
438 {-1, -1, -1, -1, -1, -1, -1, -1}},
439 {{-1, -1, -1, -1, 1, -1, -1, -1},
440 {-1, -1, -1, -1, 3, -1, -1, -1},
441 { 6, 1, 3, 1, 2, 1, 4, 1},
442 {-1, -1, -1, -1, 6, -1, -1, -1},
443 {-1, -1, -1, 4, 1, -1, -1, -1},
444 {-1, -1, 1, -1, 3, -1, -1, -1},
445 {-1, -1, -1, 2, 1, -1, -1, -1},
446 {-1, -1, -1, -1, 4, -1, -1, -1},
447 {-1, -1, -1, 6, 1, -1, -1, -1},
448 {-1, -1, -1, 6, -1, -1, -1, -1}},
449 {{-1, -1, -1, 5, 4, -1, -1, -1},
450 {-1, -1, 4, 1, 0, -1, -1, -1},
451 {-1, -1, -1, 2, 3, -1, -1, -1},
452 {-1, 1, 4, -1, 2, 2, -1, -1},
453 {-1, 3, 1, 2, 5, 1, 4, -1},
454 {-1, 4, 2, -1, 0, 4, -1, -1},
455 {-1, -1, -1, -1, -1, -1, -1, -1},
456 {-1, -1, -1, -1, -1, -1, -1, -1},
457 {-1, -1, -1, -1, -1, -1, -1, -1},
458 {-1, -1, -1, -1, -1, -1, -1, -1}},
459 {{-1, -1, -1, -1, 1, -1, -1, -1},
460 {-1, -1, -1, 1, -1, -1, -1, -1},
461 {-1, 2, -1, -1, 1, -1, 5, -1},
462 { 5, -1, -1, 1, -1, -1, 0, -1},
463 {-1, 6, -1, -1, 1, -1, 4, -1},
464 {-1, 0, -1, 1, -1, 5, -1, -1},
465 {-1, -1, 5, 5, 0, 1, -1, -1},
466 {-1, -1, -1, -1, -1, -1, -1, -1},
467 {-1, -1, -1, -1, -1, -1, -1, -1},
468 {-1, -1, -1, -1, -1, -1, -1, -1}},
469 {{-1, -1, -1, 6, 3, -1, -1, -1},
470 {-1, -1, 3, 2, 6, -1, -1, -1},
471 {-1, -1, 2, 6, 3, 2, -1, -1},
472 {-1, 6, 3, 2, 6, 3, -1, -1},
473 {-1, 3, 2, 6, 3, 2, 6, -1},
474 { 2, 6, 3, 2, 6, 3, 2, -1},
475 { 6, 3, 2, 6, 3, 2, 6, 3},
476 {-1, -1, -1, -1, -1, -1, -1, -1},
477 {-1, -1, -1, -1, -1, -1, -1, -1},
478 {-1, -1, -1, -1, -1, -1, -1, -1}},
479 {{ 6, 6, 6, 6, 6, 6, 6, 6},
480 { 4, -1, -1, -1, -1, -1, -1, -1},
481 {-1, 3, 2, 5, 7, 6, 4, 3},
482 {-1, 5, -1, -1, -1, -1, -1, -1},
483 {-1, -1, 7, 6, 4, 3, 2, 5},
484 {-1, -1, 4, -1, -1, -1, -1, -1},
485 {-1, -1, -1, 3, 2, 5, 7, 6},
486 {-1, -1, -1, -1, -1, -1, -1, -1},
487 {-1, -1, -1, -1, -1, -1, -1, -1},
488 {-1, -1, -1, -1, -1, -1, -1, -1}},
489 {{ 1, -1, 7, -1, -1, 6, -1, 2},
490 { 6, -1, 1, -1, 6, 1, 3, -1},
491 {-1, 4, -1, 7, 2, -1, 7, -1},
492 { 2, 7, -1, -1, -1, 4, -1, -1},
493 { 6, -1, 3, 5, 0, 2, -1, 7},
494 { 1, -1, -1, -1, -1, -1, 1, -1},
495 {-1, 1, 4, 5, 7, 5, 1, -1},
496 {-1, -1, -1, -1, -1, -1, -1, -1},
497 {-1, -1, -1, -1, -1, -1, -1, -1},
498 {-1, -1, -1, -1, -1, -1, -1, -1}},
499 {{ 6, 6, 6, -1, -1, 6, 6, 6},
500 {-1, -1, 6, -1, 6, -1, -1, -1},
501 {-1, -1, 2, 3, 3, 2, -1, -1},
502 {-1, 3, -1, 5, -1, 3, -1, -1},
503 {-1, -1, 5, 3, 3, 5, -1, -1},
504 {-1, -1, 6, 1, 6, -1, -1, -1},
505 {-1, 4, 2, -1, -1, 2, 4, -1},
506 {-1, -1, -1, -1, -1, -1, -1, -1},
507 {-1, -1, -1, -1, -1, -1, -1, -1},
508 {-1, -1, -1, -1, -1, -1, -1, -1}},
509 {{-1, -1, -1, 5, 5, -1, -1, -1},
510 {-1, -1, 5, -1, -1, -1, -1, -1},
511 {-1, 3, 4, 6, 6, -1, -1, 5},
512 { 3, 3, 4, 6, 5, -1, 5, -1},
513 { 3, 2, 3, 6, 6, 5, 5, -1},
514 { 3, 3, 4, 6, 5, -1, 5, -1},
515 {-1, 3, 4, 6, 6, -1, -1, 5},
516 {-1, -1, 5, -1, -1, -1, -1, -1},
517 {-1, -1, -1, 5, 5, -1, -1, -1},
518 {-1, -1, -1, -1, -1, -1, -1, -1}},
519 {{ 1, -1, -1, -1, -1, -1, -1, 1},
520 { 1, -1, 2, 2, 2, -1, 1, -1},
521 {-1, 1, 2, 3, 3, 2, 1, -1},
522 { 6, 2, 3, -1, 3, 2, 6, -1},
523 { 6, 2, 3, -1, -1, 3, 2, 6},
524 { 6, 2, 3, -1, 3, 2, 6, -1},
525 { 3, 3, 3, 7, 7, 3, 3, 3},
526 { 0, 5, 0, 2, 0, 5, 0, -1},
527 {-1, -1, -1, -1, -1, -1, -1, -1},
528 {-1, -1, -1, -1, -1, -1, -1, -1}},
529 {{-1, -1, 7, 7, 7, -1, -1, -1},
530 {-1, 7, 2, 2, 7, -1, -1, -1},
531 {-1, 7, 5, 5, 5, 7, -1, -1},
532 { 7, 7, 7, 7, 7, 7, -1, -1},
533 {-1, -1, 6, -1, 6, -1, -1, -1},
534 {-1, 6, -1, -1, 6, -1, -1, -1},
535 {-1, 6, 4, 4, -1, 6, 4, 4},
536 {-1, -1, -1, -1, -1, -1, -1, -1},
537 {-1, -1, -1, -1, -1, -1, -1, -1},
538 {-1, -1, -1, -1, -1, -1, -1, -1}},
539 {{-1, 3, 3, -1, 3, 3, 3, -1},
540 { 3, 7, 5, 4, 6, 5, 3, -1},
541 { 1, 3, 3, 3, -1, 3, 3, 1},
542 { 2, 1, 2, 1, 2, 1, 2, -1},
543 { 1, 3, 3, -1, 3, 3, 3, 1},
544 { 3, 5, 6, 4, 5, 7, 3, -1},
545 { 2, 3, 3, 3, -1, 3, 3, 2},
546 { 1, 1, 2, 2, 2, 1, 1, -1},
547 {-1, -1, -1, -1, -1, -1, -1, -1},
548 {-1, -1, -1, -1, -1, -1, -1, -1}},
549 {{-1, 6, 5, -1, -1, -1, -1, -1},
550 { 3, 1, 3, -1, -1, -1, -1, -1},
551 {-1, 5, 6, -1, -1, -1, -1, -1},
552 {-1, -1, 5, 3, -1, -1, -1, -1},
553 {-1, -1, 6, 1, 6, -1, -1, -1},
554 {-1, -1, 3, 5, -1, -1, -1, -1},
555 {-1, -1, -1, -1, 3, 6, -1, -1},
556 {-1, -1, -1, 5, 6, 5, -1, -1},
557 {-1, -1, -1, -1, 6, 3, -1, -1},
558 {-1, -1, -1, -1, -1, -1, -1, -1}},
559 {{ 6, 3, 7, 4, 5, 1, 6, 3},
560 { 5, 1, 6, 3, 7, 4, 5, -1},
561 { 6, 3, 7, 4, 5, 1, 6, 3},
562 {-1, -1, -1, -1, -1, -1, -1, -1},
563 {-1, -1, -1, -1, -1, -1, -1, -1},
564 {-1, -1, -1, -1, -1, -1, -1, -1},
565 {-1, -1, -1, -1, -1, -1, -1, -1},
566 {-1, -1, -1, -1, -1, -1, -1, -1},
567 {-1, -1, -1, -1, -1, -1, -1, -1},
568 {-1, -1, -1, -1, -1, -1, -1, -1}},
569 {{-1, -1, -1, -1, -1, -1, 4, 4},
570 {-1, -1, 7, 7, 7, 4, 4, -1},
571 {-1, -1, -1, -1, -1, -1, 4, 4},
572 {-1, 1, -1, -1, -1, 7, -1, -1},
573 {-1, 1, 1, -1, -1, 7, -1, -1},
574 { 3, 3, 3, -1, 7, -1, -1, -1},
575 { 3, -1, 2, 3, 3, 3, -1, 3},
576 {-1, 2, -1, 3, -1, 3, 3, -1},
577 {-1, 2, -1, -1, -1, -1, -1, -1},
578 {-1, -1, -1, -1, -1, -1, -1, -1}},
579 {{-1, -1, 4, -1, -1, -1, -1, -1},
580 {-1, 7, 4, -1, -1, -1, -1, -1},
581 {-1, -1, 7, 4, -1, -1, -1, -1},
582 {-1, 4, 7, 4, -1, -1, -1, -1},
583 { 1, 1, 1, 1, 1, 1, 1, -1},
584 { 1, 2, 1, 2, 1, 1, -1, -1},
585 { 2, 2, 2, 2, 2, 2, 2, 2},
586 {-1, -1, -1, -1, -1, -1, -1, -1},
587 {-1, -1, -1, -1, -1, -1, -1, -1},
588 {-1, -1, -1, -1, -1, -1, -1, -1}},
589 {{ 0, -1, -1, -1, -1, -1, -1, 6},
590 { 6, 1, 4, 3, 7, 5, 0, -1},
591 { 0, -1, -1, -1, -1, -1, -1, 6},
592 { 6, 1, 4, 3, 7, 5, 0, -1},
593 { 0, -1, -1, -1, -1, -1, -1, 6},
594 { 6, 1, 4, 3, 7, 5, 0, -1},
595 {-1, -1, -1, -1, -1, -1, -1, -1},
596 {-1, -1, -1, -1, -1, -1, -1, -1},
597 {-1, -1, -1, -1, -1, -1, -1, -1},
598 {-1, -1, -1, -1, -1, -1, -1, -1}},
599 {{ 3, 3, 4, 6, 6, 4, 3, 3},
600 { 0, 3, 4, 6, 4, 3, 1, -1},
601 { 5, 1, 3, 4, 4, 3, 0, 1},
602 { 0, 1, 3, 4, 3, 1, 0, -1},
603 { 2, 1, 6, 3, 3, 0, 0, 1},
604 { 0, 3, 4, 3, 6, 1, 5, -1},
605 { 6, 1, 2, 6, 4, 0, 0, 2},
606 {-1, -1, -1, -1, -1, -1, -1, -1},
607 {-1, -1, -1, -1, -1, -1, -1, -1},
608 {-1, -1, -1, -1, -1, -1, -1, -1}},
609 {{ 6, 6, -1, -1, -1, -1, 4, 4},
610 { 4, 0, -1, -1, -1, 3, 6, -1},
611 { 0, 6, -1, -1, -1, -1, 4, 2},
612 { 7, -1, -1, -1, -1, -1, 7, -1},
613 { 4, 4, -1, -1, -1, -1, 5, 6},
614 { 6, 4, 7, 7, 5, 6, 4, -1},
615 {-1, 7, 6, 4, 6, 4, 7, -1},
616 {-1, 0, -1, 7, -1, 7, -1, -1},
617 {-1, -1, -1, -1, -1, -1, -1, -1},
618 {-1, -1, -1, -1, -1, -1, -1, -1}},
619 {{-1, 5, -1, -1, -1, -1, 4, -1},
620 {-1, 5, -1, -1, -1, 4, -1, -1},
621 {-1, -1, 5, 6, 6, 4, -1, -1},
622 {-1, -1, 2, -1, 2, -1, -1, -1},
623 { 0, 0, 6, -1, -1, 6, 1, 1},
624 {-1, -1, 2, -1, 2, -1, -1, -1},
625 {-1, -1, 7, 6, 6, 3, -1, -1},
626 {-1, 7, -1, -1, -1, 3, -1, -1},
627 {-1, 7, -1, -1, -1, -1, 3, -1},
628 {-1, -1, -1, -1, -1, -1, -1, -1}},
629 {{-1, 6, -1, -1, -1, -1, 2, -1},
630 { 1, 7, 1, 1, 1, 3, 1, -1},
631 {-1, -1, 4, 1, 1, 4, -1, -1},
632 {-1, 1, 3, 1, 7, 1, -1, -1},
633 {-1, -1, -1, 2, 6, -1, -1, -1},
634 {-1, -1, 1, 5, 1, -1, -1, -1},
635 {-1, -1, -1, -1, -1, -1, -1, -1},
636 {-1, -1, -1, -1, -1, -1, -1, -1},
637 {-1, -1, -1, -1, -1, -1, -1, -1},
638 {-1, -1, -1, -1, -1, -1, -1, -1}},
639 {{ 7, 7, 7, 7, 7, 7, 7, 7},
640 { 7, -1, -1, -1, -1, -1, 7, -1},
641 { 7, -1, -1, 2, 0, 5, 2, 2},
642 { 7, -1, -1, -1, 0, 3, 6, -1},
643 { 7, -1, -1, -1, -1, -1, 4, 0},
644 { 5, 5, -1, -1, -1, -1, -1, -1},
645 { 4, 3, 6, 2, -1, -1, -1, -1},
646 { 0, 2, 0, 4, -1, -1, -1, -1},
647 {-1, -1, -1, -1, -1, -1, -1, -1},
648 {-1, -1, -1, -1, -1, -1, -1, -1}},
649 {{-1, -1, 1, -1, -1, 1, -1, -1},
650 {-1, 4, -1, -1, 5, -1, -1, -1},
651 {-1, 7, -1, -1, 1, 1, 1, -1},
652 { 6, -1, -1, -1, -1, 7, -1, -1},
653 { 1, 1, 1, 1, -1, 4, -1, -1},
654 {-1, -1, 5, -1, -1, -1, -1, -1},
655 {-1, -1, 0, -1, -1, -1, -1, -1},
656 {-1, 3, -1, -1, -1, -1, -1, -1},
657 {-1, 1, -1, -1, -1, -1, -1, -1},
658 {-1, -1, -1, -1, -1, -1, -1, -1}},
659 {{-1, 7, 7, -1, -1, 7, 7, -1},
660 { 6, -1, 4, -1, 4, -1, 6, -1},
661 { 5, -1, -1, 3, 3, -1, -1, 5},
662 { 6, -1, -1, -1, -1, -1, 6, -1},
663 {-1, 7, -1, -1, -1, -1, 7, -1},
664 {-1, 4, -1, -1, -1, 4, -1, -1},
665 {-1, -1, 3, -1, -1, 3, -1, -1},
666 {-1, -1, 2, -1, 2, -1, -1, -1},
667 {-1, -1, -1, 5, 5, -1, -1, -1},
668 {-1, -1, -1, -1, -1, -1, -1, -1}},
669 {{-1, 0, 0, -1, -1, 0, 0, -1},
670 { 7, 4, 6, 6, 6, 4, 3, -1},
671 { 5, 6, 6, 6, 2, 6, 6, 3},
672 { 7, 4, 6, 6, 6, 4, 3, -1},
673 {-1, 0, 0, -1, -1, 0, 0, -1},
674 {-1, -1, -1, -1, -1, -1, -1, -1},
675 {-1, -1, -1, -1, -1, -1, -1, -1},
676 {-1, -1, -1, -1, -1, -1, -1, -1},
677 {-1, -1, -1, -1, -1, -1, -1, -1},
678 {-1, -1, -1, -1, -1, -1, -1, -1}},
679 {{-1, -1, -1, -1, -1, 7, 7, 7},
680 {-1, -1, -1, -1, 2, 7, 7, -1},
681 {-1, 0, 7, 7, 7, -1, 7, 7},
682 { 6, 7, 7, 7, -1, -1, -1, -1},
683 { 6, -1, -1, -1, 7, 7, 7, 7},
684 { 6, -1, -1, -1, -1, -1, -1, -1},
685 { 4, 2, 2, 2, 4, -1, 3, -1},
686 { 4, 4, 4, 4, 3, 3, 3, -1},
687 {-1, -1, -1, -1, -1, -1, -1, -1},
688 {-1, -1, -1, -1, -1, -1, -1, -1}},
689 {{ 4, -1, -1, 7, -1, 6, -1, 7},
690 { 7, 6, 7, -1, -1, 7, 4, -1},
691 {-1, -1, 7, -1, -1, 7, -1, -1},
692 {-1, 0, 0, 0, 0, 0, 3, -1},
693 {-1, -1, 0, 2, 2, 0, 6, 4},
694 {-1, -1, 0, 0, 0, 1, 3, -1},
695 {-1, -1, -1, 0, 0, -1, 3, 4},
696 {-1, -1, -1, 6, -1, 5, 6, -1},
697 {-1, -1, -1, -1, -1, -1, 1, 0},
698 {-1, -1, -1, -1, -1, -1, -1, -1}},
699 {{-1, 5, -1, -1, -1, -1, 5, -1},
700 { 0, -1, -1, 0, -1, -1, 0, -1},
701 { 0, 0, 0, 2, 2, 0, 0, 0},
702 { 0, -1, -1, 0, -1, -1, 0, -1},
703 {-1, 7, -1, 3, -1, -1, 7, -1},
704 {-1, -1, 3, 6, -1, -1, -1, -1},
705 {-1, -1, -1, 6, -1, -1, -1, -1},
706 {-1, 3, 6, -1, -1, -1, -1, -1},
707 {-1, 3, -1, -1, -1, -1, -1, -1},
708 {-1, -1, -1, -1, -1, -1, -1, -1}},
709 {{-1, -1, -1, 6, 5, -1, -1, -1},
710 {-1, -1, 2, 6, 3, -1, -1, -1},
711 {-1, -1, 5, 4, 7, 1, -1, -1},
712 {-1, 6, 2, 2, 3, 4, -1, -1},
713 {-1, -1, 3, 7, 3, 6, -1, -1},
714 {-1, -1, 1, 3, 2, -1, -1, -1},
715 {-1, -1, -1, 4, 5, -1, -1, -1},
716 {-1, -1, -1, 4, -1, -1, -1, -1},
717 {-1, -1, -1, -1, -1, -1, -1, -1},
718 {-1, -1, -1, -1, -1, -1, -1, -1}},
719 {{ 7, 7, -1, 2, 2, -1, 6, 6},
720 { 6, -1, -1, 6, -1, -1, 3, -1},
721 { 2, -1, -1, 1, -1, -1, 2, -1},
722 { 5, -1, -1, 3, -1, -1, 2, -1},
723 { 1, -1, -1, 2, -1, -1, 1, -1},
724 { 5, -1, -1, 2, -1, -1, 2, -1},
725 { 6, -1, -1, 1, -1, -1, 7, -1},
726 { 5, -1, -1, 5, -1, -1, 4, -1},
727 {-1, -1, -1, -1, -1, -1, -1, -1},
728 {-1, -1, -1, -1, -1, -1, -1, -1}},
729 {{-1, -1, -1, 6, 6, -1, -1, -1},
730 {-1, 0, 4, 4, 4, 0, -1, -1},
731 {-1, -1, -1, 6, 6, -1, -1, -1},
732 {-1, -1, 2, 7, 2, -1, -1, -1},
733 {-1, -1, -1, 6, 6, -1, -1, -1},
734 {-1, 0, 5, 5, 5, 0, -1, -1},
735 {-1, -1, -1, 3, 3, -1, -1, -1},
736 {-1, -1, -1, -1, -1, -1, -1, -1},
737 {-1, -1, -1, -1, -1, -1, -1, -1},
738 {-1, -1, -1, -1, -1, -1, -1, -1}},
739 {{-1, -1, 4, 1, 3, -1, -1, -1},
740 {-1, 1, -1, -1, 1, -1, -1, -1},
741 {-1, -1, 4, 1, 3, 4, 1, -1},
742 {-1, 1, 3, 4, -1, -1, 4, -1},
743 {-1, 3, -1, -1, 3, 4, 1, -1},
744 {-1, 1, 3, 4, 1, 3, -1, -1},
745 {-1, -1, 4, 1, -1, -1, -1, -1},
746 {-1, -1, -1, -1, -1, -1, -1, -1},
747 {-1, -1, -1, -1, -1, -1, -1, -1},
748 {-1, -1, -1, -1, -1, -1, -1, -1}},
749 {{-1, 6, 4, -1, 3, 2, 5, -1},
750 { 0, -1, -1, -1, -1, -1, 1, -1},
751 {-1, 2, 3, 5, -1, 4, 6, -1},
752 { 0, -1, -1, -1, -1, -1, 1, -1},
753 {-1, 4, 6, -1, 2, 5, 3, -1},
754 { 0, -1, -1, -1, -1, -1, 1, -1},
755 {-1, 5, 2, 3, -1, 4, 6, -1},
756 {-1, -1, -1, -1, -1, -1, -1, -1},
757 {-1, -1, -1, -1, -1, -1, -1, -1},
758 {-1, -1, -1, -1, -1, -1, -1, -1}},
759 {{-1, -1, -1, 6, 6, -1, -1, -1},
760 {-1, -1, 7, 6, 4, -1, -1, -1},
761 {-1, 2, 1, 7, 4, 1, 3, -1},
762 { 2, 1, 1, 1, 1, 1, 3, -1},
763 {-1, 2, 2, 2, 3, 3, 3, -1},
764 {-1, -1, -1, 5, -1, -1, -1, -1},
765 {-1, -1, -1, 2, 3, -1, -1, -1},
766 {-1, -1, -1, 5, -1, -1, -1, -1},
767 {-1, -1, 2, 2, 3, 3, -1, -1},
768 {-1, -1, -1, -1, -1, -1, -1, -1}},
769 {{ 4, -1, 5, -1, -1, 3, -1, 6},
770 { 2, -1, 3, -1, 2, -1, 4, -1},
771 { 4, -1, -1, 1, 0, -1, -1, 6},
772 { 6, -1, 2, 3, 5, -1, 4, -1},
773 { 4, -1, -1, 0, 1, -1, -1, 6},
774 { 2, -1, 5, -1, 3, -1, 4, -1},
775 { 4, -1, 3, -1, -1, 2, -1, 6},
776 { 6, -1, -1, -1, -1, -1, 4, -1},
777 {-1, -1, -1, -1, -1, -1, -1, -1},
778 {-1, -1, -1, -1, -1, -1, -1, -1}},
779 {{ 2, 6, 0, 5, 5, 1, 3, 4},
780 { 1, -1, -1, 2, -1, -1, 0, -1},
781 { 4, -1, -1, 3, 6, -1, -1, 2},
782 {-1, -1, -1, 0, -1, -1, -1, -1},
783 {-1, -1, -1, 1, 4, -1, -1, -1},
784 {-1, -1, -1, 2, -1, -1, -1, -1},
785 {-1, -1, -1, 6, 3, -1, -1, -1},
786 {-1, -1, -1, 5, -1, -1, -1, -1},
787 {-1, -1, -1, 4, 1, -1, -1, -1},
788 {-1, -1, -1, -1, -1, -1, -1, -1}},
789 {{-1, -1, -1, -1, 5, 1, 1, 3},
790 { 0, 5, 1, 0, 5, 3, 3, -1},
791 { 5, 1, 0, 5, 1, 0, 5, 1},
792 { 0, 5, 1, 0, 5, 1, 6, -1},
793 {-1, -1, -1, -1, 1, 6, 5, 1},
794 {-1, -1, -1, -1, 5, 1, 6, -1},
795 {-1, -1, -1, -1, 1, 0, 5, 1},
796 {-1, -1, -1, -1, 5, 1, 0, -1},
797 {-1, -1, -1, -1, -1, -1, -1, -1},
798 {-1, -1, -1, -1, -1, -1, -1, -1}},
799 {{-1, 0, 7, 3, -1, -1, 2, 2},
800 {-1, 0, 7, 3, -1, -1, 2, -1},
801 {-1, 0, 7, 3, -1, -1, 2, 2},
802 {-1, 0, 7, 3, -1, 3, 1, -1},
803 {-1, 0, 7, 3, -1, 6, 4, 5},
804 {-1, 0, 7, 3, -1, 7, 0, -1},
805 {-1, 0, 7, 3, -1, 2, 3, 4},
806 {-1, 0, 7, 3, -1, 5, 6, -1},
807 {-1, -1, -1, -1, -1, 7, 0, 1},
808 {-1, -1, -1, -1, -1, -1, -1, -1}},
809 {{-1, -1, -1, 7, 7, 7, 7, -1},
810 { 3, 4, 5, -1, -1, -1, 7, -1},
811 { 2, -1, -1, -1, -1, -1, -1, 3},
812 { 7, -1, -1, -1, -1, -1, 4, -1},
813 { 7, -1, -1, -1, 3, 4, 5, 6},
814 { 7, -1, -1, 2, 0, 1, 2, -1},
815 { 6, -1, -1, -1, 3, 4, 5, 6},
816 { 0, 1, -1, -1, -1, -1, -1, -1},
817 { 2, 3, 4, -1, -1, -1, -1, -1},
818 { 5, 6, 0, -1, -1, -1, -1, -1}},
819 {{-1, 7, -1, -1, -1, -1, 2, -1},
820 { 1, 1, -1, -1, -1, 3, 3, -1},
821 {-1, 2, -1, -1, -1, -1, 4, -1},
822 { 3, 3, -1, -1, -1, 5, 5, -1},
823 {-1, 4, -1, -1, -1, -1, 6, -1},
824 { 5, 5, -1, -1, -1, 1, 1, -1},
825 {-1, 6, -1, -1, -1, -1, 7, -1},
826 {-1, -1, -1, -1, -1, -1, -1, -1},
827 {-1, -1, -1, -1, -1, -1, -1, -1},
828 {-1, -1, -1, -1, -1, -1, -1, -1}},
829 {{-1, 4, -1, -1, -1, -1, 4, -1},
830 { 2, -1, -1, 1, -1, -1, 2, -1},
831 { 5, -1, -1, 0, 0, -1, -1, 5},
832 { 5, -1, -1, 1, -1, -1, 6, -1},
833 {-1, 4, 2, 7, 7, 5, 4, -1},
834 {-1, -1, -1, 6, -1, -1, -1, -1},
835 {-1, -1, -1, 3, 3, -1, -1, -1},
836 {-1, -1, -1, 7, -1, -1, -1, -1},
837 {-1, -1, -1, -1, -1, -1, -1, -1},
838 {-1, -1, -1, -1, -1, -1, -1, -1}},
839 {{-1, 1, -1, -1, 2, 3, 4, -1},
840 { 2, -1, -1, 3, 0, 4, -1, -1},
841 { 4, -1, -1, 2, 3, 1, -1, -1},
842 { 3, -1, 4, 3, 0, -1, -1, -1},
843 { 4, -1, -1, 2, 5, 1, -1, -1},
844 { 3, -1, 4, 5, 0, 4, -1, -1},
845 {-1, -1, -1, -1, -1, -1, -1, -1},
846 {-1, -1, -1, -1, -1, -1, -1, -1},
847 {-1, -1, -1, -1, -1, -1, -1, -1},
848 {-1, -1, -1, -1, -1, -1, -1, -1}},
849 {{ 2, -1, -1, 1, 1, -1, -1, 2},
850 { 2, -1, 3, 3, 3, -1, 2, -1},
851 {-1, 2, -1, 4, 4, -1, 2, -1},
852 {-1, 7, 7, 0, 7, 7, -1, -1},
853 {-1, -1, -1, 4, 4, -1, -1, -1},
854 {-1, -1, 5, 7, 5, -1, -1, -1},
855 { 6, 3, 2, 6, 4, 2, 3, 6},
856 { 5, -1, -1, -1, -1, -1, 1, -1},
857 {-1, -1, -1, -1, -1, -1, -1, -1},
858 {-1, -1, -1, -1, -1, -1, -1, -1}},
859 {{ 4, 2, 3, 5, 7, 1, 3, 6},
860 { 1, -1, -1, 1, -1, -1, 1, -1},
861 { 3, 0, 1, 3, 2, 4, 3, 5},
862 { 4, -1, -1, 4, -1, -1, 4, -1},
863 {-1, 5, -1, -1, 5, -1, -1, 5},
864 { 0, 3, 2, 0, 4, 5, 0, -1},
865 {-1, 6, -1, -1, 6, -1, -1, 6},
866 { 7, -1, -1, 7, -1, -1, 7, -1},
867 {-1, -1, -1, -1, -1, -1, -1, -1},
868 {-1, -1, -1, -1, -1, -1, -1, -1}},
869 {{-1, 5, 4, -1, 1, 1, -1, -1},
870 { 5, -1, 4, 1, -1, 1, -1, -1},
871 { 0, -1, -1, -1, -1, -1, 0, -1},
872 { 0, 6, 4, -1, -1, 4, 2, -1},
873 {-1, 4, 3, 5, 2, 6, 3, 6},
874 {-1, 2, 6, -1, -1, 5, 4, -1},
875 {-1, -1, -1, -1, -1, -1, -1, -1},
876 {-1, -1, -1, -1, -1, -1, -1, -1},
877 {-1, -1, -1, -1, -1, -1, -1, -1},
878 {-1, -1, -1, -1, -1, -1, -1, -1}},
879 {{-1, -1, -1, 6, 6, -1, -1, -1},
880 {-1, -1, 5, 5, 4, -1, -1, -1},
881 {-1, -1, 1, 6, 6, 4, -1, -1},
882 {-1, 1, 7, 2, 5, 3, -1, -1},
883 {-1, 2, 7, 2, 1, 5, 3, -1},
884 { 2, 1, 3, 1, 4, 2, 7, -1},
885 {-1, 3, 1, 3, 4, 2, 7, -1},
886 {-1, 3, 5, 5, 6, 6, -1, -1},
887 {-1, -1, -1, -1, -1, -1, -1, -1},
888 {-1, -1, -1, -1, -1, -1, -1, -1}},
889 {{-1, -1, 7, 3, -1, -1, -1, -1},
890 {-1, 1, 7, 6, -1, -1, -1, -1},
891 {-1, 3, 7, 5, 1, 5, -1, -1},
892 { 7, 7, 0, 2, 4, 0, 4, -1},
893 { 7, 1, 4, 6, 5, 6, 5, 7},
894 { 1, 7, 7, 1, 7, 7, 1, -1},
895 {-1, -1, -1, -1, -1, -1, -1, -1},
896 {-1, -1, -1, -1, -1, -1, -1, -1},
897 {-1, -1, -1, -1, -1, -1, -1, -1},
898 {-1, -1, -1, -1, -1, -1, -1, -1}},
899 {{-1, -1, 1, -1, -1, 1, -1, -1},
900 {-1, 5, 6, 1, 5, 6, -1, -1},
901 {-1, 1, 1, 2, 2, 1, 1, -1},
902 { 4, 7, 1, 0, 1, 7, 4, -1},
903 {-1, 3, 7, 5, 7, 5, 3, -1},
904 {-1, 1, 1, 1, 1, 1, -1, -1},
905 {-1, -1, -1, -1, -1, -1, -1, -1},
906 {-1, -1, -1, -1, -1, -1, -1, -1},
907 {-1, -1, -1, -1, -1, -1, -1, -1},
908 {-1, -1, -1, -1, -1, -1, -1, -1}},
909 {{ 4, -1, -1, -1, 5, -1, -1, 4},
910 { 6, 6, 7, 6, -1, 4, 5, -1},
911 { 4, 2, 7, 5, 2, 2, 6, 4},
912 {-1, -1, 4, 1, -1, 5, 2, -1},
913 {-1, 5, 2, 7, 7, -1, 7, 4},
914 { 4, 6, 5, 4, -1, 4, 2, -1},
915 {-1, -1, -1, 4, -1, 4, 1, -1},
916 { 0, 0, 0, 5, -1, -1, -1, -1},
917 {-1, -1, -1, -1, 0, 0, 0, 0},
918 {-1, -1, -1, -1, -1, -1, -1, -1}},
919 {{ 1, -1, -1, -1, 0, 0, -1, -1},
920 { 2, -1, -1, 0, 1, 0, -1, -1},
921 { 3, -1, -1, 0, 2, 2, 0, -1},
922 { 4, -1, 0, 1, 1, 1, 0, -1},
923 { 5, -1, -1, 0, 4, 4, 0, -1},
924 { 6, -1, -1, 4, 4, 4, -1, -1},
925 { 7, -1, -1, -1, 4, 4, -1, -1},
926 {-1, -1, -1, 0, 1, 0, -1, -1},
927 {-1, -1, -1, 0, 1, 1, 0, -1},
928 {-1, -1, -1, -1, -1, -1, -1, -1}},
929 {{-1, -1, 3, -1, -1, 1, 7, -1},
930 {-1, 7, 4, -1, -1, 4, 3, -1},
931 { 1, -1, -1, 0, 2, 0, -1, -1},
932 { 5, 4, -1, 3, -1, -1, -1, -1},
933 { 4, -1, 3, 6, 1, 1, 6, -1},
934 {-1, 1, -1, -1, 4, -1, 1, -1},
935 {-1, 7, 5, -1, -1, -1, 3, -1},
936 {-1, -1, 3, -1, -1, -1, -1, -1},
937 {-1, -1, -1, -1, -1, -1, -1, -1},
938 {-1, -1, -1, -1, -1, -1, -1, -1}},
939 {{ 1, -1, -1, -1, 1, -1, -1, -1},
940 { 2, -1, -1, -1, 2, -1, -1, -1},
941 {-1, 3, -1, -1, 3, 3, -1, -1},
942 {-1, 4, -1, 4, -1, 4, -1, -1},
943 {-1, 5, -1, -1, 5, 5, -1, -1},
944 { 6, -1, -1, 7, 1, 7, -1, -1},
945 { 7, -1, -1, -1, 6, 6, -1, -1},
946 {-1, -1, -1, -1, -1, -1, -1, -1},
947 {-1, -1, -1, -1, -1, -1, -1, -1},
948 {-1, -1, -1, -1, -1, -1, -1, -1}},
949 {{ 2, -1, -1, 6, -1, 2, 5, 1},
950 { 5, -1, 4, -1, 4, -1, 4, -1},
951 { 6, -1, -1, 3, -1, -1, -1, 3},
952 { 4, 2, 0, -1, -1, -1, 5, -1},
953 {-1, -1, -1, 6, -1, 3, 6, -1},
954 {-1, -1, 5, -1, 5, -1, -1, -1},
955 {-1, -1, -1, 3, -1, 4, 2, 5},
956 {-1, -1, -1, -1, -1, -1, -1, -1},
957 {-1, -1, -1, -1, -1, -1, -1, -1},
958 {-1, -1, -1, -1, -1, -1, -1, -1}},
959 {{ 6, -1, -1, -1, 4, -1, -1, 3},
960 { 0, 3, -1, -1, 6, -1, 0, -1},
961 {-1, -1, 7, -1, 1, -1, 3, -1},
962 { 7, -1, 4, 7, -1, 2, -1, -1},
963 { 5, 2, 3, 2, 1, 6, -1, 3},
964 {-1, -1, 0, 4, 3, 5, 4, -1},
965 {-1, 7, 6, -1, -1, 0, -1, -1},
966 { 4, 3, -1, -1, -1, 4, 2, -1},
967 { 0, -1, -1, -1, -1, -1, 6, -1},
968 {-1, -1, -1, -1, -1, -1, -1, -1}},
969 {{ 6, 1, 2, 5, 1, 6, 3, 0},
970 {-1, -1, -1, -1, -1, -1, 4, -1},
971 { 0, 5, 2, 7, 1, 6, 2, -1},
972 { 3, -1, -1, -1, -1, -1, -1, -1},
973 { 6, 7, 6, 4, 0, 5, 2, 6},
974 {-1, -1, -1, -1, -1, -1, 1, -1},
975 { 6, 1, 4, 0, 6, 2, 3, -1},
976 { 0, -1, -1, -1, -1, -1, -1, -1},
977 {-1, 0, 4, 5, 3, 7, 6, 0},
978 {-1, -1, -1, -1, -1, -1, -1, -1}},
979 {{-1, -1, -1, 0, 1, -1, -1, -1},
980 {-1, -1, 0, 7, 0, -1, -1, -1},
981 {-1, -1, 1, 2, 2, 0, -1, -1},
982 {-1, 0, 7, 0, 7, 0, -1, -1},
983 {-1, 6, -1, 7, 7, -1, 6, -1},
984 { 4, 1, 6, 6, 6, 4, 1, -1},
985 {-1, 5, -1, 7, 7, -1, 5, -1},
986 {-1, -1, -1, -1, -1, -1, -1, -1},
987 {-1, -1, -1, -1, -1, -1, -1, -1},
988 {-1, -1, -1, -1, -1, -1, -1, -1}},
989 {{-1, -1, -1, 5, 6, -1, -1, -1},
990 {-1, -1, 3, 3, 3, -1, -1, -1},
991 {-1, -1, 7, 5, 3, 7, -1, -1},
992 {-1, 3, -1, 6, -1, 3, -1, -1},
993 { 2, -1, -1, 3, 7, -1, -1, 1},
994 { 2, 2, -1, 3, -1, 1, 1, -1},
995 {-1, 0, 2, 5, 6, 1, 0, -1},
996 {-1, -1, -1, 3, -1, -1, -1, -1},
997 {-1, -1, -1, 3, 7, -1, -1, -1},
998 {-1, -1, -1, -1, -1, -1, -1, -1}},
999 {{-1, 6, -1, -1, -1, -1, 2, -1},
1000 {-1, 2, 6, 0, 6, 0, -1, -1},
1001 {-1, 0, -1, -1, -1, -1, -1, -1},
1002 { 6, -1, -1, -1, -1, -1, -1, -1},
1003 {-1, 3, 3, 2, 0, 6, 0, 0},
1004 {-1, 6, -1, -1, -1, -1, 0, -1},
1005 {-1, -1, -1, 6, 0, 2, 6, -1},
1006 {-1, 2, 0, -1, -1, -1, -1, -1},
1007 {-1, -1, -1, -1, -1, -1, -1, -1},
1008 {-1, -1, -1, -1, -1, -1, -1, -1}},
1009 {{ 0, 7, -1, -1, -1, -1, -1, -1},
1010 { 1, 5, -1, -1, -1, -1, -1, -1},
1011 { 7, 2, 5, -1, -1, -1, -1, -1},
1012 { 6, 3, 4, -1, -1, -1, -1, -1},
1013 { 5, 5, 4, 4, -1, -1, -1, -1},
1014 { 3, 3, 5, 3, -1, -1, -1, -1},
1015 { 1, 2, 2, 5, 3, -1, -1, -1},
1016 { 1, 0, 0, 7, 6, -1, -1, -1},
1017 { 3, 3, 5, 5, 7, 6, -1, -1},
1018 {-1, -1, -1, -1, -1, -1, -1, -1}},
1019 {{-1, -1, 2, 6, 6, 2, -1, -1},
1020 {-1, 2, 1, 1, 0, 2, -1, -1},
1021 {-1, 2, 3, 2, 2, 0, 2, -1},
1022 { 2, 3, 2, 5, 2, 7, 2, -1},
1023 { 2, 4, 2, 5, 2, 7, 2, 0},
1024 { 2, 4, 2, 6, 6, 2, 0, -1},
1025 {-1, 2, 5, 2, 2, 2, 7, 2},
1026 {-1, 2, 5, 6, 6, 7, 2, -1},
1027 {-1, -1, 2, 2, 2, 2, 2, -1},
1028 {-1, -1, -1, -1, -1, -1, -1, -1}},
1029 {{-1, -1, 0, -1, -1, 0, -1, -1},
1030 { 1, 0, 0, 1, 0, 0, 1, -1},
1031 { 1, 7, 7, 5, 5, 7, 7, 1},
1032 { 3, 2, -1, 2, -1, 2, 3, -1},
1033 { 3, 7, -1, 6, 6, -1, 7, 3},
1034 { 7, -1, -1, 6, -1, -1, 7, -1},
1035 { 4, 4, 5, -1, -1, 5, 4, 4},
1036 {-1, -1, -1, -1, -1, -1, -1, -1},
1037 {-1, -1, -1, -1, -1, -1, -1, -1},
1038 {-1, -1, -1, -1, -1, -1, -1, -1}},
1039 {{-1, 6, 3, -1, -1, 3, 6, -1},
1040 { 6, -1, 2, -1, 2, -1, 6, -1},
1041 { 2, -1, 0, 1, 1, 0, -1, 2},
1042 { 5, 0, -1, 7, -1, 0, 5, -1},
1043 {-1, 5, -1, 6, 6, -1, 5, -1},
1044 { 7, 1, 4, -1, 4, 1, 7, -1},
1045 { 7, -1, 4, -1, -1, 4, -1, 7},
1046 { 2, 0, -1, -1, -1, 0, 2, -1},
1047 {-1, 2, -1, -1, -1, -1, 2, -1},
1048 {-1, -1, -1, -1, -1, -1, -1, -1}},
1049 {{ 6, 1, -1, -1, -1, -1, 4, 0},
1050 { 2, 7, 5, 5, 5, 7, 3, -1},
1051 { 6, 1, -1, -1, -1, -1, 4, 0},
1052 { 2, 5, 7, 7, 7, 5, 3, -1},
1053 { 6, 1, -1, -1, -1, -1, 4, 0},
1054 { 2, 0, 6, 6, 6, 0, 3, -1},
1055 { 6, 1, -1, -1, -1, -1, 4, 0},
1056 {-1, -1, -1, -1, -1, -1, -1, -1},
1057 {-1, -1, -1, -1, -1, -1, -1, -1},
1058 {-1, -1, -1, -1, -1, -1, -1, -1}},
1059 {{ 5, -1, -1, 1, 1, -1, -1, 5},
1060 { 5, -1, 4, -1, 4, -1, 5, -1},
1061 {-1, 2, 4, -1, -1, 4, 2, -1},
1062 { 7, 2, -1, -1, -1, 2, 7, -1},
1063 { 0, -1, 0, 4, 4, 0, -1, 0},
1064 { 7, 2, -1, -1, -1, 2, 7, -1},
1065 {-1, 2, 3, -1, -1, 3, 2, -1},
1066 { 5, -1, 3, -1, 3, -1, 5, -1},
1067 { 5, -1, -1, 6, 6, -1, -1, 5},
1068 {-1, -1, -1, -1, -1, -1, -1, -1}},
1069 {{ 2, 2, -1, -1, -1, -1, 5, 5},
1070 { 5, -1, -1, -1, -1, -1, 2, -1},
1071 { 5, -1, -1, -1, -1, -1, -1, 2},
1072 { 1, -1, 1, 5, 1, -1, 3, -1},
1073 { 5, 2, 5, 3, 1, 2, 5, 2},
1074 { 2, 0, 5, -1, 2, 0, 5, -1},
1075 {-1, 3, 7, -1, -1, 3, 7, -1},
1076 {-1, -1, 2, 0, 5, -1, -1, -1},
1077 {-1, -1, -1, -1, -1, -1, -1, -1},
1078 {-1, -1, -1, -1, -1, -1, -1, -1}},
1079 {{ 0, 6, 5, 2, 3, 4, 1, 7},
1080 {-1, -1, -1, -1, 1, -1, -1, -1},
1081 {-1, -1, -1, 1, 1, -1, -1, -1},
1082 {-1, -1, 1, -1, -1, -1, -1, -1},
1083 { 7, 1, 4, 3, 2, 5, 6, 0},
1084 {-1, -1, -1, -1, 1, -1, -1, -1},
1085 {-1, -1, -1, 1, 1, -1, -1, -1},
1086 {-1, -1, 1, -1, -1, -1, -1, -1},
1087 { 0, 6, 5, 2, 3, 4, 1, 7},
1088 {-1, -1, -1, -1, -1, -1, -1, -1}},
1089 {{-1, -1, 1, -1, -1, 1, -1, -1},
1090 {-1, 2, 4, -1, 2, 4, -1, -1},
1091 {-1, 2, 3, 6, 5, 3, 2, -1},
1092 {-1, 6, 5, -1, 6, 5, -1, -1},
1093 {-1, -1, -1, 7, 7, -1, -1, -1},
1094 {-1, -1, -1, 7, -1, -1, -1, -1},
1095 { 1, -1, -1, 7, 7, -1, -1, 3},
1096 { 2, -1, -1, 7, -1, -1, 2, -1},
1097 {-1, 3, 4, 5, 6, 4, 1, -1},
1098 {-1, -1, -1, -1, -1, -1, -1, -1}},
1099 {{ 1, -1, -1, 2, 2, -1, -1, 2},
1100 { 1, 3, 7, 3, 7, 4, 2, -1},
1101 {-1, 1, 6, -1, -1, 6, 2, -1},
1102 { 6, -1, 7, 3, 7, -1, 6, -1},
1103 {-1, 4, 2, -1, -1, 1, 3, -1},
1104 {-1, -1, 2, 6, 1, -1, -1, -1},
1105 {-1, 4, 3, 3, 4, 4, 3, -1},
1106 {-1, -1, -1, -1, -1, -1, -1, -1},
1107 {-1, -1, -1, -1, -1, -1, -1, -1},
1108 {-1, -1, -1, -1, -1, -1, -1, -1}},
1109 {{-1, -1, -1, 5, 6, -1, -1, -1},
1110 {-1, -1, -1, 3, -1, -1, -1, -1},
1111 {-1, -1, -1, 1, 2, -1, -1, -1},
1112 {-1, -1, -1, 4, -1, -1, -1, -1},
1113 {-1, -1, -1, 5, 7, -1, -1, -1},
1114 {-1, -1, -1, 2, -1, -1, -1, -1},
1115 { 6, 5, 4, 3, 2, 1, 7, 5},
1116 {-1, -1, -1, -1, -1, -1, -1, -1},
1117 {-1, -1, -1, -1, -1, -1, -1, -1},
1118 {-1, -1, -1, -1, -1, -1, -1, -1}},
1119 {{-1, 0, -1, 1, -1, 2, -1, -1},
1120 {-1, 4, -1, 5, -1, 6, -1, -1},
1121 {-1, 7, -1, 0, -1, 2, -1, -1},
1122 {-1, 6, -1, 3, -1, 6, -1, -1},
1123 {-1, 1, -1, 1, -1, 2, -1, -1},
1124 {-1, 3, -1, 5, -1, 0, -1, -1},
1125 {-1, 2, -1, 4, -1, 6, -1, -1},
1126 {-1, 3, -1, 6, -1, 7, -1, -1},
1127 {-1, -1, -1, -1, -1, -1, -1, -1},
1128 {-1, -1, -1, -1, -1, -1, -1, -1}},
1129 {{ 1, 1, 2, 2, 3, 3, 4, 4},
1130 { 5, 5, 6, 7, 6, 5, 5, -1},
1131 { 6, 4, 3, 3, 2, 2, 1, 6},
1132 { 4, 6, 5, 7, 6, 3, 1, -1},
1133 {-1, -1, -1, -1, -1, -1, -1, -1},
1134 {-1, -1, -1, -1, -1, -1, -1, -1},
1135 {-1, -1, -1, -1, -1, -1, -1, -1},
1136 {-1, -1, -1, -1, -1, -1, -1, -1},
1137 {-1, -1, -1, -1, -1, -1, -1, -1},
1138 {-1, -1, -1, -1, -1, -1, -1, -1}},
1139 {{ 7, 4, -1, 1, 2, -1, 4, 7},
1140 { 5, 5, -1, 2, -1, 4, 4, -1},
1141 {-1, 5, -1, 7, 7, -1, 4, -1},
1142 { 1, 0, 6, 7, 6, 0, 2, -1},
1143 {-1, 2, -1, 5, 3, -1, 1, -1},
1144 { 1, 1, -1, -1, -1, 2, 2, -1},
1145 { 6, 1, 4, -1, -1, 4, 2, 6},
1146 { 5, 3, -1, -1, -1, 3, 5, -1},
1147 {-1, -1, -1, -1, -1, -1, -1, -1},
1148 {-1, -1, -1, -1, -1, -1, -1, -1}},
1149 {{ 1, 5, 1, 0, 0, 1, 5, 1},
1150 { 1, 2, 5, -1, 5, 2, 1, -1},
1151 { 3, 6, 1, 2, 2, 1, 6, 3},
1152 { 4, 3, 4, -1, 4, 3, 4, -1},
1153 { 3, 4, 6, 5, 5, 6, 4, 3},
1154 { 0, 2, 3, -1, 3, 2, 0, -1},
1155 { 2, 3, 1, 5, 5, 1, 3, 2},
1156 {-1, -1, -1, -1, -1, -1, -1, -1},
1157 {-1, -1, -1, -1, -1, -1, -1, -1},
1158 {-1, -1, -1, -1, -1, -1, -1, -1}},
1159 {{ 3, 0, 2, 7, 5, 7, 6, 5},
1160 { 6, -1, 1, -1, 2, -1, 1, -1},
1161 {-1, 6, 4, 0, 3, 4, 5, -1},
1162 {-1, 5, -1, 1, -1, 4, -1, -1},
1163 {-1, 7, 3, 5, 6, 5, 3, -1},
1164 { 1, -1, 2, -1, 4, -1, 2, -1},
1165 { 6, 4, 4, 6, 6, 5, 5, 1},
1166 {-1, -1, -1, -1, -1, -1, -1, -1},
1167 {-1, -1, -1, -1, -1, -1, -1, -1},
1168 {-1, -1, -1, -1, -1, -1, -1, -1}}
1169};
1170
1171/* the tile struct
1172 * type is the bubble number 0-7
1173 * fallx is the x axis movement for the falling bubble
1174 * ingroup denotes a bubble that is part of a group to be removed
1175 * anchored denotes a bubble that is anchored to the ceiling
1176 */
1177struct tile {
1178 int type;
1179 int fallx;
1180 bool ingroup;
1181 bool anchored;
1182 bool delete;
1183};
1184
1185/* the highscore struct
1186 * level is the highscore level
1187 * score is the highscore score
1188 */
1189struct highscore {
1190 unsigned int level;
1191 unsigned int score;
1192};
1193
1194/* the game context struct
1195 * score is the current score
1196 * level is the current level
1197 * highlevel is the highest level beaten
1198 * highscores is the list of high scores
1199 * angle is the current cannon direction
1200 * shots is the number of shots fired since last compression
1201 * compress is the height of the compressor
1202 * onboardcnt is the number of unique bubbles on the playing board
1203 * onboard is the unique bubbles on the playing board
1204 * nextinq is the pointer to the next bubble in the firing queue
1205 * queue is the circular buffer of bubbles to be fired
1206 * elapsedlvl is level elapsed time in 1/100s of seconds
1207 * elapsedshot is the shot elapsed time in 1/100s of seconds
1208 * resume denotes whether to resume the currently loaded game
1209 * dirty denotes whether the high scores are out of sync with the saved file
1210 * playboard is the game playing board
1211 */
1212struct game_context {
1213 unsigned int score;
1214 unsigned int level;
1215 unsigned int highlevel;
1216 struct highscore highscores[NUM_SCORES];
1217 int angle;
1218 int shots;
1219 int compress;
1220 int onboardcnt;
1221 int onboard[NUM_BUBBLES];
1222 int nextinq;
1223 int queue[NUM_QUEUE];
1224 long elapsedlvl;
1225 long elapsedshot;
1226 bool resume;
1227 bool dirty;
1228 struct tile playboard[BB_HEIGHT][BB_WIDTH];
1229};
1230
1231/*
1232 * Precalculated sine and cosine * 16384 (fixed point 18.14)
1233 * Borrowed from cube.c plugin
1234 */
1235static const short sin_table[91] = {
1236 0, 285, 571, 857, 1142, 1427, 1712, 1996, 2280, 2563,
1237 2845, 3126, 3406, 3685, 3963, 4240, 4516, 4790, 5062, 5334,
1238 5603, 5871, 6137, 6401, 6663, 6924, 7182, 7438, 7691, 7943,
1239 8191, 8438, 8682, 8923, 9161, 9397, 9630, 9860, 10086, 10310,
1240 10531, 10748, 10963, 11173, 11381, 11585, 11785, 11982, 12175, 12365,
1241 12550, 12732, 12910, 13084, 13254, 13420, 13582, 13740, 13894, 14043,
1242 14188, 14329, 14466, 14598, 14725, 14848, 14967, 15081, 15190, 15295,
1243 15395, 15491, 15582, 15668, 15749, 15825, 15897, 15964, 16025, 16082,
1244 16135, 16182, 16224, 16261, 16294, 16321, 16344, 16361, 16374, 16381,
1245 16384
1246};
1247
1248static long sin(int val) {
1249 val = (val+360)%360;
1250
1251 if(val < 181) {
1252 if(val < 91) {
1253 /* phase 0-90 degree */
1254 return (long)sin_table[val];
1255 } else {
1256 /* phase 91-180 degree */
1257 return (long)sin_table[180-val];
1258 }
1259 } else {
1260 if(val < 271) {
1261 /* phase 181-270 degree */
1262 return -(long)sin_table[val-180];
1263 } else {
1264 /* phase 270-359 degree */
1265 return -(long)sin_table[360-val];
1266 }
1267 }
1268 return 0;
1269}
1270
1271static long cos(int val) {
1272 val = (val+360)%360;
1273
1274 if(val < 181) {
1275 if(val < 91) {
1276 /* phase 0-90 degree */
1277 return (long)sin_table[90-val];
1278 } else {
1279 /* phase 91-180 degree */
1280 return -(long)sin_table[val-90];
1281 }
1282 } else {
1283 if(val < 271) {
1284 /* phase 181-270 degree */
1285 return -(long)sin_table[270-val];
1286 } else {
1287 /* phase 270-359 degree */
1288 return (long)sin_table[val-270];
1289 }
1290 }
1291 return 0;
1292}
1293
1294
1295
1296static void bubbles_init(struct game_context* bb);
1297static bool bubbles_nextlevel(struct game_context* bb);
1298static void bubbles_getonboard(struct game_context* bb);
1299static void bubbles_drawboard(struct game_context* bb);
1300static int bubbles_fire(struct game_context* bb);
1301static bool bubbles_collision(struct game_context* bb, int y, int x,
1302 int nearrow, int nearcol);
1303static bool bubbles_ingroup(struct game_context* bb, int row, int col);
1304static int bubbles_searchgroup(struct game_context* bb, int row, int col);
1305static int bubbles_remove(struct game_context* bb);
1306static void bubbles_anchored(struct game_context* bb, int row, int col);
1307static int bubbles_fall(struct game_context* bb);
1308static int bubbles_checklevel(struct game_context* bb);
1309static int bubbles_recordscore(struct game_context* bb);
1310static void bubbles_savescores(struct game_context* bb);
1311static bool bubbles_loadgame(struct game_context* bb);
1312static void bubbles_savegame(struct game_context* bb);
1313static void bubbles_setcolors(void);
1314static void bubbles_callback(void* param);
1315static int bubbles_handlebuttons(struct game_context* bb, bool animblock);
1316static int bubbles(struct game_context* bb);
1317
1318/*****************************************************************************
1319* bubbles_init() initializes bubbles data structures.
1320******************************************************************************/
1321static void bubbles_init(struct game_context* bb) {
1322 /* seed the rand generator */
1323 rb->srand(*rb->current_tick);
1324
1325 /* check for resumed game */
1326 if(bb->resume) {
1327 bb->resume = false;
1328 return;
1329 }
1330
1331 bb->score = 0;
1332 bubbles_nextlevel(bb);
1333}
1334
1335/*****************************************************************************
1336* bubbles_nextlevel() sets up the game for the next level, returns false if
1337* there are no more levels.
1338******************************************************************************/
1339static bool bubbles_nextlevel(struct game_context* bb) {
1340 int i, j, pos;
1341
1342 bb->level++;
1343
1344 /* check if there are no more levels */
1345 if(bb->level > NUM_LEVELS) return false;
1346
1347 /* set up the play board */
1348 rb->memset(bb->playboard, 0, sizeof(bb->playboard));
1349 for(i=0; i<BB_LEVEL_HEIGHT; i++) {
1350 for(j=0; j<BB_WIDTH; j++) {
1351 pos = (int)level[bb->level-1][i][j];
1352 if(pos >=0 && pos < NUM_BUBBLES) {
1353 bb->playboard[i][j].type = pos;
1354 } else {
1355 bb->playboard[i][j].type = -1;
1356 }
1357 }
1358 }
1359 for(i=BB_LEVEL_HEIGHT; i<BB_HEIGHT; i++) {
1360 for(j=0; j<BB_WIDTH; j++) {
1361 bb->playboard[i][j].type = -1;
1362 }
1363 }
1364
1365 /* fill first bubbles in shot queue */
1366 bubbles_getonboard(bb);
1367 for(i=0; i<NUM_QUEUE; i++) {
1368 bb->queue[i] = bb->onboard[rb->rand()%bb->onboardcnt];
1369 }
1370
1371 bb->angle = 0;
1372 bb->shots = 0;
1373 bb->compress = 0;
1374 bb->nextinq = 0;
1375 bb->elapsedlvl = 0;
1376 bb->elapsedshot = 0;
1377
1378 return true;
1379}
1380
1381/*****************************************************************************
1382* bubbles_getonboard() determines which bubble types are on the play board.
1383******************************************************************************/
1384static void bubbles_getonboard(struct game_context* bb) {
1385 int i, j, k;
1386 bool found;
1387
1388 bb->onboardcnt = 0;
1389 rb->memset(bb->onboard, -1, sizeof(bb->onboard));
1390
1391 for(i=0; i<BB_HEIGHT; i++) {
1392 for(j=0; j<BB_WIDTH; j++) {
1393 if(bb->playboard[i][j].type >= 0) {
1394 found = false;
1395
1396 for(k=0; k<bb->onboardcnt; k++) {
1397 if(bb->playboard[i][j].type == bb->onboard[k]) {
1398 found = true;
1399 break;
1400 }
1401 }
1402
1403 if(!found) {
1404 bb->onboard[bb->onboardcnt] = bb->playboard[i][j].type;
1405 bb->onboardcnt++;
1406 }
1407
1408 if(bb->onboardcnt == NUM_BUBBLES) return;
1409 }
1410 }
1411 }
1412}
1413
1414/*****************************************************************************
1415* bubbles_drawboard() draws the game board to the buffer but does not update
1416* the lcd.
1417******************************************************************************/
1418static void bubbles_drawboard(struct game_context* bb) {
1419 int i, j;
1420 int w, h;
1421 int colmax, indent;
1422 int tipx, tipy;
1423 bool evenline = false;
1424 char *level = "Level";
1425 char *score = "Score";
1426 char *next = "Next";
1427 char *hurry = "HURRY!";
1428 char str[11];
1429
1430 /* clear screen */
1431 rb->lcd_clear_display();
1432
1433 /* draw sidebars */
1434#ifdef HAVE_LCD_COLOR
1435 rb->lcd_bitmap(bubbles_left, 0, 0, XOFS, LCD_HEIGHT);
1436 rb->lcd_bitmap(bubbles_right, XOFS-1+BB_WIDTH*BUBBLE_SZ, 0,
1437 LCD_WIDTH-(XOFS-1+BB_WIDTH*BUBBLE_SZ), LCD_HEIGHT);
1438#endif
1439
1440 /* display play board */
1441 for(i=0; i<BB_HEIGHT; i++) {
1442 colmax = BB_WIDTH;
1443 if(evenline) {
1444 colmax--;
1445 indent = ROW_INDENT;
1446 } else {
1447 indent = 0;
1448 }
1449 evenline = !evenline;
1450
1451 for(j=0; j<colmax; j++) {
1452 if(bb->playboard[i][j].type >= 0 && !bb->playboard[i][j].delete) {
1453 rb->lcd_bitmap_part(bubbles_emblem,
1454 0, EMBLEM_SZ*bb->playboard[i][j].type, EMBLEM_SZ,
1455 XOFS+indent+BUBBLE_SZ*j+(BUBBLE_SZ-EMBLEM_SZ)/2,
1456 ROW_HEIGHT*i+(BUBBLE_SZ-EMBLEM_SZ)/2+bb->compress*ROW_HEIGHT,
1457 EMBLEM_SZ, EMBLEM_SZ);
1458 rb->lcd_set_drawmode(DRMODE_FG);
1459 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble,
1460 XOFS+indent+BUBBLE_SZ*j,
1461 ROW_HEIGHT*i+bb->compress*ROW_HEIGHT,
1462 BUBBLE_SZ, BUBBLE_SZ);
1463 rb->lcd_set_drawmode(DRMODE_SOLID);
1464 }
1465 }
1466 }
1467
1468 /* display bubble to be shot */
1469 rb->lcd_bitmap_part(bubbles_emblem,
1470 0, EMBLEM_SZ*bb->queue[bb->nextinq], EMBLEM_SZ,
1471 SHOTX+(BUBBLE_SZ-EMBLEM_SZ)/2,
1472 SHOTY+(BUBBLE_SZ-EMBLEM_SZ)/2,
1473 EMBLEM_SZ, EMBLEM_SZ);
1474 rb->lcd_set_drawmode(DRMODE_FG);
1475 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble,
1476 SHOTX, SHOTY,
1477 BUBBLE_SZ, BUBBLE_SZ);
1478 rb->lcd_set_drawmode(DRMODE_SOLID);
1479
1480 /* display next bubble to be shot */
1481 rb->lcd_bitmap_part(bubbles_emblem,
1482 0, EMBLEM_SZ*bb->queue[(bb->nextinq+1)%NUM_QUEUE], EMBLEM_SZ,
1483 XOFS/2-BUBBLE_SZ/2+(BUBBLE_SZ-EMBLEM_SZ)/2,
1484 SHOTY+(BUBBLE_SZ-EMBLEM_SZ)/2,
1485 EMBLEM_SZ, EMBLEM_SZ);
1486 rb->lcd_set_drawmode(DRMODE_FG);
1487 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble,
1488 XOFS/2-BUBBLE_SZ/2, SHOTY,
1489 BUBBLE_SZ, BUBBLE_SZ);
1490 rb->lcd_set_drawmode(DRMODE_SOLID);
1491
1492 /* draw bounding lines */
1493#ifndef HAVE_LCD_COLOR
1494 rb->lcd_vline(XOFS-1, 0, LCD_HEIGHT);
1495 rb->lcd_vline(XOFS+BUBBLE_SZ*BB_WIDTH, 0, LCD_HEIGHT);
1496#endif
1497 rb->lcd_hline(XOFS, XOFS+BUBBLE_SZ*BB_WIDTH-1, bb->compress*ROW_HEIGHT-1);
1498 rb->lcd_hline(XOFS, XOFS+BUBBLE_SZ*BB_WIDTH-1,
1499 ROW_HEIGHT*(BB_HEIGHT-2)+BUBBLE_SZ);
1500
1501 /* draw arrow */
1502 tipx = SHOTX+BUBBLE_SZ/2+(((sin(bb->angle)>>4)*BUBBLE_SZ*3/2)>>10);
1503 tipy = SHOTY+BUBBLE_SZ/2-(((cos(bb->angle)>>4)*BUBBLE_SZ*3/2)>>10);
1504
1505 rb->lcd_drawline(SHOTX+BUBBLE_SZ/2+(((sin(bb->angle)>>4)*BUBBLE_SZ/2)>>10),
1506 SHOTY+BUBBLE_SZ/2-(((cos(bb->angle)>>4)*BUBBLE_SZ/2)>>10),
1507 tipx, tipy);
1508 xlcd_filltriangle(tipx, tipy,
1509 tipx+(((sin(bb->angle-135)>>4)*BUBBLE_SZ/3)>>10),
1510 tipy-(((cos(bb->angle-135)>>4)*BUBBLE_SZ/3)>>10),
1511 tipx+(((sin(bb->angle+135)>>4)*BUBBLE_SZ/3)>>10),
1512 tipy-(((cos(bb->angle+135)>>4)*BUBBLE_SZ/3)>>10));
1513
1514 /* draw text */
1515 rb->lcd_getstringsize(level, &w, &h);
1516 rb->lcd_putsxy(XOFS/2-w/2, 2, level);
1517
1518 rb->snprintf(str, 4, "%d", bb->level);
1519 rb->lcd_getstringsize(str, &w, &h);
1520 rb->lcd_putsxy(XOFS/2-w/2, 11, str);
1521
1522 rb->lcd_getstringsize(score, &w, &h);
1523 rb->lcd_putsxy(XOFS/2-w/2, 29, score);
1524
1525 rb->snprintf(str, 10, "%d", bb->score);
1526 rb->lcd_getstringsize(str, &w, &h);
1527 rb->lcd_putsxy(XOFS/2-w/2, 38, str);
1528
1529 rb->lcd_getstringsize(next, &w, &h);
1530 rb->lcd_putsxy(XOFS/2-w/2, SHOTY-9, next);
1531
1532 if(bb->elapsedshot >= (MAX_SHOTTIME*7)/10) {
1533 rb->lcd_getstringsize(hurry, &w, &h);
1534 rb->lcd_putsxy(LCD_WIDTH/2-w/2, LCD_HEIGHT/2-h/2, hurry);
1535 }
1536}
1537
1538/*****************************************************************************
1539* bubbles_fire() fires the current bubble, reloads the cannon, attaches
1540* bubble to playboard, removes appropriate bubbles, and advances the
1541* the compressor.
1542******************************************************************************/
1543static int bubbles_fire(struct game_context* bb) {
1544 int bubblecur;
1545 long shotxinc, shotyinc;
1546 long shotxofs, shotyofs;
1547 int shotxdirec = 1;
1548 long tempxofs, tempyofs;
1549 int nearrow, nearcol;
1550 int lastrow = BB_HEIGHT-1;
1551 int lastcol = (BB_WIDTH-1)/2;
1552 int buttonres;
1553 long lasttick, currenttick;
1554
1555 /* get current bubble */
1556 bubblecur = bb->queue[bb->nextinq];
1557 shotxinc = ((sin(bb->angle)>>4)*BUBBLE_SZ)/3;
1558 shotyinc = ((-1*(cos(bb->angle)>>4))*BUBBLE_SZ)/3;
1559 shotxofs = shotyofs = 0;
1560
1561 /* advance the queue */
1562 bb->queue[bb->nextinq] = bb->onboard[rb->rand()%bb->onboardcnt];
1563 bb->nextinq = (bb->nextinq+1)%NUM_QUEUE;
1564 bubbles_drawboard(bb);
1565 rb->lcd_update_rect(0, 0, XOFS, LCD_HEIGHT);
1566
1567 /* move the bubble across the play board */
1568 lasttick = *rb->current_tick;
1569
1570 while(true) {
1571 /* move the bubble one step */
1572 shotyofs += shotyinc;
1573 shotxofs += shotxinc*shotxdirec;
1574
1575 /* check for bounce off sides */
1576 if(SHOTX+(shotxofs>>10) < XOFS) {
1577 shotxofs += 2*((XOFS<<10)-(((SHOTX)<<10)+shotxofs));
1578 shotxdirec *= -1;
1579 } else if(SHOTX+(shotxofs>>10) > XOFS+(BB_WIDTH-1)*BUBBLE_SZ) {
1580 shotxofs -= 2*((((SHOTX)<<10)+shotxofs)-((XOFS<<10)+(((BB_WIDTH-1)*BUBBLE_SZ)<<10)));
1581 shotxdirec *= -1;
1582 }
1583
1584 tempxofs = shotxofs>>10;
1585 tempyofs = shotyofs>>10;
1586
1587 /* display shot */
1588 bubbles_drawboard(bb);
1589 rb->lcd_bitmap_part(bubbles_emblem, 0, EMBLEM_SZ*bubblecur, EMBLEM_SZ,
1590 SHOTX+tempxofs+(BUBBLE_SZ-EMBLEM_SZ)/2,
1591 SHOTY+tempyofs+(BUBBLE_SZ-EMBLEM_SZ)/2,
1592 EMBLEM_SZ, EMBLEM_SZ);
1593 rb->lcd_set_drawmode(DRMODE_FG);
1594 rb->lcd_mono_bitmap((const unsigned char *)bubbles_bubble,
1595 SHOTX+tempxofs, SHOTY+tempyofs,
1596 BUBBLE_SZ, BUBBLE_SZ);
1597 rb->lcd_set_drawmode(DRMODE_SOLID);
1598 rb->lcd_update_rect(XOFS, 0, BB_WIDTH*BUBBLE_SZ, LCD_HEIGHT);
1599
1600 /* find nearest position */
1601 nearrow = ((SHOTY+tempyofs)-
1602 (bb->compress*ROW_HEIGHT)+
1603 (ROW_HEIGHT/2))/ROW_HEIGHT;
1604 if(nearrow >= BB_HEIGHT) nearrow = BB_HEIGHT-1;
1605
1606 if(nearrow%2) { /* odd row */
1607 nearcol = ((SHOTX+tempxofs)-
1608 (XOFS+ROW_INDENT)+
1609 (BUBBLE_SZ/2))/BUBBLE_SZ;
1610 if(nearcol >= BB_WIDTH-1) nearcol = BB_WIDTH-2;
1611 } else { /* even row */
1612 nearcol = ((SHOTX+tempxofs)-XOFS+(BUBBLE_SZ/2))/BUBBLE_SZ;
1613 if(nearcol >= BB_WIDTH) nearcol = BB_WIDTH-1;
1614 }
1615 if(nearcol < 0) nearcol = 0;
1616
1617 /* if nearest position is occupied attach to last position */
1618 if(bb->playboard[nearrow][nearcol].type >= 0) {
1619 bb->playboard[lastrow][lastcol].type = bubblecur;
1620 break;
1621 }
1622
1623 /* save last position */
1624 lastrow = nearrow;
1625 lastcol = nearcol;
1626
1627 /* if collision with neighbor then attach shot */
1628 if(bubbles_collision(bb, SHOTY+tempyofs, SHOTX+tempxofs,
1629 nearrow, nearcol)) {
1630 bb->playboard[nearrow][nearcol].type = bubblecur;
1631 break;
1632 }
1633
1634 /* if at top then attach shot to the ceiling */
1635 if(nearrow == 0 && SHOTY+tempyofs <= bb->compress*ROW_HEIGHT) {
1636 bb->playboard[nearrow][nearcol].type = bubblecur;
1637 break;
1638 }
1639
1640 /* handle button events */
1641 buttonres = bubbles_handlebuttons(bb, true);
1642 if(buttonres != BB_NONE) return buttonres;
1643
1644 /* framerate limiting */
1645 currenttick = *rb->current_tick;
1646 if(currenttick-lasttick < HZ/MAX_FPS) {
1647 rb->sleep((HZ/MAX_FPS)-(currenttick-lasttick));
1648 } else {
1649 rb->yield();
1650 }
1651 lasttick = currenttick;
1652 }
1653
1654 bubbles_drawboard(bb);
1655 rb->lcd_update();
1656
1657 /* clear appropriate bubbles from playing board */
1658 if(bubbles_ingroup(bb, lastrow, lastcol)) {
1659 buttonres = bubbles_remove(bb);
1660 if(buttonres != BB_NONE) return buttonres;
1661 }
1662
1663 /* update shots and compress amount */
1664 bb->shots++;
1665 if(bb->shots >= NUM_COMPRESS) {
1666 bb->shots = 0;
1667 bb->compress++;
1668 }
1669
1670 return BB_NONE;
1671}
1672
1673/*****************************************************************************
1674* bubbles_collision() determines if a fired bubble has collided with another
1675* bubble.
1676******************************************************************************/
1677static bool bubbles_collision(struct game_context* bb, int y, int x,
1678 int nearrow, int nearcol) {
1679 int nx, ny;
1680 int adj = nearrow%2;
1681
1682 /* check neighbors */
1683 if(nearcol-1 >= 0) {
1684 if(bb->playboard[nearrow][nearcol-1].type >= 0) {
1685 nx = XOFS+(nearrow%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol-1);
1686 ny = ROW_HEIGHT*nearrow+bb->compress*ROW_HEIGHT;
1687 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1688 }
1689 }
1690
1691 if(nearcol-1+adj >= 0) {
1692 if(nearrow-1 >= 0) {
1693 if(bb->playboard[nearrow-1][nearcol-1+adj].type >= 0) {
1694 nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol-1+adj);
1695 ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT;
1696 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1697 }
1698 }
1699
1700 if(nearrow+1 < BB_HEIGHT) {
1701 if(bb->playboard[nearrow+1][nearcol-1+adj].type >= 0) {
1702 nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol-1+adj);
1703 ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT;
1704 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1705 }
1706 }
1707 }
1708
1709 if(nearcol+adj >= 0) {
1710 if(nearrow-1 >= 0) {
1711 if(bb->playboard[nearrow-1][nearcol+adj].type >= 0) {
1712 nx = XOFS+((nearrow-1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol+adj);
1713 ny = ROW_HEIGHT*(nearrow-1)+bb->compress*ROW_HEIGHT;
1714 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1715 }
1716 }
1717
1718 if(nearrow+1 < BB_HEIGHT) {
1719 if(bb->playboard[nearrow+1][nearcol+adj].type >= 0) {
1720 nx = XOFS+((nearrow+1)%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol+adj);
1721 ny = ROW_HEIGHT*(nearrow+1)+bb->compress*ROW_HEIGHT;
1722 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1723 }
1724 }
1725 }
1726
1727 if(nearcol+1 < BB_WIDTH-adj) {
1728 if(bb->playboard[nearrow][nearcol+1].type >= 0) {
1729 nx = XOFS+(nearrow%2 ? ROW_INDENT : 0)+BUBBLE_SZ*(nearcol+1);
1730 ny = ROW_HEIGHT*nearrow+bb->compress*ROW_HEIGHT;
1731 if((x-nx)*(x-nx)+(y-ny)*(y-ny) < MIN_DISTANCE) return true;
1732 }
1733 }
1734
1735 return false;
1736}
1737
1738/*****************************************************************************
1739* bubbles_ingroup() marks all bubbles that form the current group.
1740******************************************************************************/
1741static bool bubbles_ingroup(struct game_context* bb, int row, int col) {
1742 int i, j;
1743 int count;
1744
1745 count = bubbles_searchgroup(bb, row, col);
1746
1747 /* unmark group if too small */
1748 if(count < 3) {
1749 for(i=0; i<BB_HEIGHT; i++) {
1750 for(j=0; j<BB_WIDTH; j++) {
1751 bb->playboard[i][j].ingroup = false;
1752 }
1753 }
1754
1755 return false;
1756 }
1757
1758 return true;
1759}
1760
1761/*****************************************************************************
1762* bubbles_searchgroup() return the size of the group of bubbles of the same
1763* type that the current bubble belongs to.
1764******************************************************************************/
1765static int bubbles_searchgroup(struct game_context* bb, int row, int col) {
1766 int count = 1;
1767 int adj = row%2;
1768 int mytype = bb->playboard[row][col].type;
1769
1770 bb->playboard[row][col].ingroup = true;
1771
1772 /* recursively call neighbors */
1773 if(col-1 >= 0) {
1774 if(bb->playboard[row][col-1].type == mytype &&
1775 !bb->playboard[row][col-1].ingroup) {
1776 count += bubbles_searchgroup(bb, row, col-1);
1777 }
1778 }
1779
1780 if(col-1+adj >= 0) {
1781 if(row-1 >= 0) {
1782 if(bb->playboard[row-1][col-1+adj].type == mytype &&
1783 !bb->playboard[row-1][col-1+adj].ingroup) {
1784 count += bubbles_searchgroup(bb, row-1, col-1+adj);
1785 }
1786 }
1787
1788 if(row+1 < BB_HEIGHT) {
1789 if(bb->playboard[row+1][col-1+adj].type == mytype &&
1790 !bb->playboard[row+1][col-1+adj].ingroup) {
1791 count += bubbles_searchgroup(bb, row+1, col-1+adj);
1792 }
1793 }
1794 }
1795
1796 if(col+adj >= 0) {
1797 if(row-1 >= 0) {
1798 if(bb->playboard[row-1][col+adj].type == mytype &&
1799 !bb->playboard[row-1][col+adj].ingroup) {
1800 count += bubbles_searchgroup(bb, row-1, col+adj);
1801 }
1802 }
1803
1804 if(row+1 < BB_HEIGHT) {
1805 if(bb->playboard[row+1][col+adj].type == mytype &&
1806 !bb->playboard[row+1][col+adj].ingroup) {
1807 count += bubbles_searchgroup(bb, row+1, col+adj);
1808 }
1809 }
1810 }
1811
1812 if(col+1 < BB_WIDTH-adj) {
1813 if(bb->playboard[row][col+1].type == mytype &&
1814 !bb->playboard[row][col+1].ingroup) {
1815 count += bubbles_searchgroup(bb, row, col+1);
1816 }
1817 }
1818
1819 return count;
1820}
1821
1822/*****************************************************************************
1823* bubbles_remove() removes all bubbles in the current group and all
1824* unanchored bubbles from the play board.
1825******************************************************************************/
1826static int bubbles_remove(struct game_context* bb) {
1827 int i, j;
1828 int buttonres;
1829
1830 /* determine all anchored bubbles */
1831 for(j=0; j<BB_WIDTH; j++) {
1832 if(bb->playboard[0][j].type >= 0 && !bb->playboard[0][j].ingroup) {
1833 bubbles_anchored(bb, 0, j);
1834 }
1835 }
1836
1837 /* mark bubbles to be deleted */
1838 for(i=0; i<BB_HEIGHT; i++) {
1839 for(j=0; j<BB_WIDTH; j++) {
1840 if(bb->playboard[i][j].type >= 0 &&
1841 (!bb->playboard[i][j].anchored || bb->playboard[i][j].ingroup)) {
1842 bb->playboard[i][j].delete = true;
1843 }
1844 }
1845 }
1846
1847 /* animate falling bubbles */
1848 buttonres = bubbles_fall(bb);
1849 if(buttonres != BB_NONE) return buttonres;
1850
1851 /* remove bubbles */
1852 for(i=0; i<BB_HEIGHT; i++) {
1853 for(j=0; j<BB_WIDTH; j++) {
1854 if(bb->playboard[i][j].delete) {
1855 bb->playboard[i][j].ingroup = false;
1856 bb->playboard[i][j].type = -1;
1857 bb->playboard[i][j].delete = false;
1858 } else {
1859 bb->playboard[i][j].anchored = false;
1860 }
1861 }
1862 }
1863
1864 bubbles_getonboard(bb);
1865
1866 return BB_NONE;
1867}
1868
1869/*****************************************************************************
1870* bubbles_anchored() marks all bubbles that are anchored in some way to the
1871* current bubble.
1872******************************************************************************/
1873static void bubbles_anchored(struct game_context* bb, int row, int col) {
1874 int adj = row%2;
1875
1876 /* mark bubble */
1877 bb->playboard[row][col].anchored = true;
1878
1879 /* recursively call neighbors */
1880 if(col-1 >= 0) {
1881 if(bb->playboard[row][col-1].type >= 0 &&
1882 !bb->playboard[row][col-1].ingroup &&
1883 !bb->playboard[row][col-1].anchored) {
1884 bubbles_anchored(bb, row, col-1);
1885 }
1886 }
1887
1888 if(col-1+adj >= 0) {
1889 if(row-1 >= 0) {
1890 if(bb->playboard[row-1][col-1+adj].type >= 0 &&
1891 !bb->playboard[row-1][col-1+adj].ingroup &&
1892 !bb->playboard[row-1][col-1+adj].anchored) {
1893 bubbles_anchored(bb, row-1, col-1+adj);
1894 }
1895 }
1896
1897 if(row+1 < BB_HEIGHT) {
1898 if(bb->playboard[row+1][col-1+adj].type >= 0 &&
1899 !bb->playboard[row+1][col-1+adj].ingroup &&
1900 !bb->playboard[row+1][col-1+adj].anchored) {
1901 bubbles_anchored(bb, row+1, col-1+adj);
1902 }
1903 }
1904 }
1905
1906 if(col+adj >= 0) {
1907 if(row-1 >= 0) {
1908 if(bb->playboard[row-1][col+adj].type >= 0 &&
1909 !bb->playboard[row-1][col+adj].ingroup &&
1910 !bb->playboard[row-1][col+adj].anchored) {
1911 bubbles_anchored(bb, row-1, col+adj);
1912 }
1913 }
1914
1915 if(row+1 < BB_HEIGHT) {
1916 if(bb->playboard[row+1][col+adj].type >= 0 &&
1917 !bb->playboard[row+1][col+adj].ingroup &&
1918 !bb->playboard[row+1][col+adj].anchored) {
1919 bubbles_anchored(bb, row+1, col+adj);
1920 }
1921 }
1922 }
1923
1924 if(col+1 < BB_WIDTH-adj) {
1925 if(bb->playboard[row][col+1].type >= 0 &&
1926 !bb->playboard[row][col+1].ingroup &&
1927 !bb->playboard[row][col+1].anchored) {
1928 bubbles_anchored(bb, row, col+1);
1929 }
1930 }
1931}
1932
1933/*****************************************************************************
1934* bubbles_fall() makes removed bubbles fall from the screen.
1935******************************************************************************/
1936static int bubbles_fall(struct game_context* bb) {
1937 int i, j;
1938 int count;
1939 int indent;
1940 int xofs, yofs;
1941 int buttonres;
1942 bool onscreen;
1943 long lasttick, currenttick;
1944
1945 /* give all falling bubbles an x axis movement */
1946 for(i=0; i<BB_HEIGHT; i++) {
1947 for(j=0; j<BB_WIDTH; j++) {
1948 if(bb->playboard[i][j].delete) {
1949 bb->playboard[i][j].fallx = rb->rand()%25 - 12;
1950 }
1951 }
1952 }
1953
1954 /* draw bubbles falling off the screen
1955 * follows y=x^2-8x scaled to bubble size
1956 */
1957 lasttick = *rb->current_tick;
1958
1959 for(count=1; ;count++) {
1960 onscreen = false;
1961 bubbles_drawboard(bb);
1962
1963 for(i=0; i<BB_HEIGHT; i++) {
1964 for(j=0; j<BB_WIDTH; j++) {
1965 if(bb->playboard[i][j].delete) {
1966 indent = (i%2 ? ROW_INDENT : 0);
1967 xofs = ((bb->playboard[i][j].fallx*count)*BUBBLE_SZ)/48;
1968 yofs = ((count*count - 8*count)*BUBBLE_SZ)/20;
1969
1970 /* draw bubble if it is still on the screen */
1971 if(ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs <= LCD_HEIGHT) {
1972 onscreen = true;
1973
1974 rb->lcd_bitmap_part(bubbles_emblem,
1975 0, EMBLEM_SZ*bb->playboard[i][j].type, EMBLEM_SZ,
1976 XOFS+indent+BUBBLE_SZ*j+(BUBBLE_SZ-EMBLEM_SZ)/2+xofs,
1977 ROW_HEIGHT*i+(BUBBLE_SZ-EMBLEM_SZ)/2+bb->compress*ROW_HEIGHT+yofs,
1978 EMBLEM_SZ, EMBLEM_SZ);
1979 rb->lcd_set_drawmode(DRMODE_FG);
1980 rb->lcd_mono_bitmap(
1981 (const unsigned char *)bubbles_bubble,
1982 XOFS+indent+BUBBLE_SZ*j+xofs,
1983 ROW_HEIGHT*i+bb->compress*ROW_HEIGHT+yofs,
1984 BUBBLE_SZ, BUBBLE_SZ);
1985 rb->lcd_set_drawmode(DRMODE_SOLID);
1986 }
1987 }
1988 }
1989 }
1990
1991 rb->lcd_update();
1992
1993 /* break out if all bubbles are off the screen */
1994 if(!onscreen) break;
1995
1996 /* handle button events */
1997 buttonres = bubbles_handlebuttons(bb, true);
1998 if(buttonres != BB_NONE) return buttonres;
1999
2000 /* framerate limiting */
2001 currenttick = *rb->current_tick;
2002 if(currenttick-lasttick < HZ/MAX_FPS) {
2003 rb->sleep((HZ/MAX_FPS)-(currenttick-lasttick));
2004 } else {
2005 rb->yield();
2006 }
2007 lasttick = currenttick;
2008 }
2009
2010 return BB_NONE;
2011}
2012
2013/*****************************************************************************
2014* bubbles_checklevel() checks the state of the playboard for a win or loss.
2015******************************************************************************/
2016static int bubbles_checklevel(struct game_context* bb) {
2017 int i, j;
2018 int points;
2019 char str[13];
2020
2021 bubbles_drawboard(bb);
2022 rb->lcd_update();
2023
2024 /* check for bubbles below cut off point */
2025 for(i=0; i<=bb->compress; i++) {
2026 for(j=0; j<BB_WIDTH; j++) {
2027 if(bb->playboard[BB_HEIGHT-1-i][j].type >= 0) return BB_LOSE;
2028 }
2029 }
2030
2031 /* check for bubbles above cut off point */
2032 for(i=0; i<BB_HEIGHT-1-bb->compress; i++) {
2033 for(j=0; j<BB_WIDTH; j++) {
2034 if(bb->playboard[i][j].type >= 0) return BB_NONE;
2035 }
2036 }
2037
2038 /* level complete, record score */
2039 points = 100 - bb->elapsedlvl/100;
2040 if(points > 0) {
2041 bb->score += points;
2042 } else {
2043 points = 0;
2044 }
2045
2046 rb->snprintf(str, 12, "%d points", points);
2047 rb->splash(HZ, true, str);
2048
2049 /* advance to the next level */
2050 if(!bubbles_nextlevel(bb)) {
2051 return BB_WIN;
2052 }
2053
2054 bubbles_drawboard(bb);
2055 rb->lcd_update();
2056 rb->snprintf(str, 12, "Level %d", bb->level);
2057 rb->splash(HZ, true, str);
2058 bubbles_drawboard(bb);
2059 rb->lcd_update();
2060
2061 return BB_NONE;
2062}
2063
2064/*****************************************************************************
2065* bubbles_recordscore() inserts a high score into the high scores list and
2066* returns the high score position.
2067******************************************************************************/
2068static int bubbles_recordscore(struct game_context* bb) {
2069 int i;
2070 int position = 0;
2071 unsigned int currentscore, currentlevel;
2072 unsigned int tempscore, templevel;
2073
2074 if(bb->score > 0) {
2075 currentlevel = bb->level-1;
2076 currentscore = bb->score;
2077
2078 for(i=0; i<NUM_SCORES; i++) {
2079 if(currentscore >= bb->highscores[i].score) {
2080 if(!position) {
2081 position = i+1;
2082 bb->dirty = true;
2083 }
2084 templevel = bb->highscores[i].level;
2085 tempscore = bb->highscores[i].score;
2086 bb->highscores[i].level = currentlevel;
2087 bb->highscores[i].score = currentscore;
2088 currentlevel = templevel;
2089 currentscore = tempscore;
2090 }
2091 }
2092 }
2093
2094 return position;
2095 }
2096
2097/*****************************************************************************
2098* bubbles_loadscores() loads the high scores saved file.
2099******************************************************************************/
2100static void bubbles_loadscores(struct game_context* bb) {
2101 int fd;
2102
2103 bb->dirty = false;
2104
2105 /* clear high scores */
2106 bb->highlevel = 0;
2107 rb->memset(bb->highscores, 0, sizeof(bb->highscores));
2108
2109 /* open scores file */
2110 fd = rb->open(SCORE_FILE, O_RDONLY);
2111 if(fd < 0) return;
2112
2113 /* read in high scores */
2114 rb->read(fd, &bb->highlevel, sizeof(bb->highlevel));
2115 if(rb->read(fd, bb->highscores, sizeof(bb->highscores)) <= 0) {
2116 /* scores are bad, reset */
2117 rb->memset(bb->highscores, 0, sizeof(bb->highscores));
2118 }
2119
2120 rb->close(fd);
2121}
2122
2123/*****************************************************************************
2124* bubbles_savescores() saves the high scores saved file.
2125******************************************************************************/
2126static void bubbles_savescores(struct game_context* bb) {
2127 int fd;
2128
2129 /* write out the high scores to the save file */
2130 fd = rb->open(SCORE_FILE, O_WRONLY|O_CREAT);
2131 rb->write(fd, &bb->highlevel, sizeof(bb->highlevel));
2132 rb->write(fd, bb->highscores, sizeof(bb->highscores));
2133 rb->close(fd);
2134 bb->dirty = false;
2135}
2136
2137/*****************************************************************************
2138* bubbles_loadgame() loads the saved game and returns load success.
2139******************************************************************************/
2140static bool bubbles_loadgame(struct game_context* bb) {
2141 int fd;
2142 bool loaded = false;
2143
2144 /* open game file */
2145 fd = rb->open(SAVE_FILE, O_RDONLY);
2146 if(fd < 0) return loaded;
2147
2148 /* read in saved game */
2149 while(true) {
2150 if(rb->read(fd, &bb->score, sizeof(bb->score)) <= 0) break;
2151 if(rb->read(fd, &bb->level, sizeof(bb->level)) <= 0) break;
2152 if(rb->read(fd, &bb->angle, sizeof(bb->angle)) <= 0) break;
2153 if(rb->read(fd, &bb->shots, sizeof(bb->shots)) <= 0) break;
2154 if(rb->read(fd, &bb->compress, sizeof(bb->compress)) <= 0) break;
2155 if(rb->read(fd, &bb->onboardcnt, sizeof(bb->onboardcnt)) <= 0) break;
2156 if(rb->read(fd, bb->onboard, sizeof(bb->onboard)) <= 0) break;
2157 if(rb->read(fd, &bb->nextinq, sizeof(bb->nextinq)) <= 0) break;
2158 if(rb->read(fd, bb->queue, sizeof(bb->queue)) <= 0) break;
2159 if(rb->read(fd, &bb->elapsedlvl, sizeof(bb->elapsedlvl)) <= 0) break;
2160 if(rb->read(fd, bb->playboard, sizeof(bb->playboard)) <= 0) break;
2161 bb->resume = true;
2162 loaded = true;
2163 break;
2164 }
2165
2166 rb->close(fd);
2167
2168 /* delete saved file */
2169 rb->remove(SAVE_FILE);
2170 return loaded;
2171}
2172
2173/*****************************************************************************
2174* bubbles_savegame() saves the current game state.
2175******************************************************************************/
2176static void bubbles_savegame(struct game_context* bb) {
2177 int fd;
2178
2179 /* write out the game state to the save file */
2180 fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT);
2181 rb->write(fd, &bb->score, sizeof(bb->score));
2182 rb->write(fd, &bb->level, sizeof(bb->level));
2183 rb->write(fd, &bb->angle, sizeof(bb->angle));
2184 rb->write(fd, &bb->shots, sizeof(bb->shots));
2185 rb->write(fd, &bb->compress, sizeof(bb->compress));
2186 rb->write(fd, &bb->onboardcnt, sizeof(bb->onboardcnt));
2187 rb->write(fd, bb->onboard, sizeof(bb->onboard));
2188 rb->write(fd, &bb->nextinq, sizeof(bb->nextinq));
2189 rb->write(fd, bb->queue, sizeof(bb->queue));
2190 rb->write(fd, &bb->elapsedlvl, sizeof(bb->elapsedlvl));
2191 rb->write(fd, bb->playboard, sizeof(bb->playboard));
2192 rb->close(fd);
2193
2194 bb->resume = true;
2195}
2196
2197/*****************************************************************************
2198* bubbles_setcolors() set the foreground and background colors.
2199******************************************************************************/
2200static inline void bubbles_setcolors(void) {
2201#ifdef HAVE_LCD_COLOR
2202 rb->lcd_set_background(LCD_RGBPACK(181,181,222));
2203 rb->lcd_set_foreground(LCD_BLACK);
2204#endif
2205}
2206
2207/*****************************************************************************
2208* bubbles_callback() is the default event handler callback which is called
2209* on usb connect and shutdown.
2210******************************************************************************/
2211static void bubbles_callback(void* param) {
2212 struct game_context* bb = (struct game_context*) param;
2213 if(bb->dirty) {
2214 rb->splash(HZ/2, true, "Saving high scores...");
2215 bubbles_savescores(bb);
2216 }
2217}
2218
2219/*****************************************************************************
2220* bubbles_handlebuttons() handles button events during a game.
2221******************************************************************************/
2222static int bubbles_handlebuttons(struct game_context* bb, bool animblock) {
2223 int button;
2224 int buttonres;
2225
2226 button = rb->button_get(false);
2227 switch(button){
2228 case (BUBBLES_LEFT|BUTTON_REPEAT):
2229 if(bb->angle > MIN_ANGLE) bb->angle -= 4;
2230 case BUBBLES_LEFT: /* change angle to the left */
2231 if(bb->angle > MIN_ANGLE) bb->angle -= 2;
2232 break;
2233
2234 case (BUBBLES_RIGHT|BUTTON_REPEAT):
2235 if(bb->angle < MAX_ANGLE) bb->angle += 4;
2236 case BUBBLES_RIGHT: /* change angle to the right */
2237 if(bb->angle < MAX_ANGLE) bb->angle += 2;
2238 break;
2239
2240 case BUBBLES_SELECT: /* fire the shot */
2241 if(!animblock) {
2242 bb->elapsedshot = 0;
2243 buttonres = bubbles_fire(bb);
2244 if(buttonres != BB_NONE) return buttonres;
2245 buttonres = bubbles_checklevel(bb);
2246 if(buttonres != BB_NONE) return buttonres;
2247 }
2248 break;
2249
2250 case BUBBLES_START: /* pause the game */
2251 rb->splash(1, true, "Paused");
2252 while(rb->button_get(true) != (BUBBLES_START));
2253 bubbles_drawboard(bb);
2254 rb->lcd_update();
2255 break;
2256
2257 case BUBBLES_RESUME: /* save and end the game */
2258 if(!animblock) {
2259 rb->splash(HZ/2, true, "Saving game...");
2260 bubbles_savegame(bb);
2261 return BB_END;
2262 }
2263 break;
2264
2265 case BUBBLES_QUIT: /* end the game */
2266 return BB_END;
2267
2268 case BUTTON_NONE: /* no button pressed */
2269 break;
2270
2271 default:
2272 if(rb->default_event_handler_ex(button, bubbles_callback,
2273 (void*) bb) == SYS_USB_CONNECTED)
2274 return BB_USB;
2275 break;
2276 }
2277
2278 return BB_NONE;
2279}
2280
2281/*****************************************************************************
2282* bubbles() is the main game subroutine, it returns the final game status.
2283******************************************************************************/
2284static int bubbles(struct game_context* bb) {
2285 int i;
2286 int w, h;
2287 int button;
2288 int buttonres;
2289 unsigned int startlevel = 0;
2290 char str[30];
2291 char *title = "Bubbles";
2292 bool startgame = false;
2293 bool showscores = false;
2294 long lasttick, currenttick;
2295
2296 bubbles_setcolors();
2297
2298 /* don't resume by default */
2299 bb->resume = false;
2300
2301 /********************
2302 * menu *
2303 ********************/
2304 while(!startgame){
2305 rb->lcd_clear_display();
2306
2307 if(!showscores) {
2308 /* welcome screen to display key bindings */
2309 rb->lcd_getstringsize(title, &w, &h);
2310 rb->lcd_putsxy((LCD_WIDTH-w)/2, 0, title);
2311#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
2312 rb->lcd_puts(0, 2, "ON to start/pause");
2313 rb->lcd_puts(0, 3, "MODE to save/resume");
2314 rb->lcd_puts(0, 4, "OFF to exit");
2315 rb->lcd_puts(0, 5, "SELECT to fire");
2316 rb->lcd_puts(0, 6, " and show high scores");
2317 rb->lcd_puts(0, 7, "LEFT/RIGHT to aim");
2318 rb->lcd_puts(0, 8, "UP/DOWN to change level");
2319#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
2320 rb->lcd_puts(0, 2, "PLAY to start/pause");
2321 rb->lcd_puts(0, 3, "LEFT+RIGHT to save/resume");
2322 rb->lcd_puts(0, 4, "MENU to exit");
2323 rb->lcd_puts(0, 5, "SELECT to fire");
2324 rb->lcd_puts(0, 6, " and show high scores");
2325 rb->lcd_puts(0, 7, "SCROLL to aim");
2326 rb->lcd_puts(0, 8, " and to change level");
2327#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
2328 rb->lcd_puts(0, 2, "PLAY to start/pause");
2329 rb->lcd_puts(0, 3, "REC to save/resume");
2330 rb->lcd_puts(0, 4, "POWER to exit");
2331 rb->lcd_puts(0, 5, "SELECT to fire");
2332 rb->lcd_puts(0, 6, " and show high scores");
2333 rb->lcd_puts(0, 7, "LEFT/RIGHT to aim");
2334 rb->lcd_puts(0, 8, "UP/DOWN to change level");
2335#elif CONFIG_KEYPAD == GIGABEAT_PAD
2336 rb->lcd_puts(0, 2, "POWER to start/pause");
2337 rb->lcd_puts(0, 3, "MENU to save/resume");
2338 rb->lcd_puts(0, 4, "A to exit");
2339 rb->lcd_puts(0, 5, "SELECT to fire");
2340 rb->lcd_puts(0, 6, " and show high scores");
2341 rb->lcd_puts(0, 7, "LEFT/RIGHT to aim");
2342 rb->lcd_puts(0, 8, "UP/DOWN to change level");
2343#endif
2344 rb->snprintf(str, 28, "Start on level %d of %d", startlevel+1, bb->highlevel+1);
2345 rb->lcd_puts(0, 10, str);
2346 rb->lcd_puts(0, 12, "High Score:");
2347 rb->snprintf(str, 30, "%d, Lvl %d",
2348 bb->highscores[0].score, bb->highscores[0].level);
2349 rb->lcd_puts(2, 13, str);
2350 } else {
2351 /* show high scores */
2352 rb->snprintf(str, 12, "%s", "High Scores");
2353 rb->lcd_getstringsize(str, &w, &h);
2354 rb->lcd_putsxy((LCD_WIDTH-w)/2, 0, str);
2355
2356 for(i=0; i<NUM_SCORES; i++) {
2357 rb->snprintf(str, 30, "#%02d: %d, Lvl %d", i+1,
2358 bb->highscores[i].score, bb->highscores[i].level);
2359 rb->lcd_puts(0, i+2, str);
2360 }
2361 }
2362
2363 rb->lcd_update();
2364
2365 /* handle menu button presses */
2366 button = rb->button_get(true);
2367 switch(button){
2368 case BUBBLES_START: /* start playing */
2369 bb->level = startlevel;
2370 startgame = true;
2371 break;
2372
2373 case BUBBLES_QUIT: /* quit program */
2374 if(showscores) {
2375 showscores = false;
2376 break;
2377 }
2378 return BB_QUIT;
2379
2380 case BUBBLES_RESUME: /* resume game */
2381 if(!bubbles_loadgame(bb)) {
2382 rb->splash(HZ*2, true, "Nothing to resume");
2383 } else {
2384 startgame = true;
2385 }
2386 break;
2387
2388 case BUBBLES_SELECT: /* toggle high scores */
2389 showscores = !showscores;
2390 break;
2391
2392 case (BUBBLES_UP|BUTTON_REPEAT):
2393 case BUBBLES_UP: /* increase starting level */
2394 if(startlevel >= bb->highlevel) {
2395 startlevel = 0;
2396 } else {
2397 startlevel++;
2398 }
2399 break;
2400
2401 case (BUBBLES_DOWN|BUTTON_REPEAT):
2402 case BUBBLES_DOWN: /* decrease starting level */
2403 if(startlevel <= 0) {
2404 startlevel = bb->highlevel;
2405 } else {
2406 startlevel--;
2407 }
2408 break;
2409
2410 default:
2411 if(rb->default_event_handler_ex(button, bubbles_callback,
2412 (void*) bb) == SYS_USB_CONNECTED)
2413 return BB_USB;
2414 break;
2415 }
2416 }
2417
2418 /********************
2419 * init *
2420 ********************/
2421 bubbles_init(bb);
2422 bubbles_drawboard(bb);
2423 rb->lcd_update();
2424
2425 /**********************
2426 * play *
2427 **********************/
2428 lasttick = *rb->current_tick;
2429
2430 while(true) {
2431 /* refresh the board */
2432 bubbles_drawboard(bb);
2433 rb->lcd_update();
2434
2435 /* handle button events */
2436 buttonres = bubbles_handlebuttons(bb, false);
2437 if(buttonres != BB_NONE) return buttonres;
2438
2439 /* handle timing */
2440 bb->elapsedlvl += (HZ*3)/(MAX_FPS*4);
2441 bb->elapsedshot += (HZ*3)/(MAX_FPS*4);
2442
2443 if(bb->elapsedshot > MAX_SHOTTIME) {
2444 bb->elapsedshot = 0;
2445 buttonres = bubbles_fire(bb);
2446 if(buttonres != BB_NONE) return buttonres;
2447 buttonres = bubbles_checklevel(bb);
2448 if(buttonres != BB_NONE) return buttonres;
2449 }
2450
2451 /* framerate limiting */
2452 currenttick = *rb->current_tick;
2453 if(currenttick-lasttick < HZ/MAX_FPS) {
2454 rb->sleep((HZ/MAX_FPS)-(currenttick-lasttick));
2455 }
2456 lasttick = currenttick;
2457 }
2458}
2459
2460/*****************************************************************************
2461* plugin entry point.
2462******************************************************************************/
2463enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
2464 struct game_context bb;
2465 bool exit = false;
2466 int position;
2467 char str[19];
2468
2469 /* plugin init */
2470 (void)parameter;
2471 rb = api;
2472 /* end of plugin init */
2473
2474 /* more init */
2475 xlcd_init(rb);
2476
2477 /* load files */
2478 rb->splash(0, true, "Loading...");
2479 bubbles_loadscores(&bb);
2480 rb->lcd_clear_display();
2481
2482 /* start app */
2483 rb->lcd_setfont(FONT_SYSFIXED);
2484
2485 while(!exit) {
2486 switch(bubbles(&bb)){
2487 case BB_WIN:
2488 rb->splash(HZ*2, true, "You Win!");
2489
2490 if((position = bubbles_recordscore(&bb))) {
2491 rb->snprintf(str, 19, "New high score #%d!", position);
2492 rb->splash(HZ*2, true, str);
2493 }
2494 break;
2495
2496 case BB_LOSE:
2497 rb->splash(HZ*2, true, "Game Over");
2498 /* fall through to BB_END */
2499
2500 case BB_END:
2501 if(!bb.resume) {
2502 /* record high level */
2503 if(bb.level-1 > bb.highlevel) {
2504 bb.highlevel = bb.level-1;
2505 bb.dirty = true;
2506 }
2507
2508 /* record high score */
2509 if((position = bubbles_recordscore(&bb))) {
2510 rb->snprintf(str, 19, "New high score #%d!", position);
2511 rb->splash(HZ*2, true, str);
2512 }
2513 }
2514 break;
2515
2516 case BB_USB:
2517 rb->lcd_setfont(FONT_UI);
2518 return PLUGIN_USB_CONNECTED;
2519
2520 case BB_QUIT:
2521 if(bb.dirty) {
2522 rb->splash(HZ/2, true, "Saving high scores...");
2523 bubbles_savescores(&bb);
2524 }
2525 exit = true;
2526 break;
2527
2528 default:
2529 break;
2530 }
2531 }
2532
2533 rb->lcd_setfont(FONT_UI);
2534 return PLUGIN_OK;
2535}
2536
2537#endif