diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs
new file mode 100644
index 00000000..625dc23c
--- /dev/null
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/AnimatedSpriteCollection.cs
@@ -0,0 +1,134 @@
+using CustomNPCFramework.Framework.NPCS;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CustomNPCFramework.Framework.ModularNPCS
+{
+ public class AnimatedSpriteCollection
+ {
+ AnimatedSprite leftSprite;
+ AnimatedSprite rightSprite;
+ AnimatedSprite upSprite;
+ AnimatedSprite downSprite;
+
+ public AnimatedSprite currentSprite;
+
+ ///
+ /// Constructor.
+ ///
+ /// Left animated sprite for this piece.
+ /// Right animated sprite for this piece.
+ /// Up animated sprite for this piece.
+ /// Down animated sprite for this piece.
+ ///
+ public AnimatedSpriteCollection(AnimatedSprite LeftSprite,AnimatedSprite RightSprite,AnimatedSprite UpSprite,AnimatedSprite DownSprite,Direction startingSpriteDirection)
+ {
+ this.leftSprite = LeftSprite;
+ this.rightSprite = RightSprite;
+ this.upSprite = UpSprite;
+ this.downSprite = DownSprite;
+ if (startingSpriteDirection == Direction.down)
+ {
+ setDown();
+ }
+ if (startingSpriteDirection == Direction.left)
+ {
+ setLeft();
+ }
+ if (startingSpriteDirection == Direction.right)
+ {
+ setRight();
+ }
+ if (startingSpriteDirection == Direction.up)
+ {
+ setUp();
+ }
+ }
+
+ ///
+ /// Sets the current
+ ///
+ public void setLeft()
+ {
+ this.currentSprite = leftSprite;
+ }
+
+ public void setRight()
+ {
+ this.currentSprite = rightSprite;
+ }
+
+ public void setDown()
+ {
+ this.currentSprite = downSprite;
+ }
+
+ public void setUp()
+ {
+ this.currentSprite = upSprite;
+ }
+
+ ///
+ /// Used to draw the sprite to the screen.
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
+ {
+ b.Draw(this.currentSprite.Texture, screenPosition, new Rectangle?(this.currentSprite.sourceRect), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, this.currentSprite.currentAnimation == null || !this.currentSprite.currentAnimation[this.currentSprite.currentAnimationIndex].flip ? SpriteEffects.None : SpriteEffects.FlipHorizontally, layerDepth);
+ }
+
+ ///
+ /// Used to draw the sprite to the screen.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth, int xOffset, int yOffset, Color c, bool flip = false, float scale = 1f, float rotation = 0.0f, bool characterSourceRectOffset = false)
+ {
+ b.Draw(this.currentSprite.Texture, screenPosition, new Rectangle?(new Rectangle(this.currentSprite.sourceRect.X + xOffset, this.currentSprite.sourceRect.Y + yOffset, this.currentSprite.sourceRect.Width, this.currentSprite.sourceRect.Height)), c, rotation, characterSourceRectOffset ? new Vector2((float)(this.currentSprite.spriteWidth / 2), (float)((double)this.currentSprite.spriteHeight * 3.0 / 4.0)) : Vector2.Zero, scale, flip || this.currentSprite.currentAnimation != null && this.currentSprite.currentAnimation[this.currentSprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
+ }
+
+ ///
+ /// A very verbose asset drawer.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle,Color color, float alpha,Vector2 origin,float scale,SpriteEffects effects,float layerDepth)
+ {
+ b.Draw(this.currentSprite.Texture,position,sourceRectangle, color* alpha, npc.rotation, origin,scale,effects,layerDepth);
+ //b.Draw(this.Sprite.Texture, npc.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
+ }
+
+ ///
+ /// Animate the current sprite. Theoreticlly works from index offset to how many frames
+ ///
+ ///
+ public void Animate(float intervalFromCharacter)
+ {
+ this.currentSprite.Animate(Game1.currentGameTime, 0, 3, intervalFromCharacter);
+ }
+ }
+}
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimation.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimation.cs
new file mode 100644
index 00000000..1eeb06b3
--- /dev/null
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimation.cs
@@ -0,0 +1,184 @@
+using CustomNPCFramework.Framework.NPCS;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CustomNPCFramework.Framework.ModularNPCS
+{
+ public class CharacterAnimation
+ {
+ public AnimatedSpriteCollection hair;
+ public AnimatedSpriteCollection body;
+ public AnimatedSpriteCollection eyes;
+ public AnimatedSpriteCollection shirt;
+ public AnimatedSpriteCollection pants;
+ public AnimatedSpriteCollection shoes;
+ public List accessories;
+
+ public CharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List accessoriesWithAnimations)
+ {
+ this.body = bodyAnimation;
+ this.hair = hairAnimation;
+ this.eyes = eyeAnimation;
+ this.shirt = shirtAnimation;
+ this.pants = pantsAnimation;
+ this.shoes = shoesAnimation;
+ this.accessories = accessoriesWithAnimations;
+ }
+
+ public void setLeft()
+ {
+ this.body.setLeft();
+ this.hair.setLeft();
+ this.eyes.setLeft();
+ this.shirt.setLeft();
+ this.pants.setLeft();
+ this.shoes.setLeft();
+
+ foreach(var accessory in this.accessories)
+ {
+ accessory.setLeft();
+ }
+ }
+ public void setRight()
+ {
+ this.body.setRight();
+ this.hair.setRight();
+ this.eyes.setRight();
+ this.shirt.setRight();
+ this.pants.setRight();
+ this.shoes.setRight();
+
+ foreach (var accessory in this.accessories)
+ {
+ accessory.setRight();
+ }
+ }
+ public void setUp()
+ {
+ this.body.setUp();
+ this.hair.setUp();
+ this.eyes.setUp();
+ this.shirt.setUp();
+ this.pants.setUp();
+ this.shoes.setUp();
+
+ foreach (var accessory in this.accessories)
+ {
+ accessory.setUp();
+ }
+ }
+ public void setDown()
+ {
+ this.body.setDown();
+ this.hair.setDown();
+ this.eyes.setDown();
+ this.shirt.setDown();
+ this.pants.setDown();
+ this.shoes.setDown();
+
+ foreach (var accessory in this.accessories)
+ {
+ accessory.setDown();
+ }
+ }
+
+ public void Animate(float animationInterval)
+ {
+ this.body.Animate(animationInterval);
+ this.hair.Animate(animationInterval);
+ this.eyes.Animate(animationInterval);
+ this.shirt.Animate(animationInterval);
+ this.pants.Animate(animationInterval);
+ this.shoes.Animate(animationInterval);
+ foreach(var accessory in this.accessories)
+ {
+ accessory.Animate(animationInterval);
+ }
+
+ }
+
+ ///
+ /// Used to draw the sprite to the screen.
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
+ {
+ this.body.draw(b,screenPosition,layerDepth);
+ this.hair.draw(b, screenPosition, layerDepth);
+ this.eyes.draw(b, screenPosition, layerDepth);
+ this.shirt.draw(b, screenPosition, layerDepth);
+ this.pants.draw(b, screenPosition, layerDepth);
+ this.shoes.draw(b, screenPosition, layerDepth);
+ foreach (var accessory in this.accessories)
+ {
+ accessory.draw(b, screenPosition, layerDepth);
+ }
+ //b.Draw(this.currentSprite.Texture, screenPosition, new Rectangle?(this.currentSprite.sourceRect), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, this.currentSprite.currentAnimation == null || !this.currentSprite.currentAnimation[this.currentSprite.currentAnimationIndex].flip ? SpriteEffects.None : SpriteEffects.FlipHorizontally, layerDepth);
+ }
+
+
+
+ ///
+ /// Used to draw the sprite to the screen.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth, int xOffset, int yOffset, Color c, bool flip = false, float scale = 1f, float rotation = 0.0f, bool characterSourceRectOffset = false)
+ {
+ // b.Draw(this.currentSprite.Texture, screenPosition, new Rectangle?(new Rectangle(this.currentSprite.sourceRect.X + xOffset, this.currentSprite.sourceRect.Y + yOffset, this.currentSprite.sourceRect.Width, this.currentSprite.sourceRect.Height)), c, rotation, characterSourceRectOffset ? new Vector2((float)(this.currentSprite.spriteWidth / 2), (float)((double)this.currentSprite.spriteHeight * 3.0 / 4.0)) : Vector2.Zero, scale, flip || this.currentSprite.currentAnimation != null && this.currentSprite.currentAnimation[this.currentSprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
+ this.body.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ this.hair.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ this.eyes.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ this.shirt.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ this.pants.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ this.shoes.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ foreach(var accessory in this.accessories)
+ {
+ accessory.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ }
+ }
+
+ ///
+ /// A very verbose asset drawer.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle, Color color, float alpha, Vector2 origin, float scale, SpriteEffects effects, float layerDepth)
+ {
+ this.body.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ this.hair.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ this.eyes.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ this.shirt.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ this.pants.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ this.shoes.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ foreach(var accessory in this.accessories)
+ {
+ accessory.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ }
+ }
+
+ }
+}
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Direction.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Direction.cs
new file mode 100644
index 00000000..e34d3623
--- /dev/null
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/Direction.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CustomNPCFramework.Framework.ModularNPCS
+{
+ public enum Direction
+ {
+ up,
+ right,
+ down,
+ left
+ }
+}
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs
new file mode 100644
index 00000000..502b540a
--- /dev/null
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/AnimationKeys.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
+{
+ class AnimationKeys
+ {
+ public static string standingKey = "standing";
+ public static string walkingKey = "walking";
+ public static string sittingKey = "sitting";
+ public static string swimmingKey = "swimming";
+ }
+}
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs
new file mode 100644
index 00000000..7a6c7733
--- /dev/null
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs
@@ -0,0 +1,136 @@
+using CustomNPCFramework.Framework.NPCS;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers
+{
+ public class BasicRenderer
+ {
+ public Dictionary animationList;
+ public CharacterAnimation currentAnimation;
+
+ public BasicRenderer(CharacterAnimation standingAnimation,CharacterAnimation walkingAnimation, CharacterAnimation swimmingAnimation)
+ {
+ animationList = new Dictionary();
+ animationList.Add(AnimationKeys.standingKey, standingAnimation);
+ animationList.Add(AnimationKeys.walkingKey, walkingAnimation);
+ animationList.Add(AnimationKeys.swimmingKey, swimmingAnimation);
+ setAnimation(AnimationKeys.standingKey);
+ }
+
+ ///
+ /// Sets the animation associated with the key name; If it fails the npc will just default to standing.
+ ///
+ ///
+ public virtual void setAnimation(string key)
+ {
+ this.currentAnimation = animationList[key];
+ if (this.currentAnimation == null) this.setAnimation(AnimationKeys.standingKey);
+ }
+
+ public virtual void setDirection(int facingDirection)
+ {
+ if (facingDirection == 0) setUp();
+ if (facingDirection == 1) setRight();
+ if (facingDirection == 2) setDown();
+ if (facingDirection == 2) setLeft();
+ }
+
+ public virtual void setLeft()
+ {
+ this.currentAnimation.setLeft();
+ }
+
+ public virtual void setRight()
+ {
+ this.currentAnimation.setRight();
+ }
+
+ public virtual void setUp()
+ {
+ this.currentAnimation.setUp();
+ }
+
+ public virtual void setDown()
+ {
+ this.currentAnimation.setDown();
+ }
+
+ ///
+ /// Used to draw the sprite to the screen.
+ ///
+ ///
+ ///
+ ///
+ public virtual void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth)
+ {
+ this.currentAnimation.draw(b, screenPosition, layerDepth);
+ }
+
+ ///
+ /// Used to draw the sprite to the screen.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual void draw(SpriteBatch b, Vector2 screenPosition, float layerDepth, int xOffset, int yOffset, Color c, bool flip = false, float scale = 1f, float rotation = 0.0f, bool characterSourceRectOffset = false)
+ {
+ this.currentAnimation.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset);
+ }
+
+ ///
+ /// A very verbose asset drawer.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, ExtendedNPC npc, Vector2 position, Rectangle sourceRectangle, Color color, float alpha, Vector2 origin, float scale, SpriteEffects effects, float layerDepth)
+ {
+ this.currentAnimation.draw(b, npc, position, sourceRectangle, color, alpha, origin, scale, effects, layerDepth);
+ }
+
+
+ public virtual void Animate(float interval)
+ {
+ this.currentAnimation.Animate(interval);
+ }
+
+
+ ///
+ /// Wrapper for a draw function that accepts rectangles to be null.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void draw(SpriteBatch b, ExtendedNPC extendedNPC, Vector2 vector21, Rectangle? v1, Color white, float rotation, Vector2 vector22, float v2, SpriteEffects spriteEffects, float v3)
+ {
+ this.draw(b, extendedNPC, vector21, v1, white, rotation, vector22, v2, spriteEffects, v3);
+ }
+ }
+}
diff --git a/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs b/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs
index 6c68eada..1899871f 100644
--- a/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs
@@ -1,4 +1,5 @@
-using Microsoft.Xna.Framework;
+using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers;
+using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Characters;
@@ -14,8 +15,9 @@ using xTile.Tiles;
namespace CustomNPCFramework.Framework.NPCS
{
- class ExtendedNPC :StardewValley.NPC
+ public class ExtendedNPC :StardewValley.NPC
{
+ public BasicRenderer characterRenderer;
public ExtendedNPC() :base()
{
@@ -158,6 +160,11 @@ namespace CustomNPCFramework.Framework.NPCS
}
}
+ ///
+ /// Used to draw the npc with the custom renderer.
+ ///
+ ///
+ ///
public override void draw(SpriteBatch b, float alpha = 1f)
{
if (this.sprite == null || this.isInvisible || !Utility.isOnScreen(this.position, 2 * Game1.tileSize))
@@ -165,13 +172,15 @@ namespace CustomNPCFramework.Framework.NPCS
//Checks if the npc is swimming. If not draw it's default graphic. Do characters aside from Farmer and Penny Swim???
if (this.swimming)
{
- b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize + Game1.tileSize / 4 + this.yJumpOffset * 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero) - new Vector2(0.0f, this.yOffset), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.sprite.SourceRect.X, this.sprite.SourceRect.Y, this.sprite.SourceRect.Width, this.sprite.SourceRect.Height / 2 - (int)((double)this.yOffset / (double)Game1.pixelZoom))), Color.White, this.rotation, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 3 / 2)) / 4f, Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
- Vector2 localPosition = this.getLocalPosition(Game1.viewport);
- b.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle((int)localPosition.X + (int)this.yOffset + Game1.pixelZoom * 2, (int)localPosition.Y - 32 * Game1.pixelZoom + this.sprite.SourceRect.Height * Game1.pixelZoom + Game1.tileSize * 3 / 4 + this.yJumpOffset * 2 - (int)this.yOffset, this.sprite.SourceRect.Width * Game1.pixelZoom - (int)this.yOffset * 2 - Game1.pixelZoom * 4, Game1.pixelZoom), new Microsoft.Xna.Framework.Rectangle?(Game1.staminaRect.Bounds), Color.White * 0.75f, 0.0f, Vector2.Zero, SpriteEffects.None, (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0));
+ this.characterRenderer.setAnimation(AnimationKeys.swimmingKey);
+ this.characterRenderer.setDirection(this.facingDirection);
+ this.characterRenderer.draw(b,this,this.getLocalPosition(Game1.viewport) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize + Game1.tileSize / 4 + this.yJumpOffset * 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero) - new Vector2(0.0f, this.yOffset), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(this.sprite.SourceRect.X, this.sprite.SourceRect.Y, this.sprite.SourceRect.Width, this.sprite.SourceRect.Height / 2 - (int)((double)this.yOffset / (double)Game1.pixelZoom))), Color.White, this.rotation, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 3 / 2)) / 4f, Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
+ //Vector2 localPosition = this.getLocalPosition(Game1.viewport);
+ //b.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle((int)localPosition.X + (int)this.yOffset + Game1.pixelZoom * 2, (int)localPosition.Y - 32 * Game1.pixelZoom + this.sprite.SourceRect.Height * Game1.pixelZoom + Game1.tileSize * 3 / 4 + this.yJumpOffset * 2 - (int)this.yOffset, this.sprite.SourceRect.Width * Game1.pixelZoom - (int)this.yOffset * 2 - Game1.pixelZoom * 4, Game1.pixelZoom), new Microsoft.Xna.Framework.Rectangle?(Game1.staminaRect.Bounds), Color.White * 0.75f, 0.0f, Vector2.Zero, SpriteEffects.None, (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0));
}
else
{
- b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
+ this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + new Vector2((float)(this.sprite.spriteWidth * Game1.pixelZoom / 2), (float)(this.GetBoundingBox().Height / 2)) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(this.Sprite.SourceRect), Color.White * alpha, this.rotation, new Vector2((float)(this.sprite.spriteWidth / 2), (float)((double)this.sprite.spriteHeight * 3.0 / 4.0)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom, this.flip || this.sprite.currentAnimation != null && this.sprite.currentAnimation[this.sprite.currentAnimationIndex].flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.991f : (float)this.getStandingY() / 10000f));
}
//If the npc breathes then this code is ran.
if (this.breather && this.shakeTimer <= 0 && (!this.swimming && this.sprite.CurrentFrame < 16) && !this.farmerPassesThrough)
@@ -195,7 +204,7 @@ namespace CustomNPCFramework.Framework.NPCS
sourceRect.Height /= 2;
}
float num = Math.Max(0.0f, (float)(Math.Ceiling(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 600.0 + (double)this.DefaultPosition.X * 20.0)) / 4.0));
- b.Draw(this.Sprite.Texture, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
+ this.characterRenderer.draw(b,this, this.getLocalPosition(Game1.viewport) + vector2 + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(sourceRect), Color.White * alpha, this.rotation, new Vector2((float)(sourceRect.Width / 2), (float)(sourceRect.Height / 2 + 1)), Math.Max(0.2f, this.scale) * (float)Game1.pixelZoom + num, this.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0.0f, this.drawOnTop ? 0.992f : (float)((double)this.getStandingY() / 10000.0 + 1.0 / 1000.0)));
}
//Checks if the npc is glowing.