Mark levels completed when using set cheat
[neverball] / putt / st_all.c
index 1858536..a4c366e 100644 (file)
 
 /*---------------------------------------------------------------------------*/
 
+static SDL_Joystick *joystick = NULL;
+
+void set_joystick(SDL_Joystick *j)
+{
+    joystick = j;
+}
+
+/*---------------------------------------------------------------------------*/
+
 static char *number(int i)
 {
     static char str[MAXSTR];
@@ -145,6 +154,28 @@ static int score_card(const char  *title,
 
 /*---------------------------------------------------------------------------*/
 
+static int shared_stick_basic(int id, int a, int v)
+{
+    int jd = 0;
+
+    if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a))
+        jd = gui_stick(id, v, 0);
+    else if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a))
+        jd = gui_stick(id, 0, 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);
+}
+
+/*---------------------------------------------------------------------------*/
+
 #define TITLE_PLAY 1
 #define TITLE_CONF 2
 #define TITLE_EXIT 3
@@ -200,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);
 }
 
@@ -214,7 +245,6 @@ static void title_timer(int id, float dt)
     game_set_fly(fcosf(time_state() / 10.f));
 
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static void title_point(int id, int x, int y, int dx, int dy)
@@ -227,9 +257,16 @@ static int title_click(int b, int d)
     return (d && b < 0) ? title_action(gui_token(gui_click())) : 1;
 }
 
-static int title_keybd(int c, int d)
+static int title_buttn(int b, int d)
 {
-    return (d && c == SDLK_ESCAPE) ? 0 : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return title_action(gui_token(gui_click()));
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return title_action(TITLE_EXIT);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -237,6 +274,8 @@ static int title_keybd(int c, int d)
 static int desc_id;
 static int shot_id;
 
+#define COURSE_BACK -1
+
 static int course_action(int i)
 {
     if (course_exists(i))
@@ -244,7 +283,7 @@ static int course_action(int i)
         course_goto(i);
         goto_state(&st_party);
     }
-    if (i < 0)
+    if (i == COURSE_BACK)
         goto_state(&st_title);
 
     return 1;
@@ -255,7 +294,7 @@ static int course_enter(void)
     int w = config_get_d(CONFIG_WIDTH);
     int h = config_get_d(CONFIG_HEIGHT);
 
-    int id, jd, kd, ld, i = 0, j, n = course_count();
+    int id, jd, kd, ld, md, i = 0, j, n = course_count();
     int m = (int)(sqrt(n/2.0)*2);
 
     if ((id = gui_vstack(0)))
@@ -266,7 +305,9 @@ static int course_enter(void)
         if ((jd = gui_hstack(id)))
         {
             shot_id = gui_image(jd, course_shot(0), w / 3, h / 3);
+
             gui_filler(jd);
+
             if ((kd = gui_varray(jd)))
             {
                 for(i = 0; i < n; i += m)
@@ -276,9 +317,14 @@ static int course_enter(void)
                         for (j = (m - 1); j >= 0; j--)
                         {
                             if (i + j < n)
-                                gui_active(gui_image(ld, course_shot(i + j),
-                                                     w / 3 / m, h / 3 / m),
-                                           i + j, 0);
+                            {
+                                md = gui_image(ld, course_shot(i + j),
+                                               w / 3 / m, h / 3 / m);
+                                gui_active(md, i + j, 0);
+
+                                if (i + j == 0)
+                                    gui_focus(md);
+                            }
                             else
                                 gui_space(ld);
                         }
@@ -294,7 +340,7 @@ static int course_enter(void)
         if ((jd = gui_hstack(id)))
         {
             gui_filler(jd);
-            gui_state(jd, _("Back"), GUI_SML, -1, 0);
+            gui_state(jd, _("Back"), GUI_SML, COURSE_BACK, 0);
         }
 
         gui_layout(id, 0, 0);
@@ -310,16 +356,15 @@ 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);
 }
 
 static void course_timer(int id, float dt)
 {
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static void course_point(int id, int x, int y, int dx, int dy)
@@ -329,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));
@@ -343,9 +406,16 @@ static int course_click(int b, int d)
     return (d && b < 0) ? course_action(gui_token(gui_click())) : 1;
 }
 
-static int course_keybd(int c, int d)
+static int course_buttn(int b, int d)
 {
-    return (d && c == SDLK_ESCAPE) ? goto_state(&st_title) : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return course_action(gui_token(gui_click()));
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return course_action(COURSE_BACK);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -409,6 +479,8 @@ static int party_enter(void)
             gui_set_color(p2, gui_grn, gui_wht);
             gui_set_color(p3, gui_blu, gui_wht);
             gui_set_color(p4, gui_yel, gui_wht);
+
+            gui_focus(p1);
         }
 
         gui_space(id);
@@ -430,16 +502,15 @@ 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);
 }
 
 static void party_timer(int id, float dt)
 {
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static void party_point(int id, int x, int y, int dx, int dy)
@@ -452,9 +523,16 @@ static int party_click(int b, int d)
     return (d && b < 0) ? party_action(gui_token(gui_click())) : 1;
 }
 
-static int party_keybd(int c, int d)
+static int party_buttn(int b, int d)
 {
-    return (d && c == SDLK_ESCAPE) ? goto_state(&st_course) : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return party_action(gui_token(gui_click()));
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return party_action(PARTY_B);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -462,14 +540,23 @@ static int party_keybd(int c, int d)
 static int paused = 0;
 
 static struct state *st_continue;
+static struct state *st_quit;
 
 #define PAUSE_CONTINUE 1
 #define PAUSE_QUIT     2
 
-int goto_pause(void)
+int goto_pause(struct state *s, int e)
 {
+    if (curr_state() == &st_pause)
+        return 1;
+
+    if (e && !config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
+        return goto_state(s);
+
     st_continue = curr_state();
+    st_quit = s;
     paused = 1;
+
     return goto_state(&st_pause);
 }
 
@@ -483,7 +570,7 @@ static int pause_action(int i)
         return goto_state(st_continue ? st_continue : &st_title);
 
     case PAUSE_QUIT:
-        return goto_state(&st_over);
+        return goto_state(st_quit);
     }
     return 1;
 }
@@ -520,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();
 }
@@ -530,7 +617,6 @@ static void pause_paint(int id, float st)
 static void pause_timer(int id, float dt)
 {
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static void pause_point(int id, int x, int y, int dx, int dy)
@@ -545,11 +631,35 @@ static int pause_click(int b, int d)
 
 static int pause_keybd(int c, int d)
 {
-    if (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c)))
+    if (d && config_tst_d(CONFIG_KEY_PAUSE, c))
         return pause_action(PAUSE_CONTINUE);
     return 1;
 }
 
+static int pause_buttn(int b, int d)
+{
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return pause_action(gui_token(gui_click()));
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return pause_action(PAUSE_CONTINUE);
+    }
+    return 1;
+}
+
+/*---------------------------------------------------------------------------*/
+
+static int shared_keybd(int c, int d)
+{
+    if (d)
+    {
+        if (config_tst_d(CONFIG_KEY_PAUSE, c))
+            return goto_pause(&st_over, 0);
+    }
+    return 1;
+}
+
 /*---------------------------------------------------------------------------*/
 
 static int num = 0;
@@ -605,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);
 }
@@ -615,7 +725,6 @@ static void next_paint(int id, float st)
 static void next_timer(int id, float dt)
 {
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static void next_point(int id, int x, int y, int dx, int dy)
@@ -634,20 +743,34 @@ static int next_keybd(int c, int d)
     {
         if (c == SDLK_F12)
             return goto_state(&st_poser);
-        if (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))
-            return goto_pause();
-        if (c == SDLK_RETURN)
-        {
-            hole_goto(num, -1);
-            num = 0;
-            return goto_state(&st_next);
-        }
+        if (config_tst_d(CONFIG_KEY_PAUSE, c))
+            return goto_pause(&st_over, 0);
         if ('0' <= c && c <= '9')
             num = num * 10 + c - '0';
     }
     return 1;
 }
 
+static int next_buttn(int b, int d)
+{
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+        {
+            if (num > 0)
+            {
+                hole_goto(num, -1);
+                num = 0;
+                return goto_state(&st_next);
+            }
+            return goto_state(&st_flyby);
+        }
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
+}
+
 /*---------------------------------------------------------------------------*/
 
 static int poser_enter(void)
@@ -656,14 +779,21 @@ 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_keybd(int c, int d)
+static int poser_buttn(int b, int d)
 {
-    return (d && c == SDLK_ESCAPE) ? goto_state(&st_next) : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return goto_state(&st_next);
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_state(&st_next);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -683,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();
 }
 
@@ -699,7 +829,6 @@ static void flyby_timer(int id, float dt)
         game_set_fly(1.f - t);
 
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static int flyby_click(int b, int d)
@@ -712,13 +841,26 @@ static int flyby_click(int b, int d)
     return 1;
 }
 
-static int flyby_keybd(int c, int d)
+static int flyby_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+        {
+            game_set_fly(0.f);
+            return goto_state(&st_stroke);
+        }
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
 
+static int stroke_rotate = 0;
+static int stroke_mag    = 0;
+
 static int stroke_enter(void)
 {
     hud_init();
@@ -739,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();
 }
 
@@ -749,9 +891,20 @@ static void stroke_timer(int id, float dt)
 {
     float g[3] = { 0.f, 0.f, 0.f };
 
+    float k;
+
+    if (SDL_GetModState() & KMOD_SHIFT ||
+        (joystick && SDL_JoystickGetButton(joystick,
+                                           config_get_d(CONFIG_JOYSTICK_BUTTON_B))))
+        k = 0.25;
+    else
+        k = 1.0;
+
+    game_set_rot(stroke_rotate * k);
+    game_set_mag(stroke_mag * k);
+
     game_update_view(dt);
     game_step(g, dt);
-    audio_timer(dt);
 }
 
 static void stroke_point(int id, int x, int y, int dx, int dy)
@@ -760,14 +913,32 @@ static void stroke_point(int id, int x, int y, int dx, int dy)
     game_set_mag(dy);
 }
 
+static void stroke_stick(int id, int a, int v)
+{
+    if (v == 1) /* See 'loop' in main.c */
+        v = 0;
+
+    if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a))
+        stroke_rotate = (6 * v) / JOY_MAX;
+    else if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a))
+        stroke_mag = -((6 * v) / JOY_MAX);
+}
+
 static int stroke_click(int b, int d)
 {
     return (d && b < 0) ? goto_state(&st_roll) : 1;
 }
 
-static int stroke_keybd(int c, int d)
+static int stroke_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return goto_state(&st_roll);
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -789,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();
 }
 
@@ -805,12 +976,16 @@ static void roll_timer(int id, float dt)
     case GAME_GOAL: goto_state(&st_goal); break;
     case GAME_FALL: goto_state(&st_fall); break;
     }
-    audio_timer(dt);
 }
 
-static int roll_keybd(int c, int d)
+static int roll_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -838,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();
 }
@@ -854,7 +1029,6 @@ static void goal_timer(int id, float dt)
         else
             goto_state(&st_score);
     }
-    audio_timer(dt);
 }
 
 static int goal_click(int b, int d)
@@ -869,9 +1043,21 @@ static int goal_click(int b, int d)
     return 1;
 }
 
-static int goal_keybd(int c, int d)
+static int goal_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+        {
+            if (hole_next())
+                goto_state(&st_next);
+            else
+                goto_state(&st_score);
+        }
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -893,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();
 }
 
@@ -905,7 +1091,6 @@ static void stop_timer(int id, float dt)
 
     game_update_view(dt);
     game_step(g, dt);
-    audio_timer(dt);
 
     if (time_state() > 1)
     {
@@ -928,9 +1113,21 @@ static int stop_click(int b, int d)
     return 1;
 }
 
-static int stop_keybd(int c, int d)
+static int stop_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+        {
+            if (hole_next())
+                goto_state(&st_next);
+            else
+                goto_state(&st_score);
+        }
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -947,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();
@@ -961,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();
 }
@@ -977,7 +1174,6 @@ static void fall_timer(int id, float dt)
         else
             goto_state(&st_score);
     }
-    audio_timer(dt);
 }
 
 static int fall_click(int b, int d)
@@ -992,9 +1188,21 @@ static int fall_click(int b, int d)
     return 1;
 }
 
-static int fall_keybd(int c, int d)
+static int fall_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+        {
+            if (hole_next())
+                goto_state(&st_next);
+            else
+                goto_state(&st_score);
+        }
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -1014,16 +1222,15 @@ 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);
 }
 
 static void score_timer(int id, float dt)
 {
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static int score_click(int b, int d)
@@ -1038,9 +1245,21 @@ static int score_click(int b, int d)
     return 1;
 }
 
-static int score_keybd(int c, int d)
+static int score_buttn(int b, int d)
 {
-    return (d && (c == SDLK_ESCAPE || config_tst_d(CONFIG_KEY_PAUSE, c))) ? goto_pause() : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+        {
+            if (hole_move())
+                goto_state(&st_next);
+            else
+                goto_state(&st_score);
+        }
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_pause(&st_over, 1);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -1056,16 +1275,15 @@ 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);
 }
 
 static void over_timer(int id, float dt)
 {
     gui_timer(id, dt);
-    audio_timer(dt);
 }
 
 static int over_click(int b, int d)
@@ -1073,9 +1291,16 @@ static int over_click(int b, int d)
     return (d && b < 0) ? goto_state(&st_title) : 1;
 }
 
-static int over_keybd(int c, int d)
+static int over_buttn(int b, int d)
 {
-    return (d && c == SDLK_ESCAPE) ? goto_state(&st_title) : 1;
+    if (d)
+    {
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
+            return goto_state(&st_title);
+        if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
+            return goto_state(&st_title);
+    }
+    return 1;
 }
 
 /*---------------------------------------------------------------------------*/
@@ -1086,10 +1311,11 @@ struct state st_title = {
     title_paint,
     title_timer,
     title_point,
+    shared_stick,
     NULL,
     title_click,
-    title_keybd,
     NULL,
+    title_buttn,
     1, 0
 };
 
@@ -1099,10 +1325,11 @@ struct state st_course = {
     course_paint,
     course_timer,
     course_point,
+    course_stick,
     NULL,
     course_click,
-    course_keybd,
     NULL,
+    course_buttn,
     1, 0
 };
 
@@ -1112,10 +1339,11 @@ struct state st_party = {
     party_paint,
     party_timer,
     party_point,
+    shared_stick,
     NULL,
     party_click,
-    party_keybd,
     NULL,
+    party_buttn,
     1, 0
 };
 
@@ -1125,10 +1353,11 @@ struct state st_next = {
     next_paint,
     next_timer,
     next_point,
+    shared_stick,
     NULL,
     next_click,
     next_keybd,
-    NULL,
+    next_buttn,
     1, 0
 };
 
@@ -1140,8 +1369,9 @@ struct state st_poser = {
     NULL,
     NULL,
     NULL,
-    poser_keybd,
     NULL,
+    NULL,
+    poser_buttn,
     1, 0
 };
 
@@ -1152,9 +1382,10 @@ struct state st_flyby = {
     flyby_timer,
     NULL,
     NULL,
-    flyby_click,
-    flyby_keybd,
     NULL,
+    flyby_click,
+    shared_keybd,
+    flyby_buttn,
     1, 0
 };
 
@@ -1164,10 +1395,11 @@ struct state st_stroke = {
     stroke_paint,
     stroke_timer,
     stroke_point,
+    stroke_stick,
     NULL,
     stroke_click,
-    stroke_keybd,
-    NULL,
+    shared_keybd,
+    stroke_buttn,
     0, 0
 };
 
@@ -1179,8 +1411,9 @@ struct state st_roll = {
     NULL,
     NULL,
     NULL,
-    roll_keybd,
     NULL,
+    shared_keybd,
+    roll_buttn,
     0, 0
 };
 
@@ -1191,9 +1424,10 @@ struct state st_goal = {
     goal_timer,
     NULL,
     NULL,
-    goal_click,
-    goal_keybd,
     NULL,
+    goal_click,
+    shared_keybd,
+    goal_buttn,
     0, 0
 };
 
@@ -1204,9 +1438,10 @@ struct state st_stop = {
     stop_timer,
     NULL,
     NULL,
-    stop_click,
-    stop_keybd,
     NULL,
+    stop_click,
+    shared_keybd,
+    stop_buttn,
     0, 0
 };
 
@@ -1217,9 +1452,10 @@ struct state st_fall = {
     fall_timer,
     NULL,
     NULL,
-    fall_click,
-    fall_keybd,
     NULL,
+    fall_click,
+    shared_keybd,
+    fall_buttn,
     0, 0
 };
 
@@ -1230,9 +1466,10 @@ struct state st_score = {
     score_timer,
     NULL,
     NULL,
-    score_click,
-    score_keybd,
     NULL,
+    score_click,
+    shared_keybd,
+    score_buttn,
     0, 0
 };
 
@@ -1243,9 +1480,10 @@ struct state st_over = {
     over_timer,
     NULL,
     NULL,
+    NULL,
     over_click,
-    over_keybd,
     NULL,
+    over_buttn,
     1, 0
 };
 
@@ -1255,9 +1493,10 @@ struct state st_pause = {
     pause_paint,
     pause_timer,
     pause_point,
+    shared_stick,
     NULL,
     pause_click,
     pause_keybd,
-    NULL,
+    pause_buttn,
     1, 0
 };