34 u = (time_point -
spline.
length(point_index)) / (
float)seg_time;
61 if (hermite.x != 0.f || hermite.y != 0.f)
114 el = std::max(z_now, final_z);
119 return SecToMS(length / velocity);
151 if (args.
flags.Cyclic)
176 TC_LOG_ERROR(
"misc",
"MoveSpline::init_spline: zero length spline, wrong input data?");
233 vertical_acceleration(0.f), initialOrientation(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0), velocity(0.f),
234 onTransport(false), splineIsFacingOnly(false)
243#define CHECK(exp, verbose) \
247 TC_LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for {}", #exp, verbose);\
249 TC_LOG_ERROR("misc.movesplineinitargs", "MoveSplineInitArgs::Validate: expression '{}' failed for cyclic spline continuation", #exp); \
268 constexpr float MIN_XY_OFFSET = -(1 << 11) / 4.0f;
269 constexpr float MIN_Z_OFFSET = -(1 << 10) / 4.0f;
272 constexpr float MAX_XY_OFFSET = (1 << 10) / 4.0f;
273 constexpr float MAX_Z_OFFSET = (1 << 9) / 4.0f;
275 auto isValidPackedXYOffset = [](
float coord) ->
bool {
return coord > MIN_XY_OFFSET && coord < MAX_XY_OFFSET; };
276 auto isValidPackedZOffset = [](
float coord) ->
bool {
return coord > MIN_Z_OFFSET && coord < MAX_Z_OFFSET; };
280 Vector3 middle = (
path.front() +
path.back()) / 2;
283 if ((
path[i + 1] -
path[i]).length() < 0.1f)
287 if (!
flags.UncompressedPath)
288 if (!isValidPackedXYOffset(middle.x -
path[i].x)
289 || !isValidPackedXYOffset(middle.y -
path[i].y)
290 || !isValidPackedZOffset(middle.z -
path[i].z))
291 flags.UncompressedPath =
true;
298parabolic_amplitude(0.f), vertical_acceleration(0.0f), effect_start_time_percent(0.f), effect_start_time(0ms),
299splineId(0), initialOrientation(0.f),
300walk(false), HasVelocity(false), TransformForTransport(true)
302 path.reserve(path_capacity);
322 ASSERT(minimal_diff >= 0);
324 ms_time_diff -= minimal_diff;
355 args.splineId =
m_Id;
357 args.velocity = 1.0f;
358 args.HasVelocity =
true;
360 if (args.Validate(
nullptr))
371 if (args.Validate(
nullptr))
390 std::stringstream str;
391 str <<
"MoveSpline" << std::endl;
392 str <<
"spline Id: " <<
GetId() << std::endl;
395 str <<
"facing angle: " <<
facing.
angle << std::endl;
400 str <<
"time passed: " <<
time_passed << std::endl;
401 str <<
"total time: " <<
Duration() << std::endl;
402 str <<
"spline point Id: " <<
point_Idx << std::endl;
DB2Storage< CurveEntry > sCurveStore("Curve.db2", &CurveLoadInfo::Instance)
std::string GetDebugInfo()
#define TC_LOG_ERROR(filterType__, message__,...)
#define CHECK(exp, verbose)
int32 next_timestamp() const
std::string ToString() const
UpdateResult _updateState(int32 &ms_time_diff)
============================================================================================
Location ComputePosition() const
void computeFallElevation(int32 time_point, float &el) const
Optional< AnimTierTransition > anim_tier
void Initialize(MoveSplineInitArgs const &)
int32 currentPathIdx() const
float vertical_acceleration
Vector3 const & FinalDestination() const
int32 segment_time_elapsed() const
void computeParabolicElevation(int32 time_point, float &el) const
MoveSplineFlag splineflags
void init_spline(MoveSplineInitArgs const &args)
Optional< SpellEffectExtraData > spell_effect_extra
Location computePosition(int32 time_point, int32 point_index) const
ControlArray const & getPoints() const
float SegLength(index_type i) const
Vector3 const & getPoint(index_type i) const
void init_cyclic_spline(const Vector3 *controls, index_type count, EvaluationMode m, index_type cyclic_point, float orientation=0.0f)
void init_spline(const Vector3 *controls, index_type count, EvaluationMode m, float orientation=0.0f)
std::string ToString() const
index_type getPointCount() const
void set_length(index_type i, length_type length)
length_type length() const
void evaluate_derivative(float t, Vector3 &hermite) const
void evaluate_percent(float t, Vector3 &c) const
std::string ToString() const
static ObjectGuid GetGUID(Object const *o)
std::string GetDebugInfo() const override
uint32 computeDuration(float length, float velocity)
float computeFallTime(float path_length, bool isSafeFall)
uint32 SecToMS(float sec)
float computeFallElevation(float t_passed, bool isSafeFall, float start_velocity=0.0f)
@ MONSTER_MOVE_FACING_TARGET
@ MONSTER_MOVE_FACING_ANGLE
@ MONSTER_MOVE_FACING_SPOT
CommonInitializer(float _velocity)
int32 operator()(Spline< int32 > &s, int32 i)
struct Movement::FacingInfo::@313 f
FallInitializer(float _start_elevation)
int32 operator()(Spline< int32 > &s, int32 i)
float effect_start_time_percent
float parabolic_amplitude
MoveSplineInitArgs(size_t path_capacity=16)
Optional< AnimTierTransition > animTier
Optional< SpellEffectExtraData > spellEffectExtra
bool Validate(Unit const *unit)
============================================================================================
Milliseconds effect_start_time
float vertical_acceleration
std::string ToString() const
constexpr bool isSmooth() const
constexpr bool HasFlag(MoveSplineFlagEnum f) const