mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 18:47:39 -04:00
A bit of code policing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19021 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4cf9b1415b
commit
f06074cd06
1 changed files with 72 additions and 74 deletions
|
@ -455,9 +455,6 @@ static char* messages[] =
|
||||||
"The spectre of Sherlock Holmes wills you onwards.",
|
"The spectre of Sherlock Holmes wills you onwards.",
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TRUE true
|
|
||||||
#define FALSE false
|
|
||||||
|
|
||||||
#define RFK_VERSION "v1.4142135.406"
|
#define RFK_VERSION "v1.4142135.406"
|
||||||
|
|
||||||
/* Button definitions stolen from maze.c */
|
/* Button definitions stolen from maze.c */
|
||||||
|
@ -531,7 +528,7 @@ const unsigned colors[NUM_COLORS] = {
|
||||||
#define randy() (rb->rand() % (Y_MAX-Y_MIN+1))+Y_MIN /*I'm feeling randy()!*/
|
#define randy() (rb->rand() % (Y_MAX-Y_MIN+1))+Y_MIN /*I'm feeling randy()!*/
|
||||||
#define randchar() rb->rand() % (126-'!'+1)+'!';
|
#define randchar() rb->rand() % (126-'!'+1)+'!';
|
||||||
#define randcolor() rb->rand() % NUM_COLORS
|
#define randcolor() rb->rand() % NUM_COLORS
|
||||||
#define randbold() (rb->rand() % 2 ? TRUE:FALSE)
|
#define randbold() (rb->rand() % 2 ? true:false)
|
||||||
|
|
||||||
/*Row constants for the animation*/
|
/*Row constants for the animation*/
|
||||||
#define ADV_ROW 1
|
#define ADV_ROW 1
|
||||||
|
@ -540,14 +537,14 @@ const unsigned colors[NUM_COLORS] = {
|
||||||
|
|
||||||
/*This struct contains all the information we need to display an object
|
/*This struct contains all the information we need to display an object
|
||||||
on the screen*/
|
on the screen*/
|
||||||
typedef struct
|
struct screen_object
|
||||||
{
|
{
|
||||||
short x;
|
short x;
|
||||||
short y;
|
short y;
|
||||||
int color;
|
int color;
|
||||||
bool bold;
|
bool bold;
|
||||||
char character;
|
char character;
|
||||||
} screen_object;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*Function definitions
|
*Function definitions
|
||||||
|
@ -572,15 +569,15 @@ static int validchar(char);
|
||||||
static void play_animation(int);
|
static void play_animation(int);
|
||||||
|
|
||||||
/*Global variables. Bite me, it's fun.*/
|
/*Global variables. Bite me, it's fun.*/
|
||||||
screen_object robot;
|
struct screen_object robot;
|
||||||
screen_object kitten;
|
struct screen_object kitten;
|
||||||
|
|
||||||
#if X_MAX*Y_MAX < 200
|
#if X_MAX*Y_MAX < 200
|
||||||
#define NUM_BOGUS 15
|
#define NUM_BOGUS 15
|
||||||
#else
|
#else
|
||||||
#define NUM_BOGUS 20
|
#define NUM_BOGUS 20
|
||||||
#endif
|
#endif
|
||||||
screen_object bogus[NUM_BOGUS];
|
struct screen_object bogus[NUM_BOGUS];
|
||||||
unsigned short bogus_messages[NUM_BOGUS];
|
unsigned short bogus_messages[NUM_BOGUS];
|
||||||
bool used_messages[MESSAGES];
|
bool used_messages[MESSAGES];
|
||||||
|
|
||||||
|
@ -612,7 +609,7 @@ static void drawchar(int x, int y, char c)
|
||||||
rb->lcd_putsxy(x*SYSFONT_WIDTH, y*SYSFONT_HEIGHT, str);
|
rb->lcd_putsxy(x*SYSFONT_WIDTH, y*SYSFONT_HEIGHT, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw(screen_object o)
|
static void draw(struct screen_object o)
|
||||||
{
|
{
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
unsigned oldforeground;
|
unsigned oldforeground;
|
||||||
|
@ -761,8 +758,9 @@ static void pause()
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
do
|
do {
|
||||||
button = rb->button_get(true);
|
button = rb->button_get(true);
|
||||||
|
}
|
||||||
while( ( button == BUTTON_NONE )
|
while( ( button == BUTTON_NONE )
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
||||||
}
|
}
|
||||||
|
@ -782,12 +780,14 @@ static int validchar(char a)
|
||||||
static void play_animation(int input)
|
static void play_animation(int input)
|
||||||
{
|
{
|
||||||
int counter;
|
int counter;
|
||||||
screen_object left;
|
struct screen_object left;
|
||||||
screen_object right;
|
struct screen_object right;
|
||||||
/*The grand cinema scene.*/
|
/*The grand cinema scene.*/
|
||||||
rb->lcd_puts_scroll(0, ADV_ROW, " ");
|
rb->lcd_puts_scroll(0, ADV_ROW, " ");
|
||||||
|
|
||||||
if (input == RFK_RIGHT || input == RFK_DOWN || input == RFK_RRIGHT || input == RFK_RDOWN) {
|
if (input == RFK_RIGHT || input == RFK_DOWN ||
|
||||||
|
input == RFK_RRIGHT || input == RFK_RDOWN)
|
||||||
|
{
|
||||||
left = robot;
|
left = robot;
|
||||||
right = kitten;
|
right = kitten;
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ static void instructions()
|
||||||
static void initialize_arrays()
|
static void initialize_arrays()
|
||||||
{
|
{
|
||||||
unsigned int counter, counter2;
|
unsigned int counter, counter2;
|
||||||
screen_object empty;
|
struct screen_object empty;
|
||||||
|
|
||||||
/*Initialize the empty object.*/
|
/*Initialize the empty object.*/
|
||||||
empty.x = -1;
|
empty.x = -1;
|
||||||
|
@ -881,7 +881,7 @@ static void initialize_arrays()
|
||||||
#else
|
#else
|
||||||
empty.color = 0;
|
empty.color = 0;
|
||||||
#endif
|
#endif
|
||||||
empty.bold = FALSE;
|
empty.bold = false;
|
||||||
empty.character = ' ';
|
empty.character = ' ';
|
||||||
|
|
||||||
for (counter = 0; counter <= X_MAX; counter++)
|
for (counter = 0; counter <= X_MAX; counter++)
|
||||||
|
@ -913,7 +913,7 @@ static void initialize_robot()
|
||||||
|
|
||||||
robot.character = '#';
|
robot.character = '#';
|
||||||
robot.color = ROBOT_COLOR;
|
robot.color = ROBOT_COLOR;
|
||||||
robot.bold = FALSE;
|
robot.bold = false;
|
||||||
screen[robot.x][robot.y] = ROBOT;
|
screen[robot.x][robot.y] = ROBOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,8 +921,7 @@ static void initialize_robot()
|
||||||
static void initialize_kitten()
|
static void initialize_kitten()
|
||||||
{
|
{
|
||||||
/*Assign the kitten a unique position.*/
|
/*Assign the kitten a unique position.*/
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
kitten.x = randx();
|
kitten.x = randx();
|
||||||
kitten.y = randy();
|
kitten.y = randy();
|
||||||
} while (screen[kitten.x][kitten.y] != EMPTY);
|
} while (screen[kitten.x][kitten.y] != EMPTY);
|
||||||
|
@ -953,8 +952,7 @@ static void initialize_bogus()
|
||||||
} while (!(validchar(bogus[counter].character)));
|
} while (!(validchar(bogus[counter].character)));
|
||||||
|
|
||||||
/*Give it a position.*/
|
/*Give it a position.*/
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
bogus[counter].x = randx();
|
bogus[counter].x = randx();
|
||||||
bogus[counter].y = randy();
|
bogus[counter].y = randy();
|
||||||
} while (screen[bogus[counter].x][bogus[counter].y] != EMPTY);
|
} while (screen[bogus[counter].x][bogus[counter].y] != EMPTY);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue