public static void Serialize(this SerializingContainer2 sc, ref KCachedConvexData convData) { if (sc.IsLoading) { convData = new KCachedConvexData(); } sc.Serialize(ref convData.CachedConvexElements, Serialize); }
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 List <UIndex>(); intToByteMap = new OrderedMultiValueDictionary <int, byte>(); guidToIntMap2 = new OrderedMultiValueDictionary <Guid, int>(); NavPoints = new List <UIndex>(); numbers = new List <int>(); } 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.Writer.WriteBoolInt(false); //PrecomputedLightVolume bIsInitialized sc.ms.BaseStream.WriteZeros(28); //Zero-ed PrecomputedVisibilityHandler sc.ms.BaseStream.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}"); } } }