forked from len0rd/rockbox
fix wrong score recording.
change menu a bit. now game is saved by default when quit, and not saved when "Quit without Saving" is selected. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21903 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
844b2147ee
commit
38754e7a9e
1 changed files with 29 additions and 27 deletions
|
@ -608,13 +608,6 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
|
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
|
||||||
((LCD_HEIGHT-10)-18)*tempscore/size+1);
|
((LCD_HEIGHT-10)-18)*tempscore/size+1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bj->type == GAME_TYPE_NORMAL) {
|
|
||||||
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
|
||||||
rb->lcd_getstringsize(str, &w, &h);
|
|
||||||
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2,
|
|
||||||
LCD_HEIGHT-8, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print text */
|
/* print text */
|
||||||
rb->lcd_getstringsize(title, &w, &h);
|
rb->lcd_getstringsize(title, &w, &h);
|
||||||
|
@ -623,6 +616,12 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
rb->lcd_getstringsize(str, &w, &h);
|
rb->lcd_getstringsize(str, &w, &h);
|
||||||
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2, 10, str);
|
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2, 10, str);
|
||||||
|
|
||||||
|
if (bj->type == GAME_TYPE_NORMAL) {
|
||||||
|
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
||||||
|
rb->lcd_getstringsize(str, &w, &h);
|
||||||
|
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2,
|
||||||
|
LCD_HEIGHT-8, str);
|
||||||
|
}
|
||||||
|
|
||||||
#elif LCD_WIDTH < LCD_HEIGHT /* vertical layout */
|
#elif LCD_WIDTH < LCD_HEIGHT /* vertical layout */
|
||||||
|
|
||||||
|
@ -653,15 +652,15 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2);
|
(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* print text */
|
||||||
|
rb->snprintf(str, 10, "%s %d", title, bj->level);
|
||||||
|
rb->lcd_putsxy(1, LCD_HEIGHT-10, str);
|
||||||
|
|
||||||
if (bj->type == GAME_TYPE_NORMAL) {
|
if (bj->type == GAME_TYPE_NORMAL) {
|
||||||
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
||||||
rb->lcd_getstringsize(str, &w, &h);
|
rb->lcd_getstringsize(str, &w, &h);
|
||||||
rb->lcd_putsxy((LCD_WIDTH-2)-w, LCD_HEIGHT-10, str);
|
rb->lcd_putsxy((LCD_WIDTH-2)-w, LCD_HEIGHT-10, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print text */
|
|
||||||
rb->snprintf(str, 10, "%s %d", title, bj->level);
|
|
||||||
rb->lcd_putsxy(1, LCD_HEIGHT-10, str);
|
|
||||||
|
|
||||||
|
|
||||||
#else /* square layout */
|
#else /* square layout */
|
||||||
|
@ -694,6 +693,10 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
|
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
|
||||||
(8*TILE_HEIGHT+YOFS)*tempscore/size+1);
|
(8*TILE_HEIGHT+YOFS)*tempscore/size+1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* print text */
|
||||||
|
rb->snprintf(str, 10, "%s %d", title, bj->level);
|
||||||
|
rb->lcd_putsxy(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str);
|
||||||
|
|
||||||
if (bj->type == GAME_TYPE_NORMAL) {
|
if (bj->type == GAME_TYPE_NORMAL) {
|
||||||
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
||||||
|
@ -702,10 +705,6 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str);
|
LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print text */
|
|
||||||
rb->snprintf(str, 10, "%s %d", title, bj->level);
|
|
||||||
rb->lcd_putsxy(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str);
|
|
||||||
|
|
||||||
#endif /* layout */
|
#endif /* layout */
|
||||||
|
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
@ -1363,7 +1362,7 @@ static void jewels_show_highscores(int position)
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jewels_help(void)
|
static bool jewels_help(void)
|
||||||
{
|
{
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
#define WORDS (sizeof help_text / sizeof (char*))
|
||||||
|
@ -1387,26 +1386,27 @@ static int jewels_help(void)
|
||||||
static struct style_text formation[]={
|
static struct style_text formation[]={
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
|
{ 42, C_RED },
|
||||||
{ -1, 0 }
|
{ -1, 0 }
|
||||||
};
|
};
|
||||||
|
int button;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
rb->lcd_set_background(LCD_BLACK);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
#endif
|
#endif
|
||||||
if (display_text(WORDS, help_text, formation, NULL)==PLUGIN_USB_CONNECTED)
|
if (display_text(WORDS, help_text, formation, NULL))
|
||||||
return PLUGIN_USB_CONNECTED;
|
return true;
|
||||||
int button;
|
|
||||||
do {
|
do {
|
||||||
button = rb->button_get(true);
|
button = rb->button_get(true);
|
||||||
if (button == SYS_USB_CONNECTED) {
|
if (rb->default_event_handler (button) == SYS_USB_CONNECTED) {
|
||||||
return PLUGIN_USB_CONNECTED;
|
return true;
|
||||||
}
|
}
|
||||||
} while( ( button == BUTTON_NONE )
|
} while( ( button == BUTTON_NONE )
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _ingame;
|
static bool _ingame;
|
||||||
|
@ -1440,7 +1440,7 @@ static int jewels_game_menu(struct game_context* bj, bool ingame)
|
||||||
"Help",
|
"Help",
|
||||||
"High Score",
|
"High Score",
|
||||||
"Playback Control",
|
"Playback Control",
|
||||||
"Save and Quit",
|
"Quit without Saving",
|
||||||
"Quit");
|
"Quit");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -1455,7 +1455,8 @@ static int jewels_game_menu(struct game_context* bj, bool ingame)
|
||||||
rb->set_option("Mode", &bj->tmp_type, INT, mode, 2, NULL);
|
rb->set_option("Mode", &bj->tmp_type, INT, mode, 2, NULL);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
jewels_help();
|
if(jewels_help())
|
||||||
|
return 1;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
jewels_show_highscores(NUM_SCORES);
|
jewels_show_highscores(NUM_SCORES);
|
||||||
|
@ -1464,13 +1465,13 @@ static int jewels_game_menu(struct game_context* bj, bool ingame)
|
||||||
playback_control(NULL);
|
playback_control(NULL);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
return 1;
|
||||||
|
case 7:
|
||||||
if (ingame) {
|
if (ingame) {
|
||||||
rb->splash(HZ*1, "Saving game ...");
|
rb->splash(HZ*1, "Saving game ...");
|
||||||
jewels_savegame(bj);
|
jewels_savegame(bj);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case 7:
|
|
||||||
return 1;
|
|
||||||
case MENU_ATTACHED_USB:
|
case MENU_ATTACHED_USB:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
|
@ -1622,6 +1623,7 @@ static int jewels_main(struct game_context* bj) {
|
||||||
case GAME_TYPE_NORMAL:
|
case GAME_TYPE_NORMAL:
|
||||||
rb->splash(HZ*2, "Game Over!");
|
rb->splash(HZ*2, "Game Over!");
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
|
bj->score += (bj->level-1)*LEVEL_PTS;
|
||||||
if (highscore_would_update(bj->score, highest,
|
if (highscore_would_update(bj->score, highest,
|
||||||
NUM_SCORES)) {
|
NUM_SCORES)) {
|
||||||
position=highscore_update(bj->score,
|
position=highscore_update(bj->score,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue