#include <ctype.h>
#include <string.h>
+#include <assert.h>
#include "gui.h"
#include "util.h"
static int score_type = GUI_MOST_COINS;
-void gui_score_board(int id, int e, int h)
+void gui_score_board(int id, unsigned int types, int e, int h)
{
int jd, kd, ld;
+ assert((types & GUI_MOST_COINS) == GUI_MOST_COINS ||
+ (types & GUI_BEST_TIMES) == GUI_BEST_TIMES ||
+ (types & GUI_UNLOCK_GOAL) == GUI_UNLOCK_GOAL );
+
+ /* Make sure current score type matches the spec. */
+
+ while ((types & score_type) != score_type)
+ score_type = gui_score_next(score_type);
+
gui_filler(id);
if ((jd = gui_hstack(id)))
{
gui_filler(kd);
- gui_state(kd, _("Most Coins"), GUI_SML, GUI_MOST_COINS,
- score_type == GUI_MOST_COINS);
- gui_state(kd, _("Best Times"), GUI_SML, GUI_BEST_TIMES,
- score_type == GUI_BEST_TIMES);
- gui_state(kd, _("Unlock Goal"), GUI_SML, GUI_UNLOCK_GOAL,
- score_type == GUI_UNLOCK_GOAL);
+ if ((types & GUI_MOST_COINS) == GUI_MOST_COINS)
+ gui_state(kd, _("Most Coins"), GUI_SML, GUI_MOST_COINS,
+ score_type == GUI_MOST_COINS);
+ if ((types & GUI_BEST_TIMES) == GUI_BEST_TIMES)
+ gui_state(kd, _("Best Times"), GUI_SML, GUI_BEST_TIMES,
+ score_type == GUI_BEST_TIMES);
+ if ((types & GUI_UNLOCK_GOAL) == GUI_UNLOCK_GOAL)
+ gui_state(kd, _("Unlock Goal"), GUI_SML, GUI_UNLOCK_GOAL,
+ score_type == GUI_UNLOCK_GOAL);
if (h)
{
* two as labels for a switch with a default label.
*/
-int gui_back_prev_next(int id, int prev, int next)
+int gui_navig(int id, int prev, int next)
{
int jd;
{
if (next || prev)
{
- gui_maybe(jd, _("Next"), GUI_NEXT, next);
- gui_maybe(jd, _("Prev"), GUI_PREV, prev);
+ gui_maybe(jd, _("Next"), GUI_NEXT, GUI_NULL, next);
+ gui_maybe(jd, _("Prev"), GUI_PREV, GUI_NULL, prev);
}
gui_start(jd, _("Back"), GUI_SML, GUI_BACK, 0);
return jd;
}
-int gui_maybe(int id, const char *label, int token, int enabled)
+int gui_maybe(int id, const char *label, int etoken, int dtoken, int enabled)
{
int bd;
if (!enabled)
{
- bd = gui_state(id,
- label,
- GUI_SML,
- token >= 0 ? token | GUI_NULL_MASK : GUI_NULL,
- 0);
-
+ bd = gui_state(id, label, GUI_SML, dtoken, 0);
gui_set_color(bd, gui_gry, gui_gry);
}
- else bd = gui_state(id, label, GUI_SML, token, 0);
+ else
+ bd = gui_state(id, label, GUI_SML, etoken, 0);
return bd;
}