2010-01-29 01:34:24 +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)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#ifndef PLAYFIELD_H
|
|
|
|
#define PLAYFIELD_H
|
|
|
|
|
|
|
|
#define BOUNCE_NONE 0x00
|
|
|
|
#define BOUNCE_X 0x01
|
|
|
|
#define BOUNCE_Y 0x02
|
|
|
|
#define BOUNCE_UNDEF 0x04
|
|
|
|
#define BOUNCE_BRICK 0x08
|
|
|
|
#define BOUNCE_REBOUND 0x10
|
|
|
|
|
|
|
|
/* entries for the playing field */
|
2011-02-25 04:31:34 +00:00
|
|
|
enum game_field
|
2010-01-29 01:34:24 +00:00
|
|
|
{
|
|
|
|
sp = 0, /* space */
|
|
|
|
b1 = 1, b2 = 2, b3 = 3, /* bricks */
|
|
|
|
bs = 4, /* solid (unbreakable) brick */
|
|
|
|
bl, /* ball */
|
|
|
|
rb /* rebound */
|
|
|
|
};
|
2011-02-25 04:31:34 +00:00
|
|
|
#ifdef NDEBUG
|
|
|
|
typedef uint8_t game_field_t;
|
|
|
|
#else
|
|
|
|
typedef enum game_field game_field_t;
|
|
|
|
#endif
|
2010-01-29 01:34:24 +00:00
|
|
|
|
2011-02-25 04:31:34 +00:00
|
|
|
|
|
|
|
extern game_field_t (*playfield)[NUM_COLS][NUM_ROWS];
|
2010-01-29 01:34:24 +00:00
|
|
|
|
|
|
|
/* @description draw the current field
|
|
|
|
*/
|
|
|
|
void playfield_draw();
|
|
|
|
|
|
|
|
/* @description set a field with given property.
|
|
|
|
*/
|
2011-02-25 04:31:34 +00:00
|
|
|
void playfield_set (uint8_t in_x, uint8_t in_y, game_field_t in_field);
|
2010-01-29 01:34:24 +00:00
|
|
|
|
|
|
|
/* @description Checks if there is an object in the way. If so, it returns 1
|
|
|
|
*/
|
|
|
|
uint8_t check_bounce (int8_t in_x, int8_t in_y);
|
|
|
|
|
|
|
|
#endif /* PLAYFIELD_H */
|