Пример #1
0
        protected override void Serialize(SerializingContainer2 sc)
        {
            sc.Serialize(ref PersistentLevel);
            if (sc.Game == MEGame.ME3)
            {
                sc.Serialize(ref PersistentFaceFXAnimSet);
            }
            else if (sc.IsLoading)
            {
                PersistentFaceFXAnimSet = new UIndex(0);
            }

            for (int i = 0; i < 4; i++)
            {
                sc.Serialize(ref EditorViews[i]);
            }

            if (sc.Game == MEGame.UDK)
            {
                sc.Serialize(ref unkFloat);
            }
            int dummy = 0;

            sc.Serialize(ref dummy);
            if (sc.Game == MEGame.ME1)
            {
                sc.Serialize(ref DecalManager);
            }
            else if (sc.IsLoading)
            {
                DecalManager = new UIndex(0);
            }

            sc.Serialize(ref ExtraReferencedObjects, SCExt.Serialize);
        }
Пример #2
0
        public UIndex ArtPlaceable2; //ME1

        protected override void Serialize(SerializingContainer2 sc)
        {
            sc.Serialize(ref Self);
            sc.Serialize(ref Actors, SCExt.Serialize);
            sc.Serialize(ref URL);
            sc.Serialize(ref Model);
            sc.Serialize(ref ModelComponents, SCExt.Serialize);
            sc.Serialize(ref GameSequences, SCExt.Serialize);
            sc.Serialize(ref TextureToInstancesMap, SCExt.Serialize, SCExt.Serialize);
            if (sc.Game == MEGame.ME3)
            {
                sc.Serialize(ref ApexMesh, SCExt.Serialize);
            }
            else if (sc.IsLoading)
            {
                ApexMesh = Array.Empty <byte>();
            }

            int byteSize = 1;

            sc.Serialize(ref byteSize);
            sc.Serialize(ref CachedPhysBSPData, SCExt.Serialize);

            sc.Serialize(ref CachedPhysSMDataMap, SCExt.Serialize, SCExt.Serialize);
            sc.Serialize(ref CachedPhysSMDataStore, SCExt.Serialize);
            sc.Serialize(ref CachedPhysPerTriSMDataMap, SCExt.Serialize, SCExt.Serialize);
            sc.Serialize(ref CachedPhysPerTriSMDataStore, SCExt.Serialize);
            sc.Serialize(ref CachedPhysBSPDataVersion);
            sc.Serialize(ref CachedPhysSMDataVersion);
            sc.Serialize(ref ForceStreamTextures, SCExt.Serialize, SCExt.Serialize);
            sc.Serialize(ref NavListStart);
            sc.Serialize(ref NavListEnd);
            sc.Serialize(ref CoverListStart);
            sc.Serialize(ref CoverListEnd);
            if (sc.Game == MEGame.ME3)
            {
                sc.Serialize(ref PylonListStart);
                sc.Serialize(ref PylonListEnd);
                sc.Serialize(ref guidToIntMap, SCExt.Serialize, SCExt.Serialize);
                sc.Serialize(ref CoverLinks, SCExt.Serialize);
                sc.Serialize(ref intToByteMap, SCExt.Serialize, SCExt.Serialize);
                sc.Serialize(ref guidToIntMap2, SCExt.Serialize, SCExt.Serialize);
                sc.Serialize(ref NavPoints, SCExt.Serialize);
                sc.Serialize(ref numbers, SCExt.Serialize);
            }
            else if (sc.IsLoading)
            {
                PylonListStart = new UIndex(0);
                PylonListEnd   = new UIndex(0);
                guidToIntMap   = new OrderedMultiValueDictionary <Guid, int>();
                CoverLinks     = new UIndex[0];
                intToByteMap   = new OrderedMultiValueDictionary <int, byte>();
                guidToIntMap2  = new OrderedMultiValueDictionary <Guid, int>();
                NavPoints      = new UIndex[0];
                numbers        = new int[0];
            }
            sc.Serialize(ref CrossLevelActors, SCExt.Serialize);
            if (sc.Game == MEGame.ME3)
            {
                //PrecomputedLightVolume
                bool bIsInitialized = false;
                sc.Serialize(ref bIsInitialized);
                //should always be false, but just in case;
                if (bIsInitialized)
                {
                    throw new Exception($"PersistentLevel has a PreComputedLightVolume! Level in: {sc.Pcc.FilePath}");
                }
            }

            if (sc.Game == MEGame.ME1)
            {
                sc.Serialize(ref ArtPlaceable1);
                sc.Serialize(ref ArtPlaceable2);
            }
            else if (sc.IsLoading)
            {
                ArtPlaceable1 = new UIndex(0);
                ArtPlaceable2 = new UIndex(0);
            }
        }
Пример #3
0
        public UIndex ArtPlaceable2; //ME1

        protected override void Serialize(SerializingContainer2 sc)
        {
            sc.Serialize(ref Self);
            sc.Serialize(ref Actors, SCExt.Serialize);
            sc.Serialize(ref URL);
            sc.Serialize(ref Model);
            sc.Serialize(ref ModelComponents, SCExt.Serialize);
            sc.Serialize(ref GameSequences, SCExt.Serialize);
            sc.Serialize(ref TextureToInstancesMap, SCExt.Serialize, SCExt.Serialize);
            if (sc.Game == MEGame.UDK)
            {
                sc.Serialize(ref MeshComponentsWithDynamiclighting, SCExt.Serialize, SCExt.Serialize);
            }
            else
            {
                MeshComponentsWithDynamiclighting = new OrderedMultiValueDictionary <UIndex, uint>();
            }
            if (sc.Game >= MEGame.ME3)
            {
                sc.Serialize(ref ApexMesh, SCExt.Serialize);
            }
            else if (sc.IsLoading)
            {
                ApexMesh = Array.Empty <byte>();
            }

            int byteSize = 1;

            sc.Serialize(ref byteSize);
            sc.Serialize(ref CachedPhysBSPData, SCExt.Serialize);

            sc.Serialize(ref CachedPhysSMDataMap, SCExt.Serialize, SCExt.Serialize);
            sc.Serialize(ref CachedPhysSMDataStore, SCExt.Serialize);
            sc.Serialize(ref CachedPhysPerTriSMDataMap, SCExt.Serialize, SCExt.Serialize);
            sc.Serialize(ref CachedPhysPerTriSMDataStore, SCExt.Serialize);
            sc.Serialize(ref CachedPhysBSPDataVersion);
            sc.Serialize(ref CachedPhysSMDataVersion);
            sc.Serialize(ref ForceStreamTextures, SCExt.Serialize, SCExt.Serialize);
            if (sc.Game == MEGame.UDK)
            {
                KCachedConvexData dummy = new KCachedConvexData {
                    CachedConvexElements = Array.Empty <KCachedConvexDataElement>()
                };
                sc.Serialize(ref dummy);
                int dummyInt = 0;
                sc.Serialize(ref dummyInt);
            }
            sc.Serialize(ref NavListStart);
            sc.Serialize(ref NavListEnd);
            sc.Serialize(ref CoverListStart);
            sc.Serialize(ref CoverListEnd);
            if (sc.Game >= MEGame.ME3)
            {
                sc.Serialize(ref PylonListStart);
                sc.Serialize(ref PylonListEnd);
            }
            if (sc.Game == MEGame.ME3)
            {
                sc.Serialize(ref guidToIntMap, SCExt.Serialize, SCExt.Serialize);
                sc.Serialize(ref CoverLinks, SCExt.Serialize);
                sc.Serialize(ref intToByteMap, SCExt.Serialize, SCExt.Serialize);
                sc.Serialize(ref guidToIntMap2, SCExt.Serialize, SCExt.Serialize);
                sc.Serialize(ref NavPoints, SCExt.Serialize);
                sc.Serialize(ref numbers, SCExt.Serialize);
            }
            else if (sc.IsLoading)
            {
                PylonListStart = new UIndex(0);
                PylonListEnd   = new UIndex(0);
                guidToIntMap   = new OrderedMultiValueDictionary <Guid, int>();
                CoverLinks     = new UIndex[0];
                intToByteMap   = new OrderedMultiValueDictionary <int, byte>();
                guidToIntMap2  = new OrderedMultiValueDictionary <Guid, int>();
                NavPoints      = new UIndex[0];
                numbers        = new int[0];
            }
            sc.Serialize(ref CrossLevelActors, SCExt.Serialize);
            if (sc.Game == MEGame.UDK)
            {
                int dummy = 0;
                sc.Serialize(ref dummy);
                sc.Serialize(ref dummy);
                sc.Serialize(ref dummy);
            }

            if (sc.Game == MEGame.ME1)
            {
                sc.Serialize(ref ArtPlaceable1);
                sc.Serialize(ref ArtPlaceable2);
            }
            else if (sc.IsLoading)
            {
                ArtPlaceable1 = new UIndex(0);
                ArtPlaceable2 = new UIndex(0);
            }

            if (sc.Game == MEGame.UDK && sc.IsSaving)
            {
                sc.ms.WriteBoolInt(false); //PrecomputedLightVolume bIsInitialized
                sc.ms.WriteZeros(28);      //Zero-ed PrecomputedVisibilityHandler
                sc.ms.WriteZeros(45);      //unk data
            }

            if (sc.Game == MEGame.ME3)
            {
                //PrecomputedLightVolume
                bool bIsInitialized = false;
                sc.Serialize(ref bIsInitialized);
                //should always be false, but just in case;
                if (bIsInitialized)
                {
                    throw new Exception($"PersistentLevel has a PreComputedLightVolume! Level in: {sc.Pcc.FilePath}");
                }
            }
        }