summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/xobox.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index fbcb321d4a..29835a26eb 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -173,7 +173,9 @@ PLUGIN_HEADER
173 to speed up the game - note that current_tick is (currently) only accurate 173 to speed up the game - note that current_tick is (currently) only accurate
174 to 10ms. 174 to 10ms.
175*/ 175*/
176#define CYCLETIME 50 176static int speed = 6; /* CYCLETIME = (11-speed)*10 ms */
177static int difficulty = 75; /* Percentage of screen that needs to be filled
178 * in order to win the game */
177 179
178static struct plugin_api *rb; 180static struct plugin_api *rb;
179static bool quit = false; 181static bool quit = false;
@@ -741,7 +743,7 @@ static inline void move_board (void)
741 player.i = newi; 743 player.i = newi;
742 player.j = newj; 744 player.j = newj;
743 } 745 }
744 if (percentage_cache > 75) { /* finished level */ 746 if (percentage_cache > difficulty) { /* finished level */
745 rb->splash (HZ * 2, "Level %d finished", player.level+1); 747 rb->splash (HZ * 2, "Level %d finished", player.level+1);
746 player.score += percentage_cache; 748 player.score += percentage_cache;
747 if (player.level < MAX_LEVEL) 749 if (player.level < MAX_LEVEL)
@@ -755,7 +757,8 @@ static inline void move_board (void)
755/* the main menu */ 757/* the main menu */
756static int game_menu (void) 758static int game_menu (void)
757{ 759{
758 MENUITEM_STRINGLIST(menu, "XOBOX Menu", NULL, "Start New Game", "Quit"); 760 MENUITEM_STRINGLIST(menu, "XOBOX Menu", NULL, "Start New Game",
761 "Speed","Difficulty","Quit");
759 int selection = 0; 762 int selection = 0;
760#ifdef HAVE_LCD_COLOR 763#ifdef HAVE_LCD_COLOR
761 rb->lcd_set_foreground (rb->global_settings->fg_color); 764 rb->lcd_set_foreground (rb->global_settings->fg_color);
@@ -764,9 +767,17 @@ static int game_menu (void)
764 rb->lcd_set_foreground(LCD_BLACK); 767 rb->lcd_set_foreground(LCD_BLACK);
765 rb->lcd_set_background(LCD_WHITE); 768 rb->lcd_set_background(LCD_WHITE);
766#endif 769#endif
767 selection = rb->do_menu(&menu, NULL); 770 for (;;) {
768 if (selection < 0) 771 rb->do_menu(&menu,&selection);
769 { 772 if (selection==1)
773 rb->set_int ("Speed", "", UNIT_INT, &speed, NULL, 1, 1, 11, NULL);
774 else if (selection==2)
775 rb->set_int ("Difficulty", "", UNIT_INT, &difficulty, NULL,
776 5, 50, 95, NULL);
777 else
778 break;
779 }
780 if (selection != MENU_START) {
770 selection = MENU_QUIT; 781 selection = MENU_QUIT;
771 } 782 }
772 return selection; 783 return selection;
@@ -794,7 +805,7 @@ static int xobox_loop (void)
794 int end; 805 int end;
795 806
796 while (!quit) { 807 while (!quit) {
797 end = *rb->current_tick + (CYCLETIME * HZ) / 1000; 808 end = *rb->current_tick + ((11-speed)*HZ)/100;
798 809
799#ifdef HAS_BUTTON_HOLD 810#ifdef HAS_BUTTON_HOLD
800 if (rb->button_hold()) { 811 if (rb->button_hold()) {