- disabled FOW blurring (made it possible to see through corners) and re-enabled penumbra
- fixed structures being assigned the misc category by default - turrets don't require a barrel sprite - OnImpact statuseffect is applied when a projectile hits something - WIP depth charges
This commit is contained in:
@@ -571,10 +571,17 @@
|
||||
<Content Include="Content\Items\Tools\tools.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\depthcharge.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\explosives.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\railgunetc.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\weapons.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -854,12 +861,6 @@
|
||||
<Content Include="Content\Items\Weapons\railgunbase.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\railguncontroller.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\railgunloader.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Reactor\reactor.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -1139,6 +1140,9 @@
|
||||
<None Include="Content\Items\warningSiren.ogg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Content\Items\Weapons\bigexplosion.ogg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Content\Items\Weapons\harpoon1.ogg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -266,6 +266,8 @@
|
||||
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10"/>
|
||||
|
||||
<LightComponent LightColor="1.0,0.0,0.0,1.0" Flicker="0.5" range="600" IsOn="false">
|
||||
<sprite texture="Content/Lights/light.png" sourcerect="33,0,31,39"/>
|
||||
|
||||
<StatusEffect type="OnUse" target="This" IsOn="true"/>
|
||||
|
||||
<StatusEffect type="OnActive" target="This" Condition="-0.5">
|
||||
|
||||
BIN
Subsurface/Content/Items/Weapons/bigexplosion.ogg
Normal file
BIN
Subsurface/Content/Items/Weapons/bigexplosion.ogg
Normal file
Binary file not shown.
102
Subsurface/Content/Items/Weapons/depthcharge.xml
Normal file
102
Subsurface/Content/Items/Weapons/depthcharge.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Items>
|
||||
<Item
|
||||
name="Depth Charge Tube"
|
||||
category="Machine"
|
||||
focusonselected="true"
|
||||
offsetonselected="700"
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture ="railgunetc.png" depth="0.01" sourcerect="64,180,47,76"/>
|
||||
|
||||
<Turret canbeselected = "true" linkable="true" barrelpos="23, 76"
|
||||
rotationlimits="90,90"
|
||||
powerconsumption="0.0">
|
||||
<StatusEffect type="OnUse" target="This" sound="Content/Items/Weapons/railgun.ogg">
|
||||
<Explosion range="1000.0" structuredamage="0" force="0.01" camerashake="10.0"/>
|
||||
</StatusEffect>
|
||||
</Turret>
|
||||
|
||||
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||
<input name="power_in"/>
|
||||
<input name="position_in"/>
|
||||
<input name="trigger_in"/>
|
||||
</ConnectionPanel>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
name="Depth Charge Loader"
|
||||
category="Machine"
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture="railgunetc.png" depth="0.8" sourcerect="0,160,61,96"/>
|
||||
|
||||
<ItemContainer hideitems="false" drawinventory="true" capacity="1" itempos="30,-55" iteminterval="26,0" itemrotation="0" canbeselected = "true">
|
||||
<Containable name="Depth Charge Shell"/>
|
||||
<Containable name="Nuclear Depth Charge"/>
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
name="Depth Charge Shell"
|
||||
category="Misc"
|
||||
pickdistance="150"
|
||||
price="50">
|
||||
|
||||
<Deconstruct time="10">
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Steel Bar"/>
|
||||
</Deconstruct>
|
||||
|
||||
<Sprite texture="railgunetc.png" sourcerect="113,188,47,68" depth ="0.5"/>
|
||||
|
||||
<Body width="47" height="68" density="30"/>
|
||||
|
||||
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,20" handle2="10,20" aimable="false"/>
|
||||
|
||||
<Projectile launchimpulse="5.0">
|
||||
<Attack damage="1" structuredamage="1" damagetype="Blunt"/>
|
||||
<StatusEffect type="OnImpact" target="Contained" Condition="-100.0"/>
|
||||
</Projectile>
|
||||
|
||||
<ItemContainer hideitems="true" capacity="1" canbeselected = "true">
|
||||
<Containable name="smallitem"/>
|
||||
<Containable name="explosive"/>
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
name="Nuclear Depth Charge"
|
||||
category="Misc"
|
||||
pickdistance="150"
|
||||
price="50">
|
||||
|
||||
<Deconstruct time="20">
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Uranium Bar"/>
|
||||
</Deconstruct>
|
||||
|
||||
<Sprite texture="railgunetc.png" sourcerect="163,188,46,68" depth="0.5"/>
|
||||
|
||||
<Body width="47" height="68" density="30"/>
|
||||
|
||||
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,20" handle2="10,20" aimable="false"/>
|
||||
|
||||
<Projectile launchimpulse="5.0">
|
||||
<StatusEffect type="OnImpact" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg">
|
||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
|
||||
</StatusEffect>
|
||||
<StatusEffect type="OnImpact" target="Contained" Condition="-100.0"/>
|
||||
</Projectile>
|
||||
|
||||
<ItemContainer hideitems="true" capacity="1" canbeselected = "true">
|
||||
<Containable name="smallitem"/>
|
||||
<Containable name="explosive"/>
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
</Items>
|
||||
@@ -32,7 +32,7 @@
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture ="railguncontroller.png" depth="0.8" sourcerect="0,0,61,97"/>
|
||||
<Sprite texture ="railgunetc.png" depth="0.8" sourcerect="182,0,61,97"/>
|
||||
|
||||
<Controller UserPos="-1.0" direction ="Right" canbeselected = "true">
|
||||
<limbposition limb="Head" position="-5,-62"/>
|
||||
@@ -54,13 +54,12 @@
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture ="railgunloader.png" depth =" 0.8"/>
|
||||
<Sprite texture ="railgunetc.png" depth="0.8" sourcerect="0,0,177,128"/>
|
||||
|
||||
<ItemContainer hideitems="false" drawinventory="true" capacity="6" slotsperrow="6" itempos="24,-75" iteminterval="26,0" itemrotation="90" canbeselected = "true">
|
||||
<Containable name="Railgun Shell"/>
|
||||
<Containable name="Nuclear Shell"/>
|
||||
</ItemContainer>
|
||||
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
@@ -111,7 +110,7 @@
|
||||
|
||||
<Projectile launchimpulse="80.0">
|
||||
<Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
|
||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Reactor/explosion.ogg">
|
||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg">
|
||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
|
||||
</StatusEffect>
|
||||
</Projectile>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.7 KiB |
BIN
Subsurface/Content/Items/Weapons/railgunetc.png
Normal file
BIN
Subsurface/Content/Items/Weapons/railgunetc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
@@ -172,6 +172,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.OnUse, 1.0f);
|
||||
ApplyStatusEffects(ActionType.OnImpact, 1.0f);
|
||||
|
||||
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
|
||||
|
||||
|
||||
@@ -75,8 +75,19 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
IsActive = true;
|
||||
|
||||
barrelSprite = new Sprite(Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" +element.Attribute("barrelsprite").Value,
|
||||
ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero));
|
||||
string barrelSpritePath = ToolBox.GetAttributeString(element, "barrelsprite", "");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(barrelSpritePath))
|
||||
{
|
||||
if (!barrelSpritePath.Contains("/"))
|
||||
{
|
||||
barrelSpritePath = Path.Combine(Path.GetDirectoryName(item.Prefab.ConfigFile), barrelSpritePath);
|
||||
}
|
||||
|
||||
barrelSprite = new Sprite(
|
||||
barrelSpritePath,
|
||||
ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing = false)
|
||||
@@ -85,10 +96,13 @@ namespace Barotrauma.Items.Components
|
||||
if (item.Submarine != null) drawPos += item.Submarine.DrawPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
barrelSprite.Draw(spriteBatch,
|
||||
drawPos + barrelPos, Color.White,
|
||||
rotation + MathHelper.PiOver2, 1.0f,
|
||||
SpriteEffects.None, item.Sprite.Depth+0.01f);
|
||||
if (barrelSprite!=null)
|
||||
{
|
||||
barrelSprite.Draw(spriteBatch,
|
||||
drawPos + barrelPos, Color.White,
|
||||
rotation + MathHelper.PiOver2, 1.0f,
|
||||
SpriteEffects.None, item.Sprite.Depth+0.01f);
|
||||
}
|
||||
|
||||
if (!editing) return;
|
||||
|
||||
@@ -169,6 +183,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
Item projectile = projectiles[0].Item;
|
||||
|
||||
projectile.Drop();
|
||||
|
||||
projectile.body.ResetDynamics();
|
||||
projectile.body.Enabled = true;
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
|
||||
@@ -298,7 +314,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
base.RemoveComponentSpecific();
|
||||
|
||||
barrelSprite.Remove();
|
||||
if (barrelSprite != null) barrelSprite.Remove();
|
||||
}
|
||||
|
||||
private List<Projectile> GetLoadedProjectiles(bool returnFirst = false)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
public Vector2 LightPos;
|
||||
|
||||
public int ShadowVertexCount;//, PenumbraVertexCount;
|
||||
public int ShadowVertexCount, PenumbraVertexCount;
|
||||
|
||||
public CachedShadow(VertexPositionColor[] shadowVertices, Vector2 lightPos, int shadowVertexCount, int penumbraVertexCount)
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace Barotrauma.Lights
|
||||
ShadowBuffer.SetData(shadowVertices, 0, shadowVertices.Length);
|
||||
|
||||
ShadowVertexCount = shadowVertexCount;
|
||||
//PenumbraVertexCount = penumbraVertexCount;
|
||||
PenumbraVertexCount = penumbraVertexCount;
|
||||
|
||||
LightPos = lightPos;
|
||||
}
|
||||
@@ -46,7 +46,8 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
public static List<ConvexHull> list = new List<ConvexHull>();
|
||||
static BasicEffect shadowEffect;
|
||||
|
||||
static BasicEffect penumbraEffect;
|
||||
|
||||
private Dictionary<LightSource, CachedShadow> cachedShadows;
|
||||
|
||||
private Vector2[] vertices;
|
||||
@@ -56,6 +57,7 @@ namespace Barotrauma.Lights
|
||||
private bool[] backFacing;
|
||||
|
||||
private VertexPositionColor[] shadowVertices;
|
||||
private VertexPositionTexture[] penumbraVertices;
|
||||
|
||||
int shadowVertexCount;
|
||||
|
||||
@@ -87,21 +89,21 @@ namespace Barotrauma.Lights
|
||||
shadowEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
shadowEffect.VertexColorEnabled = true;
|
||||
}
|
||||
//if (penumbraEffect == null)
|
||||
//{
|
||||
// penumbraEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
// penumbraEffect.TextureEnabled = true;
|
||||
// //shadowEffect.VertexColorEnabled = true;
|
||||
// penumbraEffect.LightingEnabled = false;
|
||||
// penumbraEffect.Texture = TextureLoader.FromFile("Content/Lights/penumbra.png");
|
||||
//}
|
||||
if (penumbraEffect == null)
|
||||
{
|
||||
penumbraEffect = new BasicEffect(GameMain.CurrGraphicsDevice);
|
||||
penumbraEffect.TextureEnabled = true;
|
||||
//shadowEffect.VertexColorEnabled = true;
|
||||
penumbraEffect.LightingEnabled = false;
|
||||
penumbraEffect.Texture = TextureLoader.FromFile("Content/Lights/penumbra.png");
|
||||
}
|
||||
|
||||
parentEntity = parent;
|
||||
|
||||
cachedShadows = new Dictionary<LightSource, CachedShadow>();
|
||||
|
||||
shadowVertices = new VertexPositionColor[6 * 2];
|
||||
//penumbraVertices = new VertexPositionTexture[6];
|
||||
penumbraVertices = new VertexPositionTexture[6];
|
||||
|
||||
//vertices = points;
|
||||
primitiveCount = points.Length;
|
||||
@@ -151,7 +153,7 @@ namespace Barotrauma.Lights
|
||||
vertices = points;
|
||||
losVertices = points;
|
||||
|
||||
int margin = 7;
|
||||
int margin = 0;
|
||||
|
||||
if (Math.Abs(points[0].X - points[2].X) < Math.Abs(points[0].Y - points[1].Y))
|
||||
{
|
||||
@@ -283,6 +285,54 @@ namespace Barotrauma.Lights
|
||||
svCount += 2;
|
||||
currentIndex = (currentIndex + 1) % primitiveCount;
|
||||
}
|
||||
|
||||
if (los)
|
||||
{
|
||||
CalculatePenumbraVertices(startingIndex, endingIndex, lightSourcePos, los);
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculatePenumbraVertices(int startingIndex, int endingIndex, Vector2 lightSourcePos, bool los)
|
||||
{
|
||||
for (int n = 0; n < 4; n += 3)
|
||||
{
|
||||
Vector3 penumbraStart = new Vector3((n == 0) ? vertices[startingIndex] : vertices[endingIndex], 0.0f);
|
||||
|
||||
penumbraVertices[n] = new VertexPositionTexture();
|
||||
penumbraVertices[n].Position = penumbraStart;
|
||||
penumbraVertices[n].TextureCoordinate = new Vector2(0.0f, 1.0f);
|
||||
//penumbraVertices[0].te = fow ? Color.Black : Color.Transparent;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
penumbraVertices[n + i + 1] = new VertexPositionTexture();
|
||||
Vector3 vertexDir = penumbraStart - new Vector3(lightSourcePos, 0);
|
||||
vertexDir.Normalize();
|
||||
|
||||
Vector3 normal = (i == 0) ? new Vector3(-vertexDir.Y, vertexDir.X, 0.0f) : new Vector3(vertexDir.Y, -vertexDir.X, 0.0f) * 0.05f;
|
||||
if (n > 0) normal = -normal;
|
||||
|
||||
vertexDir = penumbraStart - (new Vector3(lightSourcePos, 0) - normal * 20.0f);
|
||||
vertexDir.Normalize();
|
||||
penumbraVertices[n + i + 1].Position = new Vector3(lightSourcePos, 0) + vertexDir * 9000;
|
||||
|
||||
if (los)
|
||||
{
|
||||
penumbraVertices[n + i + 1].TextureCoordinate = (i == 0) ? new Vector2(0.05f, 0.0f) : new Vector2(1.0f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
penumbraVertices[n + i + 1].TextureCoordinate = (i == 0) ? new Vector2(1.0f, 0.0f) : Vector2.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
var temp = penumbraVertices[4];
|
||||
penumbraVertices[4] = penumbraVertices[5];
|
||||
penumbraVertices[5] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawShadows(GraphicsDevice graphicsDevice, Camera cam, LightSource light, Matrix transform, bool los = true)
|
||||
@@ -345,24 +395,37 @@ namespace Barotrauma.Lights
|
||||
if (los)
|
||||
{
|
||||
shadowEffect.CurrentTechnique.Passes[0].Apply();
|
||||
graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, shadowVertices, 0, shadowVertexCount * 2 - 2);
|
||||
graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, shadowVertices, 0, shadowVertexCount * 2 - 2, VertexPositionColor.VertexDeclaration);
|
||||
}
|
||||
else
|
||||
{
|
||||
shadowEffect.CurrentTechnique.Passes[0].Apply();
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, shadowVertexCount * 2 - 2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (los)
|
||||
{
|
||||
penumbraEffect.World = shadowEffect.World;
|
||||
penumbraEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
#if WINDOWS
|
||||
graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, penumbraVertices, 0, 2, VertexPositionTexture.VertexDeclaration);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
|
||||
|
||||
ClearCachedShadows();
|
||||
|
||||
list.Remove(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,47 +69,6 @@ namespace Barotrauma.Lights
|
||||
lights.Remove(light);
|
||||
}
|
||||
|
||||
public void DrawLOS(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Effect effect)
|
||||
{
|
||||
if (!LosEnabled || ViewTarget==null) return;
|
||||
|
||||
//Vector2 pos = ViewTarget.WorldPosition;
|
||||
|
||||
//Rectangle camView = new Rectangle(cam.WorldView.X, cam.WorldView.Y - cam.WorldView.Height, cam.WorldView.Width, cam.WorldView.Height);
|
||||
|
||||
//Matrix shadowTransform = cam.ShaderTransform
|
||||
// * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
//graphics.SetRenderTarget(losTexture);
|
||||
//graphics.Clear(Color.Transparent);
|
||||
|
||||
//foreach (ConvexHull convexHull in ConvexHull.list)
|
||||
//{
|
||||
// if (!convexHull.Intersects(camView)) continue;
|
||||
// //if (!camView.Intersects(convexHull.BoundingBox)) continue;
|
||||
|
||||
// convexHull.DrawShadows(graphics, cam, pos, shadowTransform);
|
||||
//}
|
||||
|
||||
//graphics.SetRenderTarget(null);
|
||||
|
||||
//if (!ObstructVision) return;
|
||||
|
||||
//spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative);
|
||||
//spriteBatch.Draw(losTexture, Vector2.Zero);
|
||||
//spriteBatch.End();
|
||||
|
||||
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, ObstructVision ? CustomBlendStates.Multiplicative : BlendState.AlphaBlend, null, null, null, effect);
|
||||
//effect.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Draw(losTexture, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
ObstructVision = false;
|
||||
|
||||
}
|
||||
|
||||
public void OnMapLoaded()
|
||||
{
|
||||
foreach (LightSource light in lights)
|
||||
@@ -191,11 +150,11 @@ namespace Barotrauma.Lights
|
||||
|
||||
graphics.SetRenderTarget(losTexture);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.Transform);
|
||||
|
||||
if (ObstructVision)
|
||||
{
|
||||
graphics.Clear(Color.Black);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.Transform);
|
||||
//graphics.Clear(Color.Black);
|
||||
|
||||
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
||||
diff.Y = -diff.Y;
|
||||
@@ -205,14 +164,16 @@ namespace Barotrauma.Lights
|
||||
|
||||
spriteBatch.Draw(visionCircle, new Vector2(ViewTarget.WorldPosition.X, -ViewTarget.WorldPosition.Y), null, Color.White, rotation,
|
||||
new Vector2(LightSource.LightTexture.Width*0.2f, LightSource.LightTexture.Height/2), scale, SpriteEffects.None, 0.0f);
|
||||
spriteBatch.End();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Clear(Color.Transparent);
|
||||
graphics.Clear(Color.White);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
if (LosEnabled && ViewTarget != null)
|
||||
@@ -232,7 +193,6 @@ namespace Barotrauma.Lights
|
||||
convexHull.DrawShadows(graphics, cam, pos, shadowTransform);
|
||||
}
|
||||
}
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
}
|
||||
|
||||
@@ -253,7 +213,16 @@ namespace Barotrauma.Lights
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
public void DrawLOS(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Effect effect)
|
||||
{
|
||||
if (!LosEnabled || ViewTarget == null) return;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null);
|
||||
spriteBatch.Draw(losTexture, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
ObstructVision = false;
|
||||
}
|
||||
|
||||
public void ClearLights()
|
||||
{
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
||||
|
||||
MapEntityCategory category;
|
||||
|
||||
if (!Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), true, out category))
|
||||
if (!Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Structure"), true, out category))
|
||||
{
|
||||
category = MapEntityCategory.Structure;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user