Beispiel #1
0
        internal static StandingWaveArea Parse(BinaryReader reader, ushort version)
        {
            var result = new StandingWaveArea
            {
                UniqueID            = reader.ReadUInt32(),
                Name                = reader.ReadUInt16PrefixedAsciiString(),
                LayerName           = reader.ReadUInt16PrefixedAsciiString(),
                UvScrollSpeed       = reader.ReadSingle(),
                UseAdditiveBlending = reader.ReadBooleanChecked()
            };

            var numPoints = reader.ReadUInt32();

            result.Points = new Vector2[numPoints];

            for (var i = 0; i < numPoints; i++)
            {
                result.Points[i] = reader.ReadVector2();
            }

            var unknown = reader.ReadUInt32();

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

            if (version < 3)
            {
                result.FinalWidth            = reader.ReadUInt32();
                result.FinalHeight           = reader.ReadUInt32();
                result.InitialWidthFraction  = reader.ReadUInt32();
                result.InitialHeightFraction = reader.ReadUInt32();
                result.InitialVelocity       = reader.ReadUInt32();
                result.TimeToFade            = reader.ReadUInt32();
                result.TimeToCompress        = reader.ReadUInt32();
                result.TimeOffset2ndWave     = reader.ReadUInt32();
                result.DistanceFromShore     = reader.ReadUInt32();
                result.Texture = reader.ReadUInt16PrefixedAsciiString();

                if (version == 2)
                {
                    result.EnablePcaWave = reader.ReadBooleanUInt32Checked();
                }
            }

            if (version >= 4)
            {
                result.WaveParticleFXName = reader.ReadUInt16PrefixedAsciiString();
            }

            return(result);
        }
Beispiel #2
0
        internal static StandingWaveAreas Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var numAreas = reader.ReadUInt32();
                var areas = new StandingWaveArea[numAreas];

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

                return new StandingWaveAreas
                {
                    Areas = areas
                };
            }));
        }