Fixed modular npc breathing.

This commit is contained in:
2018-03-18 03:20:06 -07:00
parent bd6e479b4f
commit 5c1f09b266
7 changed files with 136 additions and 31 deletions

View File

@ -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.
/// </summary>
@ -110,7 +111,7 @@ namespace CustomNPCFramework
/// <param name="e"></param>
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<Item>()
{
new StardewValley.Object(475,999)

View File

@ -59,6 +59,7 @@
<Compile Include="Framework\ModularNPCS\CharacterAnimationBases\StandardCharacterAnimation.cs" />
<Compile Include="Framework\ModularNPCS\CharacterAnimationBases\CharacterAnimationBase.cs" />
<Compile Include="Framework\Enums\Direction.cs" />
<Compile Include="Framework\ModularNPCS\ColorCollections\StandardColorCollection.cs" />
<Compile Include="Framework\ModularNPCS\ModularRenderers\AnimationKeys.cs" />
<Compile Include="Framework\ModularNPCS\ModularRenderers\BasicRenderer.cs" />
<Compile Include="Framework\ModularNPCS\Portrait.cs" />

View File

@ -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<NamePairings> AccessoriesSprites)
public StandardCharacterAnimation GetStandardCharacterAnimation(NamePairings BodySprites, NamePairings EyeSprites, NamePairings HairSprites, NamePairings ShirtsSprites, NamePairings PantsSprites, NamePairings ShoesSprites,List<NamePairings> 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<AssetSheet> getListOfApplicableBodyParts(string assetManagerName,Genders gender, Seasons season, PartType type)
@ -150,7 +152,7 @@ namespace CustomNPCFramework.Framework.Graphics
/// <param name="gender"></param>
/// <param name="minNumOfAccessories"></param>
/// <param name="maxNumOfAccessories"></param>
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<AssetSheet> accessorySheet)
public virtual BasicRenderer generateBasicRenderer(AssetSheet bodySheet, AssetSheet eyesSheet, AssetSheet hairSheet, AssetSheet shirtSheet, AssetSheet pantsSheet, AssetSheet shoesSheet, List<AssetSheet> 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<AssetSheet> accessories, AnimationType animationType)
public virtual StandardCharacterAnimation generateCharacterAnimation(AssetSheet body, AssetSheet eyes, AssetSheet hair, AssetSheet shirt, AssetSheet pants, AssetSheet shoes,List<AssetSheet> 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;
}

View File

@ -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<AnimatedSpriteCollection> accessories;
public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List<AnimatedSpriteCollection> accessoriesWithAnimations) :base()
public StandardCharacterAnimation(AnimatedSpriteCollection bodyAnimation, AnimatedSpriteCollection eyeAnimation, AnimatedSpriteCollection hairAnimation, AnimatedSpriteCollection shirtAnimation, AnimatedSpriteCollection pantsAnimation, AnimatedSpriteCollection shoesAnimation,List<AnimatedSpriteCollection> 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);

View File

@ -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
{
/// <summary>
/// Collection of colors to be used for the StandardCharacterAnimation object.
/// </summary>
public class StandardColorCollection
{
public Color bodyColor;
public Color eyeColor;
public Color hairColor;
public Color shirtColor;
public Color bottomsColor;
public Color shoesColor;
/// <summary>
/// Default constrctor that sets all of the draw colors to white.
/// </summary>
public StandardColorCollection()
{
defaultColor(this.bodyColor);
defaultColor(this.eyeColor);
defaultColor(this.hairColor);
defaultColor(this.shirtColor);
defaultColor(this.bottomsColor);
defaultColor(this.shoesColor);
}
/// <summary>
/// Constructor that takes different colors as parameters.
/// </summary>
/// <param name="BodyColor">Color for the body texture.</param>
/// <param name="EyeColor">Color for the eyes texture.</param>
/// <param name="HairColor">Color for the hair texture.</param>
/// <param name="ShirtColor">Color for the shirt texture.</param>
/// <param name="BottomsColor">Color for the bottoms texture.</param>
/// <param name="ShoesColor">Color for the shoes texture.</param>
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);
}
/// <summary>
/// If a color is null, make it white.
/// </summary>
/// <param name="color"></param>
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;
}
}
}

View File

@ -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
/// <param name="layerDepth"></param>
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
/// <param name="v2"></param>
/// <param name="spriteEffects"></param>
/// <param name="v3"></param>
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);
}
}
}

View File

@ -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)