Launcher error messageboxes, more easily controllable & better looking swimming, oxygen tank bugfixes, loading screen coroutine bugfix

This commit is contained in:
Regalis
2015-10-03 17:19:14 +03:00
parent a285b00eb9
commit 46e862216b
29 changed files with 184 additions and 149 deletions
+31 -1
View File
@@ -181,6 +181,17 @@ namespace Launcher2
PlayerInput.Update(deltaTime); 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); guiRoot.Update(deltaTime);
} }
@@ -297,6 +308,15 @@ namespace Launcher2
private bool CheckForUpdates() 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..."; updateInfoText.Text = "Checking for updates...";
XDocument doc = null; XDocument doc = null;
@@ -308,6 +328,9 @@ namespace Launcher2
catch (Exception e) catch (Exception e)
{ {
updateInfoText.Text = "Checking updates failed";
updateInfoBox.Visible = true;
SetUpdateInfoBox("Error while checking for updates: " + e.Message); SetUpdateInfoBox("Error while checking for updates: " + e.Message);
return false; return false;
} }
@@ -416,6 +439,12 @@ namespace Launcher2
latestVersionFiles = UpdaterUtil.GetFileList(doc); latestVersionFiles = UpdaterUtil.GetFileList(doc);
filesToDownload = UpdaterUtil.GetRequiredFiles(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(); string dir = Directory.GetCurrentDirectory();
filesToDownloadCount = filesToDownload.Count; filesToDownloadCount = filesToDownload.Count;
@@ -503,7 +532,8 @@ namespace Launcher2
{ {
GUIFrame dummyFrame = new GUIFrame(new Rectangle(0,0,graphicsWidth,graphicsHeight)); 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) private void Completed(object sender, AsyncCompletedEventArgs e)
@@ -8,12 +8,12 @@
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="4.0" walkspeed="3.5"> <ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="4.0" walkspeed="3.5">
<!-- head --> <!-- 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"/> <sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="371,15,66,136" depth="0.02" origin ="0.5,0.5"/>
</limb> </limb>
<!-- lower yaw --> <!-- 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"/> <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"/> <attack type="PinchCCW" range="200" duration="0.5" damage="150" bleedingdamage="10" structuredamage="200" damagetype="slash"/>
</limb> </limb>
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Items> <Items>
<Item <Item
name="Oxygen Tank" name="Oxygen Tank"
Tags="smallitem" Tags="smallitem"
pickdistance="150" pickdistance="150"
price="50"> price="50">
<Sprite texture ="oxygentank.png" depth="0.5"/> <Sprite texture ="oxygentank.png" depth="0.5"/>
<Body radius="6" height="22" density="5"/> <Body radius="6" height="22" density="5"/>
<Holdable holdpos="30,-15" handle1="0,5" handle2="0,-5"/> <Pickable holdpos="30,-15" handle1="0,1" slots="RightHand,LeftHand,Any">
<Pickable slots="RightHand,Any"/> <StatusEffect type="OnWearing" target="This" Condition="-0.5"/>
<StatusEffect type="OnWearing" target="Character" Oxygen="20.0"/>
</Pickable>
</Item> </Item>
<Item <Item
@@ -26,8 +28,6 @@
<Wearable limbtype="Head" slots="Any,Head"> <Wearable limbtype="Head" slots="Any,Head">
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/> <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> </Wearable>
<ItemContainer capacity="1" hideitems="true"> <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="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"/> <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"/> <StatusEffect type="OnWearing" target="Character" PressureProtection="100.0" SpeedMultiplier="0.7" LowPassMultiplier="0.2" setvalue="true" disabledeltatime="true"/>
</Wearable> </Wearable>
+4 -2
View File
@@ -93,8 +93,10 @@
<Body radius="6" height="22" density="5"/> <Body radius="6" height="22" density="5"/>
<Holdable slots="RightHand,Any" <Holdable slots="RightHand,Any" holdpos="30,-15" handle1="0,5" handle2="0,-5">
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>
<Item <Item
+7 -16
View File
@@ -52,7 +52,7 @@ namespace Subsurface
(int)newWidth, (int)newWidth,
(int)newHeight); (int)newHeight);
UpdateTransform(); //UpdateTransform();
} }
} }
@@ -126,10 +126,10 @@ namespace Subsurface
position += amount; position += amount;
Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f); Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f);
UpdateTransform(); //UpdateTransform();
} }
private void UpdateTransform() public void UpdateTransform()
{ {
Vector2 interpolatedPosition = Physics.Interpolate(prevPosition, position); Vector2 interpolatedPosition = Physics.Interpolate(prevPosition, position);
@@ -149,15 +149,15 @@ namespace Subsurface
-interpolatedPosition.Y - resolution.Y / interpolatedZoom / 2.0f, 0)) * -interpolatedPosition.Y - resolution.Y / interpolatedZoom / 2.0f, 0)) *
Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) * Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) *
viewMatrix; viewMatrix;
prevPosition = position;
prevZoom = zoom;
} }
public void MoveCamera(float deltaTime) public void MoveCamera(float deltaTime)
{ {
float moveSpeed = 20.0f/zoom; float moveSpeed = 20.0f/zoom;
prevPosition = position;
prevZoom = zoom;
Vector2 moveCam = Vector2.Zero; Vector2 moveCam = Vector2.Zero;
if (targetPos == Vector2.Zero) if (targetPos == Vector2.Zero)
{ {
@@ -189,16 +189,7 @@ namespace Subsurface
Vector2 diff = (targetPos + offset) - position; Vector2 diff = (targetPos + offset) - position;
if (diff == Vector2.Zero) moveCam = diff / MoveSmoothness;
{
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);
}
} }
shakeTargetPosition = Rand.Vector(Shake); shakeTargetPosition = Rand.Vector(Shake);
+1 -1
View File
@@ -741,7 +741,7 @@ namespace Subsurface
public virtual void Update(Camera cam, float deltaTime) 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; if (isDead) return;
@@ -34,6 +34,11 @@ namespace Subsurface
Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition; Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition;
if (!MathUtils.IsValid(RefLimb.body.SimPosition))
{
int a = 1;
}
//if (inWater) stairs = null; //if (inWater) stairs = null;
Vector2 rayStart = colliderPos; // at the bottom of the player sprite Vector2 rayStart = colliderPos; // at the bottom of the player sprite
@@ -406,12 +411,22 @@ namespace Subsurface
movement = Vector2.Normalize(movement); movement = Vector2.Normalize(movement);
} }
if (!MathUtils.IsValid(movement))
{
int a = 1;
}
RefLimb.pullJoint.Enabled = true; RefLimb.pullJoint.Enabled = true;
RefLimb.pullJoint.WorldAnchorB = RefLimb.pullJoint.WorldAnchorB =
RefLimb.SimPosition + movement*0.15f; RefLimb.SimPosition + movement*0.15f;
RefLimb.body.SmoothRotate(0.0f); RefLimb.body.SmoothRotate(0.0f);
if (!MathUtils.IsValid(RefLimb.body.SimPosition))
{
int a = 1;
}
foreach (Limb l in Limbs) foreach (Limb l in Limbs)
{ {
if (l==RefLimb) continue; if (l==RefLimb) continue;
@@ -458,25 +473,30 @@ namespace Subsurface
TargetDir = Direction.Right; TargetDir = Direction.Right;
} }
if (TargetMovement == Vector2.Zero) return;
float targetSpeed = TargetMovement.Length(); float targetSpeed = TargetMovement.Length();
if (targetSpeed > 0.0f) TargetMovement /= targetSpeed; if (targetSpeed > 0.0f) TargetMovement /= targetSpeed;
//if trying to head to the opposite direction, apply torque if (targetSpeed > 0.1f)
//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)
{ {
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); movement = MathUtils.SmoothStep(movement, TargetMovement, 0.3f);
@@ -503,9 +523,11 @@ namespace Subsurface
movement.Y = movement.Y - (surfaceLimiter - 1.0f) * 0.01f; movement.Y = movement.Y - (surfaceLimiter - 1.0f) * 0.01f;
} }
movement.Y -= 0.05f;
head.body.ApplyForce((new Vector2(movement.X, head.body.ApplyForce((new Vector2(movement.X,
movement.Y / surfaceLimiter + 0.2f) - head.body.LinearVelocity * 0.2f) * 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, torso.body.ApplyForce((new Vector2(movement.X,
movement.Y / surfaceLimiter + 0.2f) - torso.body.LinearVelocity * 0.2f) * 10.0f * torso.body.Mass); 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; walkPos += movement.Length() * 0.15f;
footPos = (leftFoot.SimPosition + rightFoot.SimPosition) / 2.0f; 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 = Vector2.Transform(
transformedFootPos, transformedFootPos,
Matrix.CreateRotationZ(torso.body.Rotation)); Matrix.CreateRotationZ(torso.body.Rotation));
MoveLimb(leftFoot, footPos + transformedFootPos, 2.5f); if (Math.Abs(MathUtils.GetShortestAngle(torso.Rotation, rightThigh.Rotation))<0.3f)
MoveLimb(rightFoot, footPos - transformedFootPos, 2.5f); {
MoveLimb(rightFoot, footPos - transformedFootPos, 1.0f);
//float legCorrection = MathUtils.GetShortestAngle(leftLeg.Rotation, torso.body.Rotation); }
if (Math.Abs(MathUtils.GetShortestAngle(torso.Rotation, leftThigh.Rotation)) < 0.3f)
//leftLeg.body.ApplyTorque(legCorrection); {
MoveLimb(leftFoot, footPos + transformedFootPos, 1.0f);
//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);
handPos = (torso.SimPosition + head.SimPosition) / 2.0f; handPos = (torso.SimPosition + head.SimPosition) / 2.0f;
@@ -571,8 +588,8 @@ 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) * 0.7f; float handPosY = (float)Math.Sin(handCyclePos * Dir) * 1.0f;
handPosY = MathHelper.Clamp(handPosY, -0.6f, 0.6f); handPosY = MathHelper.Clamp(handPosY, -0.8f, 0.8f);
Matrix rotationMatrix = Matrix.CreateRotationZ(torso.Rotation); 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.X = (Dir == 1.0f) ? Math.Max(0.2f, rightHandPos.X) : Math.Min(-0.2f, rightHandPos.X);
rightHandPos = Vector2.Transform(rightHandPos, rotationMatrix); 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) 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.X = (Dir == 1.0f) ? Math.Max(0.2f, leftHandPos.X) : Math.Min(-0.2f, leftHandPos.X);
leftHandPos = Vector2.Transform(leftHandPos, rotationMatrix); leftHandPos = Vector2.Transform(leftHandPos, rotationMatrix);
MoveLimb(leftHand, handPos + leftHandPos, 3.5f); //MoveLimb(leftHand, handPos + leftHandPos,1.5f);
HandIK(leftHand, handPos + leftHandPos, 0.5f);
} }
} }
+5 -5
View File
@@ -364,11 +364,11 @@ namespace Subsurface
{ {
if (LinearVelocity.X>100.0f) if (LinearVelocity.X>100.0f)
{ {
DebugConsole.ThrowError("CHARACTER EXPLODED"); //DebugConsole.ThrowError("CHARACTER EXPLODED");
foreach (Limb limb in character.AnimController.Limbs) foreach (Limb limb in character.AnimController.Limbs)
{ {
limb.body.ResetDynamics(); 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; Vector2 dragForce = Vector2.Zero;
if (dragDot > 0) if (dragDot > 0)
{ {
float vel = LinearVelocity.Length(); float vel = LinearVelocity.Length()*2.0f;
float drag = dragDot * vel * vel float drag = dragDot * vel * vel
* ConvertUnits.ToSimUnits(sprite.size.Y); * ConvertUnits.ToSimUnits(sprite.size.Y);
dragForce = drag * -velDir; dragForce = drag * -velDir;
if (dragForce.Length() > 100.0f) { } //if (dragForce.Length() > 100.0f) { }
} }
body.ApplyForce(dragForce + buoyancy); body.ApplyForce(dragForce + buoyancy);
body.ApplyTorque(body.AngularVelocity * body.Mass * -0.05f); body.ApplyTorque(body.AngularVelocity * body.Mass * -0.08f);
} }
if (character.IsDead) return; if (character.IsDead) return;
+5 -5
View File
@@ -655,12 +655,12 @@ namespace Subsurface
{ {
if (inWater) if (inWater)
{ {
//foreach (Limb limb in Limbs) foreach (Limb limb in Limbs)
//{ {
// if (limb.body.TargetPosition == Vector2.Zero) continue; //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); correctionMovement = Vector2.Normalize(newMovement) * Math.Min(0.1f + dist, 3.0f);
} }
+2
View File
@@ -152,6 +152,8 @@ namespace Subsurface
} }
loadState = 100.0f; loadState = 100.0f;
yield return CoroutineStatus.Success;
} }
} }
} }
+5 -5
View File
@@ -314,11 +314,11 @@ namespace Subsurface
Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch); Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch);
} }
double elapsed = sw.Elapsed.TotalSeconds; //double elapsed = sw.Elapsed.TotalSeconds;
if (elapsed < Physics.step) //if (elapsed < Physics.step)
{ //{
System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0)); // System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0));
} //}
sw.Restart(); sw.Restart();
} }
@@ -38,7 +38,8 @@ namespace Subsurface.Items.Components
/// <summary> /// <summary>
/// The base class for components holding the different functionalities of the item /// The base class for components holding the different functionalities of the item
/// </summary> /// </summary>
class ItemComponent : IPropertyObject class
ItemComponent : IPropertyObject
{ {
protected Item item; protected Item item;
@@ -87,7 +88,6 @@ namespace Subsurface.Items.Components
if (!value && isActive) if (!value && isActive)
{ {
StopSounds(ActionType.OnActive); StopSounds(ActionType.OnActive);
StopSounds(ActionType.OnUse);
} }
isActive = value; isActive = value;
@@ -181,7 +181,10 @@ namespace Subsurface.Items.Components
// initableProperty.TrySetValue(value); // initableProperty.TrySetValue(value);
//} //}
if (item.Name=="Welding Tool")
{
int a = 1;
}
properties = ObjectProperty.InitProperties(this, element); properties = ObjectProperty.InitProperties(this, element);
@@ -81,8 +81,6 @@ namespace Subsurface.Items.Components
//ApplyStatusEffects(ActionType.OnUse, 1.0f, character); //ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
Debug.WriteLine(item.body.Rotation);
Launch(new Vector2( Launch(new Vector2(
(float)Math.Cos(item.body.Rotation), (float)Math.Cos(item.body.Rotation),
(float)Math.Sin(item.body.Rotation)) * launchImpulse * item.body.Mass); (float)Math.Sin(item.body.Rotation)) * launchImpulse * item.body.Mass);
-14
View File
@@ -306,20 +306,6 @@ namespace Subsurface
TryPutItem(item, i, false); 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);
//}
} }
} }
} }
+3 -1
View File
@@ -474,6 +474,8 @@ namespace Subsurface
{ {
if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive; if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive;
if (ic.WasUsed) ic.StopSounds(ActionType.OnUse);
if (!ic.IsActive) continue; if (!ic.IsActive) continue;
if (condition > 0.0f) if (condition > 0.0f)
@@ -745,7 +747,7 @@ namespace Subsurface
foreach (Item item in itemList) foreach (Item item in itemList)
{ {
if (ignoredItems!=null && ignoredItems.Contains(item)) continue; 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; if (item.body != null && !item.body.Enabled) continue;
Pickable pickableComponent = item.GetComponent<Pickable>(); Pickable pickableComponent = item.GetComponent<Pickable>();
+16 -14
View File
@@ -590,7 +590,7 @@ int currentTargetIndex = 1;
tempVertices.Clear(); tempVertices.Clear();
foreach (GraphEdge ge in cell.edges) 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.point1)) tempVertices.Add(ge.point1);
if (!tempVertices.Contains(ge.point2)) tempVertices.Add(ge.point2); if (!tempVertices.Contains(ge.point2)) tempVertices.Add(ge.point2);
@@ -686,7 +686,6 @@ int currentTargetIndex = 1;
int i = 0; int i = 0;
foreach (Body body in bodies) foreach (Body body in bodies)
{ {
System.Diagnostics.Debug.WriteLine(i);
i++; i++;
body.SetTransform(body.Position + simAmount, body.Rotation); body.SetTransform(body.Position + simAmount, body.Rotation);
} }
@@ -823,25 +822,28 @@ int currentTargetIndex = 1;
pos.X += Position.X; pos.X += Position.X;
pos.Y = -pos.Y - Position.Y; 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, spriteBatch.Draw(shaftTexture,
new Rectangle((int)(pos.X - shaftWidth / 2), (int)pos.Y, shaftWidth, 512), new Rectangle((int)(MathUtils.Round(x, 512.0f)), (int)pos.Y, width, 512),
new Rectangle(0, 0, shaftWidth, 256), new Rectangle(0, 0, width, 256),
Color.White, 0.0f, Color.White, 0.0f,
Vector2.Zero, Vector2.Zero,
SpriteEffects.None, 0.0f); SpriteEffects.None, 0.0f);
pos = startPosition; //pos = startPosition;
pos.X += Position.X; //pos.X += Position.X;
pos.Y = -pos.Y - Position.Y; //pos.Y = -pos.Y - Position.Y;
spriteBatch.Draw(shaftTexture, //spriteBatch.Draw(shaftTexture,
new Rectangle((int)(pos.X - shaftWidth/2), (int)pos.Y, shaftWidth, 512), // new Rectangle((int)(pos.X - shaftWidth/2), (int)pos.Y, shaftWidth, 512),
new Rectangle(0, 0, shaftWidth, 256), // new Rectangle(0, 0, shaftWidth, 256),
Color.White, 0.0f, // Color.White, 0.0f,
Vector2.Zero, // Vector2.Zero,
SpriteEffects.None, 0.0f); // SpriteEffects.None, 0.0f);
//List<Vector2[]> edges = GetCellEdges(observerPosition, 1, false); //List<Vector2[]> edges = GetCellEdges(observerPosition, 1, false);
-2
View File
@@ -332,7 +332,6 @@ namespace Subsurface
} }
selectionPos = Vector2.Zero; selectionPos = Vector2.Zero;
Debug.WriteLine("zero");
selectionSize = Vector2.Zero; selectionSize = Vector2.Zero;
} }
} }
@@ -350,7 +349,6 @@ namespace Subsurface
} }
selectionPos = position; selectionPos = position;
Debug.WriteLine("pos");
} }
-2
View File
@@ -599,8 +599,6 @@ namespace Subsurface
string name = element.Attribute("name").Value; string name = element.Attribute("name").Value;
Debug.WriteLine(name+" - "+rect);
Structure s = null; Structure s = null;
foreach (MapEntityPrefab ep in MapEntityPrefab.list) foreach (MapEntityPrefab ep in MapEntityPrefab.list)
-2
View File
@@ -61,8 +61,6 @@ namespace Subsurface
{ {
StructurePrefab sp = Load(el); StructurePrefab sp = Load(el);
Debug.WriteLine(sp.name);
list.Add(sp); list.Add(sp);
} }
} }
+1 -1
View File
@@ -250,7 +250,7 @@ namespace Subsurface
/// <param name="gameTime">Provides a snapshot of timing values.</param> /// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{ {
//cam.UpdateTransform(); cam.UpdateTransform();
spriteBatch.Begin(SpriteSortMode.BackToFront, spriteBatch.Begin(SpriteSortMode.BackToFront,
BlendState.AlphaBlend, BlendState.AlphaBlend,
+8 -5
View File
@@ -83,6 +83,7 @@ namespace Subsurface
StatusEffect.UpdateAll((float)deltaTime); StatusEffect.UpdateAll((float)deltaTime);
Physics.accumulator = Math.Min(Physics.accumulator, Physics.step * 4); Physics.accumulator = Math.Min(Physics.accumulator, Physics.step * 4);
//Physics.accumulator = Physics.step;
while (Physics.accumulator >= Physics.step) while (Physics.accumulator >= Physics.step)
{ {
cam.MoveCamera((float)Physics.step); cam.MoveCamera((float)Physics.step);
@@ -119,6 +120,8 @@ namespace Subsurface
{ {
//if (!Physics.updated) return; //if (!Physics.updated) return;
cam.UpdateTransform();
DrawMap(graphics, spriteBatch); DrawMap(graphics, spriteBatch);
spriteBatch.Begin(); spriteBatch.Begin();
@@ -283,11 +286,11 @@ namespace Subsurface
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch); foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch);
//if (GameMain.GameSession != null && GameMain.GameSession.Level != null) if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
//{ {
// GameMain.GameSession.Level.Draw(spriteBatch); GameMain.GameSession.Level.Draw(spriteBatch);
// //Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter); //Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
//} }
spriteBatch.End(); spriteBatch.End();
+3 -2
View File
@@ -446,14 +446,15 @@ namespace Subsurface
private bool StartShift(GUIButton button, object selection) 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; return true;
} }
private IEnumerable<object> ShiftLoading() private IEnumerable<object> ShiftLoading()
{ {
GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false); GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false);
GameMain.GameScreen.Select(); GameMain.GameScreen.Select();
@@ -158,6 +158,8 @@ namespace Subsurface
{ {
base.Select(); base.Select();
Submarine.Unload();
SelectTab(null, 0); SelectTab(null, 0);
//selectedTab = 0; //selectedTab = 0;
} }
+1 -4
View File
@@ -546,10 +546,7 @@ namespace Subsurface
{ {
Gender gender = (Gender)obj; Gender gender = (Gender)obj;
GameMain.NetworkMember.CharacterInfo.Gender = gender; GameMain.NetworkMember.CharacterInfo.Gender = gender;
GameMain.Client.SendCharacterData(); if (GameMain.Client != null) GameMain.Client.SendCharacterData();
//CreatePreviewCharacter();
UpdatePreviewPlayer(GameMain.NetworkMember.CharacterInfo); UpdatePreviewPlayer(GameMain.NetworkMember.CharacterInfo);
return true; return true;
@@ -273,7 +273,7 @@ namespace Subsurface
{ {
if (i == selectedSound) 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); Debug.WriteLine("playing: " + s.sound);
return; return;
} }
+4 -2
View File
@@ -234,11 +234,11 @@ namespace Subsurface
loadedSounds.Remove(this); loadedSounds.Remove(this);
System.Diagnostics.Debug.WriteLine("Removing sound " + filePath + " (buffer id" + AlBufferId + ")");
if (alSourceId>0 && SoundManager.IsPlaying(alSourceId)) if (alSourceId>0 && SoundManager.IsPlaying(alSourceId))
{ {
ALHelper.Check();
SoundManager.Stop(alSourceId); SoundManager.Stop(alSourceId);
ALHelper.Check();
} }
foreach (Sound s in loadedSounds) foreach (Sound s in loadedSounds)
@@ -246,6 +246,8 @@ namespace Subsurface
if (s.oggSound == oggSound) return; if (s.oggSound == oggSound) return;
} }
System.Diagnostics.Debug.WriteLine("Removing sound " + filePath + " (buffer id" + AlBufferId + ")");
SoundManager.ClearAlSource(AlBufferId); SoundManager.ClearAlSource(AlBufferId);
oggSound.Dispose(); oggSound.Dispose();
} }
-1
View File
@@ -218,7 +218,6 @@ namespace Subsurface.Sounds
if (AL.GetSourceState(alSources[sourceIndex]) != ALSourceState.Paused) if (AL.GetSourceState(alSources[sourceIndex]) != ALSourceState.Paused)
return; return;
Debug.WriteLine("sourceplay");
AL.SourcePlay(alSources[sourceIndex]); AL.SourcePlay(alSources[sourceIndex]);
ALHelper.Check(); ALHelper.Check();
} }
+2
View File
@@ -10,6 +10,8 @@ namespace Subsurface
{ {
public static class UpdaterUtil public static class UpdaterUtil
{ {
public const string Version = "1.0";
public static void SaveFileList(string filePath) public static void SaveFileList(string filePath)
{ {
XDocument doc = new XDocument(CreateFileList()); XDocument doc = new XDocument(CreateFileList());
Binary file not shown.