T-int fix
[neverball] / ball / st_goal.c
index 784483d..96f5f98 100644 (file)
@@ -12,7 +12,7 @@
  * General Public License for more details.
  */
 
-#include <stdio.h> /* Necessary for strcat() found below */.
+#include <stdio.h>
 
 #include "gui.h"
 #include "game.h"
@@ -74,7 +74,7 @@ static int goal_action(int i)
         be_back_soon = 1;
 
         level_stop();
-        return goto_name(&st_goal, &st_goal);
+        return goto_name(&st_goal, &st_goal, 0);
 
     case GOAL_DONE:
         level_stop();
@@ -100,7 +100,7 @@ static int goal_enter(void)
 
     int id, jd, kd;
 
-          struct level_game *lg = curr_lg(); /* Note: const removed.  Is this really needed? */
+    struct level_game *lg = curr_lg();
     const struct level *l = lg->level;
 
     int high;
@@ -120,14 +120,18 @@ static int goal_enter(void)
     {
         int gid;
 
-        if(lg->mode == MODE_CHALLENGE && lg->bonus > 0)
+        if (lg->mode == MODE_CHALLENGE && lg->bonus)
         {
+            char buf[MAXSTR];
+
+            sprintf(buf, _("You have unlocked bonus level %s!"),
+                    lg->bonus_repr);
+
+            gid = gui_label(id, s3,  GUI_MED, GUI_ALL, gui_grn, gui_red);
+            gid = gui_label(id, buf, GUI_SML, GUI_ALL, gui_blu, gui_grn);
+
             lg->bonus = 0;
-            lg->bonusid += 1;
-            char buf[MAXSTR] = {0};
-            sprintf(buf, "You Have Unlocked Bonus Level %i!", lg->bonusid);
-            gid = gui_label(id, s3, GUI_SML, GUI_ALL, gui_grn, gui_red);
-            gid = gui_label(id, buf, GUI_SML, GUI_ALL, gui_grn, gui_blu);
+            lg->bonus_repr = NULL;
         }
 
         if (high)
@@ -235,18 +239,18 @@ static int goal_enter(void)
 
 static void goal_timer(int id, float dt)
 {
-    static float DT = 0.0f;
+    static float t = 0.0f;
 
     float g[3] = { 0.0f, 9.8f, 0.0f };
 
-    DT += dt;
+    t += dt;
 
     if (time_state() < 1.f)
     {
+        demo_play_step();
         game_step(g, dt, 0);
-        demo_play_step(dt);
     }
-    else if (DT > 0.05f && coins_id)
+    else if (t > 0.05f && coins_id)
     {
         int coins = gui_value(coins_id);
 
@@ -268,7 +272,7 @@ static void goal_timer(int id, float dt)
                 audio_play(AUD_BALL, 1.0f);
             }
         }
-        DT = 0.0f;
+        t = 0.0f;
     }
 
     gui_timer(id, dt);
@@ -303,6 +307,7 @@ struct state st_goal = {
     goal_timer,
     shared_point,
     shared_stick,
+    shared_angle,
     shared_click,
     NULL,
     goal_buttn,