From 5c1f09b266d9fef91f8262f3fca375c9030a2f6a Mon Sep 17 00:00:00 2001 From: Date: Sun, 18 Mar 2018 03:20:06 -0700 Subject: [PATCH] Fixed modular npc breathing. --- GeneralMods/CustomNPCFramework/Class1.cs | 5 +- .../CustomNPCFramework.csproj | 1 + .../Framework/Graphics/AssetPool.cs | 26 +++--- .../StandardCharacterAnimation.cs | 42 ++++++---- .../StandardColorCollection.cs | 79 +++++++++++++++++++ .../ModularRenderers/BasicRenderer.cs | 6 +- .../Framework/NPCS/ExtendedNPC.cs | 8 +- 7 files changed, 136 insertions(+), 31 deletions(-) create mode 100644 GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs diff --git a/GeneralMods/CustomNPCFramework/Class1.cs b/GeneralMods/CustomNPCFramework/Class1.cs index f1ef0889..46756808 100644 --- a/GeneralMods/CustomNPCFramework/Class1.cs +++ b/GeneralMods/CustomNPCFramework/Class1.cs @@ -2,6 +2,7 @@ using CustomNPCFramework.Framework.Graphics; using CustomNPCFramework.Framework.ModularNPCS; using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases; +using CustomNPCFramework.Framework.ModularNPCS.ColorCollections; using CustomNPCFramework.Framework.NPCS; using CustomNPCFramework.Framework.Utilities; using Microsoft.Xna.Framework; @@ -37,8 +38,8 @@ namespace CustomNPCFramework /// Load in the assets and go go go. /// -Collect a bunch of assets together to test this thing. /// - /// Fix modular npc breathing. /// Find way to make sideways shirts render correctly. + /// @@ -110,7 +111,7 @@ namespace CustomNPCFramework /// private void SaveEvents_LoadChar(object sender, EventArgs e) { - ExtendedNPC myNpc3 = assetPool.generateNPC(Genders.female, 0, 1); + ExtendedNPC myNpc3 = assetPool.generateNPC(Genders.female, 0, 1,new StandardColorCollection(null, null, Color.Blue, null, Color.Yellow, null)); MerchantNPC merch = new MerchantNPC(new List() { new StardewValley.Object(475,999) diff --git a/GeneralMods/CustomNPCFramework/CustomNPCFramework.csproj b/GeneralMods/CustomNPCFramework/CustomNPCFramework.csproj index 5562b56b..493eaf25 100644 --- a/GeneralMods/CustomNPCFramework/CustomNPCFramework.csproj +++ b/GeneralMods/CustomNPCFramework/CustomNPCFramework.csproj @@ -59,6 +59,7 @@ + diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs index 2b7a1e3a..bbac2c21 100644 --- a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs +++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs @@ -2,6 +2,7 @@ using CustomNPCFramework.Framework.Enums; using CustomNPCFramework.Framework.ModularNPCS; using CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases; +using CustomNPCFramework.Framework.ModularNPCS.ColorCollections; using CustomNPCFramework.Framework.ModularNPCS.ModularRenderers; using CustomNPCFramework.Framework.NPCS; using StardewValley; @@ -121,7 +122,7 @@ namespace CustomNPCFramework.Framework.Graphics return getAnimatedSpriteCollectionFromAssets(pair.leftString, pair.rightString, pair.upString, pair.downString); } - public StandardCharacterAnimation GetStandardCharacterAnimation(NamePairings BodySprites, NamePairings EyeSprites, NamePairings HairSprites, NamePairings ShirtsSprites, NamePairings PantsSprites, NamePairings ShoesSprites,List AccessoriesSprites) + public StandardCharacterAnimation GetStandardCharacterAnimation(NamePairings BodySprites, NamePairings EyeSprites, NamePairings HairSprites, NamePairings ShirtsSprites, NamePairings PantsSprites, NamePairings ShoesSprites,List AccessoriesSprites,StandardColorCollection DrawColors=null) { var body = getAnimatedSpriteCollectionFromAssets(BodySprites); var eyes = getAnimatedSpriteCollectionFromAssets(EyeSprites); @@ -134,7 +135,8 @@ namespace CustomNPCFramework.Framework.Graphics { accessories.Add(getAnimatedSpriteCollectionFromAssets(v)); } - return new StandardCharacterAnimation(body,eyes,hair,shirts,pants,shoes,accessories); + if (DrawColors == null) DrawColors = new StandardColorCollection(); + return new StandardCharacterAnimation(body,eyes,hair,shirts,pants,shoes,accessories,DrawColors); } public List getListOfApplicableBodyParts(string assetManagerName,Genders gender, Seasons season, PartType type) @@ -150,7 +152,7 @@ namespace CustomNPCFramework.Framework.Graphics /// /// /// - public ExtendedNPC generateNPC(Genders gender, int minNumOfAccessories, int maxNumOfAccessories) + public ExtendedNPC generateNPC(Genders gender, int minNumOfAccessories, int maxNumOfAccessories, StandardColorCollection DrawColors=null) { Seasons myseason=Seasons.spring; @@ -291,27 +293,28 @@ namespace CustomNPCFramework.Framework.Graphics { accessorySheet.Add(accessoryList.ElementAt(v)); } - - var render = generateBasicRenderer(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet); + if (DrawColors == null) DrawColors = new StandardColorCollection(); + var render = generateBasicRenderer(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet,DrawColors); ExtendedNPC npc = new ExtendedNPC(new Sprite(getDefaultSpriteImage(bodySheet)), render, new Microsoft.Xna.Framework.Vector2(13, 15) * Game1.tileSize, 2, NPCNames.getRandomNPCName(gender)); return npc; } - public virtual BasicRenderer generateBasicRenderer(AssetSheet bodySheet, AssetSheet eyesSheet, AssetSheet hairSheet, AssetSheet shirtSheet, AssetSheet pantsSheet, AssetSheet shoesSheet, List accessorySheet) + public virtual BasicRenderer generateBasicRenderer(AssetSheet bodySheet, AssetSheet eyesSheet, AssetSheet hairSheet, AssetSheet shirtSheet, AssetSheet pantsSheet, AssetSheet shoesSheet, List accessorySheet, StandardColorCollection DrawColors=null) { + if (DrawColors == null) DrawColors = new StandardColorCollection(); //Get all of the appropriate animations. AnimationType type = AnimationType.standing; - var standingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type); + var standingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type,DrawColors); type = AnimationType.walking; - var movingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type); + var movingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type,DrawColors); type = AnimationType.swimming; - var swimmingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type); + var swimmingAnimation = generateCharacterAnimation(bodySheet, eyesSheet, hairSheet, shirtSheet, pantsSheet, shoesSheet, accessorySheet, type,DrawColors); BasicRenderer render = new BasicRenderer(standingAnimation, movingAnimation, swimmingAnimation); return render; } - public virtual StandardCharacterAnimation generateCharacterAnimation(AssetSheet body, AssetSheet eyes, AssetSheet hair, AssetSheet shirt, AssetSheet pants, AssetSheet shoes,List accessories, AnimationType animationType) + public virtual StandardCharacterAnimation generateCharacterAnimation(AssetSheet body, AssetSheet eyes, AssetSheet hair, AssetSheet shirt, AssetSheet pants, AssetSheet shoes,List accessories, AnimationType animationType, StandardColorCollection DrawColors=null) { var bodySprite = getSpriteCollectionFromSheet(body, animationType); var eyesSprite = getSpriteCollectionFromSheet(eyes, animationType); @@ -325,7 +328,8 @@ namespace CustomNPCFramework.Framework.Graphics AnimatedSpriteCollection acc = getSpriteCollectionFromSheet(v, AnimationType.standing); accessoryCollection.Add(acc); } - StandardCharacterAnimation standingAnimation = new StandardCharacterAnimation(bodySprite, eyesSprite, hairSprite, shirtSprite, pantsSprite, shoesSprite, accessoryCollection); + if (DrawColors == null) DrawColors = new StandardColorCollection(); + StandardCharacterAnimation standingAnimation = new StandardCharacterAnimation(bodySprite, eyesSprite, hairSprite, shirtSprite, pantsSprite, shoesSprite, accessoryCollection,DrawColors); return standingAnimation; } diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs index c94853f6..1504f3b8 100644 --- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs +++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/StandardCharacterAnimation.cs @@ -1,4 +1,5 @@ -using CustomNPCFramework.Framework.NPCS; +using CustomNPCFramework.Framework.ModularNPCS.ColorCollections; +using CustomNPCFramework.Framework.NPCS; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewValley; @@ -18,9 +19,10 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases public AnimatedSpriteCollection shirt; public AnimatedSpriteCollection pants; public AnimatedSpriteCollection shoes; + public StandardColorCollection drawColors; public List accessories; - public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List accessoriesWithAnimations) :base() + public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List accessoriesWithAnimations, StandardColorCollection DrawColors) :base() { this.body = bodyAnimation; this.hair = hairAnimation; @@ -29,6 +31,7 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases this.pants = pantsAnimation; this.shoes = shoesAnimation; this.accessories = accessoriesWithAnimations; + this.drawColors = DrawColors; } public override void setLeft() @@ -152,12 +155,12 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases public override 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); + this.body.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c,this.drawColors.bodyColor), flip, scale, rotation, characterSourceRectOffset); + this.hair.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.hairColor), flip, scale, rotation, characterSourceRectOffset); + this.eyes.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.eyeColor), flip, scale, rotation, characterSourceRectOffset); + this.shirt.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.shirtColor), flip, scale, rotation, characterSourceRectOffset); + this.pants.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.bottomsColor), flip, scale, rotation, characterSourceRectOffset); + this.shoes.draw(b, screenPosition, layerDepth, xOffset, yOffset, StandardColorCollection.colorMult(c, this.drawColors.shoesColor), flip, scale, rotation, characterSourceRectOffset); foreach(var accessory in this.accessories) { accessory.draw(b, screenPosition, layerDepth, xOffset, yOffset, c, flip, scale, rotation, characterSourceRectOffset); @@ -183,12 +186,23 @@ namespace CustomNPCFramework.Framework.ModularNPCS.CharacterAnimationBases Vector2 generalOffset = new Vector2(0, 1*Game1.tileSize); //Puts the sprite at the correct positioning. float smallOffset = 0.001f; float tinyOffset = 0.0001f; - this.body.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset); - this.eyes.draw(b, npc, position - generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset *1)); - this.hair.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset *2)); - this.shirt.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset*3)); - this.pants.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset*4)); - this.shoes.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth + smallOffset+(tinyOffset*5)); + //Class1.ModMonitor.Log((position - generalOffset).ToString()); + float num = Math.Max(0.0f, (float)(Math.Ceiling(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 600.0 + (double)npc.DefaultPosition.X * 20.0)) / 4.0)); + this.body.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.bodyColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset); + this.eyes.draw(b, npc, position - generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.eyeColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset *1)); + this.hair.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.hairColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset *2)); + + if (num > 0.0f) + { + Vector2 shirtOffset = new Vector2((1 * Game1.tileSize) / 4, (1 * Game1.tileSize) / 4); + this.shirt.draw(b, npc, position - generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.shirtColor), alpha, new Vector2(0.5f,1), scale * Game1.pixelZoom + num, effects, layerDepth + smallOffset + (tinyOffset * 3)); + } + else + { + this.shirt.draw(b, npc, position - generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.shirtColor), alpha, origin, scale * Game1.pixelZoom, effects, layerDepth + smallOffset + (tinyOffset * 3)); + } + this.pants.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.bottomsColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset*4)); + this.shoes.draw(b, npc, position-generalOffset, sourceRectangle, StandardColorCollection.colorMult(color, this.drawColors.shoesColor), alpha, origin, scale*Game1.pixelZoom, effects, layerDepth + smallOffset+(tinyOffset*5)); foreach(var accessory in this.accessories) { accessory.draw(b, npc, position-generalOffset, sourceRectangle, color, alpha, origin, scale, effects, layerDepth +0.0006f); diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs new file mode 100644 index 00000000..52d6a073 --- /dev/null +++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ColorCollections/StandardColorCollection.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CustomNPCFramework.Framework.ModularNPCS.ColorCollections +{ + /// + /// Collection of colors to be used for the StandardCharacterAnimation object. + /// + public class StandardColorCollection + { + public Color bodyColor; + public Color eyeColor; + public Color hairColor; + public Color shirtColor; + public Color bottomsColor; + public Color shoesColor; + + /// + /// Default constrctor that sets all of the draw colors to white. + /// + public StandardColorCollection() + { + defaultColor(this.bodyColor); + defaultColor(this.eyeColor); + defaultColor(this.hairColor); + defaultColor(this.shirtColor); + defaultColor(this.bottomsColor); + defaultColor(this.shoesColor); + } + + /// + /// Constructor that takes different colors as parameters. + /// + /// Color for the body texture. + /// Color for the eyes texture. + /// Color for the hair texture. + /// Color for the shirt texture. + /// Color for the bottoms texture. + /// Color for the shoes texture. + public StandardColorCollection(Color? BodyColor, Color? EyeColor, Color? HairColor, Color? ShirtColor, Color? BottomsColor, Color? ShoesColor) + { + this.bodyColor = (Color)BodyColor.GetValueOrDefault(Color.White); + this.eyeColor = (Color)EyeColor.GetValueOrDefault(Color.White); + this.hairColor = (Color)HairColor.GetValueOrDefault(Color.White); + this.shirtColor = (Color)ShirtColor.GetValueOrDefault(Color.White); + this.bottomsColor = (Color)BottomsColor.GetValueOrDefault(Color.White); + this.shoesColor = (Color)ShoesColor.GetValueOrDefault(Color.White); + + defaultColor(this.bodyColor); + defaultColor(this.eyeColor); + defaultColor(this.hairColor); + defaultColor(this.shirtColor); + defaultColor(this.bottomsColor); + defaultColor(this.shoesColor); + } + + /// + /// If a color is null, make it white. + /// + /// + public void defaultColor(Color color) + { + if (color == null) color = Color.White; + } + + public static Color colorMult(Color cBase, Color cMult) + { + Vector3 color1 = cBase.ToVector3(); + Vector3 color2 = cMult.ToVector3(); + Vector3 mixColor = color1 * color2; + Color value = new Color(mixColor); + return value; + } + } +} diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs index 02a76460..d266ec1b 100644 --- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs +++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/ModularRenderers/BasicRenderer.cs @@ -2,6 +2,7 @@ using CustomNPCFramework.Framework.NPCS; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using StardewValley; using System; using System.Collections.Generic; using System.Linq; @@ -114,6 +115,7 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers /// public virtual 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); } @@ -137,9 +139,9 @@ namespace CustomNPCFramework.Framework.ModularNPCS.ModularRenderers /// /// /// - public virtual void draw(SpriteBatch b, ExtendedNPC extendedNPC, Vector2 position, Rectangle? v1, Color white, float rotation, Vector2 origin, float v2, SpriteEffects spriteEffects, float v3) + public virtual void draw(SpriteBatch b, ExtendedNPC extendedNPC, Vector2 position, Rectangle? v1, Color white, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float v3) { - this.draw(b, extendedNPC, position, new Rectangle(0,0,16,32), white, rotation, origin, v2, spriteEffects, v3); + this.draw(b, extendedNPC, position, new Rectangle(0,0,16,32), white, rotation, origin, scale, spriteEffects, v3); } } } diff --git a/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs b/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs index e52a2d48..45e1a42a 100644 --- a/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs +++ b/GeneralMods/CustomNPCFramework/Framework/NPCS/ExtendedNPC.cs @@ -456,12 +456,16 @@ namespace CustomNPCFramework.Framework.NPCS vector2.Y -= (float)Game1.pixelZoom; 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)); //The actual character drawing to the screen? - this.characterRenderer.draw(b, this, this.getLocalPosition(Game1.viewport) + (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,Vector2.Zero, 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) + (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,Vector2.Zero, Math.Max(0.2f, this.scale), 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))); //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, .99f); } + else + { + //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)); + this.characterRenderer.draw(b, this, this.getLocalPosition(Game1.viewport) + (this.shakeTimer > 0 ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle()), Color.White * alpha, this.rotation, Vector2.Zero, Math.Max(0.2f, this.scale), 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. if (this.isGlowing)