Merged linux changes, fixed first item in inventory not being loaded, fixed levels breaking if re-entering the same level

This commit is contained in:
Regalis
2015-11-19 16:29:13 +02:00
parent 118d60342a
commit f42cc78af3
23 changed files with 42 additions and 65 deletions
+1 -1
View File
@@ -394,7 +394,7 @@ namespace Barotrauma
{
for (ushort i = 0; i < Info.PickedItemIDs.Count; i++ )
{
if (i == 0) continue;
if (Info.PickedItemIDs[i] == 0) continue;
Item item = FindEntityByID(Info.PickedItemIDs[i]) as Item;
if (item == null) continue;
@@ -165,11 +165,18 @@ namespace EventInput
(int)Marshal.GetFunctionPointerForDelegate(hookProcDelegate));
hIMC = ImmGetContext(window.Handle);
#elif LINUX
window.TextInput += ReceiveInput;
#endif
initialized = true;
}
private static void ReceiveInput(object sender, TextInputEventArgs e)
{
OnCharEntered(e.Character);
}
public static void OnCharEntered(char character)
{
if (CharEntered != null) CharEntered(null, new CharacterEventArgs(character, 0));
+13
View File
@@ -54,6 +54,19 @@ namespace Barotrauma
get { return textBlock.TextColor; }
set { textBlock.TextColor = value; }
}
public override SpriteFont Font
{
get
{
return (textBlock==null) ? GUI.Font : textBlock.Font;
}
set
{
if (textBlock == null) return;
base.Font = value;
}
}
public string Text
{
+2
View File
@@ -101,6 +101,8 @@ namespace Barotrauma
{
Graphics = new GraphicsDeviceManager(this);
Window.Title = "Barotrauma";
Instance = this;
Config = new GameSettings("config.xml");
@@ -143,11 +143,13 @@ namespace Barotrauma
if (Level.Loaded.AtEndPosition)
{
endShiftButton.Text = "Enter " + Map.SelectedLocation.Name;
endShiftButton.Font = GUI.SmallFont;
endShiftButton.Draw(spriteBatch);
}
else if (Level.Loaded.AtStartPosition)
{
endShiftButton.Text = "Enter " + Map.CurrentLocation.Name;
endShiftButton.Font = GUI.SmallFont;
endShiftButton.Draw(spriteBatch);
}
-5
View File
@@ -582,11 +582,6 @@ namespace Barotrauma
if (body.LinearVelocity != Vector2.Zero && body.LinearVelocity.Length() > 1000.0f)
{
body.ResetDynamics();
if (body.SimPosition.Length() > 1000.0f)
{
Remove();
return;
}
}
body.ApplyForce(buoyancy - body.LinearVelocity * volume);
+3 -12
View File
@@ -1,4 +1,5 @@
using FarseerPhysics;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Barotrauma.Lights;
using System;
@@ -79,17 +80,7 @@ namespace Barotrauma
if (force == 0.0f && attack.Stun == 0.0f && attack.GetDamage(1.0f) == 0.0f) return;
Hull hull = Hull.FindHull(displayPosition);
foreach (Item item in Item.ItemList)
{
if (item.body == null || item.CurrentHull != hull) continue;
Vector2 dir = (item.SimPosition == simPosition) ? Rand.Vector(1.0f) : Vector2.Normalize(item.SimPosition - simPosition);
float distFactor = 1.0f - Vector2.Distance(item.SimPosition, simPosition) / attack.Range;
item.body.ApplyLinearImpulse(dir * distFactor * force);
}
//Hull hull = Hull.FindHull(displayPosition);
foreach (Character c in Character.CharacterList)
{
+2
View File
@@ -962,6 +962,8 @@ namespace Barotrauma
bodies.Clear();
bodies = null;
loaded = null;
//vertexBuffer.Dispose();
//vertexBuffer = null;
}
-17
View File
@@ -309,23 +309,6 @@ namespace Barotrauma
if (timeSinceClick < doubleClickDelay) doubleClicked = true;
timeSinceClick = 0.0;
}
#if LINUX
foreach (Keys key in keyboardState.GetPressedKeys())
{
if (!oldKeyboardState.IsKeyUp(key)) continue;
char Character = (char)key;
if (keyboardState.IsKeyUp(Keys.LeftShift) && keyboardState.IsKeyUp(Keys.RightShift))
{
Character = char.ToLower(Character);
}
EventInput.EventInput.OnCharEntered(Character);
}
#endif
}
}
}