Release 1.9.7.0 - Summer Update 2025
This commit is contained in:
@@ -714,21 +714,21 @@ namespace Barotrauma.Lights
|
||||
const float MaxOffset = 256.0f;
|
||||
//the magic numbers here are just based on experimentation
|
||||
float MinHorizontalScale = MathHelper.Lerp(3.5f, 1.5f, ObstructVisionAmount);
|
||||
float MaxHorizontalScale = MinHorizontalScale * 1.25f;
|
||||
float MaxHorizontalScale = 10.0f;
|
||||
float VerticalScale = MathHelper.Lerp(4.0f, 1.25f, ObstructVisionAmount);
|
||||
|
||||
//Starting point and scale-based modifier that moves the point of origin closer to the edge of the texture if the player moves their mouse further away, or vice versa.
|
||||
float relativeOriginStartPosition = 0.1f; //Increasing this value moves the origin further behind the character
|
||||
float originStartPosition = visionCircle.Width * relativeOriginStartPosition * MinHorizontalScale;
|
||||
float relativeOriginLookAtPosModifier = -0.055f; //Increase this value increases how much the vision changes by moving the mouse
|
||||
float originLookAtPosModifier = visionCircle.Width * relativeOriginLookAtPosModifier;
|
||||
|
||||
Vector2 scale = new Vector2(
|
||||
MathHelper.Clamp(losOffset.Length() / MaxOffset, MinHorizontalScale, MaxHorizontalScale), VerticalScale);
|
||||
|
||||
//Increasing this value moves the origin further behind the character (current value chosen by experimentation)
|
||||
float relativeOriginStartPosition = 0.2f;
|
||||
//Divide by scale to move the origin closer to the edge of the texture, meaning the visible area moves forwards.
|
||||
//Just stretching the texture without touching the origin would otherwise mean the blurry edge of visibility moves further behind the character (allowing you to see behind you better when looking far away)
|
||||
float originStartPosition = visionCircle.Width * relativeOriginStartPosition / scale.X;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, transformMatrix: cam.Transform * Matrix.CreateScale(new Vector3(GameSettings.CurrentConfig.Graphics.LightMapScale, GameSettings.CurrentConfig.Graphics.LightMapScale, 1.0f)));
|
||||
spriteBatch.Draw(visionCircle, new Vector2(ViewTarget.WorldPosition.X, -ViewTarget.WorldPosition.Y), null, Color.White, rotation,
|
||||
new Vector2(originStartPosition + (scale.X * originLookAtPosModifier), visionCircle.Height / 2), scale, SpriteEffects.None, 0.0f);
|
||||
new Vector2(originStartPosition, visionCircle.Height / 2), scale, SpriteEffects.None, 0.0f);
|
||||
spriteBatch.End();
|
||||
}
|
||||
else
|
||||
@@ -788,8 +788,8 @@ namespace Barotrauma.Lights
|
||||
if (!convexHull.Intersects(camView)) { continue; }
|
||||
|
||||
Vector2 relativeViewPos = pos;
|
||||
if (convexHull.ParentEntity?.Submarine != null)
|
||||
{
|
||||
if (convexHull.ParentEntity?.Submarine != null)
|
||||
{
|
||||
relativeViewPos -= convexHull.ParentEntity.Submarine.DrawPosition;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user