예제 #1
0
        public void RemoveLink(TGI meshTGI)
        {
            for (int i = 0; i < this.meshBlocks.Length; i++)
            {
                List <TGI> linkList = new List <TGI>(this.meshBlocks[i].ITGtable);
                for (int j = 0; j < linkList.Count; j++)
                {
                    if (linkList[j].Equals(meshTGI))
                    {
                        linkList.RemoveAt(j);
                    }
                }
                this.meshBlocks[i].ITGtable = linkList.ToArray();
            }
            List <int> removeRegions = new List <int>();

            for (int i = 0; i < this.meshBlocks.Length; i++)
            {
                if (this.meshBlocks[i].ITGtable.Length == 0)
                {
                    removeRegions.Add(i);
                }
            }
            foreach (int i in removeRegions)
            {
                this.RemoveRegion(i);
            }
        }
예제 #2
0
        public BBLN(BinaryReader br)
        {
            version    = br.ReadInt32();
            TGI_offset = br.ReadInt32();
            TGI_size   = br.ReadInt32();
            int tmp = br.ReadByte();

            byte[] tmpb = br.ReadBytes(tmp);
            partName = Encoding.BigEndianUnicode.GetString(tmpb);
            unknown  = br.ReadInt32();
            if (version == 8)
            {
                bgType     = br.ReadUInt32();
                bgGroup    = br.ReadUInt32();
                bgInstance = br.ReadUInt64();
            }
            int entryCount = br.ReadInt32();

            entries = new Entry[entryCount];
            for (int i = 0; i < entryCount; i++)
            {
                entries[i] = new Entry(br);
            }
            int tgiCount = br.ReadInt32();

            tgiList = new TGI[tgiCount];
            for (int i = 0; i < tgiCount; i++)
            {
                tgiList[i] = new TGI(br);
            }
        }
예제 #3
0
 public DATAtmp(TGI iconTGI, TGI iconhighlightTGI, uint itemNameHash, uint itemDescriptionHash)
 {
     stuff1        = new byte[] { 0x44, 0x41, 0x54, 0x41, 0x0, 0x1, 0x0, 0x0, 0x18, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xD0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38, 0x2, 0x0, 0x0, 0xD5, 0xF2, 0xCD, 0xA5, 0xB8, 0x0, 0x0, 0x0, 0xD, 0x0, 0x0, 0x0, 0x60, 0x0, 0x0, 0x0, 0x4C, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46, 0xC6, 0x64, 0xCF, 0x16, 0xB9, 0xF8, 0x8A, 0x4A, 0xAA, 0xB2, 0x39, 0x0, 0x0, 0x0, 0x0, 0xEA, 0x46, 0x55, 0xA2, 0x16, 0x32, 0xF3, 0x3B, 0x4A, 0xAA, 0xB2, 0x39, 0x0, 0x0, 0x0, 0x0 };
     nameHash      = itemNameHash;
     descHash      = itemDescriptionHash;
     iconImage     = iconTGI;          //ITG icon
     iconHighLight = iconhighlightTGI; //ITG iconhighlight
     stuff2        = new byte[] { 0x33, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6B, 0x1, 0x0, 0x0, 0xA6, 0x64, 0x74, 0x42, 0x5A, 0xFE, 0x3, 0x66, 0x60, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0xA, 0x0, 0x0, 0x0, 0x11, 0x1, 0x0, 0x0, 0xF3, 0x0, 0x36, 0x12, 0x13, 0x0, 0x0, 0x0, 0x38, 0x0, 0x0, 0x0, 0x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6E, 0x5F, 0x61, 0x64, 0x64, 0x0, 0x61, 0x75, 0x64, 0x69, 0x6F, 0x5F, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x5F, 0x6F, 0x6E, 0x5F, 0x72, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x0, 0x62, 0x75, 0x66, 0x66, 0x5F, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x0, 0x62, 0x75, 0x66, 0x66, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x0, 0x69, 0x63, 0x6F, 0x6E, 0x0, 0x69, 0x63, 0x6F, 0x6E, 0x5F, 0x68, 0x69, 0x67, 0x68, 0x6C, 0x69, 0x67, 0x68, 0x74, 0x0, 0x6D, 0x6F, 0x6F, 0x64, 0x5F, 0x74, 0x79, 0x70, 0x65, 0x0, 0x6D, 0x6F, 0x6F, 0x64, 0x5F, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x0, 0x74, 0x69, 0x6D, 0x65, 0x6F, 0x75, 0x74, 0x5F, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x0, 0x75, 0x69, 0x5F, 0x73, 0x6F, 0x72, 0x74, 0x5F, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x0, 0x43, 0x6C, 0x6F, 0x74, 0x68, 0x69, 0x6E, 0x67, 0x42, 0x75, 0x66, 0x66, 0x0, 0x42, 0x75, 0x66, 0x66, 0x5F, 0x43, 0x41, 0x53, 0x5F, 0x43, 0x4D, 0x54, 0x6F, 0x6F, 0x6C, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6F, 0x6D, 0x0 };
 }
예제 #4
0
 public void replaceLink(TGI oldtgi, TGI newtgi)
 {
     for (int i = 0; i < this.meshBlocks.Length; i++)
     {
         for (int j = 0; j < this.meshBlocks[i].ITGtable.Length; j++)
         {
             if (this.meshBlocks[i].ITGtable[j].Equals(oldtgi))
             {
                 this.meshBlocks[i].ITGtable[j] = new TGI(newtgi);
             }
         }
     }
 }
예제 #5
0
        internal MeshBlock(BinaryReader br)
        {
            region        = br.ReadUInt32();
            layer         = br.ReadSingle();
            isReplacement = br.ReadByte();
            uint numKeys = br.ReadUInt32();

            ITGtable = new TGI[numKeys];
            for (int i = 0; i < numKeys; i++)
            {
                ITGtable[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
        }
예제 #6
0
        public void SetMeshRegions(TGI meshTGI, int[] regionList, float layer)
        {
            for (int i = 0; i < this.meshBlocks.Length; i++)
            {
                if (Array.IndexOf(this.meshBlocks[i].ITGtable, meshTGI) >= 0 &&
                    ((Array.IndexOf(regionList, (int)this.meshBlocks[i].region) < 0) || (layer != this.meshBlocks[i].layer)))
                {
                    List <TGI> tmpTGI = new List <TGI>(this.meshBlocks[i].ITGtable);
                    tmpTGI.Remove(meshTGI);
                    this.meshBlocks[i].ITGtable = tmpTGI.ToArray();
                }
            }
            foreach (uint r in regionList)
            {
                bool wasFound = false;
                foreach (MeshBlock b in this.meshBlocks)
                {
                    if (r == b.region && layer == b.layer)
                    {
                        if (Array.IndexOf(b.ITGtable, meshTGI) < 0)
                        {
                            List <TGI> tmpTGI = new List <TGI>(b.ITGtable);
                            tmpTGI.Add(meshTGI);
                            b.ITGtable = tmpTGI.ToArray();
                        }
                        wasFound = true;
                        break;
                    }
                }
                if (!wasFound)
                {
                    List <MeshBlock> tmp = new List <MeshBlock>(this.meshBlocks);
                    tmp.Add(new MeshBlock(r, layer, 0, new TGI[] { meshTGI }));
                    this.meshBlocks = tmp.ToArray();
                }
            }
            List <int> removeRegions = new List <int>();

            for (int i = 0; i < this.meshBlocks.Length; i++)
            {
                if (this.meshBlocks[i].ITGtable.Length == 0)
                {
                    removeRegions.Add(i);
                }
            }
            foreach (int i in removeRegions)
            {
                this.RemoveRegion(i);
            }
        }
예제 #7
0
 internal void SortLODs(CASP casp)
 {
     for (int i = this.ITGtable.Length - 1; i >= 0; i--)
     {
         for (int j = 0; j < i; j++)
         {
             if (casp.getLOD(this.ITGtable[j]) > casp.getLOD(this.ITGtable[j + 1]))
             {
                 TGI tmp = new TGI(this.ITGtable[j]);
                 this.ITGtable[j]     = new TGI(this.ITGtable[j + 1]);
                 this.ITGtable[j + 1] = tmp;
             }
         }
     }
 }
예제 #8
0
        public float GetMeshLayer(TGI meshTGI)
        {
            List <uint> tmp = new List <uint>();

            for (int i = 0; i < this.meshBlocks.Length; i++)
            {
                for (int j = 0; j < this.meshBlocks[i].ITGtable.Length; j++)
                {
                    if (this.meshBlocks[i].ITGtable[j].Equals(meshTGI))
                    {
                        return(this.meshBlocks[i].layer);
                    }
                }
            }
            return(-1f);
        }
예제 #9
0
        public uint[] GetMeshRegions(TGI meshTGI)
        {
            List <uint> tmp = new List <uint>();

            for (int i = 0; i < this.meshBlocks.Length; i++)
            {
                for (int j = 0; j < this.meshBlocks[i].ITGtable.Length; j++)
                {
                    if (this.meshBlocks[i].ITGtable[j].Equals(meshTGI))
                    {
                        tmp.Add(this.meshBlocks[i].region);
                    }
                }
            }
            return(tmp.ToArray());
        }
예제 #10
0
        public SMOD(BinaryReader br)
        {
            this.contextVersion = br.ReadUInt32();
            uint publicKeyCount    = br.ReadUInt32();
            uint externalKeyCount  = br.ReadUInt32();
            uint delayLoadKeyCount = br.ReadUInt32();
            uint objectKeyCount    = br.ReadUInt32();

            this.publicKey = new TGI[publicKeyCount];
            for (int i = 0; i < publicKeyCount; i++)
            {
                publicKey[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
            this.externalKey = new TGI[externalKeyCount];
            for (int i = 0; i < externalKeyCount; i++)
            {
                externalKey[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
            this.delayLoadKey = new TGI[delayLoadKeyCount];
            for (int i = 0; i < delayLoadKeyCount; i++)
            {
                delayLoadKey[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
            this.objectKey = new ObjectData[objectKeyCount];
            for (int i = 0; i < objectKeyCount; i++)
            {
                objectKey[i] = new ObjectData(br);
            }
            this.version = br.ReadUInt32();
            this.gender  = (XmodsEnums.AgeGender)br.ReadUInt32();
            this.region  = br.ReadUInt32();
            this.linkTag = br.ReadUInt32();
            if (this.version >= 144)
            {
                this.unknown1 = br.ReadUInt32();
            }
            this.bonePoseKey          = new TGI(br, TGI.TGIsequence.ITG);
            this.deformerMapShapeKey  = new TGI(br, TGI.TGIsequence.ITG);
            this.deformerMapNormalKey = new TGI(br, TGI.TGIsequence.ITG);
            uint count = br.ReadUInt32();

            this.boneEntryList = new BoneEntry[count];
            for (int i = 0; i < count; i++)
            {
                this.boneEntryList[i] = new BoneEntry(br);
            }
        }
예제 #11
0
        public RegionMap(BinaryReader br)
        {
            br.BaseStream.Position = 0;
            contextVersion         = br.ReadUInt32();
            publicKeyCount         = br.ReadUInt32();
            externalKeyCount       = br.ReadUInt32();
            delayLoadKeyCount      = br.ReadUInt32();
            objectCount            = br.ReadUInt32();
            publicKey = new TGI[publicKeyCount];
            for (int i = 0; i < publicKeyCount; i++)
            {
                publicKey[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
            externalKey = new TGI[externalKeyCount];
            for (int i = 0; i < externalKeyCount; i++)
            {
                externalKey[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
            delayLoadKey = new TGI[delayLoadKeyCount];
            for (int i = 0; i < delayLoadKeyCount; i++)
            {
                delayLoadKey[i] = new TGI(br, TGI.TGIsequence.ITG);
            }
            objData = new ObjectData[objectCount];
            for (int i = 0; i < objectCount; i++)
            {
                objData[i] = new ObjectData(br);
            }
            version = br.ReadInt32();
            int numMeshBlocks = br.ReadInt32();

            meshBlocks = new MeshBlock[numMeshBlocks];
            for (int i = 0; i < numMeshBlocks; i++)
            {
                meshBlocks[i] = new MeshBlock(br);
            }
        }
예제 #12
0
 public void setInternalLink(TGI tgi)
 {
     this.publicKey = new TGI[] { tgi };
 }
예제 #13
0
 public TGI(TGI tgi)
 {
     this.type     = tgi.Type;
     this.group    = tgi.Group;
     this.instance = tgi.Instance;
 }
예제 #14
0
        public bool Equals(string tgi)
        {
            TGI tmp = new TGI(tgi);

            return(this.type == tmp.type & this.group == tmp.group & this.instance == tmp.instance);
        }
예제 #15
0
 public bool Equals(TGI tgi)
 {
     return(this.type == tgi.type & this.group == tgi.group & this.instance == tgi.instance);
 }
예제 #16
0
 public VPXY(BinaryReader br)
 {
     rcolVersion = br.ReadInt32();
     rcolCount   = br.ReadInt32();
     index3      = br.ReadInt32();
     extCount    = br.ReadInt32();
     intCount    = br.ReadInt32();
     if (intCount > 0)
     {
         intITG = new ITG[intCount];
     }
     for (int i = 0; i < intCount; i++)
     {
         intITG[i] = new ITG(br);
     }
     if (extCount > 0)
     {
         extITG = new ITG[extCount];
     }
     for (int i = 0; i < extCount; i++)
     {
         extITG[i] = new ITG(br);
     }
     chunkPos  = br.ReadInt32();
     chunkSize = br.ReadInt32();
     magic     = new char[4];
     magic     = br.ReadChars(4);
     version   = br.ReadInt32();
     tgiOffset = br.ReadInt32();
     tgiSize   = br.ReadInt32();
     count     = br.ReadByte();
     entries   = new Entry[count];
     for (int i = 0; i < count; i++)
     {
         entries[i] = new Entry(br);
     }
     boxType     = br.ReadByte();
     boundingBox = new float[6];
     for (int i = 0; i < 6; i++)
     {
         boundingBox[i] = br.ReadSingle();
     }
     unknown = br.ReadUInt32();
     flag    = br.ReadByte();
     if (flag == 1)
     {
         ftptIndex = br.ReadInt32();
     }
     if (tgiSize > 0)
     {
         tgiCount = br.ReadInt32();
         tgiList  = new TGI[tgiCount];
         for (int i = 0; i < tgiCount; i++)
         {
             tgiList[i] = new TGI(br);
         }
     }
     else
     {
         tgiCount = 0;
         tgiList  = new TGI[0];
     }
 }
예제 #17
0
 public VPXY(TGI tgi, TGI[] boneTGIs, TGI[][] geomTGIs)
 {
     if (geomTGIs.GetLength(0) != 4)
     {
         throw new ApplicationException("First dimension of LOD TGIs must be 4!");
     }
     rcolVersion = 3;
     rcolCount   = 1;
     index3      = 0;
     extCount    = 0;
     intCount    = 1;
     intITG      = new ITG[1];
     intITG[0]   = new ITG(tgi.Instance, tgi.Type, tgi.Group);
     chunkPos    = 44;
     chunkSize   = 141;
     magic       = new char[4] {
         'V', 'P', 'X', 'Y'
     };
     version  = 4;
     count    = 0;
     tgiCount = 0;
     for (int i = 0; i < boneTGIs.Length; i++)
     {
         count++;
         tgiCount++;
     }
     for (int i = 0; i < geomTGIs.GetLength(0); i++)
     {
         for (int j = 0; j < geomTGIs[i].Length; j++)
         {
             tgiCount++;
         }
         if (geomTGIs[i].Length > 0)
         {
             count++;
         }
     }
     boxType     = 2;
     boundingBox = new float[6] {
         0f, 0f, 0f, 0f, 0f, 0f
     };
     unknown = 0;
     flag    = 0;
     entries = new Entry[count];
     tgiList = new TGI[tgiCount];
     if (count > 0)
     {
         int counterTGI = 0;
         int counterEnt = 0;
         for (int i = 0; i < boneTGIs.Length; i++)
         {
             entries[counterEnt] = new Entry(counterTGI);
             tgiList[counterTGI] = new TGI(boneTGIs[i].Type, boneTGIs[i].Group, boneTGIs[i].Instance);
             counterEnt++;
             counterTGI++;
         }
         for (int i = 0; i < 4; i++)
         {
             List <int> tmp = new List <int>();
             for (int j = 0; j < geomTGIs[i].Length; j++)
             {
                 tmp.Add(counterTGI);
                 tgiList[counterTGI] = new TGI(geomTGIs[i][j].Type, geomTGIs[i][j].Group, geomTGIs[i][j].Instance);
                 counterTGI++;
             }
             if (tmp.Count > 0)
             {
                 entries[counterEnt] = new Entry(i, tmp.ToArray());
                 counterEnt++;
             }
         }
         // for (int i = 3; i >= 0; i--)
         // {
         //     for (int j = 0; j < geomTGIs[i].Length; j++)
         //     {
         //         entries[counter] = new Entry(i, counter);
         //         tgiList[counter] = new TGI(geomTGIs[i][j].Type, geomTGIs[i][j].Group, geomTGIs[i][j].Instance);
         //         counter++;
         //     }
         // }
     }
     tgiOffset = 35;
     foreach (Entry e in this.entries)
     {
         tgiOffset += e.Size;
     }
     tgiSize = (tgiCount * 16) + 4;
 }
예제 #18
0
 public VPXY(TGI tgi, TGI[][] geomTGIs) : this(tgi, new TGI[] { }, geomTGIs)
 {
 }