Example #1
0
static int pause_gui(void)
{
    int id, jd, title_id;

    /* Build the pause GUI. */

    if ((id = gui_vstack(0)))
    {
        title_id = gui_label(id, _("Paused"), GUI_LRG, 0, 0);

        gui_space(id);

        if ((jd = gui_harray(id)))
        {
            gui_state(jd, _("Quit"), GUI_SML, PAUSE_EXIT, 0);

            if (progress_same_avail())
                gui_state(jd, _("Restart"), GUI_SML, PAUSE_RESTART, 0);

            gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 0);
        }

        gui_pulse(title_id, 1.2f);
        gui_layout(id, 0, 0);
    }

    return id;
}
Example #2
0
static int time_out_keybd(int c, int d)
{
    if (d)
    {
        if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail())
        {
            if (progress_same())
                goto_state(&st_play_ready);
        }
    }
    return 1;
}
Example #3
0
static int goal_keybd(int c, int d)
{
    if (d)
    {
        if (config_tst_d(CONFIG_KEY_SCORE_NEXT, c))
            return goal_action(gui_score_next(gui_score_get()));
        if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail())
            return goal_action(GOAL_SAME);
    }

    return 1;
}
Example #4
0
static int goal_keybd(int c, int d)
{
    if (d)
    {
        if (c == KEY_EXIT)
            return goal_action(GUI_BACK, 0);
        if (config_tst_d(CONFIG_KEY_SCORE_NEXT, c))
            return goal_action(GUI_SCORE, GUI_SCORE_NEXT(gui_score_get()));
        if (config_tst_d(CONFIG_KEY_RESTART, c) && progress_same_avail())
            return goal_action(GOAL_SAME, 0);
    }

    return 1;
}
Example #5
0
static int play_loop_keybd(int c, int d)
{
    if (d)
    {
        if (config_tst_d(CONFIG_KEY_CAMERA_R, c))
            rot_set(DIR_R, 1.0f, 0);
        if (config_tst_d(CONFIG_KEY_CAMERA_L, c))
            rot_set(DIR_L, 1.0f, 0);
        if (config_tst_d(CONFIG_KEY_ROTATE_FAST, c))
            fast_rotate = 1;

        keybd_camera(c);

        if (config_tst_d(CONFIG_KEY_RESTART, c) &&
            progress_same_avail())
        {
            if (progress_same())
                goto_state(&st_play_ready);
        }
        if (c == KEY_EXIT)
            goto_state(&st_pause);
    }
    else
    {
        if (config_tst_d(CONFIG_KEY_CAMERA_R, c))
            rot_clr(DIR_R);
        if (config_tst_d(CONFIG_KEY_CAMERA_L, c))
            rot_clr(DIR_L);
        if (config_tst_d(CONFIG_KEY_ROTATE_FAST, c))
            fast_rotate = 0;
    }

    if (d && c == KEY_LOOKAROUND && config_cheat())
        return goto_state(&st_look);

    if (d && c == KEY_POSE)
        show_hud = !show_hud;

    if (d && c == SDLK_c && config_cheat())
    {
        progress_stat(GAME_GOAL);
        return goto_state(&st_goal);
    }
    return 1;
}
Example #6
0
static int fall_out_enter(void)
{
    int id, jd, kd;

    /* Reset hack. */
    resume = 0;

    if ((id = gui_vstack(0)))
    {
        kd = gui_label(id, _("Fall-out!"), GUI_LRG, GUI_ALL, gui_gry, gui_red);

        gui_space(id);

        if ((jd = gui_harray(id)))
        {
            if (progress_dead())
                gui_start(jd, _("Exit"), GUI_SML, FALL_OUT_OVER, 0);

            if (progress_next_avail())
                gui_start(jd, _("Next Level"),  GUI_SML, FALL_OUT_NEXT, 0);

            if (progress_same_avail())
                gui_start(jd, _("Retry Level"), GUI_SML, FALL_OUT_SAME, 0);

            if (demo_saved())
                gui_state(jd, _("Save Replay"), GUI_SML, FALL_OUT_SAVE, 0);
        }

        gui_space(id);

        gui_pulse(kd, 1.2f);
        gui_layout(id, 0, 0);
    }

    audio_music_fade_out(2.0f);
    /* audio_play(AUD_FALL, 1.0f); */

    video_clr_grab();

    return id;
}
Example #7
0
static int goal_gui(void)
{
    const char *s1 = _("New Record");
    const char *s2 = _("GOAL");

    int id, jd, kd, ld, md;

    int high = progress_lvl_high();

    if ((id = gui_vstack(0)))
    {
        int gid = 0;

        if (curr_mode() == MODE_CHALLENGE)
        {
            int coins, score, balls;
            int i;

            /* Reverse-engineer initial score and balls. */

            if (resume)
            {
                coins = 0;
                score = curr_score();
                balls = curr_balls();
            }
            else
            {
                coins = curr_coins();
                score = curr_score() - coins;
                balls = curr_balls();

                for (i = curr_score(); i > score; i--)
                    if (progress_reward_ball(i))
                        balls--;
            }

            /*if ((jd = gui_hstack(id)))
            {
                gui_filler(jd);*/

                if ((kd = gui_vstack(id)))
                {
                    if ((ld = video.device_w < video.device_h ? gui_vstack(kd) : gui_hstack(kd)))
                    {
                        if ((md = gui_harray(ld)))
                        {
                            balls_id = gui_count(md, 100, GUI_MED);
                            gui_label(md, _("Balls"), GUI_MED,
                                      gui_wht, gui_wht);
                        }
                        if ((md = gui_harray(ld)))
                        {
                            score_id = gui_count(md, 1000, GUI_MED);
                            gui_label(md, _("Score"), GUI_MED,
                                      gui_wht, gui_wht);
                        }
                        if ((md = gui_harray(ld)))
                        {
                            coins_id = gui_count(md, 100, GUI_MED);
                            gui_label(md, _("Coins"), GUI_MED,
                                      gui_wht, gui_wht);
                        }

                        gui_set_count(balls_id, balls);
                        gui_set_count(score_id, score);
                        gui_set_count(coins_id, coins);
                    }

                    if ((ld = gui_harray(kd)))
                    {
                        const struct level *l;

                        gui_label(ld, "", GUI_SML, 0, 0);

                        for (i = MAXLVL - 1; i >= 0; i--)
                            if ((l = get_level(i)) && level_bonus(l))
                            {
                                const GLubyte *c = (level_opened(l) ?
                                                    gui_grn : gui_gry);

                                gui_label(ld, level_name(l), GUI_SML, c, c);
                            }

                        gui_label(ld, "", GUI_SML, 0, 0);
                    }

                    gui_set_rect(kd, GUI_ALL);
                }

                /*gui_filler(jd);
            }*/

            gui_space(id);
        }
        else
        {
            gid = gui_label(id, high ? s1 : s2, GUI_LRG, gui_blu, gui_grn);
            gui_space(id);

            balls_id = score_id = coins_id = 0;
        }

        gui_score_board(id, (GUI_SCORE_COIN |
                             GUI_SCORE_TIME |
                             GUI_SCORE_GOAL |
                             GUI_SCORE_SAVE), 1, high);

        gui_space(id);

        if ((jd = gui_harray(id)))
        {
            if      (progress_done())
                gui_start(jd, _("Finish"), GUI_MED, GOAL_DONE, 0);
            else if (progress_last())
                gui_start(jd, _("Finish"), GUI_MED, GOAL_LAST, 0);

            if (progress_next_avail())
                gui_start(jd, _("Next"),  GUI_MED, GOAL_NEXT, 0);

            if (progress_same_avail())
                gui_start(jd, _("Retry"), GUI_MED, GOAL_SAME, 0);

            if (!progress_done() && !progress_last())
                gui_start(jd, _("Quit"), GUI_MED, GOAL_DONE, 0);
            //if (demo_saved())
            //    gui_state(jd, _("Save Replay"), GUI_SML, GOAL_SAVE, 0);
        }

        if (!resume && gid)
            gui_pulse(gid, 1.2f);

        gui_layout(id, 0, 0);

    }

    set_score_board(level_score(curr_level(), SCORE_COIN), progress_coin_rank(),
                    level_score(curr_level(), SCORE_TIME), progress_time_rank(),
                    level_score(curr_level(), SCORE_GOAL), progress_goal_rank());

    return id;
}
Example #8
0
static int goal_enter(void)
{
    const char *s1 = _("New Record");
    const char *s2 = _("GOAL");

    int id, jd, kd, ld, md;

    const struct level *l = get_level(curr_level());

    int high = progress_lvl_high();

    if (new_name)
    {
        progress_rename(0);
        new_name = 0;
    }

    if ((id = gui_vstack(0)))
    {
        int gid;

        if (high)
            gid = gui_label(id, s1, GUI_MED, GUI_ALL, gui_grn, gui_grn);
        else
            gid = gui_label(id, s2, GUI_LRG, GUI_ALL, gui_blu, gui_grn);

        gui_space(id);

        if (curr_mode() == MODE_CHALLENGE)
        {
            int coins, score, balls;
            char msg[MAXSTR] = "";
            int i;

            /* Reverse-engineer initial score and balls. */

            if (resume)
            {
                coins = 0;
                score = curr_score();
                balls = curr_balls();
            }
            else
            {
                coins = curr_coins();
                score = curr_score() - coins;
                balls = curr_balls();

                for (i = curr_score(); i > score; i--)
                    if (progress_reward_ball(i))
                        balls--;
            }

            sprintf(msg, ngettext("%d new bonus level",
                                  "%d new bonus levels",
                                  curr_bonus()), curr_bonus());

            if ((jd = gui_hstack(id)))
            {
                gui_filler(jd);

                if ((kd = gui_vstack(jd)))
                {
                    if ((ld = gui_hstack(kd)))
                    {
                        if ((md = gui_harray(ld)))
                        {
                            balls_id = gui_count(md, 100, GUI_MED, GUI_NE);
                            gui_label(md, _("Balls"), GUI_SML, 0,
                                      gui_wht, gui_wht);
                        }
                        if ((md = gui_harray(ld)))
                        {
                            score_id = gui_count(md, 1000, GUI_MED, 0);
                            gui_label(md, _("Score"), GUI_SML, 0,
                                      gui_wht, gui_wht);
                        }
                        if ((md = gui_harray(ld)))
                        {
                            coins_id = gui_count(md, 100, GUI_MED, 0);
                            gui_label(md, _("Coins"), GUI_SML, GUI_NW,
                                      gui_wht, gui_wht);
                        }

                        gui_set_count(balls_id, balls);
                        gui_set_count(score_id, score);
                        gui_set_count(coins_id, coins);
                    }

                    gui_label(kd, msg, GUI_SML, GUI_BOT, 0, 0);
                }

                gui_filler(jd);
            }

            gui_space(id);
        }
        else
        {
            balls_id = score_id = coins_id = 0;
        }

        gui_score_board(id, (GUI_MOST_COINS |
                             GUI_BEST_TIMES |
                             GUI_FAST_UNLOCK), 1, high);

        gui_space(id);

        if ((jd = gui_harray(id)))
        {
            if      (progress_done())
                gui_start(jd, _("Finish"), GUI_SML, GOAL_DONE, 0);
            else if (progress_last())
                gui_start(jd, _("Finish"), GUI_SML, GOAL_LAST, 0);

            if (progress_next_avail())
                gui_start(jd, _("Next Level"),  GUI_SML, GOAL_NEXT, 0);

            if (progress_same_avail())
                gui_start(jd, _("Retry Level"), GUI_SML, GOAL_SAME, 0);

            if (demo_saved())
                gui_state(jd, _("Save Replay"), GUI_SML, GOAL_SAVE, 0);
        }

        if (!resume)
            gui_pulse(gid, 1.2f);

        gui_layout(id, 0, 0);

    }

    set_score_board(&l->score.most_coins,  progress_coin_rank(),
                    &l->score.best_times,  progress_time_rank(),
                    &l->score.fast_unlock, progress_goal_rank());

    audio_music_fade_out(2.0f);

    video_clr_grab();

    /* Reset hack. */
    resume = 0;

    return id;
}