Skip to content

Commit

Permalink
Rename WalkFrame -> RenderWalkFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Jan 23, 2021
1 parent 794c4ec commit 60b4921
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions EOLib/Domain/Character/CharacterRenderProperties.cs
Expand Up @@ -26,7 +26,7 @@ public class CharacterRenderProperties : ICharacterRenderProperties
public int MapX { get; private set; }
public int MapY { get; private set; }

public int WalkFrame { get; private set; }
public int RenderWalkFrame { get; private set; }
public int AttackFrame { get; private set; }
public int EmoteFrame { get; private set; }

Expand Down Expand Up @@ -126,8 +126,8 @@ public ICharacterRenderProperties WithMapY(int mapY)
public ICharacterRenderProperties WithNextWalkFrame()
{
var props = MakeCopy(this);
props.WalkFrame = (props.WalkFrame + 1) % MAX_NUMBER_OF_WALK_FRAMES;
props.CurrentAction = props.WalkFrame == 0 ? CharacterActionState.Standing : CharacterActionState.Walking;
props.RenderWalkFrame = (props.RenderWalkFrame + 1) % MAX_NUMBER_OF_WALK_FRAMES;
props.CurrentAction = props.RenderWalkFrame == 0 ? CharacterActionState.Standing : CharacterActionState.Walking;
return props;
}

Expand Down Expand Up @@ -159,7 +159,7 @@ public ICharacterRenderProperties WithNextSpellCastFrame()
public ICharacterRenderProperties ResetAnimationFrames()
{
var props = MakeCopy(this);
props.WalkFrame = 0;
props.RenderWalkFrame = 0;
props.AttackFrame = 0;
props.EmoteFrame = 0;
props.CurrentAction = CharacterActionState.Standing;
Expand Down Expand Up @@ -228,7 +228,7 @@ private static CharacterRenderProperties MakeCopy(ICharacterRenderProperties oth
MapX = other.MapX,
MapY = other.MapY,

WalkFrame = other.WalkFrame,
RenderWalkFrame = other.RenderWalkFrame,
AttackFrame = other.AttackFrame,
EmoteFrame = other.EmoteFrame,

Expand Down Expand Up @@ -257,7 +257,7 @@ public override bool Equals(object obj)
Direction == properties.Direction &&
MapX == properties.MapX &&
MapY == properties.MapY &&
WalkFrame == properties.WalkFrame &&
RenderWalkFrame == properties.RenderWalkFrame &&
AttackFrame == properties.AttackFrame &&
EmoteFrame == properties.EmoteFrame &&
SitState == properties.SitState &&
Expand All @@ -283,7 +283,7 @@ public override int GetHashCode()
hashCode = hashCode * -1521134295 + Direction.GetHashCode();
hashCode = hashCode * -1521134295 + MapX.GetHashCode();
hashCode = hashCode * -1521134295 + MapY.GetHashCode();
hashCode = hashCode * -1521134295 + WalkFrame.GetHashCode();
hashCode = hashCode * -1521134295 + RenderWalkFrame.GetHashCode();
hashCode = hashCode * -1521134295 + AttackFrame.GetHashCode();
hashCode = hashCode * -1521134295 + EmoteFrame.GetHashCode();
hashCode = hashCode * -1521134295 + SitState.GetHashCode();
Expand Down
2 changes: 1 addition & 1 deletion EOLib/Domain/Character/ICharacterRenderProperties.cs
Expand Up @@ -22,7 +22,7 @@ public interface ICharacterRenderProperties : ICloneable
int MapX { get; }
int MapY { get; }

int WalkFrame { get; }
int RenderWalkFrame { get; }
int AttackFrame { get; }
int EmoteFrame { get; }

Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/Controllers/ArrowKeyController.cs
Expand Up @@ -77,7 +77,7 @@ public bool MoveDown(bool faceAndMove = false)
private bool CanWalkAgain()
{
return _characterProvider.MainCharacter.RenderProperties.IsActing(CharacterActionState.Standing) ||
_characterProvider.MainCharacter.RenderProperties.WalkFrame == CharacterRenderProperties.MAX_NUMBER_OF_WALK_FRAMES;
_characterProvider.MainCharacter.RenderProperties.RenderWalkFrame == CharacterRenderProperties.MAX_NUMBER_OF_WALK_FRAMES;
}

private bool CurrentDirectionIs(EODirection direction)
Expand Down
Expand Up @@ -39,7 +39,7 @@ private Vector2 GetOffsets(Rectangle parentCharacterDrawArea)
{
resY -= 1;// * factor;

if (_renderProperties.WalkFrame == 2)
if (_renderProperties.RenderWalkFrame == 2)
resY -= 1;
}
else if (_renderProperties.AttackFrame == 2)
Expand Down
4 changes: 2 additions & 2 deletions EndlessClient/Rendering/RenderOffsetCalculator.cs
Expand Up @@ -22,7 +22,7 @@ public int CalculateOffsetX(ICharacterRenderProperties properties)
public int CalculateWalkAdjustX(ICharacterRenderProperties properties)
{
var multiplier = properties.IsFacing(EODirection.Left, EODirection.Down) ? -1 : 1;
var walkAdjust = properties.IsActing(CharacterActionState.Walking) ? WalkWidthFactor * properties.WalkFrame : 0;
var walkAdjust = properties.IsActing(CharacterActionState.Walking) ? WalkWidthFactor * properties.RenderWalkFrame : 0;
return walkAdjust * multiplier;
}

Expand All @@ -34,7 +34,7 @@ public int CalculateOffsetY(ICharacterRenderProperties properties)
public int CalculateWalkAdjustY(ICharacterRenderProperties properties)
{
var multiplier = properties.IsFacing(EODirection.Left, EODirection.Up) ? -1 : 1;
var walkAdjust = properties.IsActing(CharacterActionState.Walking) ? WalkHeightFactor * properties.WalkFrame : 0;
var walkAdjust = properties.IsActing(CharacterActionState.Walking) ? WalkHeightFactor * properties.RenderWalkFrame : 0;
return walkAdjust * multiplier;
}

Expand Down
12 changes: 6 additions & 6 deletions EndlessClient/Rendering/Sprites/CharacterSpriteCalculator.cs
Expand Up @@ -35,7 +35,7 @@ public ISpriteSheet GetBootsTexture(ICharacterRenderProperties characterRenderPr
switch (characterRenderProperties.CurrentAction)
{
case CharacterActionState.Walking:
switch (characterRenderProperties.WalkFrame)
switch (characterRenderProperties.RenderWalkFrame)
{
case 1: type = BootsSpriteType.WalkFrame1; break;
case 2: type = BootsSpriteType.WalkFrame2; break;
Expand Down Expand Up @@ -75,7 +75,7 @@ public ISpriteSheet GetArmorTexture(ICharacterRenderProperties characterRenderPr
switch (characterRenderProperties.CurrentAction)
{
case CharacterActionState.Walking:
switch (characterRenderProperties.WalkFrame)
switch (characterRenderProperties.RenderWalkFrame)
{
case 1: type = ArmorShieldSpriteType.WalkFrame1; break;
case 2: type = ArmorShieldSpriteType.WalkFrame2; break;
Expand Down Expand Up @@ -153,7 +153,7 @@ public ISpriteSheet GetShieldTexture(ICharacterRenderProperties characterRenderP
{
if (characterRenderProperties.CurrentAction == CharacterActionState.Walking)
{
switch (characterRenderProperties.WalkFrame)
switch (characterRenderProperties.RenderWalkFrame)
{
case 1: type = ArmorShieldSpriteType.WalkFrame1; break;
case 2: type = ArmorShieldSpriteType.WalkFrame2; break;
Expand Down Expand Up @@ -207,7 +207,7 @@ public ISpriteSheet[] GetWeaponTextures(ICharacterRenderProperties characterRend
switch (characterRenderProperties.CurrentAction)
{
case CharacterActionState.Walking:
switch (characterRenderProperties.WalkFrame)
switch (characterRenderProperties.RenderWalkFrame)
{
case 1: type = WeaponSpriteType.WalkFrame1; break;
case 2: type = WeaponSpriteType.WalkFrame2; break;
Expand Down Expand Up @@ -278,7 +278,7 @@ public ISpriteSheet GetSkinTexture(ICharacterRenderProperties characterRenderPro
var sheetColumns = 4;
var gfxNum = 1;

if (characterRenderProperties.CurrentAction == CharacterActionState.Walking && characterRenderProperties.WalkFrame > 0)
if (characterRenderProperties.CurrentAction == CharacterActionState.Walking && characterRenderProperties.RenderWalkFrame > 0)
{
gfxNum = 2;
sheetColumns = 16;
Expand Down Expand Up @@ -314,7 +314,7 @@ public ISpriteSheet GetSkinTexture(ICharacterRenderProperties characterRenderPro
var widthDelta = texture.Width / sheetColumns;
var sectionDelta = texture.Width / 4;

var walkExtra = characterRenderProperties.WalkFrame > 0 ? widthDelta * (characterRenderProperties.WalkFrame - 1) : 0;
var walkExtra = characterRenderProperties.RenderWalkFrame > 0 ? widthDelta * (characterRenderProperties.RenderWalkFrame - 1) : 0;
walkExtra = !BowIsEquipped(characterRenderProperties) && characterRenderProperties.AttackFrame > 0 ? widthDelta * (characterRenderProperties.AttackFrame - 1) : walkExtra;

// Fix offsets for skins - the source rectangles are not at an evenly spaced interval
Expand Down

0 comments on commit 60b4921

Please sign in to comment.