Skip to content

Commit

Permalink
Fix rendering of other characters
Browse files Browse the repository at this point in the history
- Draw frames when character is walking (don't consider destination x/y for if renderer should be drawn)
- Fix replay of walk animation when character is not main character
  • Loading branch information
ethanmoffat committed Mar 8, 2022
1 parent 6c5cd65 commit a10e8fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion EndlessClient/Rendering/Character/CharacterAnimator.cs
Expand Up @@ -181,7 +181,7 @@ private void AnimateCharacterWalking()
{
var isMainCharacter = currentCharacter == _characterRepository.MainCharacter;

if (isMainCharacter && _walkValidationActions.CanMoveToCoordinates(nextFrameRenderProperties.GetDestinationX(), nextFrameRenderProperties.GetDestinationY()))
if (!isMainCharacter || (isMainCharacter && _walkValidationActions.CanMoveToCoordinates(nextFrameRenderProperties.GetDestinationX(), nextFrameRenderProperties.GetDestinationY())))
{
// send the walk packet after the game state has been updated so the correct coordinates are sent
sendWalk = currentCharacter == _characterRepository.MainCharacter;
Expand Down
Expand Up @@ -59,14 +59,7 @@ public override void RenderElementAt(SpriteBatch spriteBatch, int row, int col,
private bool IsAtPosition(int characterId, int row, int col)
{
var rp = _characterStateCache.OtherCharacters[characterId].RenderProperties;
if (!rp.IsActing(CharacterActionState.Walking))
{
return row == rp.MapY && col == rp.MapX;
}
else
{
return row == rp.GetDestinationY() && col == rp.GetDestinationX();
}
return row == rp.MapY && col == rp.MapX;
}
}
}

0 comments on commit a10e8fb

Please sign in to comment.