Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawProj_FishingLine()

static void Terraria.Main.DrawProj_FishingLine ( Projectile proj,
ref float polePosX,
ref float polePosY,
Vector2 mountedCenter )
inlinestaticprivate

Definition at line 32719 of file Main.cs.

32720 {
32721 Player player = Main.player[proj.owner];
32724 polePosY += player.gfxOffY;
32725 if (player.mount.Active && player.mount.Type == 52)
32726 {
32727 polePosX -= player.direction * 14;
32728 polePosY -= -10f;
32729 }
32730 int type = player.inventory[player.selectedItem].type;
32731 Microsoft.Xna.Framework.Color stringColor = new Microsoft.Xna.Framework.Color(200, 200, 200, 100);
32732 if (type == 2294)
32733 {
32734 stringColor = new Microsoft.Xna.Framework.Color(100, 180, 230, 100);
32735 }
32736 if (type == 2295)
32737 {
32738 stringColor = new Microsoft.Xna.Framework.Color(250, 90, 70, 100);
32739 }
32740 if (type == 2293)
32741 {
32742 stringColor = new Microsoft.Xna.Framework.Color(203, 190, 210, 100);
32743 }
32744 if (type == 2421)
32745 {
32746 stringColor = new Microsoft.Xna.Framework.Color(183, 77, 112, 100);
32747 }
32748 if (type == 2422)
32749 {
32750 stringColor = new Microsoft.Xna.Framework.Color(255, 226, 116, 100);
32751 }
32752 if (type == 4325)
32753 {
32754 stringColor = new Microsoft.Xna.Framework.Color(200, 100, 100, 100);
32755 }
32756 if (type == 4442)
32757 {
32758 stringColor = new Microsoft.Xna.Framework.Color(100, 100, 200, 100);
32759 }
32760 stringColor = TryApplyingPlayerStringColor(Main.player[proj.owner].stringColor, stringColor);
32761 float gravDir = Main.player[proj.owner].gravDir;
32762 switch (type)
32763 {
32764 case 2289:
32765 polePosX += 43 * Main.player[proj.owner].direction;
32766 if (Main.player[proj.owner].direction < 0)
32767 {
32768 polePosX -= 13f;
32769 }
32770 polePosY -= 36f * gravDir;
32771 break;
32772 case 2291:
32773 polePosX += 43 * Main.player[proj.owner].direction;
32774 if (Main.player[proj.owner].direction < 0)
32775 {
32776 polePosX -= 13f;
32777 }
32778 polePosY -= 34f * gravDir;
32779 break;
32780 case 2292:
32781 polePosX += 46 * Main.player[proj.owner].direction;
32782 if (Main.player[proj.owner].direction < 0)
32783 {
32784 polePosX -= 13f;
32785 }
32786 polePosY -= 34f * gravDir;
32787 break;
32788 case 2293:
32789 polePosX += 43 * Main.player[proj.owner].direction;
32790 if (Main.player[proj.owner].direction < 0)
32791 {
32792 polePosX -= 13f;
32793 }
32794 polePosY -= 34f * gravDir;
32795 break;
32796 case 2294:
32797 polePosX += 43 * Main.player[proj.owner].direction;
32798 if (Main.player[proj.owner].direction < 0)
32799 {
32800 polePosX -= 13f;
32801 }
32802 polePosY -= 30f * gravDir;
32803 break;
32804 case 2295:
32805 polePosX += 43 * Main.player[proj.owner].direction;
32806 if (Main.player[proj.owner].direction < 0)
32807 {
32808 polePosX -= 13f;
32809 }
32810 polePosY -= 30f * gravDir;
32811 break;
32812 case 2296:
32813 polePosX += 43 * Main.player[proj.owner].direction;
32814 if (Main.player[proj.owner].direction < 0)
32815 {
32816 polePosX -= 13f;
32817 }
32818 polePosY -= 30f * gravDir;
32819 break;
32820 case 2421:
32821 polePosX += 47 * Main.player[proj.owner].direction;
32822 if (Main.player[proj.owner].direction < 0)
32823 {
32824 polePosX -= 13f;
32825 }
32826 polePosY -= 36f * gravDir;
32827 break;
32828 case 2422:
32829 polePosX += 47 * Main.player[proj.owner].direction;
32830 if (Main.player[proj.owner].direction < 0)
32831 {
32832 polePosX -= 13f;
32833 }
32834 polePosY -= 32f * gravDir;
32835 break;
32836 case 4325:
32837 polePosX += 44 * Main.player[proj.owner].direction;
32838 if (Main.player[proj.owner].direction < 0)
32839 {
32840 polePosX -= 13f;
32841 }
32842 polePosY -= 32f * gravDir;
32843 break;
32844 case 4442:
32845 polePosX += 44 * Main.player[proj.owner].direction;
32846 if (Main.player[proj.owner].direction < 0)
32847 {
32848 polePosX -= 13f;
32849 }
32850 polePosY -= 32f * gravDir;
32851 break;
32852 }
32853 if (gravDir == -1f)
32854 {
32855 polePosY -= 12f;
32856 }
32858 vector = Main.player[proj.owner].RotatedRelativePoint(vector + new Vector2(8f)) - new Vector2(8f);
32859 float num = proj.position.X + (float)proj.width * 0.5f - vector.X;
32860 float num2 = proj.position.Y + (float)proj.height * 0.5f - vector.Y;
32861 Math.Sqrt(num * num + num2 * num2);
32862 float num3 = (float)Math.Atan2(num2, num) - 1.57f;
32863 bool flag = true;
32864 if (num == 0f && num2 == 0f)
32865 {
32866 flag = false;
32867 }
32868 else
32869 {
32870 float num4 = (float)Math.Sqrt(num * num + num2 * num2);
32871 num4 = 12f / num4;
32872 num *= num4;
32873 num2 *= num4;
32874 vector.X -= num;
32875 vector.Y -= num2;
32876 num = proj.position.X + (float)proj.width * 0.5f - vector.X;
32877 num2 = proj.position.Y + (float)proj.height * 0.5f - vector.Y;
32878 }
32879 while (flag)
32880 {
32881 float num5 = 12f;
32882 float num6 = (float)Math.Sqrt(num * num + num2 * num2);
32883 float num7 = num6;
32884 if (float.IsNaN(num6) || float.IsNaN(num7))
32885 {
32886 flag = false;
32887 continue;
32888 }
32889 if (num6 < 20f)
32890 {
32891 num5 = num6 - 8f;
32892 flag = false;
32893 }
32894 num6 = 12f / num6;
32895 num *= num6;
32896 num2 *= num6;
32897 vector.X += num;
32898 vector.Y += num2;
32899 num = proj.position.X + (float)proj.width * 0.5f - vector.X;
32900 num2 = proj.position.Y + (float)proj.height * 0.1f - vector.Y;
32901 if (num7 > 12f)
32902 {
32903 float num8 = 0.3f;
32904 float num9 = Math.Abs(proj.velocity.X) + Math.Abs(proj.velocity.Y);
32905 if (num9 > 16f)
32906 {
32907 num9 = 16f;
32908 }
32909 num9 = 1f - num9 / 16f;
32910 num8 *= num9;
32911 num9 = num7 / 80f;
32912 if (num9 > 1f)
32913 {
32914 num9 = 1f;
32915 }
32916 num8 *= num9;
32917 if (num8 < 0f)
32918 {
32919 num8 = 0f;
32920 }
32921 num9 = 1f - proj.localAI[0] / 100f;
32922 num8 *= num9;
32923 if (num2 > 0f)
32924 {
32925 num2 *= 1f + num8;
32926 num *= 1f - num8;
32927 }
32928 else
32929 {
32930 num9 = Math.Abs(proj.velocity.X) / 3f;
32931 if (num9 > 1f)
32932 {
32933 num9 = 1f;
32934 }
32935 num9 -= 0.5f;
32936 num8 *= num9;
32937 if (num8 > 0f)
32938 {
32939 num8 *= 2f;
32940 }
32941 num2 *= 1f + num8;
32942 num *= 1f - num8;
32943 }
32944 }
32945 num3 = (float)Math.Atan2(num2, num) - 1.57f;
32946 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f), stringColor);
32947 EntitySpriteDraw(TextureAssets.FishingLine.Value, new Vector2(vector.X - screenPosition.X + (float)TextureAssets.FishingLine.Width() * 0.5f, vector.Y - screenPosition.Y + (float)TextureAssets.FishingLine.Height() * 0.5f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.FishingLine.Width(), (int)num5), color, num3, new Vector2((float)TextureAssets.FishingLine.Width() * 0.5f, 0f), 1f, SpriteEffects.None);
32948 }
32949 }
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Abs(double value)
static Asset< Texture2D > FishingLine
static Microsoft.Xna.Framework.Color TryApplyingPlayerStringColor(int playerStringColor, Microsoft.Xna.Framework.Color stringColor)
Definition Main.cs:32681
static Vector2 screenPosition
Definition Main.cs:1715
static Player[] player
Definition Main.cs:1803
static void EntitySpriteDraw(Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float worthless=0f)
Definition Main.cs:34658

References System.Math.Abs(), System.Math.Atan2(), Terraria.Main.EntitySpriteDraw(), Terraria.GameContent.TextureAssets.FishingLine, Terraria.Lighting.GetColor(), Terraria.Main.player, Terraria.Main.screenPosition, System.Math.Sqrt(), Terraria.Main.TryApplyingPlayerStringColor(), System.type, and Microsoft.Xna.Framework.Graphics.Vector2.

Referenced by Terraria.Main.DrawProjDirect().