Ejemplo n.º 1
0
        public static int ball_opts(s_file fp, ref float alpha)
        {
            int flags = F_DEPTHTEST;
            int di;

            //	MY
            for (di = 0; di < fp.m_dc; ++di)
            {
                string k = fp.Get_av(fp.m_dv[di].m_ai);
                string v = fp.Get_av(fp.m_dv[di].m_aj);

                if (string.Equals(k, "drawback"))
                {
                    flags = SET(flags, int.Parse(v, System.Globalization.CultureInfo.InvariantCulture), F_DRAWBACK);
                }
                if (string.Equals(k, "depthmask"))
                {
                    flags = SET(flags, int.Parse(v, System.Globalization.CultureInfo.InvariantCulture), F_DEPTHMASK);
                }
                if (string.Equals(k, "depthtest"))
                {
                    flags = SET(flags, int.Parse(v, System.Globalization.CultureInfo.InvariantCulture), F_DEPTHTEST);
                }
                if (string.Equals(k, "alphatest"))
                {
                    if (v != null)
                    {
                        string[] parts = v.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                        if (parts != null && parts.Length > 0)
                        {
                            alpha = (float)double.Parse(parts[0], System.Globalization.CultureInfo.InvariantCulture);
                        }
                    }
                }
            }

            return(flags);
        }
Ejemplo n.º 2
0
        public static int game_client_init(string file_name)
        {
            string back_name = null;
            string grad_name = null;
            int    i;

            coins  = 0;
            status = (int)GAME.GAME_NONE;

            if (client_state != 0)
            {
                game_client_free();
            }

            if (file.sol_load_gl(file_name, Config.config_get_d(Config.CONFIG_TEXTURES), Config.config_get_d(Config.CONFIG_SHADOW)) == 0)
            {
                return(client_state = 0);
            }

            reflective = file.sol_reflective();

            client_state = 1;

            game_common.game_tilt_init(tilt);

            //  Initialize jump and goal states.

            jump_e = 1;
            jump_b = 0;

            goal_e = 0;
            goal_k = 0.0f;

            //  Initialise the level, background, particles, fade, and view.

            fade_k = 1.0f;
            fade_d = -2.0f;


            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, "back"))
                {
                    back_name = v;
                }

                if (string.Equals(k, "grad"))
                {
                    grad_name = v;
                }

                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);
                        }
                    }
                }
            }


            //  If the client map's version is 1, assume the map is compatible
            //  with the server.  This ensures that 1.5.0 replays don't trigger
            //  bogus map compatibility warnings.  (Post-1.5.0 replays will
            //  have cmd_type.CMD_MAP override this.)


            game_compat_map = version_x == 1 ? 1 : 0;

            Part.part_reset(Config.GOAL_HEIGHT, Config.JUMP_HEIGHT);

            ups          = 0;
            first_update = 1;

            Back.back_init(grad_name, Config.config_get_d(Config.CONFIG_GEOMETRY));

            back.sol_load_gl(back_name, Config.config_get_d(Config.CONFIG_TEXTURES), 0);

            return(client_state);
        }
Ejemplo n.º 3
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);
        }