Progress on tutorial, gap tweaking (water flows faster from room to room), UPnP error messages, input keys in array, underwater aiming tweaking, tons of misc stuff commit more often ffs
This commit is contained in:
@@ -129,12 +129,12 @@ namespace Subsurface
|
||||
|
||||
currBrightness -= 0.1f;
|
||||
|
||||
yield return Status.Running;
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
light.Remove();
|
||||
|
||||
yield return Status.Success;
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,12 +249,20 @@ namespace Subsurface
|
||||
{
|
||||
pos.Y = ConvertUnits.ToSimUnits(MathHelper.Clamp(lowerSurface, rect.Y-rect.Height, rect.Y));
|
||||
|
||||
Game1.ParticleManager.CreateParticle("watersplash",
|
||||
var particle = Game1.ParticleManager.CreateParticle("watersplash",
|
||||
new Vector2(pos.X, pos.Y - Rand.Range(0.0f, 0.1f)),
|
||||
new Vector2(flowForce.X * Rand.Range(0.005f, 0.007f), flowForce.Y * Rand.Range(0.005f, 0.007f)));
|
||||
new Vector2(
|
||||
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.005f, 0.007f),
|
||||
flowForce.Y * Rand.Range(0.005f, 0.007f)));
|
||||
if (particle!=null)
|
||||
{
|
||||
particle.Size = particle.Size * Math.Abs(flowForce.X / 1000.0f);
|
||||
|
||||
}
|
||||
|
||||
pos.Y = ConvertUnits.ToSimUnits(Rand.Range(lowerSurface, rect.Y - rect.Height));
|
||||
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
|
||||
|
||||
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -312,7 +320,7 @@ namespace Subsurface
|
||||
flowTargetHull = hull1;
|
||||
|
||||
//make sure not to move more than what the room contains
|
||||
delta = Math.Min((hull2.Pressure - hull1.Pressure) * sizeModifier, Math.Min(hull2.Volume, hull2.FullVolume));
|
||||
delta = Math.Min((hull2.Pressure - hull1.Pressure) * 5.0f * sizeModifier, Math.Min(hull2.Volume, hull2.FullVolume));
|
||||
|
||||
//make sure not to place more water to the target room than it can hold
|
||||
delta = Math.Min(delta, hull1.FullVolume + Hull.MaxCompress - (hull1.Volume));
|
||||
@@ -331,7 +339,7 @@ namespace Subsurface
|
||||
flowTargetHull = hull2;
|
||||
|
||||
//make sure not to move more than what the room contains
|
||||
delta = Math.Min((hull1.Pressure - hull2.Pressure) * sizeModifier, Math.Min(hull1.Volume, hull1.FullVolume));
|
||||
delta = Math.Min((hull1.Pressure - hull2.Pressure) * 5.0f * sizeModifier, Math.Min(hull1.Volume, hull1.FullVolume));
|
||||
|
||||
//make sure not to place more water to the target room than it can hold
|
||||
delta = Math.Min(delta, hull2.FullVolume + Hull.MaxCompress - (hull2.Volume));
|
||||
@@ -405,7 +413,7 @@ namespace Subsurface
|
||||
flowTargetHull = hull2;
|
||||
|
||||
//make sure the amount of water moved isn't more than what the room contains
|
||||
float delta = Math.Min(hull1.Volume, deltaTime * 10000f * sizeModifier);
|
||||
float delta = Math.Min(hull1.Volume, deltaTime * 25000f * sizeModifier);
|
||||
//make sure not to place more water to the target room than it can hold
|
||||
delta = Math.Min(delta, (hull2.FullVolume + Math.Max(hull1.Volume - hull1.FullVolume, 0.0f)) - hull2.Volume + Hull.MaxCompress / 4.0f);
|
||||
|
||||
|
||||
@@ -122,8 +122,8 @@ namespace Subsurface
|
||||
|
||||
public static Level CreateRandom(LocationConnection locationConnection)
|
||||
{
|
||||
int seed = locationConnection.Locations[0].GetHashCode() | locationConnection.Locations[1].GetHashCode();
|
||||
return new Level(seed.ToString(), locationConnection.Difficulty, 100000, 40000, 2000);
|
||||
string seed = locationConnection.Locations[0].Name + locationConnection.Locations[1].Name;
|
||||
return new Level(seed, locationConnection.Difficulty, 100000, 40000, 2000);
|
||||
}
|
||||
|
||||
public static Level CreateRandom(string seed = "")
|
||||
@@ -153,7 +153,7 @@ namespace Subsurface
|
||||
|
||||
bodies = new List<Body>();
|
||||
|
||||
Random rand = new Random(seed.GetHashCode());
|
||||
Random rand = new Random(ToolBox.StringToInt(seed));
|
||||
|
||||
float siteVariance = siteInterval * 0.8f;
|
||||
for (int x = siteInterval / 2; x < borders.Width; x += siteInterval)
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Subsurface.Lights
|
||||
shadowEffect.TextureEnabled = true;
|
||||
//shadowEffect.VertexColorEnabled = true;
|
||||
shadowEffect.LightingEnabled = false;
|
||||
shadowEffect.Texture = Game1.TextureLoader.FromFile("Content/lights/penumbra.png");
|
||||
shadowEffect.Texture = Game1.TextureLoader.FromFile("Content/Lights/penumbra.png");
|
||||
}
|
||||
|
||||
//compute facing of each edge, using N*L
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Subsurface
|
||||
if (iceCraters == null) iceCraters = Game1.TextureLoader.FromFile("Content/Map/iceCraters.png");
|
||||
if (iceCrack == null) iceCrack = Game1.TextureLoader.FromFile("Content/Map/iceCrack.png");
|
||||
|
||||
Rand.SetSyncedSeed(this.seed.GetHashCode());
|
||||
Rand.SetSyncedSeed(ToolBox.StringToInt(this.seed));
|
||||
|
||||
GenerateLocations();
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Subsurface
|
||||
newLocations[i] = Location.CreateRandom(position);
|
||||
locations.Add(newLocations[i]);
|
||||
}
|
||||
int seed = (newLocations[0].GetHashCode() | newLocations[1].GetHashCode());
|
||||
//int seed = (newLocations[0].GetHashCode() | newLocations[1].GetHashCode());
|
||||
connections.Add(new LocationConnection(newLocations[0], newLocations[1]));
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,11 @@ namespace Subsurface
|
||||
shortHash = GetShortHash(hash);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return hash;
|
||||
}
|
||||
|
||||
private string CalculateHash(FileStream stream)
|
||||
{
|
||||
MD5 md5 = MD5.Create();
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Subsurface
|
||||
|
||||
class Structure : MapEntity, IDamageable
|
||||
{
|
||||
static int wallSectionSize = 100;
|
||||
public static int wallSectionSize = 100;
|
||||
public static List<Structure> wallList = new List<Structure>();
|
||||
|
||||
ConvexHull convexHull;
|
||||
@@ -97,12 +97,7 @@ namespace Subsurface
|
||||
{
|
||||
get { return prefab.MaxHealth; }
|
||||
}
|
||||
|
||||
public AITarget AiTarget
|
||||
{
|
||||
get { return null;}
|
||||
}
|
||||
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
{
|
||||
base.Move(amount);
|
||||
@@ -368,6 +363,20 @@ namespace Subsurface
|
||||
return (sections[sectionIndex].damage>=prefab.MaxHealth);
|
||||
}
|
||||
|
||||
public bool SectionIsLeaking(int sectionIndex)
|
||||
{
|
||||
if (sectionIndex < 0 || sectionIndex >= sections.Length) return false;
|
||||
|
||||
return (sections[sectionIndex].damage >= prefab.MaxHealth*0.5f);
|
||||
}
|
||||
|
||||
public int SectionLength(int sectionIndex)
|
||||
{
|
||||
if (sectionIndex < 0 || sectionIndex >= sections.Length) return 0;
|
||||
|
||||
return (isHorizontal ? sections[sectionIndex].rect.Width : sections[sectionIndex].rect.Height);
|
||||
}
|
||||
|
||||
public void AddDamage(int sectionIndex, float damage)
|
||||
{
|
||||
if (!prefab.HasBody || prefab.IsPlatform) return;
|
||||
@@ -428,7 +437,7 @@ namespace Subsurface
|
||||
if (!prefab.HasBody) return;
|
||||
|
||||
if (damage != sections[sectionIndex].damage)
|
||||
new NetworkEvent(ID, false);
|
||||
new NetworkEvent(NetworkEventType.UpdateEntity, ID, false, sectionIndex);
|
||||
|
||||
if (damage < prefab.MaxHealth*0.5f)
|
||||
{
|
||||
@@ -615,19 +624,40 @@ namespace Subsurface
|
||||
|
||||
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
{
|
||||
for (int i = 0; i < sections.Length; i++ )
|
||||
int sectionIndex = 0;
|
||||
byte byteIndex = 0;
|
||||
|
||||
try
|
||||
{
|
||||
message.Write(sections[i].damage);
|
||||
sectionIndex = (int)data;
|
||||
byteIndex = (byte)sectionIndex;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
message.Write(byteIndex);
|
||||
message.Write(sections[sectionIndex].damage);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
{
|
||||
for (int i = 0; i < sections.Length; i++)
|
||||
int sectionIndex = 0;
|
||||
float damage = 0.0f;
|
||||
|
||||
try
|
||||
{
|
||||
float damage = message.ReadFloat();
|
||||
if (damage != sections[i].damage) SetDamage(i, damage);
|
||||
sectionIndex = message.ReadByte();
|
||||
damage = message.ReadFloat();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetDamage(sectionIndex, damage);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Subsurface
|
||||
private set;
|
||||
}
|
||||
|
||||
public Md5Hash Hash
|
||||
public Md5Hash MD5Hash
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -115,6 +115,11 @@ namespace Subsurface
|
||||
public Vector2 Speed
|
||||
{
|
||||
get { return speed; }
|
||||
set
|
||||
{
|
||||
if (!MathUtils.IsValid(value)) return;
|
||||
speed = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string FilePath
|
||||
@@ -773,7 +778,7 @@ namespace Subsurface
|
||||
try
|
||||
{
|
||||
// Get the type of a specified class.
|
||||
t = Type.GetType("Subsurface." + typeName + ", Subsurface", true, true);
|
||||
t = Type.GetType("Subsurface." + typeName, true, true);
|
||||
if (t == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in " + filePath + "! Could not find a entity of the type ''" + typeName + "''.");
|
||||
|
||||
@@ -56,8 +56,13 @@ namespace Subsurface
|
||||
//vertexBuffer.SetData(vertices);
|
||||
|
||||
//effect = Game1.game.Content.Load<Effect>("effects");
|
||||
#if WINDOWS
|
||||
byte[] bytecode = File.ReadAllBytes("Content/effects.mgfx");
|
||||
#endif
|
||||
#if LINUX
|
||||
byte[] bytecode = File.ReadAllBytes("Content/effects_linux.mgfx");
|
||||
#endif
|
||||
|
||||
byte[] bytecode = File.ReadAllBytes("Content/effects.mgfx");
|
||||
effect = new Effect(graphicsDevice, bytecode);
|
||||
|
||||
//Texture2D waterBumpMap = Game1.textureLoader.FromFile("Content/waterbump.jpg");
|
||||
|
||||
Reference in New Issue
Block a user