spline changes for mmaps.

This commit is contained in:
Venugh
2012-04-09 16:38:05 +02:00
parent c8f708f9ad
commit f478e6be2b
3 changed files with 24 additions and 11 deletions

View File

@@ -54,7 +54,7 @@ namespace Movement
return MOVE_RUN;
}
void MoveSplineInit::Launch()
int32 MoveSplineInit::Launch()
{
MoveSpline& move_spline = *unit.movespline;
@@ -86,7 +86,7 @@ namespace Movement
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate())
return;
return 0;
if (moveFlags & MOVEMENTFLAG_ROOT)
moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
@@ -98,6 +98,8 @@ namespace Movement
data.append(unit.GetPackGUID());
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data,true);
return move_spline.Duration();
}
MoveSplineInit::MoveSplineInit(Unit& m) : unit(m)

View File

@@ -20,6 +20,7 @@
#define TRINITYSERVER_MOVESPLINEINIT_H
#include "MoveSplineInitArgs.h"
#include "PathFinderMovementGenerator.h"
class Unit;
@@ -43,7 +44,7 @@ namespace Movement
/* Final pass of initialization that launches spline movement.
*/
void Launch();
int32 Launch();
/* Adds movement by parabolic trajectory
* @param amplitude - the maximum height of parabola, value could be negative and positive
@@ -72,8 +73,8 @@ namespace Movement
/* Initializes simple A to B mition, A is current unit's position, B is destination
*/
void MoveTo(const Vector3& destination);
void MoveTo(float x, float y, float z);
void MoveTo(const Vector3& destination, bool generatePath = false, bool forceDestination = false);
void MoveTo(float x, float y, float z, bool generatePath = false, bool forceDestination = false);
/* Sets Id of fisrt point of the path. When N-th path point will be done ILisener will notify that pointId + N done
* Needed for waypoint movement where path splitten into parts
@@ -133,17 +134,26 @@ namespace Movement
args.path.assign(controls.begin(),controls.end());
}
inline void MoveSplineInit::MoveTo(float x, float y, float z)
inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
{
Vector3 v(x,y,z);
MoveTo(v);
MoveTo(v, generatePath, forceDestination);
}
inline void MoveSplineInit::MoveTo(const Vector3& dest)
inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
{
args.path_Idx_offset = 0;
args.path.resize(2);
args.path[1] = dest;
if (generatePath)
{
PathFinderMovementGenerator path(&unit);
path.calculate(dest.x, dest.y, dest.z, forceDestination);
MovebyPath(path.getPath());
}
else
{
args.path_Idx_offset = 0;
args.path.resize(2);
args.path[1] = dest;
}
}
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift)

View File

@@ -136,6 +136,7 @@ World::~World()
delete command;
VMAP::VMapFactory::clear();
MMAP::MMapFactory::clear();
//TODO free addSessQueue
}