Button&door sounds, sound looping bugfixes, positional sound bugfixes + low pass filter on distant sounds, submarine collision improvements, controller trigger bugfix, humans walk/run more slowly in water

This commit is contained in:
Regalis
2015-10-04 14:49:05 +03:00
parent 46e862216b
commit 0be4ad4f84
66 changed files with 317 additions and 222 deletions
Binary file not shown.
@@ -12,6 +12,7 @@
<Controller userpos="0" direction ="None" canbepicked = "true" msg="Open [E]"> <Controller userpos="0" direction ="None" canbepicked = "true" msg="Open [E]">
<RequiredItem name="ID Card" type="Picked" msg="UNAUTHORIZED ACCESS"/> <RequiredItem name="ID Card" type="Picked" msg="UNAUTHORIZED ACCESS"/>
<sound file="beep.ogg" type="OnUse" range="500.0"/>
</Controller> </Controller>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
Binary file not shown.
+2
View File
@@ -9,6 +9,7 @@
<Door> <Door>
<Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.05" origin="0.5,0.0"/> <Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.05" origin="0.5,0.0"/>
<WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/> <WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/>
<sound file="door.ogg" type="OnUse" range="500.0"/>
</Door> </Door>
<AiTarget sightrange="5000.0"/> <AiTarget sightrange="5000.0"/>
@@ -32,6 +33,7 @@
<Door window="0,-18,10,89"> <Door window="0,-18,10,89">
<Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.0" origin="0.5,0.0"/> <Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.0" origin="0.5,0.0"/>
<WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/> <WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/>
<sound file="door.ogg" type="OnUse" range="500.0"/>
</Door> </Door>
<AiTarget sightrange="5000.0"/> <AiTarget sightrange="5000.0"/>
+1 -1
View File
@@ -10,7 +10,7 @@
<Engine minvoltage="0.5" powerperforce="10.0" maxforce="500" canbeselected = "true"> <Engine minvoltage="0.5" powerperforce="10.0" maxforce="500" canbeselected = "true">
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/> <GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
<sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume"/> <sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/>
</Engine> </Engine>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
@@ -8,7 +8,7 @@
<OxygenGenerator powerconsumption="1000.0" minvoltage="0.5" canbeselected = "true"> <OxygenGenerator powerconsumption="1000.0" minvoltage="0.5" canbeselected = "true">
<StatusEffect type="OnActive" target="Contained" targetnames="Oxygen Tank" Condition="2.0"/> <StatusEffect type="OnActive" target="Contained" targetnames="Oxygen Tank" Condition="2.0"/>
<sound file="oxygengenerator.ogg" type="OnActive" range="2000.0" volume="CurrPowerConsumption" volumemultiplier="0.001f"/> <sound file="oxygengenerator.ogg" type="OnActive" range="1000.0" volume="CurrFlow" volumemultiplier="0.001f" loop="true"/>
</OxygenGenerator> </OxygenGenerator>
<trigger/> <trigger/>
@@ -30,7 +30,7 @@
<Sprite texture ="vent.png" depth="0.85"/> <Sprite texture ="vent.png" depth="0.85"/>
<Vent> <Vent>
<sound file="ventilation.ogg" type="OnActive" range="600.0" volume="OxygenFlow" volumemultiplier="0.001f"/> <sound file="ventilation.ogg" type="OnActive" range="600.0" volume="OxygenFlow" volumemultiplier="0.001f" loop="true"/>
</Vent> </Vent>
</Item> </Item>
+1 -1
View File
@@ -7,7 +7,7 @@
<Pump canbeselected = "true" maxflow="500" PowerConsumption="300.0" MinVoltage="0.3"> <Pump canbeselected = "true" maxflow="500" PowerConsumption="300.0" MinVoltage="0.3">
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/> <GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
<sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrPowerConsumption" volumemultiplier="0.003"/> <sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrFlow" volumemultiplier="0.01" loop="true"/>
</Pump> </Pump>
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
Binary file not shown.
+1 -1
View File
@@ -24,7 +24,7 @@
<GuiFrame rect="0,0,0.6,0.7" alignment="Center" color="0.0,0.0,0.0,0.8"/> <GuiFrame rect="0,0,0.6,0.7" alignment="Center" color="0.0,0.0,0.0,0.8"/>
<requireditem name="Fuel Rod" type="Contained" msg="Fuel required to run the engine"/> <requireditem name="Fuel Rod" type="Contained" msg="Fuel required to run the engine"/>
<StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" /> <StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" />
<sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02f"/> <sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02" loop="true"/>
<StatusEffect type="OnBroken" target="This" FissionRate="0.0" disabledeltatime="true" sound="Content/Items/Reactor/explosion.ogg"> <StatusEffect type="OnBroken" target="This" FissionRate="0.0" disabledeltatime="true" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range ="800" damage="500" structuredamage="400" stun="5.0" force="5.0"/> <Explosion range ="800" damage="500" structuredamage="400" stun="5.0" force="5.0"/>
+2 -2
View File
@@ -19,7 +19,7 @@
<!-- the item must contain a welding fuel tank for it to work --> <!-- the item must contain a welding fuel tank for it to work -->
<RequiredItems name="Welding Fuel Tank" type="Contained" msg="Welding fuel required"/> <RequiredItems name="Welding Fuel Tank" type="Contained" msg="Welding fuel required"/>
<sound file="weldingTool.ogg" type="OnUse" range="500.0"/> <sound file="weldingTool.ogg" type="OnUse" range="500.0" loop="true"/>
<!-- when using, the contained welding fuel tank will detoriate (= lose fuel) --> <!-- when using, the contained welding fuel tank will detoriate (= lose fuel) -->
<StatusEffect type="OnUse" target="Contained" targetnames="Welding Fuel Tank" Condition="-0.7"/> <StatusEffect type="OnUse" target="Contained" targetnames="Welding Fuel Tank" Condition="-0.7"/>
@@ -64,7 +64,7 @@
<StatusEffect type="OnUse" target="Contained" targetnames="Oxygen Tank" Condition="-0.7"/> <StatusEffect type="OnUse" target="Contained" targetnames="Oxygen Tank" Condition="-0.7"/>
<StatusEffect type="OnUse" target="UseTarget" targetnames="Door,Windowed Door" Stuck="-20.0" Condition="-3.0"/> <StatusEffect type="OnUse" target="UseTarget" targetnames="Door,Windowed Door" Stuck="-20.0" Condition="-3.0"/>
<sound file="plasmaCutter.ogg" type="OnUse" range="500.0"/> <sound file="plasmaCutter.ogg" type="OnUse" range="500.0" loop="true"/>
<Fixable name="structure"/> <Fixable name="structure"/>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.
Binary file not shown.
+3 -1
View File
@@ -4,7 +4,9 @@
<damagesound file="Content/Sounds/Damage/StructureBlunt2.ogg" damagerange="20.0,30.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt2.ogg" damagerange="20.0,30.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt3.ogg" damagerange="25.0,50.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt3.ogg" damagerange="25.0,50.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt4.ogg" damagerange="40.0,80.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt4.ogg" damagerange="40.0,80.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt5.ogg" damagerange="70.0,100.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt5.ogg" damagerange="60.0,80.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt6.ogg" damagerange="60.0,100.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt7.ogg" damagerange="80.0,100.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureCrunch1.ogg" damagerange="0.0,40.0" damagesoundtype="StructureSlash"/> <damagesound file="Content/Sounds/Damage/StructureCrunch1.ogg" damagerange="0.0,40.0" damagesoundtype="StructureSlash"/>
<damagesound file="Content/Sounds/Damage/StructureCrunch2.ogg" damagerange="5.0,70.0" damagesoundtype="StructureSlash"/> <damagesound file="Content/Sounds/Damage/StructureCrunch2.ogg" damagerange="5.0,70.0" damagesoundtype="StructureSlash"/>
+6 -4
View File
@@ -124,8 +124,6 @@ namespace Subsurface
public void Translate(Vector2 amount) public void Translate(Vector2 amount)
{ {
position += amount; position += amount;
Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f);
//UpdateTransform(); //UpdateTransform();
} }
@@ -152,6 +150,10 @@ namespace Subsurface
prevPosition = position; prevPosition = position;
prevZoom = zoom; prevZoom = zoom;
Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f);
} }
public void MoveCamera(float deltaTime) public void MoveCamera(float deltaTime)
@@ -161,7 +163,6 @@ namespace Subsurface
Vector2 moveCam = Vector2.Zero; Vector2 moveCam = Vector2.Zero;
if (targetPos == Vector2.Zero) if (targetPos == Vector2.Zero)
{ {
if (PlayerInput.KeyDown(Keys.A)) moveCam.X -= moveSpeed; if (PlayerInput.KeyDown(Keys.A)) moveCam.X -= moveSpeed;
if (PlayerInput.KeyDown(Keys.D)) moveCam.X += moveSpeed; if (PlayerInput.KeyDown(Keys.D)) moveCam.X += moveSpeed;
if (PlayerInput.KeyDown(Keys.S)) moveCam.Y -= moveSpeed; if (PlayerInput.KeyDown(Keys.S)) moveCam.Y -= moveSpeed;
@@ -169,7 +170,8 @@ namespace Subsurface
moveCam = moveCam * deltaTime * 60.0f; moveCam = moveCam * deltaTime * 60.0f;
Zoom = MathHelper.Clamp(Zoom + PlayerInput.ScrollWheelSpeed / 1000.0f, 0.1f, 2.0f);
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, 0.1f, 2.0f);
} }
else else
{ {
@@ -225,9 +225,19 @@ namespace Subsurface
float footMid = waist.SimPosition.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f; float footMid = waist.SimPosition.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
int limbsInWater = 0;
foreach (Limb limb in Limbs)
{
if (limb.inWater) limbsInWater++;
}
TargetMovement *= (1.0f - 0.5f*((float)limbsInWater/(float)Limbs.Count()));
movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp); movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp);
movement.Y = 0.0f; movement.Y = 0.0f;
//place the anchors of the head and the torso to make the ragdoll stand //place the anchors of the head and the torso to make the ragdoll stand
if (onGround && LowestLimb != null && (LowestLimb.SimPosition.Y-floorY < 0.5f || stairs != null) && head !=null) if (onGround && LowestLimb != null && (LowestLimb.SimPosition.Y-floorY < 0.5f || stairs != null) && head !=null)
{ {
@@ -588,7 +598,7 @@ namespace Subsurface
float handCyclePos = walkPos / 2.0f; float handCyclePos = walkPos / 2.0f;
float handPosX = (float)Math.Cos(handCyclePos * Dir) * 0.4f; float handPosX = (float)Math.Cos(handCyclePos * Dir) * 0.4f;
float handPosY = (float)Math.Sin(handCyclePos * Dir) * 1.0f; float handPosY = (float)Math.Sin(handCyclePos) * 1.0f;
handPosY = MathHelper.Clamp(handPosY, -0.8f, 0.8f); handPosY = MathHelper.Clamp(handPosY, -0.8f, 0.8f);
Matrix rotationMatrix = Matrix.CreateRotationZ(torso.Rotation); Matrix rotationMatrix = Matrix.CreateRotationZ(torso.Rotation);
+2 -5
View File
@@ -519,9 +519,7 @@ namespace Subsurface
public void Update(Camera cam, float deltaTime) public void Update(Camera cam, float deltaTime)
{ {
UpdateNetplayerPosition(); UpdateNetplayerPosition();
Vector2 flowForce = Vector2.Zero; Vector2 flowForce = Vector2.Zero;
FindLowestLimb(); FindLowestLimb();
@@ -543,8 +541,7 @@ namespace Subsurface
if (currentHull.Volume > currentHull.FullVolume * 0.95f || if (currentHull.Volume > currentHull.FullVolume * 0.95f ||
ConvertUnits.ToSimUnits(currentHull.Surface) - floorY > HeadPosition * 0.95f) ConvertUnits.ToSimUnits(currentHull.Surface) - floorY > HeadPosition * 0.95f)
inWater = true; inWater = true;
} }
foreach (Limb limb in Limbs) foreach (Limb limb in Limbs)
+17
View File
@@ -290,6 +290,23 @@ namespace Subsurface
if (commands.Length < 2) break; if (commands.Length < 2) break;
Submarine.Load(string.Join(" ", commands.Skip(1))); Submarine.Load(string.Join(" ", commands.Skip(1)));
break; break;
case "cleansub":
for (int i = MapEntity.mapEntityList.Count-1; i>=0; i--)
{
MapEntity me = MapEntity.mapEntityList[i];
if (me.SimPosition.Length()>200.0f)
{
DebugConsole.NewMessage("Removed "+me.Name+" (simposition "+me.SimPosition+")", Color.Orange);
MapEntity.mapEntityList.RemoveAt(i);
}
else if (me.MoveWithLevel)
{
DebugConsole.NewMessage("Removed " + me.Name + " (MoveWithLevel==true)", Color.Orange);
MapEntity.mapEntityList.RemoveAt(i);
}
}
break;
case "messagebox": case "messagebox":
if (commands.Length < 3) break; if (commands.Length < 3) break;
new GUIMessageBox(commands[1], commands[2]); new GUIMessageBox(commands[1], commands[2]);
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework; using FarseerPhysics;
using Microsoft.Xna.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -9,15 +10,15 @@ namespace Subsurface
{ {
class SalvageQuest : Quest class SalvageQuest : Quest
{ {
ItemPrefab itemPrefab; private ItemPrefab itemPrefab;
Item item; private Item item;
public override Vector2 RadarPosition public override Vector2 RadarPosition
{ {
get get
{ {
return item.Position; return ConvertUnits.ToDisplayUnits(item.SimPosition);
} }
} }
@@ -39,17 +40,18 @@ namespace Subsurface
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)]; Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)];
item = new Item(itemPrefab, position + level.Position); item = new Item(itemPrefab, position + level.Position);
item.MoveWithLevel = true;
//item.MoveWithLevel = true; //item.MoveWithLevel = true;
} }
public override void End() public override void End()
{ {
item.Remove();
if (item.CurrentHull == null) if (item.CurrentHull == null)
{ {
new GUIMessageBox("Quest failed", failureMessage); new GUIMessageBox("Quest failed", failureMessage);
return; return;
} }
item.Remove();
GiveReward(); GiveReward();
+6 -1
View File
@@ -157,6 +157,11 @@ namespace Subsurface
base.Update(deltaTime); base.Update(deltaTime);
scrollBar.Update(deltaTime); scrollBar.Update(deltaTime);
if ((MouseOn==this || MouseOn==scrollBar || IsParentOf(MouseOn) )&& PlayerInput.ScrollWheelSpeed!=0)
{
scrollBar.BarScroll -= (PlayerInput.ScrollWheelSpeed/500.0f) * BarSize;
}
} }
public void Select(int childIndex) public void Select(int childIndex)
@@ -237,7 +242,7 @@ namespace Subsurface
if (!scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height); if (!scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height);
scrollBarHidden = true; scrollBarHidden = true;
} }
public override void Draw(SpriteBatch spriteBatch) public override void Draw(SpriteBatch spriteBatch)
{ {
if (!Visible) return; if (!Visible) return;
@@ -209,7 +209,7 @@ namespace Subsurface.Items.Components
if (inventory.TryPutItem(item)) if (inventory.TryPutItem(item))
{ {
isActive = true; IsActive = true;
if (hideItems || (item.body!=null && !item.body.Enabled)) item.body.Enabled = false; if (hideItems || (item.body!=null && !item.body.Enabled)) item.body.Enabled = false;
item.container = this.item; item.container = this.item;
+6 -3
View File
@@ -148,7 +148,7 @@ namespace Subsurface.Items.Components
UpdateConvexHulls(); UpdateConvexHulls();
isActive = true; IsActive = true;
} }
private void UpdateConvexHulls() private void UpdateConvexHulls()
@@ -240,7 +240,7 @@ namespace Subsurface.Items.Components
{ {
if (!isStuck) if (!isStuck)
{ {
OpenState += deltaTime * ((isOpen) ? 3.0f : -3.0f); OpenState += deltaTime * ((isOpen) ? 2.0f : -1.0f);
LinkedGap.Open = openState; LinkedGap.Open = openState;
} }
@@ -327,10 +327,13 @@ namespace Subsurface.Items.Components
if (connection.Name=="toggle") if (connection.Name=="toggle")
{ {
isOpen = !isOpen; isOpen = !isOpen;
PlaySound(ActionType.OnUse, item.Position);
} }
else if (connection.Name == "set_state") else if (connection.Name == "set_state")
{ {
isOpen = (signal!="0"); bool newState = (signal!="0");
if (isOpen!=newState) PlaySound(ActionType.OnUse, item.Position);
isOpen = newState;
} }
//opening a partially stuck door makes it less stuck //opening a partially stuck door makes it less stuck
@@ -118,7 +118,7 @@ namespace Subsurface.Items.Components
if (picker.Inventory == null) return; if (picker.Inventory == null) return;
item.body.Enabled = true; item.body.Enabled = true;
isActive = false; IsActive = false;
//item.Unequip(); //item.Unequip();
@@ -140,7 +140,7 @@ namespace Subsurface.Items.Components
if (picker.TrySelectItem(item)) if (picker.TrySelectItem(item))
{ {
item.body.Enabled = true; item.body.Enabled = true;
isActive = true; IsActive = true;
} }
} }
@@ -151,7 +151,7 @@ namespace Subsurface.Items.Components
picker.DeselectItem(item); picker.DeselectItem(item);
item.body.Enabled = false; item.body.Enabled = false;
isActive = false; IsActive = false;
} }
public override bool Pick(Character picker) public override bool Pick(Character picker)
@@ -213,7 +213,7 @@ namespace Subsurface.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
if (!item.body.Enabled) return; if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) isActive = false; if (!picker.HasSelectedItem(item)) IsActive = false;
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker); ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
@@ -73,7 +73,7 @@ namespace Subsurface.Items.Components
hitting = true; hitting = true;
isActive = true; IsActive = true;
return true; return true;
} }
@@ -93,7 +93,7 @@ namespace Subsurface.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
if (!item.body.Enabled) return; if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) isActive = false; if (!picker.HasSelectedItem(item)) IsActive = false;
if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f; if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f;
@@ -46,7 +46,7 @@ namespace Subsurface.Items.Components
if (reload < 0.0f) if (reload < 0.0f)
{ {
reload = 0.0f; reload = 0.0f;
isActive = false; IsActive = false;
} }
} }
@@ -54,7 +54,7 @@ namespace Subsurface.Items.Components
{ {
if (character == null) return false; if (character == null) return false;
if (!character.GetInputState(InputType.SecondaryHeld) || reload > 0.0f) return false; if (!character.GetInputState(InputType.SecondaryHeld) || reload > 0.0f) return false;
isActive = true; IsActive = true;
reload = 1.0f; reload = 1.0f;
List<Body> limbBodies = new List<Body>(); List<Body> limbBodies = new List<Body>();
@@ -106,7 +106,7 @@ namespace Subsurface.Items.Components
//if (DoesUseFail(character)) return false; //if (DoesUseFail(character)) return false;
isActive = true; IsActive = true;
Vector2 targetPosition = item.body.SimPosition; Vector2 targetPosition = item.body.SimPosition;
//targetPosition = targetPosition.X, -targetPosition.Y); //targetPosition = targetPosition.X, -targetPosition.Y);
@@ -200,7 +200,7 @@ namespace Subsurface.Items.Components
public override void Draw(SpriteBatch spriteBatch, bool editing) public override void Draw(SpriteBatch spriteBatch, bool editing)
{ {
if (!isActive) return; if (!IsActive) return;
//Vector2 particleSpeed = new Vector2( //Vector2 particleSpeed = new Vector2(
// (float)Math.Cos(item.body.Rotation), // (float)Math.Cos(item.body.Rotation),
@@ -219,7 +219,7 @@ namespace Subsurface.Items.Components
//GUI.DrawLine(spriteBatch, startPos, endPos, Color.Orange, 0.0f); //GUI.DrawLine(spriteBatch, startPos, endPos, Color.Orange, 0.0f);
isActive = false; IsActive = false;
} }
@@ -48,7 +48,7 @@ namespace Subsurface.Items.Components
throwing = true; throwing = true;
isActive = true; IsActive = true;
return true; return true;
} }
@@ -73,7 +73,7 @@ namespace Subsurface.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
if (!item.body.Enabled) return; if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) isActive = false; if (!picker.HasSelectedItem(item)) IsActive = false;
if (!picker.GetInputState(InputType.SecondaryHeld) && !throwing) throwPos = 0.0f; if (!picker.GetInputState(InputType.SecondaryHeld) && !throwing) throwPos = 0.0f;
@@ -25,7 +25,7 @@ namespace Subsurface.Items.Components
public readonly bool Loop; public readonly bool Loop;
public ItemSound(Sound sound, ActionType type, float range, bool loop = true) public ItemSound(Sound sound, ActionType type, float range, bool loop = false)
{ {
this.Sound = sound; this.Sound = sound;
this.Type = type; this.Type = type;
@@ -45,7 +45,7 @@ namespace Subsurface.Items.Components
protected string name; protected string name;
protected bool isActive; private bool isActive;
protected bool characterUsable; protected bool characterUsable;
@@ -255,7 +255,8 @@ namespace Subsurface.Items.Components
Sound sound = Sound.Load(filePath); Sound sound = Sound.Load(filePath);
float range = ToolBox.GetAttributeFloat(subElement, "range", 800.0f); float range = ToolBox.GetAttributeFloat(subElement, "range", 800.0f);
ItemSound itemSound = new ItemSound(sound, type, range); bool loop = ToolBox.GetAttributeBool(subElement, "loop", false);
ItemSound itemSound = new ItemSound(sound, type, range, loop);
itemSound.VolumeProperty = ToolBox.GetAttributeString(subElement, "volume", ""); itemSound.VolumeProperty = ToolBox.GetAttributeString(subElement, "volume", "");
itemSound.VolumeMultiplier = ToolBox.GetAttributeFloat(subElement, "volumemultiplier", 1.0f); itemSound.VolumeMultiplier = ToolBox.GetAttributeFloat(subElement, "volumemultiplier", 1.0f);
sounds.Add(itemSound); sounds.Add(itemSound);
@@ -299,7 +300,9 @@ namespace Subsurface.Items.Components
} }
else else
{ {
itemSound.Sound.Play(GetSoundVolume(itemSound), itemSound.Range, position); float volume = GetSoundVolume(itemSound);
if (volume == 0.0f) return;
itemSound.Sound.Play(volume, itemSound.Range, position);
} }
} }
} }
@@ -322,14 +325,21 @@ namespace Subsurface.Items.Components
private float GetSoundVolume(ItemSound sound) private float GetSoundVolume(ItemSound sound)
{ {
if (sound == null) return 0.0f;
if (sound.VolumeProperty == "") return 1.0f; if (sound.VolumeProperty == "") return 1.0f;
ObjectProperty op = null; ObjectProperty op = null;
if (properties.TryGetValue(sound.VolumeProperty.ToLower(), out op)) if (properties.TryGetValue(sound.VolumeProperty.ToLower(), out op))
{ {
float newVolume = 0.0f; float newVolume = 0.0f;
float.TryParse(op.GetValue().ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out newVolume); try
{
newVolume = (float)op.GetValue();
}
catch
{
return 0.0f;
}
newVolume *= sound.VolumeMultiplier; newVolume *= sound.VolumeMultiplier;
return MathHelper.Clamp(newVolume, 0.0f, 1.0f); return MathHelper.Clamp(newVolume, 0.0f, 1.0f);
@@ -59,7 +59,7 @@ namespace Subsurface.Items.Components
limbPositions.Add(lp); limbPositions.Add(lp);
} }
isActive = true; IsActive = true;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -76,7 +76,7 @@ namespace Subsurface.Items.Components
character.AnimController.Anim = AnimController.Animation.None; character.AnimController.Anim = AnimController.Animation.None;
character = null; character = null;
} }
isActive = false; IsActive = false;
return; return;
} }
@@ -131,9 +131,9 @@ namespace Subsurface.Items.Components
public override bool Use(float deltaTime, Character activator = null) public override bool Use(float deltaTime, Character activator = null)
{ {
if (activator.SelectedConstruction != item) if (character==null || activator!=character || character.SelectedConstruction != item)
{ {
activator = null; character = null;
return false; return false;
} }
@@ -146,8 +146,7 @@ namespace Subsurface.Items.Components
public override void SecondaryUse(float deltaTime, Character character = null) public override void SecondaryUse(float deltaTime, Character character = null)
{ {
if (character == null) return; if (this.character == null || this.character!=character || this.character.SelectedConstruction!=item)
if (character.SelectedConstruction!=item)
{ {
character = null; character = null;
return; return;
@@ -186,6 +185,9 @@ namespace Subsurface.Items.Components
public override bool Pick(Character picker) public override bool Pick(Character picker)
{ {
item.SendSignal("1", "signal_out"); item.SendSignal("1", "signal_out");
PlaySound(ActionType.OnUse, item.Position);
return true; return true;
} }
@@ -194,7 +196,7 @@ namespace Subsurface.Items.Components
if (character!=null && character.SelectedConstruction == item) if (character!=null && character.SelectedConstruction == item)
{ {
character = null; character = null;
isActive = false; IsActive = false;
if (activator != null) activator.AnimController.Anim = AnimController.Animation.None; if (activator != null) activator.AnimController.Anim = AnimController.Animation.None;
return false; return false;
@@ -204,7 +206,7 @@ namespace Subsurface.Items.Components
character = activator; character = activator;
if (activator == null) return false; if (activator == null) return false;
isActive = true; IsActive = true;
} }
item.SendSignal("1", "signal_out"); item.SendSignal("1", "signal_out");
@@ -49,7 +49,7 @@ namespace Subsurface.Items.Components
public Engine(Item item, XElement element) public Engine(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
} }
public float CurrentVolume public float CurrentVolume
@@ -157,7 +157,7 @@ namespace Subsurface.Items.Components
itemList.Enabled = false; itemList.Enabled = false;
fabricatedItem = obj as FabricableItem; fabricatedItem = obj as FabricableItem;
isActive = true; IsActive = true;
timeUntilReady = fabricatedItem.RequiredTime; timeUntilReady = fabricatedItem.RequiredTime;
@@ -179,7 +179,7 @@ namespace Subsurface.Items.Components
new Item(fabricatedItem.TargetItem, item.Position); new Item(fabricatedItem.TargetItem, item.Position);
isActive = false; IsActive = false;
fabricatedItem = null; fabricatedItem = null;
} }
@@ -11,7 +11,7 @@ namespace Subsurface.Items.Components
public MiniMap(Item item, XElement element) public MiniMap(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -19,10 +19,16 @@ namespace Subsurface.Items.Components
return (running && item.Condition>0.0f); return (running && item.Condition>0.0f);
} }
public float CurrFlow
{
get;
private set;
}
public OxygenGenerator(Item item, XElement element) public OxygenGenerator(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
ventList = new List<Vent>(); ventList = new List<Vent>();
@@ -34,6 +40,7 @@ namespace Subsurface.Items.Components
{ {
base.Update(deltaTime, cam); base.Update(deltaTime, cam);
CurrFlow = 0.0f;
currPowerConsumption = powerConsumption; currPowerConsumption = powerConsumption;
if (item.CurrentHull == null) return; if (item.CurrentHull == null) return;
@@ -54,11 +61,11 @@ namespace Subsurface.Items.Components
} }
running = true; running = true;
float deltaOxygen = Math.Min(voltage, 1.0f) * 50000.0f;
item.CurrentHull.Oxygen += deltaOxygen * deltaTime;
UpdateVents(deltaOxygen); CurrFlow = Math.Min(voltage, 1.0f) * 50000.0f;
item.CurrentHull.Oxygen += CurrFlow * deltaTime;
UpdateVents(CurrFlow);
voltage = 0.0f; voltage = 0.0f;
@@ -35,6 +35,16 @@ namespace Subsurface.Items.Components
set { maxFlow = value; } set { maxFlow = value; }
} }
float currFlow;
public float CurrFlow
{
get
{
if (!IsActive) return 0.0f;
return Math.Abs(currFlow);
}
}
public Pump(Item item, XElement element) public Pump(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
@@ -55,6 +65,8 @@ namespace Subsurface.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
currFlow = 0.0f;
if (targetLevel != null) if (targetLevel != null)
{ {
float hullPercentage = 0.0f; float hullPercentage = 0.0f;
@@ -71,14 +83,14 @@ namespace Subsurface.Items.Components
float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage; float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage;
//flowPercentage = maxFlow * powerFactor; //flowPercentage = maxFlow * powerFactor;
float deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor; currFlow = (flowPercentage / 100.0f) * maxFlow * powerFactor;
hull1.Volume += deltaVolume; hull1.Volume += currFlow;
if (hull1.Volume > hull1.FullVolume) hull1.Pressure += 0.5f; if (hull1.Volume > hull1.FullVolume) hull1.Pressure += 0.5f;
if (hull2 != null) if (hull2 != null)
{ {
hull2.Volume -= deltaVolume; hull2.Volume -= currFlow;
if (hull2.Volume > hull1.FullVolume) hull2.Pressure += 0.5f; if (hull2.Volume > hull1.FullVolume) hull2.Pressure += 0.5f;
} }
@@ -90,28 +102,6 @@ namespace Subsurface.Items.Components
hull1 = Hull.FindHull(item.Position, item.CurrentHull); hull1 = Hull.FindHull(item.Position, item.CurrentHull);
} }
//private void GetHulls()
//{
// hull1 = null;
// hull2 = null;
// foreach (MapEntity e in item.linkedTo)
// {
// Hull hull = e as Hull;
// if (hull == null) continue;
// if (hull1 == null)
// {
// hull1 = hull;
// }
// else if (hull2 == null && hull != hull1)
// {
// hull2 = hull;
// break;
// }
// }
//}
public override void DrawHUD(SpriteBatch spriteBatch, Character character) public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{ {
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height; int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
@@ -120,11 +110,11 @@ namespace Subsurface.Items.Components
GuiFrame.Draw(spriteBatch); GuiFrame.Draw(spriteBatch);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 100, 40), ((isActive) ? "TURN OFF" : "TURN ON"))) if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 100, 40), ((IsActive) ? "TURN OFF" : "TURN ON")))
{ {
targetLevel = null; targetLevel = null;
isActive = !isActive; IsActive = !IsActive;
if (!isActive) currPowerConsumption = 0.0f; if (!IsActive) currPowerConsumption = 0.0f;
item.NewComponentEvent(this, true); item.NewComponentEvent(this, true);
} }
@@ -148,11 +138,11 @@ namespace Subsurface.Items.Components
if (connection.Name == "toggle") if (connection.Name == "toggle")
{ {
isActive = !isActive; IsActive = !IsActive;
} }
else if (connection.Name == "set_active") else if (connection.Name == "set_active")
{ {
isActive = (signal != "0"); IsActive = (signal != "0");
} }
else if (connection.Name == "set_speed") else if (connection.Name == "set_speed")
{ {
@@ -171,13 +161,13 @@ namespace Subsurface.Items.Components
} }
} }
if (!isActive) currPowerConsumption = 0.0f; if (!IsActive) currPowerConsumption = 0.0f;
} }
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message) public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
{ {
message.Write(Convert.ToByte(flowPercentage+100)); message.Write(Convert.ToByte(flowPercentage+100));
message.Write(isActive); message.Write(IsActive);
} }
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message) public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
@@ -200,7 +190,7 @@ namespace Subsurface.Items.Components
} }
FlowPercentage = newFlow; FlowPercentage = newFlow;
isActive = newActive; IsActive = newActive;
} }
} }
} }
@@ -77,7 +77,7 @@ namespace Subsurface.Items.Components
if (voltage < minVoltage) return; if (voltage < minVoltage) return;
if (GUI.DrawButton(spriteBatch, new Rectangle(x+20, y+20, 200, 30), "Activate Radar")) isActive = !isActive; if (GUI.DrawButton(spriteBatch, new Rectangle(x+20, y+20, 200, 30), "Activate Radar")) IsActive = !IsActive;
int radius = GuiFrame.Rect.Height / 2 - 10; int radius = GuiFrame.Rect.Height / 2 - 10;
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));
@@ -92,7 +92,7 @@ namespace Subsurface.Items.Components
//lineEnd += new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * Math.Min(width, height) / 2.0f; //lineEnd += new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * Math.Min(width, height) / 2.0f;
//GUI.DrawLine(spriteBatch, GuiFrame.Center, lineEnd, Color.Green); //GUI.DrawLine(spriteBatch, GuiFrame.Center, lineEnd, Color.Green);
if (!isActive) return; if (!IsActive) return;
if (pingCircle!=null) if (pingCircle!=null)
{ {
@@ -132,7 +132,7 @@ namespace Subsurface.Items.Components
powerPerTemp = 1.0f; powerPerTemp = 1.0f;
isActive = true; IsActive = true;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -288,7 +288,7 @@ namespace Subsurface.Items.Components
bool valueChanged = false; bool valueChanged = false;
public override void DrawHUD(SpriteBatch spriteBatch, Character character) public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{ {
isActive = true; IsActive = true;
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height; int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
@@ -62,7 +62,7 @@ namespace Subsurface.Items.Components
public Steering(Item item, XElement element) public Steering(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -72,7 +72,7 @@ namespace Subsurface.Items.Components
//maxRechargeSpeed = ToolBox.GetAttributeFloat(element, "maxinput", 10.0f); //maxRechargeSpeed = ToolBox.GetAttributeFloat(element, "maxinput", 10.0f);
//maxOutput = ToolBox.GetAttributeFloat(element, "maxoutput", 10.0f); //maxOutput = ToolBox.GetAttributeFloat(element, "maxoutput", 10.0f);
isActive = true; IsActive = true;
} }
public override bool Pick(Character picker) public override bool Pick(Character picker)
@@ -27,7 +27,7 @@ namespace Subsurface.Items.Components
public PowerTransfer(Item item, XElement element) public PowerTransfer(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -45,11 +45,11 @@ namespace Subsurface.Items.Components
[HasDefaultValue(false,true)] [HasDefaultValue(false,true)]
public override bool IsActive public override bool IsActive
{ {
get { return isActive; } get { return base.IsActive; }
set set
{ {
isActive = value; base.IsActive = value;
if (!isActive) currPowerConsumption = 0.0f; if (!value) currPowerConsumption = 0.0f;
} }
} }
@@ -101,7 +101,6 @@ namespace Subsurface.Items.Components
powerOnSound.Play(1.0f, 600.0f, item.Position); powerOnSound.Play(1.0f, 600.0f, item.Position);
powerOnSoundPlayed = true; powerOnSoundPlayed = true;
} }
ApplyStatusEffects(ActionType.OnActive, deltaTime);
} }
else if (voltage < 0.1f) else if (voltage < 0.1f)
{ {
@@ -123,12 +123,12 @@ namespace Subsurface.Items.Components
GameMain.World.RemoveJoint(stickJoint); GameMain.World.RemoveJoint(stickJoint);
stickJoint = null; stickJoint = null;
isActive = false; IsActive = false;
} }
} }
else else
{ {
isActive = false; IsActive = false;
} }
} }
@@ -209,7 +209,7 @@ namespace Subsurface.Items.Components
stickTarget = targetBody; stickTarget = targetBody;
GameMain.World.AddJoint(stickJoint); GameMain.World.AddJoint(stickJoint);
isActive = true; IsActive = true;
return false; return false;
} }
+4 -4
View File
@@ -179,7 +179,7 @@ namespace Subsurface.Items.Components
{ {
item.Combine(projectile); item.Combine(projectile);
ropeBodies[ropeBodies.Length - 1].Enabled = false; ropeBodies[ropeBodies.Length - 1].Enabled = false;
isActive = false; IsActive = false;
} }
} }
@@ -235,7 +235,7 @@ namespace Subsurface.Items.Components
{ {
if (joint != null) joint.Enabled = false; if (joint != null) joint.Enabled = false;
} }
isActive = false; IsActive = false;
} }
} }
@@ -243,7 +243,7 @@ namespace Subsurface.Items.Components
{ {
base.Draw(spriteBatch); base.Draw(spriteBatch);
if (!isActive) return; if (!IsActive) return;
RevoluteJoint firstJoint = null; RevoluteJoint firstJoint = null;
@@ -279,7 +279,7 @@ namespace Subsurface.Items.Components
public void Attach(Item projectile) public void Attach(Item projectile)
{ {
reload = 0.5f; reload = 0.5f;
isActive = true; IsActive = true;
this.projectile = projectile; this.projectile = projectile;
//Projectile projectileComponent = projectile.GetComponent<Projectile>(); //Projectile projectileComponent = projectile.GetComponent<Projectile>();
@@ -60,12 +60,12 @@ namespace Subsurface.Items.Components
case "signal_in1": case "signal_in1":
if (signal == "0") return; if (signal == "0") return;
timeSinceReceived[0] = 0.0f; timeSinceReceived[0] = 0.0f;
isActive = true; IsActive = true;
break; break;
case "signal_in2": case "signal_in2":
if (signal == "0") return; if (signal == "0") return;
timeSinceReceived[1] = 0.0f; timeSinceReceived[1] = 0.0f;
isActive = true; IsActive = true;
break; break;
case "set_output": case "set_output":
output = signal; output = signal;
@@ -30,7 +30,7 @@ namespace Subsurface.Items.Components
} }
} }
isActive = true; IsActive = true;
} }
public override void DrawHUD(SpriteBatch spriteBatch, Character character) public override void DrawHUD(SpriteBatch spriteBatch, Character character)
@@ -67,7 +67,7 @@ namespace Subsurface.Items.Components
public override bool Select(Character picker) public override bool Select(Character picker)
{ {
user = picker; user = picker;
isActive = true; IsActive = true;
return true; return true;
} }
@@ -75,7 +75,7 @@ namespace Subsurface.Items.Components
light = new LightSource(item.Position, 100.0f, Color.White); light = new LightSource(item.Position, 100.0f, Color.White);
isActive = true; IsActive = true;
//lightColor = new Color(ToolBox.GetAttributeVector4(element, "color", Vector4.One)); //lightColor = new Color(ToolBox.GetAttributeVector4(element, "color", Vector4.One));
} }
@@ -124,7 +124,7 @@ namespace Subsurface.Items.Components
public override void Draw(SpriteBatch spriteBatch, bool editing) public override void Draw(SpriteBatch spriteBatch, bool editing)
{ {
if (!isActive) if (!IsActive)
{ {
light.Color = Color.Transparent; light.Color = Color.Transparent;
} }
@@ -144,10 +144,10 @@ namespace Subsurface.Items.Components
switch (connection.Name) switch (connection.Name)
{ {
case "toggle": case "toggle":
isActive = !isActive; IsActive = !IsActive;
break; break;
case "set_state": case "set_state":
isActive = (signal != "0"); IsActive = (signal != "0");
break; break;
} }
} }
@@ -11,7 +11,7 @@ namespace Subsurface.Items.Components
{ {
hull = Hull.FindHull(item.Position); hull = Hull.FindHull(item.Position);
isActive = true; IsActive = true;
} }
public override void OnMapLoaded() public override void OnMapLoaded()
@@ -48,7 +48,7 @@ namespace Subsurface.Items.Components
public RegExFindComponent(Item item, XElement element) public RegExFindComponent(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -115,7 +115,7 @@ namespace Subsurface.Items.Components
item.body.Enabled = false; item.body.Enabled = false;
isActive = false; IsActive = false;
//Nodes = prevNodes; //Nodes = prevNodes;
CleanNodes(); CleanNodes();
@@ -128,21 +128,21 @@ namespace Subsurface.Items.Components
{ {
ClearConnections(); ClearConnections();
isActive = true; IsActive = true;
} }
public override void Unequip(Character character) public override void Unequip(Character character)
{ {
ClearConnections(); ClearConnections();
isActive = false; IsActive = false;
} }
public override void Drop(Character dropper) public override void Drop(Character dropper)
{ {
ClearConnections(); ClearConnections();
isActive = false; IsActive = false;
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -289,7 +289,7 @@ namespace Subsurface.Items.Components
DrawSection(spriteBatch, Nodes[i], Nodes[i - 1], item.Color); DrawSection(spriteBatch, Nodes[i], Nodes[i - 1], item.Color);
} }
if (isActive && Vector2.Distance(newNodePos, Nodes[Nodes.Count - 1]) > nodeDistance) if (IsActive && Vector2.Distance(newNodePos, Nodes[Nodes.Count - 1]) > nodeDistance)
{ {
DrawSection(spriteBatch, Nodes[Nodes.Count - 1], newNodePos, item.Color * 0.5f); DrawSection(spriteBatch, Nodes[Nodes.Count - 1], newNodePos, item.Color * 0.5f);
//nodes.Add(newNodePos); //nodes.Add(newNodePos);
+6 -3
View File
@@ -73,7 +73,7 @@ namespace Subsurface.Items.Components
public Turret(Item item, XElement element) public Turret(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
isActive = true; IsActive = true;
barrelSprite = new Sprite(Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" +element.Attribute("barrelsprite").Value, barrelSprite = new Sprite(Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" +element.Attribute("barrelsprite").Value,
ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero)); ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero));
@@ -81,7 +81,10 @@ namespace Subsurface.Items.Components
public override void Draw(SpriteBatch spriteBatch, bool editing) public override void Draw(SpriteBatch spriteBatch, bool editing)
{ {
barrelSprite.Draw(spriteBatch, new Vector2(item.Rect.X, -item.Rect.Y) + barrelPos, rotation + MathHelper.PiOver2, 1.0f); barrelSprite.Draw(spriteBatch,
new Vector2(item.Rect.X, -item.Rect.Y) + barrelPos, Color.White,
rotation + MathHelper.PiOver2, 1.0f,
SpriteEffects.None, item.Sprite.Depth+0.01f);
} }
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
@@ -198,7 +201,7 @@ namespace Subsurface.Items.Components
targetRotation = MathUtils.WrapAngleTwoPi(MathUtils.VectorToAngle(offset)); targetRotation = MathUtils.WrapAngleTwoPi(MathUtils.VectorToAngle(offset));
isActive = true; IsActive = true;
break; break;
case "trigger_in": case "trigger_in":
@@ -114,7 +114,7 @@ namespace Subsurface.Items.Components
item.body.Enabled = false; item.body.Enabled = false;
isActive = true; IsActive = true;
limb[i] = equipLimb; limb[i] = equipLimb;
equipLimb.WearingItem = this; equipLimb.WearingItem = this;
@@ -129,7 +129,7 @@ namespace Subsurface.Items.Components
base.Drop(dropper); base.Drop(dropper);
picker = null; picker = null;
isActive = false; IsActive = false;
} }
public override void Unequip(Character character) public override void Unequip(Character character)
@@ -147,7 +147,7 @@ namespace Subsurface.Items.Components
equipLimb.WearingItemSprite = null; equipLimb.WearingItemSprite = null;
} }
isActive = false; IsActive = false;
} }
public override void UpdateBroken(float deltaTime, Camera cam) public override void UpdateBroken(float deltaTime, Camera cam)
+8
View File
@@ -78,6 +78,14 @@ namespace Subsurface
get { return prefab.PickDistance; } get { return prefab.PickDistance; }
} }
public override Vector2 SimPosition
{
get
{
return (body==null) ? base.SimPosition : body.SimPosition;
}
}
protected Color spriteColor; protected Color spriteColor;
[Editable, HasDefaultValue("1.0,1.0,1.0,1.0", true)] [Editable, HasDefaultValue("1.0,1.0,1.0,1.0", true)]
public string SpriteColor public string SpriteColor
+1 -1
View File
@@ -24,7 +24,7 @@ namespace Subsurface
private static Texture2D shaftTexture; private static Texture2D shaftTexture;
//how close the sub has to be to start/endposition to exit //how close the sub has to be to start/endposition to exit
const float ExitDistance = 3000.0f; const float ExitDistance = 6000.0f;
private string seed; private string seed;
+1 -1
View File
@@ -90,7 +90,7 @@ namespace Subsurface
rect.X + rect.Width / 2.0f, rect.X + rect.Width / 2.0f,
rect.Y - rect.Height / 2.0f); rect.Y - rect.Height / 2.0f);
if (MoveWithLevel) rectPos += Level.Loaded.Position; //if (MoveWithLevel) rectPos += Level.Loaded.Position;
return rectPos; return rectPos;
} }
} }
+5 -1
View File
@@ -249,7 +249,10 @@ namespace Subsurface
Body closestBody = null; Body closestBody = null;
GameMain.World.RayCast((fixture, point, normal, fraction) => GameMain.World.RayCast((fixture, point, normal, fraction) =>
{ {
if (fixture == null || fixture.CollisionCategories == Category.None) return -1; if (fixture == null ||
fixture.CollisionCategories == Category.None ||
fixture.CollisionCategories == Physics.CollisionMisc) return -1;
if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1; if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1;
Structure structure = fixture.Body.UserData as Structure; Structure structure = fixture.Body.UserData as Structure;
@@ -430,6 +433,7 @@ namespace Subsurface
foreach (MapEntity e in MapEntity.mapEntityList) foreach (MapEntity e in MapEntity.mapEntityList)
{ {
if (e.MoveWithLevel) continue;
e.Save(doc); e.Save(doc);
} }
+41 -33
View File
@@ -97,12 +97,14 @@ namespace Subsurface
body.CollisionCategories = Physics.CollisionMisc; body.CollisionCategories = Physics.CollisionMisc;
body.CollidesWith = Physics.CollisionLevel; body.CollidesWith = Physics.CollisionLevel;
body.Restitution = 0.0f;
body.FixedRotation = true; body.FixedRotation = true;
body.Awake = true; body.Awake = true;
body.SleepingAllowed = false; body.SleepingAllowed = false;
body.GravityScale = 0.0f; body.IgnoreGravity = true;
body.OnCollision += OnCollision; body.OnCollision += OnCollision;
body.OnSeparation += OnSeparation; //body.OnSeparation += OnSeparation;
body.UserData = this;
} }
@@ -194,28 +196,9 @@ namespace Subsurface
//hullBodies[0].body.LinearVelocity = -hullBodies[0].body.Position; //hullBodies[0].body.LinearVelocity = -hullBodies[0].body.Position;
//hullBody.SetTransform(Vector2.Zero , 0.0f); //hullBody.SetTransform(Vector2.Zero , 0.0f);
body.LinearVelocity = -body.Position / (float)Physics.step; body.SetTransform(Vector2.Zero, 0.0f);// .LinearVelocity = -body.Position / (float)Physics.step;
body.LinearVelocity = Vector2.Zero;
if (collidingCell == null)
{
collisionRigidness = MathHelper.Lerp(collisionRigidness, 1.0f, 0.1f);
return;
}
foreach (GraphEdge ge in collidingCell.edges)
{
Body wallBody = Submarine.PickBody(
ConvertUnits.ToSimUnits(ge.point1 + GameMain.GameSession.Level.Position),
ConvertUnits.ToSimUnits(ge.point2 + GameMain.GameSession.Level.Position), new List<Body>() { collidingCell.body });
if (wallBody == null || wallBody.UserData == null) continue;
Structure structure = wallBody.UserData as Structure;
if (structure == null) continue;
structure.AddDamage(
structure.FindSectionIndex(ConvertUnits.ToDisplayUnits(Submarine.LastPickedPosition)), 50.0f);
}
collidingCell = null;
} }
private Vector2 CalculateBuoyancy() private Vector2 CalculateBuoyancy()
@@ -244,7 +227,6 @@ namespace Subsurface
speed += force / mass; speed += force / mass;
} }
VoronoiCell collidingCell;
public bool OnCollision(Fixture f1, Fixture f2, Contact contact) public bool OnCollision(Fixture f1, Fixture f2, Contact contact)
{ {
VoronoiCell cell = f2.Body.UserData as VoronoiCell; VoronoiCell cell = f2.Body.UserData as VoronoiCell;
@@ -255,7 +237,7 @@ namespace Subsurface
} }
Vector2 normal = contact.Manifold.LocalNormal; Vector2 normal = contact.Manifold.LocalNormal;
Vector2 simSpeed = ConvertUnits.ToSimUnits(speed); Vector2 simSpeed = ConvertUnits.ToSimUnits(speed) + body.LinearVelocity;
float impact = Vector2.Dot(simSpeed, normal); float impact = Vector2.Dot(simSpeed, normal);
Vector2 u = Vector2.Dot(simSpeed, -normal) * -normal; Vector2 u = Vector2.Dot(simSpeed, -normal) * -normal;
@@ -292,27 +274,53 @@ namespace Subsurface
} }
System.Diagnostics.Debug.WriteLine("IMPACT: " + impact + " normal: " + normal + " simspeed: " + simSpeed + " u: " + u + " w: " + w); System.Diagnostics.Debug.WriteLine("IMPACT: " + impact + " normal: " + normal + " simspeed: " + simSpeed + " u: " + u + " w: " + w);
if (impact < 4.0f) if (impact < 3.0f)
{ {
speed = ConvertUnits.ToDisplayUnits(w * 0.9f - u * 0.2f); speed = ConvertUnits.ToDisplayUnits(w * 0.45f - u * 0.25f);
return true; return true;
} }
else else
{ {
speed = ConvertUnits.ToDisplayUnits(w * 0.9f + u * 0.5f); speed = ConvertUnits.ToDisplayUnits(w * 0.9f + u * 0.5f);
//FixedArray2<Vector2> worldPoints;
//contact.GetWorldManifold(out normal, out worldPoints);
//if (contact.Manifold.PointCount >= 1)
//{
// Vector2 contactPoint = worldPoints[0];
// Body wallBody = Submarine.PickBody(contactPoint, contactPoint + normal, new List<Body>() { cell.body });
// if (wallBody!=null && wallBody.UserData!=null)
// {
// Structure s = wallBody.UserData as Structure;
// }
//}
foreach (GraphEdge ge in cell.edges)
{
Body wallBody = Submarine.PickBody(
ConvertUnits.ToSimUnits(ge.point1 + GameMain.GameSession.Level.Position + normal),
ConvertUnits.ToSimUnits(ge.point2 + GameMain.GameSession.Level.Position + normal), new List<Body>() { cell.body });
if (wallBody == null || wallBody.UserData == null) continue;
Structure structure = wallBody.UserData as Structure;
if (structure == null) continue;
structure.AddDamage(
structure.FindSectionIndex(ConvertUnits.ToDisplayUnits(Submarine.LastPickedPosition)), impact*50.0f);
}
} }
collisionRigidness = 0.8f; collisionRigidness = 0.8f;
collidingCell = cell;
return true; return true;
} }
public void OnSeparation(Fixture f1, Fixture f2) //public void OnSeparation(Fixture f1, Fixture f2)
{ //{
collidingCell = null; // collidingCell = null;
} //}
} }
} }
@@ -54,7 +54,9 @@ namespace Subsurface.Particles
public Particle CreateParticle(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation=0.0f) public Particle CreateParticle(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation=0.0f)
{ {
if (!Submarine.RectContains(cam.WorldView, position)) return null; //if (!Submarine.RectContains(cam.WorldView, position)) return null;
if (!cam.WorldView.Contains(position)) return null;
if (particleCount >= MaxParticles) return null; if (particleCount >= MaxParticles) return null;
if (particles[particleCount] == null) particles[particleCount] = new Particle(); if (particles[particleCount] == null) particles[particleCount] = new Particle();
+11 -12
View File
@@ -206,8 +206,11 @@ namespace Subsurface
public override void Update(double deltaTime) public override void Update(double deltaTime)
{ {
if (GUIComponent.MouseOn == null) cam.MoveCamera((float)deltaTime); if (GUIComponent.MouseOn == null)
cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed / 1000.0f, 0.1f, 2.0f); {
cam.MoveCamera((float)deltaTime);
//cam.Zoom = MathHelper.Clamp(cam.Zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f)*cam.Zoom, 0.1f, 2.0f);
}
if (characterMode) if (characterMode)
{ {
@@ -278,12 +281,8 @@ namespace Subsurface
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch); if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
GUI.Draw((float)deltaTime, spriteBatch, cam);
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50)); //EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
if (characterMode) if (characterMode)
{ {
if (dummyCharacter != null) if (dummyCharacter != null)
@@ -312,17 +311,17 @@ namespace Subsurface
} }
if (PlayerInput.GetMouseState.LeftButton != ButtonState.Pressed) //if (PlayerInput.GetMouseState.LeftButton != ButtonState.Pressed)
{ //{
Inventory.draggingItem = null; // Inventory.draggingItem = null;
} //}
} }
else else
{ {
MapEntity.Edit(spriteBatch, cam); MapEntity.Edit(spriteBatch, cam);
} }
GUI.Draw((float)deltaTime, spriteBatch, cam);
spriteBatch.End(); spriteBatch.End();
+7 -7
View File
@@ -300,16 +300,16 @@ namespace Subsurface
saveFileFrame.UserData = "savefileframe"; saveFileFrame.UserData = "savefileframe";
saveFileFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); saveFileFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
new GUITextBlock(new Rectangle(0,0,0,20), fileName, GUI.Style, saveFileFrame); new GUITextBlock(new Rectangle(0,0,0,20), fileName, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
new GUITextBlock(new Rectangle(0, 30, 0, 20), subName, GUI.Style, saveFileFrame); new GUITextBlock(new Rectangle(0, 35, 0, 20), "Submarine: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 70, 0, 20), "Last saved: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 50, 0, 20), "Last saved: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont; new GUITextBlock(new Rectangle(0, 105, 0, 20), "Map seed: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 65, 0, 20), saveTime, GUI.Style, saveFileFrame).Font = GUI.SmallFont; new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(0, 85, 0, 20), "Map seed: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
new GUITextBlock(new Rectangle(15, 100, 0, 20), mapseed, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, GUI.Style, saveFileFrame); var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, GUI.Style, saveFileFrame);
deleteSaveButton.UserData = fileName; deleteSaveButton.UserData = fileName;
@@ -161,14 +161,14 @@ namespace Subsurface
startDrone = null; startDrone = null;
} }
float ambienceVolume = 0.6f; float ambienceVolume = 0.8f;
float lowpassHFGain = 1.0f; float lowpassHFGain = 1.0f;
if (Character.Controlled != null) if (Character.Controlled != null)
{ {
AnimController animController = Character.Controlled.AnimController; AnimController animController = Character.Controlled.AnimController;
if (animController.HeadInWater) if (animController.HeadInWater)
{ {
ambienceVolume = 0.8f; ambienceVolume = 1.0f;
ambienceVolume += animController.Limbs[0].LinearVelocity.Length(); ambienceVolume += animController.Limbs[0].LinearVelocity.Length();
lowpassHFGain = 0.2f; lowpassHFGain = 0.2f;
@@ -262,7 +262,7 @@ namespace Subsurface
public static void PlayDamageSound(DamageSoundType damageType, float damage, Vector2 position) public static void PlayDamageSound(DamageSoundType damageType, float damage, Vector2 position)
{ {
damage = MathHelper.Clamp(damage, 0.0f, 100.0f); damage = MathHelper.Clamp(damage+Rand.Range(-10.0f, 10.0f), 0.0f, 100.0f);
var sounds = damageSounds.Where(x => damage >= x.damageRange.X && damage <= x.damageRange.Y && x.damageType == damageType).ToList(); var sounds = damageSounds.Where(x => damage >= x.damageRange.X && damage <= x.damageRange.Y && x.damageType == damageType).ToList();
if (!sounds.Any()) return; if (!sounds.Any()) return;
+2 -2
View File
@@ -183,9 +183,9 @@ namespace Subsurface
} }
return sourceIndex; return sourceIndex;
} }
return SoundManager.Loop(this, sourceIndex, position, volume, volume); return SoundManager.Loop(this, sourceIndex, relativePos, volume);
} }
+32 -22
View File
@@ -16,13 +16,13 @@ namespace Subsurface.Sounds
private static int[] alBuffers = new int[DefaultSourceCount]; private static int[] alBuffers = new int[DefaultSourceCount];
private static int lowpassFilterId; private static int lowpassFilterId;
private static float overrideLowPassGain; //private static float overrideLowPassGain;
public static float OverrideLowPassGain //public static float OverrideLowPassGain
{ //{
get { return overrideLowPassGain; } // get { return overrideLowPassGain; }
set { overrideLowPassGain = MathHelper.Clamp(overrideLowPassGain, 0.0f, 1.0f); } // set { overrideLowPassGain = MathHelper.Clamp(overrideLowPassGain, 0.0f, 1.0f); }
} //}
static AudioContext AC; static AudioContext AC;
@@ -139,17 +139,20 @@ namespace Subsurface.Sounds
alBuffers[i] = sound.AlBufferId; alBuffers[i] = sound.AlBufferId;
OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSourceb.Looping, false); OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSourceb.Looping, false);
position /= 1000.0f;
//System.Diagnostics.Debug.WriteLine("updatesoundpos: "+offset);
OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSourcef.Gain, volume);
OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSource3f.Position, position.X, position.Y, 0.0f);
OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSourcei.Buffer, sound.AlBufferId); OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSourcei.Buffer, sound.AlBufferId);
ALHelper.Efx.Filter(lowpassFilterId, OpenTK.Audio.OpenAL.EfxFilterf.LowpassGainHF, lowPassHfGain = Math.Min(lowPassGain, overrideLowPassGain));
ALHelper.Efx.BindFilterToSource(alSources[i], lowpassFilterId); UpdateSoundPosition(i, position, volume);
ALHelper.Check();
//position /= 1000.0f;
////System.Diagnostics.Debug.WriteLine("updatesoundpos: "+offset);
//OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSourcef.Gain, volume);
//OpenTK.Audio.OpenAL.AL.Source(alSources[i], OpenTK.Audio.OpenAL.ALSource3f.Position, position.X, position.Y, 0.0f);
//ALHelper.Efx.Filter(lowpassFilterId, OpenTK.Audio.OpenAL.EfxFilterf.LowpassGainHF, lowPassHfGain);
//ALHelper.Efx.BindFilterToSource(alSources[i], lowpassFilterId);
//ALHelper.Check();
//AL.Source(alSources[i], ALSource3f.Position, position.X, position.Y, 0.0f); //AL.Source(alSources[i], ALSource3f.Position, position.X, position.Y, 0.0f);
OpenTK.Audio.OpenAL.AL.SourcePlay(alSources[i]); OpenTK.Audio.OpenAL.AL.SourcePlay(alSources[i]);
@@ -164,13 +167,13 @@ namespace Subsurface.Sounds
public static int Loop(Sound sound, int sourceIndex, float volume = 1.0f) public static int Loop(Sound sound, int sourceIndex, float volume = 1.0f)
{ {
return Loop(sound,sourceIndex, Vector2.Zero, volume, 0.0f); return Loop(sound,sourceIndex, Vector2.Zero, volume);
} }
public static int Loop(Sound sound, int sourceIndex, Vector2 position, float volume = 1.0f, float lowPassGain = 0.0f) public static int Loop(Sound sound, int sourceIndex, Vector2 position, float volume = 1.0f)
{ {
if (sourceIndex<1) if (sourceIndex<1)
{ {
sourceIndex = Play(sound, position, volume, lowPassGain); sourceIndex = Play(sound, position, volume);
if (sourceIndex>0) if (sourceIndex>0)
{ {
AL.Source(alSources[sourceIndex], ALSourceb.Looping, true); AL.Source(alSources[sourceIndex], ALSourceb.Looping, true);
@@ -181,8 +184,13 @@ namespace Subsurface.Sounds
} }
else else
{ {
UpdateSoundPosition(sourceIndex, position, volume);
//position /= 1000.0f;
//OpenTK.Audio.OpenAL.AL.Source(alSources[sourceIndex], OpenTK.Audio.OpenAL.ALSource3f.Position, position.X, position.Y, 0.0f);
AL.Source(alSources[sourceIndex], ALSourceb.Looping, true); AL.Source(alSources[sourceIndex], ALSourceb.Looping, true);
AL.Source(alSources[sourceIndex], ALSourcef.Gain, volume); //AL.Source(alSources[sourceIndex], ALSourcef.Gain, volume);
ALHelper.Check(); ALHelper.Check();
return sourceIndex; return sourceIndex;
} }
@@ -257,7 +265,7 @@ namespace Subsurface.Sounds
{ {
if (ALHelper.Efx.IsInitialized) if (ALHelper.Efx.IsInitialized)
{ {
overrideLowPassGain = value; lowPassHfGain = value;
for (int i = 0; i < DefaultSourceCount; i++) for (int i = 0; i < DefaultSourceCount; i++)
{ {
//find a source that's free to use (not playing or paused) //find a source that's free to use (not playing or paused)
@@ -284,7 +292,7 @@ namespace Subsurface.Sounds
// } // }
//} //}
public static void UpdateSoundPosition(int sourceIndex, Vector2 position, float baseVolume = 1.0f, float lowPassGain = 0.0f) public static void UpdateSoundPosition(int sourceIndex, Vector2 position, float baseVolume = 1.0f)
{ {
if (sourceIndex < 1) return; if (sourceIndex < 1) return;
@@ -296,7 +304,9 @@ namespace Subsurface.Sounds
OpenTK.Audio.OpenAL.AL.Source(alSources[sourceIndex], OpenTK.Audio.OpenAL.ALSourcef.Gain, baseVolume); OpenTK.Audio.OpenAL.AL.Source(alSources[sourceIndex], OpenTK.Audio.OpenAL.ALSourcef.Gain, baseVolume);
OpenTK.Audio.OpenAL.AL.Source(alSources[sourceIndex], OpenTK.Audio.OpenAL.ALSource3f.Position, position.X, position.Y, 0.0f); OpenTK.Audio.OpenAL.AL.Source(alSources[sourceIndex], OpenTK.Audio.OpenAL.ALSource3f.Position, position.X, position.Y, 0.0f);
ALHelper.Efx.Filter(lowpassFilterId, OpenTK.Audio.OpenAL.EfxFilterf.LowpassGainHF, lowPassHfGain = Math.Min(lowPassGain, overrideLowPassGain)); float lowPassGain = lowPassHfGain / Math.Max(position.Length()*5.0f,1.0f);
ALHelper.Efx.Filter(lowpassFilterId, OpenTK.Audio.OpenAL.EfxFilterf.LowpassGainHF, lowPassGain);
ALHelper.Efx.BindFilterToSource(alSources[sourceIndex], lowpassFilterId); ALHelper.Efx.BindFilterToSource(alSources[sourceIndex], lowpassFilterId);
ALHelper.Check(); ALHelper.Check();
} }
+12
View File
@@ -815,9 +815,15 @@
<None Include="Content\effects.mgfx"> <None Include="Content\effects.mgfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Items\Button\beep.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Diving\divingSuit.ogg"> <None Include="Content\Items\Diving\divingSuit.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Items\Door\door.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Electricity\powerOn.ogg"> <None Include="Content\Items\Electricity\powerOn.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -896,6 +902,12 @@
<None Include="Content\Sounds\Damage\LimbSlash2.ogg"> <None Include="Content\Sounds\Damage\LimbSlash2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Sounds\Damage\StructureBlunt6.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\StructureBlunt7.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Enter the Maze.ogg"> <None Include="Content\Sounds\Music\Enter the Maze.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
+1 -1
View File
@@ -9,7 +9,7 @@
<ErrorReportUrlHistory /> <ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture> <FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles> <VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ProjectFiles</ProjectView> <ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ReferencePath> <ReferencePath>
Binary file not shown.