summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StardewModdingAPI/Constants.cs2
-rw-r--r--src/StardewModdingAPI/Extensions.cs4
-rw-r--r--src/StardewModdingAPI/FodyWeavers.xml9
-rw-r--r--src/StardewModdingAPI/Inheritance/SGame.cs713
4 files changed, 365 insertions, 363 deletions
diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs
index 0dd387b3..2bb7930e 100644
--- a/src/StardewModdingAPI/Constants.cs
+++ b/src/StardewModdingAPI/Constants.cs
@@ -62,6 +62,6 @@ namespace StardewModdingAPI
/// <summary>
/// Completely overrides the base game's draw call to the one is SGame
/// </summary>
- public static bool EnableCompletelyOverridingBaseCalls => true;
+ public static bool EnableCompletelyOverridingBaseCalls => false;
}
} \ No newline at end of file
diff --git a/src/StardewModdingAPI/Extensions.cs b/src/StardewModdingAPI/Extensions.cs
index abad6ce2..391e2c8c 100644
--- a/src/StardewModdingAPI/Extensions.cs
+++ b/src/StardewModdingAPI/Extensions.cs
@@ -83,12 +83,12 @@ namespace StardewModdingAPI
public static FieldInfo[] GetPrivateFields(this object o)
{
- return o.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
+ return o.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
}
public static FieldInfo GetBaseFieldInfo(this Type t, string name)
{
- return t.GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
+ return t.GetField(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
}
public static T GetBaseFieldValue<T>(this Type t, object o, string name) where T : class
diff --git a/src/StardewModdingAPI/FodyWeavers.xml b/src/StardewModdingAPI/FodyWeavers.xml
index 2e6d4a7a..0ef30506 100644
--- a/src/StardewModdingAPI/FodyWeavers.xml
+++ b/src/StardewModdingAPI/FodyWeavers.xml
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
- <Costura/>
+ <Costura>
+ <ExcludeAssemblies>
+ Stardew Valley
+ xTile
+ Steamworks.NET
+ Lidgren.Network
+ </ExcludeAssemblies>
+ </Costura>
</Weavers> \ No newline at end of file
diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs
index 9b69434a..f09e7900 100644
--- a/src/StardewModdingAPI/Inheritance/SGame.cs
+++ b/src/StardewModdingAPI/Inheritance/SGame.cs
@@ -219,6 +219,15 @@ namespace StardewModdingAPI.Inheritance
}
/// <summary>
+ /// The current FramesThisSecond in Game1 (Private field, uses reflection)
+ /// </summary>
+ public int FramesThisSecond
+ {
+ get { return (int)typeof(Game1).GetBaseFieldValue<object>(null, "framesThisSecond"); }
+ set { typeof(Game1).SetBaseFieldValue<object>(null, "framesThisSecond", value); }
+ }
+
+ /// <summary>
/// Static accessor for an Instance of the class SGame
/// </summary>
public static SGame Instance { get; private set; }
@@ -852,13 +861,13 @@ namespace StardewModdingAPI.Inheritance
try
{
- if (!ZoomLevelIsOne)
+ if (options.zoomLevel != 1f)
{
- GraphicsDevice.SetRenderTarget(Screen);
+ base.GraphicsDevice.SetRenderTarget(Screen);
}
-
- GraphicsDevice.Clear(BgColour);
- if (options.showMenuBackground && activeClickableMenu != null && activeClickableMenu.showWithoutTransparencyIfOptionIsSet())
+ FramesThisSecond++;
+ base.GraphicsDevice.Clear(BgColour);
+ if ((options.showMenuBackground && (activeClickableMenu != null)) && activeClickableMenu.showWithoutTransparencyIfOptionIsSet())
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
activeClickableMenu.drawBackground(spriteBatch);
@@ -866,467 +875,453 @@ namespace StardewModdingAPI.Inheritance
activeClickableMenu.draw(spriteBatch);
GraphicsEvents.InvokeOnPostRenderGuiEvent(null, EventArgs.Empty);
spriteBatch.End();
- if (!ZoomLevelIsOne)
+ if (options.zoomLevel != 1f)
{
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
+ base.GraphicsDevice.SetRenderTarget(null);
+ base.GraphicsDevice.Clear(BgColour);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
+ spriteBatch.Draw(Screen, Vector2.Zero, new Rectangle?(Screen.Bounds), Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
spriteBatch.End();
}
- return;
}
- if (gameMode == 11)
+ else if (gameMode == 11)
{
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
spriteBatch.DrawString(smoothFont, "Stardew Valley has crashed...", new Vector2(16f, 16f), Color.HotPink);
- spriteBatch.DrawString(smoothFont, "Please send the error report or a screenshot of this message to @ConcernedApe. (http://stardewvalley.net/contact/)", new Vector2(16f, 32f), new Color(0, 255, 0));
+ spriteBatch.DrawString(smoothFont, "Please send the error report or a screenshot of this message to @ConcernedApe. (http://stardewvalley.net/contact/)", new Vector2(16f, 32f), new Color(0, 0xff, 0));
spriteBatch.DrawString(smoothFont, parseText(errorMessage, smoothFont, graphics.GraphicsDevice.Viewport.Width), new Vector2(16f, 48f), Color.White);
spriteBatch.End();
- return;
}
- if (currentMinigame != null)
+ else if (currentMinigame != null)
{
currentMinigame.draw(spriteBatch);
- if (globalFade && !menuUp && (!nameSelectUp || messagePause))
+ if ((globalFade && !menuUp) && (!nameSelectUp || messagePause))
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Black * ((gameMode == 0) ? (1f - fadeToBlackAlpha) : fadeToBlackAlpha));
+ spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, (Color)(Color.Black * ((gameMode == 0) ? (1f - fadeToBlackAlpha) : fadeToBlackAlpha)));
spriteBatch.End();
}
- if (!ZoomLevelIsOne)
+ if (options.zoomLevel != 1f)
{
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
+ base.GraphicsDevice.SetRenderTarget(null);
+ base.GraphicsDevice.Clear(BgColour);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
+ spriteBatch.Draw(Screen, Vector2.Zero, new Rectangle?(Screen.Bounds), Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
spriteBatch.End();
}
- return;
}
- if (showingEndOfNightStuff)
+ else if (showingEndOfNightStuff)
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- activeClickableMenu?.draw(spriteBatch);
+ if (activeClickableMenu != null)
+ {
+ activeClickableMenu.draw(spriteBatch);
+ }
spriteBatch.End();
- if (!ZoomLevelIsOne)
+ if (options.zoomLevel != 1f)
{
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
+ base.GraphicsDevice.SetRenderTarget(null);
+ base.GraphicsDevice.Clear(BgColour);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
+ spriteBatch.Draw(Screen, Vector2.Zero, new Rectangle?(Screen.Bounds), Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
spriteBatch.End();
}
- return;
}
- if (gameMode == 6)
+ else if (gameMode == 6)
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- string text = "";
- int num = 0;
- while (num < gameTime.TotalGameTime.TotalMilliseconds % 999.0 / 333.0)
+ string str = "";
+ for (int i = 0; i < ((gameTime.TotalGameTime.TotalMilliseconds % 999.0) / 333.0); i++)
{
- text += ".";
- num++;
+ str = str + ".";
}
- SpriteText.drawString(spriteBatch, "Loading" + text, 64, graphics.GraphicsDevice.Viewport.Height - 64, 999, -1, 999, 1f, 1f, false, 0, "Loading...");
+ SpriteText.drawString(spriteBatch, "Loading" + str, 0x40, graphics.GraphicsDevice.Viewport.Height - 0x40, 0x3e7, -1, 0x3e7, 1f, 1f, false, 0, "Loading...", -1);
spriteBatch.End();
- if (!ZoomLevelIsOne)
+ if (options.zoomLevel != 1f)
{
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
+ base.GraphicsDevice.SetRenderTarget(null);
+ base.GraphicsDevice.Clear(BgColour);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
+ spriteBatch.Draw(Screen, Vector2.Zero, new Rectangle?(Screen.Bounds), Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
spriteBatch.End();
}
- return;
- }
- if (gameMode == 0)
- {
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
}
else
{
- if (drawLighting)
+ if (gameMode == 0)
+ {
+ spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
+ }
+ else
{
- GraphicsDevice.SetRenderTarget(lightmap);
- GraphicsDevice.Clear(Color.White * 0f);
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null);
- spriteBatch.Draw(staminaRect, lightmap.Bounds, currentLocation.name.Equals("UndergroundMine") ? mine.getLightingColor(gameTime) : ((!ambientLight.Equals(Color.White) && (!isRaining || !currentLocation.isOutdoors)) ? ambientLight : outdoorLight));
- for (int i = 0; i < currentLightSources.Count; i++)
+ if (drawLighting)
{
- if (Utility.isOnScreen(currentLightSources.ElementAt(i).position, (int) (currentLightSources.ElementAt(i).radius * tileSize * 4f)))
+ base.GraphicsDevice.SetRenderTarget(lightmap);
+ base.GraphicsDevice.Clear((Color)(Color.White * 0f));
+ spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null);
+ spriteBatch.Draw(staminaRect, lightmap.Bounds, currentLocation.name.Equals("UndergroundMine") ? mine.getLightingColor(gameTime) : ((!ambientLight.Equals(Color.White) && (!isRaining || !currentLocation.isOutdoors)) ? ambientLight : outdoorLight));
+ for (int j = 0; j < currentLightSources.Count; j++)
{
- spriteBatch.Draw(currentLightSources.ElementAt(i).lightTexture, GlobalToLocal(viewport, currentLightSources.ElementAt(i).position) / options.lightingQuality, currentLightSources.ElementAt(i).lightTexture.Bounds, currentLightSources.ElementAt(i).color, 0f, new Vector2(currentLightSources.ElementAt(i).lightTexture.Bounds.Center.X, currentLightSources.ElementAt(i).lightTexture.Bounds.Center.Y), currentLightSources.ElementAt(i).radius / options.lightingQuality, SpriteEffects.None, 0.9f);
+ if (Utility.isOnScreen(currentLightSources.ElementAt<LightSource>(j).position, (int)((currentLightSources.ElementAt<LightSource>(j).radius * tileSize) * 4f)))
+ {
+ spriteBatch.Draw(currentLightSources.ElementAt<LightSource>(j).lightTexture, (Vector2)(GlobalToLocal(viewport, currentLightSources.ElementAt<LightSource>(j).position) / ((float)(options.lightingQuality / 2))), new Rectangle?(currentLightSources.ElementAt<LightSource>(j).lightTexture.Bounds), currentLightSources.ElementAt<LightSource>(j).color, 0f, new Vector2((float)currentLightSources.ElementAt<LightSource>(j).lightTexture.Bounds.Center.X, (float)currentLightSources.ElementAt<LightSource>(j).lightTexture.Bounds.Center.Y), (float)(currentLightSources.ElementAt<LightSource>(j).radius / ((float)(options.lightingQuality / 2))), SpriteEffects.None, 0.9f);
+ }
}
+ spriteBatch.End();
+ base.GraphicsDevice.SetRenderTarget((options.zoomLevel == 1f) ? null : Screen);
}
- spriteBatch.End();
- GraphicsDevice.SetRenderTarget(ZoomLevelIsOne ? null : Screen);
- }
- if (bloomDay)
- {
- bloom?.BeginDraw();
- }
- GraphicsDevice.Clear(BgColour);
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- GraphicsEvents.InvokeOnPreRenderEvent(null, EventArgs.Empty);
- background?.draw(spriteBatch);
- mapDisplayDevice.BeginScene(spriteBatch);
- currentLocation.Map.GetLayer("Back").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
- currentLocation.drawWater(spriteBatch);
- if (CurrentEvent == null)
- {
- using (List<NPC>.Enumerator enumerator = currentLocation.characters.GetEnumerator())
+ if (bloomDay && (bloom != null))
+ {
+ bloom.BeginDraw();
+ }
+ base.GraphicsDevice.Clear(BgColour);
+ spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
+ GraphicsEvents.InvokeOnPreRenderEvent(null, EventArgs.Empty);
+ if (background != null)
+ {
+ background.draw(spriteBatch);
+ }
+ mapDisplayDevice.BeginScene(spriteBatch);
+ currentLocation.Map.GetLayer("Back").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
+ currentLocation.drawWater(spriteBatch);
+ if (CurrentEvent == null)
{
- while (enumerator.MoveNext())
+ foreach (NPC npc in currentLocation.characters)
{
- NPC current = enumerator.Current;
- if (current != null && !current.swimming && !current.hideShadow && !current.IsMonster && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current.getTileLocation()))
+ if (((!npc.swimming && !npc.hideShadow) && (!npc.isInvisible && !npc.IsMonster)) && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(npc.getTileLocation()))
{
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current.position + new Vector2(current.sprite.spriteWidth * pixelZoom / 2f, current.GetBoundingBox().Height + (current.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current.yJumpOffset / 40f) * current.scale, SpriteEffects.None, Math.Max(0f, current.getStandingY() / 10000f) - 1E-06f);
+ spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, npc.position + new Vector2(((float)(npc.sprite.spriteWidth * pixelZoom)) / 2f, (float)(npc.GetBoundingBox().Height + (npc.IsMonster ? 0 : (pixelZoom * 3))))), new Rectangle?(shadowTexture.Bounds), Color.White, 0f, new Vector2((float)shadowTexture.Bounds.Center.X, (float)shadowTexture.Bounds.Center.Y), (float)((pixelZoom + (((float)npc.yJumpOffset) / 40f)) * npc.scale), SpriteEffects.None, Math.Max((float)0f, (float)(((float)npc.getStandingY()) / 10000f)) - 1E-06f);
}
}
- goto IL_B30;
}
- }
- foreach (NPC current2 in CurrentEvent.actors)
- {
- if (!current2.swimming && !current2.hideShadow && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current2.getTileLocation()))
+ else
{
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current2.position + new Vector2(current2.sprite.spriteWidth * pixelZoom / 2f, current2.GetBoundingBox().Height + (current2.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current2.yJumpOffset / 40f) * current2.scale, SpriteEffects.None, Math.Max(0f, current2.getStandingY() / 10000f) - 1E-06f);
+ foreach (NPC npc2 in CurrentEvent.actors)
+ {
+ if ((!npc2.swimming && !npc2.hideShadow) && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(npc2.getTileLocation()))
+ {
+ spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, npc2.position + new Vector2(((float)(npc2.sprite.spriteWidth * pixelZoom)) / 2f, (float)(npc2.GetBoundingBox().Height + (npc2.IsMonster ? 0 : ((npc2.sprite.spriteHeight <= 0x10) ? -pixelZoom : (pixelZoom * 3)))))), new Rectangle?(shadowTexture.Bounds), Color.White, 0f, new Vector2((float)shadowTexture.Bounds.Center.X, (float)shadowTexture.Bounds.Center.Y), (float)((pixelZoom + (((float)npc2.yJumpOffset) / 40f)) * npc2.scale), SpriteEffects.None, Math.Max((float)0f, (float)(((float)npc2.getStandingY()) / 10000f)) - 1E-06f);
+ }
+ }
}
- }
- IL_B30:
- if (!player.swimming && !player.isRidingHorse() && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), 4f - (((player.running || player.usingTool) && player.FarmerSprite.indexInCurrentAnimation > 1) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f), SpriteEffects.None, 0f);
- }
- currentLocation.Map.GetLayer("Buildings").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
- mapDisplayDevice.EndScene();
- spriteBatch.End();
- spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- if (CurrentEvent == null)
- {
- using (List<NPC>.Enumerator enumerator3 = currentLocation.characters.GetEnumerator())
+ if ((displayFarmer && !player.swimming) && (!player.isRidingHorse() && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation())))
+ {
+ spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), new Rectangle?(shadowTexture.Bounds), Color.White, 0f, new Vector2((float)shadowTexture.Bounds.Center.X, (float)shadowTexture.Bounds.Center.Y), (float)(4f - (((player.running || player.usingTool) && (player.FarmerSprite.indexInCurrentAnimation > 1)) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f)), SpriteEffects.None, 0f);
+ }
+ currentLocation.Map.GetLayer("Buildings").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
+ mapDisplayDevice.EndScene();
+ spriteBatch.End();
+ spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
+ if (CurrentEvent == null)
{
- while (enumerator3.MoveNext())
+ foreach (NPC npc3 in currentLocation.characters)
{
- NPC current3 = enumerator3.Current;
- if (current3 != null && !current3.swimming && !current3.hideShadow && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current3.getTileLocation()))
+ if ((!npc3.swimming && !npc3.hideShadow) && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(npc3.getTileLocation()))
{
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current3.position + new Vector2(current3.sprite.spriteWidth * pixelZoom / 2f, current3.GetBoundingBox().Height + (current3.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current3.yJumpOffset / 40f) * current3.scale, SpriteEffects.None, Math.Max(0f, current3.getStandingY() / 10000f) - 1E-06f);
+ spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, npc3.position + new Vector2(((float)(npc3.sprite.spriteWidth * pixelZoom)) / 2f, (float)(npc3.GetBoundingBox().Height + (npc3.IsMonster ? 0 : (pixelZoom * 3))))), new Rectangle?(shadowTexture.Bounds), Color.White, 0f, new Vector2((float)shadowTexture.Bounds.Center.X, (float)shadowTexture.Bounds.Center.Y), (float)((pixelZoom + (((float)npc3.yJumpOffset) / 40f)) * npc3.scale), SpriteEffects.None, Math.Max((float)0f, (float)(((float)npc3.getStandingY()) / 10000f)) - 1E-06f);
}
}
- goto IL_F5F;
}
- }
- foreach (NPC current4 in CurrentEvent.actors)
- {
- if (!current4.swimming && !current4.hideShadow && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current4.getTileLocation()))
+ else
{
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current4.position + new Vector2(current4.sprite.spriteWidth * pixelZoom / 2f, current4.GetBoundingBox().Height + (current4.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current4.yJumpOffset / 40f) * current4.scale, SpriteEffects.None, Math.Max(0f, current4.getStandingY() / 10000f) - 1E-06f);
+ foreach (NPC npc4 in CurrentEvent.actors)
+ {
+ if ((!npc4.swimming && !npc4.hideShadow) && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(npc4.getTileLocation()))
+ {
+ spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, npc4.position + new Vector2(((float)(npc4.sprite.spriteWidth * pixelZoom)) / 2f, (float)(npc4.GetBoundingBox().Height + (npc4.IsMonster ? 0 : (pixelZoom * 3))))), new Rectangle?(shadowTexture.Bounds), Color.White, 0f, new Vector2((float)shadowTexture.Bounds.Center.X, (float)shadowTexture.Bounds.Center.Y), (float)((pixelZoom + (((float)npc4.yJumpOffset) / 40f)) * npc4.scale), SpriteEffects.None, Math.Max((float)0f, (float)(((float)npc4.getStandingY()) / 10000f)) - 1E-06f);
+ }
+ }
}
- }
- IL_F5F:
- if (!player.swimming && !player.isRidingHorse() && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), 4f - (((player.running || player.usingTool) && player.FarmerSprite.indexInCurrentAnimation > 1) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f), SpriteEffects.None, Math.Max(0.0001f, player.getStandingY() / 10000f + 0.00011f) - 0.0001f);
- }
- if (displayFarmer)
- {
- player.draw(spriteBatch);
- }
- if ((eventUp || killScreen) && !killScreen)
- {
- currentLocation.currentEvent?.draw(spriteBatch);
- }
- if (player.currentUpgrade != null && player.currentUpgrade.daysLeftTillUpgradeDone <= 3 && currentLocation.Name.Equals("Farm"))
- {
- spriteBatch.Draw(player.currentUpgrade.workerTexture, GlobalToLocal(viewport, player.currentUpgrade.positionOfCarpenter), player.currentUpgrade.getSourceRectangle(), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, (player.currentUpgrade.positionOfCarpenter.Y + tileSize * 3 / 4) / 10000f);
- }
- currentLocation.draw(spriteBatch);
- if (eventUp && currentLocation.currentEvent?.messageToScreen != null)
- {
- drawWithBorder(currentLocation.currentEvent.messageToScreen, Color.Black, Color.White, new Vector2(graphics.GraphicsDevice.Viewport.TitleSafeArea.Width / 2 - borderFont.MeasureString(currentLocation.currentEvent.messageToScreen).X / 2f, graphics.GraphicsDevice.Viewport.TitleSafeArea.Height - tileSize), 0f, 1f, 0.999f);
- }
- if (player.ActiveObject == null && (player.UsingTool || pickingTool) && player.CurrentTool != null && (!player.CurrentTool.Name.Equals("Seeds") || pickingTool))
- {
- drawTool(player);
- }
- if (currentLocation.Name.Equals("Farm"))
- {
- //typeof (Game1).GetMethod("drawFarmBuildings", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Program.gamePtr, null);
- DrawFarmBuildings.Invoke(Program.gamePtr, null);
- //this.drawFarmBuildings();
- }
- if (tvStation >= 0)
- {
- spriteBatch.Draw(tvStationTexture, GlobalToLocal(viewport, new Vector2(6 * tileSize + tileSize / 4, 2 * tileSize + tileSize / 2)), new Rectangle(tvStation * 24, 0, 24, 15), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-08f);
- }
- if (panMode)
- {
- spriteBatch.Draw(fadeToBlackRect, new Rectangle((int) Math.Floor((getOldMouseX() + viewport.X) / (double) tileSize) * tileSize - viewport.X, (int) Math.Floor((getOldMouseY() + viewport.Y) / (double) tileSize) * tileSize - viewport.Y, tileSize, tileSize), Color.Lime * 0.75f);
- foreach (Warp current5 in currentLocation.warps)
+ if ((displayFarmer && !player.swimming) && (!player.isRidingHorse() && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation())))
{
- spriteBatch.Draw(fadeToBlackRect, new Rectangle(current5.X * tileSize - viewport.X, current5.Y * tileSize - viewport.Y, tileSize, tileSize), Color.Red * 0.75f);
+ spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), new Rectangle?(shadowTexture.Bounds), Color.White, 0f, new Vector2((float)shadowTexture.Bounds.Center.X, (float)shadowTexture.Bounds.Center.Y), (float)(4f - (((player.running || player.usingTool) && (player.FarmerSprite.indexInCurrentAnimation > 1)) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f)), SpriteEffects.None, Math.Max((float)0.0001f, (float)((((float)player.getStandingY()) / 10000f) + 0.00011f)) - 0.0001f);
+ }
+ if (displayFarmer)
+ {
+ player.draw(spriteBatch);
+ }
+ if ((eventUp || killScreen) && (!killScreen && (currentLocation.currentEvent != null)))
+ {
+ currentLocation.currentEvent.draw(spriteBatch);
+ }
+ if (((player.currentUpgrade != null) && (player.currentUpgrade.daysLeftTillUpgradeDone <= 3)) && currentLocation.Name.Equals("Farm"))
+ {
+ spriteBatch.Draw(player.currentUpgrade.workerTexture, GlobalToLocal(viewport, player.currentUpgrade.positionOfCarpenter), new Rectangle?(player.currentUpgrade.getSourceRectangle()), Color.White, 0f, Vector2.Zero, (float)1f, SpriteEffects.None, (player.currentUpgrade.positionOfCarpenter.Y + ((tileSize * 3) / 4)) / 10000f);
+ }
+ currentLocation.draw(spriteBatch);
+ if ((eventUp && (currentLocation.currentEvent != null)) && (currentLocation.currentEvent.messageToScreen != null))
+ {
+ drawWithBorder(currentLocation.currentEvent.messageToScreen, Color.Black, Color.White, new Vector2((graphics.GraphicsDevice.Viewport.TitleSafeArea.Width / 2) - (borderFont.MeasureString(currentLocation.currentEvent.messageToScreen).X / 2f), (float)(graphics.GraphicsDevice.Viewport.TitleSafeArea.Height - tileSize)), 0f, 1f, 0.999f);
+ }
+ if (((player.ActiveObject == null) && (player.UsingTool || pickingTool)) && ((player.CurrentTool != null) && (!player.CurrentTool.Name.Equals("Seeds") || pickingTool)))
+ {
+ drawTool(player);
+ }
+ if (currentLocation.Name.Equals("Farm"))
+ {
+ DrawFarmBuildings.Invoke(Program.gamePtr, null);
+ }
+ if (tvStation >= 0)
+ {
+ spriteBatch.Draw(tvStationTexture, GlobalToLocal(viewport, new Vector2((float)((6 * tileSize) + (tileSize / 4)), (float)((2 * tileSize) + (tileSize / 2)))), new Rectangle(tvStation * 0x18, 0, 0x18, 15), Color.White, 0f, Vector2.Zero, (float)4f, SpriteEffects.None, 1E-08f);
+ }
+ if (panMode)
+ {
+ spriteBatch.Draw(fadeToBlackRect, new Rectangle((((int)Math.Floor((double)(((double)(getOldMouseX() + viewport.X)) / ((double)tileSize)))) * tileSize) - viewport.X, (((int)Math.Floor((double)(((double)(getOldMouseY() + viewport.Y)) / ((double)tileSize)))) * tileSize) - viewport.Y, tileSize, tileSize), (Color)(Color.Lime * 0.75f));
+ foreach (Warp warp in currentLocation.warps)
+ {
+ spriteBatch.Draw(fadeToBlackRect, new Rectangle((warp.X * tileSize) - viewport.X, (warp.Y * tileSize) - viewport.Y, tileSize, tileSize), (Color)(Color.Red * 0.75f));
+ }
}
- }
- mapDisplayDevice.BeginScene(spriteBatch);
- currentLocation.Map.GetLayer("Front").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
- mapDisplayDevice.EndScene();
- currentLocation.drawAboveFrontLayer(spriteBatch);
- spriteBatch.End();
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- if (currentLocation.Name.Equals("Farm") && stats.SeedsSown >= 200u)
- {
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(3 * tileSize + tileSize / 4, tileSize + tileSize / 3)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(4 * tileSize + tileSize, 2 * tileSize + tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(5 * tileSize, 2 * tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(3 * tileSize + tileSize / 2, 3 * tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(5 * tileSize - tileSize / 4, tileSize)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(4 * tileSize, 3 * tileSize + tileSize / 6)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2(4 * tileSize + tileSize / 5, 2 * tileSize + tileSize / 3)), getSourceRectForStandardTileSheet(debrisSpriteSheet, 16), Color.White);
- }
- if (displayFarmer && player.ActiveObject != null && player.ActiveObject.bigCraftable && checkBigCraftableBoundariesForFrontLayer() && currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), player.getStandingY()), viewport.Size) == null)
- {
- drawPlayerHeldObject(player);
- }
- else if (displayFarmer && player.ActiveObject != null && ((currentLocation.Map.GetLayer("Front").PickTile(new Location((int) player.position.X, (int) player.position.Y - tileSize * 3 / 5), viewport.Size) != null && !currentLocation.Map.GetLayer("Front").PickTile(new Location((int) player.position.X, (int) player.position.Y - tileSize * 3 / 5), viewport.Size).TileIndexProperties.ContainsKey("FrontAlways")) || (currentLocation.Map.GetLayer("Front").PickTile(new Location(player.GetBoundingBox().Right, (int) player.position.Y - tileSize * 3 / 5), viewport.Size) != null && !currentLocation.Map.GetLayer("Front").PickTile(new Location(player.GetBoundingBox().Right, (int) player.position.Y - tileSize * 3 / 5), viewport.Size).TileIndexProperties.ContainsKey("FrontAlways"))))
- {
- drawPlayerHeldObject(player);
- }
- if ((player.UsingTool || pickingTool) && player.CurrentTool != null && (!player.CurrentTool.Name.Equals("Seeds") || pickingTool) && currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), (int) player.position.Y - tileSize * 3 / 5), viewport.Size) != null && currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), player.getStandingY()), viewport.Size) == null)
- {
- drawTool(player);
- }
- if (currentLocation.Map.GetLayer("AlwaysFront") != null)
- {
mapDisplayDevice.BeginScene(spriteBatch);
- currentLocation.Map.GetLayer("AlwaysFront").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
+ currentLocation.Map.GetLayer("Front").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
mapDisplayDevice.EndScene();
- }
- if (toolHold > 400f && player.CurrentTool.UpgradeLevel >= 1 && player.canReleaseTool)
- {
- Color color = Color.White;
- switch ((int) (toolHold / 600f) + 2)
+ currentLocation.drawAboveFrontLayer(spriteBatch);
+ spriteBatch.End();
+ spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
+ if (currentLocation.Name.Equals("Farm") && (stats.SeedsSown >= 200))
{
- case 1:
- color = Tool.copperColor;
- break;
- case 2:
- color = Tool.steelColor;
- break;
- case 3:
- color = Tool.goldColor;
- break;
- case 4:
- color = Tool.iridiumColor;
- break;
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)((3 * tileSize) + (tileSize / 4)), (float)(tileSize + (tileSize / 3)))), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)((4 * tileSize) + tileSize), (float)((2 * tileSize) + tileSize))), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)(5 * tileSize), (float)(2 * tileSize))), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)((3 * tileSize) + (tileSize / 2)), (float)(3 * tileSize))), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)((5 * tileSize) - (tileSize / 4)), (float)tileSize)), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)(4 * tileSize), (float)((3 * tileSize) + (tileSize / 6)))), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
+ spriteBatch.Draw(debrisSpriteSheet, GlobalToLocal(viewport, new Vector2((float)((4 * tileSize) + (tileSize / 5)), (float)((2 * tileSize) + (tileSize / 3)))), new Rectangle?(getSourceRectForStandardTileSheet(debrisSpriteSheet, 0x10, -1, -1)), Color.White);
}
- spriteBatch.Draw(littleEffect, new Rectangle((int) player.getLocalPosition(viewport).X - 2, (int) player.getLocalPosition(viewport).Y - (player.CurrentTool.Name.Equals("Watering Can") ? 0 : tileSize) - 2, (int) (toolHold % 600f * 0.08f) + 4, tileSize / 8 + 4), Color.Black);
- spriteBatch.Draw(littleEffect, new Rectangle((int) player.getLocalPosition(viewport).X, (int) player.getLocalPosition(viewport).Y - (player.CurrentTool.Name.Equals("Watering Can") ? 0 : tileSize), (int) (toolHold % 600f * 0.08f), tileSize / 8), color);
- }
- if (isDebrisWeather && currentLocation.IsOutdoors && !currentLocation.ignoreDebrisWeather && !currentLocation.Name.Equals("Desert") && viewport.X > -10)
- {
- foreach (WeatherDebris current6 in debrisWeather)
+ if (((displayFarmer && (player.ActiveObject != null)) && (player.ActiveObject.bigCraftable && this.checkBigCraftableBoundariesForFrontLayer())) && (currentLocation.Map.GetLayer("Front").PickTile(new Location(player.getStandingX(), player.getStandingY()), viewport.Size) == null))
{
- current6.draw(spriteBatch);
+ drawPlayerHeldObject(player);
}
- }
- farmEvent?.draw(spriteBatch);
- if (currentLocation.LightLevel > 0f && timeOfDay < 2000)
- {
- spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Black * currentLocation.LightLevel);
- }
- if (screenGlow)
- {
- spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, screenGlowColor * screenGlowAlpha);
- }
- currentLocation.drawAboveAlwaysFrontLayer(spriteBatch);
- if (player.CurrentTool is FishingRod && ((pl