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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace AlternativeTextures.Framework.Interfaces
{
public interface IMoreGiantCropsApi
{
Texture2D? GetTexture(int productIndex);
Texture2D GetTexture(int productIndex);
}
}
10 changes: 4 additions & 6 deletions AlternativeTextures/Framework/Patches/Entities/PetPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ internal void Apply(Harmony harmony)
harmony.Patch(AccessTools.Method(_entity, nameof(Pet.draw), new[] { typeof(SpriteBatch) }), prefix: new HarmonyMethod(GetType(), nameof(DrawPrefix)));
harmony.Patch(AccessTools.Method(_entity, nameof(Pet.update), new[] { typeof(GameTime), typeof(GameLocation) }), postfix: new HarmonyMethod(GetType(), nameof(UpdatePostfix)));

harmony.Patch(AccessTools.Constructor(typeof(Cat), new[] { typeof(int), typeof(int), typeof(string), typeof(string) }), postfix: new HarmonyMethod(GetType(), nameof(PetPostfix)));
harmony.Patch(AccessTools.Constructor(typeof(Dog), new[] { typeof(int), typeof(int), typeof(string), typeof(string) }), postfix: new HarmonyMethod(GetType(), nameof(PetPostfix)));
harmony.Patch(AccessTools.Constructor(typeof(Pet), new[] { typeof(int), typeof(int), typeof(string), typeof(string) }), postfix: new HarmonyMethod(GetType(), nameof(PetPostfix)));
}

private static void ReloadBreedSpritePostfix(Pet __instance)
Expand Down Expand Up @@ -77,10 +76,9 @@ private static bool DrawPrefix(Pet __instance, int ___shakeTimer, SpriteBatch b)
b.Draw(__instance.Sprite.Texture, __instance.getLocalPosition(Game1.viewport) + new Vector2(__instance.Sprite.SpriteWidth * 4 / 2, __instance.GetBoundingBox().Height / 2) + ((___shakeTimer > 0) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero), __instance.Sprite.SourceRect, Color.White, __instance.rotation, new Vector2(__instance.Sprite.SpriteWidth / 2, (float)__instance.Sprite.SpriteHeight * 3f / 4f), Math.Max(0.2f, __instance.Scale) * 4f, (__instance.flip || (__instance.Sprite.CurrentAnimation != null && __instance.Sprite.CurrentAnimation[__instance.Sprite.currentAnimationIndex].flip)) ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, __instance.isSleepingOnFarmerBed.Value ? (((float)__instance.StandingPixel.Y + 112f) / 10000f) : ((float)__instance.StandingPixel.Y / 10000f)));
if (__instance.IsEmoting)
{
Vector2 emotePosition = __instance.getLocalPosition(Game1.viewport);
emotePosition.X += 32f;
emotePosition.Y -= 96 + ((__instance is Dog) ? 16 : 0);
b.Draw(Game1.emoteSpriteSheet, emotePosition, new Rectangle(__instance.CurrentEmoteIndex * 16 % Game1.emoteSpriteSheet.Width, __instance.CurrentEmoteIndex * 16 / Game1.emoteSpriteSheet.Width * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)__instance.StandingPixel.Y / 10000f + 0.0001f);
Vector2 localPosition = __instance.getLocalPosition(Game1.viewport);
Point point = __instance.GetPetData()?.EmoteOffset ?? Point.Zero;
b.Draw(Game1.emoteSpriteSheet, new Vector2(localPosition.X + 32f + (float)point.X, localPosition.Y - 96f + (float)point.Y), new Rectangle(__instance.CurrentEmoteIndex * 16 % Game1.emoteSpriteSheet.Width, __instance.CurrentEmoteIndex * 16 / Game1.emoteSpriteSheet.Width * 16, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)__instance.StandingPixel.Y / 10000f + 0.0001f);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ private static bool DrawPrefix(Chest __instance, int ___currentLidFrame, int ___

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(0, textureOffset, 16, 32), __instance.Tint * 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 * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f);
return false;
}
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(0, textureOffset, 16, 32), __instance.Tint * 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 * alpha * alpha, 0f, Vector2.Zero, 4f, SpriteEffects.None, base_sort_order + 1E-05f);
return false;
}
if (__instance.giftbox.Value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ private static bool DrawPrefix(CrabPot __instance, float ___yBob, Vector2 ___sha
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.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);
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ private static bool DrawPrefix(IndoorPot __instance, SpriteBatch spriteBatch, in
Rectangle fertilizer_rect = __instance.hoeDirt.Value.GetFertilizerSourceRect();
fertilizer_rect.Width = 13;
fertilizer_rect.Height = 13;
spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.tileLocation.X * 64f + 4f, __instance.tileLocation.Y * 64f - 12f)), fertilizer_rect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (__instance.tileLocation.Y + 0.65f) * 64f / 10000f + (float)x * 1E-05f);
spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2(__instance.TileLocation.X * 64f + 4f, __instance.TileLocation.Y * 64f - 12f)), fertilizer_rect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (__instance.TileLocation.Y + 0.65f) * 64f / 10000f + (float)x * 1E-05f);
}
if (__instance.hoeDirt.Value.crop != null)
{
__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)
{
__instance.heldObject.Value.draw(spriteBatch, x * 64, y * 64 - 48, (__instance.tileLocation.Y + 0.66f) * 64f / 10000f + (float)x * 1E-05f, 1f);
__instance.heldObject.Value.draw(spriteBatch, x * 64, y * 64 - 48, (__instance.TileLocation.Y + 0.66f) * 64f / 10000f + (float)x * 1E-05f, 1f);
}
if (__instance.bush.Value != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ 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.Value)
if (!__instance.IsOn)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static bool DrawPrefix(Phone __instance, NetRef<Object> ___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.Value ? 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 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, draw_layer + 0.00175f);
}
if (___depositedItem.Value != null && __instance.MinutesUntilReady > 0)
{
Expand All @@ -80,13 +80,13 @@ private static bool DrawPrefix(Phone __instance, NetRef<Object> ___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 + ((__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 + ((__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, __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));
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static bool DrawPrefix(FruitTree __instance, float ___shakeRotation, flo
Vector2 tileLocation = __instance.Tile;

string season = Game1.GetSeasonForLocation(__instance.Location).ToString();
if (__instance.greenHouseTileTree.Value)
if (__instance.GreenHouseTileTree)
{
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);
}
Expand Down
Loading