mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
Core/Movement: reverted the spline segment length validation until he path generation generates proper segments
This commit is contained in:
@@ -186,7 +186,6 @@ void MoveSpline::Initialize(MoveSplineInitArgs const& args)
|
||||
time_passed = 0;
|
||||
vertical_acceleration = 0.f;
|
||||
effect_start_time = 0;
|
||||
splineIsFacingOnly = args.path.size() == 2 && args.flags & MoveSplineFlag::Mask_Final_Facing && ((args.path[1] - args.path[0]).length() < 0.1f);
|
||||
velocity = args.velocity;
|
||||
|
||||
// Check if its a stop spline
|
||||
@@ -213,7 +212,7 @@ void MoveSpline::Initialize(MoveSplineInitArgs const& args)
|
||||
|
||||
MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
|
||||
vertical_acceleration(0.f), initialOrientation(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0), velocity(0.f),
|
||||
onTransport(false), splineIsFacingOnly(false)
|
||||
onTransport(false)
|
||||
{
|
||||
splineflags.done = true;
|
||||
}
|
||||
@@ -245,21 +244,34 @@ bool MoveSplineInitArgs::Validate(Unit* unit) const
|
||||
CHECK(path.size() > 1);
|
||||
CHECK(velocity >= 0.01f);
|
||||
CHECK(time_perc >= 0.f && time_perc <= 1.f);
|
||||
CHECK(_checkPathLengths());
|
||||
//CHECK(_checkPathLengths());
|
||||
return true;
|
||||
#undef CHECK
|
||||
}
|
||||
|
||||
// check path lengths - why are we even starting such short movement?
|
||||
bool MoveSplineInitArgs::_checkPathLengths() const
|
||||
// MONSTER_MOVE packet format limitation for not CatmullRom movement:
|
||||
// each vertex offset packed into 11 bytes
|
||||
bool MoveSplineInitArgs::_checkPathBounds() const
|
||||
{
|
||||
if (path.size() > 2 || !(flags & MoveSplineFlag::Mask_Final_Facing))
|
||||
for (uint32 i = 0; i < path.size() - 1; ++i)
|
||||
if ((path[i + 1] - path[i]).length() < 0.1f)
|
||||
if (!(flags & MoveSplineFlag::Catmullrom) && path.size() > 2)
|
||||
{
|
||||
enum{
|
||||
MAX_OFFSET = (1 << 11) / 2
|
||||
};
|
||||
Vector3 middle = (path.front()+path.back()) / 2;
|
||||
Vector3 offset;
|
||||
for (uint32 i = 1; i < path.size()-1; ++i)
|
||||
{
|
||||
offset = path[i] - middle;
|
||||
if (std::fabs(offset.x) >= MAX_OFFSET || std::fabs(offset.y) >= MAX_OFFSET || std::fabs(offset.z) >= MAX_OFFSET)
|
||||
{
|
||||
TC_LOG_ERROR("misc", "MoveSplineInitArgs::_checkPathBounds check failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// ============================================================================================
|
||||
|
||||
MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff)
|
||||
|
||||
@@ -144,7 +144,6 @@ namespace Movement
|
||||
AnimationTier GetAnimation() const { return static_cast<AnimationTier>(splineflags.animId); }
|
||||
|
||||
bool onTransport;
|
||||
bool splineIsFacingOnly;
|
||||
std::string ToString() const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Movement
|
||||
bool Validate(Unit* unit) const;
|
||||
|
||||
private:
|
||||
bool _checkPathLengths() const;
|
||||
bool _checkPathBounds() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@ namespace Movement
|
||||
|
||||
void PacketBuilder::WriteCreateBits(MoveSpline const& moveSpline, ByteBuffer& data)
|
||||
{
|
||||
bool hasSplineMove = data.WriteBit(!moveSpline.Finalized() && !moveSpline.splineIsFacingOnly);
|
||||
if (!hasSplineMove)
|
||||
if (!data.WriteBit(!moveSpline.Finalized()))
|
||||
return;
|
||||
|
||||
data.WriteBits(uint8(moveSpline.spline.mode()), 2);
|
||||
@@ -75,8 +74,7 @@ namespace Movement
|
||||
|
||||
void PacketBuilder::WriteCreateData(MoveSpline const& moveSpline, ByteBuffer& data)
|
||||
{
|
||||
bool hasSplineMove = !moveSpline.Finalized() && !moveSpline.splineIsFacingOnly;
|
||||
if (hasSplineMove)
|
||||
if (!moveSpline.Finalized())
|
||||
{
|
||||
MoveSplineFlag const& splineFlags = moveSpline.splineflags;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user