diff options
author | Johannes Schwarz <ubuntuxer@rockbox.org> | 2009-07-18 15:16:24 +0000 |
---|---|---|
committer | Johannes Schwarz <ubuntuxer@rockbox.org> | 2009-07-18 15:16:24 +0000 |
commit | 99f52999968eb56e8fc9cabbf2ab4f65943ce678 (patch) | |
tree | 0e87625df1579f27b3f43141d8a2d20f7b8df248 /apps/plugins/clix.c | |
parent | 03cb2b83ae17d9118ddee69908389fb4cd0484a6 (diff) | |
download | rockbox-99f52999968eb56e8fc9cabbf2ab4f65943ce678.tar.gz rockbox-99f52999968eb56e8fc9cabbf2ab4f65943ce678.zip |
Commit FS#10350, prevents to save an unchanged highscore and move the function show_highscore to the lib
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21960 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/clix.c')
-rw-r--r-- | apps/plugins/clix.c | 70 |
1 files changed, 9 insertions, 61 deletions
diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c index e0cf88bf08..5a4f683e84 100644 --- a/apps/plugins/clix.c +++ b/apps/plugins/clix.c | |||
@@ -242,56 +242,6 @@ enum { | |||
242 | CC_DARK_GREEN | 242 | CC_DARK_GREEN |
243 | }; | 243 | }; |
244 | 244 | ||
245 | /* display the highscore list and highlight the last one */ | ||
246 | static void clix_show_highscores(int position) | ||
247 | { | ||
248 | int i, w, h; | ||
249 | char str[30]; | ||
250 | |||
251 | #ifdef HAVE_LCD_COLOR | ||
252 | rb->lcd_set_background(LCD_BLACK); | ||
253 | rb->lcd_set_foreground(LCD_WHITE); | ||
254 | #endif | ||
255 | rb->button_clear_queue(); | ||
256 | rb->lcd_clear_display(); | ||
257 | |||
258 | rb->lcd_setfont(FONT_UI); | ||
259 | rb->lcd_getstringsize("High Scores", &w, &h); | ||
260 | /* check wether it fits on screen */ | ||
261 | if ((4*h + h*(NUM_SCORES-1) + MARGIN) > LCD_HEIGHT) { | ||
262 | rb->lcd_setfont(FONT_SYSFIXED); | ||
263 | rb->lcd_getstringsize("High Scores", &w, &h); | ||
264 | } | ||
265 | rb->lcd_putsxy(LCD_WIDTH/2-w/2, MARGIN, "High Scores"); | ||
266 | rb->lcd_putsxy(LCD_WIDTH/4-w/4,2*h, "Score"); | ||
267 | rb->lcd_putsxy(LCD_WIDTH*3/4-w/4,2*h, "Level"); | ||
268 | |||
269 | for (i = 0; i<NUM_SCORES; i++) | ||
270 | { | ||
271 | #ifdef HAVE_LCD_COLOR | ||
272 | if (i == position) { | ||
273 | rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); | ||
274 | } | ||
275 | #endif | ||
276 | rb->snprintf (str, sizeof (str), "%d)", i+1); | ||
277 | rb->lcd_putsxy (MARGIN,3*h + h*i, str); | ||
278 | rb->snprintf (str, sizeof (str), "%d", highest[i].score); | ||
279 | rb->lcd_putsxy (LCD_WIDTH/4-w/4,3*h + h*i, str); | ||
280 | rb->snprintf (str, sizeof (str), "%d", highest[i].level); | ||
281 | rb->lcd_putsxy (LCD_WIDTH*3/4-w/4,3*h + h*i, str); | ||
282 | if(i == position) { | ||
283 | #ifdef HAVE_LCD_COLOR | ||
284 | rb->lcd_set_foreground(LCD_WHITE); | ||
285 | #else | ||
286 | rb->lcd_hline(MARGIN, LCD_WIDTH-MARGIN, 3*h + h*(i+1)); | ||
287 | #endif | ||
288 | } | ||
289 | } | ||
290 | rb->lcd_update(); | ||
291 | rb->button_get(true); | ||
292 | rb->lcd_setfont(FONT_SYSFIXED); | ||
293 | } | ||
294 | |||
295 | /* recursive function to check if a neighbour cell is of the same color | 245 | /* recursive function to check if a neighbour cell is of the same color |
296 | if so call the function with the neighbours position | 246 | if so call the function with the neighbours position |
297 | */ | 247 | */ |
@@ -671,7 +621,7 @@ static int clix_menu(struct clix_game_state_t* state, bool ingame) | |||
671 | return 1; | 621 | return 1; |
672 | break; | 622 | break; |
673 | case 3: | 623 | case 3: |
674 | clix_show_highscores(NUM_SCORES); | 624 | highscore_show(NUM_SCORES, highest, NUM_SCORES); |
675 | break; | 625 | break; |
676 | case 4: | 626 | case 4: |
677 | playback_control(NULL); | 627 | playback_control(NULL); |
@@ -827,16 +777,14 @@ static int clix_handle_game(struct clix_game_state_t* state) | |||
827 | clix_draw( state); | 777 | clix_draw( state); |
828 | rb->splash(HZ*2, "Game Over!"); | 778 | rb->splash(HZ*2, "Game Over!"); |
829 | rb->lcd_clear_display(); | 779 | rb->lcd_clear_display(); |
830 | if (highscore_would_update(state->score, | 780 | position=highscore_update(state->score, |
831 | highest, NUM_SCORES)) { | 781 | state->level, "", |
832 | position=highscore_update(state->score, | 782 | highest,NUM_SCORES); |
833 | state->level, "", | 783 | if (position == 0) |
834 | highest,NUM_SCORES); | 784 | rb->splash(HZ*2, "New High Score"); |
835 | if (position == 0) { | 785 | if (position != -1) |
836 | rb->splash(HZ*2, "New High Score"); | 786 | highscore_show(position, highest, |
837 | } | 787 | NUM_SCORES); |
838 | clix_show_highscores(position); | ||
839 | } | ||
840 | if (clix_menu(state, 0)) | 788 | if (clix_menu(state, 0)) |
841 | return 1; | 789 | return 1; |
842 | break; | 790 | break; |