X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=ball%2Fst_done.c;h=ad832b1255dacf2da75da22a1f9151ade8ee2059;hb=428f34e4b4486c5e3714abdbcc234b05215c8e4a;hp=fc5f945b5f6a996204fe555affbaebb1def099eb;hpb=ed6b151bb808501f7e15cd2591a219282fc4c2b9;p=neverball diff --git a/ball/st_done.c b/ball/st_done.c index fc5f945..ad832b1 100644 --- a/ball/st_done.c +++ b/ball/st_done.c @@ -19,7 +19,7 @@ #include "game.h" #include "util.h" #include "demo.h" -#include "levels.h" +#include "progress.h" #include "audio.h" #include "config.h" #include "st_shared.h" @@ -31,11 +31,11 @@ /*---------------------------------------------------------------------------*/ #define DONE_OK 1 -#define DONE_NAME 2 /* Bread crumbs. */ static int new_name; +static int resume; static int done_action(int i) { @@ -46,9 +46,16 @@ static int done_action(int i) case DONE_OK: return goto_state(&st_start); - case DONE_NAME: + case GUI_NAME: new_name = 1; return goto_name(&st_done, &st_done, 0); + + case GUI_MOST_COINS: + case GUI_BEST_TIMES: + case GUI_UNLOCK_GOAL: + gui_score_set(i); + resume = 1; + return goto_state(&st_done); } return 1; } @@ -60,11 +67,11 @@ static int done_enter(void) int id, jd; - int high = (curr_lg()->times_rank < 3) || (curr_lg()->score_rank < 3); + int high = progress_set_high(); if (new_name) { - level_update_player_name(); + progress_rename(1); new_name = 0; } @@ -79,34 +86,38 @@ static int done_enter(void) gui_space(id); - if ((jd = gui_harray(id))) - { - gui_most_coins(jd, 1); - gui_best_times(jd, 1); - } + if ((jd = gui_hstack(id))) + gui_score_board(jd, GUI_MOST_COINS | + GUI_BEST_TIMES, 1, high); gui_space(id); - if ((jd = gui_harray(id))) - { - /* FIXME, I'm ugly. */ - - if (high) - gui_state(jd, _("Change Player Name"), GUI_SML, DONE_NAME, 0); + gui_start(id, _("Select Level"), GUI_SML, DONE_OK, 0); - gui_start(jd, _("OK"), GUI_SML, DONE_OK, 0); - } + if (!resume) + gui_pulse(gid, 1.2f); gui_layout(id, 0, 0); - gui_pulse(gid, 1.2f); } - set_best_times(set_time_score(curr_set()), curr_lg()->times_rank, 0); - set_most_coins(set_coin_score(curr_set()), curr_lg()->score_rank); + set_score_board(set_coin_score(curr_set()), progress_score_rank(), + set_time_score(curr_set()), progress_times_rank(), + set_time_score(curr_set()), progress_times_rank()); + + /* Reset hack. */ + resume = 0; return id; } +static int done_keybd(int c, int d) +{ + if (d && config_tst_d(CONFIG_KEY_SCORE_NEXT, c)) + return done_action(gui_score_next(gui_score_get())); + + return 1; +} + static int done_buttn(int b, int d) { if (d) @@ -130,7 +141,7 @@ struct state st_done = { shared_stick, shared_angle, shared_click, - NULL, + done_keybd, done_buttn, 1, 0 };