Almost completely separate coins and items in share/geom.c. Items still
[neverball] / ball / util.c
index 3777837..1662ba0 100644 (file)
@@ -60,7 +60,7 @@ void gui_most_coins(int id, int e)
                         coin_c[j] = gui_count(md, 1000, GUI_SML, 0);
 
                     coin_c[j++] = gui_count(md, 1000, GUI_SML, GUI_SE);
-                    
+
                     if (e)
                     {
                        gui_space(md);
@@ -71,12 +71,14 @@ void gui_most_coins(int id, int e)
                 if ((md = gui_vstack(ld)))
                 {
                     for (j = 0; j < NSCORE ; j++)
-                        coin_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
-                    
+                        coin_n[j] = gui_label(md, s, GUI_SML, 0,
+                                              gui_yel, gui_wht);
+
                     if (e)
                     {
                         gui_space(md);
-                        coin_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+                        coin_n[j++] = gui_label(md, s, GUI_SML, 0,
+                                                gui_yel, gui_wht);
                     }
                 }
 
@@ -172,7 +174,7 @@ void gui_best_times(int id, int e)
                         time_t2[j] = gui_clock(md, 359999, GUI_SML, 0);
 
                     time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_SE);
-                    
+
                     if (e)
                     {
                         gui_space(md);
@@ -183,12 +185,14 @@ void gui_best_times(int id, int e)
                 if ((md = gui_vstack(ld)))
                 {
                     for (j = 0; j < NSCORE; j++)
-                        time_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+                        time_n[j] = gui_label(md, s, GUI_SML, 0,
+                                              gui_yel, gui_wht);
 
                     if (e)
                     {
                         gui_space(md);
-                        time_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+                        time_n[j++] = gui_label(md, s, GUI_SML, 0,
+                                                gui_yel, gui_wht);
                     }
                 }
 
@@ -198,7 +202,7 @@ void gui_best_times(int id, int e)
                         time_c[j] = gui_count(md, 1000, GUI_SML, 0);
 
                     time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_SW);
-                    
+
                     if (e)
                     {
                         gui_space(md);
@@ -218,10 +222,7 @@ void set_best_times(const struct score *s, int hilight, int goal)
     int j, spe;
     const char *name;
 
-    if (goal)
-        gui_set_label(time_l, _("Unlock Goal"));
-    else
-        gui_set_label(time_l, _("Best Times"));
+    gui_set_label(time_l, goal ? _("Unlock Goal") : _("Best Times"));
 
     if (s == NULL)
     {
@@ -258,17 +259,17 @@ void set_best_times(const struct score *s, int hilight, int goal)
 /*---------------------------------------------------------------------------*/
 
 static int lock = 1;
-static int keyd[127]; 
+static int keyd[127];
 
 static void gui_fill(int id, char *line)
 {
     char l[2];
     l[1] = '\0';
 
-    while(*line)
+    while (*line)
     {
         *l = *(line++);
-        keyd[(int)*l] = gui_state(id, l, GUI_SML, *l, 0);
+        keyd[(int) *l] = gui_state(id, l, GUI_SML, *l, 0);
     }
 }
 
@@ -337,6 +338,7 @@ void gui_keyboard(int id)
 int gui_back_prev_next(int id, int prev, int next)
 {
     int jd;
+
     if ((jd = gui_hstack(id)))
     {
         if (next || prev)
@@ -344,7 +346,7 @@ int gui_back_prev_next(int id, int prev, int next)
             gui_maybe(jd, _("Next"), GUI_NEXT, next);
             gui_maybe(jd, _("Prev"), GUI_PREV, prev);
         }
-        
+
         gui_start(jd, _("Back"),  GUI_SML, GUI_BACK, 0);
     }
     return jd;
@@ -357,7 +359,7 @@ int gui_maybe(int id, const char *label, int token, int enabled)
         bd = gui_state(id, label, GUI_SML, token,    0);
     else
     {
-        bd = gui_state(id, label, GUI_SML, GUI_NULL, 0);
+        bd = gui_state(id, label, GUI_SML, token >= 0 ? token | GUI_NULL_MASK : GUI_NULL, 0);
         gui_set_color(bd, gui_gry, gui_gry);
     }
     return bd;