summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-20 09:32:33 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-20 09:32:33 +0000
commit28bb3033a5c5ca991fb04692608c2e828eb7ecbf (patch)
treef656f678dcaf0582af23048b2483f393e408d043 /apps/recorder
parent80ed0ce1dbb1a613fc15219c9544b397015d5504 (diff)
downloadrockbox-28bb3033a5c5ca991fb04692608c2e828eb7ecbf.zip
rockbox-28bb3033a5c5ca991fb04692608c2e828eb7ecbf.tar.gz
rockbox-28bb3033a5c5ca991fb04692608c2e828eb7ecbf.tar.bz2
rockbox-28bb3033a5c5ca991fb04692608c2e828eb7ecbf.tar.xz
Added level speeds. Cleaned up variables.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1119 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/tetris.c66
1 files changed, 29 insertions, 37 deletions
diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c
index aa96a55..e22c4f0 100644
--- a/apps/recorder/tetris.c
+++ b/apps/recorder/tetris.c
@@ -38,23 +38,19 @@
#define TETRIS_TITLE_XLOC 43
#define TETRIS_TITLE_YLOC 15
-int start_x = 2;
-int start_y = 1;
-int max_x = 28;
-int max_y = 48;
-int current_x = 0;
-int current_y = 0;
-int current_f = 0;
-int current_b = 0;
-int level = 0;
-short lines = 0;
-int score = 0;
-int next_b = 0;
-int next_f = 0;
-char virtual[LCD_WIDTH*LCD_HEIGHT];
-short level_speeds[10] = {1000,900,800,700,600,500,400,300,250,200};
-int blocks = 7;
-int block_frames[7] = {1,2,2,2,4,4,4};
+static const int start_x = 2;
+static const int start_y = 1;
+static const int max_x = 28;
+static const int max_y = 48;
+static const short level_speeds[10] = {1000,900,800,700,600,500,400,300,250,200};
+static const int blocks = 7;
+static const int block_frames[7] = {1,2,2,2,4,4,4};
+
+static int current_x, current_y, current_f, current_b;
+static int level, score;
+static int next_b, next_f;
+static short lines;
+static char virtual[LCD_WIDTH*LCD_HEIGHT];
/*
block_data is built up the following way
@@ -70,7 +66,7 @@ int block_frames[7] = {1,2,2,2,4,4,4};
with block_data
*/
-int block_data[7][4][2][4] =
+static const char block_data[7][4][2][4] =
{
{
{{0,1,0,1},{0,0,1,1}}
@@ -332,11 +328,11 @@ void game_loop(void)
{
int b=0;
int count = 0;
- /* while(count*20 < level_speeds[level]) */
+ while(count*300 < level_speeds[level])
{
b = button_get(false);
if ( b & BUTTON_OFF )
- return; /* get out of here */
+ return; /* get out of here */
if ( b & BUTTON_LEFT ) {
move_block(-2,0,0);
@@ -353,19 +349,19 @@ void game_loop(void)
count++;
sleep(HZ/10);
}
- if(gameover()) {
- int w, h;
-
- lcd_getfontsize(TETRIS_TITLE_FONT, &w, &h);
- lcd_clearrect(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC,
- TETRIS_TITLE_XLOC+(w*sizeof(TETRIS_TITLE)),
- TETRIS_TITLE_YLOC-h);
- lcd_putsxy(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, "You lose!",
- TETRIS_TITLE_FONT);
- lcd_update();
- sleep(HZ);
- return;
- }
+ if(gameover()) {
+ int w, h;
+
+ lcd_getfontsize(TETRIS_TITLE_FONT, &w, &h);
+ lcd_clearrect(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC,
+ TETRIS_TITLE_XLOC+(w*sizeof(TETRIS_TITLE)),
+ TETRIS_TITLE_YLOC-h);
+ lcd_putsxy(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC, "You lose!",
+ TETRIS_TITLE_FONT);
+ lcd_update();
+ sleep(HZ);
+ return;
+ }
move_down();
}
}
@@ -373,10 +369,6 @@ void game_loop(void)
void init_tetris(void)
{
memset(&virtual, 0, sizeof(virtual));
- start_x = 2;
- start_y = 1;
- max_x = 28;
- max_y = 48;
current_x = 0;
current_y = 0;
current_f = 0;