diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-07-08 17:48:20 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-14 18:47:35 -0400 |
commit | c9778b567e3fe47a790bcf1d473a7092052a1ba3 (patch) | |
tree | d093c9318be64faa6b37a305ae5cd8fcaf7be90c /src/SMAPI | |
parent | 20c81f04e0c4db88f550bc1427eb0904697baff0 (diff) | |
download | SMAPI-c9778b567e3fe47a790bcf1d473a7092052a1ba3.tar.gz SMAPI-c9778b567e3fe47a790bcf1d473a7092052a1ba3.tar.bz2 SMAPI-c9778b567e3fe47a790bcf1d473a7092052a1ba3.zip |
update draw logic (#638)
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/SGame.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 7222899a..2f642692 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -977,6 +977,13 @@ namespace StardewModdingAPI.Framework Game1.spriteBatch.Draw(Game1.staminaRect, Game1.lightmap.Bounds, color1); for (int index = 0; index < Game1.currentLightSources.Count; ++index) { + LightSource lightSource = Game1.currentLightSources.ElementAt<LightSource>(index); + if (lightSource.PlayerID != 0L && lightSource.PlayerID != Game1.player.UniqueMultiplayerID) + { + Farmer farmerMaybeOffline = Game1.getFarmerMaybeOffline(lightSource.PlayerID); + if (farmerMaybeOffline == null || farmerMaybeOffline.currentLocation != null && farmerMaybeOffline.currentLocation.Name != Game1.currentLocation.Name || (bool)((NetFieldBase<bool, NetBool>)farmerMaybeOffline.hidden)) + continue; + } if (Utility.isOnScreen((Vector2)((NetFieldBase<Vector2, NetVector2>)Game1.currentLightSources.ElementAt<LightSource>(index).position), (int)((double)(float)((NetFieldBase<float, NetFloat>)Game1.currentLightSources.ElementAt<LightSource>(index).radius) * 64.0 * 4.0))) { SpriteBatch spriteBatch = Game1.spriteBatch; @@ -1045,7 +1052,7 @@ namespace StardewModdingAPI.Framework } foreach (Farmer farmerShadow in this._farmerShadows) { - if (!(bool)((NetFieldBase<bool, NetBool>)farmerShadow.swimming) && !farmerShadow.isRidingHorse() && (Game1.currentLocation == null || !Game1.currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(farmerShadow.getTileLocation()))) + if (!Game1.multiplayer.isDisconnecting(farmerShadow.UniqueMultiplayerID) && !(bool)((NetFieldBase<bool, NetBool>)farmerShadow.swimming) && !farmerShadow.isRidingHorse() && (Game1.currentLocation == null || !Game1.currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(farmerShadow.getTileLocation()))) { SpriteBatch spriteBatch = Game1.spriteBatch; Texture2D shadowTexture = Game1.shadowTexture; @@ -1283,6 +1290,27 @@ namespace StardewModdingAPI.Framework } if (Game1.currentBillboard != 0) this.drawBillboard(); + if (!Game1.eventUp && Game1.farmEvent == null && (Game1.currentBillboard == 0 && Game1.gameMode == (byte)3) && Game1.isOutdoorMapSmallerThanViewport()) + { + SpriteBatch spriteBatch1 = Game1.spriteBatch; + Texture2D fadeToBlackRect1 = Game1.fadeToBlackRect; + int width1 = -Math.Min(Game1.viewport.X, 4096); + viewport = Game1.graphics.GraphicsDevice.Viewport; + int height1 = viewport.Height; + Microsoft.Xna.Framework.Rectangle destinationRectangle1 = new Microsoft.Xna.Framework.Rectangle(0, 0, width1, height1); + Color black1 = Color.Black; + spriteBatch1.Draw(fadeToBlackRect1, destinationRectangle1, black1); + SpriteBatch spriteBatch2 = Game1.spriteBatch; + Texture2D fadeToBlackRect2 = Game1.fadeToBlackRect; + int x = -Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64; + viewport = Game1.graphics.GraphicsDevice.Viewport; + int width2 = Math.Min(4096, viewport.Width - (-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64)); + viewport = Game1.graphics.GraphicsDevice.Viewport; + int height2 = viewport.Height; + Microsoft.Xna.Framework.Rectangle destinationRectangle2 = new Microsoft.Xna.Framework.Rectangle(x, 0, width2, height2); + Color black2 = Color.Black; + spriteBatch2.Draw(fadeToBlackRect2, destinationRectangle2, black2); + } if ((Game1.displayHUD || Game1.eventUp) && (Game1.currentBillboard == 0 && Game1.gameMode == (byte)3) && (!Game1.freezeControls && !Game1.panMode && !Game1.HostPaused)) { events.RenderingHud.RaiseEmpty(); |