Exemplo n.º 1
0
        internal UCurveTable(IoPackageReader reader)
        {
            reader.ReadUInt16(); // don't ask me
            reader.ReadUInt32(); // what this is

            int NumRows = reader.ReadInt32();

            CurveTableMode = (ECurveTableMode)reader.ReadByte();
            Dictionary <int, PropertyInfo> properties = CurveTableMode switch
            {
                ECurveTableMode.RichCurves => Globals.TypeMappings["RichCurve"],
                ECurveTableMode.SimpleCurves => Globals.TypeMappings["SimpleCurve"],
                _ => throw new FileLoadException($"This table has an unknown mode ({CurveTableMode})")
            };

            RowMap = new Dictionary <string, object>();
            for (int i = 0; i < NumRows; i++)
            {
                int    num      = 1;
                string RowName  = reader.ReadFName().String ?? "";
                string baseName = RowName;
                while (RowMap.ContainsKey(RowName))
                {
                    RowName = $"{baseName}_NK{num++:00}";
                }

                RowMap[RowName] = new UObject(reader, properties, true);
            }
        }
Exemplo n.º 2
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var numRows = Ar.Read <int>();

            var bUpgradingCurveTable = FFortniteMainBranchObjectVersion.Get(Ar) < FFortniteMainBranchObjectVersion.Type.ShrinkCurveTableSize;

            if (bUpgradingCurveTable)
            {
                CurveTableMode = numRows > 0 ? ECurveTableMode.RichCurves : ECurveTableMode.Empty;
            }
            else
            {
                CurveTableMode = Ar.Read <ECurveTableMode>();
            }
            RowMap = new Dictionary <FName, FStructFallback>(numRows);
            for (var i = 0; i < numRows; i++)
            {
                var    rowName   = Ar.ReadFName();
                string rowStruct = CurveTableMode switch
                {
                    ECurveTableMode.SimpleCurves => "SimpleCurve",
                    ECurveTableMode.RichCurves => "RichCurve",
                    _ => ""
                };
                RowMap[rowName] = new FStructFallback(Ar, rowStruct);
            }
        }
Exemplo n.º 3
0
        internal UCurveTable(PackageReader reader)
        {
            _ = new UObject(reader); //will break

            int NumRows = reader.ReadInt32();

            CurveTableMode = (ECurveTableMode)reader.ReadByte();

            RowMap = new Dictionary <string, object>();
            for (int i = 0; i < NumRows; i++)
            {
                var RowName = reader.ReadFName();
                RowMap[RowName.String] = new UObject(reader, true);
            }
        }
Exemplo n.º 4
0
        public override void Deserialize(FAssetArchive Ar, long validPos)
        {
            base.Deserialize(Ar, validPos);

            var numRows = Ar.Read <int>();

            CurveTableMode = Ar.Read <ECurveTableMode>();
            RowMap         = new Dictionary <FName, FStructFallback>(numRows);
            for (var i = 0; i < numRows; i++)
            {
                var    rowName   = Ar.ReadFName();
                string rowStruct = CurveTableMode switch
                {
                    ECurveTableMode.SimpleCurves => "SimpleCurve",
                    ECurveTableMode.RichCurves => "RichCurve",
                    _ => ""
                };
                RowMap[rowName] = new FStructFallback(Ar, rowStruct);
            }
        }
    }
Exemplo n.º 5
0
        internal UCurveTable(PackageReader reader)
        {
            new UObject(reader); //will break

            int NumRows = reader.ReadInt32();

            CurveTableMode = (ECurveTableMode)reader.ReadByte();

            RowMap = new Dictionary <string, object>();
            for (int i = 0; i < NumRows; i++)
            {
                int    num      = 1;
                string RowName  = reader.ReadFName().String ?? "";
                string baseName = RowName;
                while (RowMap.ContainsKey(RowName))
                {
                    RowName = $"{baseName}_NK{num++:00}";
                }

                RowMap[RowName] = new UObject(reader, true);
            }
        }
Exemplo n.º 6
0
        internal UCurveTable(IoPackageReader reader, IReadOnlyDictionary <int, PropertyInfo> properties)
        {
            reader.ReadUInt16(); // don't ask me
            reader.ReadUInt32(); // what is this

            int NumRows = reader.ReadInt32();

            CurveTableMode = (ECurveTableMode)reader.ReadByte();

            RowMap = new Dictionary <string, object>();
            for (int i = 0; i < NumRows; i++)
            {
                int    num      = 1;
                string RowName  = reader.ReadFName().String ?? "";
                string baseName = RowName;
                while (RowMap.ContainsKey(RowName))
                {
                    RowName = $"{baseName}_NK{num++:00}";
                }

                RowMap[RowName] = new UObject(reader, properties, true);
            }
        }