Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AlternativeTextures/AlternativeTextures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions AlternativeTextures/Framework/Patches/Buildings/BuildingPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions AlternativeTextures/Framework/Patches/PatchTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal static string GetObjectName(Object obj)
}
}

if (obj.bigCraftable)
if (obj.bigCraftable.Value)
{
if (!Game1.bigCraftableData.ContainsKey(obj.ItemId))
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand All @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Loading