From ca56284912f94ba7dc97a807007141d5118338e0 Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Sat, 20 Nov 2010 19:38:02 +0200 Subject: [PATCH] [10759] Correctly reset mob orientation upon reaching spawn point. Should also improve visualisation of mob orientation on clients Signed-off-by: Ambal --- src/game/HomeMovementGenerator.cpp | 3 ++- src/game/Object.cpp | 8 ++++++++ src/game/Object.h | 2 +- src/game/Unit.h | 1 + src/shared/revision_nr.h | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index ae7d3cd6d..baff82130 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -72,9 +72,10 @@ HomeMovementGenerator::Update(Creature &owner, const uint32& time_diff // restore orientation of not moving creature at returning to home if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE) { + // such a mob might need very exact spawning point, hence relocate to spawn-position if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) { - owner.SetOrientation(data->orientation); + owner.Relocate(data->posX, data->posY, data->posZ, data->orientation); owner.SendHeartBeat(false); } } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index de9011bd7..256c54be7 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1158,6 +1158,14 @@ void WorldObject::Relocate(float x, float y, float z) ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation()); } +void WorldObject::SetOrientation(float orientation) +{ + m_orientation = orientation; + + if(isType(TYPEMASK_UNIT)) + ((Unit*)this)->m_movementInfo.ChangeOrientation(orientation); +} + uint32 WorldObject::GetZoneId() const { return GetTerrain()->GetZoneId(m_positionX, m_positionY, m_positionZ); diff --git a/src/game/Object.h b/src/game/Object.h index 299de0187..d507380be 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -350,7 +350,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object void Relocate(float x, float y, float z, float orientation); void Relocate(float x, float y, float z); - void SetOrientation(float orientation) { m_orientation = orientation; } + void SetOrientation(float orientation); float GetPositionX( ) const { return m_positionX; } float GetPositionY( ) const { return m_positionY; } diff --git a/src/game/Unit.h b/src/game/Unit.h index a18d9bb84..b8f559787 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -791,6 +791,7 @@ class MovementInfo int8 GetTransportSeat() const { return t_seat; } uint32 GetTransportTime() const { return t_time; } uint32 GetFallTime() const { return fallTime; } + void ChangeOrientation(float o) { pos.o = o; } void ChangePosition(float x, float y, float z, float o) { pos.x = x; pos.y = y; pos.z = z; pos.o = o; } void UpdateTime(uint32 _time) { time = _time; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 27d31c560..d7bf5e6aa 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10758" + #define REVISION_NR "10759" #endif // __REVISION_NR_H__