Core/Movement: merged smooth waypoint movement. Followup commits will be merged soon (tm)

This commit is contained in:
Ovahlord committed 2018-08-02 15:38:35 +02:00
1 parent d59a20701e
commit c808b981f7
88 files changed
+1301 -1396

No files matched your search

+29 -1
View File
@@ -40,6 +40,7 @@
#include "Log.h"
#include "LootMgr.h"
#include "MotionMaster.h"
#include "MovementGenerator.h"
#include "MovementStructures.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
@@ -10944,6 +10945,26 @@ void Unit::StopMoving()
init.Stop();
}
void Unit::PauseMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
{
if (slot >= MAX_MOTION_SLOT)
return;
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
movementGenerator->Pause(timer);
StopMoving();
}
void Unit::ResumeMovement(uint32 timer/* = 0*/, uint8 slot/* = 0*/)
{
if (slot >= MAX_MOTION_SLOT)
return;
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
movementGenerator->Resume(timer);
}
bool Unit::IsSitState() const
{
uint8 s = GetStandState();
@@ -12113,8 +12134,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (GetTypeId() == TYPEID_UNIT)
{
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
movementGenerator->Pause(0);
GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
StopMoving();
ToCreature()->AI()->OnCharmed(true);
GetMotionMaster()->MoveIdle();
}
else if (Player* player = ToPlayer())
{
@@ -12230,6 +12257,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
else
RestoreFaction();
///@todo Handle SLOT_IDLE motion resume
GetMotionMaster()->InitDefault();
if (Creature* creature = ToCreature())