[0020] Update splines. Author: @Shauren.

Also use movement StatusInfo for players to write movement information.

Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-08-08 13:47:06 +03:00 committed by Antz
parent bce3248acc
commit ef498a7689
10 changed files with 243 additions and 182 deletions

View file

@ -133,16 +133,29 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
if (target == this) // building packet for yourself
updateFlags |= UPDATEFLAG_SELF;
switch (GetObjectGuid().GetHigh())
{
case HIGHGUID_PLAYER:
case HIGHGUID_PET:
case HIGHGUID_CORPSE:
case HIGHGUID_DYNAMICOBJECT:
updatetype = UPDATETYPE_CREATE_OBJECT2;
break;
case HIGHGUID_UNIT:
{
Creature* creature = (Creature*)this;
if (creature->IsTemporarySummon() && ((TemporarySummon*)this)->GetSummonerGuid().IsPlayer())
updatetype = UPDATETYPE_CREATE_OBJECT2;
break;
}
case HIGHGUID_GAMEOBJECT:
{
if (((GameObject*)this)->GetOwnerGuid().IsPlayer())
updatetype = UPDATETYPE_CREATE_OBJECT2;
}
}
if (updateFlags & UPDATEFLAG_HAS_POSITION)
{
// UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses...
if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
updatetype = UPDATETYPE_CREATE_OBJECT2;
// UPDATETYPE_CREATE_OBJECT2 for pets...
if (target->GetPetGuid() == GetObjectGuid())
updatetype = UPDATETYPE_CREATE_OBJECT2;
// UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
if (isType(TYPEMASK_GAMEOBJECT))
{
@ -243,88 +256,112 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
data->WriteBit(false);
data->WriteBit(updateFlags & UPDATEFLAG_POSITION); // flags & UPDATEFLAG_HAS_POSITION Game Object Position
data->WriteBit(updateFlags & UPDATEFLAG_HAS_POSITION); // Stationary Position
data->WriteBit(false);
data->WriteBit(updateFlags & UPDATEFLAG_TRANSPORT_ARR);
data->WriteBit(false);
data->WriteBit(updateFlags & UPDATEFLAG_TRANSPORT);
bool hasTransport = false,
isSplineEnabled = false,
hasPitch = false,
hasFallData = false,
hasFallDirection = false,
hasElevation = false,
hasOrientation = !isType(TYPEMASK_ITEM),
hasTimeStamp = true,
hasTransportTime2 = false,
hasTransportTime3 = false;
if (isType(TYPEMASK_UNIT))
{
Unit const* unit = (Unit const*)this;
hasTransport = !unit->m_movementInfo.GetTransportGuid().IsEmpty();
isSplineEnabled = unit->IsSplineEnabled();
if (GetTypeId() == TYPEID_PLAYER)
{
// use flags received from client as they are more correct
hasPitch = unit->m_movementInfo.GetStatusInfo().hasPitch;
hasFallData = unit->m_movementInfo.GetStatusInfo().hasFallData;
hasFallDirection = unit->m_movementInfo.GetStatusInfo().hasFallDirection;
hasElevation = unit->m_movementInfo.GetStatusInfo().hasSplineElevation;
hasTransportTime2 = unit->m_movementInfo.GetStatusInfo().hasTransportTime2;
hasTransportTime3 = unit->m_movementInfo.GetStatusInfo().hasTransportTime3;
}
else
{
hasPitch = unit->m_movementInfo.HasMovementFlag(MovementFlags(MOVEFLAG_SWIMMING | MOVEFLAG_FLYING)) ||
unit->m_movementInfo.HasMovementFlag2(MOVEFLAG2_ALLOW_PITCHING);
hasFallData = unit->m_movementInfo.HasMovementFlag2(MOVEFLAG2_INTERP_TURNING);
hasFallDirection = unit->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLING);
hasElevation = unit->m_movementInfo.HasMovementFlag(MOVEFLAG_SPLINE_ELEVATION);
}
}
if (updateFlags & UPDATEFLAG_LIVING)
{
Unit const* unit = (Unit const*)this;
bool hasTransport = unit->m_movementInfo.GetTransportGuid();
bool isSplineEnabled = unit->IsSplineEnabled();
bool hasPitch = ((unit->m_movementInfo.GetMovementFlags() & (MOVEFLAG_SWIMMING | MOVEFLAG_FLYING)) ||
(unit->m_movementInfo.GetMovementFlags2() & MOVEFLAG2_ALLOW_PITCHING));
bool haveFallData = unit->m_movementInfo.GetMovementFlags2() & MOVEFLAG2_INTERP_TURNING;
bool hasFallDirection = unit->m_movementInfo.GetMovementFlags() & MOVEFLAG_FALLING;
bool hasElevation = unit->m_movementInfo.GetMovementFlags() & MOVEFLAG_SPLINE_ELEVATION;
bool hasOrientation = GetTypeId() != TYPEID_ITEM && GetTypeId() != TYPEID_CONTAINER;
data->WriteBit(!(unit->m_movementInfo.GetMovementFlags()));
data->WriteBit(!unit->m_movementInfo.GetMovementFlags());
data->WriteBit(!hasOrientation);
data->WriteGuidMask<7, 3, 2>(Guid);
if(unit->m_movementInfo.GetMovementFlags())
if (unit->m_movementInfo.GetMovementFlags())
data->WriteBits(unit->m_movementInfo.GetMovementFlags(), 30);
data->WriteBit(false);
data->WriteBit(false);
data->WriteBit(!hasPitch);
data->WriteBit(isSplineEnabled);
data->WriteBit(haveFallData);
data->WriteBit(hasFallData);
data->WriteBit(!hasElevation);
data->WriteGuidMask<5>(Guid);
data->WriteBit(hasTransport);
data->WriteBit(false); // hasTimeStamp == true
data->WriteBit(!hasTimeStamp);
if (hasTransport)
{
ObjectGuid tGuid = unit->m_movementInfo.GetTransportGuid();
data->WriteGuidMask<1>(tGuid);
data->WriteBit(false); // hasTransportTime2 == false
data->WriteBit(hasTransportTime2);
data->WriteGuidMask<4, 0, 6>(tGuid);
data->WriteBit(false); // hasTransportTime3 == false
data->WriteBit(hasTransportTime3);
data->WriteGuidMask<7, 5, 3, 2>(tGuid);
}
data->WriteGuidMask<4>(Guid);
if (isSplineEnabled)
{
data->WriteBit(true); // writeBits == true
Movement::PacketBuilder::WriteCreateBits(*unit->movespline, *data);
}
data->WriteGuidMask<6>(Guid);
if (haveFallData)
if (hasFallData)
data->WriteBit(hasFallDirection);
data->WriteGuidMask<0, 1>(Guid);
data->WriteBit(false); // Unknown 4.3.3
data->WriteBit(!unit->m_movementInfo.GetMovementFlags2());
if(unit->m_movementInfo.GetMovementFlags2())
if (unit->m_movementInfo.GetMovementFlags2())
data->WriteBits(unit->m_movementInfo.GetMovementFlags2(), 12);
}
// used only with GO's, placeholder
if (updateFlags & UPDATEFLAG_POSITION)
{
Unit const* unit = (Unit const*)this;
ObjectGuid transGuid = unit->m_movementInfo.GetTransportGuid();
ObjectGuid transGuid;
data->WriteGuidMask<5>(transGuid);
data->WriteBit(false); // Has GO transport time 3 == false
data->WriteBit(hasTransportTime3);
data->WriteGuidMask<0, 3, 6, 1, 4, 2>(transGuid);
data->WriteBit(false); // Has GO transport time 2 == false
data->WriteBit(hasTransportTime2);
data->WriteGuidMask<7>(transGuid);
}
if (updateFlags & UPDATEFLAG_HAS_ATTACKING_TARGET)
{
ObjectGuid guid;
if (Unit *victim = ((Unit*)this)->getVictim())
if (Unit* victim = ((Unit*)this)->getVictim())
guid = victim->GetObjectGuid();
data->WriteGuidMask<2, 7, 0, 4, 5, 6, 1, 3>(guid);
@ -343,41 +380,32 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
{
Unit const* unit = (Unit const*)this;
bool hasTransport = unit->m_movementInfo.GetTransportGuid();
bool isSplineEnabled = unit->IsSplineEnabled();
bool hasPitch = ((unit->m_movementInfo.GetMovementFlags() & (MOVEFLAG_SWIMMING | MOVEFLAG_FLYING)) ||
(unit->m_movementInfo.GetMovementFlags2() & MOVEFLAG2_ALLOW_PITCHING));
bool hasFallData = unit->m_movementInfo.GetMovementFlags2() & MOVEFLAG2_INTERP_TURNING;
bool hasFallDirection = unit->m_movementInfo.GetMovementFlags() & MOVEFLAG_FALLING;
bool hasElevation = unit->m_movementInfo.GetMovementFlags() & MOVEFLAG_SPLINE_ELEVATION;
bool hasOrientation = GetTypeId() != TYPEID_ITEM && GetTypeId() != TYPEID_CONTAINER;
data->WriteGuidBytes<4>(Guid);
*data << unit->GetSpeed(MOVE_RUN_BACK);
*data << float(unit->GetSpeed(MOVE_RUN_BACK));
if (hasFallData)
{
if (hasFallDirection)
{
*data << (float)unit->m_movementInfo.GetJumpInfo().cosAngle;
*data << (float)unit->m_movementInfo.GetJumpInfo().xyspeed;
*data << (float)unit->m_movementInfo.GetJumpInfo().sinAngle;
*data << float(unit->m_movementInfo.GetJumpInfo().cosAngle);
*data << float(unit->m_movementInfo.GetJumpInfo().xyspeed);
*data << float(unit->m_movementInfo.GetJumpInfo().sinAngle);
}
*data << (uint32)unit->m_movementInfo.GetFallTime();
*data << (float)unit->m_movementInfo.GetJumpInfo().velocity;
*data << uint32(unit->m_movementInfo.GetFallTime());
*data << float(unit->m_movementInfo.GetJumpInfo().velocity);
}
*data << unit->GetSpeed(MOVE_SWIM_BACK);
*data << float(unit->GetSpeed(MOVE_SWIM_BACK));
if (hasElevation)
*data << unit->m_movementInfo.GetSplineElevation();
*data << float(unit->m_movementInfo.GetSplineElevation());
if (isSplineEnabled)
Movement::PacketBuilder::WriteCreateBytes(*unit->movespline, *data);
*data << unit->GetPositionZ();
*data << float(unit->GetPositionZ());
data->WriteGuidBytes<5>(Guid);
if (hasTransport)
@ -385,48 +413,48 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
ObjectGuid tGuid = unit->m_movementInfo.GetTransportGuid();
data->WriteGuidBytes<5, 7>(tGuid);
*data << unit->m_movementInfo.GetTransportTime();
*data << unit->m_movementInfo.GetTransportPos()->o;
*data << uint32(unit->m_movementInfo.GetTransportTime());
*data << float(unit->m_movementInfo.GetTransportPos()->o);
//if (hasTransportTime2)
// *data << uint32(...);
if (hasTransportTime2)
*data << uint32(unit->m_movementInfo.GetTransportTime2());
*data << unit->m_movementInfo.GetTransportPos()->y;
*data << unit->m_movementInfo.GetTransportPos()->x;
*data << float(unit->m_movementInfo.GetTransportPos()->y);
*data << float(unit->m_movementInfo.GetTransportPos()->x);
data->WriteGuidBytes<3>(tGuid);
*data << unit->m_movementInfo.GetTransportPos()->z;
*data << float(unit->m_movementInfo.GetTransportPos()->z);
data->WriteGuidBytes<0>(tGuid);
//if (hasTransportTime3)
// *data << uint32(...);
if (hasTransportTime3)
*data << uint32(unit->m_movementInfo.GetFallTime());
*data << unit->m_movementInfo.GetTransportSeat();
*data << int32(unit->m_movementInfo.GetTransportSeat());
data->WriteGuidBytes<1, 6, 2, 4>(tGuid);
}
*data << unit->GetPositionX();
*data << unit->GetSpeed(MOVE_PITCH_RATE);
*data << float(unit->GetPositionX());
*data << float(unit->GetSpeed(MOVE_PITCH_RATE));
data->WriteGuidBytes<3, 0>(Guid);
*data << unit->GetSpeed(MOVE_SWIM);
*data << unit->GetPositionY();
*data << float(unit->GetSpeed(MOVE_SWIM));
*data << float(unit->GetPositionY());
data->WriteGuidBytes<7, 1, 2>(Guid);
*data << unit->GetSpeed(MOVE_WALK);
*data << float(unit->GetSpeed(MOVE_WALK));
*data << uint32(WorldTimer::getMSTime());
*data << unit->GetSpeed(MOVE_FLIGHT_BACK);
*data << float(unit->GetSpeed(MOVE_FLIGHT_BACK));
data->WriteGuidBytes<6>(Guid);
*data << unit->GetSpeed(MOVE_TURN_RATE);
*data << float(unit->GetSpeed(MOVE_TURN_RATE));
if (hasOrientation)
*data << unit->GetOrientation();
*data << float(unit->GetOrientation());
*data << unit->GetSpeed(MOVE_RUN);
*data << float(unit->GetSpeed(MOVE_RUN));
if(hasPitch)
*data << unit->m_movementInfo.GetPitch();
if (hasPitch)
*data << float(unit->m_movementInfo.GetPitch());
*data << unit->GetSpeed(MOVE_FLIGHT);
*data << float(unit->GetSpeed(MOVE_FLIGHT));
}
if (updateFlags & UPDATEFLAG_VEHICLE)
@ -435,38 +463,59 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
*data << uint32(((Unit*)this)->GetVehicleInfo()->GetEntry()->m_ID); // vehicle id
}
// used only with GO's, placeholder
if (updateFlags & UPDATEFLAG_POSITION)
{
Unit const* unit = (Unit const*)this;
ObjectGuid transGuid = unit->m_movementInfo.GetTransportGuid();
ObjectGuid transGuid;
data->WriteGuidMask<0, 5>(transGuid);
//if (hasGoTransportTime3)
// *data << uint32(...);
if (hasTransportTime3)
*data << uint32(0);
data->WriteGuidMask<3>(transGuid);
*data << float(unit->m_movementInfo.GetTransportPos()->x);
*data << float(0.0f); // x offset
data->WriteGuidMask<4, 6, 1>(transGuid);
*data << uint32(unit->m_movementInfo.GetTransportTime());
*data << float(unit->m_movementInfo.GetTransportPos()->y);
*data << uint32(0); // transport time
*data << float(0.0f); // y offset
data->WriteGuidMask<2, 7>(transGuid);
*data << float(unit->m_movementInfo.GetTransportPos()->z);
*data << int8(unit->m_movementInfo.GetTransportSeat());
*data << float(unit->m_movementInfo.GetTransportPos()->o);
*data << float(0.0f); // z offset
*data << int8(-1); // transport seat
*data << float(0.0f); // o offset
//if (hasGoTransportTime2)
// *data << uint32(...);
if (hasTransportTime2)
*data << uint32(0);
}
if(updateFlags & UPDATEFLAG_ROTATION)
if (updateFlags & UPDATEFLAG_ROTATION)
*data << int64(((GameObject*)this)->GetPackedWorldRotation());
if (updateFlags & UPDATEFLAG_TRANSPORT_ARR)
{
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << uint8(0);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
*data << float(0.0f);
}
if (updateFlags & UPDATEFLAG_HAS_POSITION)
{
*data << ((WorldObject*)this)->GetOrientation();
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
*data << float(((WorldObject*)this)->GetOrientation());
*data << float(((WorldObject*)this)->GetPositionX());
*data << float(((WorldObject*)this)->GetPositionY());
*data << float(((WorldObject*)this)->GetPositionZ());
}
if (updateFlags & UPDATEFLAG_HAS_ATTACKING_TARGET)
@ -481,7 +530,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
//if (updateFlags & UPDATEFLAG_ANIM_KITS)
// *data << uint16(0) << uint16(0) << uint16(0);
if(updateFlags & UPDATEFLAG_TRANSPORT)
if (updateFlags & UPDATEFLAG_TRANSPORT)
*data << uint32(WorldTimer::getMSTime());
}

View file

@ -11320,5 +11320,5 @@ void Unit::DisableSpline()
bool Unit::IsSplineEnabled() const
{
return !movespline->Finalized();
return movespline->Initialized();
}

View file

@ -651,20 +651,20 @@ enum MovementFlags2
MOVEFLAG2_NONE = 0x0000,
MOVEFLAG2_NO_STRAFE = 0x0001,
MOVEFLAG2_NO_JUMPING = 0x0002,
MOVEFLAG2_UNK3 = 0x0004,
MOVEFLAG2_FULLSPEEDTURNING = 0x0008,
MOVEFLAG2_FULLSPEEDPITCHING = 0x0010,
MOVEFLAG2_ALLOW_PITCHING = 0x0020,
MOVEFLAG2_UNK4 = 0x0040,
MOVEFLAG2_UNK5 = 0x0080,
MOVEFLAG2_UNK6 = 0x0100, // transport related
MOVEFLAG2_UNK7 = 0x0200,
MOVEFLAG2_INTERP_MOVEMENT = 0x0400,
MOVEFLAG2_INTERP_TURNING = 0x0800,
MOVEFLAG2_INTERP_PITCHING = 0x1000,
MOVEFLAG2_UNK8 = 0x2000,
MOVEFLAG2_UNK9 = 0x4000,
MOVEFLAG2_UNK10 = 0x8000,
MOVEFLAG2_FULLSPEEDTURNING = 0x0004,
MOVEFLAG2_FULLSPEEDPITCHING = 0x0008,
MOVEFLAG2_ALLOW_PITCHING = 0x0010,
MOVEFLAG2_UNK4 = 0x0020,
MOVEFLAG2_UNK5 = 0x0040,
MOVEFLAG2_UNK6 = 0x0080, // transport related
MOVEFLAG2_UNK7 = 0x0100,
MOVEFLAG2_INTERP_MOVEMENT = 0x0200,
MOVEFLAG2_INTERP_TURNING = 0x0400,
MOVEFLAG2_INTERP_PITCHING = 0x0800,
MOVEFLAG2_UNK8 = 0x1000,
MOVEFLAG2_UNK9 = 0x2000,
MOVEFLAG2_UNK10 = 0x4000,
MOVEFLAG2_UNK11 = 0x8000,
MOVEFLAG2_INTERP_MASK = MOVEFLAG2_INTERP_MOVEMENT | MOVEFLAG2_INTERP_TURNING | MOVEFLAG2_INTERP_PITCHING
};
@ -682,6 +682,7 @@ class MovementInfo
void AddMovementFlag(MovementFlags f) { moveFlags |= f; }
void RemoveMovementFlag(MovementFlags f) { moveFlags &= ~f; }
bool HasMovementFlag(MovementFlags f) const { return moveFlags & f; }
bool HasMovementFlag2(MovementFlags2 f) const { return moveFlags2 & f; }
MovementFlags GetMovementFlags() const { return MovementFlags(moveFlags); }
void SetMovementFlags(MovementFlags f) { moveFlags = f; }
MovementFlags2 GetMovementFlags2() const { return MovementFlags2(moveFlags2); }
@ -713,6 +714,7 @@ class MovementInfo
Position const* GetTransportPos() const { return &t_pos; }
int8 GetTransportSeat() const { return t_seat; }
uint32 GetTransportTime() const { return t_time; }
uint32 GetTransportTime2() const { return t_time2; }
uint32 GetFallTime() const { return fallTime; }
void ChangeOrientation(float o) { pos.o = o; }
void ChangePosition(float x, float y, float z, float o) { pos.x = x; pos.y = y; pos.z = z; pos.o = o; }
@ -742,6 +744,7 @@ class MovementInfo
};
JumpInfo const& GetJumpInfo() const { return jump; }
StatusInfo const& GetStatusInfo() const { return si; }
float GetSplineElevation() const { return splineElevation; }
float GetPitch() const { return s_pitch; }

View file

@ -306,6 +306,8 @@ void FlightPathMovementGenerator::Reset(Player& player)
}
init.SetFirstPointId(GetCurrentNode());
init.SetFly();
init.SetSmooth();
init.SetWalk(true);
init.SetVelocity(PLAYER_FLIGHT_SPEED);
init.Launch();
}

View file

@ -56,7 +56,7 @@ namespace Movement
}
else
{
if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed | MoveSplineFlag::Falling))
if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed | MoveSplineFlag::Falling | MoveSplineFlag::Unknown0))
{
Vector3 hermite;
spline.evaluate_derivative(point_Idx, u, hermite);
@ -216,7 +216,7 @@ namespace Movement
// each vertex offset packed into 11 bytes
bool MoveSplineInitArgs::_checkPathBounds() const
{
if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size() > 2)
if (!(flags & MoveSplineFlag::Catmullrom) && path.size() > 2)
{
enum
{

View file

@ -37,7 +37,8 @@ namespace Movement
{
None = 0x00000000,
// x00-xF(first byte) used as animation Ids storage in pair with Animation flag
Unknown1 = 0x00000010, // NOT VERIFIED
Unknown0 = 0x00000008, // NOT VERIFIED
FallingSlow = 0x00000010,
Done = 0x00000020,
Falling = 0x00000040, // Affects elevation computation, can't be combined with Trajectory flag
No_Spline = 0x00000080,
@ -53,7 +54,7 @@ namespace Movement
Unknown3 = 0x00020000, // NOT VERIFIED
Unknown4 = 0x00040000, // NOT VERIFIED
OrientationInversed = 0x00080000,
Unknown5 = 0x00100000, // NOT VERIFIED
SmoothGroundPath = 0x00100000,
Walkmode = 0x00200000,
UncompressedPath = 0x00400000,
Unknown6 = 0x00800000, // NOT VERIFIED
@ -69,13 +70,11 @@ namespace Movement
// Masks
Mask_Final_Facing = Final_Point | Final_Target | Final_Angle,
// animation ids stored here, see AnimType enum, used with Animation flag
Mask_Animations = 0xF,
Mask_Animations = 0x7,
// flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
Mask_No_Monster_Move = Mask_Final_Facing | Mask_Animations | Done,
// CatmullRom interpolation mode used
Mask_CatmullRom = Catmullrom,
// Unused, not suported flags
Mask_Unused = No_Spline | Enter_Cycle | Frozen | UncompressedPath | Unknown1 | Unknown2 | Unknown3 | Unknown4 | Unknown5 | Unknown6 | Unknown7 | Unknown8 | Unknown9,
Mask_Unused = No_Spline | Enter_Cycle | Frozen | FallingSlow | Unknown2 | Unknown3 | Unknown4 | SmoothGroundPath | Unknown6 | Unknown7 | Unknown8 | Unknown9,
};
inline uint32& raw() { return (uint32&)*this;}
@ -87,7 +86,7 @@ namespace Movement
// Constant interface
bool isSmooth() const { return raw() & Mask_CatmullRom;}
bool isSmooth() const { return raw() & Catmullrom;}
bool isLinear() const { return !isSmooth();}
bool isFacing() const { return raw() & Mask_Final_Facing;}
@ -103,19 +102,19 @@ namespace Movement
void operator &= (uint32 f) { raw() &= f;}
void operator |= (uint32 f) { raw() |= f;}
void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Trajectory)) | Animation | anim;}
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation)) | Trajectory;}
void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Trajectory | FallingSlow)) | Animation | (anim & Mask_Animations);}
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation | FallingSlow)) | Trajectory;}
void EnableFalling() { raw() = (raw() & ~(Mask_Animations | Trajectory | Animation))| Falling;}
void EnableFlying() { raw() = (raw() & ~Catmullrom) | Flying; }
void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; }
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;}
void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;}
void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
void EnableCatmullRom() { raw() = (raw() & ~SmoothGroundPath) | Catmullrom | UncompressedPath; }
void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;}
void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;}
void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;}
void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
uint8 animId : 4;
bool unknown1 : 1;
uint8 animId : 3;
bool unknown0 : 1;
bool fallingSlow : 1;
bool done : 1;
bool falling : 1;
bool no_spline : 1;
@ -131,7 +130,7 @@ namespace Movement
bool unknown3 : 1;
bool unknown4 : 1;
bool orientationInversed : 1;
bool unknown5 : 1;
bool smoothGroundPath : 1;
bool walkmode : 1;
bool uncompressedPath : 1;
bool unknown6 : 1;

View file

@ -120,7 +120,7 @@ namespace Movement
Unit& unit;
};
inline void MoveSplineInit::SetFly() { args.flags.EnableFlying();}
inline void MoveSplineInit::SetFly() { args.flags.flying = true; }
inline void MoveSplineInit::SetWalk(bool enable) { args.flags.walkmode = enable;}
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}

View file

@ -137,7 +137,7 @@ namespace Movement
const Spline<int32>& spline = move_spline.spline;
MoveSplineFlag splineflags = move_spline.splineflags;
if (splineflags & MoveSplineFlag::Mask_CatmullRom)
if (splineflags & MoveSplineFlag::UncompressedPath)
{
if (splineflags.cyclic)
WriteCatmullRomCyclicPath(spline, data);
@ -150,6 +150,9 @@ namespace Movement
void PacketBuilder::WriteCreateBits(const MoveSpline& move_spline, ByteBuffer& data)
{
if (!data.WriteBit(!move_spline.Finalized()))
return;
MoveSplineFlag splineFlags = move_spline.splineflags;
uint32 nodes = move_spline.getPath().size();
bool hasSplineStartTime = move_spline.splineflags & (MoveSplineFlag::Trajectory | MoveSplineFlag::Animation);
@ -185,38 +188,41 @@ namespace Movement
void PacketBuilder::WriteCreateBytes(const MoveSpline& move_spline, ByteBuffer& data)
{
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 << move_spline.vertical_acceleration; // added in 3.1
data << move_spline.timePassed();
if (move_spline.splineflags & MoveSplineFlag::Final_Angle)
data << 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)
if (!move_spline.Finalized())
{
data << move_spline.getPath()[i].z;
data << move_spline.getPath()[i].x;
data << move_spline.getPath()[i].y;
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(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.splineflags & MoveSplineFlag::Final_Point)
data << move_spline.facing.f.x << move_spline.facing.f.z << move_spline.facing.f.y;
data << float(1.f);
data << move_spline.Duration();
if (hasSplineStartTime)
data << move_spline.effect_start_time; // added in 3.1
data << float(1.f);
if (!move_spline.isCyclic())
{
Vector3 dest = move_spline.FinalDestination();
@ -227,6 +233,6 @@ namespace Movement
else
data << Vector3::zero();
data << move_spline.GetId();
data << uint32(move_spline.GetId());
}
}

View file

@ -133,22 +133,24 @@ namespace Movement
STR(Safe_Fall), // 0x08000000, // Active Rogue Safe Fall Spell (Passive)
STR(Hover), // 0x10000000,
STR(Unknown11), // 0x20000000
STR(NoStrafe),
STR(NoJumping),
STR(Unk3),
STR(Fullspeedturning),
STR(Fullspeedpitching),
STR(Allow_Pitching),
STR(Unk4),
STR(Unk5),
STR(Unk6),
STR(Unk7),
STR(Interp_Move),
STR(Interp_Turning),
STR(Interp_Pitching),
STR(Unk8),
STR(Unk9),
STR(Unk10),
STR(None31), // 0x40000000
STR(None32), // 0x80000000
STR(NoStrafe), // 0x0001
STR(NoJumping), // 0x0002
STR(Unk3), // 0x0004
STR(Fullspeedturning), // 0x0008
STR(Fullspeedpitching), // 0x0010
STR(Allow_Pitching), // 0x0020
STR(Unk4), // 0x0040
STR(Unk5), // 0x0080
STR(Unk6), // 0x0100
STR(Interp_Move), // 0x0200
STR(Interp_Turning), // 0x0400
STR(Interp_Pitching), // 0x0800
STR(Unk8), // 0x1000
STR(Unk9), // 0x2000
STR(Unk10), // 0x4000
STR(Unk11), // 0x8000
};
const char* g_SplineFlag_names[32] =
@ -156,8 +158,8 @@ namespace Movement
STR(AnimBit1), // 0x00000001,
STR(AnimBit2), // 0x00000002,
STR(AnimBit3), // 0x00000004,
STR(AnimBit4), // 0x00000008,
STR(Unknown1), // 0x00000010,
STR(Unknown0), // 0x00000008,
STR(FallingSlow), // 0x00000010,
STR(Done), // 0x00000020,
STR(Falling), // 0x00000040, // Not Compartible With Trajectory Movement
STR(No_Spline), // 0x00000080,
@ -173,7 +175,7 @@ namespace Movement
STR(Unknown3), // 0x00020000,
STR(Unknown4), // 0x00040000,
STR(OrientationInversed), // 0x00080000, // Appears With Runmode Flag, Nodes ),// 1, Handles Orientation
STR(Unknown5), // 0x00100000
STR(SmoothGroundPath), // 0x00100000
STR(Walkmode), // 0x00200000,
STR(UncompressedPath), // 0x00400000
STR(Unknown6), // 0x00800000

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "0019"
#define REVISION_NR "0020"
#endif // __REVISION_NR_H__