Exemplo n.º 1
0
        internal override void OnTimer(int id, float dt)
        {
            if (Progress.curr_mode() != MODE.MODE_CHALLENGE || State.time_state() > 3)
            {
                State.goto_state(st_start.get_st_start());
            }

            gui.gui_timer(id, dt);
        }
Exemplo n.º 2
0
        internal override int OnEnter()
        {
            int id, jd, kd;

            if ((id = gui.gui_vstack(0)) != 0)
            {
                if ((jd = gui.gui_hstack(id)) != 0)
                {
                    gui.gui_filler(jd);

                    if ((kd = gui.gui_vstack(jd)) != 0)
                    {
                        string ln = Level.level_name(Progress.curr_level());
                        int    b  = Level.level_bonus(Progress.curr_level());

                        string setattr, lvlattr;

                        if (b != 0)
                        {
                            lvlattr = "Bonus Level " + ln;
                        }
                        else
                        {
                            lvlattr = "Level " + ln;
                        }

                        if (Progress.curr_mode() == MODE.MODE_CHALLENGE)
                        {
                            setattr = Set.set_name(Set.curr_set()) + ": " + game_common.mode_to_str(MODE.MODE_CHALLENGE, 1);
                        }
                        else
                        {
                            setattr = Set.set_name(Set.curr_set());
                        }

                        gui.gui_label(kd, lvlattr, b != 0 ? gui.GUI_MED : gui.GUI_LRG, gui.GUI_TOP,
                                      b != 0 ? widget.gui_wht : null, b != 0 ? widget.gui_grn : null);
                        gui.gui_label(kd, setattr, gui.GUI_SML, gui.GUI_BOT,
                                      widget.gui_wht, widget.gui_wht);
                    }
                    gui.gui_filler(jd);
                }
                gui.gui_space(id);

                gui.gui_multi(id, Level.level_msg(Progress.curr_level()),
                              gui.GUI_SML, gui.GUI_ALL,
                              widget.gui_wht, widget.gui_wht);

                gui.gui_layout(id, 0, 0);
            }

            game_server.game_set_fly(1, null);
            game_client.game_client_step();

            return(id);
        }
Exemplo n.º 3
0
        public static void hud_paint()
        {
            if (Progress.curr_mode() == MODE.MODE_CHALLENGE)
            {
                gui.gui_paint(Lhud_id);
            }

            gui.gui_paint(Rhud_id);
            gui.gui_paint(time_id);

            hud_view_paint();
        }
Exemplo n.º 4
0
        public static int start_action(int i)
        {
            Audio.audio_play(Common.AUD_MENU, 1.0f);

            switch (i)
            {
            case START_BACK:
                return(State.goto_state(st_set.get_st_set()));

            case START_CHALLENGE:
                if (Config.config_cheat() != 0)
                {
                    Progress.progress_init(Progress.curr_mode() == MODE.MODE_CHALLENGE ?
                                           MODE.MODE_NORMAL : MODE.MODE_CHALLENGE);
                    gui.gui_toggle(challenge_id);
                    return(1);
                }
                else
                {
                    Progress.progress_init(MODE.MODE_CHALLENGE);
                    return(start_action(0));
                }

            case Util.GUI_MOST_COINS:
            case Util.GUI_BEST_TIMES:
            case Util.GUI_FAST_UNLOCK:
                Util.gui_score_set(i);
                return(State.goto_state(get_st_start()));

            case START_OPEN_GOALS:
                Config.config_set_d(Config.CONFIG_LOCK_GOALS, 0);
                return(State.goto_state(get_st_start()));

            case START_LOCK_GOALS:
                Config.config_set_d(Config.CONFIG_LOCK_GOALS, 1);
                return(State.goto_state(get_st_start()));

            default:
                if (Progress.progress_play(i) != 0)
                {
                    return(State.goto_state(st_level.get_st_level()));
                }
                break;
            }

            return(1);
        }
Exemplo n.º 5
0
        internal override int OnEnter()
        {
            int id;

            if (Progress.curr_mode() != MODE.MODE_CHALLENGE)
            {
                return(0);
            }

            if ((id = gui.gui_label(0, "GAME OVER", gui.GUI_LRG, gui.GUI_ALL, widget.gui_gry, widget.gui_red)) != 0)
            {
                gui.gui_layout(id, 0, 0);
                gui.gui_pulse(id, 1.2f);
            }

            Audio.audio_music_fade_out(2.0f);
            Audio.audio_play(Common.AUD_OVER, 1);

            Video.video_clr_grab();

            return(id);
        }
Exemplo n.º 6
0
        internal override int OnEnter()
        {
            int w = Config.config_get_d(Config.CONFIG_WIDTH);
            int h = Config.config_get_d(Config.CONFIG_HEIGHT);
            int i, j;

            int id, jd, kd, ld;

            Progress.progress_init(MODE.MODE_NORMAL);

            if ((id = gui.gui_vstack(0)) != 0)
            {
                if ((jd = gui.gui_hstack(id)) != 0)
                {
                    gui.gui_label(jd, Set.set_name(Set.curr_set()), gui.GUI_SML, gui.GUI_ALL,
                                  widget.gui_yel, widget.gui_red);
                    gui.gui_filler(jd);
                    gui.gui_start(jd, "Back", gui.GUI_SML, st_start.START_BACK, 0);
                }

                gui.gui_space(id);

                if ((jd = gui.gui_harray(id)) != 0)
                {
                    if (Config.config_cheat() != 0)
                    {
                        if ((kd = gui.gui_vstack(jd)) != 0)
                        {
                            st_start.shot_id = gui.gui_image(kd, Set.set_shot(Set.curr_set()), 6 * w / 16, 6 * h / 16);

                            st_start.file_id = gui.gui_label(kd, " ", gui.GUI_SML, gui.GUI_ALL,
                                                             widget.gui_yel, widget.gui_red);
                        }
                    }
                    else
                    {
                        st_start.shot_id = gui.gui_image(jd, Set.set_shot(Set.curr_set()), 7 * w / 16, 7 * h / 16);
                    }

                    if ((kd = gui.gui_varray(jd)) != 0)
                    {
                        for (i = 0; i < 5; i++)
                        {
                            if ((ld = gui.gui_harray(kd)) != 0)
                            {
                                for (j = 4; j >= 0; j--)
                                {
                                    st_start.gui_level(ld, i * 5 + j);
                                }
                            }
                        }

                        st_start.challenge_id = gui.gui_state(kd, "Challenge",
                                                              gui.GUI_SML, st_start.START_CHALLENGE,
                                                              Progress.curr_mode() == MODE.MODE_CHALLENGE ? 1 : 0);
                    }
                }
                gui.gui_space(id);
                Util.gui_score_board(id, (Util.GUI_MOST_COINS |
                                          Util.GUI_BEST_TIMES |
                                          Util.GUI_FAST_UNLOCK), 0, 0);
                gui.gui_space(id);

                if ((jd = gui.gui_hstack(id)) != 0)
                {
                    gui.gui_filler(jd);

                    if ((kd = gui.gui_harray(jd)) != 0)
                    {
                        /* TODO, replace the whitespace hack with something sane. */

                        gui.gui_state(kd,

                                      /* Translators: adjust the amount of whitespace here
                                       * as necessary for the buttons to look good. */
                                      "   No   ", gui.GUI_SML, st_start.START_OPEN_GOALS,
                                      Config.config_get_d(Config.CONFIG_LOCK_GOALS) == 0 ? 1 : 0);

                        gui.gui_state(kd, "Yes", gui.GUI_SML, st_start.START_LOCK_GOALS,
                                      Config.config_get_d(Config.CONFIG_LOCK_GOALS) == 1 ? 1 : 0);
                    }

                    gui.gui_space(jd);

                    gui.gui_label(jd, "Lock Goals of Completed Levels?",
                                  gui.GUI_SML, gui.GUI_ALL, null, null);

                    gui.gui_filler(jd);
                }

                gui.gui_layout(id, 0, 0);

                Util.set_score_board(null, -1, null, -1, null, -1);
            }

            Audio.audio_music_fade_to(0.5f, "bgm/inter.ogg");

            return(id);
        }
Exemplo n.º 7
0
        internal override int OnEnter()
        {
            string s1 = "New Record";
            string s2 = "GOAL";

            int id, jd, kd, ld, md;

            Level l = Set.get_level(Progress.curr_level());

            int high = Progress.progress_lvl_high();

            if (st_goal.new_name != 0)
            {
                Progress.progress_rename(0);
                st_goal.new_name = 0;
            }

            if ((id = gui.gui_vstack(0)) != 0)
            {
                int gid;

                if (high != 0)
                {
                    gid = gui.gui_label(id, s1, gui.GUI_MED, gui.GUI_ALL, widget.gui_grn, widget.gui_grn);
                }
                else
                {
                    gid = gui.gui_label(id, s2, gui.GUI_LRG, gui.GUI_ALL, widget.gui_blu, widget.gui_grn);
                }

                gui.gui_space(id);

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

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

                    if (st_goal.resume != 0)
                    {
                        coins = 0;
                        score = Progress.curr_score();
                        balls = Progress.curr_balls();
                    }
                    else
                    {
                        coins = game_client.curr_coins();
                        score = Progress.curr_score() - coins;
                        balls = Progress.curr_balls();

                        for (i = Progress.curr_score(); i > score; i--)
                        {
                            if (Progress.progress_reward_ball(i) != 0)
                            {
                                balls--;
                            }
                        }
                    }

                    string msg = Progress.curr_bonus().ToString() +
                                 (Progress.curr_bonus() == 1 ? " new bonus level" : " new bonus levels");

                    if ((jd = gui.gui_hstack(id)) != 0)
                    {
                        gui.gui_filler(jd);

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

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

                            gui.gui_label(kd, msg, gui.GUI_SML, gui.GUI_BOT, null, null);
                        }

                        gui.gui_filler(jd);
                    }

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

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

                gui.gui_space(id);

                if ((jd = gui.gui_harray(id)) != 0)
                {
                    if (Progress.progress_done() != 0)
                    {
                        gui.gui_start(jd, "Finish", gui.GUI_SML, st_goal.GOAL_DONE, 0);
                    }
                    else if (Progress.progress_last() != 0)
                    {
                        gui.gui_start(jd, "Finish", gui.GUI_SML, st_goal.GOAL_LAST, 0);
                    }

                    if (Progress.progress_next_avail() != 0)
                    {
                        gui.gui_start(jd, "Next Level", gui.GUI_SML, st_goal.GOAL_NEXT, 0);
                    }

                    if (Progress.progress_same_avail() != 0)
                    {
                        gui.gui_start(jd, "Retry Level", gui.GUI_SML, st_goal.GOAL_SAME, 0);
                    }
                }

                if (st_goal.resume == 0)
                {
                    gui.gui_pulse(gid, 1.2f);
                }

                gui.gui_layout(id, 0, 0);
            }

            Util.set_score_board(l.most_coins, Progress.progress_coin_rank(),
                                 l.best_times, Progress.progress_time_rank(),
                                 l.fast_unlock, Progress.progress_goal_rank());

            Audio.audio_music_fade_out(2.0f);

            Video.video_clr_grab();

            /* Reset hack. */
            st_goal.resume = 0;

            return(id);
        }
Exemplo n.º 8
0
        public static void hud_update(int pulse)
        {
            int clock = game_client.curr_clock();
            int coins = game_client.curr_coins();
            int goal  = Progress.curr_goal();
            int balls = Progress.curr_balls();
            int score = Progress.curr_score();

            int c_id;
            int last;

            if (pulse == 0)
            {
                /* reset the hud */

                gui.gui_pulse(ball_id, 0);
                gui.gui_pulse(time_id, 0);
                gui.gui_pulse(coin_id, 0);
            }

            /* time and tick-tock */

            if (clock != (last = gui.gui_value(time_id)))
            {
                gui.gui_set_clock(time_id, clock);

                if (last > clock && pulse != 0)
                {
                    if (clock <= 1000 && (last / 100) > (clock / 100))
                    {
                        Audio.audio_play(Common.AUD_TICK, 1);
                        gui.gui_pulse(time_id, 1.50f);
                    }
                    else if (clock < 500 && (last / 50) > (clock / 50))
                    {
                        Audio.audio_play(Common.AUD_TOCK, 1);
                        gui.gui_pulse(time_id, 1.25f);
                    }
                }
            }

            /* balls and score + select coin widget */

            switch (Progress.curr_mode())
            {
            case MODE.MODE_CHALLENGE:
                if (gui.gui_value(ball_id) != balls)
                {
                    gui.gui_set_count(ball_id, balls);
                }
                if (gui.gui_value(scor_id) != score)
                {
                    gui.gui_set_count(scor_id, score);
                }

                c_id = coin_id;
                break;

            default:
                c_id = coin_id;
                break;
            }


            /* coins and pulse */

            if (coins != (last = gui.gui_value(c_id)))
            {
                last = coins - last;

                gui.gui_set_count(c_id, coins);

                if (pulse != 0 && last > 0)
                {
                    if (last >= 10)
                    {
                        gui.gui_pulse(coin_id, 2.00f);
                    }
                    else if (last >= 5)
                    {
                        gui.gui_pulse(coin_id, 1.50f);
                    }
                    else
                    {
                        gui.gui_pulse(coin_id, 1.25f);
                    }

                    if (goal > 0)
                    {
                        if (last >= 10)
                        {
                            gui.gui_pulse(goal_id, 2.00f);
                        }
                        else if (last >= 5)
                        {
                            gui.gui_pulse(goal_id, 1.50f);
                        }
                        else
                        {
                            gui.gui_pulse(goal_id, 1.25f);
                        }
                    }
                }
            }

            /* goal and pulse */

            if (goal != (last = gui.gui_value(goal_id)))
            {
                gui.gui_set_count(goal_id, goal);

                if (pulse != 0 && goal == 0 && last > 0)
                {
                    gui.gui_pulse(goal_id, 2.00f);
                }
            }
        }