X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=putt%2Fst_all.c;h=a4c366ecd68f9a310af1413c9a231cc80cd35e16;hb=3b2ab48457222f022fb38f08c9693a367956f3f1;hp=fe2fd6879a7a38878c42f5c9eeaa6876db311557;hpb=14fc60505a9c0cc1c451b4af7c91afdc6f4bcb67;p=neverball diff --git a/putt/st_all.c b/putt/st_all.c index fe2fd68..a4c366e 100644 --- a/putt/st_all.c +++ b/putt/st_all.c @@ -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); } @@ -238,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) @@ -350,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) @@ -369,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)); @@ -479,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) @@ -525,7 +547,10 @@ static struct state *st_quit; int goto_pause(struct state *s, int e) { - if (e && (SDL_GetModState() & KMOD_SHIFT)) + 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(); @@ -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(); } @@ -592,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) @@ -630,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); } @@ -693,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); } @@ -703,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) @@ -724,12 +745,6 @@ static int next_keybd(int c, int d) return goto_state(&st_poser); if (config_tst_d(CONFIG_KEY_PAUSE, c)) return goto_pause(&st_over, 0); - if (c == SDLK_c) - { - hole_goto(num, -1); - num = 0; - return goto_state(&st_next); - } if ('0' <= c && c <= '9') num = num * 10 + c - '0'; } @@ -741,7 +756,15 @@ 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); } @@ -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(); } @@ -806,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) @@ -859,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(); } @@ -883,7 +905,6 @@ static void stroke_timer(int id, float dt) 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) @@ -939,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(); } @@ -955,7 +976,6 @@ 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_buttn(int b, int d) @@ -993,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(); } @@ -1009,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) @@ -1060,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(); } @@ -1072,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) { @@ -1126,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(); @@ -1140,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(); } @@ -1156,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) @@ -1205,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) @@ -1259,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) @@ -1297,6 +1312,7 @@ struct state st_title = { title_timer, title_point, shared_stick, + NULL, title_click, NULL, title_buttn, @@ -1309,7 +1325,8 @@ struct state st_course = { course_paint, course_timer, course_point, - shared_stick, + course_stick, + NULL, course_click, NULL, course_buttn, @@ -1323,6 +1340,7 @@ struct state st_party = { party_timer, party_point, shared_stick, + NULL, party_click, NULL, party_buttn, @@ -1336,6 +1354,7 @@ struct state st_next = { next_timer, next_point, shared_stick, + NULL, next_click, next_keybd, next_buttn, @@ -1351,6 +1370,7 @@ struct state st_poser = { NULL, NULL, NULL, + NULL, poser_buttn, 1, 0 }; @@ -1362,6 +1382,7 @@ struct state st_flyby = { flyby_timer, NULL, NULL, + NULL, flyby_click, shared_keybd, flyby_buttn, @@ -1375,6 +1396,7 @@ struct state st_stroke = { stroke_timer, stroke_point, stroke_stick, + NULL, stroke_click, shared_keybd, stroke_buttn, @@ -1389,6 +1411,7 @@ struct state st_roll = { NULL, NULL, NULL, + NULL, shared_keybd, roll_buttn, 0, 0 @@ -1401,6 +1424,7 @@ struct state st_goal = { goal_timer, NULL, NULL, + NULL, goal_click, shared_keybd, goal_buttn, @@ -1414,6 +1438,7 @@ struct state st_stop = { stop_timer, NULL, NULL, + NULL, stop_click, shared_keybd, stop_buttn, @@ -1427,6 +1452,7 @@ struct state st_fall = { fall_timer, NULL, NULL, + NULL, fall_click, shared_keybd, fall_buttn, @@ -1440,6 +1466,7 @@ struct state st_score = { score_timer, NULL, NULL, + NULL, score_click, shared_keybd, score_buttn, @@ -1453,6 +1480,7 @@ struct state st_over = { over_timer, NULL, NULL, + NULL, over_click, NULL, over_buttn, @@ -1466,6 +1494,7 @@ struct state st_pause = { pause_timer, pause_point, shared_stick, + NULL, pause_click, pause_keybd, pause_buttn,