#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"
/*---------------------------------------------------------------------------*/
#define DONE_OK 1
-#define DONE_NAME 2
/* Bread crumbs. */
static int new_name;
+static int resume;
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;
}
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;
}
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(&curr_set()->time_score, curr_lg()->times_rank, 0);
- set_most_coins(&curr_set()->coin_score, 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)
shared_stick,
shared_angle,
shared_click,
- NULL,
+ done_keybd,
done_buttn,
1, 0
};