FindProperty() public method

public FindProperty ( string s, List p ) : int
s string
p List
return int
        public void CloneObject(int index)
        {
            int    n = Entries[index];
            Matrix m = Matrices[index];

            Entries.Add(n);
            Matrices.Add(m);
            MemoryStream mem    = new MemoryStream();
            int          ent    = UPR.FindProperty("StaticMeshComponents", props) + 1;
            int          off    = props[ent].offset + 8;
            int          offend = props[ent].offset + props[ent].raw.Length;

            mem.Write(memory, 0, off);
            mem.Write(BitConverter.GetBytes(Entries.Count * 4 + 4), 0, 4);
            mem.Write(BitConverter.GetBytes((Int32)0), 0, 4);
            mem.Write(BitConverter.GetBytes(Entries.Count), 0, 4);
            for (int i = 0; i < Entries.Count; i++)
            {
                mem.Write(BitConverter.GetBytes(Entries[i] + 1), 0, 4);
            }
            if (ent + 1 < props.Count)
            {
                int offnextend = props[props.Count - 1].offset + props[props.Count - 1].raw.Length;
                mem.Write(memory, offend, offnextend - offend);
            }
            for (int i = 0; i < Matrices.Count; i++)
            {
                mem = StreamAppend(mem, MatrixToStream(Matrices[i]));
            }
            memory  = mem.ToArray();
            memsize = memory.Length;
            CHANGED = true;
        }
Example #2
0
        public void ExportToFile()
        {
            int entry = UPR.FindProperty("Filename", props);

            if (entry == -1)
            {
                return;
            }
            int index = BitConverter.ToInt32(props[entry].raw, 24);

            if (index < 0 || index >= names.Length)
            {
                return;
            }
            string nm = names[index];

            nm  = nm.Substring(0, nm.Length - 1);
            nm += ".afc";
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = nm + "|" + nm;
            if (d.ShowDialog() == DialogResult.OK)
            {
                AFCFile afc = new AFCFile();
                afc.ExtractWav(d.FileName, offset, size);
            }
        }
Example #3
0
 public void LoadStaticMeshActors()
 {
     for (int i = 0; i < UStatActors.Count; i++)
     {
         int entry = UPR.FindObjectProperty("StaticMeshComponent", UStatActors[i].props);
         if (entry >= 0 && entry < pcc.Header.ExportCount)
         {
             UStaticMeshComponent t = new UStaticMeshComponent(pcc.EntryToBuff(entry), pcc.names);
             t.UPR = UPR;
             t.Deserialize();
             LevelProperties LP = UStatActors[i].LP;
             GlobalTransform g  = new GlobalTransform();
             if (i == 21)
             {
             }
             entry = UPR.FindProperty("location", UStatActors[i].props);
             if (entry != -1)
             {
                 g.loc = PropToVector3(UStatActors[i].props[entry + 1].raw);
             }
             entry = UPR.FindProperty("Rotator", UStatActors[i].props);
             if (entry != -1)
             {
                 g.rot = PropToCYPRVector3(UStatActors[i].props[entry].raw);
             }
             entry = UPR.FindProperty("DrawScale3D", UStatActors[i].props);
             if (entry != -1)
             {
                 g.scl = PropToVector3(UStatActors[i].props[entry + 1].raw);
             }
             else
             {
                 g.scl = new Vector3(1, 1, 1);
             }
             entry = UPR.FindProperty("DrawScale", UStatActors[i].props);
             if (entry != -1)
             {
                 g.scl2 = BitConverter.ToSingle(UStatActors[i].props[entry + 1].raw, UStatActors[i].props[entry + 1].raw.Length - 4);
             }
             else
             {
                 g.scl2 = 1;
             }
             LP.GT   = g;
             t.LP    = LP;
             t.index = entry;
             UStatComp.Add(t);
         }
     }
 }