X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=ball%2Fst_time_out.c;h=e2711dc0e1b7af427f2bd0c620f9e59094fe44c1;hb=428f34e4b4486c5e3714abdbcc234b05215c8e4a;hp=e8bb68b4a678cfac4e5f2c8dc78b9876ab0f30ce;hpb=570cd4713d19660ee6ea0f75163c68e7c53f0df3;p=neverball diff --git a/ball/st_time_out.c b/ball/st_time_out.c index e8bb68b..e2711dc 100644 --- a/ball/st_time_out.c +++ b/ball/st_time_out.c @@ -14,7 +14,7 @@ #include "game.h" #include "util.h" -#include "levels.h" +#include "progress.h" #include "demo.h" #include "audio.h" #include "gui.h" @@ -26,6 +26,7 @@ #include "st_time_out.h" #include "st_level.h" #include "st_shared.h" +#include "st_play.h" /*---------------------------------------------------------------------------*/ @@ -45,20 +46,22 @@ static int time_out_action(int i) /* Fall through. */ case TIME_OUT_OVER: - level_stop(); + progress_stop(); return goto_state(&st_over); case TIME_OUT_SAVE: - level_stop(); + progress_stop(); return goto_save(&st_time_out, &st_time_out); case TIME_OUT_NEXT: - level_next(); - return goto_state(&st_level); + if (progress_next()) + return goto_state(&st_level); + break; case TIME_OUT_SAME: - level_same(); - return goto_state(&st_level); + if (progress_same()) + return goto_state(&st_level); + break; } return 1; @@ -68,8 +71,6 @@ static int time_out_enter(void) { int id, jd, kd; - const struct level_game *lg = curr_lg(); - if ((id = gui_vstack(0))) { kd = gui_label(id, _("Time's Up!"), GUI_LRG, GUI_ALL, gui_gry, gui_red); @@ -78,27 +79,17 @@ static int time_out_enter(void) if ((jd = gui_harray(id))) { - int next_id = 0, retry_id = 0; - - next_id = gui_maybe(jd, _("Next Level"), TIME_OUT_NEXT, - lg->next_level != NULL); - - if (lg->dead) - gui_start(jd, _("Game Over"), GUI_SML, TIME_OUT_OVER, 0); - else - { - retry_id = gui_state(jd, _("Retry Level"), GUI_SML, - TIME_OUT_SAME, 0); - } + if (progress_dead()) + gui_start(jd, _("Exit"), GUI_SML, TIME_OUT_OVER, 0); - gui_maybe(jd, _("Save Replay"), TIME_OUT_SAVE, demo_saved()); + if (progress_next_avail()) + gui_start(jd, _("Next Level"), GUI_SML, TIME_OUT_NEXT, 0); - /* Default is next if the next level is newly unlocked. */ + if (progress_same_avail()) + gui_start(jd, _("Retry Level"), GUI_SML, TIME_OUT_SAME, 0); - if (next_id && lg->unlock) - gui_focus(next_id); - else if (retry_id) - gui_focus(retry_id); + if (demo_saved()) + gui_state(jd, _("Save Replay"), GUI_SML, TIME_OUT_SAVE, 0); } gui_space(id); @@ -118,9 +109,11 @@ static int time_out_keybd(int c, int d) { if (d) { - if (config_tst_d(CONFIG_KEY_RESTART, c) - && !curr_lg()->dead) - return time_out_action(TIME_OUT_SAME); + if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail()) + { + if (progress_same()) + goto_state(&st_play_ready); + } } return 1; }