Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Jan 15, 2021
2 parents bdb7b04 + 415047b commit 5953fc3
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 72 deletions.
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<!--set properties -->
<PropertyGroup>
<Version>3.8.3</Version>
<Version>3.8.4</Version>
<Product>SMAPI</Product>

<LangVersion>latest</LangVersion>
Expand Down
10 changes: 10 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
* Migrated to Harmony 2.0 (see [_migrate to Harmony 2.0_](https://stardewvalleywiki.com/Modding:Migrate_to_Harmony_2.0) for more info).
-->

## 3.8.4
Released 15 January 2021 for Stardew Valley 1.5.3 or later.

* For players:
* Updated for Stardew Valley 1.5.3.
* Fixed issue where title screen music didn't stop after loading a save.

* For modders:
* Fixed `SemanticVersion` comparisons returning wrong value in rare cases.

## 3.8.3
Released 08 January 2021 for Stardew Valley 1.5.2 or later.

Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "3.8.3",
"Version": "3.8.4",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "3.8.3"
"MinimumApiVersion": "3.8.4"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "3.8.3",
"Version": "3.8.4",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "3.8.3"
"MinimumApiVersion": "3.8.4"
}
80 changes: 49 additions & 31 deletions src/SMAPI.Toolkit/SemanticVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,38 +230,49 @@ private int CompareTo(int otherMajor, int otherMinor, int otherPatch, int otherP
const int curNewer = 1;
const int curOlder = -1;

// compare stable versions
if (this.MajorVersion != otherMajor)
return this.MajorVersion.CompareTo(otherMajor);
if (this.MinorVersion != otherMinor)
return this.MinorVersion.CompareTo(otherMinor);
if (this.PatchVersion != otherPatch)
return this.PatchVersion.CompareTo(otherPatch);
if (this.PlatformRelease != otherPlatformRelease)
return this.PlatformRelease.CompareTo(otherPlatformRelease);
if (this.PrereleaseTag == otherTag)
return same;

// stable supersedes prerelease
bool curIsStable = string.IsNullOrWhiteSpace(this.PrereleaseTag);
bool otherIsStable = string.IsNullOrWhiteSpace(otherTag);
if (curIsStable)
return curNewer;
if (otherIsStable)
return curOlder;

// compare two prerelease tag values
string[] curParts = this.PrereleaseTag.Split('.', '-');
string[] otherParts = otherTag.Split('.', '-');
for (int i = 0; i < curParts.Length; i++)
int CompareToRaw()
{
// longer prerelease tag supersedes if otherwise equal
if (otherParts.Length <= i)
// compare stable versions
if (this.MajorVersion != otherMajor)
return this.MajorVersion.CompareTo(otherMajor);
if (this.MinorVersion != otherMinor)
return this.MinorVersion.CompareTo(otherMinor);
if (this.PatchVersion != otherPatch)
return this.PatchVersion.CompareTo(otherPatch);
if (this.PlatformRelease != otherPlatformRelease)
return this.PlatformRelease.CompareTo(otherPlatformRelease);
if (this.PrereleaseTag == otherTag)
return same;

// stable supersedes prerelease
bool curIsStable = string.IsNullOrWhiteSpace(this.PrereleaseTag);
bool otherIsStable = string.IsNullOrWhiteSpace(otherTag);
if (curIsStable)
return curNewer;

// compare if different
if (curParts[i] != otherParts[i])
if (otherIsStable)
return curOlder;

// compare two prerelease tag values
string[] curParts = this.PrereleaseTag.Split('.', '-');
string[] otherParts = otherTag.Split('.', '-');
int length = Math.Max(curParts.Length, otherParts.Length);
for (int i = 0; i < length; i++)
{
// longer prerelease tag supersedes if otherwise equal
if (curParts.Length <= i)
return curOlder;
if (otherParts.Length <= i)
return curNewer;

// skip if same value, unless we've reached the end
if (curParts[i] == otherParts[i])
{
if (i == length - 1)
return same;

continue;
}

// unofficial is always lower-precedence
if (otherParts[i].Equals("unofficial", StringComparison.OrdinalIgnoreCase))
return curNewer;
Expand All @@ -277,10 +288,17 @@ private int CompareTo(int otherMajor, int otherMinor, int otherPatch, int otherP
// else compare lexically
return string.Compare(curParts[i], otherParts[i], StringComparison.OrdinalIgnoreCase);
}

// fallback (this should never happen)
return string.Compare(this.ToString(), new SemanticVersion(otherMajor, otherMinor, otherPatch, otherPlatformRelease, otherTag).ToString(), StringComparison.OrdinalIgnoreCase);
}

// fallback (this should never happen)
return string.Compare(this.ToString(), new SemanticVersion(otherMajor, otherMinor, otherPatch, otherPlatformRelease, otherTag).ToString(), StringComparison.OrdinalIgnoreCase);
return CompareToRaw() switch
{
(< 0) => curOlder,
(> 0) => curNewer,
_ => same
};
}

/// <summary>Assert that the current version is valid.</summary>
Expand Down
4 changes: 4 additions & 0 deletions src/SMAPI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "technical", "technical", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Internal", "Internal", "{82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Mods", "Mods", "{AE9A4D46-E910-4293-8BC4-673F85FFF6A5}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SMAPI.Internal", "SMAPI.Internal\SMAPI.Internal.shproj", "{85208F8D-6FD1-4531-BE05-7142490F59FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.ModBuildConfig.Analyzer.Tests", "SMAPI.ModBuildConfig.Analyzer.Tests\SMAPI.ModBuildConfig.Analyzer.Tests.csproj", "{680B2641-81EA-467C-86A5-0E81CDC57ED0}"
Expand Down Expand Up @@ -148,6 +150,8 @@ Global
{85208F8D-6FD1-4531-BE05-7142490F59FE} = {82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11}
{680B2641-81EA-467C-86A5-0E81CDC57ED0} = {82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11}
{AA95884B-7097-476E-92C8-D0500DE9D6D1} = {82D22ED7-A0A7-4D64-8E92-4B6A5E74ED11}
{0634EA4C-3B8F-42DB-AEA6-CA9E4EF6E92F} = {AE9A4D46-E910-4293-8BC4-673F85FFF6A5}
{CD53AD6F-97F4-4872-A212-50C2A0FD3601} = {AE9A4D46-E910-4293-8BC4-673F85FFF6A5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {70143042-A862-47A8-A677-7C819DDC90DC}
Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public static class Constants
** Public
****/
/// <summary>SMAPI's current semantic version.</summary>
public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.8.3");
public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.8.4");

/// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.5.2");
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.5.3");

/// <summary>The maximum supported version of Stardew Valley.</summary>
public static ISemanticVersion MaximumGameVersion { get; } = null;
Expand Down
1 change: 1 addition & 0 deletions src/SMAPI/Framework/SCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ private void OnPlayerInstanceUpdating(SGame instance, GameTime gameTime, Action
if (Game1.currentLoader != null)
{
this.Monitor.Log("Game loader synchronizing...");
this.Reflection.GetMethod(Game1.game1, "UpdateTitleScreen").Invoke(Game1.currentGameTime); // run game logic to change music on load, etc
while (Game1.currentLoader?.MoveNext() == true)
{
// raise load stage changed
Expand Down
12 changes: 8 additions & 4 deletions src/SMAPI/Framework/SGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -740,16 +740,20 @@ private void DrawImpl(GameTime gameTime, RenderTarget2D target_screen)
Game1.spriteBatch.Draw(Game1.staminaRect, new Microsoft.Xna.Framework.Rectangle(startingX, (int)y, Game1.graphics.GraphicsDevice.Viewport.Width, 1), Microsoft.Xna.Framework.Color.Red * 0.5f);
}
}
if (Game1.ShouldShowOnscreenUsernames() && Game1.currentLocation != null)
{
Game1.currentLocation.DrawFarmerUsernames(Game1.spriteBatch);
}
if (Game1.currentBillboard != 0 && !this.takingMapScreenshot)
{
this.drawBillboard();
}
if (!Game1.eventUp && Game1.farmEvent == null && Game1.currentBillboard == 0 && Game1.gameMode == 3 && !this.takingMapScreenshot && Game1.isOutdoorMapSmallerThanViewport())
{
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, -Math.Min(Game1.viewport.X, 4096), Game1.graphics.GraphicsDevice.Viewport.Height), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64, 0, Math.Min(4096, Game1.graphics.GraphicsDevice.Viewport.Width - (-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64)), Game1.graphics.GraphicsDevice.Viewport.Height), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, Game1.graphics.GraphicsDevice.Viewport.Width, -Math.Min(Game1.viewport.Y, 4096)), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, -Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64, Game1.graphics.GraphicsDevice.Viewport.Width, Math.Min(4096, Game1.graphics.GraphicsDevice.Viewport.Height - (-Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64))), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, -Math.Min(Game1.viewport.X, GameRunner.MaxTextureSize), Game1.graphics.GraphicsDevice.Viewport.Height), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64, 0, Math.Min(GameRunner.MaxTextureSize, Game1.graphics.GraphicsDevice.Viewport.Width - (-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64)), Game1.graphics.GraphicsDevice.Viewport.Height), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, 0, Game1.graphics.GraphicsDevice.Viewport.Width, -Math.Min(Game1.viewport.Y, GameRunner.MaxTextureSize)), Microsoft.Xna.Framework.Color.Black);
Game1.spriteBatch.Draw(Game1.fadeToBlackRect, new Microsoft.Xna.Framework.Rectangle(0, -Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64, Game1.graphics.GraphicsDevice.Viewport.Width, Math.Min(GameRunner.MaxTextureSize, Game1.graphics.GraphicsDevice.Viewport.Height - (-Game1.viewport.Y + Game1.currentLocation.map.Layers[0].LayerHeight * 64))), Microsoft.Xna.Framework.Color.Black);
}
Game1.spriteBatch.End();
Game1.PushUIMode();
Expand Down
66 changes: 36 additions & 30 deletions src/SMAPI/Metadata/CoreAssetPropagator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,36 +138,7 @@ private bool PropagateOther(LocalizedContentManager content, string key, Type ty
{
if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.NormalizeAssetNameIgnoringEmpty(location.mapPath.Value) == key)
{
// reset patch caches
switch (location)
{
case Town _:
this.Reflection.GetField<bool>(location, "ccRefurbished").SetValue(false);
this.Reflection.GetField<bool>(location, "isShowingDestroyedJoja").SetValue(false);
this.Reflection.GetField<bool>(location, "isShowingUpgradedPamHouse").SetValue(false);
break;

case Beach _:
case BeachNightMarket _:
case Forest _:
this.Reflection.GetField<bool>(location, "hasShownCCUpgrade").SetValue(false);
break;
}

// general updates
location.reloadMap();
location.updateSeasonalTileSheets();
location.updateWarps();

// update interior doors
location.interiorDoors.Clear();
foreach (var entry in new InteriorDoorDictionary(location))
location.interiorDoors.Add(entry);

// update doors
location.doors.Clear();
location.updateDoors();

this.ReloadMap(location);
anyChanged = true;
}
}
Expand Down Expand Up @@ -803,6 +774,41 @@ private bool ReloadHairData()
return true;
}

/// <summary>Reload the map for a location.</summary>
/// <param name="location">The location whose map to reload.</param>
private void ReloadMap(GameLocation location)
{
// reset patch caches
switch (location)
{
case Town _:
this.Reflection.GetField<bool>(location, "ccRefurbished").SetValue(false);
this.Reflection.GetField<bool>(location, "isShowingDestroyedJoja").SetValue(false);
this.Reflection.GetField<bool>(location, "isShowingUpgradedPamHouse").SetValue(false);
break;

case Beach _:
case BeachNightMarket _:
case Forest _:
this.Reflection.GetField<bool>(location, "hasShownCCUpgrade").SetValue(false);
break;
}

// general updates
location.reloadMap();
location.updateSeasonalTileSheets();
location.updateWarps();

// update interior doors
location.interiorDoors.Clear();
foreach (var entry in new InteriorDoorDictionary(location))
location.interiorDoors.Add(entry);

// update doors
location.doors.Clear();
location.updateDoors();
}

/// <summary>Reload the disposition data for matching NPCs.</summary>
/// <param name="content">The content manager through which to reload the asset.</param>
/// <param name="key">The asset key to reload.</param>
Expand Down

0 comments on commit 5953fc3

Please sign in to comment.