Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }