mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Various Cleanups (movement/)
This commit is contained in:
parent
6379a746d7
commit
0d2bedadae
13 changed files with 1122 additions and 1113 deletions
|
|
@ -20,14 +20,15 @@
|
|||
#include <sstream>
|
||||
#include "Log.h"
|
||||
|
||||
namespace Movement{
|
||||
|
||||
extern float computeFallTime(float path_length, bool isSafeFall);
|
||||
extern float computeFallElevation(float time_passed, bool isSafeFall, float start_velocy);
|
||||
extern float computeFallElevation(float time_passed);
|
||||
|
||||
Location MoveSpline::ComputePosition() const
|
||||
namespace Movement
|
||||
{
|
||||
|
||||
extern float computeFallTime(float path_length, bool isSafeFall);
|
||||
extern float computeFallElevation(float time_passed, bool isSafeFall, float start_velocy);
|
||||
extern float computeFallElevation(float time_passed);
|
||||
|
||||
Location MoveSpline::ComputePosition() const
|
||||
{
|
||||
MANGOS_ASSERT(Initialized());
|
||||
|
||||
float u = 1.f;
|
||||
|
|
@ -66,10 +67,10 @@ Location MoveSpline::ComputePosition() const
|
|||
c.orientation = -c.orientation;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
void MoveSpline::computeParabolicElevation(float& el) const
|
||||
{
|
||||
void MoveSpline::computeParabolicElevation(float& el) const
|
||||
{
|
||||
if (time_passed > effect_start_time)
|
||||
{
|
||||
float t_passedf = MSToSec(time_passed - effect_start_time);
|
||||
|
|
@ -79,39 +80,40 @@ void MoveSpline::computeParabolicElevation(float& el) const
|
|||
//(dur * v3->z_acceleration * dt)/2 - (v3->z_acceleration * dt * dt)/2 + Z;
|
||||
el += (t_durationf - t_passedf) * 0.5f * vertical_acceleration * t_passedf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoveSpline::computeFallElevation(float& el) const
|
||||
{
|
||||
void MoveSpline::computeFallElevation(float& el) const
|
||||
{
|
||||
float z_now = spline.getPoint(spline.first()).z - Movement::computeFallElevation(MSToSec(time_passed));
|
||||
float final_z = FinalDestination().z;
|
||||
if (z_now < final_z)
|
||||
el = final_z;
|
||||
else
|
||||
el = z_now;
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32 computeDuration(float length, float velocity)
|
||||
{
|
||||
inline uint32 computeDuration(float length, float velocity)
|
||||
{
|
||||
return SecToMS(length / velocity);
|
||||
}
|
||||
}
|
||||
|
||||
struct FallInitializer
|
||||
{
|
||||
struct FallInitializer
|
||||
{
|
||||
FallInitializer(float _start_elevation) : start_elevation(_start_elevation) {}
|
||||
float start_elevation;
|
||||
inline int32 operator()(Spline<int32>& s, int32 i)
|
||||
{
|
||||
return Movement::computeFallTime(start_elevation - s.getPoint(i+1).z,false) * 1000.f;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
enum{
|
||||
enum
|
||||
{
|
||||
minimal_duration = 1,
|
||||
};
|
||||
};
|
||||
|
||||
struct CommonInitializer
|
||||
{
|
||||
struct CommonInitializer
|
||||
{
|
||||
CommonInitializer(float _velocity) : velocityInv(1000.f/_velocity), time(minimal_duration) {}
|
||||
float velocityInv;
|
||||
int32 time;
|
||||
|
|
@ -120,10 +122,10 @@ struct CommonInitializer
|
|||
time += (s.SegLength(i) * velocityInv);
|
||||
return time;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
void MoveSpline::init_spline(const MoveSplineInitArgs& args)
|
||||
{
|
||||
void MoveSpline::init_spline(const MoveSplineInitArgs& args)
|
||||
{
|
||||
const SplineBase::EvaluationMode modes[2] = {SplineBase::ModeLinear,SplineBase::ModeCatmullrom};
|
||||
if (args.flags.cyclic)
|
||||
{
|
||||
|
|
@ -157,10 +159,10 @@ void MoveSpline::init_spline(const MoveSplineInitArgs& args)
|
|||
spline.set_length(spline.last(), spline.isCyclic() ? 1000 : 1);
|
||||
}
|
||||
point_Idx = spline.first();
|
||||
}
|
||||
}
|
||||
|
||||
void MoveSpline::Initialize(const MoveSplineInitArgs& args)
|
||||
{
|
||||
void MoveSpline::Initialize(const MoveSplineInitArgs& args)
|
||||
{
|
||||
splineflags = args.flags;
|
||||
facing = args.facing;
|
||||
m_Id = args.splineId;
|
||||
|
|
@ -184,18 +186,18 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args)
|
|||
vertical_acceleration = args.parabolic_amplitude * 8.f / (f_duration * f_duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
|
||||
MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
|
||||
vertical_acceleration(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0), initialOrientation(0.f)
|
||||
{
|
||||
{
|
||||
splineflags.done = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// ============================================================================================
|
||||
|
||||
bool MoveSplineInitArgs::Validate() const
|
||||
{
|
||||
bool MoveSplineInitArgs::Validate() const
|
||||
{
|
||||
#define CHECK(exp) \
|
||||
if (!(exp))\
|
||||
{\
|
||||
|
|
@ -208,15 +210,16 @@ bool MoveSplineInitArgs::Validate() const
|
|||
//CHECK(_checkPathBounds());
|
||||
return true;
|
||||
#undef CHECK
|
||||
}
|
||||
}
|
||||
|
||||
// MONSTER_MOVE packet format limitation for not CatmullRom movement:
|
||||
// each vertex offset packed into 11 bytes
|
||||
bool MoveSplineInitArgs::_checkPathBounds() const
|
||||
{
|
||||
bool MoveSplineInitArgs::_checkPathBounds() const
|
||||
{
|
||||
if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size() > 2)
|
||||
{
|
||||
enum{
|
||||
enum
|
||||
{
|
||||
MAX_OFFSET = (1 << 11) / 2,
|
||||
};
|
||||
Vector3 middle = (path.front()+path.back()) / 2;
|
||||
|
|
@ -232,12 +235,12 @@ bool MoveSplineInitArgs::_checkPathBounds() const
|
|||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// ============================================================================================
|
||||
|
||||
MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff)
|
||||
{
|
||||
MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff)
|
||||
{
|
||||
if (Finalized())
|
||||
{
|
||||
ms_time_diff = 0;
|
||||
|
|
@ -276,10 +279,10 @@ MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff)
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
std::string MoveSpline::ToString() const
|
||||
{
|
||||
std::string MoveSpline::ToString() const
|
||||
{
|
||||
std::stringstream str;
|
||||
str << "MoveSpline" << std::endl;
|
||||
str << "spline Id: " << GetId() << std::endl;
|
||||
|
|
@ -288,7 +291,7 @@ std::string MoveSpline::ToString() const
|
|||
str << "facing angle: " << facing.angle;
|
||||
else if (splineflags.final_target)
|
||||
str << "facing target: " << facing.target;
|
||||
else if(splineflags.final_point)
|
||||
else if (splineflags.final_point)
|
||||
str << "facing point: " << facing.f.x << " " << facing.f.y << " " << facing.f.z;
|
||||
str << std::endl;
|
||||
str << "time passed: " << time_passed << std::endl;
|
||||
|
|
@ -297,20 +300,20 @@ std::string MoveSpline::ToString() const
|
|||
str << "path point Id: " << currentPathIdx() << std::endl;
|
||||
str << spline.ToString();
|
||||
return str.str();
|
||||
}
|
||||
}
|
||||
|
||||
void MoveSpline::_Finalize()
|
||||
{
|
||||
void MoveSpline::_Finalize()
|
||||
{
|
||||
splineflags.done = true;
|
||||
point_Idx = spline.last() - 1;
|
||||
time_passed = Duration();
|
||||
}
|
||||
}
|
||||
|
||||
int32 MoveSpline::currentPathIdx() const
|
||||
{
|
||||
int32 MoveSpline::currentPathIdx() const
|
||||
{
|
||||
int32 point = point_Idx_offset + point_Idx - spline.first() + (int)Finalized();
|
||||
if (isCyclic())
|
||||
point = point % (spline.last()-spline.first());
|
||||
return point;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ namespace Movement
|
|||
{
|
||||
public:
|
||||
typedef Spline<int32> MySpline;
|
||||
enum UpdateResult{
|
||||
enum UpdateResult
|
||||
{
|
||||
Result_None = 0x01,
|
||||
Result_Arrived = 0x02,
|
||||
Result_NextCycle = 0x04,
|
||||
|
|
@ -99,14 +100,14 @@ namespace Movement
|
|||
MANGOS_ASSERT(Initialized());
|
||||
do
|
||||
handler(_updateState(difftime));
|
||||
while(difftime > 0);
|
||||
while (difftime > 0);
|
||||
}
|
||||
|
||||
void updateState(int32 difftime)
|
||||
{
|
||||
MANGOS_ASSERT(Initialized());
|
||||
do _updateState(difftime);
|
||||
while(difftime > 0);
|
||||
while (difftime > 0);
|
||||
}
|
||||
|
||||
Location ComputePosition() const;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ namespace Movement
|
|||
class MoveSplineFlag
|
||||
{
|
||||
public:
|
||||
enum eFlags{
|
||||
enum eFlags
|
||||
{
|
||||
None = 0x00000000,
|
||||
// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
|
||||
Done = 0x00000100,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Movement
|
|||
{
|
||||
if (moveFlags & MOVEFLAG_FLYING)
|
||||
{
|
||||
if ( moveFlags & MOVEFLAG_BACKWARD /*&& speed_obj.flight >= speed_obj.flight_back*/ )
|
||||
if (moveFlags & MOVEFLAG_BACKWARD /*&& speed_obj.flight >= speed_obj.flight_back*/)
|
||||
return MOVE_FLIGHT_BACK;
|
||||
else
|
||||
return MOVE_FLIGHT;
|
||||
|
|
@ -102,7 +102,7 @@ namespace Movement
|
|||
args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEFLAG_FLYING|MOVEFLAG_LEVITATING));
|
||||
}
|
||||
|
||||
void MoveSplineInit::SetFacing(const Unit * target)
|
||||
void MoveSplineInit::SetFacing(const Unit* target)
|
||||
{
|
||||
args.flags.EnableFacingTarget();
|
||||
args.facing.target = target->GetObjectGuid().GetRawValue();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Movement
|
|||
*/
|
||||
void SetFacing(float angle);
|
||||
void SetFacing(Vector3 const& point);
|
||||
void SetFacing(const Unit * target);
|
||||
void SetFacing(const Unit* target);
|
||||
|
||||
/* Initializes movement by path
|
||||
* @param path - array of points, shouldn't be empty
|
||||
|
|
@ -125,7 +125,7 @@ namespace Movement
|
|||
inline void MoveSplineInit::SetSmooth() { args.flags.EnableCatmullRom();}
|
||||
inline void MoveSplineInit::SetCyclic() { args.flags.cyclic = true;}
|
||||
inline void MoveSplineInit::SetFall() { args.flags.EnableFalling();}
|
||||
inline void MoveSplineInit::SetVelocity(float vel){ args.velocity = vel;}
|
||||
inline void MoveSplineInit::SetVelocity(float vel) { args.velocity = vel;}
|
||||
inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;}
|
||||
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ namespace Movement
|
|||
|
||||
inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
|
||||
{
|
||||
if(generatePath)
|
||||
if (generatePath)
|
||||
{
|
||||
PathFinder path(&unit);
|
||||
path.calculate(dest.x, dest.y, dest.z, forceDestination);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@ namespace Movement
|
|||
|
||||
union FacingInfo
|
||||
{
|
||||
struct{
|
||||
struct
|
||||
{
|
||||
float x,y,z;
|
||||
}f;
|
||||
} f;
|
||||
uint64 target;
|
||||
float angle;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Movement
|
|||
data << move_spline.spline.getPoint(move_spline.spline.first());
|
||||
data << move_spline.GetId();
|
||||
|
||||
switch(splineflags & MoveSplineFlag::Mask_Final_Facing)
|
||||
switch (splineflags & MoveSplineFlag::Mask_Final_Facing)
|
||||
{
|
||||
default:
|
||||
data << uint8(MonsterMoveNormal);
|
||||
|
|
@ -97,7 +97,7 @@ namespace Movement
|
|||
void WriteLinearPath(const Spline<int32>& spline, ByteBuffer& data)
|
||||
{
|
||||
uint32 last_idx = spline.getPointCount() - 3;
|
||||
const Vector3 * real_path = &spline.getPoint(1);
|
||||
const Vector3* real_path = &spline.getPoint(1);
|
||||
|
||||
data << last_idx;
|
||||
data << real_path[last_idx]; // destination
|
||||
|
|
@ -106,7 +106,7 @@ namespace Movement
|
|||
Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
|
||||
Vector3 offset;
|
||||
// first and last points already appended
|
||||
for(uint32 i = 1; i < last_idx; ++i)
|
||||
for (uint32 i = 1; i < last_idx; ++i)
|
||||
{
|
||||
offset = middle - real_path[i];
|
||||
data.appendPackXYZ(offset.x, offset.y, offset.z);
|
||||
|
|
@ -164,7 +164,7 @@ namespace Movement
|
|||
{
|
||||
data << move_spline.facing.target;
|
||||
}
|
||||
else if(splineFlags.final_point)
|
||||
else if (splineFlags.final_point)
|
||||
{
|
||||
data << move_spline.facing.f.x << move_spline.facing.f.y << move_spline.facing.f.z;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,60 +20,61 @@
|
|||
#include <sstream>
|
||||
#include <G3D/Matrix4.h>
|
||||
|
||||
namespace Movement{
|
||||
|
||||
SplineBase::EvaluationMethtod SplineBase::evaluators[SplineBase::ModesEnd] =
|
||||
namespace Movement
|
||||
{
|
||||
|
||||
SplineBase::EvaluationMethtod SplineBase::evaluators[SplineBase::ModesEnd] =
|
||||
{
|
||||
&SplineBase::EvaluateLinear,
|
||||
&SplineBase::EvaluateCatmullRom,
|
||||
&SplineBase::EvaluateBezier3,
|
||||
(EvaluationMethtod)&SplineBase::UninitializedSpline,
|
||||
};
|
||||
(EvaluationMethtod)& SplineBase::UninitializedSpline,
|
||||
};
|
||||
|
||||
SplineBase::EvaluationMethtod SplineBase::derivative_evaluators[SplineBase::ModesEnd] =
|
||||
{
|
||||
SplineBase::EvaluationMethtod SplineBase::derivative_evaluators[SplineBase::ModesEnd] =
|
||||
{
|
||||
&SplineBase::EvaluateDerivativeLinear,
|
||||
&SplineBase::EvaluateDerivativeCatmullRom,
|
||||
&SplineBase::EvaluateDerivativeBezier3,
|
||||
(EvaluationMethtod)&SplineBase::UninitializedSpline,
|
||||
};
|
||||
(EvaluationMethtod)& SplineBase::UninitializedSpline,
|
||||
};
|
||||
|
||||
SplineBase::SegLenghtMethtod SplineBase::seglengths[SplineBase::ModesEnd] =
|
||||
{
|
||||
SplineBase::SegLenghtMethtod SplineBase::seglengths[SplineBase::ModesEnd] =
|
||||
{
|
||||
&SplineBase::SegLengthLinear,
|
||||
&SplineBase::SegLengthCatmullRom,
|
||||
&SplineBase::SegLengthBezier3,
|
||||
(SegLenghtMethtod)&SplineBase::UninitializedSpline,
|
||||
};
|
||||
(SegLenghtMethtod)& SplineBase::UninitializedSpline,
|
||||
};
|
||||
|
||||
SplineBase::InitMethtod SplineBase::initializers[SplineBase::ModesEnd] =
|
||||
{
|
||||
SplineBase::InitMethtod SplineBase::initializers[SplineBase::ModesEnd] =
|
||||
{
|
||||
//&SplineBase::InitLinear,
|
||||
&SplineBase::InitCatmullRom, // we should use catmullrom initializer even for linear mode! (client's internal structure limitation)
|
||||
&SplineBase::InitCatmullRom,
|
||||
&SplineBase::InitBezier3,
|
||||
(InitMethtod)&SplineBase::UninitializedSpline,
|
||||
};
|
||||
(InitMethtod)& SplineBase::UninitializedSpline,
|
||||
};
|
||||
|
||||
///////////
|
||||
#pragma region evaluation methtods
|
||||
#pragma region evaluation methtods
|
||||
|
||||
using G3D::Matrix4;
|
||||
static const Matrix4 s_catmullRomCoeffs(
|
||||
using G3D::Matrix4;
|
||||
static const Matrix4 s_catmullRomCoeffs(
|
||||
-0.5f, 1.5f,-1.5f, 0.5f,
|
||||
1.f, -2.5f, 2.f, -0.5f,
|
||||
-0.5f, 0.f, 0.5f, 0.f,
|
||||
0.f, 1.f, 0.f, 0.f);
|
||||
|
||||
static const Matrix4 s_Bezier3Coeffs(
|
||||
static const Matrix4 s_Bezier3Coeffs(
|
||||
-1.f, 3.f, -3.f, 1.f,
|
||||
3.f, -6.f, 3.f, 0.f,
|
||||
-3.f, 3.f, 0.f, 0.f,
|
||||
1.f, 0.f, 0.f, 0.f);
|
||||
|
||||
/* classic view:
|
||||
inline void C_Evaluate(const Vector3 *vertice, float t, const float (&matrix)[4][4], Vector3 &position)
|
||||
{
|
||||
/* classic view:
|
||||
inline void C_Evaluate(const Vector3 *vertice, float t, const float (&matrix)[4][4], Vector3 &position)
|
||||
{
|
||||
Vector3 tvec(t*t*t, t*t, t);
|
||||
int i = 0;
|
||||
double c;
|
||||
|
|
@ -93,76 +94,76 @@ inline void C_Evaluate(const Vector3 *vertice, float t, const float (&matrix)[4]
|
|||
position.x = x;
|
||||
position.y = y;
|
||||
position.z = z;
|
||||
}*/
|
||||
}*/
|
||||
|
||||
inline void C_Evaluate(const Vector3 *vertice, float t, const Matrix4& matr, Vector3 &result)
|
||||
{
|
||||
inline void C_Evaluate(const Vector3* vertice, float t, const Matrix4& matr, Vector3& result)
|
||||
{
|
||||
Vector4 tvec(t*t*t, t*t, t, 1.f);
|
||||
Vector4 weights(tvec * matr);
|
||||
|
||||
result = vertice[0] * weights[0] + vertice[1] * weights[1]
|
||||
+ vertice[2] * weights[2] + vertice[3] * weights[3];
|
||||
}
|
||||
}
|
||||
|
||||
inline void C_Evaluate_Derivative(const Vector3 *vertice, float t, const Matrix4& matr, Vector3 &result)
|
||||
{
|
||||
inline void C_Evaluate_Derivative(const Vector3* vertice, float t, const Matrix4& matr, Vector3& result)
|
||||
{
|
||||
Vector4 tvec(3.f*t*t, 2.f*t, 1.f, 0.f);
|
||||
Vector4 weights(tvec * matr);
|
||||
|
||||
result = vertice[0] * weights[0] + vertice[1] * weights[1]
|
||||
+ vertice[2] * weights[2] + vertice[3] * weights[3];
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::EvaluateLinear(index_type index, float u, Vector3& result) const
|
||||
{
|
||||
void SplineBase::EvaluateLinear(index_type index, float u, Vector3& result) const
|
||||
{
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
result = points[index] + (points[index+1] - points[index]) * u;
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::EvaluateCatmullRom( index_type index, float t, Vector3& result) const
|
||||
{
|
||||
void SplineBase::EvaluateCatmullRom(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
C_Evaluate(&points[index - 1], t, s_catmullRomCoeffs, result);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::EvaluateBezier3(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
void SplineBase::EvaluateBezier3(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
index *= 3u;
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
C_Evaluate(&points[index], t, s_Bezier3Coeffs, result);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::EvaluateDerivativeLinear(index_type index, float, Vector3& result) const
|
||||
{
|
||||
void SplineBase::EvaluateDerivativeLinear(index_type index, float, Vector3& result) const
|
||||
{
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
result = points[index+1] - points[index];
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::EvaluateDerivativeCatmullRom(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
void SplineBase::EvaluateDerivativeCatmullRom(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
C_Evaluate_Derivative(&points[index - 1], t, s_catmullRomCoeffs, result);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::EvaluateDerivativeBezier3(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
void SplineBase::EvaluateDerivativeBezier3(index_type index, float t, Vector3& result) const
|
||||
{
|
||||
index *= 3u;
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
C_Evaluate_Derivative(&points[index], t, s_Bezier3Coeffs, result);
|
||||
}
|
||||
}
|
||||
|
||||
float SplineBase::SegLengthLinear(index_type index) const
|
||||
{
|
||||
float SplineBase::SegLengthLinear(index_type index) const
|
||||
{
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
return (points[index] - points[index+1]).length();
|
||||
}
|
||||
}
|
||||
|
||||
float SplineBase::SegLengthCatmullRom( index_type index ) const
|
||||
{
|
||||
float SplineBase::SegLengthCatmullRom(index_type index) const
|
||||
{
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
|
||||
Vector3 curPos, nextPos;
|
||||
const Vector3 * p = &points[index - 1];
|
||||
const Vector3* p = &points[index - 1];
|
||||
curPos = nextPos = p[1];
|
||||
|
||||
index_type i = 1;
|
||||
|
|
@ -175,15 +176,15 @@ float SplineBase::SegLengthCatmullRom( index_type index ) const
|
|||
++i;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
float SplineBase::SegLengthBezier3(index_type index) const
|
||||
{
|
||||
float SplineBase::SegLengthBezier3(index_type index) const
|
||||
{
|
||||
index *= 3u;
|
||||
MANGOS_ASSERT(index >= index_lo && index < index_hi);
|
||||
|
||||
Vector3 curPos, nextPos;
|
||||
const Vector3 * p = &points[index];
|
||||
const Vector3* p = &points[index];
|
||||
|
||||
C_Evaluate(p, 0.f, s_Bezier3Coeffs, nextPos);
|
||||
curPos = nextPos;
|
||||
|
|
@ -198,27 +199,27 @@ float SplineBase::SegLengthBezier3(index_type index) const
|
|||
++i;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
#pragma endregion
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
void SplineBase::init_spline(const Vector3 * controls, index_type count, EvaluationMode m)
|
||||
{
|
||||
void SplineBase::init_spline(const Vector3* controls, index_type count, EvaluationMode m)
|
||||
{
|
||||
m_mode = m;
|
||||
cyclic = false;
|
||||
|
||||
(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)
|
||||
{
|
||||
void SplineBase::init_cyclic_spline(const Vector3* controls, index_type count, EvaluationMode m, index_type cyclic_point)
|
||||
{
|
||||
m_mode = m;
|
||||
cyclic = true;
|
||||
|
||||
(this->*initializers[m_mode])(controls, count, cyclic, cyclic_point);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
|
||||
{
|
||||
void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
|
||||
{
|
||||
MANGOS_ASSERT(count >= 2);
|
||||
const int real_size = count + 1;
|
||||
|
||||
|
|
@ -235,10 +236,10 @@ void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cycl
|
|||
|
||||
index_lo = 0;
|
||||
index_hi = cyclic ? count : (count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool cyclic, 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));
|
||||
|
||||
points.resize(real_size);
|
||||
|
|
@ -268,10 +269,10 @@ void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool
|
|||
|
||||
index_lo = lo_index;
|
||||
index_hi = high_index + (cyclic ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::InitBezier3(const Vector3* controls, index_type count, bool /*cyclic*/, 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;
|
||||
|
||||
|
|
@ -281,19 +282,19 @@ void SplineBase::InitBezier3(const Vector3* controls, index_type count, bool /*c
|
|||
index_lo = 0;
|
||||
index_hi = t-1;
|
||||
//mov_assert(points.size() % 3 == 0);
|
||||
}
|
||||
}
|
||||
|
||||
void SplineBase::clear()
|
||||
{
|
||||
void SplineBase::clear()
|
||||
{
|
||||
index_lo = 0;
|
||||
index_hi = 0;
|
||||
points.clear();
|
||||
}
|
||||
}
|
||||
|
||||
std::string SplineBase::ToString() const
|
||||
{
|
||||
std::string SplineBase::ToString() const
|
||||
{
|
||||
std::stringstream str;
|
||||
const char * mode_str[ModesEnd] = {"Linear", "CatmullRom", "Bezier3", "Uninitialized"};
|
||||
const char* mode_str[ModesEnd] = {"Linear", "CatmullRom", "Bezier3", "Uninitialized"};
|
||||
|
||||
index_type count = this->points.size();
|
||||
str << "mode: " << mode_str[mode()] << std::endl;
|
||||
|
|
@ -302,6 +303,6 @@ std::string SplineBase::ToString() const
|
|||
str << "point " << i << " : " << points[i].toString() << std::endl;
|
||||
|
||||
return str.str();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@
|
|||
#include "typedefs.h"
|
||||
#include <G3D/Vector3.h>
|
||||
|
||||
namespace Movement {
|
||||
|
||||
class SplineBase
|
||||
namespace Movement
|
||||
{
|
||||
public:
|
||||
|
||||
class SplineBase
|
||||
{
|
||||
public:
|
||||
typedef int index_type;
|
||||
typedef std::vector<Vector3> ControlArray;
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ public:
|
|||
ModesEnd
|
||||
};
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ControlArray points;
|
||||
|
||||
index_type index_lo;
|
||||
|
|
@ -48,7 +49,8 @@ protected:
|
|||
uint8 m_mode;
|
||||
bool cyclic;
|
||||
|
||||
enum{
|
||||
enum
|
||||
{
|
||||
// could be modified, affects segment length evaluation precision
|
||||
// lesser value saves more performance in cost of lover precision
|
||||
// minimal value is 1
|
||||
|
|
@ -57,7 +59,7 @@ protected:
|
|||
};
|
||||
static_assert(STEPS_PER_SEGMENT > 0, "shouldn't be lesser than 1");
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void EvaluateLinear(index_type, float, Vector3&) const;
|
||||
void EvaluateCatmullRom(index_type, float, Vector3&) const;
|
||||
void EvaluateBezier3(index_type, float, Vector3&) const;
|
||||
|
|
@ -72,7 +74,7 @@ protected:
|
|||
float SegLengthLinear(index_type) const;
|
||||
float SegLengthCatmullRom(index_type) const;
|
||||
float SegLengthBezier3(index_type) const;
|
||||
typedef float (SplineBase::*SegLenghtMethtod)(index_type) const;
|
||||
typedef float(SplineBase::*SegLenghtMethtod)(index_type) const;
|
||||
static SegLenghtMethtod seglengths[ModesEnd];
|
||||
|
||||
void InitLinear(const Vector3*, index_type, bool, index_type);
|
||||
|
|
@ -83,7 +85,7 @@ protected:
|
|||
|
||||
void UninitializedSpline() const { MANGOS_ASSERT(false);}
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
explicit SplineBase() : index_lo(0), index_hi(0), m_mode(UninitializedMode), cyclic(false) {}
|
||||
|
||||
|
|
@ -112,8 +114,8 @@ public:
|
|||
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);
|
||||
void init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point);
|
||||
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. */
|
||||
|
|
@ -128,26 +130,26 @@ public:
|
|||
float SegLength(index_type i) const { return (this->*seglengths[m_mode])(i);}
|
||||
|
||||
std::string ToString() const;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename length_type>
|
||||
class Spline : public SplineBase
|
||||
{
|
||||
public:
|
||||
template<typename length_type>
|
||||
class Spline : public SplineBase
|
||||
{
|
||||
public:
|
||||
typedef length_type LengthType;
|
||||
typedef std::vector<length_type> LengthArray;
|
||||
protected:
|
||||
protected:
|
||||
|
||||
LengthArray lengths;
|
||||
|
||||
index_type computeIndexInBounds(length_type length) const;
|
||||
public:
|
||||
public:
|
||||
|
||||
explicit Spline(){}
|
||||
explicit Spline() {}
|
||||
|
||||
/** Calculates the position for given t
|
||||
@param t - percent of spline's length, assumes that t in range [0, 1]. */
|
||||
void evaluate_percent(float t, Vector3 & c) const;
|
||||
void evaluate_percent(float t, Vector3& c) const;
|
||||
|
||||
/** Calculates derivation for given t
|
||||
@param t - percent of spline's length, assumes that t in range [0, 1]. */
|
||||
|
|
@ -168,8 +170,8 @@ public:
|
|||
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) { 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);}
|
||||
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();
|
||||
|
|
@ -181,7 +183,7 @@ public:
|
|||
index_type i = index_lo;
|
||||
lengths.resize(index_hi+1);
|
||||
length_type prev_length = 0, new_length = 0;
|
||||
while(i < index_hi)
|
||||
while (i < index_hi)
|
||||
{
|
||||
new_length = cacher(*this, i);
|
||||
lengths[++i] = new_length;
|
||||
|
|
@ -199,7 +201,7 @@ public:
|
|||
|
||||
void set_length(index_type i, length_type length) { lengths[i] = length;}
|
||||
void clear();
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,26 +18,26 @@
|
|||
|
||||
namespace Movement
|
||||
{
|
||||
template<typename length_type> void Spline<length_type>::evaluate_percent( float t, Vector3 & c ) const
|
||||
{
|
||||
template<typename length_type> void Spline<length_type>::evaluate_percent(float t, Vector3& c) const
|
||||
{
|
||||
index_type Index;
|
||||
float u;
|
||||
computeIndex(t, Index, u);
|
||||
evaluate_percent(Index, u, c);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename length_type> void Spline<length_type>::evaluate_derivative(float t, Vector3& hermite) const
|
||||
{
|
||||
template<typename length_type> void Spline<length_type>::evaluate_derivative(float t, Vector3& hermite) const
|
||||
{
|
||||
index_type Index;
|
||||
float u;
|
||||
computeIndex(t, Index, u);
|
||||
evaluate_derivative(Index, u, hermite);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename length_type> SplineBase::index_type Spline<length_type>::computeIndexInBounds(length_type length_) const
|
||||
{
|
||||
template<typename length_type> SplineBase::index_type Spline<length_type>::computeIndexInBounds(length_type length_) const
|
||||
{
|
||||
// Temporary disabled: causes infinite loop with t = 1.f
|
||||
/*
|
||||
/*
|
||||
index_type hi = index_hi;
|
||||
index_type lo = index_lo;
|
||||
|
||||
|
|
@ -59,39 +59,39 @@ template<typename length_type> SplineBase::index_type Spline<length_type>::compu
|
|||
++i;
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename length_type> void Spline<length_type>::computeIndex(float t, index_type& index, float& u) const
|
||||
{
|
||||
template<typename length_type> void Spline<length_type>::computeIndex(float t, index_type& index, float& u) const
|
||||
{
|
||||
MANGOS_ASSERT(t >= 0.f && t <= 1.f);
|
||||
length_type length_ = t * length();
|
||||
index = computeIndexInBounds(length_);
|
||||
MANGOS_ASSERT(index < index_hi);
|
||||
u = (length_ - length(index)) / (float)length(index, index+1);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename length_type> SplineBase::index_type Spline<length_type>::computeIndexInBounds( float t ) const
|
||||
{
|
||||
template<typename length_type> SplineBase::index_type Spline<length_type>::computeIndexInBounds(float t) const
|
||||
{
|
||||
MANGOS_ASSERT(t >= 0.f && t <= 1.f);
|
||||
return computeIndexInBounds(t * length());
|
||||
}
|
||||
}
|
||||
|
||||
template<typename length_type> void Spline<length_type>::initLengths()
|
||||
{
|
||||
template<typename length_type> void Spline<length_type>::initLengths()
|
||||
{
|
||||
index_type i = index_lo;
|
||||
length_type length = 0;
|
||||
lengths.resize(index_hi+1);
|
||||
while(i < index_hi )
|
||||
while (i < index_hi)
|
||||
{
|
||||
length += SegLength(i);
|
||||
lengths[++i] = length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename length_type> void Spline<length_type>::clear()
|
||||
{
|
||||
template<typename length_type> void Spline<length_type>::clear()
|
||||
{
|
||||
SplineBase::clear();
|
||||
lengths.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ namespace Movement
|
|||
}
|
||||
|
||||
#ifndef static_assert
|
||||
#define CONCAT(x, y) CONCAT1 (x, y)
|
||||
#define CONCAT1(x, y) x##y
|
||||
#define static_assert(expr, msg) typedef char CONCAT(static_assert_failed_at_line_, __LINE__) [(expr) ? 1 : -1]
|
||||
#define CONCAT(x, y) CONCAT1 (x, y)
|
||||
#define CONCAT1(x, y) x##y
|
||||
#define static_assert(expr, msg) typedef char CONCAT(static_assert_failed_at_line_, __LINE__) [(expr) ? 1 : -1]
|
||||
#endif
|
||||
|
||||
template<class T, T limit>
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ namespace Movement
|
|||
float terminalVelocity = 60.148003f;
|
||||
float terminalSavefallVelocity = 7.f;
|
||||
|
||||
const float terminal_length = float(terminalVelocity * terminalVelocity) / (2.f * gravity);
|
||||
const float terminal_savefall_length = (terminalSavefallVelocity * terminalSavefallVelocity) / (2.f * gravity);
|
||||
const float terminal_length = float(terminalVelocity* terminalVelocity) / (2.f* gravity);
|
||||
const float terminal_savefall_length = (terminalSavefallVelocity* terminalSavefallVelocity) / (2.f* gravity);
|
||||
const float terminalFallTime = float(terminalVelocity/gravity); // the time that needed to reach terminalVelocity
|
||||
|
||||
float computeFallTime(float path_length, bool isSafeFall)
|
||||
|
|
@ -38,7 +38,7 @@ namespace Movement
|
|||
return 0.f;
|
||||
|
||||
float time;
|
||||
if ( isSafeFall )
|
||||
if (isSafeFall)
|
||||
{
|
||||
if (path_length >= terminal_savefall_length)
|
||||
time = (path_length - terminal_savefall_length)/terminalSavefallVelocity + terminalSavefallVelocity/gravity;
|
||||
|
|
@ -61,17 +61,17 @@ namespace Movement
|
|||
float termVel;
|
||||
float result;
|
||||
|
||||
if ( isSafeFall )
|
||||
if (isSafeFall)
|
||||
termVel = terminalSavefallVelocity;
|
||||
else
|
||||
termVel = terminalVelocity;
|
||||
|
||||
if ( start_velocity > termVel )
|
||||
if (start_velocity > termVel)
|
||||
start_velocity = termVel;
|
||||
|
||||
float terminal_time = terminalFallTime - start_velocity / gravity; // the time that needed to reach terminalVelocity
|
||||
|
||||
if ( t_passed > terminal_time )
|
||||
if (t_passed > terminal_time)
|
||||
{
|
||||
result = terminalVelocity*(t_passed - terminal_time) +
|
||||
start_velocity*terminal_time + gravity*terminal_time*terminal_time*0.5f;
|
||||
|
|
@ -98,95 +98,95 @@ namespace Movement
|
|||
return result;
|
||||
}
|
||||
|
||||
#define STR(x) #x
|
||||
#define STR(x) #x
|
||||
|
||||
const char * g_MovementFlag_names[]=
|
||||
const char* g_MovementFlag_names[]=
|
||||
{
|
||||
STR(Forward ),// 0x00000001,
|
||||
STR(Backward ),// 0x00000002,
|
||||
STR(Strafe_Left ),// 0x00000004,
|
||||
STR(Strafe_Right ),// 0x00000008,
|
||||
STR(Turn_Left ),// 0x00000010,
|
||||
STR(Turn_Right ),// 0x00000020,
|
||||
STR(Pitch_Up ),// 0x00000040,
|
||||
STR(Pitch_Down ),// 0x00000080,
|
||||
STR(Forward), // 0x00000001,
|
||||
STR(Backward), // 0x00000002,
|
||||
STR(Strafe_Left), // 0x00000004,
|
||||
STR(Strafe_Right), // 0x00000008,
|
||||
STR(Turn_Left), // 0x00000010,
|
||||
STR(Turn_Right), // 0x00000020,
|
||||
STR(Pitch_Up), // 0x00000040,
|
||||
STR(Pitch_Down), // 0x00000080,
|
||||
|
||||
STR(Walk ),// 0x00000100, // Walking
|
||||
STR(Ontransport ),// 0x00000200,
|
||||
STR(Levitation ),// 0x00000400,
|
||||
STR(Root ),// 0x00000800,
|
||||
STR(Falling ),// 0x00001000,
|
||||
STR(Fallingfar ),// 0x00002000,
|
||||
STR(Pendingstop ),// 0x00004000,
|
||||
STR(PendingSTRafestop ),// 0x00008000,
|
||||
STR(Pendingforward ),// 0x00010000,
|
||||
STR(Pendingbackward ),// 0x00020000,
|
||||
STR(PendingSTRafeleft ),// 0x00040000,
|
||||
STR(PendingSTRaferight ),// 0x00080000,
|
||||
STR(Pendingroot ),// 0x00100000,
|
||||
STR(Swimming ),// 0x00200000, // Appears With Fly Flag Also
|
||||
STR(Ascending ),// 0x00400000, // Swim Up Also
|
||||
STR(Descending ),// 0x00800000, // Swim Down Also
|
||||
STR(Can_Fly ),// 0x01000000, // Can Fly In 3.3?
|
||||
STR(Flying ),// 0x02000000, // Actual Flying Mode
|
||||
STR(Spline_Elevation ),// 0x04000000, // Used For Flight Paths
|
||||
STR(Spline_Enabled ),// 0x08000000, // Used For Flight Paths
|
||||
STR(Waterwalking ),// 0x10000000, // Prevent Unit From Falling Through Water
|
||||
STR(Safe_Fall ),// 0x20000000, // Active Rogue Safe Fall Spell (Passive)
|
||||
STR(Hover ),// 0x40000000
|
||||
STR(Unknown13 ),// 0x80000000
|
||||
STR(Unk1 ),
|
||||
STR(Unk2 ),
|
||||
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(Walk), // 0x00000100, // Walking
|
||||
STR(Ontransport), // 0x00000200,
|
||||
STR(Levitation), // 0x00000400,
|
||||
STR(Root), // 0x00000800,
|
||||
STR(Falling), // 0x00001000,
|
||||
STR(Fallingfar), // 0x00002000,
|
||||
STR(Pendingstop), // 0x00004000,
|
||||
STR(PendingSTRafestop), // 0x00008000,
|
||||
STR(Pendingforward), // 0x00010000,
|
||||
STR(Pendingbackward), // 0x00020000,
|
||||
STR(PendingSTRafeleft), // 0x00040000,
|
||||
STR(PendingSTRaferight), // 0x00080000,
|
||||
STR(Pendingroot), // 0x00100000,
|
||||
STR(Swimming), // 0x00200000, // Appears With Fly Flag Also
|
||||
STR(Ascending), // 0x00400000, // Swim Up Also
|
||||
STR(Descending), // 0x00800000, // Swim Down Also
|
||||
STR(Can_Fly), // 0x01000000, // Can Fly In 3.3?
|
||||
STR(Flying), // 0x02000000, // Actual Flying Mode
|
||||
STR(Spline_Elevation), // 0x04000000, // Used For Flight Paths
|
||||
STR(Spline_Enabled), // 0x08000000, // Used For Flight Paths
|
||||
STR(Waterwalking), // 0x10000000, // Prevent Unit From Falling Through Water
|
||||
STR(Safe_Fall), // 0x20000000, // Active Rogue Safe Fall Spell (Passive)
|
||||
STR(Hover), // 0x40000000
|
||||
STR(Unknown13), // 0x80000000
|
||||
STR(Unk1),
|
||||
STR(Unk2),
|
||||
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),
|
||||
};
|
||||
|
||||
const char * g_SplineFlag_names[32]=
|
||||
const char* g_SplineFlag_names[32]=
|
||||
{
|
||||
STR(AnimBit1 ),// 0x00000001,
|
||||
STR(AnimBit2 ),// 0x00000002,
|
||||
STR(AnimBit3 ),// 0x00000004,
|
||||
STR(AnimBit4 ),// 0x00000008,
|
||||
STR(AnimBit5 ),// 0x00000010,
|
||||
STR(AnimBit6 ),// 0x00000020,
|
||||
STR(AnimBit7 ),// 0x00000040,
|
||||
STR(AnimBit8 ),// 0x00000080,
|
||||
STR(Done ),// 0x00000100,
|
||||
STR(Falling ),// 0x00000200, // Not Compartible With Trajectory Movement
|
||||
STR(No_Spline ),// 0x00000400,
|
||||
STR(Trajectory ),// 0x00000800, // Not Compartible With Fall Movement
|
||||
STR(Walkmode ),// 0x00001000,
|
||||
STR(Flying ),// 0x00002000, // Smooth Movement(Catmullrom Interpolation Mode), Flying Animation
|
||||
STR(Knockback ),// 0x00004000, // Model Orientation Fixed
|
||||
STR(Final_Point ),// 0x00008000,
|
||||
STR(Final_Target ),// 0x00010000,
|
||||
STR(Final_Angle ),// 0x00020000,
|
||||
STR(Catmullrom ),// 0x00040000, // Used Catmullrom Interpolation Mode
|
||||
STR(Cyclic ),// 0x00080000, // Movement By Cycled Spline
|
||||
STR(Enter_Cycle ),// 0x00100000, // Everytime Appears With Cyclic Flag In Monster Move Packet
|
||||
STR(Animation ),// 0x00200000, // Animationid (0...3), Uint32 Time, Not Compartible With Trajectory And Fall Movement
|
||||
STR(Unknown4 ),// 0x00400000, // Disables Movement By Path
|
||||
STR(Unknown5 ),// 0x00800000,
|
||||
STR(Unknown6 ),// 0x01000000,
|
||||
STR(Unknown7 ),// 0x02000000,
|
||||
STR(Unknown8 ),// 0x04000000,
|
||||
STR(OrientationInversed ),// 0x08000000, // Appears With Runmode Flag, Nodes ),// 1, Handles Orientation
|
||||
STR(Unknown10 ),// 0x10000000,
|
||||
STR(Unknown11 ),// 0x20000000,
|
||||
STR(Unknown12 ),// 0x40000000,
|
||||
STR(Unknown13 ),// 0x80000000,
|
||||
STR(AnimBit1), // 0x00000001,
|
||||
STR(AnimBit2), // 0x00000002,
|
||||
STR(AnimBit3), // 0x00000004,
|
||||
STR(AnimBit4), // 0x00000008,
|
||||
STR(AnimBit5), // 0x00000010,
|
||||
STR(AnimBit6), // 0x00000020,
|
||||
STR(AnimBit7), // 0x00000040,
|
||||
STR(AnimBit8), // 0x00000080,
|
||||
STR(Done), // 0x00000100,
|
||||
STR(Falling), // 0x00000200, // Not Compartible With Trajectory Movement
|
||||
STR(No_Spline), // 0x00000400,
|
||||
STR(Trajectory), // 0x00000800, // Not Compartible With Fall Movement
|
||||
STR(Walkmode), // 0x00001000,
|
||||
STR(Flying), // 0x00002000, // Smooth Movement(Catmullrom Interpolation Mode), Flying Animation
|
||||
STR(Knockback), // 0x00004000, // Model Orientation Fixed
|
||||
STR(Final_Point), // 0x00008000,
|
||||
STR(Final_Target), // 0x00010000,
|
||||
STR(Final_Angle), // 0x00020000,
|
||||
STR(Catmullrom), // 0x00040000, // Used Catmullrom Interpolation Mode
|
||||
STR(Cyclic), // 0x00080000, // Movement By Cycled Spline
|
||||
STR(Enter_Cycle), // 0x00100000, // Everytime Appears With Cyclic Flag In Monster Move Packet
|
||||
STR(Animation), // 0x00200000, // Animationid (0...3), Uint32 Time, Not Compartible With Trajectory And Fall Movement
|
||||
STR(Unknown4), // 0x00400000, // Disables Movement By Path
|
||||
STR(Unknown5), // 0x00800000,
|
||||
STR(Unknown6), // 0x01000000,
|
||||
STR(Unknown7), // 0x02000000,
|
||||
STR(Unknown8), // 0x04000000,
|
||||
STR(OrientationInversed), // 0x08000000, // Appears With Runmode Flag, Nodes ),// 1, Handles Orientation
|
||||
STR(Unknown10), // 0x10000000,
|
||||
STR(Unknown11), // 0x20000000,
|
||||
STR(Unknown12), // 0x40000000,
|
||||
STR(Unknown13), // 0x80000000,
|
||||
};
|
||||
|
||||
template<class Flags, int N>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue