New sonar overlay image
This commit is contained in:
@@ -75,7 +75,7 @@
|
|||||||
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI"/>
|
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI"/>
|
||||||
</Steering>
|
</Steering>
|
||||||
|
|
||||||
<Radar canbeselected = "true" powerconsumption="100">
|
<Radar canbeselected = "true" powerconsumption="100" displaybordersize="0.2">
|
||||||
<sound file="radarPing.ogg" type="OnUse" range="4000.0"/>
|
<sound file="radarPing.ogg" type="OnUse" range="4000.0"/>
|
||||||
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI" color="0.0,0.0,0.0,0.0"/>
|
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI" color="0.0,0.0,0.0,0.0"/>
|
||||||
<PingCircle texture="Content/Items/Engine/pingCircle.png" origin="0.5,0.5"/>
|
<PingCircle texture="Content/Items/Engine/pingCircle.png" origin="0.5,0.5"/>
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
<item name="Screwdriver"/>
|
<item name="Screwdriver"/>
|
||||||
</fixrequirement>
|
</fixrequirement>
|
||||||
|
|
||||||
<Radar canbeselected = "true" powerconsumption="100">
|
<Radar canbeselected = "true" powerconsumption="100" displaybordersize="0.2">
|
||||||
<StatusEffect type="InWater" target="This" condition="-1.0"/>
|
<StatusEffect type="InWater" target="This" condition="-1.0"/>
|
||||||
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI"/>
|
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI"/>
|
||||||
<PingCircle texture="Content/Items/Engine/pingCircle.png" origin="0.5,0.5"/>
|
<PingCircle texture="Content/Items/Engine/pingCircle.png" origin="0.5,0.5"/>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 283 KiB |
@@ -198,7 +198,7 @@
|
|||||||
<Holdable slots="Any,RightHand,LeftHand"
|
<Holdable slots="Any,RightHand,LeftHand"
|
||||||
holdangle="30" handle1="-10,0"/>
|
holdangle="30" handle1="-10,0"/>
|
||||||
|
|
||||||
<Radar range="6000.0" powerconsumption="10" drawhudwhenequipped="true" detectsubmarinewalls="true">
|
<Radar range="6000.0" powerconsumption="10" drawhudwhenequipped="true" detectsubmarinewalls="true" displaybordersize="0.2">
|
||||||
<StatusEffect type="OnUse" target="Contained" Condition="-1.0" disabledeltatime="true"/>
|
<StatusEffect type="OnUse" target="Contained" Condition="-1.0" disabledeltatime="true"/>
|
||||||
<sound file="Content/Items/Engine/radarPing.ogg" type="OnUse" range="1000.0"/>
|
<sound file="Content/Items/Engine/radarPing.ogg" type="OnUse" range="1000.0"/>
|
||||||
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI"/>
|
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" style="ItemUI"/>
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ namespace Barotrauma.Items.Components
|
|||||||
private float displayRadius;
|
private float displayRadius;
|
||||||
private float displayScale;
|
private float displayScale;
|
||||||
|
|
||||||
|
private float displayBorderSize;
|
||||||
|
|
||||||
[HasDefaultValue(10000.0f, false)]
|
[HasDefaultValue(10000.0f, false)]
|
||||||
public float Range
|
public float Range
|
||||||
{
|
{
|
||||||
@@ -62,6 +64,8 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
radarBlips = new List<RadarBlip>();
|
radarBlips = new List<RadarBlip>();
|
||||||
|
|
||||||
|
displayBorderSize = ToolBox.GetAttributeFloat(element, "displaybordersize", 0.0f);
|
||||||
|
|
||||||
foreach (XElement subElement in element.Elements())
|
foreach (XElement subElement in element.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
@@ -168,25 +172,19 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
GuiFrame.Draw(spriteBatch);
|
GuiFrame.Draw(spriteBatch);
|
||||||
|
|
||||||
spriteBatch.End();
|
int radius = GuiFrame.Rect.Height / 2 - 10;
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
|
|
||||||
|
|
||||||
int radius = GuiFrame.Rect.Height / 2 - 30;
|
|
||||||
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
|
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect)
|
private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect)
|
||||||
{
|
{
|
||||||
center = new Vector2(rect.X + rect.Width * 0.5f, rect.Center.Y);
|
center = new Vector2(rect.X + rect.Width * 0.5f, rect.Center.Y);
|
||||||
displayRadius = rect.Width / 2.0f;
|
displayRadius = (rect.Width / 2.0f) * (1.0f - displayBorderSize);
|
||||||
displayScale = displayRadius / range;
|
displayScale = displayRadius / range;
|
||||||
|
|
||||||
if (IsActive)
|
if (IsActive)
|
||||||
{
|
{
|
||||||
pingCircle.Draw(spriteBatch, center, Color.White * (1.0f - pingState), 0.0f, (rect.Width / pingCircle.size.X) * pingState);
|
pingCircle.Draw(spriteBatch, center, Color.White * (1.0f - pingState), 0.0f, (displayRadius*2 / pingCircle.size.X) * pingState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.Submarine != null && !DetectSubmarineWalls)
|
if (item.Submarine != null && !DetectSubmarineWalls)
|
||||||
@@ -206,14 +204,23 @@ namespace Barotrauma.Items.Components
|
|||||||
Vector2 end = (submarine.HullVertices[(i + 1) % submarine.HullVertices.Count] + offset) * simScale;
|
Vector2 end = (submarine.HullVertices[(i + 1) % submarine.HullVertices.Count] + offset) * simScale;
|
||||||
end.Y = -end.Y;
|
end.Y = -end.Y;
|
||||||
|
|
||||||
GUI.DrawLine(spriteBatch, center + start, center + end, Color.Green);
|
GUI.DrawLine(spriteBatch, center + start, center + end, Color.LightBlue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (RadarBlip radarBlip in radarBlips)
|
if (radarBlips.Count > 0)
|
||||||
{
|
{
|
||||||
DrawBlip(spriteBatch, radarBlip, center, radarBlip.FadeTimer / 2.0f);
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
|
||||||
|
|
||||||
|
foreach (RadarBlip radarBlip in radarBlips)
|
||||||
|
{
|
||||||
|
DrawBlip(spriteBatch, radarBlip, center, radarBlip.FadeTimer / 2.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.DebugDraw)
|
if (GameMain.DebugDraw)
|
||||||
@@ -500,7 +507,7 @@ namespace Barotrauma.Items.Components
|
|||||||
markerPos.X = (int)markerPos.X;
|
markerPos.X = (int)markerPos.X;
|
||||||
markerPos.Y = (int)markerPos.Y;
|
markerPos.Y = (int)markerPos.Y;
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightGreen * textAlpha);
|
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightBlue);
|
||||||
|
|
||||||
if (dir.X < 0.0f) markerPos.X -= GUI.SmallFont.MeasureString(label).X+10;
|
if (dir.X < 0.0f) markerPos.X -= GUI.SmallFont.MeasureString(label).X+10;
|
||||||
|
|
||||||
@@ -511,7 +518,7 @@ namespace Barotrauma.Items.Components
|
|||||||
GUI.DrawString(spriteBatch,
|
GUI.DrawString(spriteBatch,
|
||||||
new Vector2(markerPos.X + 10, markerPos.Y),
|
new Vector2(markerPos.X + 10, markerPos.Y),
|
||||||
wrappedLabel,
|
wrappedLabel,
|
||||||
Color.LightGreen * textAlpha, Color.Black * textAlpha * 0.5f,
|
Color.LightBlue * textAlpha, Color.Black * textAlpha * 0.5f,
|
||||||
2, GUI.SmallFont);
|
2, GUI.SmallFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user