diff options
| author | NoName <322016+Faq@users.noreply.github.com> | 2020-09-08 18:12:52 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-08 17:12:52 +0200 |
| commit | dad187615df603ad8614531a0ec84c1a5e136838 (patch) | |
| tree | 2e0fa2b671a3645da2f10ba654c7cc2c1b816db9 /src/server/game/Entities/Unit | |
| parent | 9e8915eaac70c0fd6dab98beeaddef59f2741b42 (diff) | |
Core/Movement: Corrected Animation Tier handling (PR #24875)
Co-authored-by: Warpten <vertozor@gmail.com>
Co-authored-by: Ovahlord <dreadkiller@gmx.de>
Co-authored-by: Carbenium <carbenium@outlook.com>
Diffstat (limited to 'src/server/game/Entities/Unit')
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 18 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 7 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/UnitDefines.h | 13 |
3 files changed, 28 insertions, 10 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 71d1176d87d..415992b1e0c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -513,8 +513,13 @@ void Unit::UpdateSplineMovement(uint32 t_diff) } if (arrived) + { DisableSpline(); + if (movespline->HasAnimation()) + SetAnimationTier(movespline->GetAnimation()); + } + UpdateSplinePosition(); } @@ -10307,6 +10312,14 @@ bool Unit::IsPolymorphed() const return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH; } +void Unit::SetAnimationTier(AnimationTier tier) +{ + if (!IsCreature()) + return; + + SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, static_cast<uint8>(tier)); +} + void Unit::RecalculateObjectScale() { int32 scaleAuras = GetTotalAuraModifier(SPELL_AURA_MOD_SCALE) + GetTotalAuraModifier(SPELL_AURA_MOD_SCALE_2); @@ -13141,7 +13154,7 @@ bool Unit::SetWalk(bool enable) return true; } -bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/) +bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/, bool /*updateAnimationTier = true*/) { if (disable == IsGravityDisabled()) return false; @@ -13153,6 +13166,7 @@ bool Unit::SetDisableGravity(bool disable, bool /*packetOnly = false*/) } else RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); + return true; } @@ -13207,7 +13221,7 @@ bool Unit::SetFeatherFall(bool enable, bool /*packetOnly = false */) return true; } -bool Unit::SetHover(bool enable, bool /*packetOnly = false*/) +bool Unit::SetHover(bool enable, bool /*packetOnly = false*/, bool /*updateAnimationTier = true*/) { if (enable == HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) return false; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 073087163d4..854b40e4ff0 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -923,6 +923,9 @@ class TC_GAME_API Unit : public WorldObject bool IsStandState() const; void SetStandState(uint8 state); + void SetAnimationTier(AnimationTier tier); + AnimationTier GetAnimationTier() const { return static_cast<AnimationTier>(GetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER)); } + void SetStandFlags(uint8 flags) { SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_VIS_FLAG, flags); } void RemoveStandFlags(uint8 flags) { RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_VIS_FLAG, flags); } @@ -1121,12 +1124,12 @@ class TC_GAME_API Unit : public WorldObject bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); } bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); } virtual bool SetWalk(bool enable); - virtual bool SetDisableGravity(bool disable, bool packetOnly = false); + virtual bool SetDisableGravity(bool disable, bool packetOnly = false, bool updateAnimationTier = true); virtual bool SetSwim(bool enable); virtual bool SetCanFly(bool enable, bool packetOnly = false); virtual bool SetWaterWalking(bool enable, bool packetOnly = false); virtual bool SetFeatherFall(bool enable, bool packetOnly = false); - virtual bool SetHover(bool enable, bool packetOnly = false); + virtual bool SetHover(bool enable, bool packetOnly = false, bool updateAnimationTier = true); void SetInFront(WorldObject const* target); void SetFacingTo(float const ori, bool force = true); diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index 1bd65509ed1..c5bb23c6463 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.h @@ -77,13 +77,14 @@ enum UnitBytes2Offsets : uint8 UNIT_BYTES_2_OFFSET_SHAPESHIFT_FORM = 3 }; -// byte flags value (UNIT_FIELD_BYTES_1, 3) -enum UnitBytes1_Flags : uint8 +// UNIT_FIELD_BYTES_1 (UNIT_BYTES_1_OFFSET_ANIM_TIER) +enum class AnimationTier : uint8 { - UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01, - UNIT_BYTE1_FLAG_HOVER = 0x02, - UNIT_BYTE1_FLAG_UNK_3 = 0x04, - UNIT_BYTE1_FLAG_ALL = 0xFF + Ground = 0, // plays ground tier animations + Swim = 1, // falls back to ground tier animations, not handled by the client, should never appear in sniffs, will prevent tier change animations from playing correctly if used + Hover = 2, // plays flying tier animations or falls back to ground tier animations, automatically enables hover clientside when entering visibility with this value + Fly = 3, // plays flying tier animations + Submerged = 4 }; // low byte (0 from 0..3) of UNIT_FIELD_BYTES_2 |
