diff --git a/AlternativeTextures/AlternativeTextures.cs b/AlternativeTextures/AlternativeTextures.cs index bcb85a34..b85b87ef 100644 --- a/AlternativeTextures/AlternativeTextures.cs +++ b/AlternativeTextures/AlternativeTextures.cs @@ -617,7 +617,7 @@ private bool RightClickSprayCan(GenericTool tool, int xTile, int yTile) else if (terrainFeature is FruitTree fruitTree) { var modelType = AlternativeTextureModel.TextureType.FruitTree; - var saplingName = Game1.objectData.ContainsKey(fruitTree.treeId) ? Game1.objectData[fruitTree.treeId].Name : String.Empty; + var saplingName = Game1.objectData.ContainsKey(fruitTree.treeId.Value) ? Game1.objectData[fruitTree.treeId.Value].Name : String.Empty; if (!fruitTree.modData.ContainsKey(ModDataKeys.ALTERNATIVE_TEXTURE_NAME) || !fruitTree.modData.ContainsKey(ModDataKeys.ALTERNATIVE_TEXTURE_VARIATION)) { // Assign default modData @@ -778,7 +778,7 @@ private void LeftClickSprayCan(GenericTool tool, int xTile, int yTile) if (terrainFeature is FruitTree fruitTree) { var modelType = AlternativeTextureModel.TextureType.FruitTree; - var saplingName = Game1.fruitTreeData.ContainsKey(fruitTree.treeId) ? Game1.objectData[fruitTree.treeId].Name : String.Empty; + var saplingName = Game1.fruitTreeData.ContainsKey(fruitTree.treeId.Value) ? Game1.objectData[fruitTree.treeId.Value].Name : String.Empty; if (tool.modData[SPRAY_CAN_FLAG] == $"{modelType}_{saplingName}") { fruitTree.modData[ModDataKeys.ALTERNATIVE_TEXTURE_OWNER] = actualSelectedModel.Owner; diff --git a/AlternativeTextures/Framework/Patches/Buildings/BuildingPatch.cs b/AlternativeTextures/Framework/Patches/Buildings/BuildingPatch.cs index 25500335..1cd08777 100644 --- a/AlternativeTextures/Framework/Patches/Buildings/BuildingPatch.cs +++ b/AlternativeTextures/Framework/Patches/Buildings/BuildingPatch.cs @@ -68,12 +68,12 @@ internal static void CondensedDrawInMenu(Building building, Texture2D texture, S y += 32; //building.drawShadow(b, x, y); b.Draw(texture, new Vector2(x, y), new Rectangle(0, 80, 80, 80), new Color(60, 126, 150) * alpha, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 1f); - for (int yWater = building.tileY; yWater < (int)building.tileY + 5; yWater++) + for (int yWater = building.tileY.Value; yWater < building.tileY.Value + 5; yWater++) { - for (int xWater = building.tileX; xWater < (int)building.tileX + 4; xWater++) + for (int xWater = building.tileX.Value; xWater < building.tileX.Value + 4; xWater++) { - bool num = yWater == (int)building.tileY + 4; - bool topY = yWater == (int)building.tileY; + bool num = yWater == building.tileY.Value + 4; + bool topY = yWater == building.tileY.Value; if (num) { b.Draw(Game1.mouseCursors, new Vector2(x + xWater * 64 + 32, y + (yWater + 1) * 64 - (int)Game1.currentLocation.waterPosition - 32), new Rectangle(Game1.currentLocation.waterAnimationIndex * 64, 2064 + (((xWater + yWater) % 2 != 0) ? ((!Game1.currentLocation.waterTileFlip) ? 128 : 0) : (Game1.currentLocation.waterTileFlip ? 128 : 0)), 64, 32 + (int)Game1.currentLocation.waterPosition - 5), Game1.currentLocation.waterColor.Value, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); @@ -103,7 +103,7 @@ internal static void CondensedDrawInMenu(Building building, Texture2D texture, S x += (int)(data.DrawOffset.X * 4f); y += (int)(data.DrawOffset.Y * 4f); } - float baseSortY = (int)building.tilesHigh * 64; + float baseSortY = building.tilesHigh.Value * 64; float sortY = baseSortY; if (data != null) { @@ -234,9 +234,9 @@ internal static bool DrawPrefix(Building __instance, float ___alpha, SpriteBatch return true; } - if (__instance is Stable || __instance.maxOccupants == TRACTOR_GARAGE_ID) + if (__instance is Stable || __instance.maxOccupants.Value == TRACTOR_GARAGE_ID) { - if (__instance.isMoving || __instance.daysOfConstructionLeft > 0) + if (__instance.isMoving || __instance.daysOfConstructionLeft.Value > 0) { return true; } @@ -256,7 +256,7 @@ internal static bool DrawPrefix(Building __instance, float ___alpha, SpriteBatch var paintedTexture = BuildingPatch.GetBuildingTextureWithPaint(__instance, textureModel, textureVariation); __instance.drawShadow(b); - b.Draw(paintedTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((int)__instance.tileX * 64, (int)__instance.tileY * 64 + (int)__instance.tilesHigh * 64)), paintedTexture.Bounds, __instance.color * ___alpha, 0f, new Vector2(0f, __instance.texture.Value.Bounds.Height), 4f, SpriteEffects.None, (float)(((int)__instance.tileY + (int)__instance.tilesHigh - 1) * 64) / 10000f); + b.Draw(paintedTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.tileX.Value * 64, __instance.tileY.Value * 64 + __instance.tilesHigh.Value * 64)), paintedTexture.Bounds, __instance.color * ___alpha, 0f, new Vector2(0f, __instance.texture.Value.Bounds.Height), 4f, SpriteEffects.None, (float)((__instance.tileY.Value + __instance.tilesHigh.Value - 1) * 64) / 10000f); return false; } diff --git a/AlternativeTextures/Framework/Patches/PatchTemplate.cs b/AlternativeTextures/Framework/Patches/PatchTemplate.cs index ed2b8988..fc6eebc7 100644 --- a/AlternativeTextures/Framework/Patches/PatchTemplate.cs +++ b/AlternativeTextures/Framework/Patches/PatchTemplate.cs @@ -94,7 +94,7 @@ internal static string GetObjectName(Object obj) } } - if (obj.bigCraftable) + if (obj.bigCraftable.Value) { if (!Game1.bigCraftableData.ContainsKey(obj.ItemId)) { @@ -130,9 +130,9 @@ internal static string GetCharacterName(Character character) { if (child.Age >= 3) { - return $"{CharacterPatch.TODDLER_NAME_PREFIX}_{(child.Gender == 0 ? "Male" : "Female")}_{(child.darkSkinned ? "Dark" : "Light")}"; + return $"{CharacterPatch.TODDLER_NAME_PREFIX}_{(child.Gender == 0 ? "Male" : "Female")}_{(child.darkSkinned.Value ? "Dark" : "Light")}"; } - return $"{CharacterPatch.BABY_NAME_PREFIX}_{(child.darkSkinned ? "Dark" : "Light")}"; + return $"{CharacterPatch.BABY_NAME_PREFIX}_{(child.darkSkinned.Value ? "Dark" : "Light")}"; } if (character is FarmAnimal animal) @@ -165,7 +165,7 @@ internal static string GetCharacterName(Character character) return pet.petType.Value; } - return character.name; + return character.Name; } internal static string GetBuildingName(Building building) @@ -195,7 +195,7 @@ internal static Object GetObjectAt(GameLocation location, int x, int y) } // Prioritize checking non-rug furniture first - foreach (var furniture in location.furniture.Where(c => c.furniture_type != Furniture.rug)) + foreach (var furniture in location.furniture.Where(c => c.furniture_type.Value != Furniture.rug)) { if (furniture.boundingBox.Value.Contains(x, y)) { diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs index df77f731..38c6e82a 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/ChestPatch.cs @@ -94,19 +94,19 @@ private static bool DrawPrefix(Chest __instance, int ___currentLidFrame, int ___ } xTileOffset *= textureModel.TextureWidth * 6; - if ((bool)__instance.playerChest && (__instance.ParentSheetIndex == 130 || __instance.ParentSheetIndex == 232)) + if (__instance.playerChest.Value && (__instance.ParentSheetIndex == 130 || __instance.ParentSheetIndex == 232)) { spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(0, textureOffset, 16, 32), __instance.tint.Value * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.parentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.tint.Value * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.ParentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.tint.Value * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); return false; } - if ((bool)__instance.playerChest) + if (__instance.playerChest.Value) { spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(0, textureOffset, 16, 32), __instance.tint.Value * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.parentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.tint.Value * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(draw_x * 64f + (float)((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (draw_y - 1f) * 64f)), new Rectangle(((___currentLidFrame - __instance.ParentSheetIndex) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 32), __instance.tint.Value * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f); return false; } - if ((bool)__instance.giftbox) + if (__instance.giftbox.Value) { return true; } @@ -130,7 +130,7 @@ private static bool DrawRecolorPrefix(Chest __instance, int ___currentLidFrame, return true; } - if ((bool)__instance.playerChest) + if (__instance.playerChest.Value) { var textureOffset = textureModel.GetTextureOffset(textureVariation); spriteBatch.Draw(textureModel.GetTexture(textureVariation), local ? new Vector2(x, y - 64) : Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, (y - 1) * 64 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))), new Rectangle(0, textureOffset, 16, 32), __instance.playerChoiceColor.Value * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, local ? 0.9f : ((float)(y * 64 + 4) / 10000f)); diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs index 77360d63..1892c9a5 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/CrabPotPatch.cs @@ -47,7 +47,7 @@ private static bool DrawPrefix(CrabPot __instance, float ___yBob, Vector2 ___sha } else if (__instance.tileIndexToShow == 0) { - __instance.tileIndexToShow = __instance.parentSheetIndex; + __instance.tileIndexToShow = __instance.ParentSheetIndex; } ___yBob = (float)(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 500.0 + (double)(x * 64)) * 8.0 + 8.0); @@ -97,11 +97,11 @@ private static bool DrawPrefix(CrabPot __instance, float ___yBob, Vector2 ___sha spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64, y * 64 + (int)___yBob)) + ___shake, new Rectangle(((__instance.tileIndexToShow - 710) * textureModel.TextureWidth) + xTileOffset, textureOffset, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, ((float)(y * 64) + __instance.directionOffset.Y + (float)(x % 4)) / 10000f); spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 + 4, y * 64 + 48)) + ___shake, new Rectangle(Game1.currentLocation.waterAnimationIndex * 64, 2112 + (((x + y) % 2 != 0) ? ((!Game1.currentLocation.waterTileFlip) ? 128 : 0) : (Game1.currentLocation.waterTileFlip ? 128 : 0)), 56, 16 + (int)___yBob), Game1.currentLocation.waterColor.Value, 0f, Vector2.Zero, 1f, SpriteEffects.None, ((float)(y * 64) + __instance.directionOffset.Y + (float)(x % 4)) / 9999f); - if ((bool)__instance.readyForHarvest && __instance.heldObject.Value != null) + if (__instance.readyForHarvest.Value && __instance.heldObject.Value != null) { float yOffset = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2); spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.tileLocation.X / 10000f); - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.parentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, __instance.directionOffset.Value + new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f); } return false; diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs index f383176a..b61e8b3b 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/IndoorPotPatch.cs @@ -44,7 +44,7 @@ private static bool DrawPrefix(IndoorPot __instance, SpriteBatch spriteBatch, in scaleFactor *= 4f; Vector2 position = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64)); Rectangle destination = new Rectangle((int)(position.X - scaleFactor.X / 2f) + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (int)(position.Y - scaleFactor.Y / 2f) + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), (int)(64f + scaleFactor.X), (int)(128f + scaleFactor.Y / 2f)); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), destination, new Rectangle((__instance.showNextIndex ? 1 : 0) * textureModel.TextureWidth, textureOffset, 16, 32), Color.White * alpha, 0f, Vector2.Zero, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 24) / 10000f) + (((int)__instance.parentSheetIndex == 105) ? 0.0035f : 0f) + (float)x * 1E-05f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), destination, new Rectangle((__instance.showNextIndex.Value ? 1 : 0) * textureModel.TextureWidth, textureOffset, 16, 32), Color.White * alpha, 0f, Vector2.Zero, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 24) / 10000f) + ((__instance.ParentSheetIndex == 105) ? 0.0035f : 0f) + (float)x * 1E-05f); if (__instance.hoeDirt.Value.fertilizer.Value != "0") { @@ -55,7 +55,7 @@ private static bool DrawPrefix(IndoorPot __instance, SpriteBatch spriteBatch, in } if (__instance.hoeDirt.Value.crop != null) { - __instance.hoeDirt.Value.crop.drawWithOffset(spriteBatch, __instance.TileLocation, ((int)__instance.hoeDirt.Value.state == 1 && (int)__instance.hoeDirt.Value.crop.currentPhase == 0 && !__instance.hoeDirt.Value.crop.raisedSeeds) ? (new Color(180, 100, 200) * 1f) : Color.White, __instance.hoeDirt.Value.getShakeRotation(), new Vector2(32f, 8f)); + __instance.hoeDirt.Value.crop.drawWithOffset(spriteBatch, __instance.TileLocation, (__instance.hoeDirt.Value.state.Value == 1 && __instance.hoeDirt.Value.crop.currentPhase.Value == 0 && !__instance.hoeDirt.Value.crop.raisedSeeds.Value) ? (new Color(180, 100, 200) * 1f) : Color.White, __instance.hoeDirt.Value.getShakeRotation(), new Vector2(32f, 8f)); } if (__instance.heldObject.Value != null) { diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs index 6485996b..c464b375 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/TorchPatch.cs @@ -46,7 +46,7 @@ private static bool DrawPrefix(Torch __instance, Vector2[] ___ashes, SpriteBatch return false; } - if (!__instance.bigCraftable) + if (!__instance.bigCraftable.Value) { Rectangle sourceRect = new Rectangle(0, textureOffset, textureModel.TextureWidth, textureModel.TextureHeight); sourceRect.Y += 8; @@ -74,18 +74,18 @@ private static bool DrawPrefix(Torch __instance, Vector2[] ___ashes, SpriteBatch ObjectPatch.DrawPrefix(__instance, spriteBatch, x, y, alpha); float draw_layer = Math.Max(0f, (float)((y + 1) * 64 - 24) / 10000f) + (float)x * 1E-05f; - if (!__instance.isOn) + if (!__instance.isOn.Value) { return false; } - if ((int)__instance.parentSheetIndex == 146 || (int)__instance.parentSheetIndex == 278) + if (__instance.ParentSheetIndex == 146 || __instance.ParentSheetIndex == 278) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 16 - 4, y * 64 - 8)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, draw_layer + 0.0008f); spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32 - 12, y * 64)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 2047) + (double)(y * 98)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, draw_layer + 0.0009f); spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32 - 20, y * 64 + 12)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 2077) + (double)(y * 98)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, draw_layer + 0.001f); - if ((int)__instance.parentSheetIndex == 278) + if (__instance.ParentSheetIndex == 278) { ObjectPatch.DrawPrefix(__instance, spriteBatch, x, y, alpha); } diff --git a/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs b/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs index 0fb028f2..313e1759 100644 --- a/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs +++ b/AlternativeTextures/Framework/Patches/SpecialObjects/WoodChipperPatch.cs @@ -67,7 +67,7 @@ private static bool DrawPrefix(Phone __instance, NetRef ___depositedItem draw_position.X += Game1.random.Next(-1, 2) * 2; draw_position.Y += Game1.random.Next(-1, 2) * 2; float draw_scale = Utility.Lerp(1f, 0.75f, completion); - spriteBatch.Draw(Game1.objectSpriteSheet, draw_position, GameLocation.getSourceRectForObject(___depositedItem.Value.ParentSheetIndex), Color.White * alpha, 0f, new Vector2(8f, 8f), 4f * draw_scale, ___depositedItem.Value.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, draw_layer + 0.00175f); + spriteBatch.Draw(Game1.objectSpriteSheet, draw_position, GameLocation.getSourceRectForObject(___depositedItem.Value.ParentSheetIndex), Color.White * alpha, 0f, new Vector2(8f, 8f), 4f * draw_scale, ___depositedItem.Value.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, draw_layer + 0.00175f); } if (___depositedItem.Value != null && __instance.MinutesUntilReady > 0) { @@ -80,13 +80,13 @@ private static bool DrawPrefix(Phone __instance, NetRef ___depositedItem return false; } float yOffset = 4f * (float)Math.Round(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 250.0), 2); - spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.tileLocation.X / 10000f + (((int)__instance.parentSheetIndex == 105) ? 0.0015f : 0f)); + spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 - 8, (float)(y * 64 - 96 - 16) + yOffset)), new Rectangle(141, 465, 20, 24), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-06f + __instance.tileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 0f)); if (__instance.heldObject.Value != null) { - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.parentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f + (((int)__instance.parentSheetIndex == 105) ? 0.0015f : 0f)); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex, 16, 16), Color.White * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 0f)); if (__instance.heldObject.Value is ColoredObject) { - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, (int)__instance.heldObject.Value.parentSheetIndex + 1, 16, 16), (__instance.heldObject.Value as ColoredObject).color.Value * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f + (((int)__instance.parentSheetIndex == 105) ? 0.0015f : 1E-05f)); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, (float)(y * 64 - 64 - 8) + yOffset)), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, __instance.heldObject.Value.ParentSheetIndex + 1, 16, 16), (__instance.heldObject.Value as ColoredObject).color.Value * 0.75f, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (float)((y + 1) * 64) / 10000f + 1E-05f + __instance.tileLocation.X / 10000f + ((__instance.ParentSheetIndex == 105) ? 0.0015f : 1E-05f)); } } return false; diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/BedFurniturePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/BedFurniturePatch.cs index 921036a1..7bc5c3fb 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/BedFurniturePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/BedFurniturePatch.cs @@ -66,9 +66,9 @@ private static bool DrawPrefix(BedFurniture __instance, NetVector2 ___drawPositi sourceRect.X -= __instance.defaultSourceRect.X; sourceRect.Y = textureOffset; - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Top + 1) / 10000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Top + 1) / 10000f); sourceRect.X += sourceRect.Width; - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Bottom - 1) / 10000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Bottom - 1) / 10000f); } else { diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/BushPatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/BushPatch.cs index 5cb4a36f..b1d698a5 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/BushPatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/BushPatch.cs @@ -49,7 +49,7 @@ private static bool DrawPrefix(Bush __instance, float ___yDrawOffset, float ___s { if (effectiveSize > 0) { - spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((tileLocation.X + ((effectiveSize == 1) ? 0.5f : 1f)) * 64f - 51f, tileLocation.Y * 64f - 16f + ___yDrawOffset)), Bush.shadowSourceRect, Color.White, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1E-06f); + spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((tileLocation.X + ((effectiveSize == 1) ? 0.5f : 1f)) * 64f - 51f, tileLocation.Y * 64f - 16f + ___yDrawOffset)), Bush.shadowSourceRect, Color.White, 0f, Vector2.Zero, 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1E-06f); } else { @@ -63,7 +63,7 @@ private static bool DrawPrefix(Bush __instance, float ___yDrawOffset, float ___s { sourceRect = new Rectangle(Math.Min(2, __instance.getAge() / 10) * 16 + __instance.tileSheetOffset.Value * 16, textureOffset, 16, 32); } - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + (float)((effectiveSize + 1) * 64 / 2), (tileLocation.Y + 1f) * 64f - (float)((effectiveSize > 0 && (!__instance.townBush || effectiveSize != 1) && (int)__instance.size != 4) ? 64 : 0) + ___yDrawOffset)), sourceRect, Color.White, ___shakeRotation, new Vector2((effectiveSize + 1) * 16 / 2, 32f), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.getBoundingBox().Center.Y + 48) / 10000f - tileLocation.X / 1000000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + (float)((effectiveSize + 1) * 64 / 2), (tileLocation.Y + 1f) * 64f - (float)((effectiveSize > 0 && (!__instance.townBush.Value || effectiveSize != 1) && __instance.size.Value != 4) ? 64 : 0) + ___yDrawOffset)), sourceRect, Color.White, ___shakeRotation, new Vector2((effectiveSize + 1) * 16 / 2, 32f), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.getBoundingBox().Center.Y + 48) / 10000f - tileLocation.X / 1000000f); return false; } diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/CropPatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/CropPatch.cs index 1e093b83..6feb2515 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/CropPatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/CropPatch.cs @@ -56,7 +56,7 @@ private static bool DrawPrefix(Crop __instance, Vector2 ___origin, Vector2 ___dr } var textureVariation = Int32.Parse(hoeDirt.modData[ModDataKeys.ALTERNATIVE_TEXTURE_VARIATION]); - if (__instance.dead || textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation)) + if (__instance.dead.Value || textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation)) { return true; } @@ -65,7 +65,7 @@ private static bool DrawPrefix(Crop __instance, Vector2 ___origin, Vector2 ___dr Vector2 position = Game1.GlobalToLocal(Game1.viewport, ___drawPosition); // Handle drawing forages - if ((bool)__instance.forageCrop) + if (__instance.forageCrop.Value) { if (__instance.whichForageCrop.Value == "2") { @@ -80,15 +80,15 @@ private static bool DrawPrefix(Crop __instance, Vector2 ___origin, Vector2 ___dr } // Handle the crops / flowers - SpriteEffects effect = (__instance.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None); - var layerDepth = (tileLocation.Y * 64f + 32f + ((!__instance.shouldDrawDarkWhenWatered() || (int)__instance.currentPhase >= __instance.phaseDays.Count - 1) ? 0f : ((tileLocation.Y * 11f + tileLocation.X * 7f) % 10f - 5f))) / 10000f / (((int)__instance.currentPhase == 0 && __instance.shouldDrawDarkWhenWatered()) ? 2f : 1f); + SpriteEffects effect = (__instance.flip.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + var layerDepth = (tileLocation.Y * 64f + 32f + ((!__instance.shouldDrawDarkWhenWatered() || __instance.currentPhase.Value >= __instance.phaseDays.Count - 1) ? 0f : ((tileLocation.Y * 11f + tileLocation.X * 7f) % 10f - 5f))) / 10000f / ((__instance.currentPhase.Value == 0 && __instance.shouldDrawDarkWhenWatered()) ? 2f : 1f); var sourceX = ___sourceRect.X >= 128 ? ___sourceRect.X - 128 : ___sourceRect.X; b.Draw(textureModel.GetTexture(textureVariation), position, new Rectangle(sourceX, textureOffset, 16, 32), toTint, rotation, ___origin, 4f, effect, layerDepth); // Handle the tinted colors for flowers Color tintColor = __instance.tintColor.Value; - if ((!tintColor.Equals(Color.White) || textureModel.HasTint(textureVariation)) && (int)__instance.currentPhase == __instance.phaseDays.Count - 1 && !__instance.dead) + if ((!tintColor.Equals(Color.White) || textureModel.HasTint(textureVariation)) && __instance.currentPhase.Value == __instance.phaseDays.Count - 1 && !__instance.dead.Value) { if (textureModel.HasTint(textureVariation)) { @@ -122,14 +122,14 @@ private static bool DrawWithOffsetPrefix(Crop __instance, Vector2 ___origin, Vec } var textureVariation = Int32.Parse(hoeDirt.modData[ModDataKeys.ALTERNATIVE_TEXTURE_VARIATION]); - if (__instance.dead || textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation)) + if (__instance.dead.Value || textureVariation == -1 || AlternativeTextures.modConfig.IsTextureVariationDisabled(textureModel.GetId(), textureVariation)) { return true; } var textureOffset = textureModel.GetTextureOffset(textureVariation); var sourceX = ___sourceRect.X >= 128 ? ___sourceRect.X - 128 : ___sourceRect.X; - if ((bool)__instance.forageCrop) + if (__instance.forageCrop.Value) { b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(sourceX, textureOffset, 16, 32), Color.White, 0f, new Vector2(8f, 8f), 4f, SpriteEffects.None, (tileLocation.Y + 0.66f) * 64f / 10000f + tileLocation.X * 1E-05f); return false; @@ -137,15 +137,15 @@ private static bool DrawWithOffsetPrefix(Crop __instance, Vector2 ___origin, Vec Color tintColor = __instance.tintColor.Value; - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(sourceX, textureOffset, 16, 32), toTint, rotation, new Vector2(8f, 24f), 4f, __instance.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (tileLocation.Y + 0.66f) * 64f / 10000f + tileLocation.X * 1E-05f); - if ((!tintColor.Equals(Color.White) || textureModel.HasTint(textureVariation)) && (int)__instance.currentPhase == __instance.phaseDays.Count - 1 && !__instance.dead) + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(sourceX, textureOffset, 16, 32), toTint, rotation, new Vector2(8f, 24f), 4f, __instance.flip.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (tileLocation.Y + 0.66f) * 64f / 10000f + tileLocation.X * 1E-05f); + if ((!tintColor.Equals(Color.White) || textureModel.HasTint(textureVariation)) && __instance.currentPhase.Value == __instance.phaseDays.Count - 1 && !__instance.dead.Value) { if (textureModel.HasTint(textureVariation)) { tintColor = textureModel.GetRandomTint(textureVariation); } - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(___coloredSourceRect.X >= 128 ? ___coloredSourceRect.X - 128 : ___coloredSourceRect.X, textureOffset, ___coloredSourceRect.Width, ___coloredSourceRect.Height), tintColor, rotation, new Vector2(8f, 24f), 4f, __instance.flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (tileLocation.Y + 0.67f) * 64f / 10000f + tileLocation.X * 1E-05f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(___coloredSourceRect.X >= 128 ? ___coloredSourceRect.X - 128 : ___coloredSourceRect.X, textureOffset, ___coloredSourceRect.Width, ___coloredSourceRect.Height), tintColor, rotation, new Vector2(8f, 24f), 4f, __instance.flip.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (tileLocation.Y + 0.67f) * 64f / 10000f + tileLocation.X * 1E-05f); } return false; diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/FencePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/FencePatch.cs index f595d7c3..81bfc697 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/FencePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/FencePatch.cs @@ -65,31 +65,31 @@ private static bool DrawPrefix(Fence __instance, SpriteBatch b, int x, int y, fl sourceRectPosition = Fence.fenceDrawGuide[drawSum]; } - var gateOffset = __instance.isGate ? 128 : 0; + var gateOffset = __instance.isGate.Value ? 128 : 0; var textureOffset = textureModel.GetTextureOffset(textureVariation); - if ((bool)__instance.isGate) + if (__instance.isGate.Value) { Vector2 offset = new Vector2(0f, 0f); switch (drawSum) { case 10: - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 - 16, y * 64 - 128)), new Rectangle(((int)__instance.gatePosition == 88) ? 24 : 0, textureOffset + (192 - gateOffset), 24, 48), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 32 + 1) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 - 16, y * 64 - 128)), new Rectangle((__instance.gatePosition.Value == 88) ? 24 : 0, textureOffset + (192 - gateOffset), 24, 48), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 32 + 1) / 10000f); return false; case 100: - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 - 16, y * 64 - 128)), new Rectangle(((int)__instance.gatePosition == 88) ? 24 : 0, textureOffset + (240 - gateOffset), 24, 48), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 32 + 1) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 - 16, y * 64 - 128)), new Rectangle((__instance.gatePosition.Value == 88) ? 24 : 0, textureOffset + (240 - gateOffset), 24, 48), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 32 + 1) / 10000f); return false; case 1000: - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 - 20)), new Rectangle(((int)__instance.gatePosition == 88) ? 24 : 0, textureOffset + (288 - gateOffset), 24, 32), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 - 32 + 2) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 - 20)), new Rectangle((__instance.gatePosition.Value == 88) ? 24 : 0, textureOffset + (288 - gateOffset), 24, 32), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 - 32 + 2) / 10000f); return false; case 500: - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 - 20)), new Rectangle(((int)__instance.gatePosition == 88) ? 24 : 0, textureOffset + (320 - gateOffset), 24, 32), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 96 - 1) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 - 20)), new Rectangle((__instance.gatePosition.Value == 88) ? 24 : 0, textureOffset + (320 - gateOffset), 24, 32), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 96 - 1) / 10000f); return false; case 110: - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 - 16, y * 64 - 64)), new Rectangle(((int)__instance.gatePosition == 88) ? 24 : 0, textureOffset + (128 - gateOffset), 24, 32), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 32 + 1) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 - 16, y * 64 - 64)), new Rectangle((__instance.gatePosition.Value == 88) ? 24 : 0, textureOffset + (128 - gateOffset), 24, 32), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 32 + 1) / 10000f); return false; case 1500: - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 - 20)), new Rectangle(((int)__instance.gatePosition == 88) ? 16 : 0, textureOffset + (160 - gateOffset), 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 - 32 + 2) / 10000f); - b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 + 44)), new Rectangle(((int)__instance.gatePosition == 88) ? 16 : 0, textureOffset + (176 - gateOffset), 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 96 - 1) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 - 20)), new Rectangle((__instance.gatePosition.Value == 88) ? 16 : 0, textureOffset + (160 - gateOffset), 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 - 32 + 2) / 10000f); + b.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, offset + new Vector2(x * 64 + 20, y * 64 - 64 + 44)), new Rectangle((__instance.gatePosition.Value == 88) ? 16 : 0, textureOffset + (176 - gateOffset), 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(y * 64 + 96 - 1) / 10000f); return false; } sourceRectPosition = 5; @@ -154,32 +154,32 @@ private static bool DrawPrefix(Fence __instance, SpriteBatch b, int x, int y, fl private static void PerformObjectDropInActionPostfix(Fence __instance, bool __result, Item dropInItem, bool probe, Farmer who, bool returnFalseIfItemConsumed = false) { // Assign Gate modData to this fence (if applicable) - if (dropInItem.parentSheetIndex == 325 && __result) + if (dropInItem.ParentSheetIndex == 325 && __result) { var instanceName = $"{AlternativeTextureModel.TextureType.Craftable}_{Game1.objectData[dropInItem.ItemId].Name}"; var instanceSeasonName = $"{instanceName}_{Game1.currentSeason}"; if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceName) && AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceSeasonName)) { - var result = Game1.random.Next(2) > 0 ? AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable) : AssignModData(__instance, instanceName, false, __instance.bigCraftable); + var result = Game1.random.Next(2) > 0 ? AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable.Value) : AssignModData(__instance, instanceName, false, __instance.bigCraftable.Value); return; } else { if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceName)) { - AssignModData(__instance, instanceName, false, __instance.bigCraftable); + AssignModData(__instance, instanceName, false, __instance.bigCraftable.Value); return; } if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceSeasonName)) { - AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable); + AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable.Value); return; } } - AssignDefaultModData(__instance, instanceSeasonName, true, __instance.bigCraftable); + AssignDefaultModData(__instance, instanceSeasonName, true, __instance.bigCraftable.Value); } } } diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/FishTankFurniturePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/FishTankFurniturePatch.cs index 4ad0efcb..b0e58303 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/FishTankFurniturePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/FishTankFurniturePatch.cs @@ -75,7 +75,7 @@ private static bool DrawPrefix(FishTankFurniture __instance, NetInt ___sourceInd Rectangle sourceRect = new Rectangle(__instance.sourceRect.Value.Width, __instance.sourceRect.Value.Y, __instance.sourceRect.Value.Width, __instance.sourceRect.Value.Height); sourceRect.Y = textureOffset; - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, draw_position + shake), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, __instance.GetGlassDrawLayer()); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, draw_position + shake), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, __instance.GetGlassDrawLayer()); if (Furniture.isDrawingLocationFurniture) { int hatsDrawn = 0; diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs index 682792ba..cbe16ab2 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/FruitTreePatch.cs @@ -65,17 +65,17 @@ private static bool DrawPrefix(FruitTree __instance, float ___shakeRotation, flo Vector2 tileLocation = __instance.Tile; string season = Game1.GetSeasonForLocation(__instance.Location).ToString(); - if ((bool)__instance.greenHouseTileTree) + if (__instance.greenHouseTileTree.Value) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f)), new Rectangle(669, 1957, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1E-08f); } var textureOffset = textureModel.GetTextureOffset(textureVariation); - if ((int)__instance.growthStage < 4) + if (__instance.growthStage.Value < 4) { Vector2 positionOffset = new Vector2((float)Math.Max(-8.0, Math.Min(64.0, Math.Sin((double)(tileLocation.X * 200f) / (Math.PI * 2.0)) * -16.0)), (float)Math.Max(-8.0, Math.Min(64.0, Math.Sin((double)(tileLocation.X * 200f) / (Math.PI * 2.0)) * -16.0))) / 2f; Rectangle sourceRect = Rectangle.Empty; - switch ((int)__instance.growthStage) + switch (__instance.growthStage.Value) { case 0: sourceRect = new Rectangle(0, textureOffset * 5 * 16, 48, 80); @@ -91,23 +91,23 @@ private static bool DrawPrefix(FruitTree __instance, float ___shakeRotation, flo break; } - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f + positionOffset.X, tileLocation.Y * 64f - (float)sourceRect.Height + 128f + positionOffset.Y)), sourceRect, Color.White, ___shakeRotation, new Vector2(24f, 80f), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, __instance.getBoundingBox().Bottom / 10000f - tileLocation.X / 1000000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f + positionOffset.X, tileLocation.Y * 64f - (float)sourceRect.Height + 128f + positionOffset.Y)), sourceRect, Color.White, ___shakeRotation, new Vector2(24f, 80f), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, __instance.getBoundingBox().Bottom / 10000f - tileLocation.X / 1000000f); } else { Rectangle boundingBox = __instance.getBoundingBox(); - if (!__instance.stump || (bool)___falling) + if (!__instance.stump.Value || ___falling.Value) { bool ignoreSeason = __instance.IgnoresSeasonsHere(); - if (!___falling) + if (!___falling.Value) { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 64f)), new Rectangle((12 + (ignoreSeason ? 1 : Utility.getSeasonNumber(season)) * 3) * 16, textureOffset * 5 * 16 + 64, 48, 16), ((int)__instance.struckByLightningCountdown > 0) ? (Color.Gray * ___alpha) : (Color.White * ___alpha), 0f, new Vector2(24f, 16f), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1E-07f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 64f)), new Rectangle((12 + (ignoreSeason ? 1 : Utility.getSeasonNumber(season)) * 3) * 16, textureOffset * 5 * 16 + 64, 48, 16), (__instance.struckByLightningCountdown.Value > 0) ? (Color.Gray * ___alpha) : (Color.White * ___alpha), 0f, new Vector2(24f, 16f), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1E-07f); } - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 64f)), new Rectangle((12 + (ignoreSeason ? 1 : Utility.getSeasonNumber(season)) * 3) * 16, textureOffset * 5 * 16, 48, 64), ((int)__instance.struckByLightningCountdown > 0) ? (Color.Gray * ___alpha) : (Color.White * ___alpha), ___shakeRotation, new Vector2(24f, 80f), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, boundingBox.Bottom / 10000f + 0.001f - tileLocation.X / 1000000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 64f)), new Rectangle((12 + (ignoreSeason ? 1 : Utility.getSeasonNumber(season)) * 3) * 16, textureOffset * 5 * 16, 48, 64), (__instance.struckByLightningCountdown.Value > 0) ? (Color.Gray * ___alpha) : (Color.White * ___alpha), ___shakeRotation, new Vector2(24f, 80f), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, boundingBox.Bottom / 10000f + 0.001f - tileLocation.X / 1000000f); } - if (__instance.health.Value >= 1f || (!___falling && __instance.health.Value > -99f)) + if (__instance.health.Value >= 1f || (!___falling.Value && __instance.health.Value > -99f)) { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f + ((___shakeTimer > 0f) ? ((float)Math.Sin(Math.PI * 2.0 / (double)___shakeTimer) * 2f) : 0f), tileLocation.Y * 64f + 64f)), new Rectangle(384, textureOffset * 5 * 16 + 48, 48, 32), ((int)__instance.struckByLightningCountdown > 0) ? (Color.Gray * ___alpha) : (Color.White * ___alpha), 0f, new Vector2(24f, 32f), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, ((bool)__instance.stump && !___falling) ? (boundingBox.Bottom / 10000f) : (boundingBox.Bottom / 10000f - 0.001f - tileLocation.X / 1000000f)); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f + ((___shakeTimer > 0f) ? ((float)Math.Sin(Math.PI * 2.0 / (double)___shakeTimer) * 2f) : 0f), tileLocation.Y * 64f + 64f)), new Rectangle(384, textureOffset * 5 * 16 + 48, 48, 32), (__instance.struckByLightningCountdown.Value > 0) ? (Color.Gray * ___alpha) : (Color.White * ___alpha), 0f, new Vector2(24f, 32f), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.stump.Value && !___falling.Value) ? (boundingBox.Bottom / 10000f) : (boundingBox.Bottom / 10000f - 0.001f - tileLocation.X / 1000000f)); } for (int i = 0; i < __instance.fruit.Count; i++) { diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs index 6305492c..1e5652f3 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/FurniturePatch.cs @@ -147,39 +147,39 @@ internal static bool DrawPrefix(Furniture __instance, NetInt ___sourceIndexOffse if (frontTexture is not null && __instance.sourceRect.Right <= frontTexture.Width && __instance.sourceRect.Bottom <= frontTexture.Height) { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Top + 16) / 10000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Top + 16) / 10000f); var rotationSourceRect = sourceRect; rotationSourceRect.Y += textureModel.TextureHeight / 2; - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), rotationSourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Bottom - 8) / 10000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), rotationSourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.boundingBox.Value.Bottom - 8) / 10000f); } else { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, ((int)__instance.furniture_type == 12) ? (2E-09f + __instance.tileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - (((int)__instance.furniture_type == 6 || (int)__instance.furniture_type == 17 || (int)__instance.furniture_type == 13) ? 48 : 8)) / 10000f)); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, ___drawPosition.Value + ((__instance.shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero)), sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.furniture_type.Value == 12) ? (2E-09f + __instance.tileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - ((__instance.furniture_type.Value == 6 || __instance.furniture_type.Value == 17 || __instance.furniture_type.Value == 13) ? 48 : 8)) / 10000f)); } } else { - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), y * 64 - (__instance.sourceRect.Height * 4 - __instance.boundingBox.Height) + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))), __instance.sourceRect.Value, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, ((int)__instance.furniture_type == 12) ? (2E-09f + __instance.tileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - (((int)__instance.furniture_type == 6 || (int)__instance.furniture_type == 17 || (int)__instance.furniture_type == 13) ? 48 : 8)) / 10000f)); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), y * 64 - (__instance.sourceRect.Height * 4 - __instance.boundingBox.Height) + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))), __instance.sourceRect.Value, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.furniture_type.Value == 12) ? (2E-09f + __instance.tileLocation.Y / 100000f) : ((float)(__instance.boundingBox.Value.Bottom - ((__instance.furniture_type.Value == 6 || __instance.furniture_type.Value == 17 || __instance.furniture_type.Value == 13) ? 48 : 8)) / 10000f)); } if (__instance.heldObject.Value != null) { if (__instance.heldObject.Value is Furniture) { - (__instance.heldObject.Value as Furniture).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.heldObject.Value as Furniture).sourceRect.Height * 4 - (__instance.drawHeldObjectLow ? (-16) : 16))), (float)(__instance.boundingBox.Bottom - 7) / 10000f, alpha); + (__instance.heldObject.Value as Furniture).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.heldObject.Value as Furniture).sourceRect.Height * 4 - (__instance.drawHeldObjectLow.Value ? (-16) : 16))), (float)(__instance.boundingBox.Bottom - 7) / 10000f, alpha); } - else if (HeldObjectDraw(__instance.heldObject.Value, spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.drawHeldObjectLow ? 32 : 85))), (float)(__instance.boundingBox.Bottom + 1) / 10000f, alpha)) + else if (HeldObjectDraw(__instance.heldObject.Value, spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.drawHeldObjectLow.Value ? 32 : 85))), (float)(__instance.boundingBox.Bottom + 1) / 10000f, alpha)) { - spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.drawHeldObjectLow ? 32 : 85))) + new Vector2(32f, 53f), Game1.shadowTexture.Bounds, Color.White * alpha, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)__instance.boundingBox.Bottom / 10000f); - spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.drawHeldObjectLow ? 32 : 85))), GameLocation.getSourceRectForObject(__instance.heldObject.Value.ParentSheetIndex), Color.White * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.boundingBox.Bottom + 1) / 10000f); + spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.drawHeldObjectLow.Value ? 32 : 85))) + new Vector2(32f, 53f), Game1.shadowTexture.Bounds, Color.White * alpha, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)__instance.boundingBox.Bottom / 10000f); + spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32, __instance.boundingBox.Center.Y - (__instance.drawHeldObjectLow.Value ? 32 : 85))), GameLocation.getSourceRectForObject(__instance.heldObject.Value.ParentSheetIndex), Color.White * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.boundingBox.Bottom + 1) / 10000f); } } - if ((bool)__instance.isOn && (int)__instance.furniture_type == 14) + if (__instance.isOn.Value && __instance.furniture_type.Value == 14) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 12, __instance.boundingBox.Center.Y - 64)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.GetBoundingBoxAt(x, y).Bottom - 2) / 10000f); spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 32 - 4, __instance.boundingBox.Center.Y - 64)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 2047) + (double)(y * 98)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.GetBoundingBoxAt(x, y).Bottom - 1) / 10000f); } - else if ((bool)__instance.isOn && (int)__instance.furniture_type == 16) + else if (__instance.isOn.Value && __instance.furniture_type.Value == 16) { spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.boundingBox.Center.X - 20, (float)__instance.boundingBox.Center.Y - 105.6f)), new Rectangle(276 + (int)((Game1.currentGameTime.TotalGameTime.TotalMilliseconds + (double)(x * 3047) + (double)(y * 88)) % 400.0 / 100.0) * 12, 1985, 12, 11), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(__instance.GetBoundingBoxAt(x, y).Bottom - 2) / 10000f); } @@ -208,7 +208,7 @@ private static bool HeldObjectDraw(Object __instance, SpriteBatch spriteBatch, V // Get the current X index for the source tile var xTileOffset = __instance.modData.ContainsKey(ModDataKeys.ALTERNATIVE_TEXTURE_SHEET_ID) ? __instance.ParentSheetIndex - Int32.Parse(__instance.modData[ModDataKeys.ALTERNATIVE_TEXTURE_SHEET_ID]) : 0; - if (__instance.showNextIndex) + if (__instance.showNextIndex.Value) { xTileOffset += 1; } @@ -216,7 +216,7 @@ private static bool HeldObjectDraw(Object __instance, SpriteBatch spriteBatch, V // Replicate the base draw Rectangle sourceRect = new Rectangle(xTileOffset, textureOffset, textureModel.TextureWidth, textureModel.TextureHeight); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), location, sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), location, sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); return false; } @@ -244,7 +244,7 @@ private static bool DrawAtNonTileSpotPrefix(Furniture __instance, NetInt ___sour Rectangle sourceRect = __instance.sourceRect.Value; sourceRect.X -= __instance.defaultSourceRect.X; sourceRect.Y = textureOffset; - spriteBatch.Draw(textureModel.GetTexture(textureVariation), location, sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), location, sourceRect, Color.White * alpha, 0f, Vector2.Zero, 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); return false; } @@ -256,7 +256,7 @@ private static bool DrawInMenuPrefix(Furniture __instance, NetInt ___sourceIndex if ((Game1.activeClickableMenu is PaintBucketMenu || Game1.activeClickableMenu is CatalogueMenu) && !PatchTemplate.IsDGAObject(__instance)) { var texture = ItemRegistry.GetDataOrErrorItem(__instance.QualifiedItemId).GetTexture(); - var sourceRect = __instance.rotations > 1 ? __instance.sourceRect.Value : __instance.defaultSourceRect.Value; + var sourceRect = __instance.rotations.Value > 1 ? __instance.sourceRect.Value : __instance.defaultSourceRect.Value; if (__instance.modData.ContainsKey(ModDataKeys.ALTERNATIVE_TEXTURE_NAME) && AlternativeTextures.textureManager.GetSpecificTextureModel(__instance.modData[ModDataKeys.ALTERNATIVE_TEXTURE_NAME]) is AlternativeTextureModel textureModel && Int32.TryParse(__instance.modData[ModDataKeys.ALTERNATIVE_TEXTURE_VARIATION], out int textureVariation) && textureVariation != -1) { @@ -266,7 +266,7 @@ private static bool DrawInMenuPrefix(Furniture __instance, NetInt ___sourceIndex } sourceRect.X += sourceRect.Width * ___sourceIndexOffset.Value; - spriteBatch.Draw(texture, location + new Vector2(32f, 32f), sourceRect, color * transparency, 0f, new Vector2(sourceRect.Width / 2, sourceRect.Height / 2), 1f * GetScaleSize(sourceRect) * scaleSize, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); + spriteBatch.Draw(texture, location + new Vector2(32f, 32f), sourceRect, color * transparency, 0f, new Vector2(sourceRect.Width / 2, sourceRect.Height / 2), 1f * GetScaleSize(sourceRect) * scaleSize, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth); return false; } diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/GrassPatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/GrassPatch.cs index 043f5e60..d5d80296 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/GrassPatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/GrassPatch.cs @@ -45,7 +45,7 @@ private static bool DrawPrefix(Grass __instance, int[] ___offset1, int[] ___offs Vector2 tileLocation = __instance.Tile; var textureOffset = textureModel.GetTextureOffset(textureVariation); - for (int i = 0; i < (int)__instance.numberOfWeeds; i++) + for (int i = 0; i < __instance.numberOfWeeds.Value; i++) { Vector2 pos = ((i != 4) ? (tileLocation * 64f + new Vector2((float)(i % 2 * 64 / 2 + ___offset3[i] * 4 - 4) + 30f, i / 2 * 64 / 2 + ___offset4[i] * 4 + 40)) : (tileLocation * 64f + new Vector2((float)(16 + ___offset1[i] * 4 - 4) + 30f, 16 + ___offset2[i] * 4 + 40))); spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, pos), new Rectangle(0, textureOffset, 15, 20), Color.White, ___shakeRotation / (float)(___shakeRandom[i] + 1.0), new Vector2(7.5f, 17.5f), 4f, ___flip[i] ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (pos.Y + 16f - 20f) / 10000f + pos.X / 1E+07f); diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs index a9022652..91bfdc3c 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/ObjectPatch.cs @@ -74,7 +74,7 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int // Get the current X index for the source tile var xTileOffset = __instance.modData.ContainsKey(ModDataKeys.ALTERNATIVE_TEXTURE_SHEET_ID) ? __instance.ParentSheetIndex - Int32.Parse(__instance.modData[ModDataKeys.ALTERNATIVE_TEXTURE_SHEET_ID]) : 0; - if (__instance.showNextIndex) + if (__instance.showNextIndex.Value) { xTileOffset += 1; } @@ -117,7 +117,7 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int } xTileOffset *= textureModel.TextureWidth; - if (__instance.bigCraftable) + if (__instance.bigCraftable.Value) { // Get required draw values Vector2 scaleFactor = __instance.getScale() * 4f; @@ -145,28 +145,28 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int { spriteBatch.Draw(textureModel.GetTexture(textureVariation), __instance.getLocalPosition(Game1.viewport) + new Vector2(32f, 0f), new Rectangle(32, textureOffset, 16, 16), Color.White * alpha, __instance.scale.X, new Vector2(8f, 8f), 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64) / 10000f + 0.0001f + (float)x * 1E-05f)); } - if ((bool)__instance.isLamp && Game1.isDarkOut(Game1.currentLocation)) + if (__instance.isLamp.Value && Game1.isDarkOut(Game1.currentLocation)) { spriteBatch.Draw(Game1.mouseCursors, position + new Vector2(-32f, -32f), new Rectangle(88, 1779, 32, 32), Color.White * 0.75f, 0f, Vector2.Zero, 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 20) / 10000f) + (float)x / 1000000f); } - if ((int)__instance.parentSheetIndex == 126 && (int)__instance.quality != 0) + if (__instance.ParentSheetIndex == 126 && __instance.quality.Value != 0) { - spriteBatch.Draw(FarmerRenderer.hatsTexture, position + new Vector2(-3f, -6f) * 4f, new Rectangle(((int)__instance.quality - 1) * 20 % FarmerRenderer.hatsTexture.Width, ((int)__instance.quality - 1) * 20 / FarmerRenderer.hatsTexture.Width * 20 * 4, 20, 20), Color.White * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 20) / 10000f) + (float)x * 1E-05f); + spriteBatch.Draw(FarmerRenderer.hatsTexture, position + new Vector2(-3f, -6f) * 4f, new Rectangle((__instance.quality.Value - 1) * 20 % FarmerRenderer.hatsTexture.Width, (__instance.quality.Value - 1) * 20 / FarmerRenderer.hatsTexture.Width * 20 * 4, 20, 20), Color.White * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, Math.Max(0f, (float)((y + 1) * 64 - 20) / 10000f) + (float)x * 1E-05f); } } else if (!Game1.eventUp || (Game1.CurrentEvent != null && !Game1.CurrentEvent.isTileWalkedOn(x, y))) { - if ((int)__instance.parentSheetIndex == 590) + if (__instance.ParentSheetIndex == 590) { Vector2 position2 = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0), y * 64 + 32 + ((__instance.shakeTimer > 0) ? Game1.random.Next(-1, 2) : 0))); Color color = Color.White * alpha; Vector2 origin = new Vector2(8f, 8f); int artifactOffset = ((Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 1200.0 <= 400.0) ? ((int)(Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 400.0 / 100.0) * 16) : 0); - spriteBatch.Draw(textureModel.GetTexture(textureVariation), position2, new Rectangle(artifactOffset, textureOffset, 16, 16), color, 0f, origin, (__instance.scale.Y > 1f) ? __instance.getScale().Y : 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.isPassable() ? __instance.GetBoundingBoxAt(x, y).Top : __instance.GetBoundingBoxAt(x, y).Bottom) / 10000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), position2, new Rectangle(artifactOffset, textureOffset, 16, 16), color, 0f, origin, (__instance.scale.Y > 1f) ? __instance.getScale().Y : 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.isPassable() ? __instance.GetBoundingBoxAt(x, y).Top : __instance.GetBoundingBoxAt(x, y).Bottom) / 10000f); return false; } - if ((int)__instance.fragility != 2) + if (__instance.fragility.Value != 2) { spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64 + 32, y * 64 + 51 + 4)), Game1.shadowTexture.Bounds, Color.White * alpha, 0f, new Vector2(Game1.shadowTexture.Bounds.Center.X, Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)__instance.GetBoundingBoxAt(x, y).Bottom / 15000f); } @@ -180,7 +180,7 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int position3 = Game1.GlobalToLocal(Game1.viewport, new Vector2(x * 64, y * 64 - 64)); } - spriteBatch.Draw(textureModel.GetTexture(textureVariation), position3, new Rectangle(xTileOffset, textureOffset, textureModel.TextureWidth, textureModel.TextureHeight), color2, 0f, origin2, (__instance.scale.Y > 1f) ? __instance.getScale().Y : 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.isPassable() ? __instance.GetBoundingBoxAt(x, y).Top : __instance.GetBoundingBoxAt(x, y).Bottom) / 10000f); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), position3, new Rectangle(xTileOffset, textureOffset, textureModel.TextureWidth, textureModel.TextureHeight), color2, 0f, origin2, (__instance.scale.Y > 1f) ? __instance.getScale().Y : 4f, __instance.Flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.isPassable() ? __instance.GetBoundingBoxAt(x, y).Top : __instance.GetBoundingBoxAt(x, y).Bottom) / 10000f); if (__instance.heldObject.Value != null && __instance.IsSprinkler()) { // Unhandled sprinkler attachments @@ -189,7 +189,7 @@ internal static bool DrawPrefix(Object __instance, SpriteBatch spriteBatch, int } // Check if product is ready to display (if applicable) - if (!__instance.readyForHarvest) + if (!__instance.readyForHarvest.Value) { return false; } @@ -324,25 +324,25 @@ internal static void PlacementActionPostfix(Object __instance, bool __result, Ga } else if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceName) && AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceSeasonName)) { - var result = Game1.random.Next(2) > 0 ? AssignModData(placedObject, instanceSeasonName, true, placedObject.bigCraftable) : AssignModData(placedObject, instanceName, false, placedObject.bigCraftable); + var result = Game1.random.Next(2) > 0 ? AssignModData(placedObject, instanceSeasonName, true, placedObject.bigCraftable.Value) : AssignModData(placedObject, instanceName, false, placedObject.bigCraftable.Value); return; } else { if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceName)) { - AssignModData(placedObject, instanceName, false, placedObject.bigCraftable); + AssignModData(placedObject, instanceName, false, placedObject.bigCraftable.Value); return; } if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceSeasonName)) { - AssignModData(placedObject, instanceSeasonName, true, placedObject.bigCraftable); + AssignModData(placedObject, instanceSeasonName, true, placedObject.bigCraftable.Value); return; } } - AssignDefaultModData(placedObject, instanceSeasonName, true, placedObject.bigCraftable); + AssignDefaultModData(placedObject, instanceSeasonName, true, placedObject.bigCraftable.Value); } private static void ObjectPostfix(Object __instance, string itemId, int initialStack, bool isRecipe = false, int price = -1, int quality = 0) @@ -358,25 +358,25 @@ private static void ObjectPostfix(Object __instance, string itemId, int initialS if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceName) && AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceSeasonName)) { - var result = Game1.random.Next(2) > 0 ? AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable) : AssignModData(__instance, instanceName, false, __instance.bigCraftable); + var result = Game1.random.Next(2) > 0 ? AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable.Value) : AssignModData(__instance, instanceName, false, __instance.bigCraftable.Value); return; } else { if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceName)) { - AssignModData(__instance, instanceName, false, __instance.bigCraftable); + AssignModData(__instance, instanceName, false, __instance.bigCraftable.Value); return; } if (AlternativeTextures.textureManager.DoesObjectHaveAlternativeTexture(instanceSeasonName)) { - AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable); + AssignModData(__instance, instanceSeasonName, true, __instance.bigCraftable.Value); return; } } - AssignDefaultModData(__instance, instanceSeasonName, true, __instance.bigCraftable); + AssignDefaultModData(__instance, instanceSeasonName, true, __instance.bigCraftable.Value); } } } diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/ResourceClumpPatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/ResourceClumpPatch.cs index 0d4b9e5e..b2a69550 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/ResourceClumpPatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/ResourceClumpPatch.cs @@ -101,7 +101,7 @@ private static void ResourceClumpPostfix(ResourceClump __instance) private static string GetResourceClumpName(ResourceClump clump) { - switch (clump.parentSheetIndex) + switch (clump.parentSheetIndex.Value) { case 600: return "Stump"; diff --git a/AlternativeTextures/Framework/Patches/StandardObjects/TreePatch.cs b/AlternativeTextures/Framework/Patches/StandardObjects/TreePatch.cs index 250e3a32..ea2355df 100644 --- a/AlternativeTextures/Framework/Patches/StandardObjects/TreePatch.cs +++ b/AlternativeTextures/Framework/Patches/StandardObjects/TreePatch.cs @@ -52,10 +52,10 @@ private static bool DrawPrefix(Tree __instance, float ___shakeRotation, float __ Vector2 tileLocation = __instance.Tile; var textureOffset = textureModel.GetTextureOffset(textureVariation); - if ((int)__instance.growthStage < 5) + if (__instance.growthStage.Value < 5) { Rectangle sourceRect = Rectangle.Empty; - switch ((int)__instance.growthStage) + switch (__instance.growthStage.Value) { case 0: sourceRect = new Rectangle(32, 128, 16, 16); @@ -72,14 +72,14 @@ private static bool DrawPrefix(Tree __instance, float ___shakeRotation, float __ } sourceRect.Y += textureOffset; - spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f - (float)(sourceRect.Height * 4 - 64) + (float)(((int)__instance.growthStage >= 3) ? 128 : 64))), sourceRect, __instance.fertilized ? Color.HotPink : Color.White, ___shakeRotation, new Vector2(8f, ((int)__instance.growthStage >= 3) ? 32 : 16), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, ((int)__instance.growthStage == 0) ? 0.0001f : (__instance.getBoundingBox().Bottom / 10000f)); + spriteBatch.Draw(textureModel.GetTexture(textureVariation), Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f - (float)(sourceRect.Height * 4 - 64) + (float)((__instance.growthStage.Value >= 3) ? 128 : 64))), sourceRect, __instance.fertilized.Value ? Color.HotPink : Color.White, ___shakeRotation, new Vector2(8f, (__instance.growthStage.Value >= 3) ? 32 : 16), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (__instance.growthStage.Value == 0) ? 0.0001f : (__instance.getBoundingBox().Bottom / 10000f)); } else { var treeTexture = textureModel.GetTexture(textureVariation); - if (!__instance.stump || (bool)___falling) + if (!__instance.stump.Value || ___falling.Value) { - spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f - 51f, tileLocation.Y * 64f - 16f)), Tree.shadowSourceRect, Color.White * ((float)Math.PI / 2f - Math.Abs(___shakeRotation)), 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1E-06f); + spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f - 51f, tileLocation.Y * 64f - 16f)), Tree.shadowSourceRect, Color.White * ((float)Math.PI / 2f - Math.Abs(___shakeRotation)), 0f, Vector2.Zero, 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1E-06f); Rectangle source_rect = Tree.treeTopSourceRect; // TODO: Review if this code block is actually used @@ -101,7 +101,7 @@ private static bool DrawPrefix(Tree __instance, float ___shakeRotation, float __ source_rect.X = 96; } source_rect.Y += textureOffset; - spriteBatch.Draw(treeTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 64f)), source_rect, Color.White * ___alpha, ___shakeRotation, new Vector2(24f, 96f), 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.getBoundingBox().Bottom + 2) / 10000f - tileLocation.X / 1000000f); + spriteBatch.Draw(treeTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 64f)), source_rect, Color.White * ___alpha, ___shakeRotation, new Vector2(24f, 96f), 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.getBoundingBox().Bottom + 2) / 10000f - tileLocation.X / 1000000f); } var stumpSource = new Rectangle(Tree.stumpSourceRect.X, Tree.stumpSourceRect.Y + textureOffset, Tree.stumpSourceRect.Width, Tree.stumpSourceRect.Height); @@ -109,13 +109,13 @@ private static bool DrawPrefix(Tree __instance, float ___shakeRotation, float __ { stumpSource.X += 96; } - if (__instance.health.Value >= 1f || (!___falling && __instance.health.Value > -99f)) + if (__instance.health.Value >= 1f || (!___falling.Value && __instance.health.Value > -99f)) { - spriteBatch.Draw(treeTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + ((___shakeTimer > 0f) ? ((float)Math.Sin(Math.PI * 2.0 / (double)___shakeTimer) * 3f) : 0f), tileLocation.Y * 64f - 64f)), stumpSource, Color.White * ___alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)__instance.getBoundingBox().Bottom / 10000f); + spriteBatch.Draw(treeTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + ((___shakeTimer > 0f) ? ((float)Math.Sin(Math.PI * 2.0 / (double)___shakeTimer) * 3f) : 0f), tileLocation.Y * 64f - 64f)), stumpSource, Color.White * ___alpha, 0f, Vector2.Zero, 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)__instance.getBoundingBox().Bottom / 10000f); } - if ((bool)__instance.stump && __instance.health.Value < 4f && __instance.health.Value > -99f) + if ((bool)__instance.stump.Value && __instance.health.Value < 4f && __instance.health.Value > -99f) { - spriteBatch.Draw(treeTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + ((___shakeTimer > 0f) ? ((float)Math.Sin(Math.PI * 2.0 / (double)___shakeTimer) * 3f) : 0f), tileLocation.Y * 64f)), new Rectangle(Math.Min(2, (int)(3f - __instance.health.Value)) * 16, 144 + textureOffset, 16, 16), Color.White * ___alpha, 0f, Vector2.Zero, 4f, __instance.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.getBoundingBox().Bottom + 1) / 10000f); + spriteBatch.Draw(treeTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2(tileLocation.X * 64f + ((___shakeTimer > 0f) ? ((float)Math.Sin(Math.PI * 2.0 / (double)___shakeTimer) * 3f) : 0f), tileLocation.Y * 64f)), new Rectangle(Math.Min(2, (int)(3f - __instance.health.Value)) * 16, 144 + textureOffset, 16, 16), Color.White * ___alpha, 0f, Vector2.Zero, 4f, __instance.flipped.Value ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (float)(__instance.getBoundingBox().Bottom + 1) / 10000f); } } foreach (Leaf i in ___leaves) diff --git a/AlternativeTextures/Framework/Patches/Tools/ToolPatch.cs b/AlternativeTextures/Framework/Patches/Tools/ToolPatch.cs index 64b989b1..90645a14 100644 --- a/AlternativeTextures/Framework/Patches/Tools/ToolPatch.cs +++ b/AlternativeTextures/Framework/Patches/Tools/ToolPatch.cs @@ -352,7 +352,7 @@ internal static bool UsePaintBucket(GameLocation location, int x, int y, Farmer }; buildingObj.modData.SetFromSerialization(targetedBuilding.modData); - Game1.activeClickableMenu = GetMenu(buildingObj, buildingObj.TileLocation * 64f, GetTextureType(targetedBuilding), modelName, _helper.Translation.Get("tools.name.paint_bucket"), textureTileWidth: targetedBuilding.tilesWide, isSprayCan: isSprayCan); + Game1.activeClickableMenu = GetMenu(buildingObj, buildingObj.TileLocation * 64f, GetTextureType(targetedBuilding), modelName, _helper.Translation.Get("tools.name.paint_bucket"), textureTileWidth: targetedBuilding.tilesWide.Value, isSprayCan: isSprayCan); return CancelUsing(who); } @@ -459,7 +459,7 @@ internal static bool UsePaintBucket(GameLocation location, int x, int y, Farmer else if (targetedTerrain is FruitTree fruitTree) { Dictionary data = Game1.content.Load>("Data\\fruitTrees"); - var saplingName = Game1.fruitTreeData.ContainsKey(fruitTree.treeId) ? Game1.objectData[fruitTree.treeId].Name : String.Empty; + var saplingName = Game1.fruitTreeData.ContainsKey(fruitTree.treeId.Value) ? Game1.objectData[fruitTree.treeId.Value].Name : String.Empty; var instanceSeasonName = $"{AlternativeTextureModel.TextureType.FruitTree}_{saplingName}_{Game1.GetSeasonForLocation(Game1.currentLocation)}"; AssignDefaultModData(targetedTerrain, instanceSeasonName, true); diff --git a/AlternativeTextures/Framework/UI/PaintBucketMenu.cs b/AlternativeTextures/Framework/UI/PaintBucketMenu.cs index 721562de..9efb0b0a 100644 --- a/AlternativeTextures/Framework/UI/PaintBucketMenu.cs +++ b/AlternativeTextures/Framework/UI/PaintBucketMenu.cs @@ -113,7 +113,7 @@ public PaintBucketMenu(Object target, Vector2 position, TextureType textureType, if (target is Furniture furniture) { - (objectWithVariation as Furniture).currentRotation.Value = furniture.currentRotation; + (objectWithVariation as Furniture).currentRotation.Value = furniture.currentRotation.Value; (objectWithVariation as Furniture).updateRotation(); } @@ -139,7 +139,7 @@ public PaintBucketMenu(Object target, Vector2 position, TextureType textureType, if (target is Furniture furniture) { - (objectWithVariation as Furniture).currentRotation.Value = furniture.currentRotation; + (objectWithVariation as Furniture).currentRotation.Value = furniture.currentRotation.Value; (objectWithVariation as Furniture).updateRotation(); } @@ -314,7 +314,7 @@ public PaintBucketMenu(Object target, Vector2 position, TextureType textureType, if (target is Furniture) { - (vanillaObject as Furniture).currentRotation.Value = (target as Furniture).currentRotation; + (vanillaObject as Furniture).currentRotation.Value = (target as Furniture).currentRotation.Value; (vanillaObject as Furniture).updateRotation(); } @@ -788,8 +788,8 @@ public override void draw(SpriteBatch b) } else if (_textureType is TextureType.Craftable && PatchTemplate.GetObjectAt(Game1.currentLocation, (int)_position.X, (int)_position.Y) != null) { - this.availableTextures[i].texture = _textureTarget.bigCraftable ? Game1.bigCraftableSpriteSheet : Game1.objectSpriteSheet; - this.availableTextures[i].sourceRect = _textureTarget.bigCraftable ? Object.getSourceRectForBigCraftable(_textureTarget.parentSheetIndex) : GameLocation.getSourceRectForObject(_textureTarget.ParentSheetIndex); + this.availableTextures[i].texture = _textureTarget.bigCraftable.Value ? Game1.bigCraftableSpriteSheet : Game1.objectSpriteSheet; + this.availableTextures[i].sourceRect = _textureTarget.bigCraftable.Value ? Object.getSourceRectForBigCraftable(_textureTarget.ParentSheetIndex) : GameLocation.getSourceRectForObject(_textureTarget.ParentSheetIndex); this.availableTextures[i].draw(b, colorOverlay, 0.87f); } else if (PatchTemplate.GetObjectAt(Game1.currentLocation, (int)_position.X, (int)_position.Y) != null) @@ -827,7 +827,7 @@ public override void draw(SpriteBatch b) } else if (PatchTemplate.GetTerrainFeatureAt(Game1.currentLocation, (int)_position.X, (int)_position.Y) is Flooring flooring) { - this.availableTextures[i].texture = Game1.GetSeasonForLocation(flooring.Location) is Season.Winter && (flooring.Location == null || !flooring.Location.isGreenhouse) ? flooring.floorTextureWinter : flooring.floorTexture; + this.availableTextures[i].texture = Game1.GetSeasonForLocation(flooring.Location) is Season.Winter && (flooring.Location == null || !flooring.Location.isGreenhouse.Value) ? flooring.floorTextureWinter : flooring.floorTexture; this.availableTextures[i].sourceRect = this.GetFlooringSourceRect(textureModel, flooring, this.availableTextures[i].sourceRect.Height, -1); this.availableTextures[i].draw(b, colorOverlay, 0.87f); } @@ -1067,24 +1067,24 @@ private static Rectangle GetFenceSourceRect(AlternativeTextureModel textureModel int drawSum = fence.getDrawSum(); sourceRectPosition = Fence.fenceDrawGuide[drawSum]; - var gateOffset = fence.isGate && variation != -1 ? 128 : 0; - if ((bool)fence.isGate) + var gateOffset = fence.isGate.Value && variation != -1 ? 128 : 0; + if (fence.isGate.Value) { Vector2 offset = new Vector2(0f, 0f); switch (drawSum) { case 10: - return new Rectangle(((int)fence.gatePosition == 88) ? 24 : 0, textureOffset + (192 - gateOffset) + 16, 24, 32); + return new Rectangle((fence.gatePosition.Value == 88) ? 24 : 0, textureOffset + (192 - gateOffset) + 16, 24, 32); case 100: - return new Rectangle(((int)fence.gatePosition == 88) ? 24 : 0, textureOffset + (240 - gateOffset) + 16, 24, 32); + return new Rectangle((fence.gatePosition.Value == 88) ? 24 : 0, textureOffset + (240 - gateOffset) + 16, 24, 32); case 1000: - return new Rectangle(((int)fence.gatePosition == 88) ? 24 : 0, textureOffset + (288 - gateOffset), 24, 32); + return new Rectangle((fence.gatePosition.Value == 88) ? 24 : 0, textureOffset + (288 - gateOffset), 24, 32); case 500: - return new Rectangle(((int)fence.gatePosition == 88) ? 24 : 0, textureOffset + (320 - gateOffset), 24, 32); + return new Rectangle((fence.gatePosition.Value == 88) ? 24 : 0, textureOffset + (320 - gateOffset), 24, 32); case 110: - return new Rectangle(((int)fence.gatePosition == 88) ? 24 : 0, textureOffset + (128 - gateOffset), 24, 32); + return new Rectangle((fence.gatePosition.Value == 88) ? 24 : 0, textureOffset + (128 - gateOffset), 24, 32); case 1500: - return new Rectangle(((int)fence.gatePosition == 88) ? 16 : 0, textureOffset + (160 - gateOffset), 16, 16); + return new Rectangle((fence.gatePosition.Value == 88) ? 16 : 0, textureOffset + (160 - gateOffset), 16, 16); } sourceRectPosition = 5; }