blob: cb6ba41b2953729728d24c97aee3bd8a5cc63c91 [file] [log] [blame]
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 Adam Boot
*
* Color graphics from Frozen Bubble (http://www.frozen-bubble.org/)
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "plugin.h"
#include "xlcd.h"
#include "pluginlib_actions.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
/* files */
#define SCORE_FILE PLUGIN_DIR "/bubbles.score"
#define SAVE_FILE PLUGIN_DIR "/bubbles.save"
/* final game return status */
#define BB_NONE 5
#define BB_WIN 4
#define BB_END 3
#define BB_USB 2
#define BB_QUIT 1
#define BB_LOSE 0
/* play board dimension */
#define BB_HEIGHT 12
#define BB_WIDTH 8
#define BB_LEVEL_HEIGHT 10
/* various amounts */
#define NUM_SCORES 10
#define NUM_LEVELS 100
#define NUM_QUEUE 2
#define NUM_BUBBLES 8
#define MIN_ANGLE -76
#define MAX_ANGLE 76
#define NUM_COMPRESS 9
#define MAX_SHOTTIME 1000
/* bubbles will consume height of 10*ROW_HEIGHT+2*(BUBBLE_HEIGHT-1)+BUBBLE_HEIGHT/2 */
/* 24x24 bubbles (iPod Video) */
#if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320)
#define BUBBLE_WIDTH 22
#define BUBBLE_HEIGHT 22
#define EMBLEM_WIDTH 16
#define EMBLEM_HEIGHT 16
#define XOFS 72
#define ROW_HEIGHT 18
#define ROW_INDENT 11
#define MAX_FPS 40
/* 16x16 bubbles (H300, iPod Color) */
#elif (LCD_HEIGHT == 176) && (LCD_WIDTH == 220)
#define BUBBLE_WIDTH 16
#define BUBBLE_HEIGHT 16
#define EMBLEM_WIDTH 12
#define EMBLEM_HEIGHT 12
#define XOFS 46
#define ROW_HEIGHT 14
#define ROW_INDENT 8
#define MAX_FPS 30
/* 16x16 bubbles (Gigabeat) */
#elif (LCD_HEIGHT == 320) && (LCD_WIDTH == 240)
#define BUBBLE_WIDTH 16
#define BUBBLE_HEIGHT 16
#define EMBLEM_WIDTH 12
#define EMBLEM_HEIGHT 12
#define XOFS 56
#define ROW_HEIGHT 14
#define ROW_INDENT 8
#define MAX_FPS 20
/* 12x12 bubbles (iPod Nano) */
#elif (LCD_HEIGHT == 132) && (LCD_WIDTH == 176)
#define BUBBLE_WIDTH 12
#define BUBBLE_HEIGHT 12
#define EMBLEM_WIDTH 8
#define EMBLEM_HEIGHT 8
#define XOFS 40
#define ROW_HEIGHT 10
#define ROW_INDENT 6
#define MAX_FPS 40
/* 12x12 bubbles (H100, H10, iAudio X5, iPod 3G, iPod 4G grayscale) */
#elif (LCD_HEIGHT == 128) && ((LCD_WIDTH == 160) || (LCD_WIDTH == 128))
#define BUBBLE_WIDTH 12
#define BUBBLE_HEIGHT 12
#define EMBLEM_WIDTH 8
#define EMBLEM_HEIGHT 8
#define XOFS 33
#define ROW_HEIGHT 10
#define ROW_INDENT 6
#define MAX_FPS 30
/* 10x10 bubbles (iPod Mini) */
#elif (LCD_HEIGHT == 110) && (LCD_WIDTH == 138)
#define BUBBLE_WIDTH 10
#define BUBBLE_HEIGHT 10
#define EMBLEM_WIDTH 6
#define EMBLEM_HEIGHT 6
#define XOFS 33
#define ROW_HEIGHT 8
#define ROW_INDENT 5
#define MAX_FPS 30
/* 8x7 bubbles (Archos recorder, Ondio) */
#elif (LCD_HEIGHT == 64) && (LCD_WIDTH == 112)
#define BUBBLE_WIDTH 8
#define BUBBLE_HEIGHT 7
#define EMBLEM_WIDTH 7
#define EMBLEM_HEIGHT 5
#define XOFS 33
#define ROW_HEIGHT 5
#define ROW_INDENT 4
#define MAX_FPS 20
#else
#error BUBBLES: Unsupported LCD type
#endif
#define TEXT_LINES (LCD_HEIGHT/8)
/* shot position */
#define SHOTX XOFS+ROW_INDENT+BUBBLE_WIDTH*3
#define SHOTY ROW_HEIGHT*(BB_HEIGHT-1)+BUBBLE_HEIGHT/2
/* collision distance squared */
#define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10)
/* external bitmaps */
extern const fb_data bubbles_bubble[];
extern const fb_data bubbles_emblem[];
#ifdef HAVE_LCD_COLOR
extern const fb_data bubbles_left[];
/* skip right border for square screens */
#if (LCD_WIDTH > LCD_HEIGHT)
extern const fb_data bubbles_right[];
#endif
#endif
/* global rockbox api */
static struct plugin_api* rb;
/* levels */
char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = {
{{ 6, 6, 4, 4, 2, 2, 3, 3},
{ 6, 6, 4, 4, 2, 2, 3, -1},
{ 2, 2, 3, 3, 6, 6, 4, 4},
{ 2, 3, 3, 6, 6, 4, 4, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 7, 7, 7, 7, 7, 7, -1},
{-1, 1, 1, 1, 1, 1, -1, -1},
{-1, -1, 2, 2, 2, 2, -1, -1},
{-1, -1, -1, 2, -1, -1, -1, -1},
{-1, -1, -1, 2, 2, -1, -1, -1},
{-1, -1, -1, 5, -1, -1, -1, -1},
{-1, -1, -1, 5, 5, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 7, -1, -1, 7, -1, -1},
{-1, -1, 7, 1, 7, -1, -1, -1},
{-1, -1, -1, 1, 2, -1, -1, -1},
{-1, -1, 1, 2, 1, -1, -1, -1},
{-1, -1, -1, 2, 5, -1, -1, -1},
{-1, -1, 3, 5, 3, -1, -1, -1},
{-1, -1, -1, 5, 3, -1, -1, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 0, 0, -1, -1, -1},
{-1, -1, 5, 0, 1, -1, -1, -1},
{-1, -1, 3, 5, 1, 6, -1, -1},
{-1, 4, 3, -1, 6, 7, -1, -1},
{-1, 7, 4, -1, -1, 7, 4, -1},
{ 6, 7, -1, -1, -1, 4, 3, -1},
{ 1, 6, -1, -1, -1, -1, 3, 5},
{ 1, -1, -1, -1, -1, -1, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 0, 0, 0, 0, -1, -1},
{-1, 0, 1, 1, 1, 0, -1, -1},
{-1, 0, 1, 0, 0, 1, 0, -1},
{-1, 0, 1, 1, 1, 0, -1, -1},
{-1, -1, 0, 0, 0, 0, -1, -1},
{-1, -1, 7, -1, 7, -1, -1, -1},
{-1, -1, 7, 7, 7, 7, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 4, 4, 4, 6, 6, 6, -1},
{ 4, -1, -1, -1, -1, -1, 6, -1},
{-1, 4, -1, -1, -1, -1, 6, -1},
{ 4, 2, 3, 1, 2, 3, 6, -1},
{-1, 3, 1, 2, 3, 1, 2, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 4, 4, 4, 6, 6, 6, -1},
{ 4, -1, -1, -1, -1, -1, 6, -1},
{-1, 4, -1, -1, -1, -1, 6, -1},
{ 4, 2, 3, 1, 2, 3, 6, -1},
{-1, 3, 1, 2, 3, 1, 2, -1},
{-1, 2, 3, 1, 2, 3, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 0, 0, -1, -1, 2, 2, -1},
{-1, 5, -1, -1, -1, 3, -1, -1},
{-1, 0, -1, -1, -1, 6, -1, -1},
{-1, 3, -1, -1, -1, 0, -1, -1},
{-1, 4, -1, -1, -1, 5, -1, -1},
{-1, 2, -1, -1, -1, 3, -1, -1},
{-1, 2, -1, -1, -1, 1, -1, -1},
{-1, 3, -1, -1, -1, 4, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 3, -1, -1, -1, -1, -1, -1, 3},
{ 6, 3, 2, 4, 6, 3, 2, -1},
{ 4, -1, -1, -1, -1, -1, -1, 4},
{ 2, 4, 6, 3, 2, 4, 6, -1},
{-1, -1, -1, 6, -1, -1, -1, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 2, -1, 1, -1, 1, -1, 2},
{ 1, 2, -1, 2, 1, -1, 1, -1},
{ 1, -1, 1, -1, 2, -1, 2, -1},
{ 2, 1, -1, 1, 2, -1, 2, -1},
{-1, 2, -1, 2, -1, 2, -1, 2},
{ 1, 2, -1, 2, 1, -1, 1, -1},
{ 1, -1, 1, -1, 2, -1, 1, -1},
{ 2, 2, -1, 1, 1, -1, 2, -1},
{-1, 2, -1, 1, -1, 1, -1, 1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 7, 7, -1, -1, 5, 5, -1},
{ 1, -1, -1, -1, -1, -1, 4, -1},
{ 2, 1, -1, -1, -1, -1, 4, 3},
{ 2, -1, -1, -1, -1, -1, 3, -1},
{ 1, 2, -1, -1, -1, -1, 3, 4},
{ 1, -1, -1, -1, -1, -1, 4, -1},
{ 7, 1, -1, -1, -1, -1, 4, 5},
{ 7, 7, -1, -1, -1, 5, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 7, 7, -1, -1, -1, -1, 5, 5},
{ 1, 5, -1, -1, -1, 7, 4, -1},
{ 2, 1, -1, -1, -1, -1, 4, 3},
{ 2, -1, -1, -1, -1, -1, 3, -1},
{ 1, 5, -1, -1, -1, -1, 7, 4},
{ 1, -1, -1, -1, -1, -1, 4, -1},
{ 7, 1, -1, -1, -1, -1, 4, 5},
{ 7, 5, -1, -1, -1, 7, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 0, 0, -1, -1, -1},
{-1, -1, 5, 0, 1, -1, -1, -1},
{-1, -1, 3, 5, 1, 6, -1, -1},
{-1, 4, 3, 2, 6, 2, -1, -1},
{-1, 7, 4, 7, 2, 2, 4, -1},
{ 6, 7, 7, 3, 3, 4, 3, -1},
{ 1, 6, 1, 1, 1, 3, 3, 5},
{ 1, 1, -1, -1, -1, -1, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 0, -1, -1, 0, -1, -1},
{-1, 3, 3, -1, 3, 3, -1, -1},
{-1, 0, 2, 0, 0, 2, 0, -1},
{-1, 3, 3, -1, 3, 3, -1, -1},
{-1, -1, 0, -1, -1, 0, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 1, 1, -1, -1, -1},
{-1, -1, 2, 2, 2, -1, -1, -1},
{-1, -1, 3, 3, 3, 3, -1, -1},
{-1, 4, 4, 4, 4, 4, -1, -1},
{-1, 5, 5, 5, 5, 5, 5, -1},
{-1, -1, -1, 6, -1, -1, -1, -1},
{-1, -1, -1, 7, 7, -1, -1, -1},
{-1, -1, -1, 0, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 2, 5, -1, -1, -1},
{-1, 4, 3, -1, -1, -1, -1, -1},
{ 6, 7, -1, 5, 2, -1, -1, -1},
{-1, -1, -1, -1, 3, 4, -1, -1},
{-1, -1, -1, 2, 5, -1, 7, 6},
{-1, 4, 3, -1, -1, -1, -1, -1},
{ 6, 7, -1, 5, 2, -1, -1, -1},
{-1, -1, -1, -1, 3, 4, -1, -1},
{-1, -1, -1, -1, -1, -1, 7, 6},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 5, 5, -1, -1, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, 1, -1, -1, -1, -1},
{-1, -1, -1, 7, -1, -1, -1, -1},
{-1, -1, -1, 2, -1, -1, -1, -1},
{-1, -1, -1, 4, -1, -1, -1, -1},
{-1, -1, -1, 5, -1, -1, -1, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 0, 1, -1, -1, -1},
{-1, -1, 0, 2, 7, 7, -1, -1},
{-1, -1, -1, 0, 1, 7, -1, -1},
{-1, 0, 0, 0, 0, -1, -1, -1},
{-1, 0, 0, 0, 1, 1, -1, -1},
{ 0, 0, 0, 1, 1, 1, -1, -1},
{-1, 0, 0, 1, 1, 1, -1, -1},
{-1, 0, 0, 0, 7, 7, -1, -1},
{-1, -1, 7, 7, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 1, -1, -1, -1, -1, -1, -1},
{ 1, -1, -1, -1, -1, -1, -1, -1},
{-1, 2, 3, 4, 7, 6, 5, -1},
{-1, -1, -1, -1, -1, -1, 1, -1},
{-1, -1, -1, -1, -1, -1, 1, -1},
{-1, 2, 3, 4, 7, 6, -1, -1},
{-1, 1, -1, -1, -1, -1, -1, -1},
{ 1, -1, -1, -1, -1, -1, -1, -1},
{-1, 2, 3, 4, 7, 6, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 6, -1, -1, -1, -1, -1, -1},
{ 5, -1, -1, -1, -1, -1, -1, -1},
{ 2, 3, 4, 7, 6, 5, 2, 3},
{-1, -1, -1, -1, -1, -1, 4, -1},
{-1, -1, -1, -1, -1, -1, 7, -1},
{-1, 4, 3, 2, 5, 6, -1, -1},
{-1, 7, -1, -1, -1, -1, -1, -1},
{ 6, -1, -1, -1, -1, -1, -1, -1},
{ 5, 2, 3, 4, 7, 6, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 3, 2, 1, 0, 0, 1, 2, 3},
{ 3, 2, 1, 0, 1, 2, 3, -1},
{ 4, 3, 2, 1, 1, 2, 3, 4},
{ 4, 3, 2, 1, 2, 3, 4, -1},
{ 5, 4, 3, 2, 2, 3, 4, 5},
{ 5, 4, 3, 2, 3, 4, 5, -1},
{ 6, 5, 4, 3, 3, 4, 5, 6},
{ 6, 5, 4, 3, 4, 5, 6, -1},
{ 7, 6, 5, 4, 4, 5, 6, 7},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 5, 5, -1, -1, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, 2, 4, -1, -1, -1},
{-1, -1, -1, 6, -1, -1, -1, -1},
{-1, -1, -1, 2, 4, -1, -1, -1},
{-1, 2, -1, 5, -1, 4, -1, -1},
{ 1, 0, 1, 0, 1, 0, 1, 0},
{ 3, -1, 3, -1, 2, -1, 6, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, 1, -1, -1, -1},
{ 7, 4, 3, 5, -1, -1, -1, -1},
{ 6, -1, -1, 1, -1, -1, -1, -1},
{-1, -1, -1, 5, 3, 4, 7, -1},
{ 6, -1, -1, -1, 1, -1, -1, 6},
{ 7, 4, 3, 5, -1, -1, -1, -1},
{-1, -1, -1, 1, -1, -1, -1, 6},
{-1, -1, -1, 5, 3, 4, 7, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, 7, 3, 6, -1},
{-1, -1, 3, 7, 3, 6, 3, -1},
{-1, -1, 5, 7, 3, 6, 3, -1},
{-1, 6, 7, 3, 6, 7, -1, -1},
{-1, 7, 7, 3, 6, 1, -1, -1},
{ 3, 7, 3, 6, 3, -1, -1, -1},
{ 5, 6, 2, 7, 1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 5, -1, -1, -1, -1, -1, -1, 5},
{ 5, -1, 6, 6, 6, -1, 5, -1},
{-1, 5, 4, -1, -1, 4, 5, -1},
{-1, 3, -1, -1, -1, 3, -1, -1},
{-1, 6, 0, -1, -1, 0, 6, -1},
{-1, 3, -1, -1, -1, 3, -1, -1},
{-1, -1, 4, -1, -1, 4, -1, -1},
{-1, -1, 6, 6, 6, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 7, 0, -1, -1, 0, 7, -1},
{ 7, -1, 0, -1, 0, -1, 7, -1},
{ 7, 1, -1, 0, 0, -1, 1, 7},
{ 7, 1, 2, 0, 2, 1, 7, -1},
{ 7, 6, 3, 2, 2, 3, 6, 7},
{ 7, -1, 3, 2, 3, -1, 7, -1},
{-1, 7, 7, 3, 3, 7, 7, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 3, -1, 1, -1, 7, -1, 6},
{ 5, -1, 7, -1, 7, -1, 6, -1},
{ 6, -1, 0, -1, 5, -1, 3, -1},
{-1, 2, -1, 1, -1, 5, -1, -1},
{-1, 4, -1, 3, -1, 4, -1, -1},
{ 2, -1, 3, -1, 2, -1, -1, -1},
{-1, -1, 4, -1, 6, -1, -1, -1},
{-1, -1, -1, 5, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, 1, -1, -1, -1},
{-1, -1, -1, -1, 3, -1, -1, -1},
{ 6, 1, 3, 1, 2, 1, 4, 1},
{-1, -1, -1, -1, 6, -1, -1, -1},
{-1, -1, -1, 4, 1, -1, -1, -1},
{-1, -1, 1, -1, 3, -1, -1, -1},
{-1, -1, -1, 2, 1, -1, -1, -1},
{-1, -1, -1, -1, 4, -1, -1, -1},
{-1, -1, -1, 6, 1, -1, -1, -1},
{-1, -1, -1, 6, -1, -1, -1, -1}},
{{-1, -1, -1, 5, 4, -1, -1, -1},
{-1, -1, 4, 1, 0, -1, -1, -1},
{-1, -1, -1, 2, 3, -1, -1, -1},
{-1, 1, 4, -1, 2, 2, -1, -1},
{-1, 3, 1, 2, 5, 1, 4, -1},
{-1, 4, 2, -1, 0, 4, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, 1, -1, -1, -1},
{-1, -1, -1, 1, -1, -1, -1, -1},
{-1, 2, -1, -1, 1, -1, 5, -1},
{ 5, -1, -1, 1, -1, -1, 0, -1},
{-1, 6, -1, -1, 1, -1, 4, -1},
{-1, 0, -1, 1, -1, 5, -1, -1},
{-1, -1, 5, 5, 0, 1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 6, 3, -1, -1, -1},
{-1, -1, 3, 2, 6, -1, -1, -1},
{-1, -1, 2, 6, 3, 2, -1, -1},
{-1, 6, 3, 2, 6, 3, -1, -1},
{-1, 3, 2, 6, 3, 2, 6, -1},
{ 2, 6, 3, 2, 6, 3, 2, -1},
{ 6, 3, 2, 6, 3, 2, 6, 3},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, 6, 6, 6, 6, 6, 6, 6},
{ 4, -1, -1, -1, -1, -1, -1, -1},
{-1, 3, 2, 5, 7, 6, 4, 3},
{-1, 5, -1, -1, -1, -1, -1, -1},
{-1, -1, 7, 6, 4, 3, 2, 5},
{-1, -1, 4, -1, -1, -1, -1, -1},
{-1, -1, -1, 3, 2, 5, 7, 6},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, -1, 7, -1, -1, 6, -1, 2},
{ 6, -1, 1, -1, 6, 1, 3, -1},
{-1, 4, -1, 7, 2, -1, 7, -1},
{ 2, 7, -1, -1, -1, 4, -1, -1},
{ 6, -1, 3, 5, 0, 2, -1, 7},
{ 1, -1, -1, -1, -1, -1, 1, -1},
{-1, 1, 4, 5, 7, 5, 1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, 6, 6, -1, -1, 6, 6, 6},
{-1, -1, 6, -1, 6, -1, -1, -1},
{-1, -1, 2, 3, 3, 2, -1, -1},
{-1, 3, -1, 5, -1, 3, -1, -1},
{-1, -1, 5, 3, 3, 5, -1, -1},
{-1, -1, 6, 1, 6, -1, -1, -1},
{-1, 4, 2, -1, -1, 2, 4, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 5, 5, -1, -1, -1},
{-1, -1, 5, -1, -1, -1, -1, -1},
{-1, 3, 4, 6, 6, -1, -1, 5},
{ 3, 3, 4, 6, 5, -1, 5, -1},
{ 3, 2, 3, 6, 6, 5, 5, -1},
{ 3, 3, 4, 6, 5, -1, 5, -1},
{-1, 3, 4, 6, 6, -1, -1, 5},
{-1, -1, 5, -1, -1, -1, -1, -1},
{-1, -1, -1, 5, 5, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, -1, -1, -1, -1, -1, -1, 1},
{ 1, -1, 2, 2, 2, -1, 1, -1},
{-1, 1, 2, 3, 3, 2, 1, -1},
{ 6, 2, 3, -1, 3, 2, 6, -1},
{ 6, 2, 3, -1, -1, 3, 2, 6},
{ 6, 2, 3, -1, 3, 2, 6, -1},
{ 3, 3, 3, 7, 7, 3, 3, 3},
{ 0, 5, 0, 2, 0, 5, 0, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 7, 7, 7, -1, -1, -1},
{-1, 7, 2, 2, 7, -1, -1, -1},
{-1, 7, 5, 5, 5, 7, -1, -1},
{ 7, 7, 7, 7, 7, 7, -1, -1},
{-1, -1, 6, -1, 6, -1, -1, -1},
{-1, 6, -1, -1, 6, -1, -1, -1},
{-1, 6, 4, 4, -1, 6, 4, 4},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 3, 3, -1, 3, 3, 3, -1},
{ 3, 7, 5, 4, 6, 5, 3, -1},
{ 1, 3, 3, 3, -1, 3, 3, 1},
{ 2, 1, 2, 1, 2, 1, 2, -1},
{ 1, 3, 3, -1, 3, 3, 3, 1},
{ 3, 5, 6, 4, 5, 7, 3, -1},
{ 2, 3, 3, 3, -1, 3, 3, 2},
{ 1, 1, 2, 2, 2, 1, 1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 6, 5, -1, -1, -1, -1, -1},
{ 3, 1, 3, -1, -1, -1, -1, -1},
{-1, 5, 6, -1, -1, -1, -1, -1},
{-1, -1, 5, 3, -1, -1, -1, -1},
{-1, -1, 6, 1, 6, -1, -1, -1},
{-1, -1, 3, 5, -1, -1, -1, -1},
{-1, -1, -1, -1, 3, 6, -1, -1},
{-1, -1, -1, 5, 6, 5, -1, -1},
{-1, -1, -1, -1, 6, 3, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, 3, 7, 4, 5, 1, 6, 3},
{ 5, 1, 6, 3, 7, 4, 5, -1},
{ 6, 3, 7, 4, 5, 1, 6, 3},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, 4, 4},
{-1, -1, 7, 7, 7, 4, 4, -1},
{-1, -1, -1, -1, -1, -1, 4, 4},
{-1, 1, -1, -1, -1, 7, -1, -1},
{-1, 1, 1, -1, -1, 7, -1, -1},
{ 3, 3, 3, -1, 7, -1, -1, -1},
{ 3, -1, 2, 3, 3, 3, -1, 3},
{-1, 2, -1, 3, -1, 3, 3, -1},
{-1, 2, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 4, -1, -1, -1, -1, -1},
{-1, 7, 4, -1, -1, -1, -1, -1},
{-1, -1, 7, 4, -1, -1, -1, -1},
{-1, 4, 7, 4, -1, -1, -1, -1},
{ 1, 1, 1, 1, 1, 1, 1, -1},
{ 1, 2, 1, 2, 1, 1, -1, -1},
{ 2, 2, 2, 2, 2, 2, 2, 2},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 0, -1, -1, -1, -1, -1, -1, 6},
{ 6, 1, 4, 3, 7, 5, 0, -1},
{ 0, -1, -1, -1, -1, -1, -1, 6},
{ 6, 1, 4, 3, 7, 5, 0, -1},
{ 0, -1, -1, -1, -1, -1, -1, 6},
{ 6, 1, 4, 3, 7, 5, 0, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 3, 3, 4, 6, 6, 4, 3, 3},
{ 0, 3, 4, 6, 4, 3, 1, -1},
{ 5, 1, 3, 4, 4, 3, 0, 1},
{ 0, 1, 3, 4, 3, 1, 0, -1},
{ 2, 1, 6, 3, 3, 0, 0, 1},
{ 0, 3, 4, 3, 6, 1, 5, -1},
{ 6, 1, 2, 6, 4, 0, 0, 2},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, 6, -1, -1, -1, -1, 4, 4},
{ 4, 0, -1, -1, -1, 3, 6, -1},
{ 0, 6, -1, -1, -1, -1, 4, 2},
{ 7, -1, -1, -1, -1, -1, 7, -1},
{ 4, 4, -1, -1, -1, -1, 5, 6},
{ 6, 4, 7, 7, 5, 6, 4, -1},
{-1, 7, 6, 4, 6, 4, 7, -1},
{-1, 0, -1, 7, -1, 7, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 5, -1, -1, -1, -1, 4, -1},
{-1, 5, -1, -1, -1, 4, -1, -1},
{-1, -1, 5, 6, 6, 4, -1, -1},
{-1, -1, 2, -1, 2, -1, -1, -1},
{ 0, 0, 6, -1, -1, 6, 1, 1},
{-1, -1, 2, -1, 2, -1, -1, -1},
{-1, -1, 7, 6, 6, 3, -1, -1},
{-1, 7, -1, -1, -1, 3, -1, -1},
{-1, 7, -1, -1, -1, -1, 3, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 6, -1, -1, -1, -1, 2, -1},
{ 1, 7, 1, 1, 1, 3, 1, -1},
{-1, -1, 4, 1, 1, 4, -1, -1},
{-1, 1, 3, 1, 7, 1, -1, -1},
{-1, -1, -1, 2, 6, -1, -1, -1},
{-1, -1, 1, 5, 1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 7, 7, 7, 7, 7, 7, 7, 7},
{ 7, -1, -1, -1, -1, -1, 7, -1},
{ 7, -1, -1, 2, 0, 5, 2, 2},
{ 7, -1, -1, -1, 0, 3, 6, -1},
{ 7, -1, -1, -1, -1, -1, 4, 0},
{ 5, 5, -1, -1, -1, -1, -1, -1},
{ 4, 3, 6, 2, -1, -1, -1, -1},
{ 0, 2, 0, 4, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 1, -1, -1, 1, -1, -1},
{-1, 4, -1, -1, 5, -1, -1, -1},
{-1, 7, -1, -1, 1, 1, 1, -1},
{ 6, -1, -1, -1, -1, 7, -1, -1},
{ 1, 1, 1, 1, -1, 4, -1, -1},
{-1, -1, 5, -1, -1, -1, -1, -1},
{-1, -1, 0, -1, -1, -1, -1, -1},
{-1, 3, -1, -1, -1, -1, -1, -1},
{-1, 1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 7, 7, -1, -1, 7, 7, -1},
{ 6, -1, 4, -1, 4, -1, 6, -1},
{ 5, -1, -1, 3, 3, -1, -1, 5},
{ 6, -1, -1, -1, -1, -1, 6, -1},
{-1, 7, -1, -1, -1, -1, 7, -1},
{-1, 4, -1, -1, -1, 4, -1, -1},
{-1, -1, 3, -1, -1, 3, -1, -1},
{-1, -1, 2, -1, 2, -1, -1, -1},
{-1, -1, -1, 5, 5, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 0, 0, -1, -1, 0, 0, -1},
{ 7, 4, 6, 6, 6, 4, 3, -1},
{ 5, 6, 6, 6, 2, 6, 6, 3},
{ 7, 4, 6, 6, 6, 4, 3, -1},
{-1, 0, 0, -1, -1, 0, 0, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, 7, 7, 7},
{-1, -1, -1, -1, 2, 7, 7, -1},
{-1, 0, 7, 7, 7, -1, 7, 7},
{ 6, 7, 7, 7, -1, -1, -1, -1},
{ 6, -1, -1, -1, 7, 7, 7, 7},
{ 6, -1, -1, -1, -1, -1, -1, -1},
{ 4, 2, 2, 2, 4, -1, 3, -1},
{ 4, 4, 4, 4, 3, 3, 3, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 4, -1, -1, 7, -1, 6, -1, 7},
{ 7, 6, 7, -1, -1, 7, 4, -1},
{-1, -1, 7, -1, -1, 7, -1, -1},
{-1, 0, 0, 0, 0, 0, 3, -1},
{-1, -1, 0, 2, 2, 0, 6, 4},
{-1, -1, 0, 0, 0, 1, 3, -1},
{-1, -1, -1, 0, 0, -1, 3, 4},
{-1, -1, -1, 6, -1, 5, 6, -1},
{-1, -1, -1, -1, -1, -1, 1, 0},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 5, -1, -1, -1, -1, 5, -1},
{ 0, -1, -1, 0, -1, -1, 0, -1},
{ 0, 0, 0, 2, 2, 0, 0, 0},
{ 0, -1, -1, 0, -1, -1, 0, -1},
{-1, 7, -1, 3, -1, -1, 7, -1},
{-1, -1, 3, 6, -1, -1, -1, -1},
{-1, -1, -1, 6, -1, -1, -1, -1},
{-1, 3, 6, -1, -1, -1, -1, -1},
{-1, 3, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 6, 5, -1, -1, -1},
{-1, -1, 2, 6, 3, -1, -1, -1},
{-1, -1, 5, 4, 7, 1, -1, -1},
{-1, 6, 2, 2, 3, 4, -1, -1},
{-1, -1, 3, 7, 3, 6, -1, -1},
{-1, -1, 1, 3, 2, -1, -1, -1},
{-1, -1, -1, 4, 5, -1, -1, -1},
{-1, -1, -1, 4, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 7, 7, -1, 2, 2, -1, 6, 6},
{ 6, -1, -1, 6, -1, -1, 3, -1},
{ 2, -1, -1, 1, -1, -1, 2, -1},
{ 5, -1, -1, 3, -1, -1, 2, -1},
{ 1, -1, -1, 2, -1, -1, 1, -1},
{ 5, -1, -1, 2, -1, -1, 2, -1},
{ 6, -1, -1, 1, -1, -1, 7, -1},
{ 5, -1, -1, 5, -1, -1, 4, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 6, 6, -1, -1, -1},
{-1, 0, 4, 4, 4, 0, -1, -1},
{-1, -1, -1, 6, 6, -1, -1, -1},
{-1, -1, 2, 7, 2, -1, -1, -1},
{-1, -1, -1, 6, 6, -1, -1, -1},
{-1, 0, 5, 5, 5, 0, -1, -1},
{-1, -1, -1, 3, 3, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 4, 1, 3, -1, -1, -1},
{-1, 1, -1, -1, 1, -1, -1, -1},
{-1, -1, 4, 1, 3, 4, 1, -1},
{-1, 1, 3, 4, -1, -1, 4, -1},
{-1, 3, -1, -1, 3, 4, 1, -1},
{-1, 1, 3, 4, 1, 3, -1, -1},
{-1, -1, 4, 1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 6, 4, -1, 3, 2, 5, -1},
{ 0, -1, -1, -1, -1, -1, 1, -1},
{-1, 2, 3, 5, -1, 4, 6, -1},
{ 0, -1, -1, -1, -1, -1, 1, -1},
{-1, 4, 6, -1, 2, 5, 3, -1},
{ 0, -1, -1, -1, -1, -1, 1, -1},
{-1, 5, 2, 3, -1, 4, 6, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 6, 6, -1, -1, -1},
{-1, -1, 7, 6, 4, -1, -1, -1},
{-1, 2, 1, 7, 4, 1, 3, -1},
{ 2, 1, 1, 1, 1, 1, 3, -1},
{-1, 2, 2, 2, 3, 3, 3, -1},
{-1, -1, -1, 5, -1, -1, -1, -1},
{-1, -1, -1, 2, 3, -1, -1, -1},
{-1, -1, -1, 5, -1, -1, -1, -1},
{-1, -1, 2, 2, 3, 3, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 4, -1, 5, -1, -1, 3, -1, 6},
{ 2, -1, 3, -1, 2, -1, 4, -1},
{ 4, -1, -1, 1, 0, -1, -1, 6},
{ 6, -1, 2, 3, 5, -1, 4, -1},
{ 4, -1, -1, 0, 1, -1, -1, 6},
{ 2, -1, 5, -1, 3, -1, 4, -1},
{ 4, -1, 3, -1, -1, 2, -1, 6},
{ 6, -1, -1, -1, -1, -1, 4, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 2, 6, 0, 5, 5, 1, 3, 4},
{ 1, -1, -1, 2, -1, -1, 0, -1},
{ 4, -1, -1, 3, 6, -1, -1, 2},
{-1, -1, -1, 0, -1, -1, -1, -1},
{-1, -1, -1, 1, 4, -1, -1, -1},
{-1, -1, -1, 2, -1, -1, -1, -1},
{-1, -1, -1, 6, 3, -1, -1, -1},
{-1, -1, -1, 5, -1, -1, -1, -1},
{-1, -1, -1, 4, 1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, 5, 1, 1, 3},
{ 0, 5, 1, 0, 5, 3, 3, -1},
{ 5, 1, 0, 5, 1, 0, 5, 1},
{ 0, 5, 1, 0, 5, 1, 6, -1},
{-1, -1, -1, -1, 1, 6, 5, 1},
{-1, -1, -1, -1, 5, 1, 6, -1},
{-1, -1, -1, -1, 1, 0, 5, 1},
{-1, -1, -1, -1, 5, 1, 0, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 0, 7, 3, -1, -1, 2, 2},
{-1, 0, 7, 3, -1, -1, 2, -1},
{-1, 0, 7, 3, -1, -1, 2, 2},
{-1, 0, 7, 3, -1, 3, 1, -1},
{-1, 0, 7, 3, -1, 6, 4, 5},
{-1, 0, 7, 3, -1, 7, 0, -1},
{-1, 0, 7, 3, -1, 2, 3, 4},
{-1, 0, 7, 3, -1, 5, 6, -1},
{-1, -1, -1, -1, -1, 7, 0, 1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 7, 7, 7, 7, -1},
{ 3, 4, 5, -1, -1, -1, 7, -1},
{ 2, -1, -1, -1, -1, -1, -1, 3},
{ 7, -1, -1, -1, -1, -1, 4, -1},
{ 7, -1, -1, -1, 3, 4, 5, 6},
{ 7, -1, -1, 2, 0, 1, 2, -1},
{ 6, -1, -1, -1, 3, 4, 5, 6},
{ 0, 1, -1, -1, -1, -1, -1, -1},
{ 2, 3, 4, -1, -1, -1, -1, -1},
{ 5, 6, 0, -1, -1, -1, -1, -1}},
{{-1, 7, -1, -1, -1, -1, 2, -1},
{ 1, 1, -1, -1, -1, 3, 3, -1},
{-1, 2, -1, -1, -1, -1, 4, -1},
{ 3, 3, -1, -1, -1, 5, 5, -1},
{-1, 4, -1, -1, -1, -1, 6, -1},
{ 5, 5, -1, -1, -1, 1, 1, -1},
{-1, 6, -1, -1, -1, -1, 7, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 4, -1, -1, -1, -1, 4, -1},
{ 2, -1, -1, 1, -1, -1, 2, -1},
{ 5, -1, -1, 0, 0, -1, -1, 5},
{ 5, -1, -1, 1, -1, -1, 6, -1},
{-1, 4, 2, 7, 7, 5, 4, -1},
{-1, -1, -1, 6, -1, -1, -1, -1},
{-1, -1, -1, 3, 3, -1, -1, -1},
{-1, -1, -1, 7, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 1, -1, -1, 2, 3, 4, -1},
{ 2, -1, -1, 3, 0, 4, -1, -1},
{ 4, -1, -1, 2, 3, 1, -1, -1},
{ 3, -1, 4, 3, 0, -1, -1, -1},
{ 4, -1, -1, 2, 5, 1, -1, -1},
{ 3, -1, 4, 5, 0, 4, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 2, -1, -1, 1, 1, -1, -1, 2},
{ 2, -1, 3, 3, 3, -1, 2, -1},
{-1, 2, -1, 4, 4, -1, 2, -1},
{-1, 7, 7, 0, 7, 7, -1, -1},
{-1, -1, -1, 4, 4, -1, -1, -1},
{-1, -1, 5, 7, 5, -1, -1, -1},
{ 6, 3, 2, 6, 4, 2, 3, 6},
{ 5, -1, -1, -1, -1, -1, 1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 4, 2, 3, 5, 7, 1, 3, 6},
{ 1, -1, -1, 1, -1, -1, 1, -1},
{ 3, 0, 1, 3, 2, 4, 3, 5},
{ 4, -1, -1, 4, -1, -1, 4, -1},
{-1, 5, -1, -1, 5, -1, -1, 5},
{ 0, 3, 2, 0, 4, 5, 0, -1},
{-1, 6, -1, -1, 6, -1, -1, 6},
{ 7, -1, -1, 7, -1, -1, 7, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 5, 4, -1, 1, 1, -1, -1},
{ 5, -1, 4, 1, -1, 1, -1, -1},
{ 0, -1, -1, -1, -1, -1, 0, -1},
{ 0, 6, 4, -1, -1, 4, 2, -1},
{-1, 4, 3, 5, 2, 6, 3, 6},
{-1, 2, 6, -1, -1, 5, 4, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 6, 6, -1, -1, -1},
{-1, -1, 5, 5, 4, -1, -1, -1},
{-1, -1, 1, 6, 6, 4, -1, -1},
{-1, 1, 7, 2, 5, 3, -1, -1},
{-1, 2, 7, 2, 1, 5, 3, -1},
{ 2, 1, 3, 1, 4, 2, 7, -1},
{-1, 3, 1, 3, 4, 2, 7, -1},
{-1, 3, 5, 5, 6, 6, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 7, 3, -1, -1, -1, -1},
{-1, 1, 7, 6, -1, -1, -1, -1},
{-1, 3, 7, 5, 1, 5, -1, -1},
{ 7, 7, 0, 2, 4, 0, 4, -1},
{ 7, 1, 4, 6, 5, 6, 5, 7},
{ 1, 7, 7, 1, 7, 7, 1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 1, -1, -1, 1, -1, -1},
{-1, 5, 6, 1, 5, 6, -1, -1},
{-1, 1, 1, 2, 2, 1, 1, -1},
{ 4, 7, 1, 0, 1, 7, 4, -1},
{-1, 3, 7, 5, 7, 5, 3, -1},
{-1, 1, 1, 1, 1, 1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 4, -1, -1, -1, 5, -1, -1, 4},
{ 6, 6, 7, 6, -1, 4, 5, -1},
{ 4, 2, 7, 5, 2, 2, 6, 4},
{-1, -1, 4, 1, -1, 5, 2, -1},
{-1, 5, 2, 7, 7, -1, 7, 4},
{ 4, 6, 5, 4, -1, 4, 2, -1},
{-1, -1, -1, 4, -1, 4, 1, -1},
{ 0, 0, 0, 5, -1, -1, -1, -1},
{-1, -1, -1, -1, 0, 0, 0, 0},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, -1, -1, -1, 0, 0, -1, -1},
{ 2, -1, -1, 0, 1, 0, -1, -1},
{ 3, -1, -1, 0, 2, 2, 0, -1},
{ 4, -1, 0, 1, 1, 1, 0, -1},
{ 5, -1, -1, 0, 4, 4, 0, -1},
{ 6, -1, -1, 4, 4, 4, -1, -1},
{ 7, -1, -1, -1, 4, 4, -1, -1},
{-1, -1, -1, 0, 1, 0, -1, -1},
{-1, -1, -1, 0, 1, 1, 0, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 3, -1, -1, 1, 7, -1},
{-1, 7, 4, -1, -1, 4, 3, -1},
{ 1, -1, -1, 0, 2, 0, -1, -1},
{ 5, 4, -1, 3, -1, -1, -1, -1},
{ 4, -1, 3, 6, 1, 1, 6, -1},
{-1, 1, -1, -1, 4, -1, 1, -1},
{-1, 7, 5, -1, -1, -1, 3, -1},
{-1, -1, 3, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, -1, -1, -1, 1, -1, -1, -1},
{ 2, -1, -1, -1, 2, -1, -1, -1},
{-1, 3, -1, -1, 3, 3, -1, -1},
{-1, 4, -1, 4, -1, 4, -1, -1},
{-1, 5, -1, -1, 5, 5, -1, -1},
{ 6, -1, -1, 7, 1, 7, -1, -1},
{ 7, -1, -1, -1, 6, 6, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 2, -1, -1, 6, -1, 2, 5, 1},
{ 5, -1, 4, -1, 4, -1, 4, -1},
{ 6, -1, -1, 3, -1, -1, -1, 3},
{ 4, 2, 0, -1, -1, -1, 5, -1},
{-1, -1, -1, 6, -1, 3, 6, -1},
{-1, -1, 5, -1, 5, -1, -1, -1},
{-1, -1, -1, 3, -1, 4, 2, 5},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, -1, -1, -1, 4, -1, -1, 3},
{ 0, 3, -1, -1, 6, -1, 0, -1},
{-1, -1, 7, -1, 1, -1, 3, -1},
{ 7, -1, 4, 7, -1, 2, -1, -1},
{ 5, 2, 3, 2, 1, 6, -1, 3},
{-1, -1, 0, 4, 3, 5, 4, -1},
{-1, 7, 6, -1, -1, 0, -1, -1},
{ 4, 3, -1, -1, -1, 4, 2, -1},
{ 0, -1, -1, -1, -1, -1, 6, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, 1, 2, 5, 1, 6, 3, 0},
{-1, -1, -1, -1, -1, -1, 4, -1},
{ 0, 5, 2, 7, 1, 6, 2, -1},
{ 3, -1, -1, -1, -1, -1, -1, -1},
{ 6, 7, 6, 4, 0, 5, 2, 6},
{-1, -1, -1, -1, -1, -1, 1, -1},
{ 6, 1, 4, 0, 6, 2, 3, -1},
{ 0, -1, -1, -1, -1, -1, -1, -1},
{-1, 0, 4, 5, 3, 7, 6, 0},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 0, 1, -1, -1, -1},
{-1, -1, 0, 7, 0, -1, -1, -1},
{-1, -1, 1, 2, 2, 0, -1, -1},
{-1, 0, 7, 0, 7, 0, -1, -1},
{-1, 6, -1, 7, 7, -1, 6, -1},
{ 4, 1, 6, 6, 6, 4, 1, -1},
{-1, 5, -1, 7, 7, -1, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 5, 6, -1, -1, -1},
{-1, -1, 3, 3, 3, -1, -1, -1},
{-1, -1, 7, 5, 3, 7, -1, -1},
{-1, 3, -1, 6, -1, 3, -1, -1},
{ 2, -1, -1, 3, 7, -1, -1, 1},
{ 2, 2, -1, 3, -1, 1, 1, -1},
{-1, 0, 2, 5, 6, 1, 0, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, 3, 7, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 6, -1, -1, -1, -1, 2, -1},
{-1, 2, 6, 0, 6, 0, -1, -1},
{-1, 0, -1, -1, -1, -1, -1, -1},
{ 6, -1, -1, -1, -1, -1, -1, -1},
{-1, 3, 3, 2, 0, 6, 0, 0},
{-1, 6, -1, -1, -1, -1, 0, -1},
{-1, -1, -1, 6, 0, 2, 6, -1},
{-1, 2, 0, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 0, 7, -1, -1, -1, -1, -1, -1},
{ 1, 5, -1, -1, -1, -1, -1, -1},
{ 7, 2, 5, -1, -1, -1, -1, -1},
{ 6, 3, 4, -1, -1, -1, -1, -1},
{ 5, 5, 4, 4, -1, -1, -1, -1},
{ 3, 3, 5, 3, -1, -1, -1, -1},
{ 1, 2, 2, 5, 3, -1, -1, -1},
{ 1, 0, 0, 7, 6, -1, -1, -1},
{ 3, 3, 5, 5, 7, 6, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 2, 6, 6, 2, -1, -1},
{-1, 2, 1, 1, 0, 2, -1, -1},
{-1, 2, 3, 2, 2, 0, 2, -1},
{ 2, 3, 2, 5, 2, 7, 2, -1},
{ 2, 4, 2, 5, 2, 7, 2, 0},
{ 2, 4, 2, 6, 6, 2, 0, -1},
{-1, 2, 5, 2, 2, 2, 7, 2},
{-1, 2, 5, 6, 6, 7, 2, -1},
{-1, -1, 2, 2, 2, 2, 2, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 0, -1, -1, 0, -1, -1},
{ 1, 0, 0, 1, 0, 0, 1, -1},
{ 1, 7, 7, 5, 5, 7, 7, 1},
{ 3, 2, -1, 2, -1, 2, 3, -1},
{ 3, 7, -1, 6, 6, -1, 7, 3},
{ 7, -1, -1, 6, -1, -1, 7, -1},
{ 4, 4, 5, -1, -1, 5, 4, 4},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 6, 3, -1, -1, 3, 6, -1},
{ 6, -1, 2, -1, 2, -1, 6, -1},
{ 2, -1, 0, 1, 1, 0, -1, 2},
{ 5, 0, -1, 7, -1, 0, 5, -1},
{-1, 5, -1, 6, 6, -1, 5, -1},
{ 7, 1, 4, -1, 4, 1, 7, -1},
{ 7, -1, 4, -1, -1, 4, -1, 7},
{ 2, 0, -1, -1, -1, 0, 2, -1},
{-1, 2, -1, -1, -1, -1, 2, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 6, 1, -1, -1, -1, -1, 4, 0},
{ 2, 7, 5, 5, 5, 7, 3, -1},
{ 6, 1, -1, -1, -1, -1, 4, 0},
{ 2, 5, 7, 7, 7, 5, 3, -1},
{ 6, 1, -1, -1, -1, -1, 4, 0},
{ 2, 0, 6, 6, 6, 0, 3, -1},
{ 6, 1, -1, -1, -1, -1, 4, 0},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 5, -1, -1, 1, 1, -1, -1, 5},
{ 5, -1, 4, -1, 4, -1, 5, -1},
{-1, 2, 4, -1, -1, 4, 2, -1},
{ 7, 2, -1, -1, -1, 2, 7, -1},
{ 0, -1, 0, 4, 4, 0, -1, 0},
{ 7, 2, -1, -1, -1, 2, 7, -1},
{-1, 2, 3, -1, -1, 3, 2, -1},
{ 5, -1, 3, -1, 3, -1, 5, -1},
{ 5, -1, -1, 6, 6, -1, -1, 5},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 2, 2, -1, -1, -1, -1, 5, 5},
{ 5, -1, -1, -1, -1, -1, 2, -1},
{ 5, -1, -1, -1, -1, -1, -1, 2},
{ 1, -1, 1, 5, 1, -1, 3, -1},
{ 5, 2, 5, 3, 1, 2, 5, 2},
{ 2, 0, 5, -1, 2, 0, 5, -1},
{-1, 3, 7, -1, -1, 3, 7, -1},
{-1, -1, 2, 0, 5, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 0, 6, 5, 2, 3, 4, 1, 7},
{-1, -1, -1, -1, 1, -1, -1, -1},
{-1, -1, -1, 1, 1, -1, -1, -1},
{-1, -1, 1, -1, -1, -1, -1, -1},
{ 7, 1, 4, 3, 2, 5, 6, 0},
{-1, -1, -1, -1, 1, -1, -1, -1},
{-1, -1, -1, 1, 1, -1, -1, -1},
{-1, -1, 1, -1, -1, -1, -1, -1},
{ 0, 6, 5, 2, 3, 4, 1, 7},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, 1, -1, -1, 1, -1, -1},
{-1, 2, 4, -1, 2, 4, -1, -1},
{-1, 2, 3, 6, 5, 3, 2, -1},
{-1, 6, 5, -1, 6, 5, -1, -1},
{-1, -1, -1, 7, 7, -1, -1, -1},
{-1, -1, -1, 7, -1, -1, -1, -1},
{ 1, -1, -1, 7, 7, -1, -1, 3},
{ 2, -1, -1, 7, -1, -1, 2, -1},
{-1, 3, 4, 5, 6, 4, 1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, -1, -1, 2, 2, -1, -1, 2},
{ 1, 3, 7, 3, 7, 4, 2, -1},
{-1, 1, 6, -1, -1, 6, 2, -1},
{ 6, -1, 7, 3, 7, -1, 6, -1},
{-1, 4, 2, -1, -1, 1, 3, -1},
{-1, -1, 2, 6, 1, -1, -1, -1},
{-1, 4, 3, 3, 4, 4, 3, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, 5, 6, -1, -1, -1},
{-1, -1, -1, 3, -1, -1, -1, -1},
{-1, -1, -1, 1, 2, -1, -1, -1},
{-1, -1, -1, 4, -1, -1, -1, -1},
{-1, -1, -1, 5, 7, -1, -1, -1},
{-1, -1, -1, 2, -1, -1, -1, -1},
{ 6, 5, 4, 3, 2, 1, 7, 5},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, 0, -1, 1, -1, 2, -1, -1},
{-1, 4, -1, 5, -1, 6, -1, -1},
{-1, 7, -1, 0, -1, 2, -1, -1},
{-1, 6, -1, 3, -1, 6, -1, -1},
{-1, 1, -1, 1, -1, 2, -1, -1},
{-1, 3, -1, 5, -1, 0, -1, -1},
{-1, 2, -1, 4, -1, 6, -1, -1},
{-1, 3, -1, 6, -1, 7, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, 1, 2, 2, 3, 3, 4, 4},
{ 5, 5, 6, 7, 6, 5, 5, -1},
{ 6, 4, 3, 3, 2, 2, 1, 6},
{ 4, 6, 5, 7, 6, 3, 1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 7, 4, -1, 1, 2, -1, 4, 7},
{ 5, 5, -1, 2, -1, 4, 4, -1},
{-1, 5, -1, 7, 7, -1, 4, -1},
{ 1, 0, 6, 7, 6, 0, 2, -1},
{-1, 2, -1, 5, 3, -1, 1, -1},
{ 1, 1, -1, -1, -1, 2, 2, -1},
{ 6, 1, 4, -1, -1, 4, 2, 6},
{ 5, 3, -1, -1, -1, 3, 5, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 1, 5, 1, 0, 0, 1, 5, 1},
{ 1, 2, 5, -1, 5, 2, 1, -1},
{ 3, 6, 1, 2, 2, 1, 6, 3},
{ 4, 3, 4, -1, 4, 3, 4, -1},
{ 3, 4, 6, 5, 5, 6, 4, 3},
{ 0, 2, 3, -1, 3, 2, 0, -1},
{ 2, 3, 1, 5, 5, 1, 3, 2},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}},
{{ 3, 0, 2, 7, 5, 7, 6, 5},
{ 6, -1, 1, -1, 2, -1, 1, -1},
{-1, 6, 4, 0, 3, 4, 5, -1},
{-1, 5, -1, 1, -1, 4, -1, -1},
{-1, 7, 3, 5, 6, 5, 3, -1},
{ 1, -1, 2, -1, 4, -1, 2, -1},
{ 6, 4, 4, 6, 6, 5, 5, 1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1}}
};
/* the tile struct
* type is the bubble number 0-7
* fallx is the x axis movement for the falling bubble
* fallvel is the initial upward velocity for the falling bubble
* ingroup denotes a bubble that is part of a group to be removed
* anchored denotes a bubble that is anchored to the ceiling
*/
struct tile {
int type;
int fallx;
int fallvel;
bool ingroup;
bool anchored;
bool delete;
};
/* the highscore struct
* level is the highscore level
* score is the highscore score
*/
struct highscore {
unsigned int level;
unsigned int score;
};
/* the game context struct
* score is the current score
* level is the current level
* highlevel is the highest level beaten
* highscores is the list of high scores
* angle is the current cannon direction
* shots is the number of shots fired since last compression
* compress is the height of the compressor
* onboardcnt is the number of unique bubbles on the playing board
* onboard is the unique bubbles on the playing board
* nextinq is the pointer to the next bubble in the firing queue
* queue is the circular buffer of bubbles to be fired
* elapsedlvl is level elapsed time in 1/100s of seconds
* elapsedshot is the shot elapsed time in 1/100s of seconds
* startedshot is when the current shot began
* resume denotes whether to resume the currently loaded game
* dirty denotes whether the high scores are out of sync with the saved file
* playboard is the game playing board
*/
struct game_context {
unsigned int score;
unsigned int level;
unsigned int highlevel;
struct highscore highscores[NUM_SCORES];
int angle;
int shots;
int compress;
int onboardcnt;
int onboard[NUM_BUBBLES];
int nextinq;
int queue[NUM_QUEUE];
long elapsedlvl;
long elapsedshot;
long startedshot;
bool resume;
bool dirty;
struct tile playboard[BB_HEIGHT][BB_WIDTH];
};
/*
* Precalculated sine and cosine * 16384 (fixed point 18.14)
* Borrowed from cube.c plugin
*/
static const short sin_table[91] = {
0, 285, 571, 857, 1142, 1427, 1712, 1996, 2280, 2563,
2845, 3126, 3406, 3685, 3963, 4240, 4516, 4790, 5062, 5334,
5603, 5871, 6137, 6401, 6663, 6924, 7182, 7438, 7691, 7943,
8191, 8438, 8682, 8923, 9161, 9397, 9630, 9860, 10086, 10310,
10531, 10748, 10963, 11173, 11381, 11585, 11785, 11982, 12175, 12365,
12550, 12732, 12910, 13084, 13254, 13420, 13582, 13740, 13894, 14043,
14188, 14329, 14466, 14598, 14725, 14848, 14967, 15081, 15190, 15295,
15395, 15491, 15582, 15668, 15749, 15825, 15897, 15964, 16025, 16082,
16135, 16182, 16224, 16261, 16294, 16321, 16344, 16361, 16374, 16381,
16384
};
static long sin(int val) {
val = (val+360)%360;
if(val < 181) {
if(val < 91) {
/* phase 0-90 degree */
return (long)sin_table[val];
} else {
/* phase 91-180 degree */