Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps

Conflicts:
	dep/PackageList.txt
	src/server/game/Movement/MotionMaster.cpp
	src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
	src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
	src/server/game/Movement/Spline/MoveSplineInit.h
	src/server/game/World/World.h
This commit is contained in:
Subv committed 2012-08-22 17:26:53 -05:00
commit dc95ce61b4
1376 files changed
+55480 -24539

No files matched your search

@@ -20,6 +20,8 @@
#include "MoveSpline.h"
#include "MovementPacketBuilder.h"
#include "Unit.h"
#include "Transport.h"
#include "Vehicle.h"
namespace Movement
{
@@ -58,17 +60,26 @@ namespace Movement
{
MoveSpline& move_spline = *unit.movespline;
Location real_position(unit.GetPositionX(),unit.GetPositionY(),unit.GetPositionZMinusOffset(),unit.GetOrientation());
// there is a big chane that current position is unknown if current state is not finalized, need compute it
bool transport = false;
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZMinusOffset(), unit.GetOrientation());
// Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes
if (unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID())
{
transport = true;
real_position.x = unit.GetTransOffsetX();
real_position.y = unit.GetTransOffsetY();
real_position.z = unit.GetTransOffsetZ();
real_position.orientation = unit.GetTransOffsetO();
}
// there is a big chance 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())
real_position = move_spline.ComputePosition();
// should i do the things that user should do? - no.
if (args.path.empty())
{
// should i do the things that user should do?
MoveTo(real_position);
}
return;
// corrent first vertex
args.path[0] = real_position;
@@ -82,7 +93,7 @@ namespace Movement
moveFlags |= (MOVEMENTFLAG_SPLINE_ENABLED|MOVEMENTFLAG_FORWARD);
if (args.velocity == 0.f)
if (!args.HasVelocity)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
if (!args.Validate())
@@ -94,8 +105,14 @@ namespace Movement
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
WorldPacket data(!transport ? SMSG_MONSTER_MOVE : SMSG_MONSTER_MOVE_TRANSPORT, 64);
data.append(unit.GetPackGUID());
if (transport)
{
data.appendPackGUID(unit.GetTransGUID());
data << int8(unit.GetTransSeat());
}
PacketBuilder::WriteMonsterMove(move_spline, data);
unit.SendMessageToSet(&data,true);
@@ -104,6 +121,8 @@ namespace Movement
MoveSplineInit::MoveSplineInit(Unit& m) : unit(m)
{
// Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes
args.TransformForTransport = unit.HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit.GetTransGUID();
// mix existing state into new
args.flags.walkmode = unit.m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);
args.flags.flying = unit.m_movementInfo.HasMovementFlag((MovementFlags)(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_DISABLE_GRAVITY));
@@ -112,13 +131,48 @@ namespace Movement
void MoveSplineInit::SetFacing(const Unit * target)
{
args.flags.EnableFacingTarget();
//args.facing.target = target->GetObjectGuid().GetRawValue();
args.facing.target = target->GetUInt64Value(OBJECT_FIELD_GUID);
args.facing.target = target->GetGUID();
}
void MoveSplineInit::SetFacing(float angle)
{
if (args.TransformForTransport)
{
if (Unit* vehicle = unit.GetVehicleBase())
angle -= vehicle->GetOrientation();
else if (Transport* transport = unit.GetTransport())
angle -= transport->GetOrientation();
}
args.facing.angle = G3D::wrap(angle, 0.f, (float)G3D::twoPi());
args.flags.EnableFacingAngle();
}
void MoveSplineInit::MoveTo(Vector3 const& dest)
{
args.path_Idx_offset = 0;
args.path.resize(2);
TransportPathTransform transform(unit, args.TransformForTransport);
args.path[1] = transform(dest);
}
Vector3 TransportPathTransform::operator()(Vector3 input)
{
if (_transformForTransport)
{
if (Unit* vehicle = _owner.GetVehicleBase())
{
input.x -= vehicle->GetPositionX();
input.y -= vehicle->GetPositionY();
input.z -= vehicle->GetPositionZMinusOffset();
}
else if (Transport* transport = _owner.GetTransport())
{
float unused = 0.0f;
transport->CalculatePassengerOffset(input.x, input.y, input.z, unused);
}
}
return input;
}
}