예제 #1
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);
        }
예제 #2
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);
                }
            }
        }