Exemplo n.º 1
0
        internal static PolygonTrigger Parse(BinaryReader reader, ushort version)
        {
            var result = new PolygonTrigger
            {
                Name = reader.ReadUInt16PrefixedAsciiString()
            };

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

            result.UniqueId = reader.ReadUInt32();

            result.TriggerType = reader.ReadUInt16AsEnum <PolygonTriggerType>();

            result.RiverStartControlPoint = reader.ReadUInt32();

            if (version >= 5)
            {
                result.RiverTexture     = reader.ReadUInt16PrefixedAsciiString();
                result.NoiseTexture     = reader.ReadUInt16PrefixedAsciiString();
                result.AlphaEdgeTexture = reader.ReadUInt16PrefixedAsciiString();
                result.SparkleTexture   = reader.ReadUInt16PrefixedAsciiString();
                result.BumpMapTexture   = reader.ReadUInt16PrefixedAsciiString();
                result.SkyTexture       = reader.ReadUInt16PrefixedAsciiString();

                result.UseAdditiveBlending = reader.ReadBooleanChecked();

                result.RiverColor = reader.ReadColorRgb();

                result.Unknown = reader.ReadByte(); // 0
                if (result.Unknown != 0)
                {
                    throw new InvalidDataException();
                }

                result.UvScrollSpeed = reader.ReadVector2();

                result.RiverAlpha = reader.ReadSingle();
            }

            var numPoints = reader.ReadUInt32();

            result.Points = new MapVector3i[numPoints];

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

            return(result);
        }
Exemplo n.º 2
0
        internal static PolygonTriggers Parse(BinaryReader reader, MapParseContext context)
        {
            return(ParseAsset(reader, context, version =>
            {
                var numTriggers = reader.ReadUInt32();
                var triggers = new PolygonTrigger[numTriggers];

                for (var i = 0; i < numTriggers; i++)
                {
                    triggers[i] = PolygonTrigger.Parse(reader, version);
                }

                return new PolygonTriggers
                {
                    Triggers = triggers
                };
            }));
        }