Skip to content

Commit

Permalink
Apply 1.5.1 source updates
Browse files Browse the repository at this point in the history
  • Loading branch information
veywrn committed Dec 31, 2020
1 parent ba19073 commit e5fc42f
Show file tree
Hide file tree
Showing 38 changed files with 304 additions and 87 deletions.
2 changes: 1 addition & 1 deletion StardewValley/BellsAndWhistles/ParrotPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public virtual void Activate()
}
}
responses.Add(new Response("Cancel", Game1.content.LoadString("Strings\\Locations:MineCart_Destination_Cancel")));
Game1.currentLocation.createQuestionDialogue("Take Parrot Express?", responses.ToArray(), "ParrotPlatform");
Game1.currentLocation.createQuestionDialogue(Game1.content.LoadString("Strings\\UI:ParrotPlatform_Question"), responses.ToArray(), "ParrotPlatform");
activePlatform = this;
}

Expand Down
5 changes: 5 additions & 0 deletions StardewValley/Characters/Child.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ public override void resetForNewDay(int dayOfMonth)
}
}

protected override string translateName(string name)
{
return name.TrimEnd();
}

public override void dayUpdate(int dayOfMonth)
{
resetForNewDay(dayOfMonth);
Expand Down
2 changes: 1 addition & 1 deletion StardewValley/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10006,7 +10006,7 @@ public void answerDialogue(string questionKey, int answerChoice)
}
else
{
Game1.activeClickableMenu = new ShopMenu(festivalShops["starTokenShop"], 1);
Game1.activeClickableMenu = new ShopMenu(festivalShops["starTokenShop"], 1, null, null, null, "StardewFair");
}
}
break;
Expand Down
19 changes: 14 additions & 5 deletions StardewValley/Events/BirthingEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using StardewValley.Characters;
using StardewValley.Menus;
using System;
using System.Collections.Generic;

namespace StardewValley.Events
{
Expand Down Expand Up @@ -112,18 +113,26 @@ public bool tickUpdate(GameTime time)
chance2 += (Game1.player.hasDarkSkin() ? 0.5 : 0.0);
bool isDarkSkinned = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed).NextDouble() < chance2;
string newBabyName = babyName;
Dictionary<string, string> dispositions = Game1.content.Load<Dictionary<string, string>>("Data\\NPCDispositions");
DisposableList<NPC> all_characters = Utility.getAllCharacters();
bool collision_found2 = false;
do
{
collision_found2 = false;
foreach (NPC item in all_characters)
if (dispositions.ContainsKey(newBabyName))
{
if (item.name.Equals(newBabyName))
newBabyName += " ";
collision_found2 = true;
}
else
{
foreach (NPC item in all_characters)
{
newBabyName += " ";
collision_found2 = true;
break;
if (item.name.Equals(newBabyName))
{
newBabyName += " ";
collision_found2 = true;
}
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions StardewValley/Farmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4750,6 +4750,7 @@ public bool addItemToInventoryBool(Item item, bool makeActiveObject = false)
{
(item as Object).reloadSprite();
}
bool showHUDNotification = true;
if (Utility.IsNormalObjectAtParentSheetIndex(item, 73))
{
success = true;
Expand Down Expand Up @@ -4825,6 +4826,7 @@ public bool addItemToInventoryBool(Item item, bool makeActiveObject = false)
base.currentLocation.debris.Add(new Debris(amount, new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY()), Color.Lime, 1f, this));
Game1.playSound("healSound");
removeItemFromInventory(item);
showHUDNotification = false;
}
if (Utility.IsNormalObjectAtParentSheetIndex(item, 102))
{
Expand Down Expand Up @@ -4878,7 +4880,7 @@ public bool addItemToInventoryBool(Item item, bool makeActiveObject = false)
break;
}
}
if (Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is ItemGrabMenu))
if (showHUDNotification && (Game1.activeClickableMenu == null || !(Game1.activeClickableMenu is ItemGrabMenu)))
{
Game1.addHUDMessage(new HUDMessage(name, Math.Max(1, item.Stack), add: true, fontColor, item));
}
Expand Down Expand Up @@ -5212,7 +5214,7 @@ public static List<int> GetAllHairstyleIndices()
}
GetHairStyleMetadataFile();
allHairStyleIndices = new List<int>();
int highest_hair = FarmerRenderer.hairStylesTexture.Height / 96 * 8 - 1;
int highest_hair = FarmerRenderer.hairStylesTexture.Height / 96 * 8;
for (int i = 0; i < highest_hair; i++)
{
allHairStyleIndices.Add(i);
Expand Down Expand Up @@ -7290,7 +7292,7 @@ public void Update(GameTime time, GameLocation location)
isSitting.Value = false;
}
}
if ((bool)isInBed && Game1.IsMultiplayer)
if ((bool)isInBed && Game1.IsMultiplayer && Game1.shouldTimePass())
{
regenTimer -= time.ElapsedGameTime.Milliseconds;
if (regenTimer < 0)
Expand Down
20 changes: 4 additions & 16 deletions StardewValley/FarmerRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -843,10 +843,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who
b.Draw(shirtsTexture, position + origin + positionOffset + new Vector2(16f * scale + (float)(featureXOffsetPerFrame[currentFrame] * 4), (float)(56 + featureYOffsetPerFrame[currentFrame] * 4) + (float)(int)heightOffset * scale), shirtSourceRect, overrideColor.Equals(Color.White) ? Color.White : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + 1.8E-07f);
b.Draw(shirtsTexture, position + origin + positionOffset + new Vector2(16f * scale + (float)(featureXOffsetPerFrame[currentFrame] * 4), (float)(56 + featureYOffsetPerFrame[currentFrame] * 4) + (float)(int)heightOffset * scale), dyed_shirt_source_rect5, overrideColor.Equals(Color.White) ? Utility.MakeCompletelyOpaque(who.GetShirtColor()) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + 1.8E-07f + dye_layer_offset);
}
if (hair_style >= 0)
{
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + 4 + ((who.IsMale && hair_style >= 16) ? (-4) : ((!who.IsMale && hair_style < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer);
}
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + 4 + ((who.IsMale && hair_style >= 16) ? (-4) : ((!who.IsMale && hair_style < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer);
break;
case 1:
shirtSourceRect.Offset(0, 8);
Expand Down Expand Up @@ -880,10 +877,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who
{
b.Draw(accessoriesTexture, position + origin + positionOffset + rotationAdjustment + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, 4 + featureYOffsetPerFrame[currentFrame] * 4 + (int)heightOffset), accessorySourceRect, (overrideColor.Equals(Color.White) && (int)who.accessory < 6) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale + ((rotation != 0f) ? 0f : 0f), SpriteEffects.None, layerDepth + (((int)who.accessory < 8) ? 1.9E-05f : 2.9E-05f));
}
if (hair_style >= 0)
{
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer);
}
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer);
break;
case 2:
dyed_shirt_source_rect5 = shirtSourceRect;
Expand All @@ -897,10 +891,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who
{
b.Draw(accessoriesTexture, position + origin + positionOffset + rotationAdjustment + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, 8 + featureYOffsetPerFrame[currentFrame] * 4 + (int)heightOffset - 4), accessorySourceRect, (overrideColor.Equals(Color.White) && (int)who.accessory < 6) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale + ((rotation != 0f) ? 0f : 0f), SpriteEffects.None, layerDepth + (((int)who.accessory < 8) ? 1.9E-05f : 2.9E-05f));
}
if (hair_style >= 0)
{
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer);
}
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, SpriteEffects.None, layerDepth + hair_draw_layer);
break;
case 3:
{
Expand Down Expand Up @@ -944,10 +935,7 @@ public void drawHairAndAccesories(SpriteBatch b, int facingDirection, Farmer who
{
b.Draw(accessoriesTexture, position + origin + positionOffset + rotationAdjustment + new Vector2(-featureXOffsetPerFrame[currentFrame] * 4, 4 + featureYOffsetPerFrame[currentFrame] * 4 + (int)heightOffset), accessorySourceRect, (overrideColor.Equals(Color.White) && (int)who.accessory < 6) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale + ((rotation != 0f) ? 0f : 0f), SpriteEffects.FlipHorizontally, layerDepth + (((int)who.accessory < 8) ? 1.9E-05f : 2.9E-05f));
}
if (hair_style >= 0)
{
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(-featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, flip2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth + hair_draw_layer);
}
b.Draw(hair_texture, position + origin + positionOffset + new Vector2(-featureXOffsetPerFrame[currentFrame] * 4, featureYOffsetPerFrame[currentFrame] * 4 + ((who.IsMale && (int)who.hair >= 16) ? (-4) : ((!who.IsMale && (int)who.hair < 16) ? 4 : 0))), hairstyleSourceRect, overrideColor.Equals(Color.White) ? ((Color)who.hairstyleColor) : overrideColor, rotation, origin, 4f * scale, flip2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth + hair_draw_layer);
break;
}
}
Expand Down
15 changes: 11 additions & 4 deletions StardewValley/Game1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public enum MusicContext

public const byte errorLogMode = 11;

public static readonly string version = "1.5";
public static readonly string version = "1.5.1";

public const float keyPollingThreshold = 650f;

Expand Down Expand Up @@ -3259,6 +3259,9 @@ public static void applySaveFix(SaveGame.SaveFixes save_fix)
netWorldState.Value.SetBundleData(new_dictionary);
break;
}
case SaveGame.SaveFixes.LeoChildrenFix:
Utility.FixChildNameCollisions();
break;
}
}

Expand Down Expand Up @@ -3629,7 +3632,7 @@ public static void loadForNewGame(bool loadedGame = false)
currentCursorTile = Vector2.Zero;
if (!loadedGame)
{
lastAppliedSaveFix = SaveGame.SaveFixes.FixBotchedBundleData;
lastAppliedSaveFix = SaveGame.SaveFixes.LeoChildrenFix;
}
resetVariables();
chanceToRainTomorrow = 0.0;
Expand Down Expand Up @@ -3827,6 +3830,10 @@ public static void loadForNewGame(bool loadedGame = false)
}
}
netWorldState.Value.ShuffleMineChests = game1.GetNewGameOption<MineChestType>("MineChests");
if (game1.newGameSetupOptions.ContainsKey("SpawnMonstersAtNight"))
{
spawnMonstersAtNight = game1.GetNewGameOption<bool>("SpawnMonstersAtNight");
}
}
player.ConvertClothingOverrideToClothesItems();
player.addQuest(9);
Expand Down Expand Up @@ -7784,7 +7791,7 @@ public static void fixProblems()
foreach (string s in NPCDispositions.Keys)
{
bool found = false;
if ((!(s == "Kent") || player.friendshipData.ContainsKey(s)) && (!(s == "Leo") || player.friendshipData.ContainsKey(s)))
if ((!(s == "Kent") || year > 1) && (!(s == "Leo") || MasterPlayer.hasOrWillReceiveMail("addedParrotBoy")))
{
foreach (NPC n2 in allCharacters2)
{
Expand Down Expand Up @@ -15704,7 +15711,7 @@ public void ShowTelephoneMenu()
{
responses.Add(new Response("AdventureGuild", getCharacterFromName("Marlon").displayName));
}
responses.Add(new Response("HangUp", content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13118")));
responses.Add(new Response("HangUp", content.LoadString("Strings\\Locations:MineCart_Destination_Cancel")));
currentLocation.createQuestionDialogue(content.LoadString("Strings\\Characters:Phone_SelectNumber"), responses.ToArray(), "telephone");
}

Expand Down
5 changes: 4 additions & 1 deletion StardewValley/GameLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2809,7 +2809,10 @@ public virtual void monsterDrop(Monster monster, int x, int y, Farmer who)
extraDrops2 = monster.getExtraDropItems();
for (int i = 0; i < extraDrops2.Count; i++)
{
debris.Add(monster.ModifyMonsterLoot(new Debris(extraDrops2[i], new Vector2(x, y), playerPosition)));
Item tmp = extraDrops2[i].getOne();
tmp.Stack = extraDrops2[i].Stack;
tmp.HasBeenInInventory = false;
debris.Add(monster.ModifyMonsterLoot(new Debris(tmp, new Vector2(x, y), playerPosition)));
}
}
if (HasUnlockedAreaSecretNotes(Game1.player) && Game1.random.NextDouble() < 0.033)
Expand Down
2 changes: 1 addition & 1 deletion StardewValley/Locations/CommunityCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public void loadArea(int area, bool showEffects = true)
{
map.GetLayer("Buildings").Tiles[x, y] = new StaticTile(map.GetLayer("Buildings"), map.TileSheets[0], BlendMode.Alpha, refurbishedMap.GetLayer("Buildings").Tiles[x, y].TileIndex);
adjustMapLightPropertiesForLamp(refurbishedMap.GetLayer("Buildings").Tiles[x, y].TileIndex, x, y, "Buildings");
if (Game1.player.getTileX() == x && Game1.player.getTileY() == y)
if (Game1.player.currentLocation == this && Game1.player.getTileX() == x && Game1.player.getTileY() == y)
{
Game1.player.Position = new Vector2(2080f, 576f);
}
Expand Down
19 changes: 14 additions & 5 deletions StardewValley/Locations/FarmHouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public virtual Point getFrontDoorSpot()
{
return new Point(warp.TargetX, warp.TargetY);
}
if (warp.X == 64 && warp.Y == 15)
if (warp.TargetX == 64 && warp.TargetY == 15)
{
return Game1.getFarm().GetMainFarmHouseEntry();
}
Expand Down Expand Up @@ -356,6 +356,15 @@ public Point GetChildBedSpot(int index)
return GetChildBed(index)?.GetBedSpot() ?? Point.Zero;
}

public override bool isTilePlaceable(Vector2 v, Item item = null)
{
if (isTileOnMap(v) && getTileIndexAt((int)v.X, (int)v.Y, "Back") == 0 && getTileSheetIDAt((int)v.X, (int)v.Y, "Back") == "indoor")
{
return false;
}
return base.isTilePlaceable(v, item);
}

public Point getRandomOpenPointInHouse(Random r, int buffer = 0, int tries = 30)
{
Point point2 = Point.Zero;
Expand Down Expand Up @@ -603,12 +612,12 @@ public override void updateEvenIfFarmerIsntHere(GameTime time, bool ignoreWasUpd
if (spouse_farmer != null && spouse_farmer == owner)
{
NPC spouse = npc;
if (spouse != null && Game1.timeOfDay < 1500 && Game1.random.NextDouble() < 0.0006 && spouse.controller == null && spouse.Schedule == null && !spouse.getTileLocation().Equals(Utility.PointToVector2(getSpouseBedSpot(Game1.player.spouse))) && base.furniture.Count > 0)
if (spouse != null && Game1.timeOfDay < 1500 && Game1.random.NextDouble() < 0.0006 && spouse.controller == null && spouse.Schedule == null && !spouse.getTileLocation().Equals(Utility.PointToVector2(getSpouseBedSpot(Game1.player.spouse))) && furniture.Count > 0)
{
Furniture furniture = base.furniture[Game1.random.Next(base.furniture.Count)];
Microsoft.Xna.Framework.Rectangle b = furniture.boundingBox;
Furniture f = furniture[Game1.random.Next(furniture.Count)];
Microsoft.Xna.Framework.Rectangle b = f.boundingBox;
Vector2 possibleLocation = new Vector2(b.X / 64, b.Y / 64);
if (furniture.furniture_type.Value != 15)
if (f.furniture_type.Value != 15 && f.furniture_type.Value != 12)
{
int tries = 0;
int facingDirection = -3;
Expand Down
10 changes: 10 additions & 0 deletions StardewValley/Locations/IslandNorth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,16 @@ public override bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle posit
return base.isCollidingPosition(position, viewport, isFarmer, damagesFarmer, glider, character);
}

public override bool isTilePlaceable(Vector2 tile_location, Item item = null)
{
Point non_tile_position = Utility.Vector2ToPoint((tile_location + new Vector2(0.5f, 0.5f)) * 64f);
if (!caveOpened && boulderPosition.Contains(non_tile_position))
{
return false;
}
return base.isTilePlaceable(tile_location, item);
}

public override void DayUpdate(int dayOfMonth)
{
base.DayUpdate(dayOfMonth);
Expand Down
14 changes: 14 additions & 0 deletions StardewValley/Locations/IslandSouth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,20 @@ public override bool isCollidingPosition(Microsoft.Xna.Framework.Rectangle posit
return base.isCollidingPosition(position, viewport, isFarmer, damagesFarmer, glider, character);
}

public override bool isTilePlaceable(Vector2 tile_location, Item item = null)
{
Point non_tile_position = Utility.Vector2ToPoint((tile_location + new Vector2(0.5f, 0.5f)) * 64f);
if (_exitsBlocked && turtle1Spot.Contains(non_tile_position))
{
return false;
}
if (!westernTurtleMoved && turtle2Spot.Contains(non_tile_position))
{
return false;
}
return base.isTilePlaceable(tile_location, item);
}

protected override void resetLocalState()
{
_isFirstVisit = false;
Expand Down
2 changes: 1 addition & 1 deletion StardewValley/Locations/IslandWest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public override bool checkAction(Location tileLocation, xTile.Dimensions.Rectang
who.Halt();
Game1.globalFadeToBlack(delegate
{
who.ActiveObject = null;
who.reduceActiveItemByOne();
startEvent(new Event(Game1.content.LoadString("Strings\\Locations:IslandSecret_Event_BirdieFinished"), -666777));
});
who.mailReceived.Add("birdieQuestFinished");
Expand Down
Loading

0 comments on commit e5fc42f

Please sign in to comment.