mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11820] implement OrientationFixed splineflag, correct OrientationInversed flag meaning. Add possibility to play landing, liftoff animation at arrive. Thanks to TOM_RUS for AnimType research
This commit is contained in:
parent
d62061f423
commit
59f8716542
10 changed files with 64 additions and 34 deletions
|
|
@ -46,7 +46,6 @@
|
|||
#include "GridNotifiersImpl.h"
|
||||
#include "CellImpl.h"
|
||||
#include "movement/MoveSplineInit.h"
|
||||
#include "movement/MoveSpline.h"
|
||||
|
||||
// apply implementation of the singletons
|
||||
#include "Policies/SingletonImp.h"
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float horizontalSpeed, fl
|
|||
{
|
||||
Movement::MoveSplineInit init(*m_owner);
|
||||
init.MoveTo(x,y,z);
|
||||
init.SetParabolic(max_height,0,false);
|
||||
init.SetParabolic(max_height,0);
|
||||
init.SetVelocity(horizontalSpeed);
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id));
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ Location MoveSpline::ComputePosition() const
|
|||
if (seg_time > 0)
|
||||
u = (time_passed - spline.length(point_Idx)) / (float)seg_time;
|
||||
Location c;
|
||||
c.orientation = initialOrientation;
|
||||
spline.evaluate_percent(point_Idx, u, c);
|
||||
|
||||
if (splineflags.animation)
|
||||
|
|
@ -54,11 +55,14 @@ Location MoveSpline::ComputePosition() const
|
|||
}
|
||||
else
|
||||
{
|
||||
Vector3 hermite;
|
||||
spline.evaluate_derivative(point_Idx,u,hermite);
|
||||
c.orientation = atan2(hermite.y, hermite.x);
|
||||
if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed|MoveSplineFlag::Falling))
|
||||
{
|
||||
Vector3 hermite;
|
||||
spline.evaluate_derivative(point_Idx,u,hermite);
|
||||
c.orientation = atan2(hermite.y, hermite.x);
|
||||
}
|
||||
|
||||
if (splineflags.backward)
|
||||
if (splineflags.orientationInversed)
|
||||
c.orientation = -c.orientation;
|
||||
}
|
||||
return c;
|
||||
|
|
@ -161,6 +165,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args)
|
|||
facing = args.facing;
|
||||
m_Id = args.splineId;
|
||||
point_Idx_offset = args.path_Idx_offset;
|
||||
initialOrientation = args.initialOrientation;
|
||||
|
||||
time_passed = 0;
|
||||
vertical_acceleration = 0.f;
|
||||
|
|
@ -182,7 +187,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args)
|
|||
}
|
||||
|
||||
MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
|
||||
vertical_acceleration(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0)
|
||||
vertical_acceleration(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0), initialOrientation(0.f)
|
||||
{
|
||||
splineflags.done = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace Movement
|
|||
//float duration_mod;
|
||||
//float duration_mod_next;
|
||||
float vertical_acceleration;
|
||||
float initialOrientation;
|
||||
int32 effect_start_time;
|
||||
int32 point_Idx;
|
||||
int32 point_Idx_offset;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Movement
|
|||
Parabolic = 0x00000800, // Affects elevation computation, can't be combined with Falling flag
|
||||
Walkmode = 0x00001000,
|
||||
Flying = 0x00002000, // Smooth movement(Catmullrom interpolation mode), flying animation
|
||||
Knockback = 0x00004000, // Model orientation fixed
|
||||
OrientationFixed = 0x00004000, // Model orientation fixed
|
||||
Final_Point = 0x00008000,
|
||||
Final_Target = 0x00010000,
|
||||
Final_Angle = 0x00020000,
|
||||
|
|
@ -55,7 +55,7 @@ namespace Movement
|
|||
Unknown6 = 0x01000000,
|
||||
Unknown7 = 0x02000000,
|
||||
Unknown8 = 0x04000000,
|
||||
Backward = 0x08000000,
|
||||
OrientationInversed = 0x08000000,
|
||||
Unknown10 = 0x10000000,
|
||||
Unknown11 = 0x20000000,
|
||||
Unknown12 = 0x40000000,
|
||||
|
|
@ -88,6 +88,7 @@ namespace Movement
|
|||
|
||||
uint8 getAnimationId() const { return animId;}
|
||||
bool hasAllFlags(uint32 f) const { return (raw() & f) == f;}
|
||||
bool hasFlag(uint32 f) const { return (raw() & f) != 0;}
|
||||
uint32 operator & (uint32 f) const { return (raw() & f);}
|
||||
uint32 operator | (uint32 f) const { return (raw() | f);}
|
||||
std::string ToString() const;
|
||||
|
|
@ -97,9 +98,9 @@ namespace Movement
|
|||
void operator &= (uint32 f) { raw() &= f;}
|
||||
void operator |= (uint32 f) { raw() |= f;}
|
||||
|
||||
void EnableAnimation(uint8 anim) { raw() = raw() & ~(Mask_Animations|Falling|Parabolic|Knockback) | Animation|anim;}
|
||||
void EnableAnimation(uint8 anim) { raw() = raw() & ~(Mask_Animations|Falling|Parabolic) | Animation|anim;}
|
||||
void EnableParabolic() { raw() = raw() & ~(Mask_Animations|Falling|Animation) | Parabolic;}
|
||||
void EnableFalling() { raw() = raw() & ~(Mask_Animations|Parabolic|Knockback|Animation) | Falling;}
|
||||
void EnableFalling() { raw() = raw() & ~(Mask_Animations|Parabolic|Animation) | Falling;}
|
||||
void EnableFlying() { raw() = raw() & ~Catmullrom | Flying; }
|
||||
void EnableCatmullRom() { raw() = raw() & ~Flying | Catmullrom; }
|
||||
void EnableFacingPoint() { raw() = raw() & ~Mask_Final_Facing | Final_Point;}
|
||||
|
|
@ -113,7 +114,7 @@ namespace Movement
|
|||
bool parabolic : 1;
|
||||
bool walkmode : 1;
|
||||
bool flying : 1;
|
||||
bool knockback : 1;
|
||||
bool orientationFixed : 1;
|
||||
bool final_point : 1;
|
||||
bool final_target : 1;
|
||||
bool final_angle : 1;
|
||||
|
|
@ -126,7 +127,7 @@ namespace Movement
|
|||
bool unknown6 : 1;
|
||||
bool unknown7 : 1;
|
||||
bool unknown8 : 1;
|
||||
bool backward : 1;
|
||||
bool orientationInversed : 1;
|
||||
bool unknown10 : 1;
|
||||
bool unknown11 : 1;
|
||||
bool unknown12 : 1;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Movement
|
|||
{
|
||||
MoveSpline& move_spline = *unit.movespline;
|
||||
|
||||
Vector3 real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZ());
|
||||
Location real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZ(),unit.GetOrientation());
|
||||
// there is a big chane that current position is unknown if current state is not finalized, need compute it
|
||||
// this also allows calculate spline position and update map position in much greater intervals
|
||||
if (!move_spline.Finalized())
|
||||
|
|
@ -68,6 +68,8 @@ namespace Movement
|
|||
|
||||
// corrent first vertex
|
||||
args.path[0] = real_position;
|
||||
args.initialOrientation = real_position.orientation;
|
||||
|
||||
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
|
||||
if (args.flags.walkmode)
|
||||
moveFlags |= MOVEFLAG_WALK_MODE;
|
||||
|
|
@ -103,4 +105,10 @@ namespace Movement
|
|||
args.flags.EnableFacingTarget();
|
||||
args.facing.target = target->GetObjectGuid().GetRawValue();
|
||||
}
|
||||
|
||||
void MoveSplineInit::SetFacing(float angle)
|
||||
{
|
||||
args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi());
|
||||
args.flags.EnableFacingAngle();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,14 @@ class Unit;
|
|||
|
||||
namespace Movement
|
||||
{
|
||||
enum AnimType
|
||||
{
|
||||
ToGround = 0, // 460 = ToGround, index of AnimationData.dbc
|
||||
FlyToFly = 1, // 461 = FlyToFly?
|
||||
ToFly = 2, // 458 = ToFly
|
||||
FlyToGround = 3, // 463 = FlyToGround
|
||||
};
|
||||
|
||||
/* Initializes and launches spline movement
|
||||
*/
|
||||
class MANGOS_DLL_SPEC MoveSplineInit
|
||||
|
|
@ -42,7 +50,11 @@ namespace Movement
|
|||
* @param start_time - delay between movement starting time and beginning to move by parabolic trajectory
|
||||
* can't be combined with final animation
|
||||
*/
|
||||
void SetParabolic(float amplitude, float start_time, bool is_knockback = false);
|
||||
void SetParabolic(float amplitude, float start_time);
|
||||
/* Plays animation after movement done
|
||||
* can't be combined with parabolic movement
|
||||
*/
|
||||
void SetAnimation(AnimType anim);
|
||||
|
||||
/* Adds final facing animation
|
||||
* sets unit's facing to specified point/angle after all path done
|
||||
|
|
@ -84,9 +96,12 @@ namespace Movement
|
|||
/* Enables falling mode. Disabled by default
|
||||
*/
|
||||
void SetFall();
|
||||
/* Disabled by default
|
||||
/* Inverses unit model orientation. Disabled by default
|
||||
*/
|
||||
void SetBackward();
|
||||
void SetOrientationInversed();
|
||||
/* Fixes unit's model rotation. Disabled by default
|
||||
*/
|
||||
void SetOrientationFixed(bool enable);
|
||||
|
||||
/* Sets the velocity (in case you want to have custom movement velocity)
|
||||
* if no set, speed will be selected based on unit's speeds and current movement mode
|
||||
|
|
@ -109,7 +124,8 @@ namespace Movement
|
|||
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::SetBackward() { args.flags.backward = true;}
|
||||
inline void MoveSplineInit::SetOrientationInversed() { args.flags.orientationInversed = true;}
|
||||
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable;}
|
||||
|
||||
inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset)
|
||||
{
|
||||
|
|
@ -130,18 +146,17 @@ namespace Movement
|
|||
args.path[1] = dest;
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift, bool is_knockback)
|
||||
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift)
|
||||
{
|
||||
args.time_perc = time_shift;
|
||||
args.parabolic_amplitude = amplitude;
|
||||
args.flags.EnableParabolic();
|
||||
args.flags.knockback = is_knockback;
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::SetFacing(float o)
|
||||
inline void MoveSplineInit::SetAnimation(AnimType anim)
|
||||
{
|
||||
args.facing.angle = G3D::wrap(o, 0.f, (float)G3D::twoPi());
|
||||
args.flags.EnableFacingAngle();
|
||||
args.time_perc = 0.f;
|
||||
args.flags.EnableAnimation((uint8)anim);
|
||||
}
|
||||
|
||||
inline void MoveSplineInit::SetFacing(Vector3 const& spot)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Movement
|
|||
struct MoveSplineInitArgs
|
||||
{
|
||||
MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0),
|
||||
velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0)
|
||||
velocity(0.f), parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f)
|
||||
{
|
||||
path.reserve(path_capacity);
|
||||
}
|
||||
|
|
@ -55,6 +55,7 @@ namespace Movement
|
|||
float parabolic_amplitude;
|
||||
float time_perc;
|
||||
uint32 splineId;
|
||||
float initialOrientation;
|
||||
|
||||
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
|
||||
bool Validate() const;
|
||||
|
|
|
|||
|
|
@ -155,14 +155,14 @@ namespace Movement
|
|||
|
||||
const char * g_SplineFlag_names[32]=
|
||||
{
|
||||
STR(Forward ),// 0x00000001,
|
||||
STR(Backward ),// 0x00000002,
|
||||
STR(Strafe_Left ),// 0x00000004,
|
||||
STR(Strafe_Right ),// 0x00000008,
|
||||
STR(Left ),// 0x00000010,
|
||||
STR(Right ),// 0x00000020,
|
||||
STR(Pitch_Up ),// 0x00000040,
|
||||
STR(Pitch_Down ),// 0x00000080,
|
||||
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,
|
||||
|
|
@ -182,7 +182,7 @@ namespace Movement
|
|||
STR(Unknown6 ),// 0x01000000,
|
||||
STR(Unknown7 ),// 0x02000000,
|
||||
STR(Unknown8 ),// 0x04000000,
|
||||
STR(Backward ),// 0x08000000, // Appears With Walkmode Flag, Nodes ),// 1, Handles Orientation
|
||||
STR(OrientationInversed ),// 0x08000000, // Appears With Runmode Flag, Nodes ),// 1, Handles Orientation
|
||||
STR(Unknown10 ),// 0x10000000,
|
||||
STR(Unknown11 ),// 0x20000000,
|
||||
STR(Unknown12 ),// 0x40000000,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11819"
|
||||
#define REVISION_NR "11820"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue