diff options
Diffstat (limited to 'src')
11 files changed, 40 insertions, 27 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index c46fc0d91d5..de5d0a0303c 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -249,6 +249,7 @@ void Creature::RemoveCorpse(bool setSpawnTime) float x, y, z, o; GetRespawnPosition(x, y, z, &o); + o = MapManager::NormalizeOrientation(o); SetHomePosition(x, y, z, o); GetMap()->CreatureRelocation(this, x, y, z, o); } @@ -2464,6 +2465,7 @@ void Creature::SetPosition(float x, float y, float z, float o) return; } + o = MapManager::NormalizeOrientation(o); GetMap()->CreatureRelocation(ToCreature(), x, y, z, o); if (IsVehicle()) GetVehicleKit()->RelocatePassengers(x, y, z, o); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index f58e49b9e14..5f933bc6ca1 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -673,8 +673,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); } void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); } - void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); } - Position GetHomePosition() { return m_homePosition; } + void GetHomePosition(float &x, float &y, float &z, float &ori) const { m_homePosition.GetPosition(x, y, z, ori); } + Position GetHomePosition() const { return m_homePosition; } void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); } void SetTransportHomePosition(const Position &pos) { m_transportHomePosition.Relocate(pos); } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 00b98ce2cc1..a59dcd7d950 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -167,6 +167,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa ASSERT(map); SetMap(map); + ang = MapManager::NormalizeOrientation(ang); Relocate(x, y, z, ang); if (!IsPositionValid()) { diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 264672fc5c9..153dad8e447 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -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]); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index aa5c33d8c67..02a6f261e98 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -711,7 +711,7 @@ void Transport::UpdateNPCPositions() void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o) { float inx = x, iny = y, inz = z, ino = o; - o = GetOrientation() + ino; + o = MapManager::NormalizeOrientation(GetOrientation() + ino); x = GetPositionX() + (inx * cos(GetOrientation()) + iny * sin(GetOrientation() + M_PI)); y = GetPositionY() + (iny * cos(GetOrientation()) + inx * sin(GetOrientation())); z = GetPositionZ() + inz; @@ -720,7 +720,7 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& //! This method transforms supplied global coordinates into local offsets void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o) { - o -= GetOrientation(); + o = MapManager::NormalizeOrientation(o - GetOrientation()); z -= GetPositionZ(); y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o) x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index cedf38cb676..9ca0d23006c 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16257,20 +16257,20 @@ void Unit::SendMoveRoot(uint32 value) data.WriteBit(guid[4]); data.WriteBit(guid[1]); data.WriteBit(guid[3]); - + data.WriteByteSeq(guid[1]); data.WriteByteSeq(guid[0]); data.WriteByteSeq(guid[2]); data.WriteByteSeq(guid[5]); - + data << uint32(value); - - + + data.WriteByteSeq(guid[3]); data.WriteByteSeq(guid[4]); data.WriteByteSeq(guid[7]); data.WriteByteSeq(guid[6]); - + SendMessageToSet(&data, true); } @@ -16286,19 +16286,19 @@ void Unit::SendMoveUnroot(uint32 value) data.WriteBit(guid[2]); data.WriteBit(guid[4]); data.WriteBit(guid[6]); - + data.WriteByteSeq(guid[3]); data.WriteByteSeq(guid[6]); data.WriteByteSeq(guid[1]); - + data << uint32(value); - + data.WriteByteSeq(guid[2]); data.WriteByteSeq(guid[0]); data.WriteByteSeq(guid[7]); data.WriteByteSeq(guid[4]); data.WriteByteSeq(guid[5]); - + SendMessageToSet(&data, true); } @@ -17849,6 +17849,7 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel return false; } + orientation = MapManager::NormalizeOrientation(orientation); bool turn = (GetOrientation() != orientation); bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index de95b7d9842..7a0b97b90ef 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -711,6 +711,12 @@ enum MovementFlags MOVEMENTFLAG_MASK_MOVING_FLY = MOVEMENTFLAG_FLYING | MOVEMENTFLAG_ASCENDING | MOVEMENTFLAG_DESCENDING, + // Movement flags allowed for creature in CreateObject - we need to keep all other enabled serverside + // to properly calculate all movement + MOVEMENTFLAG_MASK_CREATURE_ALLOWED = + MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_ROOT | MOVEMENTFLAG_SWIMMING | + MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_WATERWALKING | MOVEMENTFLAG_FALLING_SLOW | MOVEMENTFLAG_HOVER, + //! TODO if needed: add more flags to this masks that are exclusive to players MOVEMENTFLAG_MASK_PLAYER_ONLY = MOVEMENTFLAG_FLYING, @@ -1407,7 +1413,7 @@ class Unit : public WorldObject MountCapabilityEntry const* GetMountCapability(uint32 mountType) const; void SendDurabilityLoss(Player* receiver, uint32 percent); - + uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } void DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb); uint32 DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true); diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 780b341f6f2..5b87d9c01b9 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -81,7 +81,7 @@ namespace Movement if (args.path.empty()) return; - // corrent first vertex + // correct first vertex args.path[0] = real_position; args.initialOrientation = real_position.orientation; @@ -114,7 +114,7 @@ namespace Movement } PacketBuilder::WriteMonsterMove(move_spline, data); - unit.SendMessageToSet(&data,true); + unit.SendMessageToSet(&data, true); } MoveSplineInit::MoveSplineInit(Unit& m) : unit(m) @@ -124,6 +124,7 @@ namespace Movement // mix existing state into new args.flags.walkmode = unit.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); args.flags.flying = unit.m_movementInfo.HasMovementFlag(MovementFlags(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY)); + args.flags.smoothGroundPath = true; // enabled by default, CatmullRom mode or client config "pathSmoothing" will disable this } void MoveSplineInit::SetFacing(const Unit * target) diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 19a250f7885..aab96a630fa 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -140,10 +140,9 @@ namespace Movement WriteLinearPath(spline, data); } - void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data, bool& fullData) + void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data) { - fullData = data.WriteBit(!moveSpline.Finalized()); - if (!fullData) + if (!data.WriteBit(!moveSpline.Finalized())) return; data.WriteBits(uint8(moveSpline.spline.mode()), 2); @@ -180,9 +179,9 @@ namespace Movement data.WriteBits(moveSpline.splineflags.raw(), 25); } - void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data, bool fullData) + void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data) { - if (fullData) + if (!moveSpline.Finalized()) { MoveSplineFlag splineFlags = moveSpline.splineflags; diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.h b/src/server/game/Movement/Spline/MovementPacketBuilder.h index 1b8506c5161..a6e4e4d5d04 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.h +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.h @@ -31,8 +31,8 @@ namespace Movement public: static void WriteMonsterMove(const MoveSpline& mov, WorldPacket& data); - static void WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data, bool& fullData); - static void WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data, bool fullData); + static void WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data); + static void WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data); }; } #endif // TRINITYSERVER_PACKET_BUILDER_H diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 0c5cb0aba52..479d234e27c 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -303,7 +303,7 @@ class npc_coldflame : public CreatureScript { Position const* ownerPos = marrowgarAI->GetLastColdflamePosition(); float ang = me->GetAngle(ownerPos) - static_cast<float>(M_PI); - MapManager::NormalizeOrientation(ang); + ang = MapManager::NormalizeOrientation(ang); me->SetOrientation(ang); owner->GetNearPosition(pos, 2.5f, 0.0f); } |