Mark levels completed when using set cheat
[neverball] / putt / st_all.c
index 86b113c..a4c366e 100644 (file)
@@ -154,7 +154,7 @@ static int score_card(const char  *title,
 
 /*---------------------------------------------------------------------------*/
 
-static void shared_stick(int id, int a, int v)
+static int shared_stick_basic(int id, int a, int v)
 {
     int jd = 0;
 
@@ -165,6 +165,13 @@ static void shared_stick(int id, int a, int v)
 
     if (jd)
         gui_pulse(jd, 1.2f);
+
+    return jd;
+}
+
+static void shared_stick(int id, int a, int v)
+{
+    shared_stick_basic(id, a, v);
 }
 
 /*---------------------------------------------------------------------------*/
@@ -224,9 +231,9 @@ static void title_leave(int id)
     gui_delete(id);
 }
 
-static void title_paint(int id, float st)
+static void title_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -349,9 +356,9 @@ static void course_leave(int id)
     gui_delete(id);
 }
 
-static void course_paint(int id, float st)
+static void course_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -367,6 +374,24 @@ static void course_point(int id, int x, int y, int dx, int dy)
     if ((jd = gui_point(id, x, y)))
     {
         int i = gui_token(jd);
+
+        if (course_exists(i))
+        {
+            gui_set_image(shot_id, course_shot(i));
+            gui_set_multi(desc_id, _(course_desc(i)));
+        }
+        gui_pulse(jd, 1.2f);
+    }
+}
+
+static void course_stick(int id, int a, int v)
+{
+    int jd;
+
+    if ((jd = shared_stick_basic(id, a, v)))
+    {
+        int i = gui_token(jd);
+
         if (course_exists(i))
         {
             gui_set_image(shot_id, course_shot(i));
@@ -477,9 +502,9 @@ static void party_leave(int id)
     gui_delete(id);
 }
 
-static void party_paint(int id, float st)
+static void party_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -525,7 +550,7 @@ int goto_pause(struct state *s, int e)
     if (curr_state() == &st_pause)
         return 1;
 
-    if (e && (SDL_GetModState() & KMOD_SHIFT))
+    if (e && !config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
         return goto_state(s);
 
     st_continue = curr_state();
@@ -582,9 +607,9 @@ static void pause_leave(int id)
     audio_music_fade_in(0.5f);
 }
 
-static void pause_paint(int id, float st)
+static void pause_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
     hud_paint();
 }
@@ -629,8 +654,6 @@ static int shared_keybd(int c, int d)
 {
     if (d)
     {
-        if (c == SDLK_ESCAPE)
-            return goto_pause(&st_over, 1);
         if (config_tst_d(CONFIG_KEY_PAUSE, c))
             return goto_pause(&st_over, 0);
     }
@@ -692,9 +715,9 @@ static void next_leave(int id)
     gui_delete(id);
 }
 
-static void next_paint(int id, float st)
+static void next_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
     gui_paint(id);
 }
@@ -756,9 +779,9 @@ static int poser_enter(void)
     return 0;
 }
 
-static void poser_paint(int id, float st)
+static void poser_paint(int id, float t)
 {
-    game_draw(1);
+    game_draw(1, t);
 }
 
 static int poser_buttn(int b, int d)
@@ -790,9 +813,9 @@ static void flyby_leave(int id)
     hud_free();
 }
 
-static void flyby_paint(int id, float st)
+static void flyby_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -858,9 +881,9 @@ static void stroke_leave(int id)
     config_set_d(CONFIG_CAMERA, 0);
 }
 
-static void stroke_paint(int id, float st)
+static void stroke_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -937,9 +960,9 @@ static void roll_leave(int id)
     hud_free();
 }
 
-static void roll_paint(int id, float st)
+static void roll_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -990,9 +1013,9 @@ static void goal_leave(int id)
     hud_free();
 }
 
-static void goal_paint(int id, float st)
+static void goal_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
     hud_paint();
 }
@@ -1056,9 +1079,9 @@ static void stop_leave(int id)
     hud_free();
 }
 
-static void stop_paint(int id, float st)
+static void stop_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     hud_paint();
 }
 
@@ -1121,7 +1144,7 @@ static int fall_enter(void)
     else
     {
         hole_fall();
-        game_draw(0); /*TODO: is this call ok? */
+/*        game_draw(0);*/ /*TODO: is this call ok? */  /* No, it's not. */
     }
 
     hud_init();
@@ -1135,9 +1158,9 @@ static void fall_leave(int id)
     hud_free();
 }
 
-static void fall_paint(int id, float st)
+static void fall_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
     hud_paint();
 }
@@ -1199,9 +1222,9 @@ static void score_leave(int id)
     gui_delete(id);
 }
 
-static void score_paint(int id, float st)
+static void score_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -1252,9 +1275,9 @@ static void over_leave(int id)
     gui_delete(id);
 }
 
-static void over_paint(int id, float st)
+static void over_paint(int id, float t)
 {
-    game_draw(0);
+    game_draw(0, t);
     gui_paint(id);
 }
 
@@ -1289,6 +1312,7 @@ struct state st_title = {
     title_timer,
     title_point,
     shared_stick,
+    NULL,
     title_click,
     NULL,
     title_buttn,
@@ -1301,7 +1325,8 @@ struct state st_course = {
     course_paint,
     course_timer,
     course_point,
-    shared_stick,
+    course_stick,
+    NULL,
     course_click,
     NULL,
     course_buttn,
@@ -1315,6 +1340,7 @@ struct state st_party = {
     party_timer,
     party_point,
     shared_stick,
+    NULL,
     party_click,
     NULL,
     party_buttn,
@@ -1328,6 +1354,7 @@ struct state st_next = {
     next_timer,
     next_point,
     shared_stick,
+    NULL,
     next_click,
     next_keybd,
     next_buttn,
@@ -1343,6 +1370,7 @@ struct state st_poser = {
     NULL,
     NULL,
     NULL,
+    NULL,
     poser_buttn,
     1, 0
 };
@@ -1354,6 +1382,7 @@ struct state st_flyby = {
     flyby_timer,
     NULL,
     NULL,
+    NULL,
     flyby_click,
     shared_keybd,
     flyby_buttn,
@@ -1367,6 +1396,7 @@ struct state st_stroke = {
     stroke_timer,
     stroke_point,
     stroke_stick,
+    NULL,
     stroke_click,
     shared_keybd,
     stroke_buttn,
@@ -1381,6 +1411,7 @@ struct state st_roll = {
     NULL,
     NULL,
     NULL,
+    NULL,
     shared_keybd,
     roll_buttn,
     0, 0
@@ -1393,6 +1424,7 @@ struct state st_goal = {
     goal_timer,
     NULL,
     NULL,
+    NULL,
     goal_click,
     shared_keybd,
     goal_buttn,
@@ -1406,6 +1438,7 @@ struct state st_stop = {
     stop_timer,
     NULL,
     NULL,
+    NULL,
     stop_click,
     shared_keybd,
     stop_buttn,
@@ -1419,6 +1452,7 @@ struct state st_fall = {
     fall_timer,
     NULL,
     NULL,
+    NULL,
     fall_click,
     shared_keybd,
     fall_buttn,
@@ -1432,6 +1466,7 @@ struct state st_score = {
     score_timer,
     NULL,
     NULL,
+    NULL,
     score_click,
     shared_keybd,
     score_buttn,
@@ -1445,6 +1480,7 @@ struct state st_over = {
     over_timer,
     NULL,
     NULL,
+    NULL,
     over_click,
     NULL,
     over_buttn,
@@ -1458,6 +1494,7 @@ struct state st_pause = {
     pause_timer,
     pause_point,
     shared_stick,
+    NULL,
     pause_click,
     pause_keybd,
     pause_buttn,