set shots from the first level, not the second
[neverball] / ball / st_set.c
index ca489ea..5816d85 100644 (file)
@@ -68,6 +68,21 @@ static int set_action(int i)
     return 1;
 }
 
+static void gui_set(int id, int i)
+{
+    const struct set *s = get_set(i);
+    int jd;
+    
+    if (set_completed(s)) 
+       jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_yel, gui_wht);
+    else if (set_unlocked(s)) 
+       jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_grn, gui_wht);
+    else
+       jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_wht, gui_wht);
+    
+    gui_active(jd, i, 0);
+}
+
 static int set_enter(void)
 {
     int w = config_get_d(CONFIG_WIDTH);
@@ -78,7 +93,16 @@ static int set_enter(void)
 
     int id, jd, kd;
 
+
     set_init();
+    
+    /* Reset last set if it do not exists */
+    if (!set_exists(last_set))
+    {
+       b = 0;
+       last_set = 0;
+       config_set_d(CONFIG_LAST_SET, 0);
+    }
 
     audio_music_fade_to(0.5f, "bgm/inter.ogg");
     audio_play(AUD_START, 1.f);
@@ -100,12 +124,7 @@ static int set_enter(void)
            {
                /* Display levels */
                for(i=b*SET_GROUP; i<(b+1)*SET_GROUP && set_exists(i); i++)
-               {
-                   if(last_set == i)
-                       gui_start(kd, _(get_set(i)->name), GUI_SML, i, 0);
-                   else
-                       gui_state(kd, _(get_set(i)->name), GUI_SML, i, 0);
-               }
+                   gui_set(kd, i);
                
                /* Display empty slots */
                for(; i<(b+1)*SET_GROUP; i++)