Ejemplo n.º 1
0
        public static int game_server_init(string file_name, int t, int e)
        {
            int version_x, version_y;

            int i;

            timer      = (float)t / 100;
            timer_down = (t > 0) ? 1 : 0;
            coins      = 0;
            status     = GAME.GAME_NONE;

            if (server_state != 0)
            {
                game_server_free();
            }

            if (Solid.sol_load_only_file(file, file_name) == 0)
            {
                return(server_state = 0);
            }

            server_state = 1;

            version_x = 0;
            version_y = 0;

            for (i = 0; i < file.m_dc; i++)
            {
                string k = file.Get_av(file.m_dv[i].m_ai);
                string v = file.Get_av(file.m_dv[i].m_aj);

                if (string.Equals(k, "version"))
                {
                    string[] parts = v.Split(new char[] { ' ', '.' }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts != null &&
                        parts.Length > 0)
                    {
                        version_x = int.Parse(parts[0], System.Globalization.CultureInfo.InvariantCulture);

                        if (parts.Length > 1)
                        {
                            version_y = int.Parse(parts[1], System.Globalization.CultureInfo.InvariantCulture);
                        }
                    }
                }
            }

            input_init();

            game_common.game_tilt_init(tilt);

            /* Initialize jump and goal states. */

            jump_e = 1;
            jump_b = 0;

            goal_e = e != 0 ? 1 : 0;
            goal_k = e != 0 ? 1.0f : 0.0f;

            /* Initialize the view. */

            view_init();

            /* Initialize ball size tracking... */

            got_orig = 0;
            grow     = 0;

            solid_phys.sol_cmd_enq_func(enq_fn_game_proxy_enq.Instance);//game_proxy_enq);

            /* Queue client commands. */

            game_cmd_map(file_name, version_x, version_y);
            game_cmd_ups();
            game_cmd_timer();

            if (goal_e != 0)
            {
                game_cmd_goalopen();
            }

            game_cmd_init_balls();
            game_cmd_init_items();

            return(server_state);
        }