Those sets haven't been merged.
[neverball] / ball / st_start.c
index 60460b1..5e90fd3 100644 (file)
 
 /*---------------------------------------------------------------------------*/
 
-int goto_end_level(void)
-{
-    switch (curr_lg()->mode)
-    {
-    case MODE_SINGLE:
-        return 0;
-    case MODE_CHALLENGE:
-        return goto_state(&st_over);
-    default:
-        return goto_state(&st_start);
-    }
-}
-
-
-/*---------------------------------------------------------------------------*/
-
-#define START_BACK -1
-#define START_PRACTICE -2
-#define START_NORMAL -3
+#define START_BACK      -1
+#define START_PRACTICE  -2
+#define START_NORMAL    -3
 #define START_CHALLENGE -4
 
 static int shot_id;
@@ -90,7 +74,7 @@ static void gui_level(int id, int i)
 static void start_over_level(int i)
 {
     const struct level *l = get_level(i);
-    if (!l->is_locked || config_get_d(CONFIG_CHEAT))
+    if (!l->is_locked || config_cheat())
     {
         gui_set_image(shot_id, l->shot);
 
@@ -115,7 +99,7 @@ static void start_over_level(int i)
             else
                 gui_set_label(status_id, _("Play this level in normal mode"));
         }
-        if (config_get_d(CONFIG_CHEAT))
+        if (config_cheat())
         {
             gui_set_label(status_id, l->file);
         }
@@ -185,7 +169,7 @@ static int start_action(int i)
     if (i == START_CHALLENGE)
     {
         /* On cheat, start challenge mode where you want */
-        if (config_get_d(CONFIG_CHEAT))
+        if (config_cheat())
         {
             mode_set(MODE_CHALLENGE);
             return goto_state(&st_start);
@@ -198,10 +182,17 @@ static int start_action(int i)
     {
         const struct level *l = get_level(i);
 
-        if (!l->is_locked || config_get_d(CONFIG_CHEAT))
+        if (!l->is_locked || config_cheat())
         {
-            level_play(l, mode);
-            return goto_state(&st_level);
+            if (level_play(l, mode))
+            {
+                return goto_state(&st_level);
+            }
+            else
+            {
+                level_stop();
+                return 1;
+            }
         }
     }
     return 1;
@@ -218,7 +209,7 @@ static int start_enter(void)
 
     /* Deactivate cheat */
 
-    if (m == MODE_CHALLENGE && !config_get_d(CONFIG_CHEAT))
+    if (m == MODE_CHALLENGE && !config_cheat())
     {
         mode_set(MODE_NORMAL);
         m = MODE_NORMAL;
@@ -296,7 +287,7 @@ static void start_stick(int id, int a, int v)
 
 static int start_keybd(int c, int d)
 {
-    if (d && c == SDLK_c && config_get_d(CONFIG_CHEAT))
+    if (d && c == SDLK_c && config_cheat())
     {
         set_cheat();
         return goto_state(&st_start);
@@ -337,6 +328,7 @@ struct state st_start = {
     shared_timer,
     start_point,
     start_stick,
+    shared_angle,
     shared_click,
     start_keybd,
     start_buttn,