improved humanoid animations, some map stats in map editor, gap connections visible in editor, editing wire nodes in editor, pumps don't have to be manually linked, coroutine exception handling
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 17 KiB |
@@ -143,6 +143,11 @@ namespace Launcher2
|
||||
if (settings.GraphicsWidth == mode.Width && settings.GraphicsHeight == mode.Height) resolutionDD.SelectItem(mode);
|
||||
}
|
||||
|
||||
if (resolutionDD.SelectedItemData==null)
|
||||
{
|
||||
resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Last());
|
||||
}
|
||||
|
||||
new GUITextBlock(new Rectangle(x, y + 50, 20, 20), "Content package", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
|
||||
contentPackageDD = new GUIDropDown(new Rectangle(x, y + 70, 200, 20), "", GUI.Style, guiRoot);
|
||||
|
||||
@@ -153,7 +158,7 @@ namespace Launcher2
|
||||
if (settings.SelectedContentPackage == contentPackage) contentPackageDD.SelectItem(contentPackage);
|
||||
}
|
||||
|
||||
new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot);
|
||||
//new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot);
|
||||
|
||||
var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
|
||||
fullScreenTick.OnSelected = ToggleFullScreen;
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Launcher2")]
|
||||
[assembly: AssemblyTitle("Barotrauma Launcher")]
|
||||
[assembly: AssemblyProduct("Launcher2")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
<name firstname="Content/Characters/Human/[GENDER]firstnames.txt" lastname="Content/Characters/Human/lastnames.txt" />
|
||||
|
||||
<ragdoll headposition="156" torsoposition="120"
|
||||
stepsize="42.0, 12.0">
|
||||
stepsize="42.0, 12.0"
|
||||
walkanimspeed="4.58"
|
||||
movementlerp="0.4"
|
||||
legtorque="15.0"
|
||||
thightorque="-5.0">
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="4.0">
|
||||
|
||||
@@ -680,17 +680,8 @@ namespace Subsurface
|
||||
|
||||
public void Update(Camera cam, float deltaTime)
|
||||
{
|
||||
if (isDead)
|
||||
{
|
||||
if (controlled == this)
|
||||
{
|
||||
cam.Zoom = MathHelper.Lerp(cam.Zoom, 1.5f, 0.1f);
|
||||
cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition);
|
||||
cam.OffsetAmount = 0.0f;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDead) return;
|
||||
|
||||
if (PressureProtection==0.0f &&
|
||||
(AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f))
|
||||
{
|
||||
@@ -953,15 +944,40 @@ namespace Subsurface
|
||||
Kill(true);
|
||||
}
|
||||
|
||||
private IEnumerable<object> DeathAnim()
|
||||
private IEnumerable<object> DeathAnim(Camera cam)
|
||||
{
|
||||
float timer = 8.0f;
|
||||
float dimDuration = 8.0f;
|
||||
float timer = 0.0f;
|
||||
|
||||
while (timer > 0.0f)
|
||||
Color prevAmbientLight = Game1.LightManager.AmbientLight;
|
||||
|
||||
while (timer < dimDuration)
|
||||
{
|
||||
AnimController.UpdateAnim(1.0f / 60.0f);
|
||||
timer -= 1.0f / 60.0f;
|
||||
timer += 1.0f / 60.0f;
|
||||
|
||||
if (cam != null)
|
||||
{
|
||||
cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition);
|
||||
cam.OffsetAmount = 0.0f;
|
||||
}
|
||||
|
||||
Game1.LightManager.AmbientLight = Color.Lerp(prevAmbientLight, Color.DarkGray, timer / dimDuration);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
while (Character.Controlled == this)
|
||||
{
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
float lerpLightBack = 0.0f;
|
||||
while (lerpLightBack<1.0f)
|
||||
{
|
||||
lerpLightBack = Math.Min(lerpLightBack+0.05f,1.0f);
|
||||
|
||||
Game1.LightManager.AmbientLight = Color.Lerp(Color.DarkGray, prevAmbientLight, lerpLightBack);
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
@@ -985,7 +1001,7 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
CoroutineManager.StartCoroutine(DeathAnim());
|
||||
CoroutineManager.StartCoroutine(DeathAnim(Game1.GameScreen.Cam));
|
||||
|
||||
health = 0.0f;
|
||||
|
||||
|
||||
@@ -11,9 +11,21 @@ namespace Subsurface
|
||||
{
|
||||
private bool aiming;
|
||||
|
||||
private float walkAnimSpeed;
|
||||
|
||||
private float movementLerp;
|
||||
|
||||
private float thighTorque;
|
||||
|
||||
public HumanoidAnimController(Character character, XElement element)
|
||||
: base(character, element)
|
||||
{
|
||||
walkAnimSpeed = ToolBox.GetAttributeFloat(element, "walkanimspeed", 4.0f);
|
||||
walkAnimSpeed = MathHelper.ToRadians(walkAnimSpeed);
|
||||
|
||||
movementLerp = ToolBox.GetAttributeFloat(element, "movementlerp", 0.4f);
|
||||
|
||||
thighTorque = ToolBox.GetAttributeFloat(element, "thightorque", -5.0f);
|
||||
}
|
||||
|
||||
public override void UpdateAnim(float deltaTime)
|
||||
@@ -26,7 +38,7 @@ namespace Subsurface
|
||||
|
||||
Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition;
|
||||
|
||||
if (inWater) stairs = null;
|
||||
//if (inWater) stairs = null;
|
||||
|
||||
Vector2 rayStart = colliderPos; // at the bottom of the player sprite
|
||||
Vector2 rayEnd = rayStart - new Vector2(0.0f, TorsoPosition);
|
||||
@@ -42,7 +54,7 @@ namespace Subsurface
|
||||
switch (fixture.CollisionCategories)
|
||||
{
|
||||
case Physics.CollisionStairs:
|
||||
if (inWater) return -1;
|
||||
if (inWater && TargetMovement.Y < 0.5f) return -1;
|
||||
Structure structure = fixture.Body.UserData as Structure;
|
||||
if (stairs == null && structure!=null)
|
||||
{
|
||||
@@ -155,6 +167,8 @@ namespace Subsurface
|
||||
aiming = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UpdateStanding()
|
||||
{
|
||||
Vector2 handPos;
|
||||
@@ -164,6 +178,8 @@ namespace Subsurface
|
||||
Limb head = GetLimb(LimbType.Head);
|
||||
Limb torso = GetLimb(LimbType.Torso);
|
||||
|
||||
Limb waist = GetLimb(LimbType.Waist);
|
||||
|
||||
Limb leftHand = GetLimb(LimbType.LeftHand);
|
||||
Limb rightHand = GetLimb(LimbType.RightHand);
|
||||
|
||||
@@ -171,7 +187,7 @@ namespace Subsurface
|
||||
Limb rightLeg = GetLimb(LimbType.RightLeg);
|
||||
|
||||
float getUpSpeed = 0.3f;
|
||||
float walkCycleSpeed = head.LinearVelocity.X * 0.08f;
|
||||
float walkCycleSpeed = head.LinearVelocity.X * walkAnimSpeed;
|
||||
if (stairs != null)
|
||||
{
|
||||
TargetMovement = new Vector2(MathHelper.Clamp(TargetMovement.X, -2.0f, 2.0f), TargetMovement.Y) ;
|
||||
@@ -183,7 +199,6 @@ namespace Subsurface
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
TargetMovement /= 1.2f;
|
||||
}
|
||||
|
||||
@@ -200,9 +215,9 @@ namespace Subsurface
|
||||
this.stepSize.X * walkPosX * runningModifier,
|
||||
this.stepSize.Y * walkPosY * runningModifier * runningModifier);
|
||||
|
||||
float footMid = (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
|
||||
float footMid = waist.SimPosition.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
|
||||
|
||||
movement = MathUtils.SmoothStep(movement, TargetMovement, 0.4f);
|
||||
movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp);
|
||||
movement.Y = 0.0f;
|
||||
|
||||
//place the anchors of the head and the torso to make the ragdoll stand
|
||||
@@ -230,12 +245,17 @@ namespace Subsurface
|
||||
torso.pullJoint.Enabled = true;
|
||||
torso.pullJoint.WorldAnchorB =
|
||||
MathUtils.SmoothStep(torso.SimPosition,
|
||||
new Vector2(footMid + movement.X * 0.35f, colliderPos.Y + TorsoPosition), getUpSpeed);
|
||||
new Vector2(footMid + movement.X * 0.3f, colliderPos.Y + TorsoPosition), getUpSpeed);
|
||||
|
||||
head.pullJoint.Enabled = true;
|
||||
head.pullJoint.WorldAnchorB =
|
||||
MathUtils.SmoothStep(head.SimPosition,
|
||||
new Vector2(footMid + movement.X * 0.4f, colliderPos.Y + HeadPosition), getUpSpeed);
|
||||
new Vector2(footMid + movement.X * (0.2f + runningModifier / 10.0f), colliderPos.Y + HeadPosition), getUpSpeed);
|
||||
|
||||
waist.pullJoint.Enabled = true;
|
||||
waist.pullJoint.WorldAnchorB = waist.SimPosition + movement*0.1f;
|
||||
//MathUtils.SmoothStep(waist.SimPosition,
|
||||
//new Vector2(footMid + movement.X * 0.4f, colliderPos.Y + HeadPosition), getUpSpeed);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,31 +277,40 @@ namespace Subsurface
|
||||
(-stepSize.Y > 0.0f) ? -stepSize.Y : -0.15f),
|
||||
15.0f, true);
|
||||
|
||||
if (Math.Sign(stepSize.X) == Math.Sign(Dir))
|
||||
leftFoot.body.SmoothRotate(leftLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
|
||||
rightFoot.body.SmoothRotate(rightLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
|
||||
|
||||
if (runningModifier>1.0f)
|
||||
{
|
||||
leftFoot.body.SmoothRotate(leftLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
|
||||
}
|
||||
else if (Math.Sign(-stepSize.X) == Math.Sign(Dir))
|
||||
{
|
||||
rightFoot.body.SmoothRotate(rightLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20 * runningModifier);
|
||||
if (walkPosY > 0.0f)
|
||||
{
|
||||
GetLimb(LimbType.LeftThigh).body.ApplyTorque(-walkPosY * Dir * Math.Abs(movement.X) * thighTorque);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLimb(LimbType.RightThigh).body.ApplyTorque(walkPosY * Dir * Math.Abs(movement.X) * thighTorque);
|
||||
}
|
||||
}
|
||||
|
||||
if (walkPosY > 0.0f)
|
||||
if (legTorque>0.0f)
|
||||
{
|
||||
GetLimb(LimbType.LeftThigh).body.ApplyTorque(-walkPosY * Dir * Math.Abs(movement.X) * -5.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLimb(LimbType.RightThigh).body.ApplyTorque(walkPosY * Dir * Math.Abs(movement.X) * -5.0f);
|
||||
if (Math.Sign(walkPosX) != Math.Sign(movement.X))
|
||||
{
|
||||
GetLimb(LimbType.LeftLeg).body.ApplyTorque(-walkPosY * Dir * Math.Abs(movement.X) * legTorque / runningModifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLimb(LimbType.RightLeg).body.ApplyTorque(walkPosY * Dir * Math.Abs(movement.X) * legTorque / runningModifier);
|
||||
}
|
||||
}
|
||||
|
||||
//calculate the positions of hands
|
||||
handPos = torso.SimPosition;
|
||||
handPos.X = -walkPosX * 0.1f * runningModifier;
|
||||
handPos.X = -walkPosX * 0.2f;// *runningModifier;
|
||||
|
||||
float lowerY = -0.6f + runningModifier/3.5f;
|
||||
|
||||
handPos.Y = lowerY + (float)(Math.Abs(Math.Sin(walkPos - Math.PI * 1.5f) * 0.1)) / runningModifier;
|
||||
handPos.Y = lowerY + (float)(Math.Abs(Math.Sin(walkPos - Math.PI * 1.5f) * 0.05)) / runningModifier;
|
||||
|
||||
Vector2 posAdditon = new Vector2(movement.X*0.07f, 0.0f);
|
||||
if (stairs!=null)
|
||||
@@ -321,11 +350,6 @@ namespace Subsurface
|
||||
}
|
||||
else
|
||||
{
|
||||
//add torque to the head to do a subtle "breathing" effect
|
||||
//head.body.ApplyTorque((float)Math.Sin(gameTime.TotalGameTime.TotalMilliseconds / 300) * 0.2f);
|
||||
|
||||
//standing still -> "attach" the feet to the ground
|
||||
|
||||
float movementFactor = (movement.X / 4.0f) * movement.X * Math.Sign(movement.X);
|
||||
|
||||
Vector2 footPos = new Vector2(
|
||||
@@ -337,13 +361,7 @@ namespace Subsurface
|
||||
|
||||
leftFoot.body.SmoothRotate(Dir * MathHelper.PiOver2, 5.0f);
|
||||
rightFoot.body.SmoothRotate(Dir * MathHelper.PiOver2, 5.0f);
|
||||
|
||||
|
||||
|
||||
|
||||
//handPos = torso.SimPosition;
|
||||
//handPos.X += movement.X;
|
||||
//handPos.Y -= 0.4f;
|
||||
|
||||
if (!rightHand.Disabled)
|
||||
{
|
||||
// MoveLimb(rightHand, handPos, 0.05f, true);
|
||||
|
||||
@@ -426,7 +426,7 @@ namespace Subsurface
|
||||
if (pullJoint!=null)
|
||||
{
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(pullJoint.WorldAnchorB);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true);
|
||||
}
|
||||
|
||||
if (bodyShapeTexture == null)
|
||||
|
||||
@@ -283,13 +283,15 @@ namespace Subsurface
|
||||
}
|
||||
else if (structure.StairDirection!=Direction.None)
|
||||
{
|
||||
if ((inWater || !(targetMovement.Y>Math.Abs(targetMovement.X/2.0f))) &&
|
||||
lowestLimb.Position.Y < structure.Rect.Y - structure.Rect.Height + 50.0f)
|
||||
if (targetMovement.Y < 0.5f)
|
||||
{
|
||||
stairs = null;
|
||||
return false;
|
||||
if (inWater || lowestLimb.Position.Y < structure.Rect.Y - structure.Rect.Height + 50.0f)
|
||||
{
|
||||
stairs = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (targetMovement.Y >= 0.0f && lowestLimb.SimPosition.Y > ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 8.0f))
|
||||
{
|
||||
stairs = null;
|
||||
@@ -367,12 +369,14 @@ namespace Subsurface
|
||||
if (limb.pullJoint != null)
|
||||
{
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true, 0.01f);
|
||||
pos.Y = -pos.Y;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f);
|
||||
|
||||
if (limb.AnimTargetPos == Vector2.Zero) continue;
|
||||
|
||||
Vector2 pos2 = ConvertUnits.ToDisplayUnits(limb.AnimTargetPos);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos2.X, (int)-pos2.Y, 5, 5), Color.Blue, true, 0.01f);
|
||||
pos2.Y = -pos2.Y;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos2.X, (int)pos2.Y, 5, 5), Color.Blue, true, 0.01f);
|
||||
|
||||
GUI.DrawLine(spriteBatch, pos, pos2, Color.Green);
|
||||
}
|
||||
|
||||
@@ -56,12 +56,18 @@ namespace Subsurface
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Coroutines[i].MoveNext();
|
||||
}
|
||||
|
||||
Coroutines[i].MoveNext();
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Coroutine "+Coroutines[i]+" threw an exception: "+e.Message);
|
||||
Coroutines.RemoveAt(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Subsurface
|
||||
|
||||
SetTextPos();
|
||||
|
||||
if (rect.Height == 0)
|
||||
if (rect.Height == 0 && !string.IsNullOrWhiteSpace(Text))
|
||||
{
|
||||
this.rect.Height = (int)Font.MeasureString(Text).Y;
|
||||
}
|
||||
|
||||
@@ -400,9 +400,9 @@ namespace Subsurface
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
}
|
||||
|
||||
infoBox = CreateInfoFrame("The capacitors consume large amounts of power when they're being charged at a high rate. "+
|
||||
"Be cautious to overload the electrical grid or the reactor. They also take some time to recharge, so now is a good "+
|
||||
"time to head to the room below to load some shells into the railgun.");
|
||||
infoBox = CreateInfoFrame("The capacitors consume large amounts of power when they're being charged at a high rate, so "+
|
||||
"be careful not to overload the electrical grid or the reactor. They also take some time to recharge, so now is a good "+
|
||||
"time to head to the room below and load some shells for the railgun.");
|
||||
|
||||
|
||||
var loader = Item.itemList.Find(i => i.Name == "Railgun Loader").GetComponent<ItemContainer>();
|
||||
|
||||
@@ -38,8 +38,19 @@ namespace Subsurface.Items.Components
|
||||
public Pump(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
item.linkedTo.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{ GetHulls(); };
|
||||
GetHull();
|
||||
}
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
{
|
||||
base.Move(amount);
|
||||
|
||||
GetHull();
|
||||
}
|
||||
|
||||
public override void OnMapLoaded()
|
||||
{
|
||||
GetHull();
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
@@ -77,28 +88,33 @@ namespace Subsurface.Items.Components
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
private void GetHulls()
|
||||
|
||||
private void GetHull()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -287,20 +287,21 @@ namespace Subsurface.Items.Components
|
||||
|
||||
for (int i = 1; i < Nodes.Count; i++)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y -3, 6, 6), Color.Red, true, 0.0f);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y - 3, 6, 6), Color.Red, true, 0.0f);
|
||||
|
||||
if (Vector2.Distance(Game1.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) < 20.0f)
|
||||
if (GUIComponent.MouseOn == null &&
|
||||
Vector2.Distance(Game1.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) < 20.0f)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 10, (int)-Nodes[i].Y - 10, 20, 20), Color.Red, false, 0.0f);
|
||||
|
||||
if (selectedNodeIndex==null && selectedNodeIndex>0 && selectedNodeIndex<Nodes.Count-1)
|
||||
if (selectedNodeIndex==null)// && selectedNodeIndex>0 && selectedNodeIndex<Nodes.Count-1)
|
||||
{
|
||||
if ( PlayerInput.LeftButtonDown())
|
||||
if (PlayerInput.LeftButtonDown())
|
||||
{
|
||||
MapEntity.SelectEntity(item);
|
||||
selectedNodeIndex = i;
|
||||
}
|
||||
else
|
||||
else if (PlayerInput.RightButtonClicked())
|
||||
{
|
||||
Nodes.RemoveAt(i);
|
||||
break;
|
||||
@@ -325,8 +326,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (selectedNodeIndex != null) MapEntity.SelectEntity(item); ;
|
||||
selectedNodeIndex = null;
|
||||
selectedNodeIndex = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -635,7 +635,7 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
editingHUD = new GUIFrame(new Rectangle(x, y, width, 60 + (editableProperties.Count() + requiredItemCount) * 30), GUI.Style);
|
||||
editingHUD = new GUIFrame(new Rectangle(x, y, width, 70 + (editableProperties.Count() + requiredItemCount) * 30), GUI.Style);
|
||||
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
||||
editingHUD.UserData = this;
|
||||
|
||||
|
||||
@@ -178,22 +178,40 @@ namespace Subsurface
|
||||
|
||||
public override void Draw(SpriteBatch sb, bool editing)
|
||||
{
|
||||
//if (linkedTo[0] != null)
|
||||
// GUI.DrawLine(sb, new Vector2(Position.X, Position.Y),
|
||||
// new Vector2(linkedTo[0].Position.X, linkedTo[0].Position.Y), Color.Blue);
|
||||
|
||||
//if (linkedTo.Count > 1 && linkedTo[1] != null)
|
||||
// GUI.DrawLine(sb, new Vector2(Position.X, Position.Y),
|
||||
// new Vector2(linkedTo[1].Position.X, linkedTo[1].Position.Y), Color.Blue);
|
||||
|
||||
|
||||
//GUI.DrawLine(sb, new Vector2(Position.X, -Position.Y), new Vector2(Position.X, -Position.Y)+new Vector2(flowForce.X, -flowForce.Y), Color.LightBlue);
|
||||
|
||||
if (!editing) return;
|
||||
|
||||
Color clr = (open == 0.0f) ? Color.Red : Color.Cyan;
|
||||
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr);
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr*0.5f, true);
|
||||
|
||||
if (isHorizontal)
|
||||
{
|
||||
for (int i = 0; i < linkedTo.Count; i++ )
|
||||
{
|
||||
if (linkedTo[i].Rect.Center.X > rect.Center.X)
|
||||
{
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.Right, -rect.Y, 10, rect.Height), Color.Green * 0.3f, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.X - 10, -rect.Y, 10, rect.Height), Color.Green * 0.3f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < linkedTo.Count; i++)
|
||||
{
|
||||
if (linkedTo[i].Rect.Y - linkedTo[i].Rect.Height/2.0f > rect.Y)
|
||||
{
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y - 10, rect.Width, 10), Color.Green * 0.3f, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y + rect.Height, rect.Width, 10), Color.Green * 0.3f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
@@ -202,10 +220,6 @@ namespace Subsurface
|
||||
new Vector2(rect.Width + 10, rect.Height + 10),
|
||||
Color.Red);
|
||||
}
|
||||
|
||||
//HUD.DrawLine(sb, new Vector2(position.X, -position.Y),
|
||||
// isHorizontal ? new Vector2(position.X, -position.Y + size) : new Vector2(position.X + size, -position.Y),
|
||||
// clr);
|
||||
}
|
||||
|
||||
public override void Update(Camera cam, float deltaTime)
|
||||
@@ -218,10 +232,7 @@ namespace Subsurface
|
||||
index = Math.Min(index,2);
|
||||
|
||||
soundIndex = AmbientSoundManager.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f);
|
||||
//soundVolume = Math.Max(0.0f, soundVolume-deltaTime);
|
||||
//Sound.UpdatePosition(soundIndex, Position, 2000.0f);
|
||||
|
||||
|
||||
flowForce = Vector2.Zero;
|
||||
|
||||
if (open == 0.0f) return;
|
||||
@@ -240,7 +251,7 @@ namespace Subsurface
|
||||
UpdateRoomToRoom(deltaTime);
|
||||
}
|
||||
|
||||
if (FlowForce.Length() > 150.0f && flowTargetHull!=null && flowTargetHull.Volume < flowTargetHull.FullVolume)
|
||||
if (FlowForce.Length() > 150.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume)
|
||||
{
|
||||
//UpdateFlowForce();
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace Subsurface.Lights
|
||||
{
|
||||
class LightSource
|
||||
{
|
||||
|
||||
private static Texture2D lightTexture;
|
||||
|
||||
private Color color;
|
||||
@@ -87,13 +87,15 @@ namespace Subsurface
|
||||
|
||||
|
||||
sw.WriteLine(sb.ToString());
|
||||
sw.Close();
|
||||
|
||||
#if WINDOWS
|
||||
MessageBox.Show( "A crash report (''crashreport.txt'') was saved in the root folder of the game."+
|
||||
" If you'd like to help fix this bug, please make a bug report on the Undertow Games forum with the report attached.",
|
||||
" If you'd like to help fix this bug, please post the report on the Undertow Games forums.",
|
||||
"Oops! Subsurface just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endif
|
||||
|
||||
sw.Close();
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,27 @@ namespace Subsurface
|
||||
get { return cam; }
|
||||
}
|
||||
|
||||
public string GetSubName()
|
||||
{
|
||||
return ((Submarine.Loaded == null) ? "" : Submarine.Loaded.Name);
|
||||
}
|
||||
|
||||
private string GetItemCount()
|
||||
{
|
||||
return "Items: " +Item.itemList.Count;
|
||||
}
|
||||
|
||||
private string GetStructureCount()
|
||||
{
|
||||
return "Structures: " + (MapEntity.mapEntityList.Count - Item.itemList.Count);
|
||||
}
|
||||
|
||||
private string GetPhysicsBodyCount()
|
||||
{
|
||||
return "Physics bodies: " + Game1.World.BodyList.Count;
|
||||
}
|
||||
|
||||
|
||||
public EditMapScreen()
|
||||
{
|
||||
cam = new Camera();
|
||||
@@ -37,15 +58,28 @@ namespace Subsurface
|
||||
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
|
||||
//constructionList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", Alignment.Left, GUI.Style, GUIpanel);
|
||||
GUITextBlock nameBlock = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, GUIpanel, true, GUI.LargeFont);
|
||||
nameBlock.TextGetter = GetSubName;
|
||||
|
||||
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 80, 0, 20), "", GUI.Style, GUIpanel);
|
||||
itemCount.TextGetter = GetItemCount;
|
||||
|
||||
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 100, 0, 20), "", GUI.Style, GUIpanel);
|
||||
structureCount.TextGetter = GetStructureCount;
|
||||
|
||||
//GUITextBlock physicsBodyCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel);
|
||||
//physicsBodyCount.TextGetter = GetPhysicsBodyCount;
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(0, 150, 0, 20), "Items", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button.UserData = 0;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button = new GUIButton(new Rectangle(0, 180, 0, 20), "Structures", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button.UserData = 1;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button = new GUIButton(new Rectangle(0, 220, 0, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
|
||||
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
|
||||
button.OnClicked = ToggleCharacterMode;
|
||||
|
||||
GUItabs = new GUIComponent[2];
|
||||
@@ -130,10 +164,10 @@ namespace Subsurface
|
||||
|
||||
private bool ToggleCharacterMode(GUIButton button, object obj)
|
||||
{
|
||||
selectedTab = 0;
|
||||
selectedTab = -1;
|
||||
|
||||
characterMode = !characterMode;
|
||||
button.Color = (characterMode) ? Color.Gold : Color.White;
|
||||
//button.Color = (characterMode) ? Color.Gold : Color.White;
|
||||
|
||||
if (characterMode)
|
||||
{
|
||||
@@ -170,16 +204,9 @@ namespace Subsurface
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
//Vector2 mousePosition = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y);
|
||||
//mousePosition = cam.ScreenToWorld(mousePosition);
|
||||
|
||||
//if (!Character.characterList.Contains(dummyCharacter))
|
||||
//{
|
||||
// CreateDummyCharacter();
|
||||
//}
|
||||
|
||||
if (GUIComponent.MouseOn==null) cam.MoveCamera((float)deltaTime);
|
||||
cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed/1000.0f,0.1f, 2.0f);
|
||||
if (GUIComponent.MouseOn == null) cam.MoveCamera((float)deltaTime);
|
||||
cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed / 1000.0f, 0.1f, 2.0f);
|
||||
|
||||
if (characterMode)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Windows\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS</DefineConstants>
|
||||
<AllowedReferenceRelatedFileExtensions>
|
||||
<!-- Prevent default XML and PDB files copied to output in RELEASE.
|
||||
Only *.allowedextension files will be included, which doesn't exist in my case.
|
||||
-->
|
||||
.allowedextension
|
||||
</AllowedReferenceRelatedFileExtensions>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -85,7 +91,7 @@
|
||||
<Compile Include="Source\Items\Components\Signal\SignalCheckComponent.cs" />
|
||||
<Compile Include="Source\Items\Components\ItemLabel.cs" />
|
||||
<Compile Include="Source\Items\FixRequirement.cs" />
|
||||
<Compile Include="Source\Map\Lights\Light.cs" />
|
||||
<Compile Include="Source\Map\Lights\LightSource.cs" />
|
||||
<Compile Include="Source\Map\LocationType.cs" />
|
||||
<Compile Include="Source\Networking\NetConfig.cs" />
|
||||
<Compile Include="Source\Particles\ParticleEmitter.cs" />
|
||||
|
||||
@@ -11,4 +11,8 @@
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ReferencePath>
|
||||
</ReferencePath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Reference in New Issue
Block a user