Exemplo n.º 1
0
        internal static RiverAreas Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var numAreas = reader.ReadUInt32();
                var areas = new RiverArea[numAreas];

                for (var i = 0; i < numAreas; i++)
                {
                    areas[i] = RiverArea.Parse(reader, version);
                }

                return new RiverAreas
                {
                    Areas = areas
                };
            }));
        }
Exemplo n.º 2
0
        internal static RiverArea Parse(BinaryReader reader, ushort version)
        {
            var result = new RiverArea
            {
                UniqueID            = reader.ReadUInt32(),
                Name                = reader.ReadUInt16PrefixedAsciiString(),
                LayerName           = reader.ReadUInt16PrefixedAsciiString(),
                UvScrollSpeed       = reader.ReadSingle(),
                UseAdditiveBlending = reader.ReadBooleanChecked(),
                RiverTexture        = reader.ReadUInt16PrefixedAsciiString(),
                NoiseTexture        = reader.ReadUInt16PrefixedAsciiString(),
                AlphaEdgeTexture    = reader.ReadUInt16PrefixedAsciiString(),
                SparkleTexture      = reader.ReadUInt16PrefixedAsciiString(),
                Color               = reader.ReadColorRgb()
            };

            var unusedColorA = reader.ReadByte();

            if (unusedColorA != 0)
            {
                throw new InvalidDataException();
            }

            result.Alpha       = reader.ReadSingle();
            result.WaterHeight = reader.ReadUInt32();

            if (version >= 3)
            {
                result.RiverType = reader.ReadUInt16PrefixedAsciiString();
            }

            result.MinimumWaterLod = reader.ReadUInt16PrefixedAsciiString();

            var numLines = reader.ReadUInt32();

            result.Lines = new Line2D[numLines];

            for (var i = 0; i < numLines; i++)
            {
                result.Lines[i] = reader.ReadLine2D();
            }

            return(result);
        }