Пример #1
0
        public static void ParseClientinfo(Int32 player)
        {
            var          s  = Globals.cl.configstrings[player + Defines.CS_PLAYERSKINS];
            clientinfo_t ci = Globals.cl.clientinfo[player];

            LoadClientinfo(ci, s);
        }
Пример #2
0
 public virtual void Set(clientinfo_t from)
 {
     name     = from.name;
     cinfo    = from.cinfo;
     skin     = from.skin;
     icon     = from.icon;
     iconname = from.iconname;
     model    = from.model;
     System.Array.Copy(from.weaponmodel, 0, weaponmodel, 0, Defines.MAX_CLIENTWEAPONMODELS);
 }
Пример #3
0
        public client_state_t()
        {
            for (int n = 0; n < Defines.CMD_BACKUP; n++)
            {
                cmds[n] = new usercmd_t();
            }
            for (int i = 0; i < frames.Length; i++)
            {
                frames[i] = new frame_t();
            }

            for (int n = 0; n < Defines.MAX_CONFIGSTRINGS; n++)
            {
                configstrings[n] = new string("");
            }
            for (int n = 0; n < Defines.MAX_CLIENTS; n++)
            {
                clientinfo[n] = new clientinfo_t();
            }
        }
Пример #4
0
        public static void LoadClientinfo(clientinfo_t ci, String s)
        {
            String model_name, skin_name, model_filename, skin_filename, weapon_filename;

            ci.cinfo = s;
            ci.name  = s;
            var t = s.IndexOf('\\');

            if (t != -1)
            {
                ci.name = s.Substring(0, t);
                s       = s.Substring(t + 1, s.Length);
            }

            if (Globals.cl_noskins.value != 0 || s.Length == 0)
            {
                model_filename    = ("players/male/tris.md2");
                weapon_filename   = ("players/male/weapon.md2");
                skin_filename     = ("players/male/grunt.pcx");
                ci.iconname       = ("/players/male/grunt_i.pcx");
                ci.model          = Globals.re.RegisterModel(model_filename);
                ci.weaponmodel    = new model_t[Defines.MAX_CLIENTWEAPONMODELS];
                ci.weaponmodel[0] = Globals.re.RegisterModel(weapon_filename);
                ci.skin           = Globals.re.RegisterSkin(skin_filename);
                ci.icon           = Globals.re.RegisterPic(ci.iconname);
            }
            else
            {
                var pos = s.IndexOf('/');
                if (pos == -1)
                {
                    pos = s.IndexOf('/');
                }
                if (pos == -1)
                {
                    pos = 0;
                    Com.Error(Defines.ERR_FATAL, "Invalid model name:" + s);
                }

                model_name     = s.Substring(0, pos);
                skin_name      = s.Substring(pos + 1, s.Length);
                model_filename = "players/" + model_name + "/tris.md2";
                ci.model       = Globals.re.RegisterModel(model_filename);
                if (ci.model == null)
                {
                    model_name     = "male";
                    model_filename = "players/male/tris.md2";
                    ci.model       = Globals.re.RegisterModel(model_filename);
                }

                skin_filename = "players/" + model_name + "/" + skin_name + ".pcx";
                ci.skin       = Globals.re.RegisterSkin(skin_filename);
                if (ci.skin == null && !model_name.EqualsIgnoreCase("male"))
                {
                    model_name     = "male";
                    model_filename = "players/male/tris.md2";
                    ci.model       = Globals.re.RegisterModel(model_filename);
                    skin_filename  = "players/" + model_name + "/" + skin_name + ".pcx";
                    ci.skin        = Globals.re.RegisterSkin(skin_filename);
                }

                if (ci.skin == null)
                {
                    skin_filename = "players/" + model_name + "/grunt.pcx";
                    ci.skin       = Globals.re.RegisterSkin(skin_filename);
                }

                for (var i = 0; i < CL_view.num_cl_weaponmodels; i++)
                {
                    weapon_filename   = "players/" + model_name + "/" + CL_view.cl_weaponmodels[i];
                    ci.weaponmodel[i] = Globals.re.RegisterModel(weapon_filename);
                    if (null == ci.weaponmodel[i] && model_name.Equals("cyborg"))
                    {
                        weapon_filename   = "players/male/" + CL_view.cl_weaponmodels[i];
                        ci.weaponmodel[i] = Globals.re.RegisterModel(weapon_filename);
                    }

                    if (0 == Globals.cl_vwep.value)
                    {
                        break;
                    }
                }

                ci.iconname = "/players/" + model_name + "/" + skin_name + "_i.pcx";
                ci.icon     = Globals.re.RegisterPic(ci.iconname);
            }

            if (ci.skin == null || ci.icon == null || ci.model == null || ci.weaponmodel[0] == null)
            {
                ci.skin           = null;
                ci.icon           = null;
                ci.model          = null;
                ci.weaponmodel[0] = null;
                return;
            }
        }