Launcher error messageboxes, more easily controllable & better looking swimming, oxygen tank bugfixes, loading screen coroutine bugfix
This commit is contained in:
@@ -181,6 +181,17 @@ namespace Launcher2
|
||||
|
||||
PlayerInput.Update(deltaTime);
|
||||
|
||||
if (GUIMessageBox.MessageBoxes.Count > 0)
|
||||
{
|
||||
var messageBox = GUIMessageBox.MessageBoxes.Peek();
|
||||
if (messageBox != null)
|
||||
{
|
||||
GUIComponent.MouseOn = messageBox;
|
||||
messageBox.Update(deltaTime);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
guiRoot.Update(deltaTime);
|
||||
}
|
||||
|
||||
@@ -297,6 +308,15 @@ namespace Launcher2
|
||||
|
||||
private bool CheckForUpdates()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(settings.MasterServerUrl))
|
||||
{
|
||||
updateInfoText.Text = "Checking updates failed";
|
||||
updateInfoBox.Visible = true;
|
||||
SetUpdateInfoBox("Update server URL not set");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
updateInfoText.Text = "Checking for updates...";
|
||||
|
||||
XDocument doc = null;
|
||||
@@ -308,6 +328,9 @@ namespace Launcher2
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
updateInfoText.Text = "Checking updates failed";
|
||||
updateInfoBox.Visible = true;
|
||||
|
||||
SetUpdateInfoBox("Error while checking for updates: " + e.Message);
|
||||
return false;
|
||||
}
|
||||
@@ -416,6 +439,12 @@ namespace Launcher2
|
||||
latestVersionFiles = UpdaterUtil.GetFileList(doc);
|
||||
filesToDownload = UpdaterUtil.GetRequiredFiles(doc);
|
||||
|
||||
string updaterVersion = ToolBox.GetAttributeString(doc.Root, "updaterversion", "1.0");
|
||||
if (updaterVersion!=UpdaterUtil.Version || true)
|
||||
{
|
||||
ShowError("Warning", "The update may contain changes which can't be installed by the autoupdater. If you receive any error messages during the install, please download and install the update manually.");
|
||||
}
|
||||
|
||||
string dir = Directory.GetCurrentDirectory();
|
||||
|
||||
filesToDownloadCount = filesToDownload.Count;
|
||||
@@ -503,7 +532,8 @@ namespace Launcher2
|
||||
{
|
||||
GUIFrame dummyFrame = new GUIFrame(new Rectangle(0,0,graphicsWidth,graphicsHeight));
|
||||
|
||||
new GUIMessageBox(header, message, new string[] { "OK" }, 400, 250, Alignment.TopLeft, dummyFrame);
|
||||
GUIMessageBox errorBox = new GUIMessageBox(header, message, new string[] { "OK" }, 400, 250, Alignment.TopLeft, dummyFrame);
|
||||
errorBox.Buttons[0].OnClicked = errorBox.Close;
|
||||
}
|
||||
|
||||
private void Completed(object sender, AsyncCompletedEventArgs e)
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="4.0" walkspeed="3.5">
|
||||
|
||||
<!-- head -->
|
||||
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0">
|
||||
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0" impacttolerance="50.0">
|
||||
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="371,15,66,136" depth="0.02" origin ="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
<!-- lower yaw -->
|
||||
<limb id = "1" width="16" height="103">
|
||||
<limb id = "1" width="16" height="103" impacttolerance="50.0">
|
||||
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="391,169,28,110" depth="0.025" origin="0.5,0.5"/>
|
||||
<attack type="PinchCCW" range="200" duration="0.5" damage="150" bleedingdamage="10" structuredamage="200" damagetype="slash"/>
|
||||
</limb>
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Items>
|
||||
<Item
|
||||
name="Oxygen Tank"
|
||||
Tags="smallitem"
|
||||
pickdistance="150"
|
||||
price="50">
|
||||
name="Oxygen Tank"
|
||||
Tags="smallitem"
|
||||
pickdistance="150"
|
||||
price="50">
|
||||
|
||||
<Sprite texture ="oxygentank.png" depth="0.5"/>
|
||||
|
||||
<Body radius="6" height="22" density="5"/>
|
||||
|
||||
<Holdable holdpos="30,-15" handle1="0,5" handle2="0,-5"/>
|
||||
<Pickable slots="RightHand,Any"/>
|
||||
<Pickable holdpos="30,-15" handle1="0,1" slots="RightHand,LeftHand,Any">
|
||||
<StatusEffect type="OnWearing" target="This" Condition="-0.5"/>
|
||||
<StatusEffect type="OnWearing" target="Character" Oxygen="20.0"/>
|
||||
</Pickable>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
@@ -26,8 +28,6 @@
|
||||
|
||||
<Wearable limbtype="Head" slots="Any,Head">
|
||||
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.5" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Welding Fuel Tank,human" Condition="-0.7" Oxygen="-20.0"/>
|
||||
</Wearable>
|
||||
|
||||
<ItemContainer capacity="1" hideitems="true">
|
||||
@@ -61,7 +61,6 @@
|
||||
<sprite texture="DivingSuit.png" limb="RightLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
|
||||
<sprite texture="DivingSuit.png" limb="LeftLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
|
||||
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.5" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Character" PressureProtection="100.0" SpeedMultiplier="0.7" LowPassMultiplier="0.2" setvalue="true" disabledeltatime="true"/>
|
||||
</Wearable>
|
||||
|
||||
|
||||
@@ -93,8 +93,10 @@
|
||||
|
||||
<Body radius="6" height="22" density="5"/>
|
||||
|
||||
<Holdable slots="RightHand,Any"
|
||||
holdpos="30,-15" handle1="0,5" handle2="0,-5"/>
|
||||
<Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
|
||||
<StatusEffect type="OnWearing" target="This" Condition="-0.5"/>
|
||||
<StatusEffect type="OnWearing" target="Character" Oxygen="-40.0"/>
|
||||
</Holdable>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Subsurface
|
||||
(int)newWidth,
|
||||
(int)newHeight);
|
||||
|
||||
UpdateTransform();
|
||||
//UpdateTransform();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,10 +126,10 @@ namespace Subsurface
|
||||
position += amount;
|
||||
Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f);
|
||||
|
||||
UpdateTransform();
|
||||
//UpdateTransform();
|
||||
}
|
||||
|
||||
private void UpdateTransform()
|
||||
public void UpdateTransform()
|
||||
{
|
||||
Vector2 interpolatedPosition = Physics.Interpolate(prevPosition, position);
|
||||
|
||||
@@ -148,16 +148,16 @@ namespace Subsurface
|
||||
-interpolatedPosition.X - resolution.X / interpolatedZoom / 2.0f,
|
||||
-interpolatedPosition.Y - resolution.Y / interpolatedZoom / 2.0f, 0)) *
|
||||
Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) *
|
||||
viewMatrix;
|
||||
viewMatrix;
|
||||
|
||||
prevPosition = position;
|
||||
prevZoom = zoom;
|
||||
}
|
||||
|
||||
public void MoveCamera(float deltaTime)
|
||||
{
|
||||
float moveSpeed = 20.0f/zoom;
|
||||
|
||||
prevPosition = position;
|
||||
prevZoom = zoom;
|
||||
|
||||
Vector2 moveCam = Vector2.Zero;
|
||||
if (targetPos == Vector2.Zero)
|
||||
{
|
||||
@@ -189,19 +189,10 @@ namespace Subsurface
|
||||
|
||||
Vector2 diff = (targetPos + offset) - position;
|
||||
|
||||
if (diff == Vector2.Zero)
|
||||
{
|
||||
moveCam = Vector2.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
float dist = diff == Vector2.Zero ? 0.0f : diff.Length();
|
||||
|
||||
moveCam = Vector2.Normalize(diff) * Math.Min(dist, (dist * deltaTime * 60.0f) / MoveSmoothness);
|
||||
}
|
||||
moveCam = diff / MoveSmoothness;
|
||||
}
|
||||
|
||||
shakeTargetPosition = Rand.Vector(Shake);
|
||||
shakeTargetPosition = Rand.Vector(Shake);
|
||||
shakePosition = Vector2.Lerp(shakePosition, shakeTargetPosition, 0.5f);
|
||||
Shake = MathHelper.Lerp(Shake, 0.0f, 0.03f);
|
||||
|
||||
|
||||
@@ -741,7 +741,7 @@ namespace Subsurface
|
||||
|
||||
public virtual void Update(Camera cam, float deltaTime)
|
||||
{
|
||||
AnimController.SimplePhysicsEnabled = (Character.controlled!=this && Vector2.Distance(cam.WorldViewCenter, Position)>2000.0f);
|
||||
AnimController.SimplePhysicsEnabled = (Character.controlled!=this && Vector2.Distance(cam.WorldViewCenter, Position)>5000.0f);
|
||||
|
||||
if (isDead) return;
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace Subsurface
|
||||
|
||||
Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition;
|
||||
|
||||
if (!MathUtils.IsValid(RefLimb.body.SimPosition))
|
||||
{
|
||||
int a = 1;
|
||||
}
|
||||
|
||||
//if (inWater) stairs = null;
|
||||
|
||||
Vector2 rayStart = colliderPos; // at the bottom of the player sprite
|
||||
@@ -405,6 +410,11 @@ namespace Subsurface
|
||||
{
|
||||
movement = Vector2.Normalize(movement);
|
||||
}
|
||||
|
||||
if (!MathUtils.IsValid(movement))
|
||||
{
|
||||
int a = 1;
|
||||
}
|
||||
|
||||
RefLimb.pullJoint.Enabled = true;
|
||||
RefLimb.pullJoint.WorldAnchorB =
|
||||
@@ -412,6 +422,11 @@ namespace Subsurface
|
||||
|
||||
RefLimb.body.SmoothRotate(0.0f);
|
||||
|
||||
if (!MathUtils.IsValid(RefLimb.body.SimPosition))
|
||||
{
|
||||
int a = 1;
|
||||
}
|
||||
|
||||
foreach (Limb l in Limbs)
|
||||
{
|
||||
if (l==RefLimb) continue;
|
||||
@@ -458,25 +473,30 @@ namespace Subsurface
|
||||
TargetDir = Direction.Right;
|
||||
}
|
||||
|
||||
if (TargetMovement == Vector2.Zero) return;
|
||||
|
||||
float targetSpeed = TargetMovement.Length();
|
||||
if (targetSpeed > 0.0f) TargetMovement /= targetSpeed;
|
||||
|
||||
//if trying to head to the opposite direction, apply torque
|
||||
//to the torso to flip the ragdoll around
|
||||
//if (Math.Sign(TargetMovement.X) != Dir && TargetMovement.X != 0.0f)
|
||||
//{
|
||||
// float torque = torso.Mass * 10.0f;
|
||||
// torque *= (rotation > 90 && rotation < 270) ? -Dir : Dir;
|
||||
|
||||
// torso.body.ApplyTorque(torque);
|
||||
//}
|
||||
|
||||
if (targetSpeed > 0.1f && !aiming)
|
||||
|
||||
if (targetSpeed > 0.1f)
|
||||
{
|
||||
torso.body.SmoothRotate(MathUtils.VectorToAngle(TargetMovement)-MathHelper.PiOver2);
|
||||
if (!aiming)
|
||||
{
|
||||
torso.body.SmoothRotate(MathUtils.VectorToAngle(TargetMovement)-MathHelper.PiOver2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aiming)
|
||||
{
|
||||
Vector2 mousePos = ConvertUnits.ToSimUnits(character.CursorPosition);
|
||||
Vector2 diff = (mousePos - torso.SimPosition) * Dir;
|
||||
|
||||
TargetMovement = new Vector2(0.0f, -0.1f);
|
||||
|
||||
torso.body.SmoothRotate(MathUtils.VectorToAngle(diff));
|
||||
}
|
||||
}
|
||||
|
||||
if (TargetMovement == Vector2.Zero) return;
|
||||
|
||||
movement = MathUtils.SmoothStep(movement, TargetMovement, 0.3f);
|
||||
|
||||
@@ -503,9 +523,11 @@ namespace Subsurface
|
||||
movement.Y = movement.Y - (surfaceLimiter - 1.0f) * 0.01f;
|
||||
}
|
||||
|
||||
movement.Y -= 0.05f;
|
||||
|
||||
head.body.ApplyForce((new Vector2(movement.X,
|
||||
movement.Y / surfaceLimiter + 0.2f) - head.body.LinearVelocity * 0.2f) *
|
||||
20.0f * head.body.Mass);
|
||||
30.0f * head.body.Mass);
|
||||
|
||||
torso.body.ApplyForce((new Vector2(movement.X,
|
||||
movement.Y / surfaceLimiter + 0.2f) - torso.body.LinearVelocity * 0.2f) * 10.0f * torso.body.Mass);
|
||||
@@ -513,30 +535,25 @@ namespace Subsurface
|
||||
walkPos += movement.Length() * 0.15f;
|
||||
footPos = (leftFoot.SimPosition + rightFoot.SimPosition) / 2.0f;
|
||||
|
||||
Vector2 transformedFootPos = new Vector2((float)Math.Sin(walkPos) * 0.3f, 0.0f);
|
||||
var rightThigh = GetLimb(LimbType.RightThigh);
|
||||
var leftThigh = GetLimb(LimbType.LeftThigh);
|
||||
|
||||
rightThigh.body.SmoothRotate(torso.Rotation + (float)Math.Sin(walkPos) * 0.3f, 2.0f);
|
||||
leftThigh.body.SmoothRotate(torso.Rotation - (float)Math.Sin(walkPos) * 0.3f, 2.0f);
|
||||
|
||||
Vector2 transformedFootPos = new Vector2((float)Math.Sin(walkPos) * 0.5f, 0.0f);
|
||||
transformedFootPos = Vector2.Transform(
|
||||
transformedFootPos,
|
||||
Matrix.CreateRotationZ(torso.body.Rotation));
|
||||
|
||||
MoveLimb(leftFoot, footPos + transformedFootPos, 2.5f);
|
||||
MoveLimb(rightFoot, footPos - transformedFootPos, 2.5f);
|
||||
|
||||
//float legCorrection = MathUtils.GetShortestAngle(leftLeg.Rotation, torso.body.Rotation);
|
||||
|
||||
//leftLeg.body.ApplyTorque(legCorrection);
|
||||
|
||||
//legCorrection = MathUtils.GetShortestAngle(rightLeg.Rotation, torso.body.Rotation);
|
||||
|
||||
//rightLeg.body.ApplyTorque(legCorrection);
|
||||
Vector2 feetExtendForce = new Vector2(
|
||||
(float)-Math.Sin(torso.body.Rotation),
|
||||
(float)Math.Cos(torso.body.Rotation));
|
||||
|
||||
leftFoot.body.ApplyForce(feetExtendForce);
|
||||
rightFoot.body.ApplyForce(feetExtendForce);
|
||||
|
||||
leftFoot.body.ApplyTorque(leftFoot.body.Mass * -Dir);
|
||||
rightFoot.body.ApplyTorque(rightFoot.body.Mass * -Dir);
|
||||
if (Math.Abs(MathUtils.GetShortestAngle(torso.Rotation, rightThigh.Rotation))<0.3f)
|
||||
{
|
||||
MoveLimb(rightFoot, footPos - transformedFootPos, 1.0f);
|
||||
}
|
||||
if (Math.Abs(MathUtils.GetShortestAngle(torso.Rotation, leftThigh.Rotation)) < 0.3f)
|
||||
{
|
||||
MoveLimb(leftFoot, footPos + transformedFootPos, 1.0f);
|
||||
}
|
||||
|
||||
handPos = (torso.SimPosition + head.SimPosition) / 2.0f;
|
||||
|
||||
@@ -571,8 +588,8 @@ namespace Subsurface
|
||||
|
||||
float handCyclePos = walkPos / 2.0f;
|
||||
float handPosX = (float)Math.Cos(handCyclePos * Dir) * 0.4f;
|
||||
float handPosY = (float)Math.Sin(handCyclePos * Dir) * 0.7f;
|
||||
handPosY = MathHelper.Clamp(handPosY, -0.6f, 0.6f);
|
||||
float handPosY = (float)Math.Sin(handCyclePos * Dir) * 1.0f;
|
||||
handPosY = MathHelper.Clamp(handPosY, -0.8f, 0.8f);
|
||||
|
||||
Matrix rotationMatrix = Matrix.CreateRotationZ(torso.Rotation);
|
||||
|
||||
@@ -582,7 +599,9 @@ namespace Subsurface
|
||||
rightHandPos.X = (Dir == 1.0f) ? Math.Max(0.2f, rightHandPos.X) : Math.Min(-0.2f, rightHandPos.X);
|
||||
rightHandPos = Vector2.Transform(rightHandPos, rotationMatrix);
|
||||
|
||||
MoveLimb(rightHand, handPos + rightHandPos, 3.5f);
|
||||
//MoveLimb(rightHand, handPos + rightHandPos, 1.5f);
|
||||
|
||||
HandIK(rightHand, handPos + rightHandPos, 0.5f);
|
||||
}
|
||||
|
||||
if (!leftHand.Disabled)
|
||||
@@ -591,7 +610,8 @@ namespace Subsurface
|
||||
leftHandPos.X = (Dir == 1.0f) ? Math.Max(0.2f, leftHandPos.X) : Math.Min(-0.2f, leftHandPos.X);
|
||||
leftHandPos = Vector2.Transform(leftHandPos, rotationMatrix);
|
||||
|
||||
MoveLimb(leftHand, handPos + leftHandPos, 3.5f);
|
||||
//MoveLimb(leftHand, handPos + leftHandPos,1.5f);
|
||||
HandIK(leftHand, handPos + leftHandPos, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -364,11 +364,11 @@ namespace Subsurface
|
||||
{
|
||||
if (LinearVelocity.X>100.0f)
|
||||
{
|
||||
DebugConsole.ThrowError("CHARACTER EXPLODED");
|
||||
//DebugConsole.ThrowError("CHARACTER EXPLODED");
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
limb.body.ResetDynamics();
|
||||
limb.body.SetTransform(body.SimPosition, 0.0f);
|
||||
limb.body.SetTransform(character.AnimController.RefLimb.SimPosition, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,15 +390,15 @@ namespace Subsurface
|
||||
Vector2 dragForce = Vector2.Zero;
|
||||
if (dragDot > 0)
|
||||
{
|
||||
float vel = LinearVelocity.Length();
|
||||
float vel = LinearVelocity.Length()*2.0f;
|
||||
float drag = dragDot * vel * vel
|
||||
* ConvertUnits.ToSimUnits(sprite.size.Y);
|
||||
dragForce = drag * -velDir;
|
||||
if (dragForce.Length() > 100.0f) { }
|
||||
//if (dragForce.Length() > 100.0f) { }
|
||||
}
|
||||
|
||||
body.ApplyForce(dragForce + buoyancy);
|
||||
body.ApplyTorque(body.AngularVelocity * body.Mass * -0.05f);
|
||||
body.ApplyTorque(body.AngularVelocity * body.Mass * -0.08f);
|
||||
}
|
||||
|
||||
if (character.IsDead) return;
|
||||
|
||||
@@ -655,12 +655,12 @@ namespace Subsurface
|
||||
{
|
||||
if (inWater)
|
||||
{
|
||||
//foreach (Limb limb in Limbs)
|
||||
//{
|
||||
// if (limb.body.TargetPosition == Vector2.Zero) continue;
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
//if (limb.body.TargetPosition == Vector2.Zero) continue;
|
||||
|
||||
// limb.body.SetTransform(limb.SimPosition + newMovement * 0.1f, limb.Rotation);
|
||||
//}
|
||||
limb.body.SetTransform(limb.SimPosition + newMovement * 0.1f, limb.Rotation);
|
||||
}
|
||||
|
||||
correctionMovement = Vector2.Normalize(newMovement) * Math.Min(0.1f + dist, 3.0f);
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
loadState = 100.0f;
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,11 +314,11 @@ namespace Subsurface
|
||||
Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch);
|
||||
}
|
||||
|
||||
double elapsed = sw.Elapsed.TotalSeconds;
|
||||
if (elapsed < Physics.step)
|
||||
{
|
||||
System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0));
|
||||
}
|
||||
//double elapsed = sw.Elapsed.TotalSeconds;
|
||||
//if (elapsed < Physics.step)
|
||||
//{
|
||||
// System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0));
|
||||
//}
|
||||
sw.Restart();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace Subsurface.Items.Components
|
||||
/// <summary>
|
||||
/// The base class for components holding the different functionalities of the item
|
||||
/// </summary>
|
||||
class ItemComponent : IPropertyObject
|
||||
class
|
||||
ItemComponent : IPropertyObject
|
||||
{
|
||||
protected Item item;
|
||||
|
||||
@@ -86,8 +87,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (!value && isActive)
|
||||
{
|
||||
StopSounds(ActionType.OnActive);
|
||||
StopSounds(ActionType.OnUse);
|
||||
StopSounds(ActionType.OnActive);
|
||||
}
|
||||
|
||||
isActive = value;
|
||||
@@ -181,7 +181,10 @@ namespace Subsurface.Items.Components
|
||||
|
||||
// initableProperty.TrySetValue(value);
|
||||
//}
|
||||
|
||||
if (item.Name=="Welding Tool")
|
||||
{
|
||||
int a = 1;
|
||||
}
|
||||
|
||||
properties = ObjectProperty.InitProperties(this, element);
|
||||
|
||||
|
||||
@@ -81,8 +81,6 @@ namespace Subsurface.Items.Components
|
||||
|
||||
//ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
|
||||
|
||||
Debug.WriteLine(item.body.Rotation);
|
||||
|
||||
Launch(new Vector2(
|
||||
(float)Math.Cos(item.body.Rotation),
|
||||
(float)Math.Sin(item.body.Rotation)) * launchImpulse * item.body.Mass);
|
||||
|
||||
@@ -306,20 +306,6 @@ namespace Subsurface
|
||||
TryPutItem(item, i, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine("Inventory update: "+itemId+" - "+slotIndex);
|
||||
|
||||
//if (slotIndex==-1)
|
||||
//{
|
||||
// if (item.inventory == this) item.Drop();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// TryPutItem(item, slotIndex, false);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,6 +474,8 @@ namespace Subsurface
|
||||
{
|
||||
if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive;
|
||||
|
||||
if (ic.WasUsed) ic.StopSounds(ActionType.OnUse);
|
||||
|
||||
if (!ic.IsActive) continue;
|
||||
|
||||
if (condition > 0.0f)
|
||||
@@ -745,7 +747,7 @@ namespace Subsurface
|
||||
foreach (Item item in itemList)
|
||||
{
|
||||
if (ignoredItems!=null && ignoredItems.Contains(item)) continue;
|
||||
if (hull != item.CurrentHull) continue;
|
||||
if (hull != item.CurrentHull && (hull==null || (item.Rect.Height<hull.Rect.Height && item.rect.Width < hull.Rect.Width))) continue;
|
||||
if (item.body != null && !item.body.Enabled) continue;
|
||||
|
||||
Pickable pickableComponent = item.GetComponent<Pickable>();
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Subsurface
|
||||
cell.edges.Add(ge);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Debug.WriteLine("find cells: " + sw2.ElapsedMilliseconds + " ms");
|
||||
sw2.Restart();
|
||||
|
||||
@@ -590,7 +590,7 @@ int currentTargetIndex = 1;
|
||||
tempVertices.Clear();
|
||||
foreach (GraphEdge ge in cell.edges)
|
||||
{
|
||||
if (ge.point1 == ge.point2) continue;
|
||||
if (Math.Abs(Vector2.Distance(ge.point1, ge.point2))<0.1f) continue;
|
||||
if (!tempVertices.Contains(ge.point1)) tempVertices.Add(ge.point1);
|
||||
if (!tempVertices.Contains(ge.point2)) tempVertices.Add(ge.point2);
|
||||
|
||||
@@ -686,7 +686,6 @@ int currentTargetIndex = 1;
|
||||
int i = 0;
|
||||
foreach (Body body in bodies)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(i);
|
||||
i++;
|
||||
body.SetTransform(body.Position + simAmount, body.Rotation);
|
||||
}
|
||||
@@ -823,25 +822,28 @@ int currentTargetIndex = 1;
|
||||
pos.X += Position.X;
|
||||
pos.Y = -pos.Y - Position.Y;
|
||||
|
||||
int shaftWidth = 10000;
|
||||
if (GameMain.GameScreen.Cam.WorldView.Y < -pos.Y-512) return;
|
||||
|
||||
float x = GameMain.GameScreen.Cam.WorldView.X-512.0f;
|
||||
int width = (int)(Math.Ceiling(GameMain.GameScreen.Cam.WorldView.Width/512.0f + 2.0f)*512.0f);
|
||||
|
||||
spriteBatch.Draw(shaftTexture,
|
||||
new Rectangle((int)(pos.X - shaftWidth / 2), (int)pos.Y, shaftWidth, 512),
|
||||
new Rectangle(0, 0, shaftWidth, 256),
|
||||
new Rectangle((int)(MathUtils.Round(x, 512.0f)), (int)pos.Y, width, 512),
|
||||
new Rectangle(0, 0, width, 256),
|
||||
Color.White, 0.0f,
|
||||
Vector2.Zero,
|
||||
SpriteEffects.None, 0.0f);
|
||||
|
||||
pos = startPosition;
|
||||
pos.X += Position.X;
|
||||
pos.Y = -pos.Y - Position.Y;
|
||||
//pos = startPosition;
|
||||
//pos.X += Position.X;
|
||||
//pos.Y = -pos.Y - Position.Y;
|
||||
|
||||
spriteBatch.Draw(shaftTexture,
|
||||
new Rectangle((int)(pos.X - shaftWidth/2), (int)pos.Y, shaftWidth, 512),
|
||||
new Rectangle(0, 0, shaftWidth, 256),
|
||||
Color.White, 0.0f,
|
||||
Vector2.Zero,
|
||||
SpriteEffects.None, 0.0f);
|
||||
//spriteBatch.Draw(shaftTexture,
|
||||
// new Rectangle((int)(pos.X - shaftWidth/2), (int)pos.Y, shaftWidth, 512),
|
||||
// new Rectangle(0, 0, shaftWidth, 256),
|
||||
// Color.White, 0.0f,
|
||||
// Vector2.Zero,
|
||||
// SpriteEffects.None, 0.0f);
|
||||
|
||||
//List<Vector2[]> edges = GetCellEdges(observerPosition, 1, false);
|
||||
|
||||
|
||||
@@ -332,7 +332,6 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
selectionPos = Vector2.Zero;
|
||||
Debug.WriteLine("zero");
|
||||
selectionSize = Vector2.Zero;
|
||||
}
|
||||
}
|
||||
@@ -350,7 +349,6 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
selectionPos = position;
|
||||
Debug.WriteLine("pos");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -599,8 +599,6 @@ namespace Subsurface
|
||||
|
||||
string name = element.Attribute("name").Value;
|
||||
|
||||
Debug.WriteLine(name+" - "+rect);
|
||||
|
||||
Structure s = null;
|
||||
|
||||
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
|
||||
|
||||
@@ -60,9 +60,7 @@ namespace Subsurface
|
||||
foreach (XElement el in doc.Root.Elements())
|
||||
{
|
||||
StructurePrefab sp = Load(el);
|
||||
|
||||
Debug.WriteLine(sp.name);
|
||||
|
||||
|
||||
list.Add(sp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace Subsurface
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
{
|
||||
//cam.UpdateTransform();
|
||||
cam.UpdateTransform();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.AlphaBlend,
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace Subsurface
|
||||
StatusEffect.UpdateAll((float)deltaTime);
|
||||
|
||||
Physics.accumulator = Math.Min(Physics.accumulator, Physics.step * 4);
|
||||
//Physics.accumulator = Physics.step;
|
||||
while (Physics.accumulator >= Physics.step)
|
||||
{
|
||||
cam.MoveCamera((float)Physics.step);
|
||||
@@ -119,6 +120,8 @@ namespace Subsurface
|
||||
{
|
||||
//if (!Physics.updated) return;
|
||||
|
||||
cam.UpdateTransform();
|
||||
|
||||
DrawMap(graphics, spriteBatch);
|
||||
|
||||
spriteBatch.Begin();
|
||||
@@ -282,12 +285,12 @@ namespace Subsurface
|
||||
Submarine.DrawFront(spriteBatch);
|
||||
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch);
|
||||
|
||||
//if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
|
||||
//{
|
||||
// GameMain.GameSession.Level.Draw(spriteBatch);
|
||||
// //Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
//}
|
||||
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
|
||||
{
|
||||
GameMain.GameSession.Level.Draw(spriteBatch);
|
||||
//Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
|
||||
@@ -446,14 +446,15 @@ namespace Subsurface
|
||||
|
||||
private bool StartShift(GUIButton button, object selection)
|
||||
{
|
||||
GameMain.ShowLoading(ShiftLoading());
|
||||
//GameMain.ShowLoading(ShiftLoading());
|
||||
GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false);
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<object> ShiftLoading()
|
||||
{
|
||||
|
||||
{
|
||||
GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false);
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
|
||||
@@ -158,6 +158,8 @@ namespace Subsurface
|
||||
{
|
||||
base.Select();
|
||||
|
||||
Submarine.Unload();
|
||||
|
||||
SelectTab(null, 0);
|
||||
//selectedTab = 0;
|
||||
}
|
||||
|
||||
@@ -546,11 +546,8 @@ namespace Subsurface
|
||||
{
|
||||
Gender gender = (Gender)obj;
|
||||
GameMain.NetworkMember.CharacterInfo.Gender = gender;
|
||||
GameMain.Client.SendCharacterData();
|
||||
if (GameMain.Client != null) GameMain.Client.SendCharacterData();
|
||||
|
||||
//CreatePreviewCharacter();
|
||||
|
||||
|
||||
UpdatePreviewPlayer(GameMain.NetworkMember.CharacterInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace Subsurface
|
||||
{
|
||||
if (i == selectedSound)
|
||||
{
|
||||
Debug.WriteLine(s.sound.Play(1.0f, 2000.0f, position));
|
||||
s.sound.Play(1.0f, 2000.0f, position);
|
||||
Debug.WriteLine("playing: " + s.sound);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,11 +234,11 @@ namespace Subsurface
|
||||
|
||||
loadedSounds.Remove(this);
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("Removing sound " + filePath + " (buffer id" + AlBufferId + ")");
|
||||
|
||||
if (alSourceId>0 && SoundManager.IsPlaying(alSourceId))
|
||||
{
|
||||
ALHelper.Check();
|
||||
SoundManager.Stop(alSourceId);
|
||||
ALHelper.Check();
|
||||
}
|
||||
|
||||
foreach (Sound s in loadedSounds)
|
||||
@@ -246,6 +246,8 @@ namespace Subsurface
|
||||
if (s.oggSound == oggSound) return;
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("Removing sound " + filePath + " (buffer id" + AlBufferId + ")");
|
||||
|
||||
SoundManager.ClearAlSource(AlBufferId);
|
||||
oggSound.Dispose();
|
||||
}
|
||||
|
||||
@@ -218,7 +218,6 @@ namespace Subsurface.Sounds
|
||||
if (AL.GetSourceState(alSources[sourceIndex]) != ALSourceState.Paused)
|
||||
return;
|
||||
|
||||
Debug.WriteLine("sourceplay");
|
||||
AL.SourcePlay(alSources[sourceIndex]);
|
||||
ALHelper.Check();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Subsurface
|
||||
{
|
||||
public static class UpdaterUtil
|
||||
{
|
||||
public const string Version = "1.0";
|
||||
|
||||
public static void SaveFileList(string filePath)
|
||||
{
|
||||
XDocument doc = new XDocument(CreateFileList());
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user