2 * Copyright (C) 2003 Robert Kooima
4 * NEVERPUTT is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
31 /*---------------------------------------------------------------------------*/
33 static SDL_Joystick *joystick = NULL;
35 void set_joystick(SDL_Joystick *j)
40 /*---------------------------------------------------------------------------*/
42 static char *number(int i)
44 static char str[MAXSTR];
46 sprintf(str, "%02d", i);
51 static int score_card(const char *title,
57 int p1 = (curr_party() >= 1) ? 1 : 0, l1 = (curr_party() == 1) ? 1 : 0;
58 int p2 = (curr_party() >= 2) ? 1 : 0, l2 = (curr_party() == 2) ? 1 : 0;
59 int p3 = (curr_party() >= 3) ? 1 : 0, l3 = (curr_party() == 3) ? 1 : 0;
60 int p4 = (curr_party() >= 4) ? 1 : 0, l4 = (curr_party() == 4) ? 1 : 0;
63 int n = curr_count() - 1;
64 int m = curr_count() / 2;
66 if ((id = gui_vstack(0)))
68 gui_label(id, title, GUI_MED, GUI_ALL, c0, c1);
71 if ((jd = gui_hstack(id)))
73 if ((kd = gui_varray(jd)))
75 if (p1) gui_label(kd, _("O"), 0, GUI_NE, 0, 0);
76 if (p1) gui_label(kd, hole_out(0), 0, 0, gui_wht, gui_wht);
77 if (p1) gui_label(kd, hole_out(1), 0, GUI_SE * l1, gui_red, gui_wht);
78 if (p2) gui_label(kd, hole_out(2), 0, GUI_SE * l2, gui_grn, gui_wht);
79 if (p3) gui_label(kd, hole_out(3), 0, GUI_SE * l3, gui_blu, gui_wht);
80 if (p4) gui_label(kd, hole_out(4), 0, GUI_SE * l4, gui_yel, gui_wht);
83 if ((kd = gui_harray(jd)))
84 for (i = m; i > 0; i--)
85 if ((ld = gui_varray(kd)))
87 if (p1) gui_label(ld, number(i), 0, (i == 1) ? GUI_NW : 0, 0, 0);
88 if (p1) gui_label(ld, hole_score(i, 0), 0, 0, gui_wht, gui_wht);
89 if (p1) gui_label(ld, hole_score(i, 1), 0, 0, gui_red, gui_wht);
90 if (p2) gui_label(ld, hole_score(i, 2), 0, 0, gui_grn, gui_wht);
91 if (p3) gui_label(ld, hole_score(i, 3), 0, 0, gui_blu, gui_wht);
92 if (p4) gui_label(ld, hole_score(i, 4), 0, 0, gui_yel, gui_wht);
94 if ((kd = gui_varray(jd)))
97 if (p1) gui_label(kd, _("Par"), 0, GUI_NW, gui_wht, gui_wht);
98 if (p1) gui_label(kd, _("P1"), 0, GUI_SW * l1, gui_red, gui_wht);
99 if (p2) gui_label(kd, _("P2"), 0, GUI_SW * l2, gui_grn, gui_wht);
100 if (p3) gui_label(kd, _("P3"), 0, GUI_SW * l3, gui_blu, gui_wht);
101 if (p4) gui_label(kd, _("P4"), 0, GUI_SW * l4, gui_yel, gui_wht);
107 if ((jd = gui_hstack(id)))
109 if ((kd = gui_varray(jd)))
111 if (p1) gui_label(kd, _("Tot"), 0, GUI_TOP, 0, 0);
112 if (p1) gui_label(kd, hole_tot(0), 0, 0, gui_wht, gui_wht);
113 if (p1) gui_label(kd, hole_tot(1), 0, GUI_BOT * l1, gui_red, gui_wht);
114 if (p2) gui_label(kd, hole_tot(2), 0, GUI_BOT * l2, gui_grn, gui_wht);
115 if (p3) gui_label(kd, hole_tot(3), 0, GUI_BOT * l3, gui_blu, gui_wht);
116 if (p4) gui_label(kd, hole_tot(4), 0, GUI_BOT * l4, gui_yel, gui_wht);
118 if ((kd = gui_varray(jd)))
120 if (p1) gui_label(kd, _("I"), 0, GUI_NE, 0, 0);
121 if (p1) gui_label(kd, hole_in(0), 0, 0, gui_wht, gui_wht);
122 if (p1) gui_label(kd, hole_in(1), 0, GUI_SE * l1, gui_red, gui_wht);
123 if (p2) gui_label(kd, hole_in(2), 0, GUI_SE * l2, gui_grn, gui_wht);
124 if (p3) gui_label(kd, hole_in(3), 0, GUI_SE * l3, gui_blu, gui_wht);
125 if (p4) gui_label(kd, hole_in(4), 0, GUI_SE * l4, gui_yel, gui_wht);
127 if ((kd = gui_harray(jd)))
128 for (i = n; i > m; i--)
129 if ((ld = gui_varray(kd)))
131 if (p1) gui_label(ld, number(i), 0, (i == m+1) ? GUI_NW : 0, 0, 0);
132 if (p1) gui_label(ld, hole_score(i, 0), 0, 0, gui_wht, gui_wht);
133 if (p1) gui_label(ld, hole_score(i, 1), 0, 0, gui_red, gui_wht);
134 if (p2) gui_label(ld, hole_score(i, 2), 0, 0, gui_grn, gui_wht);
135 if (p3) gui_label(ld, hole_score(i, 3), 0, 0, gui_blu, gui_wht);
136 if (p4) gui_label(ld, hole_score(i, 4), 0, 0, gui_yel, gui_wht);
138 if ((kd = gui_varray(jd)))
141 if (p1) gui_label(kd, _("Par"), 0, GUI_NW, gui_wht, gui_wht);
142 if (p1) gui_label(kd, _("P1"), 0, GUI_SW * l1, gui_red, gui_wht);
143 if (p2) gui_label(kd, _("P2"), 0, GUI_SW * l2, gui_grn, gui_wht);
144 if (p3) gui_label(kd, _("P3"), 0, GUI_SW * l3, gui_blu, gui_wht);
145 if (p4) gui_label(kd, _("P4"), 0, GUI_SW * l4, gui_yel, gui_wht);
149 gui_layout(id, 0, 0);
155 /*---------------------------------------------------------------------------*/
157 static int shared_stick_basic(int id, int a, int v)
161 if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a))
162 jd = gui_stick(id, v, 0);
163 else if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a))
164 jd = gui_stick(id, 0, v);
172 static void shared_stick(int id, int a, int v)
174 shared_stick_basic(id, a, v);
177 /*---------------------------------------------------------------------------*/
183 static int title_action(int i)
185 audio_play(AUD_MENU, 1.0f);
189 case TITLE_PLAY: return goto_state(&st_course);
190 case TITLE_CONF: return goto_state(&st_conf);
191 case TITLE_EXIT: return 0;
196 static int title_enter(void)
200 /* Build the title GUI. */
202 if ((id = gui_vstack(0)))
204 gui_label(id, "Neverputt", GUI_LRG, GUI_ALL, 0, 0);
207 if ((jd = gui_harray(id)))
211 if ((kd = gui_varray(jd)))
213 gui_start(kd, sgettext("menu^Play"), GUI_MED, TITLE_PLAY, 1);
214 gui_state(kd, sgettext("menu^Options"), GUI_MED, TITLE_CONF, 0);
215 gui_state(kd, sgettext("menu^Exit"), GUI_MED, TITLE_EXIT, 0);
220 gui_layout(id, 0, 0);
229 static void title_leave(int id)
234 static void title_paint(int id, float t)
240 static void title_timer(int id, float dt)
242 float g[3] = { 0.f, 0.f, 0.f };
245 game_set_fly(fcosf(time_state() / 10.f));
250 static void title_point(int id, int x, int y, int dx, int dy)
252 gui_pulse(gui_point(id, x, y), 1.2f);
255 static int title_click(int b, int d)
257 return (d && b < 0) ? title_action(gui_token(gui_click())) : 1;
260 static int title_buttn(int b, int d)
264 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
265 return title_action(gui_token(gui_click()));
266 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
267 return title_action(TITLE_EXIT);
272 /*---------------------------------------------------------------------------*/
277 #define COURSE_BACK -1
279 static int course_action(int i)
281 if (course_exists(i))
284 goto_state(&st_party);
286 if (i == COURSE_BACK)
287 goto_state(&st_title);
292 static int course_enter(void)
294 int w = config_get_d(CONFIG_WIDTH);
295 int h = config_get_d(CONFIG_HEIGHT);
297 int id, jd, kd, ld, md, i = 0, j, n = course_count();
298 int m = (int)(sqrt(n/2.0)*2);
300 if ((id = gui_vstack(0)))
302 gui_label(id, _("Select Course"), GUI_MED, GUI_ALL, 0, 0);
305 if ((jd = gui_hstack(id)))
307 shot_id = gui_image(jd, course_shot(0), w / 3, h / 3);
311 if ((kd = gui_varray(jd)))
313 for(i = 0; i < n; i += m)
315 if ((ld = gui_harray(kd)))
317 for (j = (m - 1); j >= 0; j--)
321 md = gui_image(ld, course_shot(i + j),
322 w / 3 / m, h / 3 / m);
323 gui_active(md, i + j, 0);
337 desc_id = gui_multi(id, _(course_desc(0)), GUI_SML, GUI_ALL, gui_yel, gui_wht);
340 if ((jd = gui_hstack(id)))
343 gui_state(jd, _("Back"), GUI_SML, COURSE_BACK, 0);
346 gui_layout(id, 0, 0);
349 audio_music_fade_to(0.5f, "bgm/inter.ogg");
354 static void course_leave(int id)
359 static void course_paint(int id, float t)
365 static void course_timer(int id, float dt)
370 static void course_point(int id, int x, int y, int dx, int dy)
374 if ((jd = gui_point(id, x, y)))
376 int i = gui_token(jd);
378 if (course_exists(i))
380 gui_set_image(shot_id, course_shot(i));
381 gui_set_multi(desc_id, _(course_desc(i)));
387 static void course_stick(int id, int a, int v)
391 if ((jd = shared_stick_basic(id, a, v)))
393 int i = gui_token(jd);
395 if (course_exists(i))
397 gui_set_image(shot_id, course_shot(i));
398 gui_set_multi(desc_id, _(course_desc(i)));
404 static int course_click(int b, int d)
406 return (d && b < 0) ? course_action(gui_token(gui_click())) : 1;
409 static int course_buttn(int b, int d)
413 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
414 return course_action(gui_token(gui_click()));
415 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
416 return course_action(COURSE_BACK);
421 /*---------------------------------------------------------------------------*/
430 static int party_action(int i)
435 audio_play(AUD_MENU, 1.f);
437 goto_state(&st_next);
440 audio_play(AUD_MENU, 1.f);
442 goto_state(&st_next);
445 audio_play(AUD_MENU, 1.f);
447 goto_state(&st_next);
450 audio_play(AUD_MENU, 1.f);
452 goto_state(&st_next);
455 audio_play(AUD_MENU, 1.f);
456 goto_state(&st_course);
462 static int party_enter(void)
466 if ((id = gui_vstack(0)))
468 gui_label(id, _("Players?"), GUI_MED, GUI_ALL, 0, 0);
471 if ((jd = gui_harray(id)))
473 int p4 = gui_state(jd, "4", GUI_LRG, PARTY_4, 0);
474 int p3 = gui_state(jd, "3", GUI_LRG, PARTY_3, 0);
475 int p2 = gui_state(jd, "2", GUI_LRG, PARTY_2, 0);
476 int p1 = gui_state(jd, "1", GUI_LRG, PARTY_1, 0);
478 gui_set_color(p1, gui_red, gui_wht);
479 gui_set_color(p2, gui_grn, gui_wht);
480 gui_set_color(p3, gui_blu, gui_wht);
481 gui_set_color(p4, gui_yel, gui_wht);
488 if ((jd = gui_hstack(id)))
491 gui_state(jd, _("Back"), GUI_SML, PARTY_B, 0);
494 gui_layout(id, 0, 0);
500 static void party_leave(int id)
505 static void party_paint(int id, float t)
511 static void party_timer(int id, float dt)
516 static void party_point(int id, int x, int y, int dx, int dy)
518 gui_pulse(gui_point(id, x, y), 1.2f);
521 static int party_click(int b, int d)
523 return (d && b < 0) ? party_action(gui_token(gui_click())) : 1;
526 static int party_buttn(int b, int d)
530 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
531 return party_action(gui_token(gui_click()));
532 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
533 return party_action(PARTY_B);
538 /*---------------------------------------------------------------------------*/
540 static int paused = 0;
542 static struct state *st_continue;
543 static struct state *st_quit;
545 #define PAUSE_CONTINUE 1
548 int goto_pause(struct state *s, int e)
550 if (curr_state() == &st_pause)
553 if (e && !config_tst_d(CONFIG_KEY_PAUSE, SDLK_ESCAPE))
554 return goto_state(s);
556 st_continue = curr_state();
560 return goto_state(&st_pause);
563 static int pause_action(int i)
565 audio_play(AUD_MENU, 1.0f);
570 return goto_state(st_continue ? st_continue : &st_title);
573 return goto_state(st_quit);
578 static int pause_enter(void)
582 audio_music_fade_out(0.2f);
584 if ((id = gui_vstack(0)))
586 td = gui_label(id, _("Paused"), GUI_LRG, GUI_ALL, 0, 0);
589 if ((jd = gui_harray(id)))
591 gui_state(jd, _("Quit"), GUI_SML, PAUSE_QUIT, 0);
592 gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 1);
596 gui_layout(id, 0, 0);
603 static void pause_leave(int id)
607 audio_music_fade_in(0.5f);
610 static void pause_paint(int id, float t)
617 static void pause_timer(int id, float dt)
622 static void pause_point(int id, int x, int y, int dx, int dy)
624 gui_pulse(gui_point(id, x, y), 1.2f);
627 static int pause_click(int b, int d)
629 return (d && b < 0) ? pause_action(gui_token(gui_click())) : 1;
632 static int pause_keybd(int c, int d)
634 if (d && config_tst_d(CONFIG_KEY_PAUSE, c))
635 return pause_action(PAUSE_CONTINUE);
639 static int pause_buttn(int b, int d)
643 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
644 return pause_action(gui_token(gui_click()));
645 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
646 return pause_action(PAUSE_CONTINUE);
651 /*---------------------------------------------------------------------------*/
653 static int shared_keybd(int c, int d)
657 if (config_tst_d(CONFIG_KEY_PAUSE, c))
658 return goto_pause(&st_over, 0);
663 /*---------------------------------------------------------------------------*/
667 static int next_enter(void)
672 sprintf(str, _("Hole %02d"), curr_hole());
674 if ((id = gui_vstack(0)))
676 gui_label(id, str, GUI_MED, GUI_ALL, 0, 0);
679 gui_label(id, _("Player"), GUI_SML, GUI_TOP, 0, 0);
681 switch (curr_player())
684 gui_label(id, "1", GUI_LRG, GUI_BOT, gui_red, gui_wht);
685 if (curr_party() > 1) audio_play(AUD_PLAYER1, 1.f);
688 gui_label(id, "2", GUI_LRG, GUI_BOT, gui_grn, gui_wht);
689 if (curr_party() > 1) audio_play(AUD_PLAYER2, 1.f);
692 gui_label(id, "3", GUI_LRG, GUI_BOT, gui_blu, gui_wht);
693 if (curr_party() > 1) audio_play(AUD_PLAYER3, 1.f);
696 gui_label(id, "4", GUI_LRG, GUI_BOT, gui_yel, gui_wht);
697 if (curr_party() > 1) audio_play(AUD_PLAYER4, 1.f);
700 gui_layout(id, 0, 0);
712 static void next_leave(int id)
718 static void next_paint(int id, float t)
725 static void next_timer(int id, float dt)
730 static void next_point(int id, int x, int y, int dx, int dy)
732 gui_pulse(gui_point(id, x, y), 1.2f);
735 static int next_click(int b, int d)
737 return (d && b < 0) ? goto_state(&st_flyby) : 1;
740 static int next_keybd(int c, int d)
745 return goto_state(&st_poser);
746 if (config_tst_d(CONFIG_KEY_PAUSE, c))
747 return goto_pause(&st_over, 0);
748 if ('0' <= c && c <= '9')
749 num = num * 10 + c - '0';
754 static int next_buttn(int b, int d)
758 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
764 return goto_state(&st_next);
766 return goto_state(&st_flyby);
768 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
769 return goto_pause(&st_over, 1);
774 /*---------------------------------------------------------------------------*/
776 static int poser_enter(void)
782 static void poser_paint(int id, float t)
787 static int poser_buttn(int b, int d)
791 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
792 return goto_state(&st_next);
793 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
794 return goto_state(&st_next);
799 /*---------------------------------------------------------------------------*/
801 static int flyby_enter(void)
811 static void flyby_leave(int id)
816 static void flyby_paint(int id, float t)
822 static void flyby_timer(int id, float dt)
824 float t = time_state();
826 if (dt > 0.f && t > 1.f)
827 goto_state(&st_stroke);
829 game_set_fly(1.f - t);
834 static int flyby_click(int b, int d)
839 return goto_state(&st_stroke);
844 static int flyby_buttn(int b, int d)
848 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
851 return goto_state(&st_stroke);
853 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
854 return goto_pause(&st_over, 1);
859 /*---------------------------------------------------------------------------*/
861 static int stroke_rotate = 0;
862 static int stroke_mag = 0;
864 static int stroke_enter(void)
868 config_set_d(CONFIG_CAMERA, 2);
869 config_set_grab(!paused);
877 static void stroke_leave(int id)
881 config_set_d(CONFIG_CAMERA, 0);
884 static void stroke_paint(int id, float t)
890 static void stroke_timer(int id, float dt)
892 float g[3] = { 0.f, 0.f, 0.f };
896 if (SDL_GetModState() & KMOD_SHIFT ||
897 (joystick && SDL_JoystickGetButton(joystick,
898 config_get_d(CONFIG_JOYSTICK_BUTTON_B))))
903 game_set_rot(stroke_rotate * k);
904 game_set_mag(stroke_mag * k);
906 game_update_view(dt);
910 static void stroke_point(int id, int x, int y, int dx, int dy)
916 static void stroke_stick(int id, int a, int v)
918 if (v == 1) /* See 'loop' in main.c */
921 if (config_tst_d(CONFIG_JOYSTICK_AXIS_X, a))
922 stroke_rotate = (6 * v) / JOY_MAX;
923 else if (config_tst_d(CONFIG_JOYSTICK_AXIS_Y, a))
924 stroke_mag = -((6 * v) / JOY_MAX);
927 static int stroke_click(int b, int d)
929 return (d && b < 0) ? goto_state(&st_roll) : 1;
932 static int stroke_buttn(int b, int d)
936 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
937 return goto_state(&st_roll);
938 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
939 return goto_pause(&st_over, 1);
944 /*---------------------------------------------------------------------------*/
946 static int roll_enter(void)
958 static void roll_leave(int id)
963 static void roll_paint(int id, float t)
969 static void roll_timer(int id, float dt)
971 float g[3] = { 0.0f, -9.8f, 0.0f };
973 switch (game_step(g, dt))
975 case GAME_STOP: goto_state(&st_stop); break;
976 case GAME_GOAL: goto_state(&st_goal); break;
977 case GAME_FALL: goto_state(&st_fall); break;
981 static int roll_buttn(int b, int d)
985 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
986 return goto_pause(&st_over, 1);
991 /*---------------------------------------------------------------------------*/
993 static int goal_enter(void)
997 if ((id = gui_label(0, _("It's In!"), GUI_MED, GUI_ALL, gui_grn, gui_grn)))
998 gui_layout(id, 0, 0);
1010 static void goal_leave(int id)
1016 static void goal_paint(int id, float t)
1023 static void goal_timer(int id, float dt)
1025 if (time_state() > 3)
1028 goto_state(&st_next);
1030 goto_state(&st_score);
1034 static int goal_click(int b, int d)
1036 if (b < 0 && d == 1)
1039 goto_state(&st_next);
1041 goto_state(&st_score);
1046 static int goal_buttn(int b, int d)
1050 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
1053 goto_state(&st_next);
1055 goto_state(&st_score);
1057 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
1058 return goto_pause(&st_over, 1);
1063 /*---------------------------------------------------------------------------*/
1065 static int stop_enter(void)
1077 static void stop_leave(int id)
1082 static void stop_paint(int id, float t)
1088 static void stop_timer(int id, float dt)
1090 float g[3] = { 0.f, 0.f, 0.f };
1092 game_update_view(dt);
1095 if (time_state() > 1)
1098 goto_state(&st_next);
1100 goto_state(&st_score);
1104 static int stop_click(int b, int d)
1106 if (b < 0 && d == 1)
1109 goto_state(&st_next);
1111 goto_state(&st_score);
1116 static int stop_buttn(int b, int d)
1120 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
1123 goto_state(&st_next);
1125 goto_state(&st_score);
1127 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
1128 return goto_pause(&st_over, 1);
1133 /*---------------------------------------------------------------------------*/
1135 static int fall_enter(void)
1139 if ((id = gui_label(0, _("1 Stroke Penalty"), GUI_MED, GUI_ALL, gui_blk, gui_red)))
1140 gui_layout(id, 0, 0);
1147 /* game_draw(0);*/ /*TODO: is this call ok? */ /* No, it's not. */
1155 static void fall_leave(int id)
1161 static void fall_paint(int id, float t)
1168 static void fall_timer(int id, float dt)
1170 if (time_state() > 3)
1173 goto_state(&st_next);
1175 goto_state(&st_score);
1179 static int fall_click(int b, int d)
1181 if (b < 0 && d == 1)
1184 goto_state(&st_next);
1186 goto_state(&st_score);
1191 static int fall_buttn(int b, int d)
1195 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
1198 goto_state(&st_next);
1200 goto_state(&st_score);
1202 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
1203 return goto_pause(&st_over, 1);
1208 /*---------------------------------------------------------------------------*/
1210 static int score_enter(void)
1212 audio_music_fade_out(2.f);
1217 return score_card(_("Scores"), gui_yel, gui_red);
1220 static void score_leave(int id)
1225 static void score_paint(int id, float t)
1231 static void score_timer(int id, float dt)
1236 static int score_click(int b, int d)
1238 if (b < 0 && d == 1)
1241 return goto_state(&st_next);
1243 return goto_state(&st_title);
1248 static int score_buttn(int b, int d)
1252 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
1255 goto_state(&st_next);
1257 goto_state(&st_score);
1259 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
1260 return goto_pause(&st_over, 1);
1265 /*---------------------------------------------------------------------------*/
1267 static int over_enter(void)
1269 audio_music_fade_out(2.f);
1270 return score_card(_("Final Scores"), gui_yel, gui_red);
1273 static void over_leave(int id)
1278 static void over_paint(int id, float t)
1284 static void over_timer(int id, float dt)
1289 static int over_click(int b, int d)
1291 return (d && b < 0) ? goto_state(&st_title) : 1;
1294 static int over_buttn(int b, int d)
1298 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
1299 return goto_state(&st_title);
1300 if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
1301 return goto_state(&st_title);
1306 /*---------------------------------------------------------------------------*/
1308 struct state st_title = {
1322 struct state st_course = {
1336 struct state st_party = {
1350 struct state st_next = {
1364 struct state st_poser = {
1378 struct state st_flyby = {
1392 struct state st_stroke = {
1406 struct state st_roll = {
1420 struct state st_goal = {
1434 struct state st_stop = {
1448 struct state st_fall = {
1462 struct state st_score = {
1476 struct state st_over = {
1490 struct state st_pause = {