本文整理汇总了C++中MoveSpline类的典型用法代码示例。如果您正苦于以下问题:C++ MoveSpline类的具体用法?C++ MoveSpline怎么用?C++ MoveSpline使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MoveSpline类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PackedGuid
void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data)
{
MoveSplineFlag splineflags = move_spline.splineflags;
if (move_spline.transportGuid)
{
//DEBUG_LOG("Setting transport opcode for %s", move_spline.transport->GetGuidStr().c_str());
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
data << PackedGuid(move_spline.transportGuid);
data << uint8(move_spline.transportSeat);
data << uint8(0);
data << (Vector3)move_spline.transportPos;
}
else
{
data << uint8(0);
data << move_spline.spline.getPoint(move_spline.spline.first());
}
data << move_spline.GetId();
switch(splineflags & MoveSplineFlag::Mask_Final_Facing)
{
default:
data << uint8(MonsterMoveNormal);
break;
case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget);
data << move_spline.facing.target;
break;
case MoveSplineFlag::Final_Angle:
data << uint8(MonsterMoveFacingAngle);
data << NormalizeOrientation(move_spline.facing.angle);
break;
case MoveSplineFlag::Final_Point:
data << uint8(MonsterMoveFacingSpot);
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
break;
}
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)
splineflags.enter_cycle = move_spline.isCyclic();
data << uint32(splineflags & ~MoveSplineFlag::Mask_No_Monster_Move);
if (splineflags.animation)
{
data << splineflags.getAnimationId();
data << move_spline.effect_start_time;
}
data << move_spline.Duration();
if (splineflags.parabolic)
{
data << move_spline.vertical_acceleration;
data << move_spline.effect_start_time;
}
}
示例2: if
void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data)
{
MoveSplineFlag splineflags = move_spline.splineflags;
/*if(unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT);
if(unit->GetVehicle())
data << unit->GetVehicle()->GetBase()->GetPackGUID();
else if(unit->GetTransport())
data << unit->GetTransport()->GetPackGUID();
else
data << uint64(0);
data << int8(unit->GetTransSeat());
}*/
data << uint8(0);
data << move_spline.spline.getPoint(move_spline.spline.first());
data << move_spline.GetId();
switch(splineflags & MoveSplineFlag::Mask_Final_Facing)
{
case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget);
data << move_spline.facing.target;
break;
case MoveSplineFlag::Final_Angle:
data << uint8(MonsterMoveFacingAngle);
data << move_spline.facing.angle;
break;
case MoveSplineFlag::Final_Point:
data << uint8(MonsterMoveFacingSpot);
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
break;
default:
data << uint8(MonsterMoveNormal);
break;
}
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)
splineflags.enter_cycle = move_spline.isCyclic();
data << uint32(splineflags & ~MoveSplineFlag::Mask_No_Monster_Move);
if(splineflags.animation)
{
data << splineflags.getAnimationId();
data << move_spline.effect_start_time;
}
data << move_spline.Duration();
if(splineflags.parabolic)
{
data << move_spline.vertical_acceleration;
data << move_spline.effect_start_time;
}
}
示例3: WriteCreateBits
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
{
if (!data.WriteBit(!moveSpline.Finalized()))
return;
data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation)); // hasSplineStartTime = packet.ReadBit();
data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration());
data.WriteBit(0); // unk
data.WriteBits(moveSpline.getPath().size(), 25); // splineCount = packet.ReadBits("Spline Waypoints", 22, index);
data.WriteBits(uint8(moveSpline.spline.mode()), 2); // packet.ReadEnum<SplineMode>("Spline Mode", 2, index);
data.WriteBits(moveSpline.splineflags.raw(), 20); // packet.ReadEnum<SplineFlag434>("Spline flags", 20, index);
}
示例4: WriteCreateBits
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
{
if (!data.WriteBit(!moveSpline.Finalized()))
return;
data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation));
data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration());
data.WriteBit(0); // NYI Block
data.WriteBits(moveSpline.getPath().size(), 20);
data.WriteBits(moveSpline.spline.mode(), 2);
data.WriteBits(moveSpline.splineflags.raw(), 25);
}
示例5: if
void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data)
{
if (!moveSpline.Finalized())
{
MoveSplineFlag splineFlags = moveSpline.splineflags;
if ((splineFlags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration())
data << moveSpline.vertical_acceleration; // added in 3.1
data << moveSpline.timePassed();
if (splineFlags.final_angle)
data << moveSpline.facing.angle;
else if (splineFlags.final_target)
{
ObjectGuid facingGuid = moveSpline.facing.target;
data.WriteByteSeq(facingGuid[5]);
data.WriteByteSeq(facingGuid[3]);
data.WriteByteSeq(facingGuid[7]);
data.WriteByteSeq(facingGuid[1]);
data.WriteByteSeq(facingGuid[6]);
data.WriteByteSeq(facingGuid[4]);
data.WriteByteSeq(facingGuid[2]);
data.WriteByteSeq(facingGuid[0]);
}
uint32 nodes = moveSpline.getPath().size();
for (uint32 i = 0; i < nodes; ++i)
{
data << float(moveSpline.getPath()[i].z);
data << float(moveSpline.getPath()[i].x);
data << float(moveSpline.getPath()[i].y);
}
if (splineFlags.final_point)
data << moveSpline.facing.f.x << moveSpline.facing.f.z << moveSpline.facing.f.y;
data << float(1.f); // splineInfo.duration_mod_next; added in 3.1
data << moveSpline.Duration();
if (splineFlags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation))
data << moveSpline.effect_start_time; // added in 3.1
data << float(1.f); // splineInfo.duration_mod; added in 3.1
}
if (!moveSpline.isCyclic())
{
Vector3 dest = moveSpline.FinalDestination();
data << float(dest.z);
data << float(dest.x);
data << float(dest.y);
}
else
data << Vector3::zero();
data << moveSpline.GetId();
}
示例6: switch
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
{
data.WriteBits(uint8(moveSpline.spline.mode()), 2);
data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation));
data.WriteBits(moveSpline.getPath().size(), 22);
switch (moveSpline.splineflags & MoveSplineFlag::Mask_Final_Facing)
{
case MoveSplineFlag::Final_Target:
{
uint64 targetGuid = moveSpline.facing.target;
data.WriteBits(2, 2);
uint8 guidMask[] = { 4, 3, 7, 2, 6, 1, 0, 5 };
data.WriteGuidMask(moveSpline.facing.target, guidMask, 8, 0);
break;
}
case MoveSplineFlag::Final_Angle:
data.WriteBits(0, 2);
break;
case MoveSplineFlag::Final_Point:
data.WriteBits(1, 2);
break;
default:
data.WriteBits(3, 2);
break;
}
data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration());
data.WriteBits(moveSpline.splineflags.raw(), 25);
}
示例7: switch
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
{
data.WriteBits(uint8(moveSpline.spline.mode()), 2);
data.WriteBit(moveSpline.splineflags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation));
data.WriteBits(moveSpline.getPath().size(), 22);
switch (moveSpline.splineflags & MoveSplineFlag::Mask_Final_Facing)
{
case MoveSplineFlag::Final_Target:
{
ObjectGuid targetGuid = moveSpline.facing.target;
data.WriteBits(2, 2);
data.WriteBit(targetGuid[4]);
data.WriteBit(targetGuid[3]);
data.WriteBit(targetGuid[7]);
data.WriteBit(targetGuid[2]);
data.WriteBit(targetGuid[6]);
data.WriteBit(targetGuid[1]);
data.WriteBit(targetGuid[0]);
data.WriteBit(targetGuid[5]);
break;
}
case MoveSplineFlag::Final_Angle:
data.WriteBits(0, 2);
break;
case MoveSplineFlag::Final_Point:
data.WriteBits(1, 2);
break;
default:
data.WriteBits(3, 2);
break;
}
data.WriteBit((moveSpline.splineflags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration());
data.WriteBits(moveSpline.splineflags.raw(), 25);
}
示例8: WriteCatmullRomPath
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));
}
示例9: uint8
void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data)
{
MoveSplineFlag splineflags = move_spline.splineflags;
data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40)
data << move_spline.spline.getPoint(move_spline.spline.first());
data << move_spline.GetId();
switch (splineflags & MoveSplineFlag::Mask_Final_Facing)
{
case MoveSplineFlag::Final_Target:
data << uint8(MonsterMoveFacingTarget);
data << move_spline.facing.target;
break;
case MoveSplineFlag::Final_Angle:
data << uint8(MonsterMoveFacingAngle);
data << move_spline.facing.angle;
break;
case MoveSplineFlag::Final_Point:
data << uint8(MonsterMoveFacingSpot);
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
break;
default:
data << uint8(MonsterMoveNormal);
break;
}
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)
splineflags.enter_cycle = move_spline.isCyclic();
data << uint32(splineflags & uint32(~MoveSplineFlag::Mask_No_Monster_Move));
if (splineflags.animation)
{
data << splineflags.getAnimationId();
data << move_spline.effect_start_time;
}
data << move_spline.Duration();
if (splineflags.parabolic)
{
data << move_spline.vertical_acceleration;
data << move_spline.effect_start_time;
}
}
示例10: WriteCreate
void PacketBuilder::WriteCreate(const MoveSpline& move_spline, ByteBuffer& data)
{
// WriteClientStatus(mov,data);
// data.append<float>(&mov.m_float_values[SpeedWalk], SpeedMaxCount);
// if (mov.SplineEnabled())
{
MoveSplineFlag splineFlags = move_spline.splineflags;
data << splineFlags.raw();
if (splineFlags.final_angle)
{
data << move_spline.facing.angle;
}
else if (splineFlags.final_target)
{
data << move_spline.facing.target;
}
else if (splineFlags.final_point)
{
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
}
data << move_spline.timePassed();
data << move_spline.Duration();
data << move_spline.GetId();
uint32 nodes = move_spline.getPath().size();
data << nodes;
data.append<Vector3>(&move_spline.getPath()[0], nodes);
data << (move_spline.isCyclic() ? Vector3::zero() : move_spline.FinalDestination());
}
}
示例11: WriteCatmullRomCyclicPath
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));
}
示例12: float
void PacketBuilder::WriteCreateBytes(const MoveSpline& move_spline, ByteBuffer& data)
{
if (!move_spline.Finalized())
{
MoveSplineFlag splineFlags = move_spline.splineflags;
uint32 nodes = move_spline.getPath().size();
bool hasSplineStartTime = move_spline.splineflags & (MoveSplineFlag::Trajectory | MoveSplineFlag::Animation);
bool hasSplineVerticalAcceleration = (move_spline.splineflags & MoveSplineFlag::Trajectory) && move_spline.effect_start_time < move_spline.Duration();
if (hasSplineVerticalAcceleration)
data << float(move_spline.vertical_acceleration); // added in 3.1
data << int32(move_spline.timePassed());
if (move_spline.splineflags & MoveSplineFlag::Final_Angle)
data << float(NormalizeOrientation(move_spline.facing.angle));
else if (move_spline.splineflags & MoveSplineFlag::Final_Target)
data.WriteGuidBytes<5, 3, 7, 1, 6, 4, 2, 0>(ObjectGuid(move_spline.facing.target));
for (uint32 i = 0; i < nodes; ++i)
{
data << float(move_spline.getPath()[i].z);
data << float(move_spline.getPath()[i].x);
data << float(move_spline.getPath()[i].y);
}
if (move_spline.splineflags & MoveSplineFlag::Final_Point)
data << float(move_spline.facing.f.x) << float(move_spline.facing.f.z) << float(move_spline.facing.f.y);
data << float(1.f);
data << int32(move_spline.Duration());
if (hasSplineStartTime)
data << int32(move_spline.effect_start_time); // added in 3.1
data << float(1.f);
}
if (!move_spline.isCyclic())
{
Vector3 dest = move_spline.FinalDestination();
data << float(dest.z);
data << float(dest.x);
data << float(dest.y);
}
else
data << Vector3::zero();
data << uint32(move_spline.GetId());
}
示例13: ASSERT
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
{
ASSERT(!moveSpline.Finalized());
MoveSplineFlag flags = moveSpline.splineflags;
data.WriteBit(true);
data.WriteBit(flags.parabolic || flags.animation);
data.WriteBits(uint8(moveSpline.spline.mode()), 2);
data.WriteBits(moveSpline.getPath().size(), 20);
data.WriteBits(flags.raw(), 25);
data.WriteBit(flags.parabolic);
data.WriteBit(false);
if (false)
{
data.WriteBits(0, 2);
data.WriteBits(0, 21);
}
}
示例14: WriteFacingTargetPart
void PacketBuilder::WriteFacingTargetPart(MoveSpline const& moveSpline, ByteBuffer& data)
{
if (GetMonsterMoveType(moveSpline) == MonsterMoveFacingTarget && !moveSpline.Finalized())
{
ObjectGuid facingGuid = moveSpline.facing.target;
data.WriteGuidMask(facingGuid, 4, 7, 0, 5, 1, 2, 3, 6);
data.WriteGuidBytes(facingGuid, 4, 2, 0, 5, 6, 3, 1, 7);
}
}
示例15: GetMonsterMoveType
void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data)
{
if (!moveSpline.Finalized())
{
MoveSplineFlag const& splineFlags = moveSpline.splineflags;
MonsterMoveType type = GetMonsterMoveType(moveSpline);
data << moveSpline.timePassed();
data << float(1.f); // splineInfo.duration_mod_next; added in 3.1
data << float(1.f); // splineInfo.duration_mod; added in 3.1
uint32 nodes = moveSpline.getPath().size();
for (uint32 i = 0; i < nodes; ++i)
{
data << float(moveSpline.getPath()[i].x);
data << float(moveSpline.getPath()[i].z);
data << float(moveSpline.getPath()[i].y);
}
if (splineFlags & (MoveSplineFlag::Parabolic | MoveSplineFlag::Animation))
data << moveSpline.effect_start_time; // added in 3.1
data << uint8(type);
if (type == MonsterMoveFacingAngle)
data << float(moveSpline.facing.angle);
if (type == MonsterMoveFacingPoint)
data << moveSpline.facing.f.x << moveSpline.facing.f.z << moveSpline.facing.f.y;
if ((splineFlags & MoveSplineFlag::Parabolic) && moveSpline.effect_start_time < moveSpline.Duration())
data << float(moveSpline.vertical_acceleration); // added in 3.1
// NYI block here
data << moveSpline.Duration();
}
Vector3 destination = moveSpline.isCyclic() ? Vector3::zero() : moveSpline.FinalDestination();
data << float(destination.x);
data << float(destination.z);
data << moveSpline.GetId();
data << float(destination.y);
}