Ejemplo n.º 1
0
        sfx_t AliasName(string aliasname, string truename)
        {
            sfx_t  sfx = null;
            string s;
            int    i;

            s = new string (truename);
            for (i = 0; i < num_sfx; i++)
            {
                if (known_sfx[i].name == null)
                {
                    break;
                }
            }
            if (i == num_sfx)
            {
                if (num_sfx == MAX_SFX)
                {
                    Com.Error(Defines.ERR_FATAL, "S_FindName: out of sfx_t");
                }
                num_sfx++;
            }

            sfx = known_sfx[i];
            sfx.Clear();
            sfx.name = new string (aliasname);
            sfx.registration_sequence = s_registration_sequence;
            sfx.truename = s;
            sfx.bufferId = i;
            return(sfx);
        }
Ejemplo n.º 2
0
        sfx_t FindName(string name, bool create)
        {
            int   i;
            sfx_t sfx = null;

            if (name == null)
            {
                Com.Error(Defines.ERR_FATAL, "S_FindName: NULL\\n");
            }
            if (name.Length == 0)
            {
                Com.Error(Defines.ERR_FATAL, "S_FindName: empty name\\n");
            }
            if (name.Length >= Defines.MAX_QPATH)
            {
                Com.Error(Defines.ERR_FATAL, "Sound name too long: " + name);
            }
            for (i = 0; i < num_sfx; i++)
            {
                if (name.Equals(known_sfx[i].name))
                {
                    return(known_sfx[i]);
                }
            }

            if (!create)
            {
                return(null);
            }
            for (i = 0; i < num_sfx; i++)
            {
                if (known_sfx[i].name == null)
                {
                    break;
                }
            }
            if (i == num_sfx)
            {
                if (num_sfx == MAX_SFX)
                {
                    Com.Error(Defines.ERR_FATAL, "S_FindName: out of sfx_t");
                }
                num_sfx++;
            }

            sfx = known_sfx[i];
            sfx.Clear();
            sfx.name = name;
            sfx.registration_sequence = s_registration_sequence;
            sfx.bufferId = i;
            return(sfx);
        }