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
|
|
|
*
|
|
|
|
* 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 "configfile.h" /* Part of libplugin */
|
|
|
|
|
|
|
|
PLUGIN_HEADER
|
|
|
|
|
2006-01-27 10:02:13 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_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
|
|
|
|
|
2006-06-30 16:43:47 +00:00
|
|
|
#define RC_QUIT BUTTON_RC_STOP
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
/* Only iPod have scroll events */
|
2006-01-27 10:02:13 +00:00
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
/* Only iPod have scroll events */
|
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
/* Only iPod have scroll events */
|
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
/* Only iPod have scroll events */
|
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
2006-02-24 20:54:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_4G_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)
|
|
|
|
|
|
|
|
#define QUIT BUTTON_A
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5_PAD /* grayscale at the moment */
|
|
|
|
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_PLAY
|
|
|
|
#define UP BUTTON_UP
|
|
|
|
#define DOWN BUTTON_DOWN
|
|
|
|
|
2006-08-03 20:40:37 +00:00
|
|
|
/* Only iPod have scroll events */
|
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
2006-10-26 13:38:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_E200_PAD
|
|
|
|
|
|
|
|
#define QUIT BUTTON_POWER
|
|
|
|
#define LEFT BUTTON_LEFT
|
|
|
|
#define RIGHT BUTTON_RIGHT
|
|
|
|
#define SELECT BUTTON_SELECT
|
|
|
|
#define UP BUTTON_SCROLL_UP
|
|
|
|
#define DOWN BUTTON_SCROLL_DOWN
|
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD /* grayscale at the moment */
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
/* Only iPod have scroll events */
|
|
|
|
#define SCROLL_FWD(x) (0)
|
|
|
|
#define SCROLL_BACK(x) (0)
|
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
#else
|
|
|
|
#error Unsupported keypad
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static struct plugin_api* rb;
|
|
|
|
|
2006-06-05 20:41:52 +00:00
|
|
|
enum menu_items {
|
|
|
|
BM_START,
|
|
|
|
BM_SEL_START,
|
|
|
|
BM_RESUME,
|
|
|
|
BM_SEL_RESUME,
|
|
|
|
BM_NO_RESUME,
|
|
|
|
BM_HELP,
|
|
|
|
BM_SEL_HELP,
|
|
|
|
BM_QUIT,
|
|
|
|
BM_SEL_QUIT,
|
|
|
|
};
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
/* External bitmaps */
|
2006-02-22 10:34:36 +00:00
|
|
|
#if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
|
|
|
|
extern const fb_data brickmania_menu_bg[];
|
2006-01-23 16:00:06 +00:00
|
|
|
extern const fb_data brickmania_gameover[];
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-06-05 20:41:52 +00:00
|
|
|
extern const fb_data brickmania_menu_items[];
|
2006-02-22 10:34:36 +00:00
|
|
|
extern const fb_data brickmania_ball[];
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-02-01 18:25:24 +00:00
|
|
|
extern const fb_data brickmania_break[];
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* normal, glue, fire */
|
|
|
|
extern const fb_data brickmania_pads[];
|
|
|
|
|
|
|
|
/* +life, -life, glue, fire, normal */
|
|
|
|
extern const fb_data brickmania_powerups[];
|
|
|
|
|
|
|
|
/* purple, red, blue, pink, green, yellow orange */
|
|
|
|
extern const fb_data brickmania_bricks[];
|
|
|
|
|
2007-01-26 06:14:29 +00:00
|
|
|
#if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
|
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
#define CYCLETIME 30
|
|
|
|
|
2007-02-14 22:59:36 +00:00
|
|
|
#define GAMESCREEN_HEIGHT LCD_HEIGHT
|
|
|
|
|
2007-01-26 08:54:44 +00:00
|
|
|
#define PAD_WIDTH 56
|
|
|
|
#define PAD_HEIGHT 7
|
2007-01-26 06:14:29 +00:00
|
|
|
#define PAD_POS_Y LCD_HEIGHT - 7
|
|
|
|
#define BRICK_HEIGHT 12
|
|
|
|
#define BRICK_WIDTH 32
|
|
|
|
#define BALL 5
|
|
|
|
#define HALFBALL 3
|
2007-01-26 08:54:44 +00:00
|
|
|
#define LEFTMARGIN 0
|
2007-01-26 06:14:29 +00:00
|
|
|
#define TOPMARGIN 30
|
|
|
|
|
|
|
|
#define MENU_BMPHEIGHT 20
|
|
|
|
#define MENU_BMPWIDTH 112
|
|
|
|
|
2007-01-26 08:54:44 +00:00
|
|
|
#define BMPHEIGHT_powerup 10
|
|
|
|
#define BMPWIDTH_powerup 16
|
2006-02-19 21:24:46 +00:00
|
|
|
|
2007-01-26 06:14:29 +00:00
|
|
|
#define BMPHEIGHT_menu LCD_HEIGHT
|
|
|
|
#define BMPWIDTH_menu LCD_WIDTH
|
2006-02-19 21:24:46 +00:00
|
|
|
|
2007-01-26 06:14:29 +00:00
|
|
|
#define BMPXOFS_start 105
|
|
|
|
#define BMPYOFS_start 110
|
|
|
|
#define BMPXOFS_resume 112
|
|
|
|
#define BMPYOFS_resume 132
|
|
|
|
#define BMPXOFS_help 142
|
|
|
|
#define BMPYOFS_help 150
|
|
|
|
#define BMPXOFS_quit 143
|
|
|
|
#define BMPYOFS_quit 170
|
|
|
|
#define HIGHSCORE_XPOS 57
|
|
|
|
#define HIGHSCORE_YPOS 88
|
|
|
|
|
|
|
|
#define STRINGPOS_finsh 140
|
|
|
|
#define STRINGPOS_congrats 157
|
|
|
|
#define STRINGPOS_navi 150
|
|
|
|
#define STRINGPOS_flipsides 150
|
|
|
|
|
|
|
|
#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
|
2006-01-27 10:02:13 +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.
|
|
|
|
*/
|
|
|
|
#define CYCLETIME 30
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-01-27 10:02:13 +00:00
|
|
|
/* Offsets for LCDS > 220x176 */
|
2007-02-14 22:59:36 +00:00
|
|
|
|
|
|
|
#define GAMESCREEN_HEIGHT 176
|
2006-01-27 10:02:13 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
#define PAD_WIDTH 40
|
|
|
|
#define PAD_HEIGHT 5
|
2007-02-14 22:59:36 +00:00
|
|
|
#define PAD_POS_Y GAMESCREEN_HEIGHT - 7
|
2006-01-23 16:00:06 +00:00
|
|
|
#define BRICK_HEIGHT 8
|
2006-02-01 18:25:24 +00:00
|
|
|
#define BRICK_WIDTH 21
|
2006-01-23 16:00:06 +00:00
|
|
|
#define BALL 5
|
2006-02-22 10:34:36 +00:00
|
|
|
#define HALFBALL 3
|
2007-02-14 22:59:36 +00:00
|
|
|
#define LEFTMARGIN (LCD_WIDTH-220)/2 + 5
|
2006-02-19 21:24:46 +00:00
|
|
|
#define TOPMARGIN 30
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2007-02-14 22:59:36 +00:00
|
|
|
#define XOFS ((LCD_WIDTH-220)/BRICK_WIDTH/2)*BRICK_WIDTH
|
|
|
|
#define YOFS ((LCD_HEIGHT-176)/BRICK_HEIGHT/2)*BRICK_HEIGHT
|
|
|
|
|
2006-06-05 20:41:52 +00:00
|
|
|
#define MENU_BMPHEIGHT 20
|
|
|
|
#define MENU_BMPWIDTH 112
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
#define BMPHEIGHT_powerup 6
|
|
|
|
#define BMPWIDTH_powerup 10
|
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
#define BMPHEIGHT_menu LCD_HEIGHT
|
|
|
|
#define BMPWIDTH_menu LCD_WIDTH
|
|
|
|
|
2006-01-27 10:02:13 +00:00
|
|
|
#define BMPXOFS_start (55+XOFS)
|
|
|
|
#define BMPYOFS_start (78+YOFS)
|
2006-02-19 21:24:46 +00:00
|
|
|
#define BMPXOFS_resume (62+XOFS)
|
|
|
|
#define BMPYOFS_resume (100+YOFS)
|
2006-01-27 10:02:13 +00:00
|
|
|
#define BMPXOFS_help (92+XOFS)
|
|
|
|
#define BMPYOFS_help (118+YOFS)
|
2006-02-19 21:24:46 +00:00
|
|
|
#define BMPXOFS_quit (93+XOFS)
|
|
|
|
#define BMPYOFS_quit (138+YOFS)
|
2006-01-27 10:02:13 +00:00
|
|
|
#define HIGHSCORE_XPOS (7+XOFS)
|
|
|
|
#define HIGHSCORE_YPOS (56+YOFS)
|
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
#define STRINGPOS_finsh 140
|
|
|
|
#define STRINGPOS_congrats 157
|
|
|
|
#define STRINGPOS_navi 150
|
|
|
|
#define STRINGPOS_flipsides 150
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128)
|
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.
|
|
|
|
*/
|
|
|
|
#define CYCLETIME 50
|
|
|
|
|
2007-02-14 22:59:36 +00:00
|
|
|
#define GAMESCREEN_HEIGHT LCD_HEIGHT
|
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
#define PAD_WIDTH 30
|
|
|
|
#define PAD_HEIGHT 5
|
|
|
|
#define PAD_POS_Y LCD_HEIGHT - 7
|
|
|
|
#define BRICK_HEIGHT 7
|
|
|
|
#define BRICK_WIDTH 15
|
|
|
|
#define BALL 5
|
2006-02-22 10:34:36 +00:00
|
|
|
#define HALFBALL 3
|
2006-02-19 21:24:46 +00:00
|
|
|
#define LEFTMARGIN 5
|
|
|
|
#define TOPMARGIN 21
|
|
|
|
|
2006-06-05 20:41:52 +00:00
|
|
|
#define MENU_BMPHEIGHT 17
|
|
|
|
#define MENU_BMPWIDTH 88
|
2006-02-19 21:24:46 +00:00
|
|
|
|
|
|
|
#define BMPHEIGHT_powerup 6
|
|
|
|
#define BMPWIDTH_powerup 10
|
|
|
|
|
2006-03-24 12:36:47 +00:00
|
|
|
#if LCD_DEPTH == 16
|
|
|
|
#define BMPHEIGHT_menu 128
|
|
|
|
#else
|
2006-02-19 21:24:46 +00:00
|
|
|
#define BMPHEIGHT_menu 45
|
2006-03-24 12:36:47 +00:00
|
|
|
#endif
|
2006-02-19 21:24:46 +00:00
|
|
|
#define BMPWIDTH_menu 160
|
|
|
|
|
2006-03-24 13:59:54 +00:00
|
|
|
#if LCD_DEPTH == 16
|
|
|
|
#define BMPXOFS_start 38
|
|
|
|
#define BMPYOFS_start 56
|
|
|
|
#define BMPXOFS_resume 42
|
|
|
|
#define BMPYOFS_resume 72
|
|
|
|
#define BMPXOFS_help 65
|
|
|
|
#define BMPYOFS_help 85
|
|
|
|
#define BMPXOFS_quit 66
|
|
|
|
#define BMPYOFS_quit 99
|
|
|
|
#else
|
2006-02-19 21:24:46 +00:00
|
|
|
#define BMPXOFS_start 34
|
|
|
|
#define BMPYOFS_start 64
|
|
|
|
#define BMPXOFS_resume 38
|
|
|
|
#define BMPYOFS_resume 77
|
|
|
|
#define BMPXOFS_help 64
|
|
|
|
#define BMPYOFS_help 90
|
|
|
|
#define BMPXOFS_quit 64
|
|
|
|
#define BMPYOFS_quit 103
|
2006-03-24 13:59:54 +00:00
|
|
|
#endif
|
2006-02-19 21:24:46 +00:00
|
|
|
#define HIGHSCORE_XPOS 7
|
|
|
|
#define HIGHSCORE_YPOS 36
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#define STRINGPOS_finsh 110
|
|
|
|
#define STRINGPOS_congrats 100
|
2006-02-19 21:24:46 +00:00
|
|
|
#define STRINGPOS_navi 100
|
|
|
|
#define STRINGPOS_flipsides 100
|
2006-01-27 10:02:13 +00:00
|
|
|
|
2006-04-11 20:16:05 +00:00
|
|
|
/* iPod Mini */
|
|
|
|
#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
#define CYCLETIME 50
|
|
|
|
|
2007-02-14 22:59:36 +00:00
|
|
|
#define GAMESCREEN_HEIGHT LCD_HEIGHT
|
|
|
|
|
2006-04-11 20:16:05 +00:00
|
|
|
#define PAD_WIDTH 30
|
|
|
|
#define PAD_HEIGHT 5
|
|
|
|
#define PAD_POS_Y LCD_HEIGHT - 5
|
|
|
|
#define BRICK_HEIGHT 7
|
|
|
|
#define BRICK_WIDTH 13
|
|
|
|
#define BALL 5
|
|
|
|
#define HALFBALL 3
|
|
|
|
#define LEFTMARGIN 4
|
|
|
|
#define TOPMARGIN 10
|
|
|
|
|
2006-06-05 20:41:52 +00:00
|
|
|
#define MENU_BMPHEIGHT 17
|
|
|
|
#define MENU_BMPWIDTH 88
|
2006-04-11 20:16:05 +00:00
|
|
|
|
|
|
|
#define BMPHEIGHT_powerup 6
|
|
|
|
#define BMPWIDTH_powerup 10
|
|
|
|
|
|
|
|
#define BMPHEIGHT_menu 45
|
|
|
|
#define BMPWIDTH_menu 160
|
|
|
|
|
|
|
|
#define BMPXOFS_start 28
|
|
|
|
#define BMPYOFS_start 41
|
|
|
|
#define BMPXOFS_resume 33
|
|
|
|
#define BMPYOFS_resume 58
|
|
|
|
#define BMPXOFS_help 56
|
|
|
|
#define BMPYOFS_help 74
|
|
|
|
#define BMPXOFS_quit 56
|
|
|
|
#define BMPYOFS_quit 90
|
|
|
|
#define HIGHSCORE_XPOS 76
|
|
|
|
#define HIGHSCORE_YPOS 22
|
|
|
|
|
|
|
|
#define STRINGPOS_finsh 54
|
|
|
|
#define STRINGPOS_congrats 44
|
|
|
|
#define STRINGPOS_navi 44
|
|
|
|
#define STRINGPOS_flipsides 44
|
|
|
|
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
#define CYCLETIME 75
|
|
|
|
|
2007-02-14 22:59:36 +00:00
|
|
|
#define GAMESCREEN_HEIGHT LCD_HEIGHT
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#define PAD_WIDTH 30
|
|
|
|
#define PAD_HEIGHT 3
|
|
|
|
#define PAD_POS_Y LCD_HEIGHT - 5
|
|
|
|
#define BRICK_HEIGHT 4
|
|
|
|
#define BRICK_WIDTH 11
|
|
|
|
#define BALL 3
|
|
|
|
#define HALFBALL 2
|
|
|
|
#define LEFTMARGIN 1
|
|
|
|
#define TOPMARGIN 10
|
|
|
|
|
2006-06-05 20:41:52 +00:00
|
|
|
#define MENU_BMPHEIGHT 9
|
|
|
|
#define MENU_BMPWIDTH 80
|
2006-02-22 10:34:36 +00:00
|
|
|
|
|
|
|
#define BMPHEIGHT_powerup 6
|
|
|
|
#define BMPWIDTH_powerup 7
|
|
|
|
|
|
|
|
#define BMPXOFS_start 12
|
|
|
|
#define BMPYOFS_start 20
|
|
|
|
#define BMPXOFS_resume 18
|
|
|
|
#define BMPYOFS_resume 31
|
|
|
|
#define BMPXOFS_help 39
|
|
|
|
#define BMPYOFS_help 42
|
|
|
|
#define BMPXOFS_quit 40
|
|
|
|
#define BMPYOFS_quit 53
|
|
|
|
#define HIGHSCORE_XPOS 0
|
|
|
|
#define HIGHSCORE_YPOS 0
|
|
|
|
|
|
|
|
#define STRINGPOS_finsh 54
|
|
|
|
#define STRINGPOS_congrats 44
|
|
|
|
#define STRINGPOS_navi 44
|
|
|
|
#define STRINGPOS_flipsides 44
|
|
|
|
|
2006-02-20 18:56:34 +00:00
|
|
|
#elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 132) && (LCD_DEPTH==16)
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
#define CYCLETIME 30
|
|
|
|
|
2007-02-14 22:59:36 +00:00
|
|
|
#define GAMESCREEN_HEIGHT LCD_HEIGHT
|
|
|
|
|
2006-02-20 18:56:34 +00:00
|
|
|
#define PAD_WIDTH 40
|
|
|
|
#define PAD_HEIGHT 5
|
|
|
|
#define PAD_POS_Y LCD_HEIGHT - 7
|
|
|
|
#define BRICK_HEIGHT 7
|
|
|
|
#define BRICK_WIDTH 17
|
|
|
|
#define BALL 5
|
2006-02-22 10:34:36 +00:00
|
|
|
#define HALFBALL 3
|
2006-02-20 18:56:34 +00:00
|
|
|
#define LEFTMARGIN 3
|
|
|
|
#define TOPMARGIN 21
|
|
|
|
|
2006-06-05 20:41:52 +00:00
|
|
|
#define MENU_BMPHEIGHT 16
|
|
|
|
#define MENU_BMPWIDTH 89
|
2006-02-20 18:56:34 +00:00
|
|
|
|
|
|
|
#define BMPHEIGHT_powerup 6
|
|
|
|
#define BMPWIDTH_powerup 10
|
|
|
|
|
|
|
|
#define BMPHEIGHT_menu 132
|
|
|
|
#define BMPWIDTH_menu 176
|
|
|
|
|
|
|
|
#define BMPXOFS_start 44
|
|
|
|
#define BMPYOFS_start 58
|
|
|
|
#define BMPXOFS_resume 50
|
|
|
|
#define BMPYOFS_resume 75
|
|
|
|
#define BMPXOFS_help 74
|
|
|
|
#define BMPYOFS_help 89
|
|
|
|
#define BMPXOFS_quit 75
|
|
|
|
#define BMPYOFS_quit 104
|
|
|
|
#define HIGHSCORE_XPOS 7
|
|
|
|
#define HIGHSCORE_YPOS 36
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#define STRINGPOS_finsh 110
|
2006-02-20 18:56:34 +00:00
|
|
|
#define STRINGPOS_congrats 110
|
|
|
|
#define STRINGPOS_navi 100
|
|
|
|
#define STRINGPOS_flipsides 100
|
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
#else
|
|
|
|
#error Unsupported LCD Size
|
|
|
|
#endif
|
|
|
|
|
|
|
|
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},
|
|
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
{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
|
|
|
|
int pad_pos_x;
|
|
|
|
int x[MAX_BALLS],y[MAX_BALLS];
|
2006-01-23 16:00:06 +00:00
|
|
|
int life;
|
|
|
|
int start_game,con_game;
|
|
|
|
int pad_type;
|
|
|
|
int score=0,vscore=0;
|
2006-01-26 23:31:00 +00:00
|
|
|
bool flip_sides=false;
|
2006-01-23 16:00:06 +00:00
|
|
|
int cur_level=0;
|
|
|
|
int brick_on_board=0;
|
2006-02-15 17:37:45 +00:00
|
|
|
int used_balls=1;
|
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 {
|
|
|
|
int pos_x;
|
|
|
|
int pos_y;
|
|
|
|
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];
|
|
|
|
|
|
|
|
|
|
|
|
int highscore;
|
|
|
|
#define MAX_POINTS 200000 /* i dont think it needs to be more */
|
|
|
|
static struct configdata config[] =
|
|
|
|
{
|
|
|
|
{TYPE_INT, 0, MAX_POINTS, &highscore, "highscore", NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
void int_game(int new_game)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
ball[i].pos_x=pad_pos_x+(PAD_WIDTH/2)-2;
|
|
|
|
ball[i].glue=false;
|
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
used_balls=1;
|
2006-01-23 16:00:06 +00:00
|
|
|
start_game =1;
|
|
|
|
con_game =0;
|
|
|
|
pad_type=0;
|
2006-02-15 17:37:45 +00:00
|
|
|
|
2006-01-26 23:31:00 +00:00
|
|
|
flip_sides=false;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
if (new_game==1)
|
2006-03-03 07:24:34 +00:00
|
|
|
brick_on_board=0;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
for(i=0;i<=7;i++) {
|
|
|
|
for(j=0;j<=9;j++) {
|
2006-01-23 16:00:06 +00:00
|
|
|
brick[i*10+j].poweruse=(levels[cur_level][i][j]==0?0:1);
|
2006-03-03 07:24:34 +00:00
|
|
|
if (i*10+j<=30)
|
|
|
|
fire[i*10+j].top=-8;
|
|
|
|
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
|
|
|
|
2006-01-26 23:31:00 +00:00
|
|
|
brick[i*10+j].hits=levels[cur_level][i][j]>=10?
|
2006-03-03 07:24:34 +00:00
|
|
|
levels[cur_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;
|
2006-01-23 16:00:06 +00:00
|
|
|
brick[i*10+j].used=(levels[cur_level][i][j]==0?0:1);
|
2006-01-26 23:31:00 +00:00
|
|
|
brick[i*10+j].color=(levels[cur_level][i][j]>=10?
|
2006-03-03 07:24:34 +00:00
|
|
|
levels[cur_level][i][j]%16:
|
|
|
|
levels[cur_level][i][j])-1;
|
|
|
|
if (levels[cur_level][i][j]!=0)
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-02-17 16:02:37 +00:00
|
|
|
int sw,i,w;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-02-17 16:02:37 +00:00
|
|
|
/* sleep timer counting the score */
|
2006-03-03 07:24:34 +00:00
|
|
|
void sleep (int secs)
|
|
|
|
{
|
|
|
|
bool done=false;
|
|
|
|
char s[20];
|
|
|
|
int count=0;
|
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
|
|
|
|
if (vscore<score) {
|
|
|
|
vscore++;
|
|
|
|
rb->snprintf(s, sizeof(s), "%d", vscore);
|
|
|
|
rb->lcd_getstringsize(s, &sw, &w);
|
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_putsxy(LCD_WIDTH/2-sw/2, 0, s);
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 2, s);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_update_rect(0,0,LCD_WIDTH,w+2);
|
|
|
|
} else {
|
|
|
|
if (count==0)
|
|
|
|
count=*rb->current_tick+HZ*secs;
|
|
|
|
if (*rb->current_tick>=count)
|
|
|
|
done=true;
|
|
|
|
}
|
|
|
|
rb->yield();
|
|
|
|
}
|
|
|
|
|
2006-02-17 16:02:37 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-21 15:24:25 +00:00
|
|
|
#define HIGH_SCORE "brickmania.score"
|
2006-02-17 16:02:37 +00:00
|
|
|
#define MENU_LENGTH 4
|
2006-01-23 16:00:06 +00:00
|
|
|
int game_menu(int when)
|
|
|
|
{
|
|
|
|
int button,cur=0;
|
|
|
|
char str[10];
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_clear_display();
|
|
|
|
#if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
|
2006-06-05 20:41:52 +00:00
|
|
|
rb->lcd_bitmap(brickmania_menu_bg, 0, 0, BMPWIDTH_menu, BMPHEIGHT_menu);
|
2006-03-03 07:24:34 +00:00
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
while (true) {
|
|
|
|
for(i=0;i<MENU_LENGTH;i++) {
|
2006-06-05 20:41:52 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-01-23 16:00:06 +00:00
|
|
|
if (cur==0)
|
2006-06-05 20:41:52 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
|
|
|
MENU_BMPHEIGHT * BM_SEL_START, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
else
|
2006-06-05 20:41:52 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
|
|
|
MENU_BMPHEIGHT * BM_START, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
if (when==1) {
|
|
|
|
if (cur==1)
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_SEL_RESUME, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
else
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_RESUME, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
} else {
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_NO_RESUME, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (cur==2)
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_SEL_HELP, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
else
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_HELP, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
if (cur==3)
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_SEL_QUIT, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
2006-01-23 16:00:06 +00:00
|
|
|
else
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_QUIT, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
#else
|
|
|
|
if (cur==0)
|
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
|
|
|
MENU_BMPHEIGHT * BM_SEL_START, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
else
|
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
|
|
|
MENU_BMPHEIGHT * BM_START, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_start, BMPYOFS_start, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
|
|
|
|
if (when==1) {
|
|
|
|
if (cur==1)
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_SEL_RESUME, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
else
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_RESUME, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
|
|
|
|
} else {
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_NO_RESUME, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_resume, BMPYOFS_resume, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (cur==2)
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_SEL_HELP, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
else
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_HELP, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_help, BMPYOFS_help, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
|
|
|
|
if (cur==3)
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_SEL_QUIT, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
else
|
2007-01-26 06:14:29 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_menu_items, 0,
|
2006-06-05 20:41:52 +00:00
|
|
|
MENU_BMPHEIGHT * BM_QUIT, MENU_BMPWIDTH,
|
|
|
|
BMPXOFS_quit, BMPYOFS_quit, MENU_BMPWIDTH,
|
|
|
|
MENU_BMPHEIGHT);
|
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-02-20 18:56:34 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_FG);
|
2006-01-23 16:00:06 +00:00
|
|
|
/* high score */
|
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_RGBPACK(0,0,140));
|
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
2006-02-19 21:24:46 +00:00
|
|
|
#endif
|
2006-01-27 10:02:13 +00:00
|
|
|
rb->lcd_putsxy(HIGHSCORE_XPOS, HIGHSCORE_YPOS, "High Score");
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->snprintf(str, sizeof(str), "%d", highscore);
|
|
|
|
rb->lcd_getstringsize("High Score", &sw, NULL);
|
|
|
|
rb->lcd_getstringsize(str, &w, NULL);
|
2006-01-27 10:02:13 +00:00
|
|
|
rb->lcd_putsxy(HIGHSCORE_XPOS+sw/2-w/2, HIGHSCORE_YPOS+9, str);
|
2006-02-20 18:56:34 +00:00
|
|
|
rb->lcd_set_drawmode(DRMODE_SOLID);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
rb->lcd_update();
|
|
|
|
|
|
|
|
button = rb->button_get(true);
|
2006-03-03 07:24:34 +00:00
|
|
|
switch(button) {
|
2006-01-23 16:00:06 +00:00
|
|
|
case UP:
|
|
|
|
if (cur==0)
|
|
|
|
cur = MENU_LENGTH-1;
|
|
|
|
else
|
|
|
|
cur--;
|
|
|
|
if (when==0 && cur==1) {
|
|
|
|
cur = 0;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DOWN:
|
|
|
|
if (cur==MENU_LENGTH-1)
|
|
|
|
cur = 0;
|
|
|
|
else
|
|
|
|
cur++;
|
|
|
|
if (when==0 && cur==1) {
|
|
|
|
cur=2;
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
case RIGHT:
|
2006-01-23 16:00:06 +00:00
|
|
|
case SELECT:
|
|
|
|
if (cur==0) {
|
|
|
|
score=0;
|
|
|
|
vscore=0;
|
|
|
|
return 0;
|
|
|
|
} else if (cur==1 && when==1) {
|
|
|
|
return 1;
|
|
|
|
} else if (cur==2) {
|
2006-03-03 07:24:34 +00:00
|
|
|
return 2;
|
2006-01-23 16:00:06 +00:00
|
|
|
} else if (cur==3) {
|
2006-03-03 07:24:34 +00:00
|
|
|
return 3;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef RC_QUIT
|
|
|
|
case RC_QUIT:
|
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
case QUIT:
|
|
|
|
return 3;
|
|
|
|
break;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
default:
|
|
|
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return 3;
|
|
|
|
break;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int help(int when)
|
|
|
|
{
|
|
|
|
int w,h;
|
|
|
|
int button;
|
2006-02-19 21:24:46 +00:00
|
|
|
int xoffset=0;
|
|
|
|
int yoffset=0;
|
|
|
|
/* set the maximum x and y in the helpscreen
|
|
|
|
dont forget to update, if you change text */
|
2006-11-02 18:50:08 +00:00
|
|
|
int maxY=180;
|
|
|
|
int maxX=215;
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
while(true) {
|
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_clear_display();
|
|
|
|
rb->lcd_set_background(LCD_BLACK);
|
|
|
|
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-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
rb->lcd_getstringsize("BrickMania", &w, &h);
|
2006-02-19 21:24:46 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-w/2+xoffset, 1+yoffset, "BrickMania");
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(245,0,0));
|
2006-02-19 21:24:46 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 1*(h+2)+yoffset,"Aim");
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
2006-02-19 21:24:46 +00:00
|
|
|
#else
|
|
|
|
rb->lcd_putsxy(1+xoffset, 1*(h+2)+yoffset,"Aim");
|
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 2*(h+2)+yoffset,
|
|
|
|
"destroy all the bricks by bouncing");
|
|
|
|
rb->lcd_putsxy(1+xoffset, 3*(h+2)+yoffset,
|
|
|
|
"the ball of them using the paddle.");
|
2006-02-19 21:24:46 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(245,0,0));
|
2006-02-19 21:24:46 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 5*(h+2)+yoffset,"Controls");
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_foreground(LCD_WHITE);
|
2006-02-19 21:24:46 +00:00
|
|
|
#else
|
|
|
|
rb->lcd_putsxy(1+xoffset, 5*(h+2)+yoffset,"Controls");
|
2006-03-03 07:24:34 +00:00
|
|
|
#endif
|
2006-02-19 21:24:46 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 6*(h+2)+yoffset,"< & > Move the paddle");
|
2006-02-22 10:34:36 +00:00
|
|
|
#if CONFIG_KEYPAD == ONDIO_PAD
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 7*(h+2)+yoffset,
|
|
|
|
"MENU Releases the ball/Fire!");
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == RECORDER_PAD
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 7*(h+2)+yoffset,
|
|
|
|
"PLAY Releases the ball/Fire!");
|
2006-02-22 10:34:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H300_PAD
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 7*(h+2)+yoffset,
|
|
|
|
"NAVI Releases the ball/Fire!");
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 7*(h+2)+yoffset,
|
|
|
|
"SELECT Releases the ball/Fire!");
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 8*(h+2)+yoffset, "STOP Opens menu/Quit");
|
2006-02-19 21:24:46 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_set_foreground(LCD_RGBPACK(245,0,0));
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 10*(h+2)+yoffset, "Specials");
|
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_putsxy(1+xoffset, 10*(h+2)+yoffset, "Specials");
|
2006-02-19 21:24:46 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 11*(h+2)+yoffset,
|
2006-11-02 18:50:08 +00:00
|
|
|
"N Normal:returns paddle to normal");
|
|
|
|
rb->lcd_putsxy(1+xoffset, 12*(h+2)+yoffset, "D DIE!:loses a life");
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 13*(h+2)+yoffset,
|
2006-11-02 18:50:08 +00:00
|
|
|
"L Life:gains a life/power up");
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 14*(h+2)+yoffset,
|
2006-11-02 18:50:08 +00:00
|
|
|
"F Fire:allows you to shoot bricks");
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 15*(h+2)+yoffset,
|
2006-11-02 18:50:08 +00:00
|
|
|
"G Glue:ball sticks to paddle");
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_putsxy(1+xoffset, 16*(h+2)+yoffset,
|
2006-11-02 18:50:08 +00:00
|
|
|
"B Ball:generates another ball");
|
|
|
|
rb->lcd_putsxy(1+xoffset, 17*(h+2)+yoffset,
|
|
|
|
"FL Flip:flips left / right movement");
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_update();
|
|
|
|
|
|
|
|
button=rb->button_get(true);
|
|
|
|
switch (button) {
|
2006-06-30 16:43:47 +00:00
|
|
|
#ifdef RC_QUIT
|
|
|
|
case RC_QUIT:
|
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
case QUIT:
|
|
|
|
switch (game_menu(when)) {
|
|
|
|
case 0:
|
|
|
|
cur_level=0;
|
|
|
|
life=2;
|
|
|
|
int_game(1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
con_game=1;
|
|
|
|
break;
|
|
|
|
case 2:
|
2006-03-03 07:24:34 +00:00
|
|
|
if (help(when)==1)
|
|
|
|
return 1;
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
2006-02-24 15:13:04 +00:00
|
|
|
return 0;
|
2006-01-23 16:00:06 +00:00
|
|
|
break;
|
2006-03-03 07:24:34 +00:00
|
|
|
case LEFT:
|
|
|
|
case LEFT | BUTTON_REPEAT:
|
2006-02-19 21:24:46 +00:00
|
|
|
if( xoffset<0)
|
2006-03-03 07:24:34 +00:00
|
|
|
xoffset+=2;
|
|
|
|
break;
|
|
|
|
case RIGHT:
|
2006-02-19 21:24:46 +00:00
|
|
|
case RIGHT | BUTTON_REPEAT:
|
|
|
|
if(xoffset+maxX > LCD_WIDTH)
|
2006-03-03 07:24:34 +00:00
|
|
|
xoffset-=2;
|
|
|
|
break;
|
|
|
|
case UP:
|
|
|
|
case UP | BUTTON_REPEAT:
|
|
|
|
if(yoffset <0)
|
|
|
|
yoffset+=2;
|
|
|
|
break;
|
|
|
|
case DOWN:
|
|
|
|
case DOWN | BUTTON_REPEAT:
|
|
|
|
if(yoffset+maxY > LCD_HEIGHT)
|
|
|
|
yoffset-=2;
|
|
|
|
break;
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-02-19 21:24:46 +00:00
|
|
|
default:
|
|
|
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return 1;
|
|
|
|
break;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-24 15:13:04 +00:00
|
|
|
return 0;
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
int pad_check(int ballxc, int mode, int pon ,int ballnum)
|
2006-01-23 16:00:06 +00:00
|
|
|
{
|
|
|
|
/* pon: positive(1) or negative(0) */
|
|
|
|
|
|
|
|
if (mode==0) {
|
|
|
|
if (pon == 0)
|
|
|
|
return -ballxc;
|
|
|
|
else
|
|
|
|
return ballxc;
|
|
|
|
} else {
|
2006-02-15 17:37:45 +00:00
|
|
|
if (ball[ballnum].x > 0)
|
2006-01-23 16:00:06 +00:00
|
|
|
return ballxc;
|
|
|
|
else
|
|
|
|
return ballxc*-1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int fire_space(void)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
for(t=0;t<=30;t++)
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
int game_loop(void)
|
|
|
|
{
|
2006-01-23 16:00:06 +00:00
|
|
|
int j,i,k,bricky,brickx;
|
2006-02-22 10:34:36 +00:00
|
|
|
char s[30];
|
2006-01-26 23:31:00 +00:00
|
|
|
int sec_count=0,num_count=10;
|
2006-01-27 10:02:13 +00:00
|
|
|
int end;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->srand( *rb->current_tick );
|
|
|
|
|
|
|
|
configfile_init(rb);
|
|
|
|
configfile_load(HIGH_SCORE,config,1,0);
|
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
switch(game_menu(0)) {
|
2006-01-23 16:00:06 +00:00
|
|
|
case 0:
|
|
|
|
cur_level = 0;
|
|
|
|
life = 2;
|
|
|
|
int_game(1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
con_game = 1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (help(0) == 1) return 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-2, STRINGPOS_flipsides, s);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
rb->lcd_putsxy(0, 0, s);
|
|
|
|
#else
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "Life: %d", life);
|
|
|
|
rb->lcd_putsxy(2, 2, s);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-22 10:34:36 +00:00
|
|
|
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
|
|
|
rb->snprintf(s, sizeof(s), "L%d", cur_level+1);
|
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH-sw, 0, s);
|
|
|
|
#else
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->snprintf(s, sizeof(s), "Level %d", cur_level+1);
|
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH-sw-2, 2, s);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
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
|
|
|
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 0, s);
|
|
|
|
#else
|
2006-01-23 16:00:06 +00:00
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 2, s);
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* continue game */
|
|
|
|
if (con_game== 1 && start_game!=1) {
|
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");
|
|
|
|
#else
|
|
|
|
rb->snprintf(s, sizeof(s), "Press SELECT To Continue");
|
|
|
|
#endif
|
|
|
|
rb->lcd_getstringsize(s, &sw, NULL);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_navi, s);
|
|
|
|
|
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 */
|
|
|
|
for(i=0;i<=30;i++) {
|
|
|
|
if (fire[i].top+7>0) {
|
|
|
|
if (con_game!=1)
|
|
|
|
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++) {
|
2006-02-15 17:37:45 +00:00
|
|
|
if (brick[i*10+j].power<7) {
|
2006-01-23 16:00:06 +00:00
|
|
|
if (brick[i*10+j].poweruse==2) {
|
|
|
|
if (con_game!=1)
|
|
|
|
brick[i*10+j].powertop+=2;
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_powerups,0,
|
|
|
|
BMPHEIGHT_powerup*brick[i*10+j
|
|
|
|
].power,
|
|
|
|
BMPWIDTH_powerup,
|
|
|
|
LEFTMARGIN+j*BRICK_WIDTH+
|
|
|
|
(BRICK_WIDTH/2-
|
|
|
|
BMPWIDTH_powerup/2),
|
|
|
|
brick[i*10+j].powertop,
|
|
|
|
BMPWIDTH_powerup,
|
|
|
|
BMPHEIGHT_powerup);
|
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 &&
|
|
|
|
pad_pos_x+PAD_WIDTH>LEFTMARGIN+j*BRICK_WIDTH+5) &&
|
|
|
|
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) {
|
|
|
|
int_game(0);
|
2006-02-17 16:02:37 +00:00
|
|
|
sleep(2);
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
score+=34;
|
|
|
|
pad_type=1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
score+=47;
|
|
|
|
pad_type=2;
|
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;
|
|
|
|
pad_type=0;
|
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;
|
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;
|
|
|
|
used_balls++;
|
2006-03-03 07:24:34 +00:00
|
|
|
ball[used_balls-1].x= rb->rand()%1 == 0 ?
|
|
|
|
-1 : 1;
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[used_balls-1].y= -4;
|
2006-03-03 07:24:34 +00:00
|
|
|
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;
|
|
|
|
if (pad_type==2) {
|
|
|
|
for (k=0;k<=30;k++) {
|
|
|
|
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)
|
|
|
|
rb->lcd_bitmap_transparent_part(brickmania_break,
|
|
|
|
0,
|
|
|
|
BRICK_HEIGHT*brick[i*10+j].hiteffect,
|
|
|
|
BRICK_WIDTH,
|
|
|
|
LEFTMARGIN+j*BRICK_WIDTH,
|
|
|
|
TOPMARGIN+i*BRICK_HEIGHT,
|
|
|
|
BRICK_WIDTH,
|
|
|
|
BRICK_HEIGHT);
|
2006-02-19 21:24:46 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
for(k=0;k<used_balls;k++) {
|
2007-01-26 06:14:29 +00:00
|
|
|
if (ball[k].pos_y <160) {
|
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 */
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_bitmap_part(brickmania_pads,0,pad_type*PAD_HEIGHT,
|
|
|
|
PAD_WIDTH,pad_pos_x, PAD_POS_Y, PAD_WIDTH,
|
|
|
|
PAD_HEIGHT);
|
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
for(k=0;k<used_balls;k++) {
|
2006-03-03 07:24:34 +00:00
|
|
|
|
|
|
|
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))
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].tempy=PAD_POS_Y-ball[k].pos_y-BALL;
|
2006-03-03 07:24:34 +00:00
|
|
|
else if ((4>ball[k].pos_y && 0<ball[k].pos_y) &&
|
|
|
|
(ball[k].y <0))
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].tempy=-ball[k].pos_y;
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((LCD_WIDTH-4<ball[k].pos_x+BALL &&
|
|
|
|
LCD_WIDTH>ball[k].pos_x+BALL) && (ball[k].x >0))
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].tempx=LCD_WIDTH-ball[k].pos_x-BALL;
|
2006-03-03 07:24:34 +00:00
|
|
|
else if ((4>ball[k].pos_x && 0<ball[k].pos_x) &&
|
|
|
|
(ball[k].x <0))
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].tempx=-ball[k].pos_x;
|
|
|
|
|
|
|
|
/* top line */
|
|
|
|
if (ball[k].pos_y<= 0)
|
|
|
|
ball[k].y = ball[k].y*-1;
|
|
|
|
/* bottom line */
|
2007-02-14 22:59:36 +00:00
|
|
|
else if (ball[k].pos_y+BALL >= GAMESCREEN_HEIGHT) {
|
2006-02-15 17:37:45 +00:00
|
|
|
if (used_balls>1) {
|
|
|
|
used_balls--;
|
|
|
|
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;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[used_balls].x=0;
|
|
|
|
ball[used_balls].y=0;
|
|
|
|
ball[used_balls].tempy=0;
|
2006-03-03 07:24:34 +00:00
|
|
|
ball[used_balls].tempx=0;
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[used_balls].pos_y=PAD_POS_Y-BALL;
|
|
|
|
ball[used_balls].pos_x=pad_pos_x+(PAD_WIDTH/2)-2;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
k--;
|
|
|
|
continue;
|
2006-01-23 16:00:06 +00:00
|
|
|
} else {
|
2006-02-15 17:37:45 +00:00
|
|
|
life--;
|
2006-03-03 07:24:34 +00:00
|
|
|
if (life>=0) {
|
2006-02-15 17:37:45 +00:00
|
|
|
int_game(0);
|
2006-02-17 16:02:37 +00:00
|
|
|
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
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
/* left line ,right line */
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((ball[k].pos_x <= 0) ||
|
|
|
|
(ball[k].pos_x+BALL >= LCD_WIDTH)) {
|
2006-02-15 17:37:45 +00:00
|
|
|
ball[k].x = ball[k].x*-1;
|
2006-02-17 16:02:37 +00:00
|
|
|
ball[k].pos_x = ball[k].pos_x <= 0 ? 0 : LCD_WIDTH-BALL;
|
|
|
|
}
|
2006-02-19 21:24:46 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((ball[k].pos_y+BALL >= PAD_POS_Y &&
|
|
|
|
(ball[k].pos_x >= pad_pos_x &&
|
|
|
|
ball[k].pos_x <= pad_pos_x+PAD_WIDTH)) &&
|
|
|
|
start_game != 1 && !ball[k].glue) {
|
|
|
|
|
|
|
|
if ((ball[k].pos_x+HALFBALL >= pad_pos_x &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
pad_pos_x+(PAD_WIDTH/2/4)) ||
|
|
|
|
(ball[k].pos_x +HALFBALL>=
|
|
|
|
pad_pos_x+(PAD_WIDTH-(PAD_WIDTH/2/4)) &&
|
|
|
|
ball[k].pos_x+HALFBALL <= pad_pos_x+PAD_WIDTH)) {
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
ball[k].y = -2;
|
|
|
|
if (ball[k].pos_x != 0 &&
|
|
|
|
ball[k].pos_x+BALL!=LCD_WIDTH)
|
|
|
|
ball[k].x = pad_check(6,0,ball[k].pos_x+2<=
|
|
|
|
pad_pos_x+(PAD_WIDTH/2)?
|
|
|
|
0:1,k);
|
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
else if ((ball[k].pos_x+HALFBALL >=
|
|
|
|
pad_pos_x+(PAD_WIDTH/2/4) &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
pad_pos_x+2*(PAD_WIDTH/2/4)) ||
|
|
|
|
(ball[k].pos_x+HALFBALL >=
|
|
|
|
pad_pos_x+(PAD_WIDTH-2*(PAD_WIDTH/2/4)) &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
pad_pos_x+(PAD_WIDTH-(PAD_WIDTH/2/4)) )) {
|
|
|
|
|
|
|
|
ball[k].y = -3;
|
|
|
|
if (ball[k].pos_x != 0 &&
|
|
|
|
ball[k].pos_x+BALL!=LCD_WIDTH)
|
|
|
|
ball[k].x = pad_check(4,0,ball[k].pos_x+2<=
|
|
|
|
pad_pos_x+(PAD_WIDTH/2)?
|
|
|
|
0:1,k);
|
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
else if ((ball[k].pos_x+HALFBALL >=
|
|
|
|
pad_pos_x+2*(PAD_WIDTH/2/4) &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
pad_pos_x+3*(PAD_WIDTH/2/4)) ||
|
|
|
|
(ball[k].pos_x+2 >=
|
|
|
|
pad_pos_x+(PAD_WIDTH-3*(PAD_WIDTH/2/4)) &&
|
|
|
|
ball[k].pos_x+2 <=
|
|
|
|
pad_pos_x+ ((PAD_WIDTH/2)-2*(PAD_WIDTH/2/4)) )) {
|
|
|
|
|
|
|
|
ball[k].y = -4;
|
|
|
|
if (ball[k].pos_x != 0 &&
|
|
|
|
ball[k].pos_x+BALL!=LCD_WIDTH)
|
|
|
|
ball[k].x = pad_check(3,0,ball[k].pos_x+2<=
|
|
|
|
pad_pos_x+(PAD_WIDTH/2)?
|
|
|
|
0:1,k);
|
|
|
|
|
2006-02-15 17:37:45 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
else if ((ball[k].pos_x+HALFBALL >=
|
|
|
|
pad_pos_x+3*(PAD_WIDTH/2/4) &&
|
|
|
|
ball[k].pos_x+HALFBALL <=
|
|
|
|
pad_pos_x+4*(PAD_WIDTH/2/4)-2) ||
|
|
|
|
(ball[k].pos_x+2 >= pad_pos_x+(PAD_WIDTH/2+2) &&
|
|
|
|
ball[k].pos_x+2 <=
|
|
|
|
pad_pos_x+(PAD_WIDTH-3*(PAD_WIDTH/2/4)) )) {
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
ball[k].y = -4;
|
|
|
|
if (ball[k].pos_x != 0 &&
|
|
|
|
ball[k].pos_x+BALL!=LCD_WIDTH)
|
|
|
|
ball[k].x = pad_check(2,1,0,k);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ball[k].y = -4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
ball[k].tempy=0;
|
|
|
|
ball[k].tempx=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ball[k].pos_y+5 >= PAD_POS_Y &&
|
|
|
|
(pad_type==1 && !ball[k].glue) &&
|
|
|
|
(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) {
|
|
|
|
if (cur_level+1<levels_num) {
|
|
|
|
cur_level++;
|
|
|
|
score+=100;
|
|
|
|
int_game(1);
|
|
|
|
sleep(2);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
rb->lcd_getstringsize("Congratulations!", &sw, NULL);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_congrats,
|
|
|
|
"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);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_finsh,
|
|
|
|
"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);
|
|
|
|
rb->lcd_putsxy(LCD_WIDTH/2-sw/2, STRINGPOS_finsh,
|
|
|
|
"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();
|
|
|
|
if (score>highscore) {
|
|
|
|
sleep(2);
|
|
|
|
highscore=score;
|
|
|
|
rb->splash(HZ*2,true,"New High Score");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sleep(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(game_menu(0)) {
|
|
|
|
case 0:
|
|
|
|
life=2;
|
|
|
|
cur_level=0;
|
|
|
|
int_game(1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
con_game=1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (help(0)==1) return 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int move_button,button;
|
|
|
|
int button_right,button_left;
|
|
|
|
button=rb->button_get(false);
|
2006-07-30 03:10:09 +00:00
|
|
|
|
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
if (rb->button_hold())
|
|
|
|
button = QUIT;
|
|
|
|
#endif
|
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
move_button=rb->button_status();
|
|
|
|
|
|
|
|
button_right=((move_button & RIGHT) || (SCROLL_FWD(button)));
|
|
|
|
button_left=((move_button & LEFT) || (SCROLL_BACK(button)));
|
2006-08-27 10:17:21 +00:00
|
|
|
if ((con_game== 1 && start_game!=1) && (button_right || button_left))
|
|
|
|
continue;
|
2006-03-03 07:24:34 +00:00
|
|
|
if ((button_right && flip_sides==false) ||
|
|
|
|
(button_left && flip_sides==true)) {
|
|
|
|
if (pad_pos_x+8+PAD_WIDTH > LCD_WIDTH) {
|
|
|
|
for(k=0;k<used_balls;k++)
|
|
|
|
if (start_game==1 || ball[k].glue)
|
|
|
|
ball[k].pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH;
|
|
|
|
pad_pos_x+=LCD_WIDTH-pad_pos_x-PAD_WIDTH;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(k=0;k<used_balls;k++)
|
|
|
|
if ((start_game==1 || ball[k].glue))
|
|
|
|
ball[k].pos_x+=8;
|
|
|
|
pad_pos_x+=8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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++)
|
|
|
|
if (start_game==1 || ball[k].glue)
|
|
|
|
ball[k].pos_x-=pad_pos_x;
|
|
|
|
pad_pos_x-=pad_pos_x;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(k=0;k<used_balls;k++)
|
|
|
|
if (start_game==1 || ball[k].glue)
|
|
|
|
ball[k].pos_x-=8;
|
|
|
|
pad_pos_x-=8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
switch(button) {
|
|
|
|
case UP:
|
|
|
|
case SELECT:
|
|
|
|
if (start_game==1 && con_game!=1 && pad_type!=1) {
|
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
ball[k].y=-4;
|
|
|
|
ball[k].x=pad_pos_x+(PAD_WIDTH/2)-2>=
|
|
|
|
LCD_WIDTH/2?2:-2;
|
|
|
|
}
|
|
|
|
start_game =0;
|
|
|
|
}
|
|
|
|
else if (pad_type==1) {
|
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
if (ball[k].glue)
|
|
|
|
ball[k].glue=false;
|
|
|
|
else if (start_game==1) {
|
|
|
|
ball[k].x = x[k];
|
|
|
|
ball[k].y = y[k];
|
|
|
|
}
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
if (start_game!=1 && con_game==1) {
|
|
|
|
start_game =0;
|
|
|
|
con_game=0;
|
|
|
|
}
|
|
|
|
} else if (pad_type==2 && con_game!=1) {
|
|
|
|
int tfire;
|
|
|
|
tfire=fire_space();
|
|
|
|
fire[tfire].top=PAD_POS_Y-7;
|
|
|
|
fire[tfire].left=pad_pos_x+1;
|
|
|
|
tfire=fire_space();
|
|
|
|
fire[tfire].top=PAD_POS_Y-7;
|
|
|
|
fire[tfire].left=pad_pos_x+PAD_WIDTH-1;
|
|
|
|
} else if (con_game==1 && start_game!=1) {
|
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
ball[k].x=x[k];
|
|
|
|
ball[k].y=y[k];
|
|
|
|
}
|
|
|
|
con_game=0;
|
|
|
|
}
|
|
|
|
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:
|
|
|
|
switch(game_menu(1)) {
|
|
|
|
case 0:
|
|
|
|
life=2;
|
|
|
|
cur_level=0;
|
|
|
|
int_game(1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
for(k=0;k<used_balls;k++)
|
|
|
|
if (ball[k].x!=0 && ball[k].y !=0)
|
|
|
|
con_game=1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (help(1)==1)
|
2006-01-23 16:00:06 +00:00
|
|
|
return 1;
|
2006-03-03 07:24:34 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
if (ball[k].x!=0)
|
|
|
|
x[k]=ball[k].x;
|
|
|
|
ball[k].x=0;
|
|
|
|
if (ball[k].y!=0)
|
|
|
|
y[k]=ball[k].y;
|
|
|
|
ball[k].y=0;
|
|
|
|
}
|
2007-01-26 06:14:29 +00:00
|
|
|
|
2006-03-03 07:24:34 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2006-02-22 10:34:36 +00:00
|
|
|
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->splash(HZ*2,true,"Game Over");
|
2006-02-22 10:34:36 +00:00
|
|
|
#else
|
2006-03-03 07:24:34 +00:00
|
|
|
rb->lcd_bitmap(brickmania_gameover,LCD_WIDTH/2-55,LCD_HEIGHT-87,
|
|
|
|
110,52);
|
|
|
|
rb->lcd_update();
|
2006-02-22 10:34:36 +00:00
|
|
|
#endif
|
2006-03-03 07:24:34 +00:00
|
|
|
if (score>highscore) {
|
|
|
|
sleep(2);
|
|
|
|
highscore=score;
|
|
|
|
rb->splash(HZ*2,true,"New High Score");
|
|
|
|
} else {
|
|
|
|
sleep(3);
|
2006-01-23 16:00:06 +00:00
|
|
|
}
|
2006-03-03 07:24:34 +00:00
|
|
|
|
|
|
|
for(k=0;k<used_balls;k++) {
|
|
|
|
ball[k].x=0;
|
|
|
|
ball[k].y=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(game_menu(0)) {
|
|
|
|
case 0:
|
|
|
|
cur_level=0;
|
|
|
|
life=2;
|
|
|
|
int_game(1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
con_game=1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (help(0)==1)
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this is the plugin entry point */
|
|
|
|
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
|
|
|
{
|
|
|
|
(void)parameter;
|
|
|
|
rb = api;
|
2006-03-03 07:24:34 +00:00
|
|
|
|
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
|
2006-01-23 17:23:02 +00:00
|
|
|
/* Permanently enable the backlight (unless the user has turned it off) */
|
|
|
|
if (rb->global_settings->backlight_timeout > 0)
|
|
|
|
rb->backlight_set_timeout(1);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
/* now go ahead and have fun! */
|
2006-01-26 23:31:00 +00:00
|
|
|
while (game_loop()!=1);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
configfile_save(HIGH_SCORE,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);
|
2006-01-23 17:23:02 +00:00
|
|
|
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
2006-01-23 16:00:06 +00:00
|
|
|
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|