update draw code for SDV 1.2.13 (#231)

This commit is contained in:
Jesse Plamondon-Willard 2017-03-01 21:30:24 -05:00
parent b7180c47d4
commit 1485d98b24
1 changed files with 575 additions and 576 deletions

View File

@ -65,6 +65,7 @@ namespace StardewModdingAPI.Framework
private readonly Action drawFarmBuildings = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawFarmBuildings)).Invoke(new object[0]); private readonly Action drawFarmBuildings = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawFarmBuildings)).Invoke(new object[0]);
private readonly Action drawHUD = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawHUD)).Invoke(new object[0]); private readonly Action drawHUD = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawHUD)).Invoke(new object[0]);
private readonly Action drawDialogueBox = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawDialogueBox)).Invoke(new object[0]); private readonly Action drawDialogueBox = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawDialogueBox)).Invoke(new object[0]);
private readonly Action renderScreenBuffer = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(renderScreenBuffer)).Invoke(new object[0]);
// ReSharper restore ArrangeStaticMemberQualifier, ArrangeThisQualifier, InconsistentNaming // ReSharper restore ArrangeStaticMemberQualifier, ArrangeThisQualifier, InconsistentNaming
@ -399,7 +400,11 @@ namespace StardewModdingAPI.Framework
this.GraphicsDevice.Clear(this.bgColor); this.GraphicsDevice.Clear(this.bgColor);
//base.Draw(gameTime); //base.Draw(gameTime);
} }
else if (this.IsSaving) else
{
if ((double)Game1.options.zoomLevel != 1.0)
this.GraphicsDevice.SetRenderTarget(this.screenWrapper);
if (this.IsSaving)
{ {
this.GraphicsDevice.Clear(this.bgColor); this.GraphicsDevice.Clear(this.bgColor);
IClickableMenu activeClickableMenu = Game1.activeClickableMenu; IClickableMenu activeClickableMenu = Game1.activeClickableMenu;
@ -420,11 +425,10 @@ namespace StardewModdingAPI.Framework
Game1.spriteBatch.End(); Game1.spriteBatch.End();
} }
//base.Draw(gameTime); //base.Draw(gameTime);
this.renderScreenBuffer();
} }
else else
{ {
if ((double)Game1.options.zoomLevel != 1.0)
this.GraphicsDevice.SetRenderTarget(this.screenWrapper);
this.GraphicsDevice.Clear(this.bgColor); this.GraphicsDevice.Clear(this.bgColor);
if (Game1.activeClickableMenu != null && Game1.options.showMenuBackground && Game1.activeClickableMenu.showWithoutTransparencyIfOptionIsSet()) if (Game1.activeClickableMenu != null && Game1.options.showMenuBackground && Game1.activeClickableMenu.showWithoutTransparencyIfOptionIsSet())
{ {
@ -742,14 +746,14 @@ namespace StardewModdingAPI.Framework
Location mapDisplayLocation2 = new Location(rectangle.Right, (int)Game1.player.position.Y - Game1.tileSize * 3 / 5); Location mapDisplayLocation2 = new Location(rectangle.Right, (int)Game1.player.position.Y - Game1.tileSize * 3 / 5);
Size size2 = Game1.viewport.Size; Size size2 = Game1.viewport.Size;
if (layer2.PickTile(mapDisplayLocation2, size2).TileIndexProperties.ContainsKey("FrontAlways")) if (layer2.PickTile(mapDisplayLocation2, size2).TileIndexProperties.ContainsKey("FrontAlways"))
goto label_128; goto label_127;
} }
else else
goto label_128; goto label_127;
} }
Game1.drawPlayerHeldObject(Game1.player); Game1.drawPlayerHeldObject(Game1.player);
} }
label_128: label_127:
if ((Game1.player.UsingTool || Game1.pickingTool) && Game1.player.CurrentTool != null && ((!Game1.player.CurrentTool.Name.Equals("Seeds") || Game1.pickingTool) && (Game1.currentLocation.Map.GetLayer("Front").PickTile(new Location(Game1.player.getStandingX(), (int)Game1.player.position.Y - Game1.tileSize * 3 / 5), Game1.viewport.Size) != null && Game1.currentLocation.Map.GetLayer("Front").PickTile(new Location(Game1.player.getStandingX(), Game1.player.getStandingY()), Game1.viewport.Size) == null))) if ((Game1.player.UsingTool || Game1.pickingTool) && Game1.player.CurrentTool != null && ((!Game1.player.CurrentTool.Name.Equals("Seeds") || Game1.pickingTool) && (Game1.currentLocation.Map.GetLayer("Front").PickTile(new Location(Game1.player.getStandingX(), (int)Game1.player.position.Y - Game1.tileSize * 3 / 5), Game1.viewport.Size) != null && Game1.currentLocation.Map.GetLayer("Front").PickTile(new Location(Game1.player.getStandingX(), Game1.player.getStandingY()), Game1.viewport.Size) == null)))
Game1.drawTool(Game1.player); Game1.drawTool(Game1.player);
if (Game1.currentLocation.Map.GetLayer("AlwaysFront") != null) if (Game1.currentLocation.Map.GetLayer("AlwaysFront") != null)
@ -1009,13 +1013,8 @@ namespace StardewModdingAPI.Framework
Game1.spriteBatch.End(); Game1.spriteBatch.End();
} }
if ((double)Game1.options.zoomLevel == 1.0) this.renderScreenBuffer();
return; }
this.GraphicsDevice.SetRenderTarget((RenderTarget2D)null);
this.GraphicsDevice.Clear(this.bgColor);
Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
Game1.spriteBatch.Draw((Texture2D)this.screenWrapper, Vector2.Zero, new Microsoft.Xna.Framework.Rectangle?(this.screenWrapper.Bounds), Color.White, 0.0f, Vector2.Zero, Game1.options.zoomLevel, SpriteEffects.None, 1f);
Game1.spriteBatch.End();
} }
} }
} }