Esempio n. 1
0
    void WriteLinearPath(const Spline<int32>& spline, ByteBuffer& data)
    {
        uint32 last_idx = spline.getPointCount() - 3;
        const Vector3* real_path = &spline.getPoint(1);
        Vector3 destination = real_path[last_idx];

		size_t lastIndexPos = data.wpos();
        data << last_idx;
        data << destination;
        if (last_idx > 1)
        {
            Vector3 offset;
            // first and last points already appended
            for (uint32 i = 1; i < last_idx; ++i)
            {
                offset = destination - real_path[i];
				// [-ZERO] The client freezes when it gets a zero offset.
				// If the offset would be rounded to zero, skip it.
				if (fabs(offset.x) < 0.25 && fabs(offset.y) < 0.25 && fabs(offset.z) < 0.25)
				{
					last_idx--;
					data.put(lastIndexPos, last_idx);
					continue;
				}
                data.appendPackXYZ(offset.x, offset.y, offset.z);
            }
        }
    }
	void WriteCatmullRomPath(const Spline<int32>& spline, ByteBuffer& data)
	{
		for (int i = 2; i < spline.getPointCount() - 3; i++)
			data << spline.getPoint(i).y << spline.getPoint(i).x << spline.getPoint(i).z;

		//data.append<Vector3>(&spline.getPoint(2), count);
	}
    void WriteCatmullRomCyclicPath(const Spline<int32>& spline, ByteBuffer& data)
    {
        uint32 count = spline.getPointCount() - 3;
        data << uint32(count + 1);
        data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done
        data.append<Vector3>(&spline.getPoint(1), count);

        // Unknow 5.0.5 MoP
        uint16 unkCount = 0;
        data << uint16(unkCount); // unk 5.0.5 count
        if (unkCount)
        {
            data << float(0);
            data << uint16(0);
            data << uint16(0);
            data << float(0);
            data << uint16(0);

            for(int i = 0; i < unkCount; i++)
            {
                data << uint16(0);
                data << uint16(0);
            }
        }
    }
    void WriteUncompressedCyclicPath(Spline<int32> const& spline, ByteBuffer& data)
    {
        data << spline.getPoint(1).y << spline.getPoint(1).x << spline.getPoint(1).z; // Fake point, client will erase it from the spline after first cycle done

        for (int i = 1; i < spline.getPointCount() - 3; i++)
            data << spline.getPoint(i).y << spline.getPoint(i).x << spline.getPoint(i).z;
    }
Esempio n. 5
0
 void WriteCatmullRomCyclicPath(const Spline<int32>& spline, ByteBuffer& data)
 {
     uint32 count = spline.getPointCount() - 3;
     data << uint32(count + 1);
     data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done
     data.append<Vector3>(&spline.getPoint(1), count);
 }
Esempio n. 6
0
 void PacketBuilder::WriteCatmullRomPath(const MoveSpline& move_spline, ByteBuffer& data)
 {
     const Spline<int32> spline = move_spline._Spline();
     uint32 count = spline.getPointCount() - 3;
     data << count;
     for (uint32 i = 0; i < count; ++i)
         data << CalcTransportOffset(move_spline, spline.getPoint(2 + i));
 }
	void WriteCatmullRomCyclicPath(const Spline<int32>& spline, ByteBuffer& data)
	{
		data << spline.getPoint(1).y << spline.getPoint(1).x << spline.getPoint(1).z; // fake point, client will erase it from the spline after first cycle done

		for (int i = 1; i < spline.getPointCount() - 3; i++)
			data << spline.getPoint(i).y << spline.getPoint(i).x << spline.getPoint(i).z;
		//data.append<Vector3>(&spline.getPoint(1), count);
	}
Esempio n. 8
0
 void PacketBuilder::WriteCatmullRomCyclicPath(const MoveSpline& move_spline, ByteBuffer& data)
 {
     const Spline<int32> spline = move_spline._Spline();
     uint32 count = spline.getPointCount() - 3;
     data << uint32(count + 1);
     data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done
     for (uint32 i = 0; i < count; ++i)
         data << CalcTransportOffset(move_spline, spline.getPoint(1 + i));
 }
    void WriteLinearPath(Spline<int32> const& spline, ByteBuffer& data)
    {
        uint32 last_idx = spline.getPointCount() - 3;
        Vector3 const* real_path = &spline.getPoint(1);

        if (last_idx > 0)
        {
            Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
            Vector3 offset;
            // first and last points already appended
            for (uint32 i = 0; i < last_idx; ++i)
            {
                offset = middle - real_path[i];
                data.appendPackXYZ(offset.x, offset.y, offset.z);
            }
        }
    }
Esempio n. 10
0
    void WriteLinearPath(const Spline<int32>& spline, ByteBuffer& data)
    {
        uint32 last_idx = spline.getPointCount() - 3;
        const Vector3* real_path = &spline.getPoint(1);

        data << last_idx;
        data << real_path[last_idx];   // destination
        if (last_idx > 1)
        {
            Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
            // first and last points already appended
            for (uint32 i = 1; i < last_idx; ++i)
            {
                Vector3 offset = middle - real_path[i];
                data.appendPackXYZ(offset.x, offset.y, offset.z);
            }
        }
    }
Esempio n. 11
0
    void PacketBuilder::WriteLinearPath(const MoveSpline& move_spline, ByteBuffer& data)
    {
        const Spline<int32> spline = move_spline._Spline();
        uint32 last_idx = spline.getPointCount() - 3;
        const Vector3 * real_path = &spline.getPoint(1);

        data << last_idx;
        data << CalcTransportOffset(move_spline, real_path[last_idx]);   // destination
        if (last_idx > 1)
        {
            Vector3 middle = (CalcTransportOffset(move_spline, real_path[0]) + CalcTransportOffset(move_spline, real_path[last_idx])) / 2.f;
            Vector3 offset;
            // first and last points already appended
            for (uint32 i = 1; i < last_idx; ++i)
            {
                offset = CalcTransportOffset(move_spline, middle) - CalcTransportOffset(move_spline, real_path[i]);
                data.appendPackXYZ(offset.x, offset.y, offset.z);
            }
        }
    }
    void WriteLinearPath(const Spline<int32>& spline, ByteBuffer& data)
    {
        uint32 last_idx = spline.getPointCount() - 3;
        const Vector3 * real_path = &spline.getPoint(1);

        data << last_idx;
        data << real_path[last_idx];   // destination
        if (last_idx > 1)
        {
            Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
            Vector3 offset;
            // first and last points already appended
            for (uint32 i = 1; i < last_idx; ++i)
            {
                offset = middle - real_path[i];
                data.appendPackXYZ(offset.x, offset.y, offset.z);
            }
        }

        // Unknow 5.0.5 MoP
        uint16 unkCount = 0;
        data << uint16(unkCount); // unk 5.0.5 count
        if (unkCount)
        {
            data << float(0);
            data << uint16(0);
            data << uint16(0);
            data << float(0);
            data << uint16(0);

            for(int i = 0; i < unkCount; i++)
            {
                data << uint16(0);
                data << uint16(0);
            }
        }
    }
    void WriteCatmullRomPath(const Spline<int32>& spline, ByteBuffer& data)
    {
        uint32 count = spline.getPointCount() - 3;
        data << count;
        data.append<Vector3>(&spline.getPoint(2), count);

        // Unknow 5.0.5 MoP
        uint16 unkCount = 0;
        data << uint16(unkCount); // unk 5.0.5 count
        if (unkCount)
        {
            data << float(0);
            data << uint16(0);
            data << uint16(0);
            data << float(0);
            data << uint16(0);

            for(int i = 0; i < unkCount; i++)
            {
                data << uint16(0);
                data << uint16(0);
            }
        }
    }
Esempio n. 14
0
 void WriteCatmullRomPath(const Spline<int32>& spline, ByteBuffer& data)
 {
     uint32 count = spline.getPointCount() - 3;
     data << count;
     data.append<Vector3>(&spline.getPoint(2), count);
 }
Esempio n. 15
0
 void WriteUncompressedPath(Spline<int32> const& spline, ByteBuffer& data)
 {
     uint32 count = spline.getPointCount() - 3;
     data << count;
     data.append<Vector3>(&spline.getPoint(2), count);
 }
 void WriteUncompressedCyclicPath(Spline<int32> const& spline, ByteBuffer& data)
 {
     uint32 count = spline.getPointCount() - 3;
     data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done
     data.append<Vector3>(&spline.getPoint(1), count);
 }
Esempio n. 17
0
 void WriteUncompressedPath(Spline<int32> const& spline, ByteBuffer& data)
 {
     for (int i = 1; i < spline.getPointCount() - 1; i++)
         data << spline.getPoint(i).y << spline.getPoint(i).x << spline.getPoint(i).z;
 }