Exemplo n.º 1
0
        /// <summary>
        /// Make sure the correct Face Structure is used (as desribed by Nukael)
        /// </summary>
        /// <remarks>http://www.modthesims2.com/showthread.php?t=56241</remarks>
        /// <param name="pkg">The package with the Face Data</param>
        public void UpdateFaceStructure(SimPe.Packages.GeneratableFile pkg)
        {
            SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds   = pkg.FindFiles((uint)0xCCCEF852);           //LxNR, Face
            SimPe.Interfaces.Files.IPackedFileDescriptor   oldpfd = null;
            SimPe.Interfaces.Files.IPackedFileDescriptor   newpfd = null;

            uint oi = 1;
            uint ni = 2;

            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                if (pfd.Instance <= oi)
                {
                    oldpfd = pfd; oi = pfd.Instance;
                }
                if (pfd.Instance >= ni)
                {
                    newpfd = pfd; ni = pfd.Instance;
                }
            }

            if (oldpfd != null && newpfd != null)
            {
                SimPe.Interfaces.Files.IPackedFile pf = pkg.Read(newpfd);
                oldpfd.UserData = pf.UncompressedData;
                oldpfd.Changed  = true;
            }
        }