- if (o) gui_state(id, text, GUI_SML, i, 0);
- else if (e) gui_label(id, text, GUI_SML, GUI_ALL, gui_yel, gui_red);
- else gui_label(id, text, GUI_SML, GUI_ALL, gui_blk, gui_blk);
+ int jd;
+
+ if (!set_level_exists(curr_set(), i))
+ {
+ gui_space(id);
+ return;
+ }
+
+ l = get_level(i);
+
+ if (!l->is_locked)
+ {
+ fore = l->is_bonus ? gui_grn : gui_wht;
+ back = l->is_completed ? fore : gui_yel;
+ }
+ else
+ fore = back = gui_gry;
+
+ jd = gui_label(id, l->repr, GUI_SML, GUI_ALL, back, fore);
+
+ gui_active(jd, i, 0);
+}
+
+static void start_over_level(int i)
+{
+ const struct level *l = get_level(i);
+ if (!l->is_locked || config_cheat())
+ {
+ gui_set_image(shot_id, l->shot);
+
+ set_most_coins(&l->score.most_coins, -1);
+
+ if (curr_mode() == MODE_PRACTICE)
+ {
+ set_best_times(&l->score.best_times, -1, 0);
+ if (l->is_bonus)
+ gui_set_label(status_id,
+ _("Play this bonus level in practice mode"));
+ else
+ gui_set_label(status_id,
+ _("Play this level in practice mode"));
+ }
+ else
+ {
+ set_best_times(&l->score.unlock_goal, -1, 1);
+ if (l->is_bonus)
+ gui_set_label(status_id,
+ _("Play this bonus level in normal mode"));
+ else
+ gui_set_label(status_id, _("Play this level in normal mode"));
+ }
+ if (config_cheat())
+ {
+ gui_set_label(status_id, l->file);
+ }
+ return;
+ }
+ else if (l->is_bonus)
+ gui_set_label(status_id,
+ _("Play in challenge mode to unlock extra bonus levels"));
+ else
+ gui_set_label(status_id,
+ _("Finish previous levels to unlock this level"));
+}
+
+static void start_over(int id)
+{
+ int i;
+
+ gui_pulse(id, 1.2f);
+ if (id == 0)
+ return;
+
+ i = gui_token(id);
+
+
+ switch (i)
+ {
+ case START_CHALLENGE:
+ gui_set_image(shot_id, set_shot(curr_set()));
+ set_most_coins(set_coin_score(curr_set()), -1);
+ set_best_times(set_time_score(curr_set()), -1, 0);
+ gui_set_label(status_id, _("Challenge all levels from the first one"));
+ break;
+
+ case START_NORMAL:
+ gui_set_label(status_id, _("Collect coins and unlock next level"));
+ break;
+
+ case START_PRACTICE:
+ gui_set_label(status_id, _("Train yourself without time nor coin"));
+ break;
+ }
+
+ if (i >= 0)
+ start_over_level(i);