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

◆ DrawNPCDirect_HallowBoss()

static void Terraria.Main.DrawNPCDirect_HallowBoss ( SpriteBatch mySpriteBatch,
NPC rCurrentNPC,
ref Vector2 screenPos,
int typeCache,
ref Microsoft::Xna::Framework::Color npcColor,
ref Vector2 halfSize,
SpriteEffects npcSpriteEffect )
inlinestaticprivate

Definition at line 24825 of file Main.cs.

24826 {
24827 Texture2D value = TextureAssets.Npc[typeCache].Value;
24828 Vector2 vector = rCurrentNPC.Center - screenPos;
24829 bool flag = rCurrentNPC.AI_120_HallowBoss_IsInPhase2();
24830 int num = (int)rCurrentNPC.ai[0];
24831 Texture2D value2 = TextureAssets.Extra[159].Value;
24832 Microsoft.Xna.Framework.Rectangle rectangle = value2.Frame(1, 11, 0, (int)(rCurrentNPC.localAI[0] / 4f) % 11);
24834 Texture2D value3 = TextureAssets.Extra[158].Value;
24835 Texture2D value4 = TextureAssets.Extra[160].Value;
24836 Texture2D value5 = TextureAssets.Extra[157].Value;
24840 Vector2 origin = rectangle2.Size() / 2f;
24841 Vector2 origin2 = rectangle3.Size() / 2f;
24842 int num2 = 0;
24843 int num3 = 0;
24844 if (armFrameToUseLeft == 5)
24845 {
24846 num2 = 1;
24847 }
24848 if (armFrameToUseRight == 5)
24849 {
24850 num3 = 1;
24851 }
24852 float num4 = 1f;
24853 int num5 = 0;
24854 int num6 = 0;
24855 float num7 = 0f;
24856 float num8 = 0f;
24857 float num9 = 0f;
24858 if (num == 8 || num == 9)
24859 {
24860 num7 = Utils.GetLerpValue(0f, 30f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(90f, 30f, rCurrentNPC.ai[1], clamped: true);
24861 num8 = Utils.GetLerpValue(0f, 30f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(90f, 70f, rCurrentNPC.ai[1], clamped: true);
24862 num9 = Utils.GetLerpValue(0f, 15f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(45f, 30f, rCurrentNPC.ai[1], clamped: true);
24864 num4 *= 1f - num9;
24865 num5 = 4;
24866 num6 = 3;
24867 }
24868 if (num == 10)
24869 {
24870 num7 = Utils.GetLerpValue(30f, 90f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(165f, 90f, rCurrentNPC.ai[1], clamped: true);
24871 num8 = Utils.GetLerpValue(0f, 60f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(180f, 120f, rCurrentNPC.ai[1], clamped: true);
24872 num9 = Utils.GetLerpValue(0f, 60f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(180f, 120f, rCurrentNPC.ai[1], clamped: true);
24874 num4 *= 1f - num9;
24875 num6 = 4;
24876 }
24877 if (num6 + num5 > 0)
24878 {
24879 for (int i = -num6; i <= num6 + num5; i++)
24880 {
24881 if (i == 0)
24882 {
24883 continue;
24884 }
24886 Vector2 position = vector;
24887 if (num == 8 || num == 9)
24888 {
24889 float hue = ((float)i + 5f) / 10f;
24890 float num10 = 200f;
24891 float num11 = (float)timeForVisualEffects / 60f;
24892 Vector3 vector2 = Vector3.Transform(matrix: Matrix.CreateRotationX((num11 - 0.3f + (float)i * 0.1f) * 0.7f * ((float)Math.PI * 2f)) * Matrix.CreateRotationY((num11 - 0.8f + (float)i * 0.3f) * 0.7f * ((float)Math.PI * 2f)) * Matrix.CreateRotationZ((num11 + (float)i * 0.5f) * 0.1f * ((float)Math.PI * 2f)), position: Vector3.Forward);
24893 num10 += Utils.GetLerpValue(-1f, 1f, vector2.Z, clamped: true) * 150f;
24895 float lerpValue = Utils.GetLerpValue(90f, 0f, rCurrentNPC.ai[1], clamped: true);
24896 color2 = hslToRgb(hue, 1f, MathHelper.Lerp(0.5f, 1f, lerpValue)) * 0.8f * num8;
24897 color2.A /= 3;
24898 position += spinningpoint.RotatedBy(rCurrentNPC.ai[1] / 180f * ((float)Math.PI * 2f));
24899 }
24900 if (num == 10)
24901 {
24902 if (rCurrentNPC.ai[1] >= 90f)
24903 {
24904 float num12 = (float)timeForVisualEffects / 90f;
24905 int num13 = i;
24906 if (num13 < 0)
24907 {
24908 num13++;
24909 }
24910 Vector2 vector3 = (((float)num13 + 0.5f) * ((float)Math.PI / 4f) + (float)Math.PI * 2f * num12).ToRotationVector2();
24911 position += vector3 * new Vector2(600f * num7, 150f * num7);
24912 }
24913 else
24914 {
24915 position += 200f * new Vector2(i, 0f) * num7;
24916 }
24917 color2 = Microsoft.Xna.Framework.Color.White * 0.8f * num8 * num4;
24918 color2.A /= 3;
24919 }
24920 if (i > num6)
24921 {
24922 float lerpValue2 = Utils.GetLerpValue(30f, 70f, rCurrentNPC.ai[1], clamped: true);
24923 if (lerpValue2 == 0f)
24924 {
24925 continue;
24926 }
24927 position = vector + rCurrentNPC.velocity * -3f * ((float)i - 4f) * lerpValue2;
24928 color2 *= 1f - num9;
24929 }
24930 mySpriteBatch.Draw(value2, position, rectangle, color2, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0f);
24931 mySpriteBatch.Draw(value5, position, rectangle, color2, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0f);
24932 if (flag)
24933 {
24934 Texture2D value6 = TextureAssets.Extra[187].Value;
24935 Microsoft.Xna.Framework.Rectangle value7 = value6.Frame(1, 8, 0, (int)(rCurrentNPC.localAI[0] / 4f) % 8);
24936 mySpriteBatch.Draw(value6, position, value7, color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24937 }
24938 mySpriteBatch.Draw(value, position, rCurrentNPC.frame, color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24939 for (int j = 0; j < 2; j++)
24940 {
24941 if (j == num2)
24942 {
24943 mySpriteBatch.Draw(value3, position, rectangle2, color2, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect, 0f);
24944 }
24945 if (j == num3)
24946 {
24947 mySpriteBatch.Draw(value4, position, rectangle3, color2, rCurrentNPC.rotation, origin2, rCurrentNPC.scale, npcSpriteEffect, 0f);
24948 }
24949 }
24950 }
24951 }
24952 color *= num4;
24953 mySpriteBatch.Draw(value2, vector, rectangle, color, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0f);
24954 if (!rCurrentNPC.IsABestiaryIconDummy)
24955 {
24956 mySpriteBatch.End();
24958 }
24959 DrawData value8 = new DrawData(value5, vector, rectangle, color, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect);
24960 GameShaders.Misc["HallowBoss"].Apply(value8);
24961 value8.Draw(mySpriteBatch);
24962 pixelShader.CurrentTechnique.Passes[0].Apply();
24963 if (!rCurrentNPC.IsABestiaryIconDummy)
24964 {
24965 mySpriteBatch.End();
24967 }
24968 float num14 = (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 0.5f) * 0.5f + 0.5f;
24969 Microsoft.Xna.Framework.Color color3 = hslToRgb((num14 * 0.08f + 0.6f) % 1f, 1f, 0.5f);
24970 color3.A = 0;
24971 color3 *= 0.6f;
24972 if (NPC.ShouldEmpressBeEnraged())
24973 {
24975 color3.A = 0;
24976 color3 *= 0.3f;
24977 }
24978 color3 *= num4 * rCurrentNPC.Opacity;
24979 if (flag)
24980 {
24981 Texture2D value9 = TextureAssets.Extra[187].Value;
24982 Microsoft.Xna.Framework.Rectangle value10 = value9.Frame(1, 8, 0, (int)(rCurrentNPC.localAI[0] / 4f) % 8);
24983 mySpriteBatch.Draw(value9, vector, value10, color, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24984 for (float num15 = 0f; num15 < 1f; num15 += 0.25f)
24985 {
24986 Vector2 vector4 = rCurrentNPC.rotation.ToRotationVector2().RotatedBy(num15 * ((float)Math.PI * 2f) + (float)Math.PI / 4f) * MathHelper.Lerp(2f, 8f, num14);
24988 }
24989 }
24990 mySpriteBatch.Draw(value, vector, rCurrentNPC.frame, color, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24991 if (flag)
24992 {
24993 Texture2D value11 = TextureAssets.Extra[188].Value;
24994 for (float num16 = 0f; num16 < 1f; num16 += 0.25f)
24995 {
24996 Vector2 vector5 = rCurrentNPC.rotation.ToRotationVector2().RotatedBy(num16 * ((float)Math.PI * 2f) + (float)Math.PI / 4f) * MathHelper.Lerp(2f, 8f, num14);
24998 }
24999 }
25000 for (int k = 0; k < 2; k++)
25001 {
25002 if (k == num2)
25003 {
25004 mySpriteBatch.Draw(value3, vector, rectangle2, color, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect, 0f);
25005 }
25006 if (k == num3)
25007 {
25009 }
25010 }
25011 }
static readonly BlendState AlphaBlend
Definition BlendState.cs:36
static readonly SamplerState PointClamp
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Sin(double a)
const double PI
Definition Math.cs:16
static Asset< Texture2D >[] Npc
static Asset< Texture2D >[] Extra
static Dictionary< string, MiscShaderData > Misc
static Effect pixelShader
Definition Main.cs:2764
static double timeForVisualEffects
Definition Main.cs:1286
static void DrawNPCDirect_GetHallowBossArmFrame(NPC rCurrentNPC, out int armFrame_Count, out int armFrameToUseLeft, out int armFrameToUseRight)
Definition Main.cs:25013
static Matrix Transform
Definition Main.cs:2771
static Microsoft.Xna.Framework.Color OurFavoriteColor
Definition Main.cs:902
static SamplerState DefaultSamplerState
Definition Main.cs:2814
static RasterizerState Rasterizer
Definition Main.cs:552
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static Vector3 Transform(Vector3 position, Matrix matrix)
Definition Vector3.cs:407

References Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend, Microsoft.Xna.Framework.Matrix.CreateRotationX(), Microsoft.Xna.Framework.Matrix.CreateRotationY(), Microsoft.Xna.Framework.Matrix.CreateRotationZ(), Microsoft.Xna.Framework.Graphics.RasterizerState.CullNone, Microsoft.Xna.Framework.Graphics.DepthStencilState.Default, Terraria.Main.DefaultSamplerState, Terraria.Main.DrawNPCDirect_GetHallowBossArmFrame(), Terraria.GameContent.TextureAssets.Extra, Microsoft.Xna.Framework.Vector3.Forward, Terraria.Utils.GetLerpValue(), Terraria.Main.GlobalTimeWrappedHourly, Terraria.Main.hslToRgb(), System.Text.RegularExpressions.i, Microsoft.Xna.Framework.Color.Lerp(), Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Graphics.Shaders.GameShaders.Misc, Microsoft.Xna.Framework.Graphics.DepthStencilState.None, Terraria.GameContent.TextureAssets.Npc, Terraria.Main.OurFavoriteColor, System.Math.PI, Terraria.Main.pixelShader, Microsoft.Xna.Framework.Graphics.SamplerState.PointClamp, Terraria.Main.Rasterizer, Terraria.NPC.ShouldEmpressBeEnraged(), System.Math.Sin(), Terraria.Main.timeForVisualEffects, Microsoft.Xna.Framework.Vector3.Transform(), Terraria.Main.Transform, System.value, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Color.White.

Referenced by Terraria.Main.DrawNPCDirect().