Merge remote-tracking branch 'refs/remotes/barotrauma/master'

Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/GameSettings.cs
	Subsurface/Source/Items/CharacterInventory.cs
	Subsurface/Source/Items/Components/ItemComponent.cs
	Subsurface/Source/Items/Components/Machines/Pump.cs
	Subsurface/Source/Items/Components/Machines/Radar.cs
	Subsurface/Source/Items/Components/Machines/Steering.cs
	Subsurface/Source/Items/Components/Power/PowerContainer.cs
	Subsurface/Source/Items/Inventory.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Items/ItemSpawner.cs
	Subsurface/Source/Map/Levels/WaterRenderer.cs
	Subsurface/Source/Map/LinkedSubmarine.cs
	Subsurface/Source/Map/Map/Map.cs
	Subsurface/Source/Map/Structure.cs
	Subsurface/Source/Map/Submarine.cs
	Subsurface/Source/Map/WayPoint.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Physics/PhysicsBody.cs
	Subsurface/Source/Screens/GameScreen.cs
This commit is contained in:
juanjp600
2016-10-11 20:19:25 -03:00
130 changed files with 4428 additions and 67178 deletions
+46 -23
View File
@@ -38,7 +38,7 @@ namespace Barotrauma
private Tutorials.EditorTutorial tutorial;
public Camera Cam
public override Camera Cam
{
get { return cam; }
}
@@ -835,6 +835,11 @@ namespace Barotrauma
}
else
{
foreach (MapEntity me in MapEntity.mapEntityList)
{
me.IsHighlighted = false;
}
if (dummyCharacter.SelectedConstruction==null)
{
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(dummyCharacter.CursorPosition);
@@ -861,6 +866,13 @@ namespace Barotrauma
GUIComponent.MouseOn = null;
if (!characterMode && !wiringMode)
{
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(cam);
MapEntity.UpdateEditor(cam);
}
leftPanel.Update((float)deltaTime);
topPanel.Update((float)deltaTime);
@@ -872,7 +884,7 @@ namespace Barotrauma
}
wiringToolPanel.Update((float)deltaTime);
}
if (loadFrame!=null)
{
loadFrame.Update((float)deltaTime);
@@ -887,6 +899,34 @@ namespace Barotrauma
GUItabs[selectedTab].Update((float)deltaTime);
if (PlayerInput.RightButtonClicked()) selectedTab = -1;
}
if ((characterMode || wiringMode) && dummyCharacter != null)
{
dummyCharacter.AnimController.FindHull(dummyCharacter.CursorWorldPosition, false);
foreach (Item item in dummyCharacter.SelectedItems)
{
if (item == null) continue;
item.SetTransform(dummyCharacter.SimPosition, 0.0f);
item.Update(cam, (float)deltaTime);
}
if (dummyCharacter.SelectedConstruction != null)
{
if (dummyCharacter.SelectedConstruction != null)
{
dummyCharacter.SelectedConstruction.UpdateHUD(cam, dummyCharacter);
}
if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.ClosestItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null;
}
CharacterHUD.Update((float)deltaTime, dummyCharacter);
}
GUI.Update((float)deltaTime);
}
/// <summary>
@@ -913,7 +953,7 @@ namespace Barotrauma
if (!characterMode && !wiringMode)
{
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.UpdatePlacing(spriteBatch, cam);
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.DrawPlacing(spriteBatch,cam);
MapEntity.DrawSelecting(spriteBatch, cam);
}
@@ -932,28 +972,11 @@ namespace Barotrauma
if ((characterMode || wiringMode) && dummyCharacter != null)
{
foreach (MapEntity me in MapEntity.mapEntityList)
{
me.IsHighlighted = false;
}
dummyCharacter.AnimController.FindHull(dummyCharacter.CursorWorldPosition, false);
foreach (Item item in dummyCharacter.SelectedItems)
{
if (item == null) continue;
item.SetTransform(dummyCharacter.SimPosition, 0.0f);
item.Update(cam, (float)deltaTime);
}
if (dummyCharacter.SelectedConstruction != null)
{
dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, dummyCharacter);
if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.ClosestItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null;
dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, cam, dummyCharacter);
}
dummyCharacter.DrawHUD(spriteBatch, cam);
if (wiringMode) wiringToolPanel.Draw(spriteBatch);
@@ -973,7 +996,7 @@ namespace Barotrauma
GUItabs[selectedTab].Draw(spriteBatch);
}
MapEntity.Edit(spriteBatch, cam);
MapEntity.DrawEditor(spriteBatch, cam);
}
if (tutorial != null) tutorial.Draw(spriteBatch);
+15 -17
View File
@@ -24,7 +24,7 @@ namespace Barotrauma
public BackgroundCreatureManager BackgroundCreatureManager;
public Camera Cam
public override Camera Cam
{
get { return cam; }
}
@@ -46,13 +46,13 @@ namespace Barotrauma
#if LINUX
var blurEffect = content.Load<Effect>("blurshader_opengl");
damageEffect = content.Load<Effect>("damageshader_opengl");
#else
var blurEffect = content.Load<Effect>("blurshader");
damageEffect = content.Load<Effect>("damageshader");
#endif
damageStencil = TextureLoader.FromFile("Content/Map/walldamage.png");
damageEffect = content.Load<Effect>("damageshader");
damageEffect.Parameters["xStencil"].SetValue(damageStencil);
damageEffect.Parameters["aMultiplier"].SetValue(50.0f);
damageEffect.Parameters["cMultiplier"].SetValue(200.0f);
@@ -95,6 +95,9 @@ namespace Barotrauma
#if DEBUG
if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null)
{
var closestSub = Submarine.GetClosest(cam.WorldViewCenter);
if (closestSub == null) closestSub = GameMain.GameSession.Submarine;
Vector2 targetMovement = Vector2.Zero;
if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f;
if (PlayerInput.KeyDown(Keys.K)) targetMovement.Y -= 1.0f;
@@ -102,10 +105,9 @@ namespace Barotrauma
if (PlayerInput.KeyDown(Keys.L)) targetMovement.X += 1.0f;
if (targetMovement != Vector2.Zero)
GameMain.GameSession.Submarine.ApplyForce(targetMovement * GameMain.GameSession.Submarine.SubBody.Body.Mass * 100.0f);
closestSub.ApplyForce(targetMovement * closestSub.SubBody.Body.Mass * 100.0f);
}
#endif
if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime);
if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime);
@@ -114,12 +116,11 @@ namespace Barotrauma
{
if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem)
{
Character.Controlled.SelectedConstruction.UpdateHUD(Character.Controlled);
Character.Controlled.SelectedConstruction.UpdateHUD(cam, Character.Controlled);
}
}
Character.UpdateAll(cam, (float)deltaTime);
BackgroundCreatureManager.Update(cam, (float)deltaTime);
GameMain.ParticleManager.Update((float)deltaTime);
@@ -130,6 +131,8 @@ namespace Barotrauma
{
cam.TargetPos = Lights.LightManager.ViewTarget.WorldPosition;
}
GameMain.LightManager.Update((float)deltaTime);
cam.MoveCamera((float)deltaTime);
foreach (Submarine sub in Submarine.Loaded)
@@ -168,10 +171,6 @@ namespace Barotrauma
{
cam.UpdateTransform(true);
if (Hull.renderer != null)
{
Hull.renderer.ScrollWater((float)deltaTime);
}
DrawMap(graphics, spriteBatch);
spriteBatch.Begin();
@@ -180,7 +179,7 @@ namespace Barotrauma
{
if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem)
{
Character.Controlled.SelectedConstruction.DrawHUD(spriteBatch, Character.Controlled);
Character.Controlled.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Controlled);
}
else if (!Character.Controlled.SelectedConstruction.IsInPickRange(Character.Controlled.WorldPosition))
{
@@ -211,7 +210,7 @@ namespace Barotrauma
GameMain.LightManager.ObstructVision = Character.Controlled != null && Character.Controlled.ObstructVision;
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam);
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam, lightBlur.Effect);
if (Character.Controlled != null)
{
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
@@ -345,8 +344,7 @@ namespace Barotrauma
spriteBatch.End();
GameMain.LightManager.DrawLightMap(spriteBatch, cam, lightBlur.Effect);
GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect);
spriteBatch.Begin(SpriteSortMode.BackToFront,
BlendState.AlphaBlend, SamplerState.LinearWrap,
@@ -355,13 +353,13 @@ namespace Barotrauma
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch);
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch,cam);
spriteBatch.End();
if (Character.Controlled != null)
{
GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam, lightBlur.Effect);
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect);
}
}
+59 -63
View File
@@ -9,7 +9,7 @@ namespace Barotrauma
{
class LobbyScreen : Screen
{
enum PanelTab { Crew = 0, Map = 1, CurrentLocation = 2, Store = 3 }
enum PanelTab { Crew = 0, Map = 1, Store = 3 }
private GUIFrame topPanel;
private GUIFrame[] bottomPanel;
@@ -72,19 +72,15 @@ namespace Barotrauma
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
moneyText.TextGetter = GetMoney;
GUIButton button = new GUIButton(new Rectangle(-360, 0, 100, 30), "Map", null, Alignment.BottomRight, GUI.Style, topPanel);
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.Map;
button.OnClicked = SelectRightPanel;
SelectRightPanel(button, button.UserData);
button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Crew", null, Alignment.BottomRight, GUI.Style, topPanel);
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.Crew;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Hire", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.CurrentLocation;
button.OnClicked = SelectRightPanel;
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, GUI.Style, topPanel);
button.UserData = PanelTab.Store;
button.OnClicked = SelectRightPanel;
@@ -106,7 +102,9 @@ namespace Barotrauma
//new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, GUI.Style, bottomPanel[(int)PanelTab.Crew]);
int crewColumnWidth = Math.Min(300, (panelRect.Width - 40) / 2);
characterList = new GUIListBox(new Rectangle(0, 0, crewColumnWidth, 0), GUI.Style, bottomPanel[(int)PanelTab.Crew]);
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", GUI.Style, bottomPanel[(int)PanelTab.Crew], GUI.LargeFont);
characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), GUI.Style, bottomPanel[(int)PanelTab.Crew]);
characterList.OnSelected = SelectCharacter;
//---------------------------------------
@@ -118,12 +116,7 @@ namespace Barotrauma
Alignment.BottomRight, GUI.Style, bottomPanel[(int)PanelTab.Map]);
startButton.OnClicked = StartShift;
startButton.Enabled = false;
//---------------------------------------
bottomPanel[(int)PanelTab.CurrentLocation] = new GUIFrame(panelRect, GUI.Style);
bottomPanel[(int)PanelTab.CurrentLocation].Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
//---------------------------------------
bottomPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, GUI.Style);
@@ -131,13 +124,13 @@ namespace Barotrauma
int sellColumnWidth = (panelRect.Width - 40) / 2 - 20;
selectedItemList = new GUIListBox(new Rectangle(0, 0, sellColumnWidth, 400), Color.White * 0.7f, GUI.Style, bottomPanel[(int)PanelTab.Store]);
selectedItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, GUI.Style, bottomPanel[(int)PanelTab.Store]);
selectedItemList.OnSelected = DeselectItem;
var costText = new GUITextBlock(new Rectangle(0, 0, 100, 25), "Cost: ", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, bottomPanel[(int)PanelTab.Store]);
costText.TextGetter = CostTextGetter;
buyButton = new GUIButton(new Rectangle(sellColumnWidth + 20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
buyButton = new GUIButton(new Rectangle(selectedItemList.Rect.Width - 100, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
buyButton.OnClicked = BuyItems;
storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
@@ -158,10 +151,7 @@ namespace Barotrauma
SelectItemCategory(categoryButton, category);
}
x += 110;
}
}
}
public override void Select()
@@ -170,49 +160,51 @@ namespace Barotrauma
gameMode = GameMain.GameSession.gameMode as SinglePlayerMode;
foreach (GUIComponent component in topPanel.children)
{
var button = component as GUIButton;
if (button == null || button.Text != "Hire") continue;
button.Enabled = GameMain.GameSession.Map.CurrentLocation.Type.HasHireableCharacters;
break;
}
UpdateCharacterLists();
}
private void UpdateLocationTab(Location location)
{
topPanel.RemoveChild(topPanel.FindChild("locationtitle"));
topPanel.UserData = location;
var locationTitle = new GUITextBlock(new Rectangle(0, 0, 200, 25),
"Location: "+location.Name, Color.Transparent, Color.White, Alignment.TopLeft, GUI.Style, topPanel);
locationTitle.UserData = "locationtitle";
locationTitle.Font = GUI.LargeFont;
bottomPanel[(int)PanelTab.CurrentLocation].ClearChildren();
bottomPanel[(int)PanelTab.CurrentLocation].UserData = location;
if (location.HireManager != null)
if (hireList == null)
{
hireList = new GUIListBox(new Rectangle(0, 0, 300, 0), GUI.Style, Alignment.Left, bottomPanel[(int)PanelTab.CurrentLocation]);
hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), GUI.Style, Alignment.Right, bottomPanel[(int)PanelTab.Crew]);
new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", GUI.Style, Alignment.Right, Alignment.Left, bottomPanel[(int)PanelTab.Crew], false, GUI.LargeFont);
hireList.OnSelected = SelectCharacter;
hireList.ClearChildren();
foreach (CharacterInfo c in location.HireManager.availableCharacters)
{
var frame = c.CreateCharacterFrame(hireList, c.Name + " (" + c.Job.Name + ")", c);
new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Salary.ToString(),
null, null,
Alignment.TopRight, GUI.Style, frame);
}
}
if (location.HireManager == null)
{
hireList.ClearChildren();
hireList.Enabled = false;
new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, GUI.Style, hireList);
return;
}
hireList.Enabled = true;
hireList.ClearChildren();
foreach (CharacterInfo c in location.HireManager.availableCharacters)
{
var frame = c.CreateCharacterFrame(hireList, c.Name + " (" + c.Job.Name + ")", c);
new GUITextBlock(
new Rectangle(0, 0, 0, 25),
c.Salary.ToString(),
null, null,
Alignment.TopRight, GUI.Style, frame);
}
}
@@ -273,6 +265,8 @@ namespace Barotrauma
frame.HoverColor = Color.Gold * 0.2f;
frame.SelectedColor = Color.Gold * 0.5f;
frame.ToolTip = ep.Description;
SpriteFont font = listBox.Rect.Width < 280 ? GUI.SmallFont : GUI.Font;
GUITextBlock textBlock = new GUITextBlock(
@@ -283,6 +277,7 @@ namespace Barotrauma
null, frame);
textBlock.Font = font;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
textBlock.ToolTip = ep.Description;
if (ep.sprite != null)
{
@@ -297,6 +292,7 @@ namespace Barotrauma
null, null, Alignment.TopLeft,
Alignment.TopLeft, GUI.Style, frame);
textBlock.Font = font;
textBlock.ToolTip = ep.Description;
}
@@ -334,15 +330,14 @@ namespace Barotrauma
{
GUIComponent child = selectedItemList.children[i];
MapEntityPrefab ep = child.UserData as MapEntityPrefab;
if (ep == null) continue;
ItemPrefab ip = child.UserData as ItemPrefab;
if (ip == null) continue;
gameMode.CargoManager.AddItem(ep);
gameMode.CargoManager.AddItem(ip);
selectedItemList.RemoveChild(child);
}
return false;
}
@@ -365,7 +360,6 @@ namespace Barotrauma
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{
if (characterList.CountChildren != CrewManager.characterInfos.Count)
{
UpdateCharacterLists();
@@ -431,12 +425,7 @@ namespace Barotrauma
private bool SelectItemCategory(GUIButton button, object selection)
{
if (!(selection is MapEntityCategory)) return false;
//var existingList = bottomPanel[(int)PanelTab.Store].children.Find(c => c is GUIListBox && c.UserData is MapEntityCategory);
//if (existingList != null) bottomPanel[(int)PanelTab.Store].RemoveChild(existingList);
//bottomPanel[(int)PanelTab.Store].AddChild(storeItemLists[(int)selection]);
storeItemList.ClearChildren();
@@ -485,27 +474,32 @@ namespace Barotrauma
CharacterInfo characterInfo = selection as CharacterInfo;
if (characterInfo == null) return false;
characterList.Deselect();
hireList.Deselect();
if (Character.Controlled != null && characterInfo == Character.Controlled.Info) return false;
if (previewFrame == null || previewFrame.UserData != characterInfo)
{
previewFrame = new GUIFrame(new Rectangle(bottomPanel[(int)PanelTab.Crew].Rect.Width/2, 60, Math.Min(300,bottomPanel[(int)PanelTab.Crew].Rect.Width/2 - 40), 300),
int width = Math.Min(300, bottomPanel[(int)PanelTab.Crew].Rect.Width - hireList.Rect.Width - characterList.Rect.Width - 50);
previewFrame = new GUIFrame(new Rectangle(0, 60, width, 300),
new Color(0.0f, 0.0f, 0.0f, 0.8f),
Alignment.Top, GUI.Style, bottomPanel[selectedRightPanel]);
Alignment.TopCenter, GUI.Style, bottomPanel[selectedRightPanel]);
previewFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
previewFrame.UserData = characterInfo;
characterInfo.CreateInfoFrame(previewFrame);
}
if (selectedRightPanel == (int)PanelTab.CurrentLocation)
if (component.Parent == hireList)
{
GUIButton hireButton = new GUIButton(new Rectangle(0,0, 100, 20), "Hire", Alignment.BottomCenter, GUI.Style, previewFrame);
hireButton.UserData = characterInfo;
hireButton.OnClicked = HireCharacter;
}
return false;
return true;
}
private bool HireCharacter(GUIButton button, object selection)
@@ -516,6 +510,8 @@ namespace Barotrauma
if (gameMode.TryHireCharacter(GameMain.GameSession.Map.CurrentLocation.HireManager, characterInfo))
{
UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation);
SelectCharacter(null,null);
}
+1 -10
View File
@@ -417,16 +417,7 @@ namespace Barotrauma
string saveTime = ToolBox.GetAttributeString(doc.Root, "savetime", "unknown");
XElement modeElement = null;
foreach (XElement element in doc.Root.Elements())
{
if (element.Name.ToString().ToLowerInvariant() != "gamemode") continue;
modeElement = element;
break;
}
string mapseed = ToolBox.GetAttributeString(modeElement, "mapseed", "unknown");
string mapseed = ToolBox.GetAttributeString(doc.Root, "mapseed", "unknown");
GUIFrame saveFileFrame = new GUIFrame(new Rectangle((int)(saveList.Rect.Width + 20), 0, 200, 230), Color.Black*0.4f, GUI.Style, menuTabs[(int)Tab.LoadGame]);
saveFileFrame.UserData = "savefileframe";
+5
View File
@@ -28,6 +28,11 @@ namespace Barotrauma
selected = this;
}
public virtual Camera Cam
{
get { return null; }
}
public virtual void Update(double deltaTime)
{
}