Пример #1
0
        static sfx_t RegisterSexedSound(entity_state_t ent, String base_renamed)
        {
            sfx_t sfx   = null;
            var   model = "male";
            var   n     = CS_PLAYERSKINS + ent.number - 1;

            if (cl.configstrings[n] != null)
            {
                var p = cl.configstrings[n].IndexOf('\\');
                if (p >= 0)
                {
                    p++;
                    model = cl.configstrings[n].Substring(p);
                    p     = model.IndexOf('/');
                    if (p > 0)
                    {
                        model = model.Substring(0, p - 1);
                    }
                }
            }

            if (model == null || model.Length == 0)
            {
                model = "male";
            }
            var sexedFilename = "#players/" + model + "/" + base_renamed.Substring(1);

            sfx = FindName(sexedFilename, false);
            if (sfx == null)
            {
                FileStream f = null;
                try
                {
                    f = FS.FOpenFile(sexedFilename.Substring(1));
                }
                catch (Exception e)
                {
                }

                if (f != null)
                {
                    try
                    {
                        FS.FCloseFile(f);
                    }
                    catch (Exception e1)
                    {
                    }

                    sfx = RegisterSound(sexedFilename);
                }
                else
                {
                    var maleFilename = "player/male/" + base_renamed.Substring(1);
                    sfx = AliasName(sexedFilename, maleFilename);
                }
            }

            return(sfx);
        }