[11720] Implement spline movement subsystem

Spline movement controls movements of server-side controlled units (monster movement, taxi movement, etc).
Proper implementation of effects such as charge, jump, cyclic movement will rely on it.
However, need improve our states system before.

Technical changes:

 1. Added linear, catmullrom and bezier3 splines which based on client's algorthims. They can be reused for proper transport position interpolation.
 2. Precission increased. There are no more position desync issues since client's position calculation formulas used.
 3. Now possible to move by paths with multiple points, send whole path to client.
This commit is contained in:
SilverIce 2011-07-08 17:25:13 +03:00
parent e302fce513
commit 9d566398ad
52 changed files with 2471 additions and 1203 deletions

View file

@ -20,8 +20,9 @@
#include "CreatureAI.h"
#include "MapManager.h"
#include "FleeingMovementGenerator.h"
#include "DestinationHolderImp.h"
#include "ObjectAccessor.h"
#include "movement/MoveSplineInit.h"
#include "movement/MoveSpline.h"
#define MIN_QUIET_DISTANCE 28.0f
#define MAX_QUIET_DISTANCE 43.0f
@ -45,8 +46,11 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
return;
owner.addUnitState(UNIT_STAT_FLEEING_MOVE);
Traveller<T> traveller(owner);
i_destinationHolder.SetDestination(traveller, x, y, z);
Movement::MoveSplineInit init(owner);
init.MoveTo(x,y,z);
init.SetWalk(false);
init.Launch();
}
template<class T>
@ -308,7 +312,6 @@ template<>
void
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
{
owner.RemoveSplineFlag(SPLINEFLAG_WALKMODE);
owner.SetTargetGuid(ObjectGuid());
is_water_ok = owner.CanSwim();
is_land_ok = owner.CanWalk();
@ -331,7 +334,6 @@ void FleeingMovementGenerator<Player>::Finalize(Player &owner)
template<>
void FleeingMovementGenerator<Creature>::Finalize(Creature &owner)
{
owner.AddSplineFlag(SPLINEFLAG_WALKMODE);
owner.clearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE);
}
@ -361,28 +363,10 @@ bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
return true;
}
Traveller<T> traveller(owner);
i_nextCheckTime.Update(time_diff);
if( (owner.IsStopped() && !i_destinationHolder.HasArrived()) || !i_destinationHolder.HasDestination() )
{
if (i_nextCheckTime.Passed() && owner.movespline->Finalized())
_setTargetLocation(owner);
return true;
}
if (i_destinationHolder.UpdateTraveller(traveller, time_diff, false))
{
if (!IsActive(owner)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
i_destinationHolder.ResetUpdate(50);
if(i_nextCheckTime.Passed() && i_destinationHolder.HasArrived())
{
_setTargetLocation(owner);
return true;
}
}
return true;
}