Terraria 1.4.0.5 Source Code
This commit is contained in:
commit
05205f009e
1059 changed files with 563450 additions and 0 deletions
88
Graphics/Renderers/ABasicParticle.cs
Normal file
88
Graphics/Renderers/ABasicParticle.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.ABasicParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public abstract class ABasicParticle : IPooledParticle, IParticle
|
||||
{
|
||||
public Vector2 AccelerationPerFrame;
|
||||
public Vector2 Velocity;
|
||||
public Vector2 LocalPosition;
|
||||
protected Asset<Texture2D> _texture;
|
||||
protected Rectangle _frame;
|
||||
protected Vector2 _origin;
|
||||
public float Rotation;
|
||||
public float RotationVelocity;
|
||||
public float RotationAcceleration;
|
||||
public Vector2 Scale;
|
||||
public Vector2 ScaleVelocity;
|
||||
public Vector2 ScaleAcceleration;
|
||||
|
||||
public bool ShouldBeRemovedFromRenderer { get; protected set; }
|
||||
|
||||
public ABasicParticle()
|
||||
{
|
||||
this._texture = (Asset<Texture2D>) null;
|
||||
this._frame = Rectangle.Empty;
|
||||
this._origin = Vector2.Zero;
|
||||
this.Velocity = Vector2.Zero;
|
||||
this.LocalPosition = Vector2.Zero;
|
||||
this.ShouldBeRemovedFromRenderer = false;
|
||||
}
|
||||
|
||||
public virtual void SetBasicInfo(
|
||||
Asset<Texture2D> textureAsset,
|
||||
Rectangle? frame,
|
||||
Vector2 initialVelocity,
|
||||
Vector2 initialLocalPosition)
|
||||
{
|
||||
this._texture = textureAsset;
|
||||
this._frame = frame.HasValue ? frame.Value : this._texture.Frame();
|
||||
this._origin = this._frame.Size() / 2f;
|
||||
this.Velocity = initialVelocity;
|
||||
this.LocalPosition = initialLocalPosition;
|
||||
this.ShouldBeRemovedFromRenderer = false;
|
||||
}
|
||||
|
||||
public virtual void Update(ref ParticleRendererSettings settings)
|
||||
{
|
||||
this.Velocity += this.AccelerationPerFrame;
|
||||
this.LocalPosition += this.Velocity;
|
||||
this.RotationVelocity += this.RotationAcceleration;
|
||||
this.Rotation += this.RotationVelocity;
|
||||
this.ScaleVelocity += this.ScaleAcceleration;
|
||||
this.Scale += this.ScaleVelocity;
|
||||
}
|
||||
|
||||
public abstract void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch);
|
||||
|
||||
public bool IsRestingInPool { get; private set; }
|
||||
|
||||
public void RestInPool() => this.IsRestingInPool = true;
|
||||
|
||||
public virtual void FetchFromPool()
|
||||
{
|
||||
this.IsRestingInPool = false;
|
||||
this.ShouldBeRemovedFromRenderer = false;
|
||||
this.AccelerationPerFrame = Vector2.Zero;
|
||||
this.Velocity = Vector2.Zero;
|
||||
this.LocalPosition = Vector2.Zero;
|
||||
this._texture = (Asset<Texture2D>) null;
|
||||
this._frame = Rectangle.Empty;
|
||||
this._origin = Vector2.Zero;
|
||||
this.Rotation = 0.0f;
|
||||
this.RotationVelocity = 0.0f;
|
||||
this.RotationAcceleration = 0.0f;
|
||||
this.Scale = Vector2.Zero;
|
||||
this.ScaleVelocity = Vector2.Zero;
|
||||
this.ScaleAcceleration = Vector2.Zero;
|
||||
}
|
||||
}
|
||||
}
|
59
Graphics/Renderers/CreativeSacrificeParticle.cs
Normal file
59
Graphics/Renderers/CreativeSacrificeParticle.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.CreativeSacrificeParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class CreativeSacrificeParticle : IParticle
|
||||
{
|
||||
public Vector2 AccelerationPerFrame;
|
||||
public Vector2 Velocity;
|
||||
public Vector2 LocalPosition;
|
||||
public float ScaleOffsetPerFrame;
|
||||
public float StopWhenBelowXScale;
|
||||
private Asset<Texture2D> _texture;
|
||||
private Rectangle _frame;
|
||||
private Vector2 _origin;
|
||||
private float _scale;
|
||||
|
||||
public bool ShouldBeRemovedFromRenderer { get; private set; }
|
||||
|
||||
public CreativeSacrificeParticle(
|
||||
Asset<Texture2D> textureAsset,
|
||||
Rectangle? frame,
|
||||
Vector2 initialVelocity,
|
||||
Vector2 initialLocalPosition)
|
||||
{
|
||||
this._texture = textureAsset;
|
||||
this._frame = frame.HasValue ? frame.Value : this._texture.Frame();
|
||||
this._origin = this._frame.Size() / 2f;
|
||||
this.Velocity = initialVelocity;
|
||||
this.LocalPosition = initialLocalPosition;
|
||||
this.StopWhenBelowXScale = 0.0f;
|
||||
this.ShouldBeRemovedFromRenderer = false;
|
||||
this._scale = 0.6f;
|
||||
}
|
||||
|
||||
public void Update(ref ParticleRendererSettings settings)
|
||||
{
|
||||
this.Velocity += this.AccelerationPerFrame;
|
||||
this.LocalPosition += this.Velocity;
|
||||
this._scale += this.ScaleOffsetPerFrame;
|
||||
if ((double) this._scale > (double) this.StopWhenBelowXScale)
|
||||
return;
|
||||
this.ShouldBeRemovedFromRenderer = true;
|
||||
}
|
||||
|
||||
public void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
|
||||
{
|
||||
Color color = Color.Lerp(Color.White, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), Utils.GetLerpValue(0.1f, 0.5f, this._scale, false));
|
||||
spritebatch.Draw(this._texture.Value, settings.AnchorPosition + this.LocalPosition, new Rectangle?(this._frame), color, 0.0f, this._origin, this._scale, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
47
Graphics/Renderers/FadingParticle.cs
Normal file
47
Graphics/Renderers/FadingParticle.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.FadingParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class FadingParticle : ABasicParticle
|
||||
{
|
||||
public float FadeInNormalizedTime;
|
||||
public float FadeOutNormalizedTime = 1f;
|
||||
public Color ColorTint = Color.White;
|
||||
private float _timeTolive;
|
||||
private float _timeSinceSpawn;
|
||||
|
||||
public override void FetchFromPool()
|
||||
{
|
||||
base.FetchFromPool();
|
||||
this.FadeInNormalizedTime = 0.0f;
|
||||
this.FadeOutNormalizedTime = 1f;
|
||||
this.ColorTint = Color.White;
|
||||
this._timeTolive = 0.0f;
|
||||
this._timeSinceSpawn = 0.0f;
|
||||
}
|
||||
|
||||
public void SetTypeInfo(float timeToLive) => this._timeTolive = timeToLive;
|
||||
|
||||
public override void Update(ref ParticleRendererSettings settings)
|
||||
{
|
||||
base.Update(ref settings);
|
||||
++this._timeSinceSpawn;
|
||||
if ((double) this._timeSinceSpawn < (double) this._timeTolive)
|
||||
return;
|
||||
this.ShouldBeRemovedFromRenderer = true;
|
||||
}
|
||||
|
||||
public override void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
|
||||
{
|
||||
Color color = this.ColorTint * Utils.GetLerpValue(0.0f, this.FadeInNormalizedTime, this._timeSinceSpawn / this._timeTolive, true) * Utils.GetLerpValue(1f, this.FadeOutNormalizedTime, this._timeSinceSpawn / this._timeTolive, true);
|
||||
spritebatch.Draw(this._texture.Value, settings.AnchorPosition + this.LocalPosition, new Rectangle?(this._frame), color, this.Rotation, this._origin, this.Scale, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
77
Graphics/Renderers/FlameParticle.cs
Normal file
77
Graphics/Renderers/FlameParticle.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.FlameParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria.DataStructures;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class FlameParticle : ABasicParticle
|
||||
{
|
||||
public float FadeOutNormalizedTime = 1f;
|
||||
private float _timeTolive;
|
||||
private float _timeSinceSpawn;
|
||||
private int _indexOfPlayerWhoSpawnedThis;
|
||||
private int _packedShaderIndex;
|
||||
|
||||
public override void FetchFromPool()
|
||||
{
|
||||
base.FetchFromPool();
|
||||
this.FadeOutNormalizedTime = 1f;
|
||||
this._timeTolive = 0.0f;
|
||||
this._timeSinceSpawn = 0.0f;
|
||||
this._indexOfPlayerWhoSpawnedThis = 0;
|
||||
this._packedShaderIndex = 0;
|
||||
}
|
||||
|
||||
public override void SetBasicInfo(
|
||||
Asset<Texture2D> textureAsset,
|
||||
Rectangle? frame,
|
||||
Vector2 initialVelocity,
|
||||
Vector2 initialLocalPosition)
|
||||
{
|
||||
base.SetBasicInfo(textureAsset, frame, initialVelocity, initialLocalPosition);
|
||||
this._origin = new Vector2((float) (this._frame.Width / 2), (float) (this._frame.Height - 2));
|
||||
}
|
||||
|
||||
public void SetTypeInfo(float timeToLive, int indexOfPlayerWhoSpawnedIt, int packedShaderIndex)
|
||||
{
|
||||
this._timeTolive = timeToLive;
|
||||
this._indexOfPlayerWhoSpawnedThis = indexOfPlayerWhoSpawnedIt;
|
||||
this._packedShaderIndex = packedShaderIndex;
|
||||
}
|
||||
|
||||
public override void Update(ref ParticleRendererSettings settings)
|
||||
{
|
||||
base.Update(ref settings);
|
||||
++this._timeSinceSpawn;
|
||||
if ((double) this._timeSinceSpawn < (double) this._timeTolive)
|
||||
return;
|
||||
this.ShouldBeRemovedFromRenderer = true;
|
||||
}
|
||||
|
||||
public override void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
|
||||
{
|
||||
Color color = new Color(120, 120, 120, 60) * Utils.GetLerpValue(1f, this.FadeOutNormalizedTime, this._timeSinceSpawn / this._timeTolive, true);
|
||||
Vector2 vector2_1 = settings.AnchorPosition + this.LocalPosition;
|
||||
ulong seed = Main.TileFrameSeed ^ ((ulong) this.LocalPosition.X << 32 | (ulong) (uint) this.LocalPosition.Y);
|
||||
Player player = Main.player[this._indexOfPlayerWhoSpawnedThis];
|
||||
for (int index = 0; index < 4; ++index)
|
||||
{
|
||||
Vector2 vector2_2 = new Vector2((float) Utils.RandomInt(ref seed, -2, 3), (float) Utils.RandomInt(ref seed, -2, 3));
|
||||
DrawData cdd = new DrawData(this._texture.Value, vector2_1 + vector2_2 * this.Scale, new Rectangle?(this._frame), color, this.Rotation, this._origin, this.Scale, SpriteEffects.None, 0)
|
||||
{
|
||||
shader = this._packedShaderIndex
|
||||
};
|
||||
PlayerDrawHelper.SetShaderForData(player, 0, ref cdd);
|
||||
cdd.Draw(spritebatch);
|
||||
}
|
||||
Main.pixelShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
}
|
||||
}
|
19
Graphics/Renderers/IParticle.cs
Normal file
19
Graphics/Renderers/IParticle.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.IParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public interface IParticle
|
||||
{
|
||||
bool ShouldBeRemovedFromRenderer { get; }
|
||||
|
||||
void Update(ref ParticleRendererSettings settings);
|
||||
|
||||
void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch);
|
||||
}
|
||||
}
|
33
Graphics/Renderers/IPlayerRenderer.cs
Normal file
33
Graphics/Renderers/IPlayerRenderer.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.IPlayerRenderer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public interface IPlayerRenderer
|
||||
{
|
||||
void DrawPlayers(Camera camera, IEnumerable<Player> players);
|
||||
|
||||
void DrawPlayerHead(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float alpha = 1f,
|
||||
float scale = 1f,
|
||||
Color borderColor = default (Color));
|
||||
|
||||
void DrawPlayer(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float rotation,
|
||||
Vector2 rotationOrigin,
|
||||
float shadow = 0.0f,
|
||||
float scale = 1f);
|
||||
}
|
||||
}
|
17
Graphics/Renderers/IPooledParticle.cs
Normal file
17
Graphics/Renderers/IPooledParticle.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.IPooledParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public interface IPooledParticle : IParticle
|
||||
{
|
||||
bool IsRestingInPool { get; }
|
||||
|
||||
void RestInPool();
|
||||
|
||||
void FetchFromPool();
|
||||
}
|
||||
}
|
453
Graphics/Renderers/LegacyPlayerRenderer.cs
Normal file
453
Graphics/Renderers/LegacyPlayerRenderer.cs
Normal file
|
@ -0,0 +1,453 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.LegacyPlayerRenderer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class LegacyPlayerRenderer : IPlayerRenderer
|
||||
{
|
||||
private readonly List<DrawData> _drawData = new List<DrawData>();
|
||||
private readonly List<int> _dust = new List<int>();
|
||||
private readonly List<int> _gore = new List<int>();
|
||||
|
||||
public static SamplerState MountedSamplerState => !Main.drawToScreen ? SamplerState.AnisotropicClamp : SamplerState.LinearClamp;
|
||||
|
||||
public void DrawPlayers(Camera camera, IEnumerable<Player> players)
|
||||
{
|
||||
foreach (Player player in players)
|
||||
this.DrawPlayerFull(camera, player);
|
||||
}
|
||||
|
||||
public void DrawPlayerHead(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float alpha = 1f,
|
||||
float scale = 1f,
|
||||
Color borderColor = default (Color))
|
||||
{
|
||||
this._drawData.Clear();
|
||||
this._dust.Clear();
|
||||
this._gore.Clear();
|
||||
PlayerDrawHeadSet drawinfo = new PlayerDrawHeadSet();
|
||||
drawinfo.BoringSetup(drawPlayer, this._drawData, this._dust, this._gore, position.X, position.Y, alpha, scale);
|
||||
PlayerDrawHeadLayers.DrawPlayer_00_BackHelmet(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_01_FaceSkin(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_02_DrawArmorWithFullHair(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_03_HelmetHair(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_04_JungleRose(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_05_TallHats(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_06_NormalHats(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_07_JustHair(ref drawinfo);
|
||||
PlayerDrawHeadLayers.DrawPlayer_08_FaceAcc(ref drawinfo);
|
||||
this.CreateOutlines(alpha, scale, borderColor);
|
||||
PlayerDrawHeadLayers.DrawPlayer_RenderAllLayers(ref drawinfo);
|
||||
}
|
||||
|
||||
private void CreateOutlines(float alpha, float scale, Color borderColor)
|
||||
{
|
||||
if (!(borderColor != Color.Transparent))
|
||||
return;
|
||||
List<DrawData> drawDataList1 = new List<DrawData>((IEnumerable<DrawData>) this._drawData);
|
||||
List<DrawData> drawDataList2 = new List<DrawData>((IEnumerable<DrawData>) this._drawData);
|
||||
float num1 = 2f * scale;
|
||||
Color color1 = borderColor * (alpha * alpha);
|
||||
Color color2 = Color.Black * (alpha * alpha);
|
||||
int colorOnlyShaderIndex = ContentSamples.CommonlyUsedContentSamples.ColorOnlyShaderIndex;
|
||||
for (int index = 0; index < drawDataList2.Count; ++index)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index];
|
||||
drawData.shader = colorOnlyShaderIndex;
|
||||
drawData.color = color2;
|
||||
drawDataList2[index] = drawData;
|
||||
}
|
||||
int num2 = 2;
|
||||
for (int index1 = -num2; index1 <= num2; ++index1)
|
||||
{
|
||||
for (int index2 = -num2; index2 <= num2; ++index2)
|
||||
{
|
||||
if (Math.Abs(index1) + Math.Abs(index2) == num2)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float) index1 * num1, (float) index2 * num1);
|
||||
for (int index3 = 0; index3 < drawDataList2.Count; ++index3)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index3];
|
||||
drawData.position += vector2;
|
||||
this._drawData.Add(drawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < drawDataList2.Count; ++index)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index];
|
||||
drawData.shader = colorOnlyShaderIndex;
|
||||
drawData.color = color1;
|
||||
drawDataList2[index] = drawData;
|
||||
}
|
||||
Vector2 vector2_1 = Vector2.Zero;
|
||||
int num3 = 1;
|
||||
for (int index4 = -num3; index4 <= num3; ++index4)
|
||||
{
|
||||
for (int index5 = -num3; index5 <= num3; ++index5)
|
||||
{
|
||||
if (Math.Abs(index4) + Math.Abs(index5) == num3)
|
||||
{
|
||||
vector2_1 = new Vector2((float) index4 * num1, (float) index5 * num1);
|
||||
for (int index6 = 0; index6 < drawDataList2.Count; ++index6)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index6];
|
||||
drawData.position += vector2_1;
|
||||
this._drawData.Add(drawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._drawData.AddRange((IEnumerable<DrawData>) drawDataList1);
|
||||
}
|
||||
|
||||
public void DrawPlayer(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float rotation,
|
||||
Vector2 rotationOrigin,
|
||||
float shadow = 0.0f,
|
||||
float scale = 1f)
|
||||
{
|
||||
if (drawPlayer.ShouldNotDraw)
|
||||
return;
|
||||
PlayerDrawSet drawinfo = new PlayerDrawSet();
|
||||
this._drawData.Clear();
|
||||
this._dust.Clear();
|
||||
this._gore.Clear();
|
||||
drawinfo.BoringSetup(drawPlayer, this._drawData, this._dust, this._gore, position, shadow, rotation, rotationOrigin);
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoPlus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_01_BackHair(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_01_2_JimsCloak(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_01_3_BackHead(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoMinus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_02_MountBehindPlayer(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_03_Carpet(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_03_PortableStool(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoPlus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_04_ElectrifiedDebuffBack(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_05_ForbiddenSetRing(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_05_2_SafemanSun(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_06_WebbedDebuffBack(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_07_LeinforsHairShampoo(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoMinus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_08_Backpacks(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_09_BackAc(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_10_Wings(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_11_Balloons(ref drawinfo);
|
||||
if (drawinfo.weaponDrawOrder == WeaponDrawOrder.BehindBackArm)
|
||||
PlayerDrawLayers.DrawPlayer_27_HeldItem(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_12_Skin(ref drawinfo);
|
||||
if (drawinfo.drawPlayer.wearsRobe && drawinfo.drawPlayer.body != 166)
|
||||
{
|
||||
PlayerDrawLayers.DrawPlayer_14_Shoes(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_13_Leggings(ref drawinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerDrawLayers.DrawPlayer_13_Leggings(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_14_Shoes(ref drawinfo);
|
||||
}
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoPlus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_15_SkinLongCoat(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_16_ArmorLongCoat(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_17_Torso(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_18_OffhandAcc(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_19_WaistAcc(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_20_NeckAcc(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_21_Head(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_22_FaceAcc(ref drawinfo);
|
||||
if (drawinfo.drawFrontAccInNeckAccLayer)
|
||||
{
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoMinus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_32_FrontAcc(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoPlus(ref drawinfo);
|
||||
}
|
||||
PlayerDrawLayers.DrawPlayer_23_MountFront(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_24_Pulley(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_25_Shield(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_MountPlus(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_26_SolarShield(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_MountMinus(ref drawinfo);
|
||||
if (drawinfo.weaponDrawOrder == WeaponDrawOrder.BehindFrontArm)
|
||||
PlayerDrawLayers.DrawPlayer_27_HeldItem(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_28_ArmOverItem(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_29_OnhandAcc(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_30_BladedGlove(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_extra_TorsoMinus(ref drawinfo);
|
||||
if (!drawinfo.drawFrontAccInNeckAccLayer)
|
||||
PlayerDrawLayers.DrawPlayer_32_FrontAcc(ref drawinfo);
|
||||
if (drawinfo.weaponDrawOrder == WeaponDrawOrder.OverFrontArm)
|
||||
PlayerDrawLayers.DrawPlayer_27_HeldItem(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_31_ProjectileOverArm(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_33_FrozenOrWebbedDebuff(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_34_ElectrifiedDebuffFront(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_35_IceBarrier(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_36_CTG(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_37_BeetleBuff(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_MakeIntoFirstFractalAfterImage(ref drawinfo);
|
||||
PlayerDrawLayers.DrawPlayer_TransformDrawData(ref drawinfo);
|
||||
if ((double) scale != 1.0)
|
||||
PlayerDrawLayers.DrawPlayer_ScaleDrawData(ref drawinfo, scale);
|
||||
PlayerDrawLayers.DrawPlayer_RenderAllLayers(ref drawinfo);
|
||||
if (!drawinfo.drawPlayer.mount.Active || drawinfo.drawPlayer.mount.Type != 11)
|
||||
return;
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].owner == drawinfo.drawPlayer.whoAmI && Main.projectile[i].type == 591)
|
||||
Main.instance.DrawProj(i);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPlayerFull(Camera camera, Player drawPlayer)
|
||||
{
|
||||
SpriteBatch spriteBatch = camera.SpriteBatch;
|
||||
SamplerState samplerState = camera.Sampler;
|
||||
if (drawPlayer.mount.Active && (double) drawPlayer.fullRotation != 0.0)
|
||||
samplerState = LegacyPlayerRenderer.MountedSamplerState;
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, samplerState, DepthStencilState.None, camera.Rasterizer, (Effect) null, camera.GameViewMatrix.TransformationMatrix);
|
||||
if (Main.gamePaused)
|
||||
drawPlayer.PlayerFrame();
|
||||
if (drawPlayer.ghost)
|
||||
{
|
||||
for (int index = 0; index < 3; ++index)
|
||||
{
|
||||
Vector2 shadowPo = drawPlayer.shadowPos[index];
|
||||
Vector2 position = drawPlayer.position - drawPlayer.velocity * (float) (2 + index * 2);
|
||||
this.DrawGhost(camera, drawPlayer, position, (float) (0.5 + 0.200000002980232 * (double) index));
|
||||
}
|
||||
this.DrawGhost(camera, drawPlayer, drawPlayer.position);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (drawPlayer.inventory[drawPlayer.selectedItem].flame || drawPlayer.head == 137 || drawPlayer.wings == 22)
|
||||
{
|
||||
--drawPlayer.itemFlameCount;
|
||||
if (drawPlayer.itemFlameCount <= 0)
|
||||
{
|
||||
drawPlayer.itemFlameCount = 5;
|
||||
for (int index = 0; index < 7; ++index)
|
||||
{
|
||||
drawPlayer.itemFlamePos[index].X = (float) Main.rand.Next(-10, 11) * 0.15f;
|
||||
drawPlayer.itemFlamePos[index].Y = (float) Main.rand.Next(-10, 1) * 0.35f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (drawPlayer.armorEffectDrawShadowEOCShield)
|
||||
{
|
||||
int num = drawPlayer.eocDash / 4;
|
||||
if (num > 3)
|
||||
num = 3;
|
||||
for (int index = 0; index < num; ++index)
|
||||
this.DrawPlayer(camera, drawPlayer, drawPlayer.shadowPos[index], drawPlayer.shadowRotation[index], drawPlayer.shadowOrigin[index], (float) (0.5 + 0.200000002980232 * (double) index), 1f);
|
||||
}
|
||||
Vector2 position1;
|
||||
if (drawPlayer.invis)
|
||||
{
|
||||
drawPlayer.armorEffectDrawOutlines = false;
|
||||
drawPlayer.armorEffectDrawShadow = false;
|
||||
drawPlayer.armorEffectDrawShadowSubtle = false;
|
||||
position1 = drawPlayer.position;
|
||||
if (drawPlayer.aggro <= -750)
|
||||
{
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawPlayer.invis = false;
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, 0.0f, 1f);
|
||||
drawPlayer.invis = true;
|
||||
}
|
||||
}
|
||||
if (drawPlayer.armorEffectDrawOutlines)
|
||||
{
|
||||
Vector2 position2 = drawPlayer.position;
|
||||
if (!Main.gamePaused)
|
||||
drawPlayer.ghostFade += drawPlayer.ghostDir * 0.075f;
|
||||
if ((double) drawPlayer.ghostFade < 0.1)
|
||||
{
|
||||
drawPlayer.ghostDir = 1f;
|
||||
drawPlayer.ghostFade = 0.1f;
|
||||
}
|
||||
else if ((double) drawPlayer.ghostFade > 0.9)
|
||||
{
|
||||
drawPlayer.ghostDir = -1f;
|
||||
drawPlayer.ghostFade = 0.9f;
|
||||
}
|
||||
float num1 = drawPlayer.ghostFade * 5f;
|
||||
for (int index = 0; index < 4; ++index)
|
||||
{
|
||||
float num2;
|
||||
float num3;
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
num2 = -num1;
|
||||
num3 = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
num2 = 0.0f;
|
||||
num3 = num1;
|
||||
break;
|
||||
case 3:
|
||||
num2 = 0.0f;
|
||||
num3 = -num1;
|
||||
break;
|
||||
default:
|
||||
num2 = num1;
|
||||
num3 = 0.0f;
|
||||
break;
|
||||
}
|
||||
position1 = new Vector2(drawPlayer.position.X + num2, drawPlayer.position.Y + drawPlayer.gfxOffY + num3);
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, drawPlayer.ghostFade, 1f);
|
||||
}
|
||||
}
|
||||
if (drawPlayer.armorEffectDrawOutlinesForbidden)
|
||||
{
|
||||
Vector2 position3 = drawPlayer.position;
|
||||
if (!Main.gamePaused)
|
||||
drawPlayer.ghostFade += drawPlayer.ghostDir * 0.025f;
|
||||
if ((double) drawPlayer.ghostFade < 0.1)
|
||||
{
|
||||
drawPlayer.ghostDir = 1f;
|
||||
drawPlayer.ghostFade = 0.1f;
|
||||
}
|
||||
else if ((double) drawPlayer.ghostFade > 0.9)
|
||||
{
|
||||
drawPlayer.ghostDir = -1f;
|
||||
drawPlayer.ghostFade = 0.9f;
|
||||
}
|
||||
float num4 = drawPlayer.ghostFade * 5f;
|
||||
for (int index = 0; index < 4; ++index)
|
||||
{
|
||||
float num5;
|
||||
float num6;
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
num5 = -num4;
|
||||
num6 = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
num5 = 0.0f;
|
||||
num6 = num4;
|
||||
break;
|
||||
case 3:
|
||||
num5 = 0.0f;
|
||||
num6 = -num4;
|
||||
break;
|
||||
default:
|
||||
num5 = num4;
|
||||
num6 = 0.0f;
|
||||
break;
|
||||
}
|
||||
position1 = new Vector2(drawPlayer.position.X + num5, drawPlayer.position.Y + drawPlayer.gfxOffY + num6);
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, drawPlayer.ghostFade, 1f);
|
||||
}
|
||||
}
|
||||
if (drawPlayer.armorEffectDrawShadowBasilisk)
|
||||
{
|
||||
int num = (int) ((double) drawPlayer.basiliskCharge * 3.0);
|
||||
for (int index = 0; index < num; ++index)
|
||||
this.DrawPlayer(camera, drawPlayer, drawPlayer.shadowPos[index], drawPlayer.shadowRotation[index], drawPlayer.shadowOrigin[index], (float) (0.5 + 0.200000002980232 * (double) index), 1f);
|
||||
}
|
||||
else if (drawPlayer.armorEffectDrawShadow)
|
||||
{
|
||||
for (int index = 0; index < 3; ++index)
|
||||
this.DrawPlayer(camera, drawPlayer, drawPlayer.shadowPos[index], drawPlayer.shadowRotation[index], drawPlayer.shadowOrigin[index], (float) (0.5 + 0.200000002980232 * (double) index), 1f);
|
||||
}
|
||||
if (drawPlayer.armorEffectDrawShadowLokis)
|
||||
{
|
||||
for (int index = 0; index < 3; ++index)
|
||||
this.DrawPlayer(camera, drawPlayer, Vector2.Lerp(drawPlayer.shadowPos[index], drawPlayer.position + new Vector2(0.0f, drawPlayer.gfxOffY), 0.5f), drawPlayer.shadowRotation[index], drawPlayer.shadowOrigin[index], MathHelper.Lerp(1f, (float) (0.5 + 0.200000002980232 * (double) index), 0.5f), 1f);
|
||||
}
|
||||
if (drawPlayer.armorEffectDrawShadowSubtle)
|
||||
{
|
||||
for (int index = 0; index < 4; ++index)
|
||||
{
|
||||
position1.X = drawPlayer.position.X + (float) Main.rand.Next(-20, 21) * 0.1f;
|
||||
position1.Y = drawPlayer.position.Y + (float) Main.rand.Next(-20, 21) * 0.1f + drawPlayer.gfxOffY;
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, 0.9f, 1f);
|
||||
}
|
||||
}
|
||||
if (drawPlayer.shadowDodge)
|
||||
{
|
||||
++drawPlayer.shadowDodgeCount;
|
||||
if ((double) drawPlayer.shadowDodgeCount > 30.0)
|
||||
drawPlayer.shadowDodgeCount = 30f;
|
||||
}
|
||||
else
|
||||
{
|
||||
--drawPlayer.shadowDodgeCount;
|
||||
if ((double) drawPlayer.shadowDodgeCount < 0.0)
|
||||
drawPlayer.shadowDodgeCount = 0.0f;
|
||||
}
|
||||
if ((double) drawPlayer.shadowDodgeCount > 0.0)
|
||||
{
|
||||
Vector2 position4 = drawPlayer.position;
|
||||
position1.X = drawPlayer.position.X + drawPlayer.shadowDodgeCount;
|
||||
position1.Y = drawPlayer.position.Y + drawPlayer.gfxOffY;
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, (float) (0.5 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129), 1f);
|
||||
position1.X = drawPlayer.position.X - drawPlayer.shadowDodgeCount;
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, (float) (0.5 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129), 1f);
|
||||
}
|
||||
if (drawPlayer.brainOfConfusionDodgeAnimationCounter > 0)
|
||||
{
|
||||
Vector2 vector2 = drawPlayer.position + new Vector2(0.0f, drawPlayer.gfxOffY);
|
||||
float lerpValue = Utils.GetLerpValue(300f, 270f, (float) drawPlayer.brainOfConfusionDodgeAnimationCounter, false);
|
||||
float y = MathHelper.Lerp(2f, 120f, lerpValue);
|
||||
if ((double) lerpValue >= 0.0 && (double) lerpValue <= 1.0)
|
||||
{
|
||||
for (float num = 0.0f; (double) num < 6.28318548202515; num += 1.047198f)
|
||||
{
|
||||
position1 = vector2 + new Vector2(0.0f, y).RotatedBy(6.28318548202515 * (double) lerpValue * 0.5 + (double) num);
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, lerpValue, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
position1 = drawPlayer.position;
|
||||
position1.Y += drawPlayer.gfxOffY;
|
||||
if (drawPlayer.stoned)
|
||||
this.DrawPlayerStoned(camera, drawPlayer, position1);
|
||||
else if (!drawPlayer.invis)
|
||||
this.DrawPlayer(camera, drawPlayer, position1, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, 0.0f, 1f);
|
||||
}
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
private void DrawPlayerStoned(Camera camera, Player drawPlayer, Vector2 position)
|
||||
{
|
||||
if (drawPlayer.dead)
|
||||
return;
|
||||
SpriteEffects effects = drawPlayer.direction != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
camera.SpriteBatch.Draw(TextureAssets.Extra[37].Value, new Vector2((float) (int) ((double) position.X - (double) camera.UnscaledPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) position.Y - (double) camera.UnscaledPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 8.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Rectangle?(), Lighting.GetColor((int) ((double) position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) position.Y + (double) drawPlayer.height * 0.5) / 16, Color.White), 0.0f, new Vector2((float) (TextureAssets.Extra[37].Width() / 2), (float) (TextureAssets.Extra[37].Height() / 2)), 1f, effects, 0.0f);
|
||||
}
|
||||
|
||||
private void DrawGhost(Camera camera, Player drawPlayer, Vector2 position, float shadow = 0.0f)
|
||||
{
|
||||
byte mouseTextColor = Main.mouseTextColor;
|
||||
SpriteEffects effects = drawPlayer.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
Color immuneAlpha = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) drawPlayer.position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) drawPlayer.position.Y + (double) drawPlayer.height * 0.5) / 16, new Color((int) mouseTextColor / 2 + 100, (int) mouseTextColor / 2 + 100, (int) mouseTextColor / 2 + 100, (int) mouseTextColor / 2 + 100)), shadow);
|
||||
immuneAlpha.A = (byte) ((double) immuneAlpha.A * (1.0 - (double) Math.Max(0.5f, shadow - 0.5f)));
|
||||
Rectangle rectangle = new Rectangle(0, TextureAssets.Ghost.Height() / 4 * drawPlayer.ghostFrame, TextureAssets.Ghost.Width(), TextureAssets.Ghost.Height() / 4);
|
||||
Vector2 origin = new Vector2((float) rectangle.Width * 0.5f, (float) rectangle.Height * 0.5f);
|
||||
camera.SpriteBatch.Draw(TextureAssets.Ghost.Value, new Vector2((float) (int) ((double) position.X - (double) camera.UnscaledPosition.X + (double) (rectangle.Width / 2)), (float) (int) ((double) position.Y - (double) camera.UnscaledPosition.Y + (double) (rectangle.Height / 2))), new Rectangle?(rectangle), immuneAlpha, 0.0f, origin, 1f, effects, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
141
Graphics/Renderers/MapHeadRenderer.cs
Normal file
141
Graphics/Renderers/MapHeadRenderer.cs
Normal file
|
@ -0,0 +1,141 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.MapHeadRenderer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class MapHeadRenderer : INeedRenderTargetContent
|
||||
{
|
||||
private bool _anyDirty;
|
||||
private PlayerHeadDrawRenderTargetContent[] _playerRenders = new PlayerHeadDrawRenderTargetContent[(int) byte.MaxValue];
|
||||
private readonly List<DrawData> _drawData = new List<DrawData>();
|
||||
|
||||
public MapHeadRenderer()
|
||||
{
|
||||
for (int index = 0; index < this._playerRenders.Length; ++index)
|
||||
this._playerRenders[index] = new PlayerHeadDrawRenderTargetContent();
|
||||
}
|
||||
|
||||
public void DrawPlayerHead(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float alpha = 1f,
|
||||
float scale = 1f,
|
||||
Color borderColor = default (Color))
|
||||
{
|
||||
PlayerHeadDrawRenderTargetContent playerRender = this._playerRenders[drawPlayer.whoAmI];
|
||||
playerRender.UsePlayer(drawPlayer);
|
||||
playerRender.UseColor(borderColor);
|
||||
playerRender.Request();
|
||||
this._anyDirty = true;
|
||||
this._drawData.Clear();
|
||||
if (!playerRender.IsReady)
|
||||
return;
|
||||
RenderTarget2D target = playerRender.GetTarget();
|
||||
this._drawData.Add(new DrawData((Texture2D) target, position, new Rectangle?(), Color.White, 0.0f, target.Size() / 2f, scale, SpriteEffects.None, 0));
|
||||
this.RenderDrawData(drawPlayer);
|
||||
}
|
||||
|
||||
private void RenderDrawData(Player drawPlayer)
|
||||
{
|
||||
Effect pixelShader = Main.pixelShader;
|
||||
Projectile[] projectile = Main.projectile;
|
||||
SpriteBatch spriteBatch = Main.spriteBatch;
|
||||
for (int index = 0; index < this._drawData.Count; ++index)
|
||||
{
|
||||
DrawData cdd = this._drawData[index];
|
||||
if (!cdd.sourceRect.HasValue)
|
||||
cdd.sourceRect = new Rectangle?(cdd.texture.Frame());
|
||||
PlayerDrawHelper.SetShaderForData(drawPlayer, drawPlayer.cHead, ref cdd);
|
||||
if (cdd.texture != null)
|
||||
cdd.Draw(spriteBatch);
|
||||
}
|
||||
pixelShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public bool IsReady => !this._anyDirty;
|
||||
|
||||
public void PrepareRenderTarget(GraphicsDevice device, SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!this._anyDirty)
|
||||
return;
|
||||
for (int index = 0; index < this._playerRenders.Length; ++index)
|
||||
this._playerRenders[index].PrepareRenderTarget(device, spriteBatch);
|
||||
this._anyDirty = false;
|
||||
}
|
||||
|
||||
private void CreateOutlines(float alpha, float scale, Color borderColor)
|
||||
{
|
||||
if (!(borderColor != Color.Transparent))
|
||||
return;
|
||||
List<DrawData> drawDataList1 = new List<DrawData>((IEnumerable<DrawData>) this._drawData);
|
||||
List<DrawData> drawDataList2 = new List<DrawData>((IEnumerable<DrawData>) this._drawData);
|
||||
this._drawData.Clear();
|
||||
float num1 = 2f * scale;
|
||||
Color color1 = borderColor * (alpha * alpha);
|
||||
Color color2 = Color.Black * (alpha * alpha);
|
||||
int colorOnlyShaderIndex = ContentSamples.CommonlyUsedContentSamples.ColorOnlyShaderIndex;
|
||||
for (int index = 0; index < drawDataList2.Count; ++index)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index];
|
||||
drawData.shader = colorOnlyShaderIndex;
|
||||
drawData.color = color2;
|
||||
drawDataList2[index] = drawData;
|
||||
}
|
||||
int num2 = 2;
|
||||
for (int index1 = -num2; index1 <= num2; ++index1)
|
||||
{
|
||||
for (int index2 = -num2; index2 <= num2; ++index2)
|
||||
{
|
||||
if (Math.Abs(index1) + Math.Abs(index2) == num2)
|
||||
{
|
||||
Vector2 vector2 = new Vector2((float) index1 * num1, (float) index2 * num1);
|
||||
for (int index3 = 0; index3 < drawDataList2.Count; ++index3)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index3];
|
||||
drawData.position += vector2;
|
||||
this._drawData.Add(drawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int index = 0; index < drawDataList2.Count; ++index)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index];
|
||||
drawData.shader = colorOnlyShaderIndex;
|
||||
drawData.color = color1;
|
||||
drawDataList2[index] = drawData;
|
||||
}
|
||||
Vector2 vector2_1 = Vector2.Zero;
|
||||
int num3 = 1;
|
||||
for (int index4 = -num3; index4 <= num3; ++index4)
|
||||
{
|
||||
for (int index5 = -num3; index5 <= num3; ++index5)
|
||||
{
|
||||
if (Math.Abs(index4) + Math.Abs(index5) == num3)
|
||||
{
|
||||
vector2_1 = new Vector2((float) index4 * num1, (float) index5 * num1);
|
||||
for (int index6 = 0; index6 < drawDataList2.Count; ++index6)
|
||||
{
|
||||
DrawData drawData = drawDataList2[index6];
|
||||
drawData.position += vector2_1;
|
||||
this._drawData.Add(drawData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._drawData.AddRange((IEnumerable<DrawData>) drawDataList1);
|
||||
}
|
||||
}
|
||||
}
|
60
Graphics/Renderers/NPCHeadRenderer.cs
Normal file
60
Graphics/Renderers/NPCHeadRenderer.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.NPCHeadRenderer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria.GameContent;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class NPCHeadRenderer : INeedRenderTargetContent
|
||||
{
|
||||
private NPCHeadDrawRenderTargetContent[] _contents;
|
||||
private Asset<Texture2D>[] _matchingArray;
|
||||
|
||||
public NPCHeadRenderer(Asset<Texture2D>[] matchingArray)
|
||||
{
|
||||
this._matchingArray = matchingArray;
|
||||
this._contents = new NPCHeadDrawRenderTargetContent[matchingArray.Length];
|
||||
}
|
||||
|
||||
public void DrawWithOutlines(
|
||||
Entity entity,
|
||||
int headId,
|
||||
Vector2 position,
|
||||
Color color,
|
||||
float rotation,
|
||||
float scale,
|
||||
SpriteEffects effects)
|
||||
{
|
||||
if (this._contents[headId] == null)
|
||||
{
|
||||
this._contents[headId] = new NPCHeadDrawRenderTargetContent();
|
||||
this._contents[headId].SetTexture(this._matchingArray[headId].Value);
|
||||
}
|
||||
NPCHeadDrawRenderTargetContent content = this._contents[headId];
|
||||
if (content.IsReady)
|
||||
{
|
||||
RenderTarget2D target = content.GetTarget();
|
||||
Main.spriteBatch.Draw((Texture2D) target, position, new Rectangle?(), color, rotation, target.Size() / 2f, scale, effects, 0.0f);
|
||||
}
|
||||
else
|
||||
content.Request();
|
||||
}
|
||||
|
||||
public bool IsReady => false;
|
||||
|
||||
public void PrepareRenderTarget(GraphicsDevice device, SpriteBatch spriteBatch)
|
||||
{
|
||||
for (int index = 0; index < this._contents.Length; ++index)
|
||||
{
|
||||
if (this._contents[index] != null && !this._contents[index].IsReady)
|
||||
this._contents[index].PrepareRenderTarget(device, spriteBatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
43
Graphics/Renderers/ParticlePool`1.cs
Normal file
43
Graphics/Renderers/ParticlePool`1.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.ParticlePool`1
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class ParticlePool<T> where T : IPooledParticle
|
||||
{
|
||||
private ParticlePool<T>.ParticleInstantiator _instantiator;
|
||||
private List<T> _particles;
|
||||
|
||||
public ParticlePool(int initialPoolSize, ParticlePool<T>.ParticleInstantiator instantiator)
|
||||
{
|
||||
this._particles = new List<T>(initialPoolSize);
|
||||
this._instantiator = instantiator;
|
||||
}
|
||||
|
||||
public T RequestParticle()
|
||||
{
|
||||
int count = this._particles.Count;
|
||||
for (int index = 0; index < count; ++index)
|
||||
{
|
||||
T particle = this._particles[index];
|
||||
if (particle.IsRestingInPool)
|
||||
{
|
||||
particle = this._particles[index];
|
||||
particle.FetchFromPool();
|
||||
return this._particles[index];
|
||||
}
|
||||
}
|
||||
T obj = this._instantiator();
|
||||
this._particles.Add(obj);
|
||||
obj.FetchFromPool();
|
||||
return obj;
|
||||
}
|
||||
|
||||
public delegate T ParticleInstantiator() where T : IPooledParticle;
|
||||
}
|
||||
}
|
46
Graphics/Renderers/ParticleRenderer.cs
Normal file
46
Graphics/Renderers/ParticleRenderer.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.ParticleRenderer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class ParticleRenderer
|
||||
{
|
||||
public ParticleRendererSettings Settings;
|
||||
public List<IParticle> Particles = new List<IParticle>();
|
||||
|
||||
public ParticleRenderer() => this.Settings = new ParticleRendererSettings();
|
||||
|
||||
public void Add(IParticle particle) => this.Particles.Add(particle);
|
||||
|
||||
public void Update()
|
||||
{
|
||||
for (int index = 0; index < this.Particles.Count; ++index)
|
||||
{
|
||||
if (this.Particles[index].ShouldBeRemovedFromRenderer)
|
||||
{
|
||||
if (this.Particles[index] is IPooledParticle particle3)
|
||||
particle3.RestInPool();
|
||||
this.Particles.RemoveAt(index);
|
||||
--index;
|
||||
}
|
||||
else
|
||||
this.Particles[index].Update(ref this.Settings);
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
for (int index = 0; index < this.Particles.Count; ++index)
|
||||
{
|
||||
if (!this.Particles[index].ShouldBeRemovedFromRenderer)
|
||||
this.Particles[index].Draw(ref this.Settings, spriteBatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
Graphics/Renderers/ParticleRendererSettings.cs
Normal file
15
Graphics/Renderers/ParticleRendererSettings.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.ParticleRendererSettings
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public struct ParticleRendererSettings
|
||||
{
|
||||
public Vector2 AnchorPosition;
|
||||
}
|
||||
}
|
59
Graphics/Renderers/PrettySparkleParticle.cs
Normal file
59
Graphics/Renderers/PrettySparkleParticle.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.PrettySparkleParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.GameContent;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class PrettySparkleParticle : ABasicParticle
|
||||
{
|
||||
public Color ColorTint;
|
||||
public float Opacity;
|
||||
private float _timeSinceSpawn;
|
||||
|
||||
public override void FetchFromPool()
|
||||
{
|
||||
base.FetchFromPool();
|
||||
this.ColorTint = Color.Transparent;
|
||||
this._timeSinceSpawn = 0.0f;
|
||||
this.Opacity = 0.0f;
|
||||
}
|
||||
|
||||
public override void Update(ref ParticleRendererSettings settings)
|
||||
{
|
||||
base.Update(ref settings);
|
||||
++this._timeSinceSpawn;
|
||||
this.Opacity = Utils.GetLerpValue(0.0f, 0.05f, this._timeSinceSpawn / 60f, true) * Utils.GetLerpValue(1f, 0.9f, this._timeSinceSpawn / 60f, true);
|
||||
if ((double) this._timeSinceSpawn < 60.0)
|
||||
return;
|
||||
this.ShouldBeRemovedFromRenderer = true;
|
||||
}
|
||||
|
||||
public override void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
|
||||
{
|
||||
Color color1 = Color.White * this.Opacity * 0.9f;
|
||||
color1.A /= (byte) 2;
|
||||
Texture2D texture2D = TextureAssets.Extra[98].Value;
|
||||
Color color2 = this.ColorTint * this.Opacity * 0.5f;
|
||||
color2.A = (byte) 0;
|
||||
Vector2 origin = texture2D.Size() / 2f;
|
||||
Color color3 = color1 * 0.5f;
|
||||
float num = Utils.GetLerpValue(0.0f, 20f, this._timeSinceSpawn, true) * Utils.GetLerpValue(45f, 30f, this._timeSinceSpawn, true);
|
||||
Vector2 scale1 = new Vector2(0.3f, 2f) * num * this.Scale;
|
||||
Vector2 scale2 = new Vector2(0.3f, 1f) * num * this.Scale;
|
||||
Color color4 = color2 * num;
|
||||
Color color5 = color3 * num;
|
||||
Vector2 position = settings.AnchorPosition + this.LocalPosition;
|
||||
SpriteEffects effects = SpriteEffects.None;
|
||||
spritebatch.Draw(texture2D, position, new Rectangle?(), color4, 1.570796f + this.Rotation, origin, scale1, effects, 0.0f);
|
||||
spritebatch.Draw(texture2D, position, new Rectangle?(), color4, 0.0f + this.Rotation, origin, scale2, effects, 0.0f);
|
||||
spritebatch.Draw(texture2D, position, new Rectangle?(), color5, 1.570796f + this.Rotation, origin, scale1 * 0.6f, effects, 0.0f);
|
||||
spritebatch.Draw(texture2D, position, new Rectangle?(), color5, 0.0f + this.Rotation, origin, scale2 * 0.6f, effects, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
71
Graphics/Renderers/RandomizedFrameParticle.cs
Normal file
71
Graphics/Renderers/RandomizedFrameParticle.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.RandomizedFrameParticle
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
public class RandomizedFrameParticle : ABasicParticle
|
||||
{
|
||||
public float FadeInNormalizedTime;
|
||||
public float FadeOutNormalizedTime = 1f;
|
||||
public Color ColorTint = Color.White;
|
||||
public int AnimationFramesAmount;
|
||||
public int GameFramesPerAnimationFrame;
|
||||
private float _timeTolive;
|
||||
private float _timeSinceSpawn;
|
||||
private int _gameFramesCounted;
|
||||
|
||||
public override void FetchFromPool()
|
||||
{
|
||||
base.FetchFromPool();
|
||||
this.FadeInNormalizedTime = 0.0f;
|
||||
this.FadeOutNormalizedTime = 1f;
|
||||
this.ColorTint = Color.White;
|
||||
this.AnimationFramesAmount = 0;
|
||||
this.GameFramesPerAnimationFrame = 0;
|
||||
this._timeTolive = 0.0f;
|
||||
this._timeSinceSpawn = 0.0f;
|
||||
this._gameFramesCounted = 0;
|
||||
}
|
||||
|
||||
public void SetTypeInfo(
|
||||
int animationFramesAmount,
|
||||
int gameFramesPerAnimationFrame,
|
||||
float timeToLive)
|
||||
{
|
||||
this._timeTolive = timeToLive;
|
||||
this.GameFramesPerAnimationFrame = gameFramesPerAnimationFrame;
|
||||
this.AnimationFramesAmount = animationFramesAmount;
|
||||
this.RandomizeFrame();
|
||||
}
|
||||
|
||||
private void RandomizeFrame()
|
||||
{
|
||||
this._frame = this._texture.Frame(verticalFrames: this.AnimationFramesAmount, frameY: Main.rand.Next(this.AnimationFramesAmount));
|
||||
this._origin = this._frame.Size() / 2f;
|
||||
}
|
||||
|
||||
public override void Update(ref ParticleRendererSettings settings)
|
||||
{
|
||||
base.Update(ref settings);
|
||||
++this._timeSinceSpawn;
|
||||
if ((double) this._timeSinceSpawn >= (double) this._timeTolive)
|
||||
this.ShouldBeRemovedFromRenderer = true;
|
||||
if (++this._gameFramesCounted < this.GameFramesPerAnimationFrame)
|
||||
return;
|
||||
this._gameFramesCounted = 0;
|
||||
this.RandomizeFrame();
|
||||
}
|
||||
|
||||
public override void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
|
||||
{
|
||||
Color color = this.ColorTint * Utils.GetLerpValue(0.0f, this.FadeInNormalizedTime, this._timeSinceSpawn / this._timeTolive, true) * Utils.GetLerpValue(1f, this.FadeOutNormalizedTime, this._timeSinceSpawn / this._timeTolive, true);
|
||||
spritebatch.Draw(this._texture.Value, settings.AnchorPosition + this.LocalPosition, new Rectangle?(this._frame), color, this.Rotation, this._origin, this.Scale, SpriteEffects.None, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
87
Graphics/Renderers/ReturnGatePlayerRenderer.cs
Normal file
87
Graphics/Renderers/ReturnGatePlayerRenderer.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: Terraria.Graphics.Renderers.ReturnGatePlayerRenderer
|
||||
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
|
||||
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.ObjectInteractions;
|
||||
|
||||
namespace Terraria.Graphics.Renderers
|
||||
{
|
||||
internal class ReturnGatePlayerRenderer : IPlayerRenderer
|
||||
{
|
||||
private List<DrawData> _voidLensData = new List<DrawData>();
|
||||
private PotionOfReturnGateInteractionChecker _interactionChecker = new PotionOfReturnGateInteractionChecker();
|
||||
|
||||
public void DrawPlayers(Camera camera, IEnumerable<Player> players)
|
||||
{
|
||||
foreach (Player player in players)
|
||||
this.DrawReturnGateInWorld(camera, player);
|
||||
}
|
||||
|
||||
public void DrawPlayerHead(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float alpha = 1f,
|
||||
float scale = 1f,
|
||||
Color borderColor = default (Color))
|
||||
{
|
||||
this.DrawReturnGateInMap(camera, drawPlayer);
|
||||
}
|
||||
|
||||
public void DrawPlayer(
|
||||
Camera camera,
|
||||
Player drawPlayer,
|
||||
Vector2 position,
|
||||
float rotation,
|
||||
Vector2 rotationOrigin,
|
||||
float shadow = 0.0f,
|
||||
float scale = 1f)
|
||||
{
|
||||
this.DrawReturnGateInWorld(camera, drawPlayer);
|
||||
}
|
||||
|
||||
private void DrawReturnGateInMap(Camera camera, Player player)
|
||||
{
|
||||
}
|
||||
|
||||
private void DrawReturnGateInWorld(Camera camera, Player player)
|
||||
{
|
||||
Rectangle homeHitbox = Rectangle.Empty;
|
||||
if (!PotionOfReturnHelper.TryGetGateHitbox(player, out homeHitbox))
|
||||
return;
|
||||
if (player == Main.LocalPlayer)
|
||||
{
|
||||
int num = (int) this._interactionChecker.AttemptInteraction(player, homeHitbox);
|
||||
}
|
||||
int selectionMode = 0;
|
||||
if (!player.PotionOfReturnOriginalUsePosition.HasValue)
|
||||
return;
|
||||
SpriteBatch spriteBatch = camera.SpriteBatch;
|
||||
SamplerState sampler = camera.Sampler;
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, sampler, DepthStencilState.None, camera.Rasterizer, (Effect) null, camera.GameViewMatrix.TransformationMatrix);
|
||||
float opacity = player.whoAmI == Main.myPlayer ? 1f : 0.1f;
|
||||
Vector2 worldPosition = player.PotionOfReturnOriginalUsePosition.Value + new Vector2(0.0f, (float) (-player.height / 2));
|
||||
Vector2 vector2 = homeHitbox.Center.ToVector2();
|
||||
PotionOfReturnGateHelper returnGateHelper1 = new PotionOfReturnGateHelper(PotionOfReturnGateHelper.GateType.ExitPoint, worldPosition, opacity);
|
||||
PotionOfReturnGateHelper returnGateHelper2 = new PotionOfReturnGateHelper(PotionOfReturnGateHelper.GateType.EntryPoint, vector2, opacity);
|
||||
if (!Main.gamePaused)
|
||||
{
|
||||
returnGateHelper1.Update();
|
||||
returnGateHelper2.Update();
|
||||
}
|
||||
this._voidLensData.Clear();
|
||||
returnGateHelper1.DrawToDrawData(this._voidLensData, 0);
|
||||
returnGateHelper2.DrawToDrawData(this._voidLensData, selectionMode);
|
||||
foreach (DrawData drawData in this._voidLensData)
|
||||
drawData.Draw(spriteBatch);
|
||||
spriteBatch.End();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue