2010-01-21 14:45:16 +00:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
|
|
|
*
|
|
|
|
* Author & Copyright (C) 2010: Soeren Heisrath (forename@surename.org)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-01-15 14:42:46 +00:00
|
|
|
#include "common.h"
|
2010-01-21 21:26:30 +00:00
|
|
|
static void borg_breakout();
|
2010-01-15 12:19:54 +00:00
|
|
|
|
2010-01-15 12:52:15 +00:00
|
|
|
#ifdef MENU_SUPPORT
|
2010-01-15 16:02:31 +00:00
|
|
|
//static uint8_t breakout_icon[8] PROGMEM = {0x03, 0x03, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00}; /* our Icon */
|
2010-01-21 13:40:40 +00:00
|
|
|
static uint8_t breakout_icon[8] PROGMEM = {0x00, 0x18, 0x18, 0x00, 0x00, 0xff, 0xff, 0x00}; /* our Icon */
|
2010-01-15 12:19:54 +00:00
|
|
|
|
2010-01-15 14:42:46 +00:00
|
|
|
game_descriptor_t breakout_game_descriptor __attribute__((section(".game_descriptors"))) =
|
|
|
|
{
|
2010-01-15 12:19:54 +00:00
|
|
|
&borg_breakout,
|
2010-01-15 16:02:31 +00:00
|
|
|
breakout_icon
|
2010-01-15 12:19:54 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void borg_breakout()
|
|
|
|
{
|
2010-01-21 21:26:30 +00:00
|
|
|
uint8_t level = 0;
|
2010-01-15 12:19:54 +00:00
|
|
|
ball_t balls[1];
|
|
|
|
|
2010-01-19 09:55:28 +00:00
|
|
|
/* spawn a ball in the middle bottom of the field, let it move upwards with random speed & direction */
|
2010-01-21 13:40:40 +00:00
|
|
|
ball_spawn_default(&(balls[0]));
|
|
|
|
balls[0].strength = START_LIFES;
|
|
|
|
level_init(level);
|
2010-01-19 09:55:28 +00:00
|
|
|
rebound_init();
|
2010-01-15 12:19:54 +00:00
|
|
|
|
2010-01-19 19:44:16 +00:00
|
|
|
while (23)
|
2010-01-15 12:19:54 +00:00
|
|
|
{
|
2010-01-15 16:02:31 +00:00
|
|
|
wait(50);
|
2010-01-15 14:42:46 +00:00
|
|
|
rebound_tick();
|
2010-01-19 19:44:16 +00:00
|
|
|
ball_think(&(balls[0]));
|
2010-01-15 12:19:54 +00:00
|
|
|
playfield_draw();
|
2010-01-19 19:44:16 +00:00
|
|
|
ball_draw(&(balls[0]));
|
|
|
|
if (!balls[0].strength)
|
|
|
|
{
|
|
|
|
print_score();
|
|
|
|
break;
|
|
|
|
}
|
2010-01-21 13:40:40 +00:00
|
|
|
|
|
|
|
if (!level_getscorediff())
|
|
|
|
{
|
|
|
|
level++;
|
|
|
|
/* respawn ball at rebound position */
|
|
|
|
ball_spawn_default (&(balls[0]));
|
|
|
|
balls[0].strength++;
|
|
|
|
level_init(level);
|
2010-01-23 20:15:45 +00:00
|
|
|
rebound_init();
|
2010-01-21 13:40:40 +00:00
|
|
|
}
|
2010-01-15 12:19:54 +00:00
|
|
|
}
|
|
|
|
}
|