Skip to content

Commit

Permalink
Fix corpse graphics from CUO/Spasitjel
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Feb 24, 2024
1 parent 5938841 commit 64df25c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/ClassicUO.Client/Game/GameObjects/Views/ItemView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ float depth
byte animIndex = (byte)AnimIndex;
ushort graphic = GetGraphicForAnimation();

Client.Game.Animations.ConvertBodyIfNeeded(ref graphic);
Client.Game.Animations.ConvertBodyIfNeeded(ref graphic, isCorpse: IsCorpse);
var animGroup = Client.Game.Animations.GetAnimType(graphic);
var animFlags = Client.Game.Animations.GetAnimFlags(graphic);
byte group = AnimationsLoader.Instance.GetDeathAction(
Expand Down Expand Up @@ -603,7 +603,7 @@ out Dictionary<ushort, EquipConvData> map
continue;
}

Client.Game.Animations.ConvertBodyIfNeeded(ref graphic);
Client.Game.Animations.ConvertBodyIfNeeded(ref graphic, isCorpse: IsCorpse);
var animGroup = Client.Game.Animations.GetAnimType(graphic);
var animFlags = Client.Game.Animations.GetAnimFlags(graphic);
byte group = AnimationsLoader.Instance.GetDeathAction(
Expand All @@ -617,7 +617,9 @@ out Dictionary<ushort, EquipConvData> map
group,
direction,
out _,
out var isUOP
out var isUOP,
false,
IsCorpse
);

if (frames.IsEmpty)
Expand Down
7 changes: 5 additions & 2 deletions src/ClassicUO.Renderer/Animations/Animation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ public void UpdateAnimationTable(BodyConvFlags flags)
public void ConvertBodyIfNeeded(
ref ushort graphic,
bool isParent = false,
bool forceUOP = false
bool forceUOP = false,
bool isCorpse = false
)
{
if (graphic >= _dataIndex.Length)
Expand All @@ -351,7 +352,9 @@ public void ConvertBodyIfNeeded(
ushort hue = 0;

if (_dataIndex[graphic] != null && _dataIndex[graphic].FileIndex == 0 && !_dataIndex[graphic].Flags.HasFlag(AnimationFlags.UseUopAnimation))
AnimationsLoader.Instance.ReplaceBody(ref graphic, ref hue);
{
_ = isCorpse ? AnimationsLoader.Instance.ReplaceCorpse(ref graphic, ref hue) : AnimationsLoader.Instance.ReplaceBody(ref graphic, ref hue);
}
}

public bool AnimationExists(ushort graphic, byte group, bool isCorpse = false)
Expand Down

0 comments on commit 64df25c

Please sign in to comment.