mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
Revert Visibility Notifier changes (#17682)
* Revert "fix(Core/Grid): Implement missing GridUnload setting (#17569)" This reverts commit79b39f9655. * Revert "fix(Core/Grid): Address bugs and performance issues introduced by visibility notifier implementation (#17480)" This reverts commit60e27511c5. * Revert "fix(Core): GridCleanUpDelay Log (#17436)" This reverts commit90b16ca065. * Revert "feat(Core/Grids): Implement visibility notifier (#15919)" This reverts commit2779833768.
This commit is contained in:
@@ -125,13 +125,14 @@ namespace Movement
|
||||
if (args.flags.cyclic)
|
||||
{
|
||||
uint32 cyclic_point = 0;
|
||||
if (splineflags.enter_cycle)
|
||||
cyclic_point = 1; // shouldn't be modified, came from client
|
||||
spline.init_cyclic_spline(&args.path[0], args.path.size(), modes[args.flags.isSmooth()], cyclic_point, args.initialOrientation);
|
||||
// MoveSplineFlag::Enter_Cycle support dropped
|
||||
//if (splineflags & SPLINEFLAG_ENTER_CYCLE)
|
||||
//cyclic_point = 1; // shouldn't be modified, came from client
|
||||
spline.init_cyclic_spline(&args.path[0], args.path.size(), modes[args.flags.isSmooth()], cyclic_point);
|
||||
}
|
||||
else
|
||||
{
|
||||
spline.init_spline(&args.path[0], args.path.size(), modes[args.flags.isSmooth()], args.initialOrientation);
|
||||
spline.init_spline(&args.path[0], args.path.size(), modes[args.flags.isSmooth()]);
|
||||
}
|
||||
|
||||
// init spline timestamps
|
||||
@@ -203,7 +204,7 @@ namespace Movement
|
||||
if (!(exp)) \
|
||||
{ \
|
||||
if (unit) \
|
||||
LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for GUID: {} Entry: {}", #exp, unit->GetGUID().ToString().c_str(), unit->GetEntry());\
|
||||
LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for {}", #exp, unit->GetGUID().ToString()); \
|
||||
else \
|
||||
LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for cyclic spline continuation", #exp); \
|
||||
return false;\
|
||||
@@ -272,41 +273,6 @@ namespace Movement
|
||||
point_Idx = spline.first();
|
||||
time_passed = time_passed % Duration();
|
||||
result = Movement::MoveSpline::UpdateResult(Result_NextCycle | Result_JustArrived);
|
||||
|
||||
// Remove first point from the path after one full cycle.
|
||||
// That point was the position of the unit prior to entering the cycle and it shouldn't be repeated with continuous cycles.
|
||||
if (splineflags.enter_cycle)
|
||||
{
|
||||
splineflags.enter_cycle = false;
|
||||
|
||||
MoveSplineInitArgs args{ (size_t)spline.getPointCount() };
|
||||
args.path.assign(spline.getPoints().begin() + spline.first() + 1, spline.getPoints().begin() + spline.last());
|
||||
args.facing = facing;
|
||||
args.flags = splineflags;
|
||||
args.path_Idx_offset = point_Idx_offset;
|
||||
// MoveSplineFlag::Parabolic | MoveSplineFlag::Animation not supported currently
|
||||
//args.parabolic_amplitude = ?;
|
||||
//args.time_perc = ?;
|
||||
args.splineId = m_Id;
|
||||
args.initialOrientation = initialOrientation;
|
||||
args.velocity = 1.0f; // Calculated below
|
||||
args.HasVelocity = true;
|
||||
args.TransformForTransport = onTransport;
|
||||
if (args.Validate(nullptr))
|
||||
{
|
||||
// New cycle should preserve previous cycle's duration for some weird reason, even though
|
||||
// the path is really different now. Blizzard is weird. Or this was just a simple oversight.
|
||||
// Since our splines precalculate length with velocity in mind, if we want to find the desired
|
||||
// velocity, we have to make a fake spline, calculate its duration and then compare it to the
|
||||
// desired duration, thus finding out how much the velocity has to be increased for them to match.
|
||||
MoveSpline tempSpline;
|
||||
tempSpline.Initialize(args);
|
||||
args.velocity = (float)tempSpline.Duration() / Duration();
|
||||
|
||||
if (args.Validate(nullptr))
|
||||
init_spline(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -87,7 +87,6 @@ namespace Movement
|
||||
// corrent first vertex
|
||||
args.path[0] = real_position;
|
||||
args.initialOrientation = real_position.orientation;
|
||||
args.flags.enter_cycle = args.flags.cyclic;
|
||||
move_spline.onTransport = transport;
|
||||
|
||||
uint32 moveFlags = unit->m_movementInfo.GetMovementFlags();
|
||||
|
||||
@@ -67,6 +67,10 @@ namespace Movement
|
||||
break;
|
||||
}
|
||||
|
||||
// add fake Enter_Cycle flag - needed for client-side cyclic movement (client will erase first spline vertex after first cycle done)
|
||||
// Xinef: this flag breaks cycle for ground movement, client teleports npc between last and first point instead of using smooth movement
|
||||
if (splineflags & MoveSplineFlag::Flying)
|
||||
splineflags.enter_cycle = move_spline.isCyclic();
|
||||
data << uint32(splineflags & uint32(~MoveSplineFlag::Mask_No_Monster_Move));
|
||||
|
||||
if (splineflags.animation)
|
||||
@@ -119,11 +123,20 @@ namespace Movement
|
||||
data.append<Vector3>(&spline.getPoint(2), count);
|
||||
}
|
||||
|
||||
void WriteCatmullRomCyclicPath(const Spline<int32>& spline, ByteBuffer& data)
|
||||
void WriteCatmullRomCyclicPath(const Spline<int32>& spline, ByteBuffer& data, bool flying)
|
||||
{
|
||||
uint32 count = spline.getPointCount() - 4;
|
||||
data << count;
|
||||
data.append<Vector3>(&spline.getPoint(2), count);
|
||||
uint32 count = spline.getPointCount() - 3;
|
||||
data << uint32(count + 1);
|
||||
if (flying)
|
||||
{
|
||||
data << spline.getPoint(1); // fake point, client will erase it from the spline after first cycle done
|
||||
data.append<Vector3>(&spline.getPoint(2), count);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.append<Vector3>(&spline.getPoint(2), count);
|
||||
data << Vector3::zero(); //Xinef: fake point
|
||||
}
|
||||
}
|
||||
|
||||
void PacketBuilder::WriteMonsterMove(const MoveSpline& move_spline, ByteBuffer& data)
|
||||
@@ -135,7 +148,7 @@ namespace Movement
|
||||
if (splineflags & MoveSplineFlag::Mask_CatmullRom)
|
||||
{
|
||||
if (splineflags.cyclic)
|
||||
WriteCatmullRomCyclicPath(spline, data);
|
||||
WriteCatmullRomCyclicPath(spline, data, splineflags & MoveSplineFlag::Flying);
|
||||
else
|
||||
WriteCatmullRomPath(spline, data);
|
||||
}
|
||||
@@ -186,8 +199,4 @@ namespace Movement
|
||||
data << (move_spline.isCyclic() ? Vector3::zero() : move_spline.FinalDestination());
|
||||
}
|
||||
}
|
||||
void PacketBuilder::WriteSplineSync(MoveSpline const& move_spline, ByteBuffer& data)
|
||||
{
|
||||
data << (float)move_spline.timePassed() / move_spline.Duration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace Movement
|
||||
static void WriteMonsterMove(const MoveSpline& mov, ByteBuffer& data);
|
||||
static void WriteStopMovement(Vector3 const& loc, uint32 splineId, ByteBuffer& data);
|
||||
static void WriteCreate(const MoveSpline& mov, ByteBuffer& data);
|
||||
static void WriteSplineSync(MoveSpline const& mov, ByteBuffer& data);
|
||||
};
|
||||
}
|
||||
#endif // AC_PACKET_BUILDER_H
|
||||
|
||||
@@ -199,25 +199,23 @@ namespace Movement
|
||||
return length;
|
||||
}
|
||||
|
||||
void SplineBase::init_spline(const Vector3* controls, index_type count, EvaluationMode m, float orientation)
|
||||
void SplineBase::init_spline(const Vector3* controls, index_type count, EvaluationMode m)
|
||||
{
|
||||
m_mode = m;
|
||||
cyclic = false;
|
||||
initialOrientation = orientation;
|
||||
|
||||
(this->*initializers[m_mode])(controls, count, 0);
|
||||
(this->*initializers[m_mode])(controls, count, cyclic, 0);
|
||||
}
|
||||
|
||||
void SplineBase::init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation)
|
||||
void SplineBase::init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point)
|
||||
{
|
||||
m_mode = m;
|
||||
cyclic = true;
|
||||
initialOrientation = orientation;
|
||||
|
||||
(this->*initializers[m_mode])(controls, count, cyclic_point);
|
||||
(this->*initializers[m_mode])(controls, count, cyclic, cyclic_point);
|
||||
}
|
||||
|
||||
void SplineBase::InitLinear(const Vector3* controls, index_type count, index_type cyclic_point)
|
||||
void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
|
||||
{
|
||||
ASSERT(count >= 2);
|
||||
const int real_size = count + 1;
|
||||
@@ -237,7 +235,7 @@ namespace Movement
|
||||
index_hi = cyclic ? count : (count - 1);
|
||||
}
|
||||
|
||||
void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, index_type cyclic_point)
|
||||
void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
|
||||
{
|
||||
const int real_size = count + (cyclic ? (1 + 2) : (1 + 1));
|
||||
|
||||
@@ -255,14 +253,14 @@ namespace Movement
|
||||
if (cyclic_point == 0)
|
||||
points[0] = controls[count - 1];
|
||||
else
|
||||
points[0] = controls[0] - G3D::Vector3{ std::cos(initialOrientation), std::sin(initialOrientation), 0.0f };
|
||||
points[0] = controls[0].lerp(controls[1], -1);
|
||||
|
||||
points[high_index + 1] = controls[cyclic_point];
|
||||
points[high_index + 2] = controls[cyclic_point + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
points[0] = controls[0] - G3D::Vector3{ std::cos(initialOrientation), std::sin(initialOrientation), 0.0f };
|
||||
points[0] = controls[0].lerp(controls[1], -1);
|
||||
points[high_index + 1] = controls[count - 1];
|
||||
}
|
||||
|
||||
@@ -270,7 +268,7 @@ namespace Movement
|
||||
index_hi = high_index + (cyclic ? 1 : 0);
|
||||
}
|
||||
|
||||
void SplineBase::InitBezier3(const Vector3* controls, index_type count, index_type /*cyclic_point*/)
|
||||
void SplineBase::InitBezier3(const Vector3* controls, index_type count, bool /*cyclic*/, index_type /*cyclic_point*/)
|
||||
{
|
||||
index_type c = count / 3u * 3u;
|
||||
index_type t = c / 3u;
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace Movement
|
||||
|
||||
uint8 m_mode{UninitializedMode};
|
||||
bool cyclic{false};
|
||||
float initialOrientation{0.f};
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -78,15 +77,15 @@ namespace Movement
|
||||
typedef float (SplineBase::*SegLenghtMethtod)(index_type) const;
|
||||
static SegLenghtMethtod seglengths[ModesEnd];
|
||||
|
||||
void InitLinear(const Vector3*, index_type, index_type);
|
||||
void InitCatmullRom(const Vector3*, index_type, index_type);
|
||||
void InitBezier3(const Vector3*, index_type, index_type);
|
||||
typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, index_type);
|
||||
void InitLinear(const Vector3*, index_type, bool, index_type);
|
||||
void InitCatmullRom(const Vector3*, index_type, bool, index_type);
|
||||
void InitBezier3(const Vector3*, index_type, bool, index_type);
|
||||
typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, bool, index_type);
|
||||
static InitMethtod initializers[ModesEnd];
|
||||
|
||||
void UninitializedSplineEvaluationMethod(index_type, float, Vector3&) const { ABORT(); }
|
||||
[[nodiscard]] float UninitializedSplineSegLenghtMethod(index_type) const { ABORT(); return 0.0f; }
|
||||
void UninitializedSplineInitMethod(Vector3 const*, index_type, index_type) { ABORT(); }
|
||||
[[nodiscard]] float UninitializedSplineSegLenghtMethod(index_type) const { ABORT(); }
|
||||
void UninitializedSplineInitMethod(Vector3 const*, index_type, bool, index_type) { ABORT(); }
|
||||
|
||||
public:
|
||||
explicit SplineBase() = default;
|
||||
@@ -117,8 +116,8 @@ namespace Movement
|
||||
[[nodiscard]] const Vector3& getPoint(index_type i) const { return points[i];}
|
||||
|
||||
/** Initializes spline. Don't call other methods while spline not initialized. */
|
||||
void init_spline(const Vector3* controls, index_type count, EvaluationMode m, float orientation);
|
||||
void init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation);
|
||||
void init_spline(const Vector3* controls, index_type count, EvaluationMode m);
|
||||
void init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point);
|
||||
|
||||
/** As i can see there are a lot of ways how spline can be initialized
|
||||
would be no harm to have some custom initializers. */
|
||||
@@ -171,8 +170,8 @@ namespace Movement
|
||||
void computeIndex(float t, index_type& out_idx, float& out_u) const;
|
||||
|
||||
/** Initializes spline. Don't call other methods while spline not initialized. */
|
||||
void init_spline(const Vector3* controls, index_type count, EvaluationMode m, float orientation = 0) { SplineBase::init_spline(controls, count, m, orientation);}
|
||||
void init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation = 0) { SplineBase::init_cyclic_spline(controls, count, m, cyclic_point, orientation);}
|
||||
void init_spline(const Vector3* controls, index_type count, EvaluationMode m) { SplineBase::init_spline(controls, count, m);}
|
||||
void init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point) { SplineBase::init_cyclic_spline(controls, count, m, cyclic_point);}
|
||||
|
||||
/** Initializes lengths with SplineBase::SegLength method. */
|
||||
void initLengths();
|
||||
@@ -198,12 +197,7 @@ namespace Movement
|
||||
}
|
||||
|
||||
/** Returns length of the whole spline. */
|
||||
[[nodiscard]] length_type length() const
|
||||
{
|
||||
if (lengths.empty())
|
||||
return 0;
|
||||
return lengths[index_hi];
|
||||
}
|
||||
[[nodiscard]] length_type length() const { return lengths[index_hi];}
|
||||
/** Returns length between given nodes. */
|
||||
[[nodiscard]] length_type length(index_type first, index_type last) const { return lengths[last] - lengths[first];}
|
||||
[[nodiscard]] length_type length(index_type Idx) const { return lengths[Idx];}
|
||||
|
||||
Reference in New Issue
Block a user