Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

Commit

Permalink
Beta 0.0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
steviegt6 committed Oct 10, 2020
1 parent 28c3d30 commit 7ce07b5
Show file tree
Hide file tree
Showing 17 changed files with 605 additions and 17 deletions.
27 changes: 27 additions & 0 deletions patches/Tea/Terraria/DataStructures/PlayerDrawLayers.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@
return;

Vector2 zero = Vector2.Zero;
@@ -1859,7 +_,7 @@

float scale = heldItem.scale;
Main.instance.LoadItem(num);
- Texture2D value = TextureAssets.Item[num].Value;
+ Texture2D value = ItemLoader.itemTexture[num];
Vector2 position = new Vector2((int)(drawinfo.ItemLocation.X - Main.screenPosition.X), (int)(drawinfo.ItemLocation.Y - Main.screenPosition.Y));
Rectangle? sourceRect = new Rectangle(0, 0, value.Width, value.Height);
if (num == 75)
@@ -2147,7 +_,7 @@
if (drawinfo.usesCompositeTorso) {
DrawPlayer_28_ArmOverItemComposite(ref drawinfo);
Expand Down Expand Up @@ -191,6 +200,24 @@
DrawData item = new DrawData(TextureAssets.AccHandsOn[drawinfo.drawPlayer.handon].Value, new Vector2((int)(drawinfo.Position.X - Main.screenPosition.X - (float)(drawinfo.drawPlayer.bodyFrame.Width / 2) + (float)(drawinfo.drawPlayer.width / 2)), (int)(drawinfo.Position.Y - Main.screenPosition.Y + (float)drawinfo.drawPlayer.height - (float)drawinfo.drawPlayer.bodyFrame.Height + 4f)) + drawinfo.drawPlayer.bodyPosition + new Vector2(drawinfo.drawPlayer.bodyFrame.Width / 2, drawinfo.drawPlayer.bodyFrame.Height / 2), drawinfo.drawPlayer.bodyFrame, drawinfo.colorArmorBody, drawinfo.drawPlayer.bodyRotation, drawinfo.bodyVect, 1f, drawinfo.playerEffect, 0);
item.shader = drawinfo.cHandOn;
drawinfo.DrawDataCache.Add(item);
@@ -2329,14 +_,14 @@
return;

Main.instance.LoadItem(heldItem.type);
- Asset<Texture2D> asset = TextureAssets.Item[heldItem.type];
+ Texture2D value = ItemLoader.itemTexture[heldItem.type];
if (!drawinfo.drawPlayer.frozen && (drawinfo.drawPlayer.itemAnimation > 0 || (heldItem.holdStyle != 0 && !drawinfo.drawPlayer.pulley)) && heldItem.type > 0 && !drawinfo.drawPlayer.dead && !heldItem.noUseGraphic && (!drawinfo.drawPlayer.wet || !heldItem.noWet)) {
if (drawinfo.drawPlayer.gravDir == -1f) {
- DrawData item = new DrawData(asset.Value, new Vector2((int)(drawinfo.ItemLocation.X - Main.screenPosition.X), (int)(drawinfo.ItemLocation.Y - Main.screenPosition.Y)), new Rectangle(0, 0, asset.Width(), asset.Height()), heldItem.GetAlpha(drawinfo.itemColor), drawinfo.drawPlayer.itemRotation, new Vector2((float)asset.Width() * 0.5f - (float)asset.Width() * 0.5f * (float)drawinfo.drawPlayer.direction, 0f), heldItem.scale, drawinfo.itemEffect, 0);
+ DrawData item = new DrawData(value, new Vector2((int)(drawinfo.ItemLocation.X - Main.screenPosition.X), (int)(drawinfo.ItemLocation.Y - Main.screenPosition.Y)), new Rectangle(0, 0, value.Width, value.Height), heldItem.GetAlpha(drawinfo.itemColor), drawinfo.drawPlayer.itemRotation, new Vector2((float)value.Width * 0.5f - (float)value.Width * 0.5f * (float)drawinfo.drawPlayer.direction, 0f), heldItem.scale, drawinfo.itemEffect, 0);
drawinfo.DrawDataCache.Add(item);
}
else {
- DrawData item = new DrawData(asset.Value, new Vector2((int)(drawinfo.ItemLocation.X - Main.screenPosition.X), (int)(drawinfo.ItemLocation.Y - Main.screenPosition.Y)), new Rectangle(0, 0, asset.Width(), asset.Height()), heldItem.GetAlpha(drawinfo.itemColor), drawinfo.drawPlayer.itemRotation, new Vector2((float)asset.Width() * 0.5f - (float)asset.Width() * 0.5f * (float)drawinfo.drawPlayer.direction, asset.Height()), heldItem.scale, drawinfo.itemEffect, 0);
+ DrawData item = new DrawData(value, new Vector2((int)(drawinfo.ItemLocation.X - Main.screenPosition.X), (int)(drawinfo.ItemLocation.Y - Main.screenPosition.Y)), new Rectangle(0, 0, value.Width, value.Height), heldItem.GetAlpha(drawinfo.itemColor), drawinfo.drawPlayer.itemRotation, new Vector2((float)value.Width * 0.5f - (float)value.Width * 0.5f * (float)drawinfo.drawPlayer.direction, value.Height), heldItem.scale, drawinfo.itemEffect, 0);
drawinfo.DrawDataCache.Add(item);
}
}
@@ -2348,7 +_,7 @@
}

Expand Down
37 changes: 37 additions & 0 deletions patches/Tea/Terraria/GameContent/Drawing/TileDrawing.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- src/Terraria/Terraria/GameContent/Drawing/TileDrawing.cs
+++ src/Tea/Terraria/GameContent/Drawing/TileDrawing.cs
@@ -10,6 +_,7 @@
using Terraria.Graphics.Capture;
using Terraria.ID;
using Terraria.ObjectData;
+using Terraria.Tea;
using Terraria.UI;
using Terraria.Utilities;

@@ -5336,7 +_,7 @@
item.netDefaults(num5);
item.Prefix(frameX2);
Main.instance.LoadItem(item.type);
- Texture2D value = TextureAssets.Item[item.type].Value;
+ Texture2D value = ItemLoader.itemTexture[item.type];
Rectangle value2 = (Main.itemAnimations[item.type] == null) ? value.Frame() : Main.itemAnimations[item.type].GetFrame(value);
int width = value2.Width;
int height = value2.Height;
@@ -5366,7 +_,7 @@
Item item3 = ((TEFoodPlatter)TileEntity.ByPosition[new Point16(num, num2)]).item;
if (!item3.IsAir) {
Main.instance.LoadItem(item3.type);
- Texture2D value3 = TextureAssets.Item[item3.type].Value;
+ Texture2D value3 = ItemLoader.itemTexture[item3.type];
Rectangle value4 = (!ItemID.Sets.IsFood[item3.type]) ? value3.Frame() : value3.Frame(1, 3, 0, 2);
int width2 = value4.Width;
int height2 = value4.Height;
@@ -5389,7 +_,7 @@
if (type == 471) {
Item item4 = (TileEntity.ByPosition[new Point16(num, num2)] as TEWeaponsRack).item;
Main.instance.LoadItem(item4.type);
- Texture2D value5 = TextureAssets.Item[item4.type].Value;
+ Texture2D value5 = ItemLoader.itemTexture[item4.type];
Rectangle value6 = (Main.itemAnimations[item4.type] == null) ? value5.Frame() : Main.itemAnimations[item4.type].GetFrame(value5);
int width3 = value6.Width;
int height3 = value6.Height;
19 changes: 19 additions & 0 deletions patches/Tea/Terraria/GameContent/UI/Chat/ItemTagHandler.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- src/Terraria/Terraria/GameContent/UI/Chat/ItemTagHandler.cs
+++ src/Tea/Terraria/GameContent/UI/Chat/ItemTagHandler.cs
@@ -1,6 +_,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
+using Terraria.Tea;
using Terraria.UI;
using Terraria.UI.Chat;

@@ -27,7 +_,7 @@
float num2 = 1f;
if (Main.netMode != 2 && !Main.dedServ) {
Main.instance.LoadItem(_item.type);
- Texture2D value = TextureAssets.Item[_item.type].Value;
+ Texture2D value = ItemLoader.itemTexture[_item.type];
Rectangle rectangle = (Main.itemAnimations[_item.type] == null) ? value.Frame() : Main.itemAnimations[_item.type].GetFrame(value);
if (rectangle.Height > 32)
num2 = 32f / (float)rectangle.Height;
31 changes: 31 additions & 0 deletions patches/Tea/Terraria/GameContent/UI/CustomCurrencyManager.cs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- src/Terraria/Terraria/GameContent/UI/CustomCurrencyManager.cs
+++ src/Tea/Terraria/GameContent/UI/CustomCurrencyManager.cs
@@ -2,6 +_,7 @@
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using Terraria.ID;
+using Terraria.Tea;

namespace Terraria.GameContent.UI
{
@@ -37,16 +_,16 @@
Main.instance.LoadItem(346);
Main.instance.LoadItem(87);
if (num4 > 0)
- sb.Draw(TextureAssets.Item[4076].Value, Utils.CenteredRectangle(new Vector2(shopx + 96f, shopy + 50f), TextureAssets.Item[4076].Value.Size() * 0.65f), null, Color.White);
+ sb.Draw(ItemLoader.itemTexture[4076], Utils.CenteredRectangle(new Vector2(shopx + 96f, shopy + 50f), ItemLoader.itemTexture[4076].Size() * 0.65f), null, Color.White);

if (num3 > 0)
- sb.Draw(TextureAssets.Item[3813].Value, Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), TextureAssets.Item[3813].Value.Size() * 0.65f), null, Color.White);
+ sb.Draw(ItemLoader.itemTexture[3813], Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), ItemLoader.itemTexture[3813].Size() * 0.65f), null, Color.White);

if (num2 > 0)
- sb.Draw(TextureAssets.Item[346].Value, Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), TextureAssets.Item[346].Value.Size() * 0.65f), null, Color.White);
+ sb.Draw(ItemLoader.itemTexture[346], Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), ItemLoader.itemTexture[346].Size() * 0.65f), null, Color.White);

if (num > 0)
- sb.Draw(TextureAssets.Item[87].Value, Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), TextureAssets.Item[87].Value.Size() * 0.65f), null, Color.White);
+ sb.Draw(ItemLoader.itemTexture[87], Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), ItemLoader.itemTexture[87].Size() * 0.65f), null, Color.White);

Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.Value, Lang.inter[66].Value, shopx, shopy + 40f, Color.White * ((float)(int)Main.mouseTextColor / 255f), Color.Black, Vector2.Zero);
customCurrencySystem.DrawSavingsMoney(sb, Lang.inter[66].Value, shopx, shopy, num5, horizontal);
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- src/Terraria/Terraria/GameContent/UI/CustomCurrencySingleCoin.cs
+++ src/Tea/Terraria/GameContent/UI/CustomCurrencySingleCoin.cs
@@ -4,6 +_,7 @@
using System.Collections.Generic;
using System.Linq;
using Terraria.Localization;
+using Terraria.Tea;
using Terraria.UI.Chat;

namespace Terraria.GameContent.UI
@@ -68,7 +_,7 @@
public override void DrawSavingsMoney(SpriteBatch sb, string text, float shopx, float shopy, long totalCoins, bool horizontal = false) {
int num = _valuePerUnit.Keys.ElementAt(0);
Main.instance.LoadItem(num);
- Texture2D value = TextureAssets.Item[num].Value;
+ Texture2D value = ItemLoader.itemTexture[num];
if (horizontal) {
_ = 99;
Vector2 position = new Vector2(shopx + ChatManager.GetStringSize(FontAssets.MouseText.Value, text, Vector2.One).X + 45f, shopy + 50f);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- src/Terraria/Terraria/GameContent/UI/Elements/UIDynamicItemCollection.cs
+++ src/Tea/Terraria/GameContent/UI/Elements/UIDynamicItemCollection.cs
@@ -34,8 +_,6 @@
Rectangle itemSlotHitbox = GetItemSlotHitbox(startX, startY, startItemIndex, i);
Item inv = ContentSamples.ItemsByType[num2];
int context = 29;
- if (TextureAssets.Item[num2].State == AssetState.NotLoaded)
- num--;

bool cREATIVE_ItemSlotShouldHighlightAsSelected = false;
if (base.IsMouseHovering && itemSlotHitbox.Contains(Main.MouseScreen.ToPoint()) && !PlayerInput.IgnoreMouseInterface) {
@@ -56,10 +_,6 @@
while (_itemIdsToLoadTexturesFor.Count > 0 && num > 0) {
int num3 = _itemIdsToLoadTexturesFor[0];
_itemIdsToLoadTexturesFor.RemoveAt(0);
- if (TextureAssets.Item[num3].State == AssetState.NotLoaded) {
- Main.instance.LoadItem(num3);
- num -= 4;
- }
}
}

32 changes: 30 additions & 2 deletions patches/Tea/Terraria/Initializers/AssetInitializer.cs.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
--- src/Terraria/Terraria/Initializers/AssetInitializer.cs
+++ src/Tea/Terraria/Initializers/AssetInitializer.cs
@@ -54,6 +_,7 @@
@@ -14,6 +_,7 @@
using Terraria.GameContent.UI;
using Terraria.ID;
using Terraria.IO;
+using Terraria.Tea;
using Terraria.Utilities;

namespace Terraria.Initializers
@@ -52,8 +_,9 @@
TextureAssets.SplashTextureLegoBack = LoadAsset<Texture2D>("Images\\SplashScreens\\Splash_" + num + "_0", AssetRequestMode.ImmediateLoad);
TextureAssets.SplashTextureLegoTree = LoadAsset<Texture2D>("Images\\SplashScreens\\Splash_" + num + "_1", AssetRequestMode.ImmediateLoad);
TextureAssets.SplashTextureLegoFront = LoadAsset<Texture2D>("Images\\SplashScreens\\Splash_" + num + "_2", AssetRequestMode.ImmediateLoad);
TextureAssets.Item[75] = LoadAsset<Texture2D>("Images\\Item_" + (short)75, AssetRequestMode.ImmediateLoad);
- TextureAssets.Item[75] = LoadAsset<Texture2D>("Images\\Item_" + (short)75, AssetRequestMode.ImmediateLoad);
+ ItemLoader.itemTexture[75] = Loader.GetTexture("Terraria/Item_" + 75);
TextureAssets.LoadingSunflower = LoadAsset<Texture2D>("Images\\UI\\Sunflower_Loading", AssetRequestMode.ImmediateLoad);
+ TextureAssets.TeaTexture = LoadAsset<Texture2D>("Tea\\UI\\Tea", AssetRequestMode.ImmediateLoad);
}

public static void LoadAssetsWhileInInitialBlackScreen() {
@@ -91,10 +_,12 @@
private static void LoadTextures(AssetRequestMode mode) {
for (int i = 0; i < TextureAssets.Item.Length; i++) {
int num = ItemID.Sets.TextureCopyLoad[i];
- if (num != -1)
- TextureAssets.Item[i] = TextureAssets.Item[num];
- else
- TextureAssets.Item[i] = LoadAsset<Texture2D>("Images/Item_" + i, AssetRequestMode.DoNotLoad);
+ if (num != -1) {
+ ItemLoader.itemTexture[i] = ItemLoader.itemTexture[num];
+ }
+ else {
+ ItemLoader.itemTexture[i] = Loader.GetTexture("Terraria/Item_" + i);
+ }
}

for (int j = 0; j < TextureAssets.Npc.Length; j++) {
1 change: 1 addition & 0 deletions patches/Tea/Terraria/Item.Tea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace Terraria
partial class Item
{
public ModItem modItem { get; internal set; }
public string name = "";
}
}
35 changes: 35 additions & 0 deletions patches/Tea/Terraria/Item.cs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
{
private string _nameOverride;
public const int luckPotionDuration1 = 10800;
@@ -156,7 +_,7 @@
public const int WALL_PLACEMENT_USETIME = 7;
public static int numberOfNewItems = 0;

- public string Name => _nameOverride ?? Lang.GetItemNameValue(type);
+ public string Name => _nameOverride ?? (string.IsNullOrWhiteSpace(name) ? Lang.GetItemNameValue(type) : name);

public string HoverName {
get {
@@ -291,7 +_,7 @@
num = -1;

Expand Down Expand Up @@ -116,6 +125,32 @@
if (ItemID.Sets.ItemNoGravity[type]) {
base.velocity.X *= 0.95f;
if ((double)base.velocity.X < 0.1 && (double)base.velocity.X > -0.1)
@@ -45594,11 +_,11 @@
public static Rectangle GetDrawHitbox(int type, Player user) {
Main.instance.LoadItem(type);
if (ItemID.Sets.IsFood[type])
- return TextureAssets.Item[type].Frame(1, 3, 0, 1);
+ return ItemLoader.itemTexture[type].Frame(1, 3, 0, 1);

switch (type) {
case 75:
- return TextureAssets.Item[type].Frame(1, 8);
+ return ItemLoader.itemTexture[type].Frame(1, 8);
case 520:
case 521:
case 547:
@@ -45613,9 +_,9 @@
case 4068:
case 4069:
case 4070:
- return TextureAssets.Item[type].Frame(1, 4);
+ return ItemLoader.itemTexture[type].Frame(1, 4);
default:
- return TextureAssets.Item[type].Frame();
+ return ItemLoader.itemTexture[type].Frame();
}
}

@@ -45777,8 +_,25 @@
}
}
Expand Down
Loading

0 comments on commit 7ce07b5

Please sign in to comment.