2006-01-23 16:00:06 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2006-03-03 07:24:34 +00:00
|
|
|
* Copyright (C) 2005, 2006 Ben Basha (Paprica)
|
2006-01-23 16:00:06 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-01-23 16:00:06 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "plugin.h"
|
2009-07-18 23:26:50 +00:00
|
|
|
#include "lib/configfile.h"
|
2009-07-14 13:03:17 +00:00
|
|
|
#include "lib/display_text.h"
|
2009-07-18 23:26:50 +00:00
|
|
|
#include "lib/helper.h"
|
|
|
|
#include "lib/highscore.h"
|
|
|
|
#include "lib/playback_control.h"
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
PLUGIN_HEADER
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2006-01-23 16:00:06 +00:00
|
|
|
#define QUIT BUTTON_OFF
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
2006-06-30 16:43:47 +00:00
|
|
|
#define RC_QUIT BUTTON_RC_STOP
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
#define QUIT BUTTON_OFF
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_MENU
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == RECORDER_PAD
|
|
|
|
#define QUIT BUTTON_OFF
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_PLAY
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2007-01-14 13:48:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
|
|
|
|
#define QUIT BUTTON_OFF
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2006-01-23 16:00:06 +00:00
|
|
|
#define QUIT BUTTON_MENU
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_SCROLL_BACK
|
|
|
|
#define DOWN BUTTON_SCROLL_FWD
|
2006-01-27 10:02:13 +00:00
|
|
|
#define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
|
|
|
|
#define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
|
|
|
|
|
2006-02-24 15:42:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
2007-05-19 23:38:09 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
2006-02-24 15:42:52 +00:00
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2007-12-30 14:56:51 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2006-02-22 10:34:36 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_PLAY
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
2009-07-18 23:26:50 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
2008-01-10 08:08:31 +00:00
|
|
|
#define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
|
2009-04-10 17:28:26 +00:00
|
|
|
#define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
|
|
|
|
|
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
2009-07-18 23:26:50 +00:00
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
2009-04-10 17:28:26 +00:00
|
|
|
|
|
|
|
#define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
|
2008-01-10 08:08:31 +00:00
|
|
|
#define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
|
2008-01-09 21:06:42 +00:00
|
|
|
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_C200_PAD || \
|
|
|
|
CONFIG_KEYPAD == SANSA_CLIP_PAD || \
|
|
|
|
CONFIG_KEYPAD == SANSA_M200_PAD
|
2007-12-30 14:56:51 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define ALTLEFT BUTTON_VOL_DOWN
|
|
|
|
#define ALTRIGHT BUTTON_VOL_UP
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
2006-08-03 20:17:25 +00:00
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_PLAY
|
|
|
|
#define UP BUTTON_SCROLL_UP
|
|
|
|
#define DOWN BUTTON_SCROLL_DOWN
|
|
|
|
|
2008-02-17 12:23:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
#define QUIT BUTTON_BACK
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
2006-02-22 10:34:36 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define QUIT BUTTON_RC_REC
|
|
|
|
#define LEFT BUTTON_RC_REW
|
|
|
|
#define RIGHT BUTTON_RC_FF
|
|
|
|
#define SELECT BUTTON_RC_PLAY
|
|
|
|
#define UP BUTTON_RC_VOL_UP
|
|
|
|
#define DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define RC_QUIT BUTTON_REC
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
|
|
|
#define QUIT BUTTON_BACK
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWOND2_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_VOL_DOWN
|
|
|
|
#define RIGHT BUTTON_VOL_UP
|
|
|
|
#define SELECT BUTTON_MENU
|
|
|
|
|
2009-04-21 04:24:16 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
|
2009-08-04 03:08:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
|
|
|
|
#define QUIT BUTTON_FFWD
|
|
|
|
#define SELECT BUTTON_PLAY
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
#else
|
2008-03-01 22:55:09 +00:00
|
|
|
#error No keymap defined!
|
2006-01-23 16:00:06 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef LEFT
|
|
|
|
#define LEFT BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef RIGHT
|
|
|
|
#define RIGHT BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef SELECT
|
|
|
|
#define SELECT BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#ifndef UP
|
|
|
|
#define UP BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef DOWN
|
|
|
|
#define DOWN BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2008-01-09 21:06:42 +00:00
|
|
|
#ifndef SCROLL_FWD /* targets without scroll wheel*/
|
2007-12-30 14:56:51 +00:00
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
#endif
|
|
|
|
|
2008-11-03 14:37:50 +00:00
|
|
|
#include "pluginbitmaps/brickmania_pads.h"
|
2009-07-26 19:51:44 +00:00
|
|
|
#include "pluginbitmaps/brickmania_short_pads.h"
|
|
|
|
#include "pluginbitmaps/brickmania_long_pads.h"
|
2008-11-03 14:37:50 +00:00
|
|
|
#include "pluginbitmaps/brickmania_bricks.h"
|
|
|
|
#include "pluginbitmaps/brickmania_powerups.h"
|
|
|
|
#include "pluginbitmaps/brickmania_ball.h"
|
|
|
|
#include "pluginbitmaps/brickmania_gameover.h"
|
2007-12-30 14:56:51 +00:00
|
|
|
|
|
|
|
#define PAD_WIDTH BMPWIDTH_brickmania_pads
|
|
|
|
#define PAD_HEIGHT (BMPHEIGHT_brickmania_pads/3)
|
2009-07-26 19:51:44 +00:00
|
|
|
#define SHORT_PAD_WIDTH BMPWIDTH_brickmania_short_pads
|
|
|
|
#define LONG_PAD_WIDTH BMPWIDTH_brickmania_long_pads
|
2007-12-30 14:56:51 +00:00
|
|
|
#define BRICK_HEIGHT (BMPHEIGHT_brickmania_bricks/7)
|
|
|
|
#define BRICK_WIDTH BMPWIDTH_brickmania_bricks
|
|
|
|
#define LEFTMARGIN ((LCD_WIDTH-10*BRICK_WIDTH)/2)
|
2009-07-26 19:51:44 +00:00
|
|
|
#define POWERUP_HEIGHT (BMPHEIGHT_brickmania_powerups/9)
|
2007-12-30 14:56:51 +00:00
|
|
|
#define POWERUP_WIDTH BMPWIDTH_brickmania_powerups
|
|
|
|
#define BALL BMPHEIGHT_brickmania_ball
|
|
|
|
#define HALFBALL ((BALL+1)/2)
|
|
|
|
#define GAMEOVER_WIDTH BMPWIDTH_brickmania_gameover
|
|
|
|
#define GAMEOVER_HEIGHT BMPHEIGHT_brickmania_gameover
|
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR /* currently no transparency for non-colour */
|
2008-11-03 14:37:50 +00:00
|
|
|
#include "pluginbitmaps/brickmania_break.h"
|
2008-03-22 10:24:28 +00:00
|
|
|
#endif
|
2007-12-30 14:56:51 +00:00
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
/* The time (in ms) for one iteration through the game loop - decrease this
|
|
|
|
to speed up the game - note that current_tick is (currently) only accurate
|
|
|
|
to 10ms.
|
|
|
|
*/
|
2009-07-18 01:42:27 +00:00
|
|
|
#define CYCLETIME 50
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2009-07-18 01:42:27 +00:00
|
|
|
#define TOPMARGIN (BRICK_HEIGHT * 2)
|
2007-02-14 22:59:36 +00:00
|
|
|
|
2009-07-18 01:42:27 +00:00
|
|
|
#if LCD_WIDTH<=LCD_HEIGHT
|
|
|
|
/* Maintain a 4/3 ratio (Width/Height) */
|
|
|
|
#define GAMESCREEN_HEIGHT (LCD_WIDTH * 3 / 4)
|
2006-03-24 13:59:54 +00:00
|
|
|
#else
|
2009-07-18 01:42:27 +00:00
|
|
|
#define GAMESCREEN_HEIGHT LCD_HEIGHT
|
2007-12-30 14:56:51 +00:00
|
|
|
#endif
|
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
#define STRINGPOS_FINISH (GAMESCREEN_HEIGHT - (GAMESCREEN_HEIGHT / 6))
|
|
|
|
#define STRINGPOS_CONGRATS (STRINGPOS_FINISH - 20)
|
|
|
|
#define STRINGPOS_NAVI (STRINGPOS_FINISH - 10)
|
|
|
|
#define STRINGPOS_FLIP (STRINGPOS_FINISH - 10)
|
2007-12-30 14:56:51 +00:00
|
|
|
|
|
|
|
/*calculate paddle y-position */
|
2009-07-18 01:42:27 +00:00
|
|
|
#define PAD_POS_Y (GAMESCREEN_HEIGHT - PAD_HEIGHT - 1)
|
2007-12-30 14:56:51 +00:00
|
|
|
|
2008-06-09 20:59:55 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
int levels_num = 29;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
static unsigned char levels[29][8][10] = {
|
|
|
|
{ /* level1 */
|
|
|
|
{0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
|
|
|
|
{0x2,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x2},
|
|
|
|
{0x0,0x2,0x1,0x0,0x0,0x0,0x0,0x1,0x2,0x0},
|
|
|
|
{0x0,0x0,0x2,0x1,0x0,0x0,0x1,0x2,0x0,0x0},
|
|
|
|
{0x0,0x0,0x0,0x2,0x1,0x1,0x2,0x0,0x0,0x0},
|
|
|
|
{0x7,0x0,0x0,0x7,0x2,0x2,0x7,0x0,0x0,0x7},
|
|
|
|
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
|
|
|
|
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
|
|
|
|
},
|
|
|
|
{ /* level2 */
|
|
|
|
{0x0,0x0,0x7,0x7,0x1,0x1,0x7,0x7,0x0,0x0},
|
|
|
|
{0x0,0x1,0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x0},
|
|
|
|
{0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
|
|
|
|
{0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1},
|
|
|
|
{0x1,0x1,0x2,0x1,0x0,0x0,0x1,0x2,0x1,0x1},
|
|
|
|
{0x1,0x2,0x0,0x2,0x2,0x2,0x2,0x0,0x2,0x1},
|
|
|
|
{0x0,0x1,0x2,0x0,0x0,0x0,0x0,0x2,0x1,0x0},
|
|
|
|
{0x0,0x0,0x1,0x2,0x2,0x2,0x2,0x1,0x0,0x0}
|
|
|
|
},
|
|
|
|
{ /* level3 */
|
|
|
|
{0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x3,0x23,0x23,0x3,0x0,0x0,0x2,0x22,0x22,0x2},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x3,0x3,0x3,0x3,0x0,0x0,0x2,0x2,0x2,0x2},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
|
|
|
|
{0x0,0x0,0x0,0x0,0x37,0x37,0x0,0x0,0x0,0x0},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x5,0x25,0x25,0x5,0x0,0x0,0x6,0x26,0x26,0x6},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x5,0x5,0x5,0x5,0x0,0x0,0x6,0x6,0x6,0x6}
|
|
|
|
},
|
|
|
|
{ /* level4 */
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x0,0x0,0x0,0x27,0x27,0x27,0x27,0x0,0x0,0x0},
|
|
|
|
{0x0,0x0,0x0,0x27,0x7,0x7,0x27,0x0,0x0,0x0},
|
|
|
|
{0x22,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x22},
|
|
|
|
{0x22,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x22},
|
|
|
|
{0x26,0x6,0x0,0x2,0x2,0x2,0x2,0x0,0x6,0x26},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
|
|
|
|
{0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0},
|
|
|
|
{0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x1,0x1,0x1}
|
|
|
|
},
|
|
|
|
{ /* level5 */
|
|
|
|
{0x1,0x0,0x2,0x2,0x0,0x3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0,0x6,0x0,0x6,0x0,0x6,0x0,0x2},
|
|
|
|
{0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x2},
|
|
|
|
{0x2,0x0,0x6,0x0,0x6,0x0,0x0,0x0,0x0,0x2},
|
|
|
|
{0x2,0x0,0x6,0x0,0x6,0x0,0x6,0x0,0x6,0x2},
|
|
|
|
{0x2,0x2,0x6,0x0,0x6,0x0,0x6,0x0,0x2,0x2},
|
|
|
|
{0x0,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0}
|
|
|
|
},
|
|
|
|
{ /* level 22 (Spider) by ts-x */
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x31,0x3,0x1,0x1,0x0,0x0,0x1,0x1,0x3,0x31},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x33,0x1,0x1,0x36,0x1,0x1,0x36,0x1,0x1,0x33},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0},
|
|
|
|
{0x0,0x0,0x1,0x1,0x0,0x0,0x1,0x1,0x0,0x0},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x21,0x3,0x1,0x21,0x2,0x2,0x21,0x1,0x3,0x21},
|
|
|
|
{0x0,0x0,0x0,0x1,0x21,0x1,0x1,0x0,0x0,0x0},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x3,0x1,0x3,0x1,0x0,0x0,0x1,0x3,0x1,0x3}
|
|
|
|
},
|
|
|
|
{ /* level 23 (Pool) by ts-x */
|
|
|
|
{0x0,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x7,0x0},
|
|
|
|
{0x0,0x0,0x5,0x0,0x2,0x0,0x0,0x0,0x2,0x0},
|
|
|
|
{0x7,0x3,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x7},
|
|
|
|
{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+00:00
|
|
|
{0x6,0x7,0x2,0x27,0x6,0x6,0x27,0x2,0x7,0x6},
|
|
|
|
{0x7,0x2,0x0,0x2,0x27,0x27,0x2,0x0,0x2,0x7},
|
|
|
|
{0x32,0x0,0x0,0x0,0x2,0x2,0x0,0x0,0x0,0x32}
|
2006-01-23 16:00:06 +00:00
|
|
|
},
|
|
|
|
{ /* level 26 (Bowtie) by ts-x */
|
|
|
|
{0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5},
|
|
|
|
{0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1},
|
|
|
|
{0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5},
|
|
|
|
{0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1},
|
|
|
|
{0x1,0x0,0x6,0x6,0x0,0x0,0x6,0x6,0x0,0x1},
|
|
|
|
{0x5,0x0,0x6,0x0,0x1,0x1,0x0,0x6,0x0,0x5},
|
|
|
|
{0x1,0x0,0x0,0x1,0x5,0x5,0x1,0x0,0x0,0x1},
|
|
|
|
{0x5,0x1,0x5,0x1,0x0,0x0,0x1,0x5,0x1,0x5}
|
|
|
|
},
|
|
|
|
{ /* level 27 (Frog) by ts-x */
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x0,0x5,0x25,0x0,0x0,0x0,0x0,0x25,0x5,0x0},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x25,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x25},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x5,0x0,0x3,0x0,0x6,0x6,0x0,0x3,0x0,0x5},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x5,0x0,0x31,0x0,0x6,0x6,0x0,0x31,0x0,0x5},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x5,0x0,0x0,0x5,0x6,0x6,0x5,0x0,0x0,0x5},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x5,0x5,0x5,0x35,0x0,0x0,0x35,0x5,0x5,0x5},
|
|
|
|
{0x0,0x25,0x5,0x0,0x4,0x4,0x0,0x5,0x25,0x0}
|
2006-01-23 16:00:06 +00:00
|
|
|
},
|
|
|
|
{ /* level 28 (DigDug) by ts-x */
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x35,0x5,0x5,0x25,0x0,0x25,0x25,0x5,0x5,0x35},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x6,0x0,0x0,0x6,0x0,0x6,0x6,0x0,0x0,0x6},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x7,0x0,0x37,0x37,0x0,0x37,0x37,0x7,0x0,0x7},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x7,0x0,0x7,0x0,0x0,0x0,0x7,0x7,0x7,0x7},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x4,0x4,0x4,0x24,0x0,0x24,0x4,0x0,0x0,0x4},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x4,0x4,0x0,0x0,0x0,0x4,0x4,0x0,0x4,0x4},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x24,0x24,0x4,0x4,0x4,0x4,0x0,0x0,0x24,0x4},
|
|
|
|
{0x1,0x1,0x1,0x1,0x1,0x1,0x21,0x21,0x1,0x1}
|
2006-01-23 16:00:06 +00:00
|
|
|
},
|
|
|
|
{ /* TheEnd */
|
|
|
|
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
|
2006-01-26 23:31:00 +00:00
|
|
|
{0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
|
|
|
|
{0x22,0x0,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
|
|
|
|
{0x22,0x22,0x26,0x26,0x0,0x26,0x24,0x0,0x24,0x0},
|
|
|
|
{0x22,0x22,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
|
|
|
|
{0x22,0x0,0x26,0x0,0x26,0x26,0x24,0x0,0x24,0x0},
|
|
|
|
{0x22,0x22,0x26,0x0,0x0,0x26,0x24,0x24,0x0,0x0},
|
2006-01-23 16:00:06 +00:00
|
|
|
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-02-17 16:02:37 +00:00
|
|
|
#define MAX_BALLS 10
|
2009-07-18 23:26:50 +00:00
|
|
|
|
|
|
|
enum difficulty_options {
|
2009-08-02 13:45:39 +00:00
|
|
|
EASY, NORMAL
|
2009-07-18 23:26:50 +00:00
|
|
|
};
|
|
|
|
|
2006-02-17 16:02:37 +00:00
|
|
|
int pad_pos_x;
|
2006-01-23 16:00:06 +00:00
|
|
|
int life;
|
2009-08-02 13:45:39 +00:00
|
|
|
enum { ST_READY, ST_START, ST_PAUSE } game_state = ST_READY;
|
2009-08-28 23:55:44 +00:00
|
|
|
|
|
|
|
enum {
|
2009-08-29 00:02:02 +00:00
|
|
|
PLAIN = 0,
|
|
|
|
STICKY = 1,
|
|
|
|
SHOOTER = 2
|
2009-08-28 23:55:44 +00:00
|
|
|
} pad_type;
|
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
int score=0,vscore=0;
|
2006-01-26 23:31:00 +00:00
|
|
|
bool flip_sides=false;
|
2009-07-18 23:26:50 +00:00
|
|
|
int level=0;
|
2006-01-23 16:00:06 +00:00
|
|
|
int brick_on_board=0;
|
2006-02-15 17:37:45 +00:00
|
|
|
int used_balls=1;
|
2009-08-02 13:45:39 +00:00
|
|
|
int difficulty = NORMAL;
|
2009-07-26 19:51:44 +00:00
|
|
|
int pad_width;
|
2009-08-02 13:45:39 +00:00
|
|
|
int num_count;
|
|
|
|
bool resume = false;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
typedef struct cube {
|
|
|
|
int powertop;
|
|
|
|
int power;
|
|
|
|
char poweruse;
|
|
|
|
char used;
|
|
|
|
int color;
|
2006-01-26 23:31:00 +00:00
|
|
|
int hits;
|
2006-02-01 18:25:24 +00:00
|
|
|
int hiteffect;
|
2006-01-23 16:00:06 +00:00
|
|
|
} cube;
|
|
|
|
cube brick[80];
|
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
typedef struct balls {
|
2009-08-28 23:55:44 +00:00
|
|
|
/* pos_x and y store the current position of the ball */
|
2006-02-15 17:37:45 +00:00
|
|
|
int pos_x;
|
|
|
|
int pos_y;
|
2009-08-28 23:55:44 +00:00
|
|
|
/* x and y store the current speed of the ball */
|
2006-02-15 17:37:45 +00:00
|
|
|
int y;
|
|
|
|
int tempy;
|
|
|
|
int x;
|
|
|
|
int tempx;
|
|
|
|
bool glue;
|
|
|
|
} balls;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
balls ball[MAX_BALLS];
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
typedef struct sfire {
|
|
|
|
int top;
|
|
|
|
int left;
|
|
|
|
} sfire;
|
|
|
|
sfire fire[30];
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
#define CONFIG_FILE_NAME "brickmania.cfg"
|
2009-08-02 13:45:39 +00:00
|
|
|
#define SAVE_FILE PLUGIN_GAMES_DIR "/brickmania.save"
|
|
|
|
#define HIGH_SCORE PLUGIN_GAMES_DIR "/brickmania.score"
|
|
|
|
#define NUM_SCORES 5
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
static struct configdata config[] = {
|
2009-08-02 13:45:39 +00:00
|
|
|
{TYPE_INT, 0, 1, { .int_p = &difficulty }, "difficulty", NULL},
|
2006-01-23 16:00:06 +00:00
|
|
|
};
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
struct highscore highest[NUM_SCORES];
|
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
static void brickmania_init_game(int new_game)
|
2006-01-23 16:00:06 +00:00
|
|
|
{
|
|
|
|
int i,j;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
pad_pos_x=LCD_WIDTH/2-PAD_WIDTH/2;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
for(i=0;i<MAX_BALLS;i++) {
|
|
|
|
ball[i].x=0;
|
|
|
|
ball[i].y=0;
|
|
|
|
ball[i].tempy=0;
|
2006-03-03 07:24:34 +00:00
|
|
|
ball[i].tempx=0;
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[i].pos_y=PAD_POS_Y-BALL;
|
2009-07-26 19:51:44 +00:00
|
|
|
ball[i].pos_x=LCD_WIDTH/2-2;
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[i].glue=false;
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
used_balls=1;
|
2009-08-02 13:45:39 +00:00
|
|
|
game_state=ST_READY;
|
2009-08-29 00:02:02 +00:00
|
|
|
pad_type = PLAIN;
|
2009-07-26 19:51:44 +00:00
|
|
|
pad_width=PAD_WIDTH;
|
2006-01-26 23:31:00 +00:00
|
|
|
flip_sides=false;
|
2009-08-02 13:45:39 +00:00
|
|
|
num_count=10;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
if (new_game==1) {
|
2006-03-03 07:24:34 +00:00
|
|
|
brick_on_board=0;
|
2009-07-18 23:26:50 +00:00
|
|
|
/* add one life per achieved level */
|
|
|
|
if (difficulty==EASY && life<2) {
|
|
|
|
score-=100;
|
|
|
|
life++;
|
|
|
|
}
|
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
for(i=0;i<30;i++) {
|
|
|
|
fire[i].top=-8;
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
for(i=0;i<=7;i++) {
|
|
|
|
for(j=0;j<=9;j++) {
|
2009-07-18 23:26:50 +00:00
|
|
|
brick[i*10+j].poweruse=(levels[level][i][j]==0?0:1);
|
2006-03-03 07:24:34 +00:00
|
|
|
if (new_game==1) {
|
|
|
|
brick[i*10+j].power=rb->rand()%25;
|
|
|
|
/* +8 make the game with less powerups */
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
brick[i*10+j].hits=levels[level][i][j]>=10?
|
|
|
|
levels[level][i][j]/16-1:0;
|
2006-02-01 18:25:24 +00:00
|
|
|
brick[i*10+j].hiteffect=0;
|
2006-02-19 21:24:46 +00:00
|
|
|
brick[i*10+j].powertop=TOPMARGIN+i*BRICK_HEIGHT+BRICK_HEIGHT;
|
2009-07-18 23:26:50 +00:00
|
|
|
brick[i*10+j].used=(levels[level][i][j]==0?0:1);
|
|
|
|
brick[i*10+j].color=(levels[level][i][j]>=10?
|
|
|
|
levels[level][i][j]%16:
|
|
|
|
levels[level][i][j])-1;
|
|
|
|
if (levels[level][i][j]!=0)
|
2006-03-03 07:24:34 +00:00
|
|
|
brick_on_board++;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
static void brickmania_loadgame(void)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
resume = false;
|
|
|
|
|
|
|
|
/* open game file */
|
|
|
|
fd = rb->open(SAVE_FILE, O_RDONLY);
|
|
|
|
if(fd < 0) return;
|
|
|
|
|
|
|
|
/* read in saved game */
|
|
|
|
while(true) {
|
|
|
|
if(rb->read(fd, &pad_pos_x, sizeof(pad_pos_x)) <= 0) break;
|
|
|
|
if(rb->read(fd, &life, sizeof(life)) <= 0) break;
|
|
|
|
if(rb->read(fd, &game_state, sizeof(game_state)) <= 0) break;
|
|
|
|
if(rb->read(fd, &pad_type, sizeof(pad_type)) <= 0) break;
|
|
|
|
if(rb->read(fd, &score, sizeof(score)) <= 0) break;
|
|
|
|
if(rb->read(fd, &flip_sides, sizeof(flip_sides)) <= 0) break;
|
|
|
|
if(rb->read(fd, &level, sizeof(level)) <= 0) break;
|
|
|
|
if(rb->read(fd, &brick_on_board, sizeof(brick_on_board)) <= 0) break;
|
|
|
|
if(rb->read(fd, &used_balls, sizeof(used_balls)) <= 0) break;
|
|
|
|
if(rb->read(fd, &pad_width, sizeof(pad_width)) <= 0) break;
|
|
|
|
if(rb->read(fd, &num_count, sizeof(num_count)) <= 0) break;
|
|
|
|
if(rb->read(fd, &brick, sizeof(brick)) <= 0) break;
|
|
|
|
if(rb->read(fd, &ball, sizeof(ball)) <= 0) break;
|
|
|
|
if(rb->read(fd, &fire, sizeof(fire)) <= 0) break;
|
|
|
|
vscore = score;
|
|
|
|
resume = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rb->close(fd);
|
|
|
|
|
|
|
|
/* delete saved file */
|
|
|
|
rb->remove(SAVE_FILE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void brickmania_savegame(void)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
/* write out the game state to the save file */
|
|
|
|
fd = rb->open(SAVE_FILE, O_WRONLY|O_CREAT);
|
|
|
|
rb->write(fd, &pad_pos_x, sizeof(pad_pos_x));
|
|
|
|
rb->write(fd, &life, sizeof(life));
|
|
|
|
rb->write(fd, &game_state, sizeof(game_state));
|
|
|
|
rb->write(fd, &pad_type, sizeof(pad_type));
|
|
|
|
rb->write(fd, &score, sizeof(score));
|
|
|
|
rb->write(fd, &flip_sides, sizeof(flip_sides));
|
|
|
|
rb->write(fd, &level, sizeof(level));
|
|
|
|
rb->write(fd, &brick_on_board, sizeof(brick_on_board));
|
|
|
|
rb->write(fd, &used_balls, sizeof(used_balls));
|
|
|
|
rb->write(fd, &pad_width, sizeof(pad_width));
|
|
|
|
rb->write(fd, &num_count, sizeof(num_count));
|
|
|
|
rb->write(fd, &brick, sizeof(brick));
|
|
|
|
rb->write(fd, &ball, sizeof(ball));
|
|
|
|
rb->write(fd, &fire, sizeof(fire));
|
|
|
|
rb->close(fd);
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
/* brickmania_sleep timer counting the score */
|
|
|
|
static void brickmania_sleep(int secs)
|
2006-03-03 07:24:34 +00:00
|
|
|
{
|
|
|
|
bool done=false;
|
|
|
|
char s[20];
|
|
|
|
int count=0;
|
2009-08-02 13:45:39 +00:00
|
|
|
int sw, w;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
|
|
|
while (!done) {
|
2009-07-18 23:26:50 +00:00
|
|
|
if (vscore == score) {
|
|
|
|
if (count==0)
|
|
|
|
count=*rb->current_tick+HZ*secs;
|
|
|
|
if (*rb->current_tick>=count)
|
|
|
|
done=true;
|
|
|
|
} else {
|
|
|
|
if (vscore<score)
|
|
|
|
vscore++;
|
|
|
|
if (vscore>score)
|
|
|
|
vscore--;
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "%d", vscore);
|
|
|
|
rb->lcd_getstringsize(s, &sw, &w);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 0, s);
|
|
|
|
rb->lcd_update_rect(0,0,LCD_WIDTH,w+2);
|
2008-06-09 20:59:55 +00:00
|
|
|
}
|
2008-12-13 07:36:44 +00:00
|
|
|
rb->yield();
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
static int brickmania_help(void)
|
2006-01-23 16:00:06 +00:00
|
|
|
{
|
2009-07-14 13:03:17 +00:00
|
|
|
#define WORDS (sizeof help_text / sizeof (char*))
|
2009-07-18 23:26:50 +00:00
|
|
|
static char *help_text[] = {
|
|
|
|
"Brickmania", "", "Aim", "",
|
2009-07-14 13:03:17 +00:00
|
|
|
"Destroy", "all", "the", "bricks", "by", "bouncing",
|
|
|
|
"the", "ball", "of", "them", "using", "the", "paddle.", "", "",
|
|
|
|
"Controls", "",
|
2009-07-18 23:26:50 +00:00
|
|
|
"< & >", "Moves", "the", "paddle", "",
|
2006-02-22 10:34:36 +00:00
|
|
|
#if CONFIG_KEYPAD == ONDIO_PAD
|
2009-07-18 23:26:50 +00:00
|
|
|
"MENU:",
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IAUDIO_M3_PAD)
|
2009-07-18 23:26:50 +00:00
|
|
|
"PLAY:",
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H300_PAD
|
2009-07-18 23:26:50 +00:00
|
|
|
"NAVI:",
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
2009-07-18 23:26:50 +00:00
|
|
|
"SELECT:",
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2009-07-18 23:26:50 +00:00
|
|
|
"Releases", "the", "ball/Fire!", "",
|
2008-03-22 10:24:28 +00:00
|
|
|
#if CONFIG_KEYPAD == IAUDIO_M3_PAD
|
2009-08-02 13:45:39 +00:00
|
|
|
"REC:",
|
2009-07-14 13:03:17 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == CREATIVEZVM_PAD)
|
2009-07-18 23:26:50 +00:00
|
|
|
"BACK:",
|
2009-07-14 13:03:17 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
2009-07-18 23:26:50 +00:00
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
"MENU:",
|
2009-07-14 13:03:17 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == ONDIO_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == RECORDER_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == ARCHOS_AV300_PAD)
|
2009-07-18 23:26:50 +00:00
|
|
|
"STOP:",
|
2008-03-22 10:24:28 +00:00
|
|
|
#else
|
2009-07-18 23:26:50 +00:00
|
|
|
"POWER:",
|
2008-03-22 10:24:28 +00:00
|
|
|
#endif
|
2009-07-18 23:26:50 +00:00
|
|
|
"Returns", "to", "menu", "", "",
|
2009-07-14 13:03:17 +00:00
|
|
|
"Specials", "",
|
|
|
|
"N", "Normal:", "returns", "paddle", "to", "normal", "",
|
|
|
|
"D", "DIE!:", "loses", "a", "life", "",
|
2009-07-18 23:26:50 +00:00
|
|
|
"L", "Life:", "gains", "a", "life/power", "up", "",
|
2009-07-14 13:03:17 +00:00
|
|
|
"F", "Fire:", "allows", "you", "to", "shoot", "bricks", "",
|
|
|
|
"G", "Glue:", "ball", "sticks", "to", "paddle", "",
|
|
|
|
"B", "Ball:", "generates", "another", "ball", "",
|
2009-07-18 23:26:50 +00:00
|
|
|
"FL", "Flip:", "flips", "left / right", "movement", "",
|
2009-07-26 20:46:40 +00:00
|
|
|
"<->", "or", "<E>:", "enlarges", "the", "paddle", "",
|
2009-08-02 13:45:39 +00:00
|
|
|
">-<", "or", ">S<:", "shrinks", "the", "paddle", "",
|
2009-07-14 13:03:17 +00:00
|
|
|
};
|
|
|
|
static struct style_text formation[]={
|
|
|
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
|
|
|
{ 2, C_RED },
|
|
|
|
{ 19, C_RED },
|
2009-07-18 23:26:50 +00:00
|
|
|
{ 37, C_RED },
|
|
|
|
{ 39, C_BLUE },
|
|
|
|
{ 46, C_RED },
|
|
|
|
{ 52, C_GREEN },
|
|
|
|
{ 59, C_ORANGE },
|
|
|
|
{ 67, C_GREEN },
|
|
|
|
{ 74, C_YELLOW },
|
|
|
|
{ 80, C_RED },
|
2009-07-23 17:45:33 +00:00
|
|
|
{ -1, 0 }
|
2009-07-14 13:03:17 +00:00
|
|
|
};
|
2009-08-02 13:45:39 +00:00
|
|
|
int button;
|
|
|
|
|
|
|
|
rb->lcd_setfont(FONT_UI);
|
2009-07-23 17:45:33 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
|
|
|
#endif
|
2009-08-02 13:45:39 +00:00
|
|
|
|
|
|
|
if (display_text(WORDS, help_text, formation, NULL))
|
|
|
|
return 1;
|
2009-07-14 13:03:17 +00:00
|
|
|
do {
|
|
|
|
button = rb->button_get(true);
|
2009-08-02 13:45:39 +00:00
|
|
|
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
|
|
return 1;
|
2009-07-18 23:26:50 +00:00
|
|
|
}
|
2009-07-14 13:03:17 +00:00
|
|
|
} while( ( button == BUTTON_NONE )
|
2009-08-02 13:45:39 +00:00
|
|
|
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
2009-07-14 13:03:17 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2006-02-24 15:13:04 +00:00
|
|
|
return 0;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
static int brickmania_menu_cb(int action, const struct menu_item_ex *this_item)
|
|
|
|
{
|
2009-08-02 13:45:39 +00:00
|
|
|
int i = ((intptr_t)this_item);
|
2009-07-18 23:26:50 +00:00
|
|
|
if(action == ACTION_REQUEST_MENUITEM
|
2009-08-02 13:45:39 +00:00
|
|
|
&& !resume && (i==0 || i==6))
|
2009-07-18 23:26:50 +00:00
|
|
|
return ACTION_EXIT_MENUITEM;
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
static int brickmania_menu(void)
|
2009-07-18 23:26:50 +00:00
|
|
|
{
|
2009-08-02 13:45:39 +00:00
|
|
|
int selected = 0;
|
2009-07-18 23:26:50 +00:00
|
|
|
|
|
|
|
static struct opt_items options[] = {
|
|
|
|
{ "Easy", -1 },
|
2009-08-02 13:45:39 +00:00
|
|
|
{ "Normal", -1 },
|
2009-07-18 23:26:50 +00:00
|
|
|
};
|
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
MENUITEM_STRINGLIST(main_menu, "Brickmania Menu", brickmania_menu_cb,
|
|
|
|
"Resume Game", "Start New Game",
|
|
|
|
"Difficulty", "Help", "High Scores",
|
|
|
|
"Playback Control",
|
|
|
|
"Quit without Saving", "Quit");
|
|
|
|
|
|
|
|
rb->button_clear_queue();
|
2009-07-18 23:26:50 +00:00
|
|
|
while (true) {
|
2009-08-02 13:45:39 +00:00
|
|
|
switch (rb->do_menu(&main_menu, &selected, NULL, false)) {
|
2009-07-18 23:26:50 +00:00
|
|
|
case 0:
|
2009-08-02 13:45:39 +00:00
|
|
|
if(game_state!=ST_READY)
|
|
|
|
game_state = ST_PAUSE;
|
2009-07-18 23:26:50 +00:00
|
|
|
return 0;
|
|
|
|
case 1:
|
|
|
|
score=0;
|
|
|
|
vscore=0;
|
|
|
|
life=2;
|
|
|
|
level=0;
|
2009-08-02 13:45:39 +00:00
|
|
|
brickmania_init_game(1);
|
2009-07-18 23:26:50 +00:00
|
|
|
return 0;
|
|
|
|
case 2:
|
|
|
|
rb->set_option("Difficulty", &difficulty, INT, options, 2, NULL);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (brickmania_help())
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
case 4:
|
2009-08-03 01:07:58 +00:00
|
|
|
highscore_show(NUM_SCORES, highest, NUM_SCORES, true);
|
2009-07-18 23:26:50 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2009-08-02 13:45:39 +00:00
|
|
|
if (playback_control(NULL))
|
|
|
|
return 1;
|
2009-07-18 23:26:50 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2009-08-02 13:45:39 +00:00
|
|
|
return 1;
|
|
|
|
case 7:
|
|
|
|
if (resume) {
|
|
|
|
rb->splash(HZ*1, "Saving game ...");
|
|
|
|
brickmania_savegame();
|
2009-07-18 23:26:50 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
case MENU_ATTACHED_USB:
|
|
|
|
return 1;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int brickmania_fire_space(void)
|
2006-01-23 16:00:06 +00:00
|
|
|
{
|
|
|
|
int t;
|
2009-08-02 13:45:39 +00:00
|
|
|
for(t=0;t<30;t++)
|
2006-01-23 16:00:06 +00:00
|
|
|
if (fire[t].top+7 < 0)
|
|
|
|
return t;
|
|
|
|
|
2006-02-24 15:13:04 +00:00
|
|
|
return 0;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
static int brickmania_game_loop(void)
|
2006-03-03 07:24:34 +00:00
|
|
|
{
|
2006-01-23 16:00:06 +00:00
|
|
|
int j,i,k,bricky,brickx;
|
2009-08-02 13:45:39 +00:00
|
|
|
int sw;
|
2006-02-22 10:34:36 +00:00
|
|
|
char s[30];
|
2009-08-02 13:45:39 +00:00
|
|
|
int sec_count=0;
|
2006-01-27 10:02:13 +00:00
|
|
|
int end;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
if (brickmania_menu()!=0) {
|
|
|
|
return 1;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
resume = false;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-01-27 10:02:13 +00:00
|
|
|
while(true) {
|
|
|
|
/* Convert CYCLETIME (in ms) to HZ */
|
|
|
|
end = *rb->current_tick + (CYCLETIME * HZ) / 1000;
|
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
if (life >= 0) {
|
2006-02-19 21:24:46 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
rb->lcd_clear_display();
|
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
2007-04-19 12:14:54 +00:00
|
|
|
#if LCD_HEIGHT > GAMESCREEN_HEIGHT
|
|
|
|
rb->lcd_set_foreground(rb->global_settings->bg_color);
|
|
|
|
rb->lcd_fillrect(0, GAMESCREEN_HEIGHT, LCD_WIDTH,
|
|
|
|
LCD_HEIGHT - GAMESCREEN_HEIGHT);
|
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
2006-02-19 21:24:46 +00:00
|
|
|
#else
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_clear_display();
|
2006-02-19 21:24:46 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-01-26 23:31:00 +00:00
|
|
|
if (flip_sides) {
|
2006-03-03 07:24:34 +00:00
|
|
|
if (*rb->current_tick>=sec_count) {
|
|
|
|
sec_count=*rb->current_tick+HZ;
|
|
|
|
if (num_count!=0)
|
|
|
|
num_count--;
|
|
|
|
else
|
|
|
|
flip_sides=false;
|
|
|
|
}
|
|
|
|
rb->snprintf(s, sizeof(s), "%d", num_count);
|
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
2007-12-30 14:56:51 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-2, STRINGPOS_FLIP, s);
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 23:31:00 +00:00
|
|
|
/* write life num */
|
2006-02-22 10:34:36 +00:00
|
|
|
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
|
|
|
rb->snprintf(s, sizeof(s), "L:%d", life);
|
|
|
|
#else
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "Life: %d", life);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2009-08-02 17:24:16 +00:00
|
|
|
rb->lcd_putsxy(0, 0, s);
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
2009-07-18 23:26:50 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "L%d", level+1);
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
2009-07-18 23:26:50 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "Level %d", level+1);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2009-08-02 17:24:16 +00:00
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH-sw, 0, s);
|
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
if (vscore<score) vscore++;
|
|
|
|
rb->snprintf(s, sizeof(s), "%d", vscore);
|
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
2006-02-22 10:34:36 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 0, s);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* continue game */
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state==ST_PAUSE) {
|
2006-02-22 10:34:36 +00:00
|
|
|
#if CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
rb->snprintf(s, sizeof(s), "MENU To Continue");
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H300_PAD
|
|
|
|
rb->snprintf(s, sizeof(s), "Press NAVI To Continue");
|
2008-03-22 10:24:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
rb->snprintf(s, sizeof(s), "PLAY To Continue");
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
|
|
|
rb->snprintf(s, sizeof(s), "Press SELECT To Continue");
|
|
|
|
#endif
|
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
2007-12-30 14:56:51 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_NAVI, s);
|
2006-02-22 10:34:36 +00:00
|
|
|
|
2006-01-26 23:31:00 +00:00
|
|
|
sec_count=*rb->current_tick+HZ;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw the ball */
|
2006-02-15 17:37:45 +00:00
|
|
|
for(i=0;i<used_balls;i++)
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_bitmap(brickmania_ball,ball[i].pos_x, ball[i].pos_y,
|
|
|
|
BALL, BALL);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if (brick_on_board==0)
|
|
|
|
brick_on_board--;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* if the pad is fire */
|
2009-08-02 13:45:39 +00:00
|
|
|
for(i=0;i<30;i++) {
|
2006-01-23 16:00:06 +00:00
|
|
|
if (fire[i].top+7>0) {
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state!=ST_PAUSE)
|
2006-01-23 16:00:06 +00:00
|
|
|
fire[i].top-=4;
|
|
|
|
rb->lcd_vline(fire[i].left, fire[i].top, fire[i].top+7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the bricks */
|
|
|
|
for (i=0;i<=7;i++) {
|
|
|
|
for (j=0;j<=9;j++) {
|
2009-07-26 19:51:44 +00:00
|
|
|
if (brick[i*10+j].power<9) {
|
2006-01-23 16:00:06 +00:00
|
|
|
if (brick[i*10+j].poweruse==2) {
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state!=ST_PAUSE)
|
2006-01-23 16:00:06 +00:00
|
|
|
brick[i*10+j].powertop+=2;
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_powerups,0,
|
2007-12-30 14:56:51 +00:00
|
|
|
POWERUP_HEIGHT*brick[i*10+j
|
2006-03-03 07:24:34 +00:00
|
|
|
].power,
|
2007-12-30 14:56:51 +00:00
|
|
|
POWERUP_WIDTH,
|
2006-03-03 07:24:34 +00:00
|
|
|
LEFTMARGIN+j*BRICK_WIDTH+
|
2009-08-02 13:45:39 +00:00
|
|
|
(BRICK_WIDTH/2-POWERUP_WIDTH/2),
|
2006-03-03 07:24:34 +00:00
|
|
|
brick[i*10+j].powertop,
|
2007-12-30 14:56:51 +00:00
|
|
|
POWERUP_WIDTH,
|
|
|
|
POWERUP_HEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((pad_pos_x<LEFTMARGIN+j*BRICK_WIDTH+5 &&
|
2009-07-26 19:51:44 +00:00
|
|
|
pad_pos_x+pad_width>LEFTMARGIN+j*BRICK_WIDTH+5) &&
|
2006-03-03 07:24:34 +00:00
|
|
|
brick[i*10+j].powertop+6>=PAD_POS_Y &&
|
|
|
|
brick[i*10+j].poweruse==2) {
|
2006-01-23 16:00:06 +00:00
|
|
|
switch(brick[i*10+j].power) {
|
|
|
|
case 0:
|
|
|
|
life++;
|
|
|
|
score+=50;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
life--;
|
|
|
|
if (life>=0) {
|
2009-08-02 13:45:39 +00:00
|
|
|
brickmania_init_game(0);
|
2009-07-18 23:26:50 +00:00
|
|
|
brickmania_sleep(2);
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
score+=34;
|
2009-08-29 00:02:02 +00:00
|
|
|
pad_type = STICKY;
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
score+=47;
|
2009-08-29 00:02:02 +00:00
|
|
|
pad_type = SHOOTER;
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++)
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].glue=false;
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
score+=23;
|
2009-08-29 00:02:02 +00:00
|
|
|
pad_type = PLAIN;
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++)
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].glue=false;
|
2006-01-26 23:31:00 +00:00
|
|
|
flip_sides=false;
|
2009-07-26 19:51:44 +00:00
|
|
|
pad_pos_x+=(pad_width-PAD_WIDTH)/2;
|
|
|
|
pad_width=PAD_WIDTH;
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
2006-01-26 23:31:00 +00:00
|
|
|
case 5:
|
2006-03-03 07:24:34 +00:00
|
|
|
score+=23;
|
2006-01-26 23:31:00 +00:00
|
|
|
sec_count=*rb->current_tick+HZ;
|
|
|
|
num_count=10;
|
|
|
|
flip_sides=!flip_sides;
|
2006-03-03 07:24:34 +00:00
|
|
|
break;
|
2006-02-15 17:37:45 +00:00
|
|
|
case 6:
|
|
|
|
score+=23;
|
2009-08-02 13:45:39 +00:00
|
|
|
if(used_balls<MAX_BALLS) {
|
|
|
|
ball[used_balls].x= rb->rand()%2 == 0 ?
|
|
|
|
-1 : 1;
|
|
|
|
ball[used_balls].y= -4;
|
|
|
|
ball[used_balls].glue= false;
|
|
|
|
used_balls++;
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
break;
|
2009-07-26 19:51:44 +00:00
|
|
|
case 7:
|
|
|
|
score+=23;
|
|
|
|
if (pad_width==PAD_WIDTH) {
|
|
|
|
pad_width=LONG_PAD_WIDTH;
|
|
|
|
pad_pos_x-=(LONG_PAD_WIDTH-PAD_WIDTH)/2;
|
|
|
|
}
|
|
|
|
else if (pad_width==SHORT_PAD_WIDTH) {
|
|
|
|
pad_width=PAD_WIDTH;
|
|
|
|
pad_pos_x-=(PAD_WIDTH-SHORT_PAD_WIDTH)/2;
|
|
|
|
}
|
|
|
|
if (pad_pos_x < 0)
|
|
|
|
pad_pos_x = 0;
|
|
|
|
else if(pad_pos_x+pad_width > LCD_WIDTH)
|
|
|
|
pad_pos_x = LCD_WIDTH-pad_width;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
if (pad_width==PAD_WIDTH) {
|
|
|
|
pad_width=SHORT_PAD_WIDTH;
|
|
|
|
pad_pos_x+=(PAD_WIDTH-SHORT_PAD_WIDTH)/2;
|
|
|
|
}
|
|
|
|
else if (pad_width==LONG_PAD_WIDTH) {
|
|
|
|
pad_width=PAD_WIDTH;
|
|
|
|
pad_pos_x+=(LONG_PAD_WIDTH-PAD_WIDTH)/2;
|
|
|
|
}
|
|
|
|
break;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
brick[i*10+j].poweruse=1;
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if (brick[i*10+j].powertop>PAD_POS_Y)
|
|
|
|
brick[i*10+j].poweruse=1;
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
brickx=LEFTMARGIN+j*BRICK_WIDTH;
|
|
|
|
bricky=TOPMARGIN+i*BRICK_HEIGHT;
|
2009-08-29 00:02:02 +00:00
|
|
|
if (pad_type == SHOOTER) {
|
2009-08-02 13:45:39 +00:00
|
|
|
for (k=0;k<30;k++) {
|
2006-03-03 07:24:34 +00:00
|
|
|
if (fire[k].top+7>0) {
|
|
|
|
if (brick[i*10+j].used==1 &&
|
|
|
|
(fire[k].left+1 >= brickx &&
|
|
|
|
fire[k].left+1 <= brickx+BRICK_WIDTH) &&
|
|
|
|
(bricky+BRICK_HEIGHT>fire[k].top)) {
|
|
|
|
score+=13;
|
|
|
|
fire[k].top=-16;
|
|
|
|
if (brick[i*10+j].hits > 0) {
|
|
|
|
brick[i*10+j].hits--;
|
|
|
|
brick[i*10+j].hiteffect++;
|
|
|
|
score+=3;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
brick[i*10+j].used=0;
|
|
|
|
if (brick[i*10+j].power!=10)
|
|
|
|
brick[i*10+j].poweruse=2;
|
2006-01-26 23:31:00 +00:00
|
|
|
brick_on_board--;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2006-01-26 23:31:00 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if (brick[i*10+j].used==1) {
|
|
|
|
rb->lcd_bitmap_part(brickmania_bricks,0,
|
|
|
|
BRICK_HEIGHT*brick[i*10+j].color,
|
|
|
|
BRICK_WIDTH,
|
|
|
|
LEFTMARGIN+j*BRICK_WIDTH,
|
|
|
|
TOPMARGIN+i*BRICK_HEIGHT,
|
|
|
|
BRICK_WIDTH, BRICK_HEIGHT);
|
2006-02-19 21:24:46 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR /* No transparent effect for greyscale lcds for now */
|
2006-03-03 07:24:34 +00:00
|
|
|
if (brick[i*10+j].hiteffect>0)
|
2009-08-02 13:45:39 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_break,0,
|
2006-03-03 07:24:34 +00:00
|
|
|
BRICK_HEIGHT*brick[i*10+j].hiteffect,
|
|
|
|
BRICK_WIDTH,
|
|
|
|
LEFTMARGIN+j*BRICK_WIDTH,
|
|
|
|
TOPMARGIN+i*BRICK_HEIGHT,
|
2009-08-02 13:45:39 +00:00
|
|
|
BRICK_WIDTH, BRICK_HEIGHT);
|
2006-02-19 21:24:46 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2009-07-18 01:57:06 +00:00
|
|
|
/* Somewhere in here collision checking is done b/w ball and
|
|
|
|
* brick.
|
|
|
|
*/
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++) {
|
2009-07-18 01:57:06 +00:00
|
|
|
if (ball[k].pos_y < PAD_POS_Y) {
|
2006-03-03 07:24:34 +00:00
|
|
|
if (brick[i*10+j].used==1) {
|
|
|
|
if ((ball[k].pos_x+ball[k].x+HALFBALL >=
|
|
|
|
brickx &&
|
|
|
|
ball[k].pos_x+ball[k].x+HALFBALL <=
|
|
|
|
brickx+BRICK_WIDTH) &&
|
|
|
|
((bricky-4<ball[k].pos_y+BALL &&
|
|
|
|
bricky>ball[k].pos_y+BALL) ||
|
|
|
|
(bricky+4>ball[k].pos_y+BALL+BALL &&
|
|
|
|
bricky<ball[k].pos_y+BALL+BALL)) &&
|
|
|
|
(ball[k].y >0)) {
|
|
|
|
ball[k].tempy=bricky-ball[k].pos_y-BALL;
|
|
|
|
}
|
|
|
|
else if ((ball[k].pos_x+ball[k].x+HALFBALL >=
|
|
|
|
brickx &&
|
|
|
|
ball[k].pos_x+ball[k].x+HALFBALL <=
|
|
|
|
brickx+BRICK_WIDTH) &&
|
|
|
|
((bricky+BRICK_HEIGHT+4>ball[k].pos_y &&
|
|
|
|
bricky+BRICK_HEIGHT<ball[k].pos_y) ||
|
|
|
|
(bricky+BRICK_HEIGHT-4<ball[k].pos_y-BALL &&
|
|
|
|
bricky+BRICK_HEIGHT>ball[k].pos_y-BALL)) &&
|
|
|
|
(ball[k].y <0)) {
|
|
|
|
ball[k].tempy=
|
|
|
|
-(ball[k].pos_y-(bricky+BRICK_HEIGHT));
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((ball[k].pos_y+HALFBALL >=
|
|
|
|
bricky &&
|
|
|
|
ball[k].pos_y+HALFBALL <=
|
|
|
|
bricky+BRICK_HEIGHT) &&
|
|
|
|
((brickx-4<ball[k].pos_x+BALL &&
|
|
|
|
brickx>ball[k].pos_x+BALL) ||
|
|
|
|
(brickx+4>ball[k].pos_x+BALL+BALL &&
|
|
|
|
brickx<ball[k].pos_x+BALL+BALL)) &&
|
|
|
|
(ball[k].x >0)) {
|
|
|
|
ball[k].tempx=brickx-ball[k].pos_x-BALL;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
else if ((ball[k].pos_y+ball[k].y+HALFBALL >=
|
|
|
|
bricky &&
|
|
|
|
ball[k].pos_y+ball[k].y+HALFBALL <=
|
|
|
|
bricky+BRICK_HEIGHT) &&
|
|
|
|
((brickx+BRICK_WIDTH+4>ball[k].pos_x &&
|
|
|
|
brickx+BRICK_WIDTH<ball[k].pos_x) ||
|
|
|
|
(brickx+BRICK_WIDTH-4<ball[k].pos_x-
|
|
|
|
BALL &&
|
|
|
|
brickx+BRICK_WIDTH>ball[k].pos_x-
|
|
|
|
BALL)) && (ball[k].x <0)) {
|
|
|
|
ball[k].tempx=
|
|
|
|
-(ball[k].pos_x-(brickx+BRICK_WIDTH));
|
2006-01-26 23:31:00 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((ball[k].pos_x+HALFBALL >= brickx &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
brickx+BRICK_WIDTH) &&
|
|
|
|
((bricky+BRICK_HEIGHT==ball[k].pos_y) ||
|
|
|
|
(bricky+BRICK_HEIGHT-6<=ball[k].pos_y &&
|
|
|
|
bricky+BRICK_HEIGHT>ball[k].pos_y)) &&
|
|
|
|
(ball[k].y <0)) { /* bottom line */
|
|
|
|
if (brick[i*10+j].hits > 0) {
|
|
|
|
brick[i*10+j].hits--;
|
|
|
|
brick[i*10+j].hiteffect++;
|
|
|
|
score+=2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
brick[i*10+j].used=0;
|
|
|
|
if (brick[i*10+j].power!=10)
|
|
|
|
brick[i*10+j].poweruse=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ball[k].y = ball[k].y*-1;
|
|
|
|
}
|
|
|
|
else if ((ball[k].pos_x+HALFBALL >= brickx &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
brickx+BRICK_WIDTH) &&
|
|
|
|
((bricky==ball[k].pos_y+BALL) ||
|
|
|
|
(bricky+6>=ball[k].pos_y+BALL &&
|
|
|
|
bricky<ball[k].pos_y+BALL)) &&
|
|
|
|
(ball[k].y >0)) { /* top line */
|
|
|
|
if (brick[i*10+j].hits > 0) {
|
|
|
|
brick[i*10+j].hits--;
|
|
|
|
brick[i*10+j].hiteffect++;
|
|
|
|
score+=2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
brick[i*10+j].used=0;
|
|
|
|
if (brick[i*10+j].power!=10)
|
|
|
|
brick[i*10+j].poweruse=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ball[k].y = ball[k].y*-1;
|
2006-01-26 23:31:00 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((ball[k].pos_y+HALFBALL >= bricky &&
|
|
|
|
ball[k].pos_y+HALFBALL <=
|
|
|
|
bricky+BRICK_HEIGHT) &&
|
|
|
|
((brickx==ball[k].pos_x+BALL) ||
|
|
|
|
(brickx+6>=ball[k].pos_x+BALL &&
|
|
|
|
brickx<ball[k].pos_x+BALL)) &&
|
|
|
|
(ball[k].x > 0)) { /* left line */
|
|
|
|
if (brick[i*10+j].hits > 0) {
|
|
|
|
brick[i*10+j].hits--;
|
|
|
|
brick[i*10+j].hiteffect++;
|
|
|
|
score+=2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
brick[i*10+j].used=0;
|
|
|
|
if (brick[i*10+j].power!=10)
|
|
|
|
brick[i*10+j].poweruse=2;
|
|
|
|
}
|
|
|
|
ball[k].x = ball[k].x*-1;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ((ball[k].pos_y+HALFBALL >= bricky &&
|
|
|
|
ball[k].pos_y+HALFBALL <=
|
|
|
|
bricky+BRICK_HEIGHT) &&
|
|
|
|
((brickx+BRICK_WIDTH==
|
|
|
|
ball[k].pos_x) ||
|
|
|
|
(brickx+BRICK_WIDTH-6<=
|
|
|
|
ball[k].pos_x &&
|
|
|
|
brickx+BRICK_WIDTH>
|
|
|
|
ball[k].pos_x)) &&
|
|
|
|
(ball[k].x < 0)) { /* Right line */
|
|
|
|
if (brick[i*10+j].hits > 0) {
|
|
|
|
brick[i*10+j].hits--;
|
|
|
|
brick[i*10+j].hiteffect++;
|
|
|
|
score+=2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
brick[i*10+j].used=0;
|
|
|
|
if (brick[i*10+j].power!=10)
|
|
|
|
brick[i*10+j].poweruse=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ball[k].x = ball[k].x*-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (brick[i*10+j].used==0) {
|
|
|
|
brick_on_board--;
|
|
|
|
score+=8;
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
} /* for k */
|
2006-02-15 17:37:45 +00:00
|
|
|
} /* for j */
|
|
|
|
} /* for i */
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* draw the pad */
|
2009-08-02 13:45:39 +00:00
|
|
|
rb->lcd_bitmap_part(pad_width==PAD_WIDTH?brickmania_pads:
|
|
|
|
pad_width==LONG_PAD_WIDTH?brickmania_long_pads:
|
|
|
|
brickmania_short_pads,
|
|
|
|
0,pad_type*PAD_HEIGHT,pad_width,
|
|
|
|
pad_pos_x, PAD_POS_Y, pad_width, PAD_HEIGHT);
|
|
|
|
|
2009-08-28 23:55:44 +00:00
|
|
|
/* If the game is not paused continue */
|
|
|
|
if (game_state!=ST_PAUSE)
|
|
|
|
{
|
|
|
|
/* Loop through all of the balls in play */
|
|
|
|
for(k=0;k<used_balls;k++)
|
|
|
|
{
|
|
|
|
if ( (ball[k].pos_x >= pad_pos_x &&
|
|
|
|
ball[k].pos_x <= pad_pos_x+pad_width) &&
|
|
|
|
(PAD_POS_Y-4<ball[k].pos_y+BALL &&
|
|
|
|
PAD_POS_Y>ball[k].pos_y+BALL) && (ball[k].y >0))
|
|
|
|
{
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].tempy=PAD_POS_Y-ball[k].pos_y-BALL;
|
2009-08-28 23:55:44 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
else if ((4>ball[k].pos_y && 0<ball[k].pos_y) &&
|
|
|
|
(ball[k].y <0))
|
2009-08-28 23:55:44 +00:00
|
|
|
{
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].tempy=-ball[k].pos_y;
|
2009-08-28 23:55:44 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
if ((LCD_WIDTH-4<ball[k].pos_x+BALL &&
|
|
|
|
LCD_WIDTH>ball[k].pos_x+BALL) && (ball[k].x >0))
|
2009-08-28 23:55:44 +00:00
|
|
|
{
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].tempx=LCD_WIDTH-ball[k].pos_x-BALL;
|
2009-08-28 23:55:44 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
else if ((4>ball[k].pos_x && 0<ball[k].pos_x) &&
|
|
|
|
(ball[k].x <0))
|
2009-08-28 23:55:44 +00:00
|
|
|
{
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].tempx=-ball[k].pos_x;
|
2009-08-28 23:55:44 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Did the Ball hit the top of the screen? */
|
2009-08-02 13:45:39 +00:00
|
|
|
if (ball[k].pos_y<= 0)
|
2009-08-28 23:55:44 +00:00
|
|
|
{
|
|
|
|
/* Reverse the direction */
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].y = ball[k].y*-1;
|
2009-08-28 23:55:44 +00:00
|
|
|
}
|
|
|
|
/* Player missed the ball and hit bottom of screen */
|
|
|
|
else if (ball[k].pos_y+BALL >= GAMESCREEN_HEIGHT)
|
|
|
|
{
|
|
|
|
/* Player had balls to spare, so handle the removal */
|
|
|
|
if (used_balls>1)
|
|
|
|
{
|
|
|
|
/* decrease number of balls in play */
|
2009-08-02 13:45:39 +00:00
|
|
|
used_balls--;
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Replace removed ball with the last ball */
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].pos_x = ball[used_balls].pos_x;
|
|
|
|
ball[k].pos_y = ball[used_balls].pos_y;
|
|
|
|
ball[k].y = ball[used_balls].y;
|
|
|
|
ball[k].tempy = ball[used_balls].tempy;
|
|
|
|
ball[k].x = ball[used_balls].x;
|
|
|
|
ball[k].tempx = ball[used_balls].tempx;
|
|
|
|
ball[k].glue = ball[used_balls].glue;
|
|
|
|
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Reset the last ball that was removed */
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[used_balls].x=0;
|
|
|
|
ball[used_balls].y=0;
|
|
|
|
ball[used_balls].tempy=0;
|
|
|
|
ball[used_balls].tempx=0;
|
|
|
|
ball[used_balls].pos_y=PAD_POS_Y-BALL;
|
|
|
|
ball[used_balls].pos_x=pad_pos_x+(pad_width/2)-2;
|
|
|
|
|
|
|
|
k--;
|
|
|
|
continue;
|
2009-08-28 23:55:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Player lost a life */
|
2009-08-02 13:45:39 +00:00
|
|
|
life--;
|
2009-08-28 23:55:44 +00:00
|
|
|
if (life>=0)
|
|
|
|
{
|
|
|
|
/* No lives left reset game */
|
2009-08-02 13:45:39 +00:00
|
|
|
brickmania_init_game(0);
|
|
|
|
brickmania_sleep(2);
|
|
|
|
}
|
2006-02-15 17:37:45 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Check if the ball hit the left or right side */
|
|
|
|
if ( (ball[k].pos_x <= 0) ||
|
|
|
|
(ball[k].pos_x+BALL >= LCD_WIDTH))
|
|
|
|
{
|
|
|
|
/* Reverse direction */
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].x = ball[k].x*-1;
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Re-position ball in gameboard */
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].pos_x = ball[k].pos_x <= 0 ? 0 : LCD_WIDTH-BALL;
|
|
|
|
}
|
2006-02-19 21:24:46 +00:00
|
|
|
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Did the ball hit the paddle? Depending on where the ball
|
|
|
|
* Hit set the x/y speed appropriately.
|
|
|
|
*/
|
|
|
|
if( (ball[k].pos_y + BALL >= PAD_POS_Y &&
|
|
|
|
(ball[k].pos_x + HALFBALL >= pad_pos_x &&
|
|
|
|
ball[k].pos_x + HALFBALL <= pad_pos_x+pad_width)) &&
|
|
|
|
game_state!=ST_READY && !ball[k].glue)
|
|
|
|
{
|
|
|
|
/* Position the ball relative to the paddle width */
|
|
|
|
int ball_repos=ball[k].pos_x + HALFBALL - pad_pos_x;
|
|
|
|
/* If the ball hits the right half of paddle, x speed
|
|
|
|
* should be positive, if it hits the left half it
|
|
|
|
* should be negative.
|
|
|
|
*/
|
|
|
|
int x_direction = -1;
|
|
|
|
|
|
|
|
/* Comparisons are done with respect to 1/2 pad_width */
|
|
|
|
if(ball_repos > pad_width/2)
|
|
|
|
{
|
|
|
|
/* flip the relative position */
|
|
|
|
ball_repos -= ((ball_repos - pad_width/2) << 1);
|
|
|
|
/* Ball hit the right half so X speed calculations
|
|
|
|
* should be positive.
|
|
|
|
*/
|
|
|
|
x_direction = 1;
|
2009-08-02 13:45:39 +00:00
|
|
|
}
|
2009-08-28 23:55:44 +00:00
|
|
|
|
|
|
|
/* Figure out where the ball hit relative to 1/2 pad
|
|
|
|
* and in divisions of 4.
|
|
|
|
*/
|
|
|
|
ball_repos = ball_repos / (pad_width/2/4);
|
|
|
|
|
|
|
|
switch(ball_repos)
|
|
|
|
{
|
|
|
|
/* Ball hit the outer edge of the paddle */
|
|
|
|
case 0:
|
|
|
|
ball[k].y = -2;
|
|
|
|
ball[k].x = 6 * x_direction;
|
|
|
|
break;
|
|
|
|
/* Ball hit the next fourth of the paddle */
|
|
|
|
case 1:
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].y = -3;
|
2009-08-28 23:55:44 +00:00
|
|
|
ball[k].x = 4 * x_direction;
|
|
|
|
break;
|
|
|
|
/* Ball hit the third fourth of the paddle */
|
|
|
|
case 2:
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].y = -4;
|
2009-08-28 23:55:44 +00:00
|
|
|
ball[k].x = 3 * x_direction;
|
|
|
|
break;
|
|
|
|
/* Ball hit the fourth fourth of the paddle or dead
|
|
|
|
* center.
|
|
|
|
*/
|
|
|
|
case 3:
|
|
|
|
case 4:
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].y = -4;
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Since this is the middle we don't want to
|
|
|
|
* force the ball in a different direction.
|
|
|
|
* Just keep it going in the same direction
|
|
|
|
* with a specific speed.
|
|
|
|
*/
|
|
|
|
ball[k].x = (ball[k].x > 0) ? 2: -2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].y = -4;
|
2009-08-28 23:55:44 +00:00
|
|
|
break;
|
2009-08-02 13:45:39 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
|
2009-08-28 23:55:44 +00:00
|
|
|
/* Update the ball position */
|
2009-08-02 13:45:39 +00:00
|
|
|
if (!ball[k].glue) {
|
|
|
|
ball[k].pos_x+=ball[k].tempx!=0?ball[k].tempx:ball[k].x;
|
|
|
|
ball[k].pos_y+=ball[k].tempy!=0?ball[k].tempy:ball[k].y;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2009-08-02 13:45:39 +00:00
|
|
|
ball[k].tempy=0;
|
|
|
|
ball[k].tempx=0;
|
|
|
|
}
|
2009-08-28 23:55:44 +00:00
|
|
|
|
|
|
|
/* Handle the sticky situation */
|
|
|
|
if (ball[k].pos_y + BALL >= PAD_POS_Y &&
|
2009-08-29 00:02:02 +00:00
|
|
|
(pad_type == STICKY && !ball[k].glue) &&
|
2009-08-02 13:45:39 +00:00
|
|
|
(ball[k].pos_x >= pad_pos_x &&
|
|
|
|
ball[k].pos_x <= pad_pos_x+pad_width)) {
|
|
|
|
ball[k].y=0;
|
|
|
|
ball[k].pos_y=PAD_POS_Y-BALL;
|
|
|
|
ball[k].glue=true;
|
|
|
|
}
|
|
|
|
} /* for k */
|
|
|
|
}
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
|
|
|
|
if (brick_on_board < 0) {
|
2009-07-18 23:26:50 +00:00
|
|
|
if (level+1<levels_num) {
|
|
|
|
level++;
|
2009-08-02 13:45:39 +00:00
|
|
|
if (difficulty==NORMAL)
|
2009-07-18 23:26:50 +00:00
|
|
|
score+=100;
|
2009-08-02 13:45:39 +00:00
|
|
|
brickmania_init_game(1);
|
2009-07-18 23:26:50 +00:00
|
|
|
brickmania_sleep(2);
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
rb->lcd_getstringsize("Congratulations!", &sw, NULL);
|
2007-12-30 14:56:51 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_CONGRATS,
|
2006-03-03 07:24:34 +00:00
|
|
|
"Congratulations!");
|
2006-02-22 10:34:36 +00:00
|
|
|
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_getstringsize("No more levels", &sw, NULL);
|
2007-12-30 14:56:51 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_FINISH,
|
2006-03-03 07:24:34 +00:00
|
|
|
"No more levels");
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_getstringsize("You have finished the game!",
|
|
|
|
&sw, NULL);
|
2007-12-30 14:56:51 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_FINISH,
|
2006-03-03 07:24:34 +00:00
|
|
|
"You have finished the game!");
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
vscore=score;
|
|
|
|
rb->lcd_update();
|
2009-08-02 13:45:39 +00:00
|
|
|
brickmania_sleep(2);
|
|
|
|
return 0;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int move_button,button;
|
|
|
|
int button_right,button_left;
|
|
|
|
button=rb->button_get(false);
|
2006-07-30 03:10:09 +00:00
|
|
|
|
2008-03-22 10:24:28 +00:00
|
|
|
#if defined(HAS_BUTTON_HOLD) && !defined(HAVE_REMOTE_LCD_AS_MAIN)
|
|
|
|
/* FIXME: Should probably check remote hold here */
|
2006-07-30 03:10:09 +00:00
|
|
|
if (rb->button_hold())
|
2009-08-02 13:45:39 +00:00
|
|
|
button = QUIT;
|
2006-07-30 03:10:09 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
if(button & BUTTON_TOUCHSCREEN)
|
2008-06-09 20:59:55 +00:00
|
|
|
{
|
|
|
|
short touch_x, touch_y;
|
|
|
|
touch_x = rb->button_get_data() >> 16;
|
|
|
|
touch_y = rb->button_get_data() & 0xffff;
|
|
|
|
if(touch_y >= PAD_POS_Y && touch_y <= PAD_POS_Y+PAD_HEIGHT)
|
|
|
|
{
|
2009-07-26 19:51:44 +00:00
|
|
|
pad_pos_x += (flip_sides ? -1 : 1) * ( (touch_x-pad_pos_x-pad_width/2) / 4 );
|
2009-08-02 13:45:39 +00:00
|
|
|
|
2008-06-09 20:59:55 +00:00
|
|
|
if(pad_pos_x < 0)
|
|
|
|
pad_pos_x = 0;
|
2009-07-26 19:51:44 +00:00
|
|
|
else if(pad_pos_x+pad_width > LCD_WIDTH)
|
|
|
|
pad_pos_x = LCD_WIDTH-pad_width;
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++)
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state==ST_READY || ball[k].glue)
|
2009-07-26 19:51:44 +00:00
|
|
|
ball[k].pos_x = pad_pos_x+pad_width/2;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
|
2008-06-09 20:59:55 +00:00
|
|
|
if(button & BUTTON_REL)
|
|
|
|
button = SELECT;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2008-06-09 20:59:55 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
move_button=rb->button_status();
|
|
|
|
#ifdef ALTRIGHT
|
|
|
|
button_right=((move_button & RIGHT) || (move_button & ALTRIGHT));
|
|
|
|
button_left=((move_button & LEFT) || (move_button & ALTLEFT));
|
|
|
|
#else
|
|
|
|
button_right=((move_button & RIGHT) || (SCROLL_FWD(button)));
|
|
|
|
button_left=((move_button & LEFT) || (SCROLL_BACK(button)));
|
|
|
|
#endif
|
2009-08-02 13:45:39 +00:00
|
|
|
if ((game_state==ST_PAUSE) && (button_right || button_left))
|
2008-06-09 20:59:55 +00:00
|
|
|
continue;
|
|
|
|
if ((button_right && flip_sides==false) ||
|
|
|
|
(button_left && flip_sides==true)) {
|
2009-07-26 19:51:44 +00:00
|
|
|
if (pad_pos_x+8+pad_width > LCD_WIDTH) {
|
2008-06-09 20:59:55 +00:00
|
|
|
for(k=0;k<used_balls;k++)
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state==ST_READY || ball[k].glue)
|
2009-07-26 19:51:44 +00:00
|
|
|
ball[k].pos_x+=LCD_WIDTH-pad_pos_x-pad_width;
|
|
|
|
pad_pos_x+=LCD_WIDTH-pad_pos_x-pad_width;
|
2008-06-09 20:59:55 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(k=0;k<used_balls;k++)
|
2009-08-02 13:45:39 +00:00
|
|
|
if ((game_state==ST_READY || ball[k].glue))
|
2008-06-09 20:59:55 +00:00
|
|
|
ball[k].pos_x+=8;
|
|
|
|
pad_pos_x+=8;
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2008-06-09 20:59:55 +00:00
|
|
|
else if ((button_left && flip_sides==false) ||
|
|
|
|
(button_right && flip_sides==true)) {
|
|
|
|
if (pad_pos_x-8 < 0) {
|
|
|
|
for(k=0;k<used_balls;k++)
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state==ST_READY || ball[k].glue)
|
2008-06-09 20:59:55 +00:00
|
|
|
ball[k].pos_x-=pad_pos_x;
|
|
|
|
pad_pos_x-=pad_pos_x;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(k=0;k<used_balls;k++)
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state==ST_READY || ball[k].glue)
|
2008-06-09 20:59:55 +00:00
|
|
|
ball[k].pos_x-=8;
|
|
|
|
pad_pos_x-=8;
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2008-06-09 20:59:55 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
switch(button) {
|
|
|
|
case UP:
|
|
|
|
case SELECT:
|
2009-08-02 13:45:39 +00:00
|
|
|
if (game_state==ST_READY) {
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
ball[k].y=-4;
|
2009-07-26 19:51:44 +00:00
|
|
|
ball[k].x=pad_pos_x+(pad_width/2)-2>=
|
2006-03-03 07:24:34 +00:00
|
|
|
LCD_WIDTH/2?2:-2;
|
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
game_state=ST_START;
|
|
|
|
}
|
|
|
|
else if (game_state==ST_PAUSE) {
|
|
|
|
game_state=ST_START;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2009-08-29 00:02:02 +00:00
|
|
|
else if (pad_type == STICKY) {
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
if (ball[k].glue)
|
|
|
|
ball[k].glue=false;
|
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
}
|
2009-08-29 00:02:02 +00:00
|
|
|
else if (pad_type == SHOOTER) {
|
2009-08-02 13:45:39 +00:00
|
|
|
k=brickmania_fire_space();
|
|
|
|
fire[k].top=PAD_POS_Y-7;
|
|
|
|
fire[k].left=pad_pos_x+1;
|
|
|
|
k=brickmania_fire_space();
|
|
|
|
fire[k].top=PAD_POS_Y-7;
|
|
|
|
fire[k].left=pad_pos_x+pad_width-1;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef RC_QUIT
|
|
|
|
case RC_QUIT:
|
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
case QUIT:
|
2009-08-02 13:45:39 +00:00
|
|
|
resume = true;
|
|
|
|
return 0;
|
2006-03-03 07:24:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2007-12-30 14:56:51 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
rb->lcd_bitmap_transparent(brickmania_gameover,
|
|
|
|
(LCD_WIDTH - GAMEOVER_WIDTH)/2,
|
|
|
|
(GAMESCREEN_HEIGHT - GAMEOVER_HEIGHT)/2,
|
|
|
|
GAMEOVER_WIDTH,GAMEOVER_HEIGHT);
|
|
|
|
#else /* greyscale and mono */
|
|
|
|
rb->lcd_bitmap(brickmania_gameover,(LCD_WIDTH - GAMEOVER_WIDTH)/2,
|
|
|
|
(GAMESCREEN_HEIGHT - GAMEOVER_HEIGHT)/2,
|
|
|
|
GAMEOVER_WIDTH,GAMEOVER_HEIGHT);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2007-12-30 14:56:51 +00:00
|
|
|
rb->lcd_update();
|
2009-07-18 23:26:50 +00:00
|
|
|
brickmania_sleep(2);
|
2009-08-02 13:45:39 +00:00
|
|
|
return 0;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
if (end > *rb->current_tick)
|
2006-01-27 10:02:13 +00:00
|
|
|
rb->sleep(end-*rb->current_tick);
|
2006-03-03 07:24:34 +00:00
|
|
|
else
|
|
|
|
rb->yield();
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2009-08-02 13:45:39 +00:00
|
|
|
return 0;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* this is the plugin entry point */
|
2009-01-16 10:34:40 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
2006-01-23 16:00:06 +00:00
|
|
|
{
|
|
|
|
(void)parameter;
|
2009-08-02 13:45:39 +00:00
|
|
|
int last_difficulty;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
highscore_load(HIGH_SCORE,highest,NUM_SCORES);
|
2009-08-02 13:45:39 +00:00
|
|
|
configfile_load(CONFIG_FILE_NAME,config,1,0);
|
|
|
|
last_difficulty = difficulty;
|
|
|
|
|
2006-02-20 18:56:34 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2006-11-15 06:46:35 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
rb->lcd_set_backdrop(NULL);
|
|
|
|
#endif
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn off backlight timeout */
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_force_on(); /* backlight control in lib/helper.c */
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* now go ahead and have fun! */
|
2009-08-02 13:45:39 +00:00
|
|
|
rb->srand( *rb->current_tick );
|
|
|
|
brickmania_loadgame();
|
|
|
|
while(brickmania_game_loop() == 0) {
|
|
|
|
if(!resume) {
|
|
|
|
int position = highscore_update(score, level+1, "", highest, NUM_SCORES);
|
|
|
|
if (position == 0) {
|
|
|
|
rb->splash(HZ*2, "New High Score");
|
|
|
|
}
|
|
|
|
if (position != -1) {
|
2009-08-03 01:07:58 +00:00
|
|
|
highscore_show(position, highest, NUM_SCORES, true);
|
2009-08-02 13:45:39 +00:00
|
|
|
} else {
|
|
|
|
brickmania_sleep(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2009-07-18 23:26:50 +00:00
|
|
|
highscore_save(HIGH_SCORE,highest,NUM_SCORES);
|
2009-08-02 13:45:39 +00:00
|
|
|
if(last_difficulty != difficulty)
|
|
|
|
configfile_save(CONFIG_FILE_NAME,config,1,0);
|
2006-01-23 17:23:02 +00:00
|
|
|
/* Restore user's original backlight setting */
|
2006-02-20 18:56:34 +00:00
|
|
|
rb->lcd_setfont(FONT_UI);
|
2007-08-15 12:42:09 +00:00
|
|
|
/* Turn on backlight timeout (revert to settings) */
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_use_settings(); /* backlight control in lib/helper.c */
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|