diff options
author | Alexander Levin <al.le@rockbox.org> | 2009-06-30 20:00:46 +0000 |
---|---|---|
committer | Alexander Levin <al.le@rockbox.org> | 2009-06-30 20:00:46 +0000 |
commit | 6a5245ae08e35bd90436ddb97a8c7fbfea89b1fd (patch) | |
tree | 1238b06f8a88573c3fe0c4a5c31c09892e263306 /apps/plugins/rockblox.c | |
parent | e905ca61d4a2d90d9a2fac0ae1b70c55451eaf88 (diff) | |
download | rockbox-6a5245ae08e35bd90436ddb97a8c7fbfea89b1fd.tar.gz rockbox-6a5245ae08e35bd90436ddb97a8c7fbfea89b1fd.zip |
Improve the highscore related functions in plugin lib (FS#10350)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21578 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/rockblox.c')
-rw-r--r-- | apps/plugins/rockblox.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 7aaf26fe03..9b4987747d 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c | |||
@@ -723,7 +723,7 @@ figures[BLOCKS_NUM] = { | |||
723 | #define MAX_HIGH_SCORES 5 | 723 | #define MAX_HIGH_SCORES 5 |
724 | 724 | ||
725 | /* Default High Scores... */ | 725 | /* Default High Scores... */ |
726 | struct highscore Highest[MAX_HIGH_SCORES]; | 726 | struct highscore highest[MAX_HIGH_SCORES]; |
727 | 727 | ||
728 | /* get random number from (0) to (range-1) */ | 728 | /* get random number from (0) to (range-1) */ |
729 | static int t_rand (int range) | 729 | static int t_rand (int range) |
@@ -776,10 +776,11 @@ static void show_highscores (void) | |||
776 | int i; | 776 | int i; |
777 | char str[25]; /* for strings */ | 777 | char str[25]; /* for strings */ |
778 | 778 | ||
779 | for (i = MAX_HIGH_SCORES-1; i>=0; i--) | 779 | for (i = 0; i<MAX_HIGH_SCORES; i++) |
780 | { | 780 | { |
781 | rb->snprintf (str, sizeof (str), "%06d" _SPACE "L%1d",Highest[i].score, Highest[i].level); | 781 | rb->snprintf (str, sizeof (str), "%06d" _SPACE "L%1d", |
782 | rb->lcd_putsxy (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * ((MAX_HIGH_SCORES-1) - i)), str); | 782 | highest[i].score, highest[i].level); |
783 | rb->lcd_putsxy (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * i), str); | ||
783 | } | 784 | } |
784 | } | 785 | } |
785 | #endif | 786 | #endif |
@@ -831,8 +832,17 @@ fail: | |||
831 | } | 832 | } |
832 | static void init_rockblox (bool resume) | 833 | static void init_rockblox (bool resume) |
833 | { | 834 | { |
834 | highscore_update(rockblox_status.score, rockblox_status.level, Highest, | 835 | char score_name[50]; |
835 | MAX_HIGH_SCORES); | 836 | struct tm* tm; |
837 | |||
838 | tm = rb->get_time(); | ||
839 | rb->snprintf(score_name, sizeof(score_name), "%04d%02d%02d %02d%02d%02d", | ||
840 | tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, | ||
841 | tm->tm_hour, tm->tm_min, tm->tm_sec); | ||
842 | |||
843 | highscore_update(rockblox_status.score, rockblox_status.level, | ||
844 | score_name, highest, MAX_HIGH_SCORES); | ||
845 | |||
836 | #ifdef HAVE_LCD_BITMAP | 846 | #ifdef HAVE_LCD_BITMAP |
837 | rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); | 847 | rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); |
838 | #else /* HAVE_LCD_CHARCELLS */ | 848 | #else /* HAVE_LCD_CHARCELLS */ |
@@ -1332,7 +1342,7 @@ enum plugin_status plugin_start (const void *parameter) | |||
1332 | rb->srand (*rb->current_tick); | 1342 | rb->srand (*rb->current_tick); |
1333 | 1343 | ||
1334 | /* Load HighScore if any */ | 1344 | /* Load HighScore if any */ |
1335 | highscore_load(HIGH_SCORE,Highest,MAX_HIGH_SCORES); | 1345 | highscore_load(HIGH_SCORE, highest, MAX_HIGH_SCORES); |
1336 | 1346 | ||
1337 | #if LCD_DEPTH > 1 | 1347 | #if LCD_DEPTH > 1 |
1338 | rb->lcd_set_backdrop(NULL); | 1348 | rb->lcd_set_backdrop(NULL); |
@@ -1357,7 +1367,7 @@ enum plugin_status plugin_start (const void *parameter) | |||
1357 | pgfx_release(); | 1367 | pgfx_release(); |
1358 | #endif | 1368 | #endif |
1359 | /* Save user's HighScore */ | 1369 | /* Save user's HighScore */ |
1360 | highscore_save(HIGH_SCORE,Highest,MAX_HIGH_SCORES); | 1370 | highscore_save(HIGH_SCORE, highest, MAX_HIGH_SCORES); |
1361 | backlight_use_settings(); /* backlight control in lib/helper.c */ | 1371 | backlight_use_settings(); /* backlight control in lib/helper.c */ |
1362 | 1372 | ||
1363 | dump_resume(); | 1373 | dump_resume(); |