Reformat code to fit in 80 columns. Jean, I cannot answer your
[neverball] / ball / st_start.c
index a1eb79c..645cfe4 100644 (file)
 /*---------------------------------------------------------------------------*/
 
 int goto_end_level(void)
-/* Action once the level sequence is ended (from goal or fail states) */
 {
-    int mode = curr_lg()->mode;
-    if (mode == MODE_SINGLE)
+    switch (curr_lg()->mode)
+    {
+    case MODE_SINGLE:
         return 0;
-    else if (mode == MODE_CHALLENGE)
+    case MODE_CHALLENGE:
         return goto_state(&st_over);
-    else
+    default:
         return goto_state(&st_start);
+    }
 }
 
 
@@ -58,10 +59,12 @@ static int status_id;
 
 static void gui_level(int id, int i)
 {
+    const GLfloat *fore, *back;
+
     const struct set *s = curr_set();
     const struct level *l;
-    int jd = 0;
-    const GLfloat *fore, *back;
+
+    int jd;
 
     if (!set_level_exists(s, i))
     {
@@ -73,12 +76,14 @@ static void gui_level(int id, int i)
 
     if (!l->is_locked)
     {
-        fore =  l->is_bonus ? gui_grn : gui_wht;
-        back = l->is_completed ? fore : gui_yel;
+        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->numbername, GUI_SML, GUI_ALL, back, fore);
+
     gui_active(jd, i, 0);
 }
 
@@ -162,17 +167,17 @@ static void start_over(id)
 static int start_action(int i)
 {
     int mode = config_get_d(CONFIG_MODE);
+
     audio_play(AUD_MENU, 1.0f);
 
-    if (i == START_BACK)
-        return goto_state(&st_set);
-    else if (i == START_NORMAL)
+    switch (i)
     {
+    case START_BACK:
+        return goto_state(&st_set);
+    case START_NORMAL:
         config_set_d(CONFIG_MODE, MODE_NORMAL);
         return goto_state(&st_start);
-    }
-    else if (i == START_PRACTICE)
-    {
+    case START_PRACTICE:
         config_set_d(CONFIG_MODE, MODE_PRACTICE);
         return goto_state(&st_start);
     }
@@ -192,6 +197,7 @@ static int start_action(int i)
     if (i >= 0)
     {
         const struct level *l = get_level(i);
+
         if (!l->is_locked || config_get_d(CONFIG_CHEAT))
         {
             level_play(l, mode);
@@ -210,7 +216,7 @@ static int start_enter(void)
 
     int id, jd, kd, ld;
 
-    /* Desactivate cheat */
+    /* Deactivate cheat */
     if (m == MODE_CHALLENGE && !config_get_d(CONFIG_CHEAT))
     {
         m = MODE_NORMAL;
@@ -222,13 +228,9 @@ static int start_enter(void)
         if ((jd = gui_hstack(id)))
         {
 
-            gui_label(jd, _(curr_set()->name), GUI_SML, GUI_ALL, gui_yel, gui_red);
+            gui_label(jd, _(curr_set()->name), GUI_SML, GUI_ALL,
+                      gui_yel, gui_red);
             gui_filler(jd);
-            if (set_completed(curr_set()))
-            {
-                gui_label(jd, _("Set Complete"), GUI_SML, GUI_ALL, gui_yel, gui_grn);
-                gui_filler(jd);
-            }
             gui_start(jd, _("Back"),  GUI_SML, START_BACK, 0);
         }
 
@@ -251,7 +253,7 @@ static int start_enter(void)
                         for (j = 4; j >= 0; j--)
                             gui_level(ld, i * 5 + j);
 
-                gui_state(kd, _("Challenge"), GUI_SML, START_CHALLENGE ,
+                gui_state(kd, _("Challenge"), GUI_SML, START_CHALLENGE,
                           m == MODE_CHALLENGE);
             }
         }
@@ -262,7 +264,6 @@ static int start_enter(void)
             gui_most_coins(jd, 0);
             gui_best_times(jd, 0);
         }
-
         gui_space(id);
 
         status_id = gui_label(id, _("Choose a level to play"), GUI_SML, GUI_ALL,