summaryrefslogtreecommitdiff
path: root/uisimulator/tetris.c
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2002-05-03 05:27:49 +0000
committerRobert Hak <adiamas@rockbox.org>2002-05-03 05:27:49 +0000
commit9433a8e7bf5a50cbd3c59262eee8fee3e1a6b5d6 (patch)
treee3b338169ce52385cb1cd0ab889f00122d2fae8a /uisimulator/tetris.c
parent67dc94786b5e6e11337ffdcee893b5c5ef7a8f8b (diff)
Fixed global values for tetris game not being reset. This prevented you
from playing another game if you lost your first. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@396 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/tetris.c')
-rw-r--r--uisimulator/tetris.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/uisimulator/tetris.c b/uisimulator/tetris.c
index 5cf1e1068d..18cf36a575 100644
--- a/uisimulator/tetris.c
+++ b/uisimulator/tetris.c
@@ -324,8 +324,28 @@ void game_loop(void)
}
}
+void init_tetris()
+{
+ memset(&virtual, 0, sizeof(virtual));
+ start_x = 1;
+ start_y = 1;
+ max_x = 14;
+ max_y = 24;
+ current_x = 0;
+ current_y = 0;
+ current_f = 0;
+ current_b = 0;
+ level = 0;
+ lines = 0;
+ score = 0;
+ next_b = 0;
+ next_f = 0;
+}
+
void tetris(void)
{
+ init_tetris();
+
draw_frame(start_x-1,start_x+max_x,start_y-1,start_y+max_y);
lcd_puts(TETRIS_TITLE_XLOC, TETRIS_TITLE_YLOC,
TETRIS_TITLE, TETRIS_TITLE_FONT);