Core/Movement: Ensured object orientation is always within 0-2pi range, this fixes movement.

This commit is contained in:
Shauren
2012-08-10 14:10:57 +02:00
parent 5e1e9bb4dd
commit 9538fb6d5a
11 changed files with 40 additions and 27 deletions

View File

@@ -315,7 +315,6 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
data->WriteBit(flags & UPDATEFLAG_UNK5);
data->WriteBit(0);
data->WriteBit(flags & UPDATEFLAG_TRANSPORT);
bool fullSpline = false;
if (flags & UPDATEFLAG_LIVING)
{
@@ -323,6 +322,8 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
ObjectGuid guid = GetGUID();
uint32 movementFlags = self->m_movementInfo.GetMovementFlags();
uint16 movementFlagsExtra = self->m_movementInfo.GetExtraMovementFlags();
if (GetTypeId() == TYPEID_UNIT)
movementFlags &= MOVEMENTFLAG_MASK_CREATURE_ALLOWED;
data->WriteBit(!movementFlags);
data->WriteBit(G3D::fuzzyEq(self->GetOrientation(), 0.0f)); // Has Orientation
@@ -359,7 +360,7 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
data->WriteBit(guid[4]);
if (self->IsSplineEnabled())
Movement::PacketBuilder::WriteCreateBits(*self->movespline, *data, fullSpline);
Movement::PacketBuilder::WriteCreateBits(*self->movespline, *data);
data->WriteBit(guid[6]);
if (movementFlagsExtra & MOVEMENTFLAG2_INTERPOLATED_TURNING)
@@ -421,6 +422,8 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
ObjectGuid guid = GetGUID();
uint32 movementFlags = self->m_movementInfo.GetMovementFlags();
uint16 movementFlagsExtra = self->m_movementInfo.GetExtraMovementFlags();
if (GetTypeId() == TYPEID_UNIT)
movementFlags &= MOVEMENTFLAG_MASK_CREATURE_ALLOWED;
data->WriteByteSeq(guid[4]);
*data << self->GetSpeed(MOVE_RUN_BACK);
@@ -442,7 +445,7 @@ void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
*data << float(self->m_movementInfo.splineElevation);
if (self->IsSplineEnabled())
Movement::PacketBuilder::WriteCreateData(*self->movespline, *data, fullSpline);
Movement::PacketBuilder::WriteCreateData(*self->movespline, *data);
*data << float(self->GetPositionZMinusOffset());
data->WriteByteSeq(guid[5]);