public Vector2 CalculateDrawLocationOfCharacterHair(Rectangle parentCharacterDrawArea)
        {
            var offsets       = GetOffsets();
            var flippedOffset = _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? 2 : 0;

            return(new Vector2(parentCharacterDrawArea.X + offsets.X + flippedOffset,
                               parentCharacterDrawArea.Y + offsets.Y));
        }
Esempio n. 2
0
        public void Render(SpriteBatch spriteBatch, Rectangle parentCharacterDrawArea)
        {
            var offsets = GetOffsets();
            var drawLoc = new Vector2(parentCharacterDrawArea.X - 2 + offsets.X, parentCharacterDrawArea.Y + 49 + offsets.Y);

            spriteBatch.Draw(_bootsTexture, drawLoc, null, Color.White, 0.0f, Vector2.Zero, 1.0f,
                             _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                             0.0f);
        }
Esempio n. 3
0
        public void Render(SpriteBatch spriteBatch, Rectangle parentCharacterDrawArea)
        {
            var offsets       = _hairRenderLocationCalculator.CalculateDrawLocationOfCharacterHair(parentCharacterDrawArea);
            var flippedOffset = _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? -2 : 0;
            var drawLoc       = new Vector2(offsets.X + flippedOffset, offsets.Y - 3);

            spriteBatch.Draw(_hatTexture, drawLoc, null, Color.White, 0.0f, Vector2.Zero, 1.0f,
                             _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                             0.0f);
        }
Esempio n. 4
0
        public void Render(SpriteBatch spriteBatch, Rectangle parentCharacterDrawArea)
        {
            if (_renderProperties.CurrentAction == CharacterActionState.Sitting ||
                _renderProperties.CurrentAction == CharacterActionState.SpellCast)
            {
                return;
            }

            var offsets = GetOffsets();
            var drawLoc = new Vector2(parentCharacterDrawArea.X + offsets.X, parentCharacterDrawArea.Y + offsets.Y);

            spriteBatch.Draw(_weaponTexture, drawLoc, null, Color.White, 0.0f, Vector2.Zero, 1.0f,
                             _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                             0.0f);
        }
Esempio n. 5
0
        public void Render(SpriteBatch spriteBatch, Rectangle parentCharacterDrawArea)
        {
            if (!_renderProperties.IsFacing(EODirection.Down, EODirection.Right))
            {
                return;
            }

            var skinLoc = _skinRenderLocationCalculator.CalculateDrawLocationOfCharacterSkin(parentCharacterDrawArea);
            var facePos = new Vector2(skinLoc.X + (_renderProperties.IsFacing(EODirection.Down) ? 2 : 3),
                                      skinLoc.Y + (_renderProperties.Gender == 0 ? 2 : 0));

            spriteBatch.Draw(_faceSheet.SheetTexture, facePos, _faceSheet.SourceRectangle, Color.White, 0f, Vector2.Zero, 1f,
                             _renderProperties.IsFacing(EODirection.Right) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                             0f);
        }
        public int CalculateOffsetY(ICharacterRenderProperties properties)
        {
            var multiplier = properties.IsFacing(EODirection.Left, EODirection.Up) ? -1 : 1;
            var walkAdjust = properties.IsActing(CharacterActionState.Walking) ? WalkHeightFactor * properties.WalkFrame : 0;

            //walkAdjust * multiplier is the old ViewAdjustY
            return(properties.MapX * HeightFactor + properties.MapY * HeightFactor + walkAdjust * multiplier);
        }
Esempio n. 7
0
        public void Render(SpriteBatch spriteBatch, Rectangle parentCharacterDrawArea)
        {
            //todo: I most likely screwed something up when re-implementing this so it needs to be verified for all states!

            var drawLoc = _skinRenderLocationCalculator.CalculateDrawLocationOfCharacterSkin(parentCharacterDrawArea);

            spriteBatch.Draw(_skinSheet.SheetTexture, drawLoc, _skinSheet.SourceRectangle, Color.White, 0.0f, Vector2.Zero, 1.0f,
                             _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                             0.0f);
        }
Esempio n. 8
0
        private bool IsWeaponBehindCharacter(ICharacterRenderProperties renderProperties)
        {
            var weaponInfo = EIFFile.Data.SingleOrDefault(
                x => x.Type == ItemType.Weapon &&
                x.DollGraphic == renderProperties.WeaponGraphic);

            var pass1 = renderProperties.AttackFrame < 2;
            var pass2 = renderProperties.IsFacing(EODirection.Up, EODirection.Left);
            var pass3 = weaponInfo == null || weaponInfo.SubType == ItemSubType.Ranged;

            return(pass1 || pass2 || pass3);
        }
Esempio n. 9
0
        public Vector2 CalculateDrawLocationOfCharacterSkin(Rectangle skinRectangle, Rectangle parentCharacterDrawArea)
        {
            var resX = -(float)Math.Floor(Math.Abs((float)skinRectangle.Width - parentCharacterDrawArea.Width) / 2);
            var resY = -(float)Math.Floor(Math.Abs((float)skinRectangle.Height - parentCharacterDrawArea.Height) / 2);

            if (_renderProperties.IsActing(CharacterActionState.SpellCast))
            {
                resY -= 2;
            }

            // This specific frame is a bitch
            if (_renderProperties.Gender == 1 && _renderProperties.AttackFrame == 1)
            {
                resX += _renderProperties.IsFacing(EOLib.EODirection.Up, EOLib.EODirection.Right) ? 2 : -2;
            }

            return(new Vector2(parentCharacterDrawArea.X + resX, parentCharacterDrawArea.Y + resY));
        }
        private Vector2 GetWalkingOffset()
        {
            int skinXOff = 0;

            if (_renderProperties.Gender == 1)
            {
                if (_renderProperties.IsFacing(EODirection.Down))
                {
                    skinXOff = -1;
                }
                else if (_renderProperties.IsFacing(EODirection.Right))
                {
                    skinXOff = 1;
                }
            }

            return(new Vector2(skinXOff - 4, -1));
        }
Esempio n. 11
0
        public Vector2 CalculateDrawLocationOfCharacterHair(Rectangle hairRectangle, Rectangle parentCharacterDrawArea)
        {
            var resX = -(float)Math.Floor(Math.Abs((float)hairRectangle.Width - parentCharacterDrawArea.Width) / 2) - 1;
            var resY = -(float)Math.Floor(Math.Abs(hairRectangle.Height - (parentCharacterDrawArea.Height / 2f)) / 2) - _renderProperties.Gender;

            if (_renderProperties.AttackFrame == 2)
            {
                resX += _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? 4 : -4;
                resX += _renderProperties.IsFacing(EODirection.Up)
                    ? _renderProperties.Gender * -2
                    : _renderProperties.IsFacing(EODirection.Left)
                        ? _renderProperties.Gender * 2
                        : 0;

                resY += _renderProperties.IsFacing(EODirection.Up, EODirection.Left) ? 1 : 5;
                resY -= _renderProperties.IsFacing(EODirection.Right, EODirection.Down) ? _renderProperties.Gender : 0;
            }

            var flippedOffset = _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? 2 : 0;

            return(parentCharacterDrawArea.Location.ToVector2() + new Vector2(resX + flippedOffset, resY));
        }
Esempio n. 12
0
 private bool IsShieldBehindCharacter(ICharacterRenderProperties renderProperties)
 {
     return(renderProperties.IsFacing(EODirection.Right, EODirection.Down) && IsShieldOnBack(renderProperties));
 }
Esempio n. 13
0
 protected virtual void Render(SpriteBatch spriteBatch, ISpriteSheet sheet, Vector2 drawLoc, int alpha = 255)
 {
     spriteBatch.Draw(sheet.SheetTexture, drawLoc, sheet.SourceRectangle, Color.FromNonPremultiplied(255, 255, 255, alpha), 0.0f, Vector2.Zero, 1.0f,
                      _renderProperties.IsFacing(EODirection.Up, EODirection.Right) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                      LayerDepth);
 }