diff --git a/.vs/Subsurface_Solution/v14/.suo b/.vs/Subsurface_Solution/v14/.suo
index 7351f4633..33c17251c 100644
Binary files a/.vs/Subsurface_Solution/v14/.suo and b/.vs/Subsurface_Solution/v14/.suo differ
diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index b86e05d78..b6028af16 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -102,6 +102,8 @@
+
+
@@ -391,6 +393,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -831,7 +836,7 @@
PreserveNewest
Designer
-
+
PreserveNewest
diff --git a/Subsurface/Content/InfoTexts.xml b/Subsurface/Content/InfoTexts.xml
new file mode 100644
index 000000000..f22898e21
--- /dev/null
+++ b/Subsurface/Content/InfoTexts.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ [sub] has returned to [location1].
+ The ocean has claimed [sub] and its crew.
+
+ Succumbed to their injuries
+ Bled out
+ Drowned
+ Suffocated
+ Crushed by water pressure
+ Burned to death
+
+ You have succumbed to your injuries.
+ You have bled out.
+ You have drowned.
+ You have suffocated.
+ You have been crushed by water pressure.
+ You have burned to death.
+
+
\ No newline at end of file
diff --git a/Subsurface/Content/Quests.xml b/Subsurface/Content/Missions.xml
similarity index 93%
rename from Subsurface/Content/Quests.xml
rename to Subsurface/Content/Missions.xml
index 281ca49a1..8d15fabde 100644
--- a/Subsurface/Content/Quests.xml
+++ b/Subsurface/Content/Missions.xml
@@ -1,6 +1,6 @@
-
-
+
-
+
-
-
+
-
-
+
-
-
+
-
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index 2ea2b63b8..e45b57d38 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -17,8 +17,6 @@ namespace Barotrauma
class Character : Entity, IDamageable, IPropertyObject
{
- public static string[] DeathMsg = new string[Enum.GetNames(typeof(CauseOfDeath)).Length];
-
public static List CharacterList = new List();
public static Queue NewCharacterQueue = new Queue();
@@ -282,16 +280,9 @@ namespace Barotrauma
{
get { return AnimController.RefLimb.Position; }
}
-
- static Character()
- {
- DeathMsg[(int)CauseOfDeath.Damage] = "succumbed to your injuries";
- DeathMsg[(int)CauseOfDeath.Bloodloss] = "bled out";
- DeathMsg[(int)CauseOfDeath.Drowning] = "drowned";
- DeathMsg[(int)CauseOfDeath.Suffocation] = "suffocated";
- DeathMsg[(int)CauseOfDeath.Pressure] = "been crushed by water pressure";
- DeathMsg[(int)CauseOfDeath.Burn] = "burnt to death";
- }
+
+ public delegate void OnDeathHandler(Character character, CauseOfDeath causeOfDeath);
+ public OnDeathHandler OnDeath;
public static Character Create(string file, Vector2 position)
{
@@ -1159,7 +1150,7 @@ namespace Barotrauma
//if the Character is controlled by this client/server, let others know that the Character has died
if (Character.controlled == this)
{
- string chatMessage = "You have " + DeathMsg[(int)causeOfDeath] + ".";
+ string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString());
if (GameMain.Client!=null) chatMessage += " Your chat messages will only be visible to other dead players.";
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
@@ -1179,6 +1170,8 @@ namespace Barotrauma
}
}
+ if (OnDeath != null) OnDeath(this, causeOfDeath);
+
CoroutineManager.StartCoroutine(DeathAnim(GameMain.GameScreen.Cam));
health = 0.0f;
diff --git a/Subsurface/Source/Events/Quests/MonsterQuest.cs b/Subsurface/Source/Events/Quests/MonsterQuest.cs
index 7693d0a97..22cfd873d 100644
--- a/Subsurface/Source/Events/Quests/MonsterQuest.cs
+++ b/Subsurface/Source/Events/Quests/MonsterQuest.cs
@@ -1,14 +1,9 @@
-using FarseerPhysics;
-using Microsoft.Xna.Framework;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using Microsoft.Xna.Framework;
using System.Xml.Linq;
namespace Barotrauma
{
- class MonsterQuest : Quest
+ class MonsterMission : Mission
{
private string monsterFile;
@@ -21,7 +16,7 @@ namespace Barotrauma
get { return monster.Position; }
}
- public MonsterQuest(XElement element)
+ public MonsterMission(XElement element)
: base(element)
{
monsterFile = ToolBox.GetAttributeString(element, "monsterfile", "");
@@ -48,12 +43,8 @@ namespace Barotrauma
public override void End()
{
- if (!monster.IsDead)
- {
- new GUIMessageBox("Quest failed", failureMessage);
- return;
- }
-
+ if (!monster.IsDead) return;
+
GiveReward();
completed = true;
diff --git a/Subsurface/Source/Events/Quests/Quest.cs b/Subsurface/Source/Events/Quests/Quest.cs
index 5ee6c592a..fdd956b9a 100644
--- a/Subsurface/Source/Events/Quests/Quest.cs
+++ b/Subsurface/Source/Events/Quests/Quest.cs
@@ -3,16 +3,15 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using System.Text;
using System.Xml.Linq;
namespace Barotrauma
{
- class Quest
+ class Mission
{
- private static List list = new List();
+ private static List list = new List();
- private static string configFile = "Content/Quests.xml";
+ private static string configFile = "Content/Missions.xml";
private string name;
@@ -60,7 +59,17 @@ namespace Barotrauma
get { return Vector2.Zero; }
}
- public Quest(XElement element)
+ public string SuccessMessage
+ {
+ get { return successMessage; }
+ }
+
+ public string FailureMessage
+ {
+ get { return failureMessage; }
+ }
+
+ public Mission(XElement element)
{
name = ToolBox.GetAttributeString(element, "name", "");
@@ -68,8 +77,10 @@ namespace Barotrauma
reward = ToolBox.GetAttributeInt(element, "reward", 1);
- successMessage = ToolBox.GetAttributeString(element, "successmessage", "");
- failureMessage = ToolBox.GetAttributeString(element, "failuremessage", "");
+ successMessage = ToolBox.GetAttributeString(element, "successmessage",
+ "Mission completed successfully");
+ failureMessage = ToolBox.GetAttributeString(element, "failuremessage",
+ "Mission failed");
radarLabel = ToolBox.GetAttributeString(element, "radarlabel", "");
@@ -83,7 +94,7 @@ namespace Barotrauma
}
}
- public static Quest LoadRandom(Location[] locations, Random rand)
+ public static Mission LoadRandom(Location[] locations, Random rand)
{
XDocument doc = ToolBox.TryLoadXml(configFile);
if (doc == null) return null;
@@ -119,32 +130,32 @@ namespace Barotrauma
t = Type.GetType("Barotrauma." + type, true, true);
if (t == null)
{
- DebugConsole.ThrowError("Error in " + configFile + "! Could not find a quest class of the type ''" + type + "''.");
+ DebugConsole.ThrowError("Error in " + configFile + "! Could not find a mission class of the type ''" + type + "''.");
continue;
}
}
catch
{
- DebugConsole.ThrowError("Error in " + configFile + "! Could not find a an event class of the type ''" + type + "''.");
+ DebugConsole.ThrowError("Error in " + configFile + "! Could not find a mission class of the type ''" + type + "''.");
continue;
}
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) });
object instance = constructor.Invoke(new object[] { element });
- Quest quest = (Quest)instance;
+ Mission mission = (Mission)instance;
for (int n = 0; n<2; n++)
{
- quest.description = quest.description.Replace("[location"+(n+1)+"]", locations[n].Name);
+ mission.description = mission.description.Replace("[location"+(n+1)+"]", locations[n].Name);
- quest.successMessage = quest.successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
- quest.failureMessage = quest.failureMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
+ mission.successMessage = mission.successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
+ mission.failureMessage = mission.failureMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
}
- return quest;
+ return mission;
}
randomNumber -= eventProbability[i];
@@ -168,9 +179,8 @@ namespace Barotrauma
}
///
- /// End the quest and give a reward if it was completed successfully
+ /// End the mission and give a reward if it was completed successfully
///
- /// whether the quest was completed or not
public virtual void End()
{
completed = true;
@@ -180,11 +190,6 @@ namespace Barotrauma
public void GiveReward()
{
- if (!string.IsNullOrWhiteSpace(successMessage))
- {
- new GUIMessageBox("Quest completed successfully", successMessage);
- }
-
var mode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (mode == null) return;
diff --git a/Subsurface/Source/Events/Quests/SalvageQuest.cs b/Subsurface/Source/Events/Quests/SalvageQuest.cs
index c0ce3ab6e..1ca5938a4 100644
--- a/Subsurface/Source/Events/Quests/SalvageQuest.cs
+++ b/Subsurface/Source/Events/Quests/SalvageQuest.cs
@@ -8,7 +8,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
- class SalvageQuest : Quest
+ class SalvageMission : Mission
{
private ItemPrefab itemPrefab;
@@ -24,7 +24,7 @@ namespace Barotrauma
}
}
- public SalvageQuest(XElement element)
+ public SalvageMission(XElement element)
: base(element)
{
string itemName = ToolBox.GetAttributeString(element, "itemname", "");
@@ -33,7 +33,7 @@ namespace Barotrauma
if (itemPrefab == null)
{
- DebugConsole.ThrowError("Error in salvagequest: couldn't find an item prefab with the name "+itemName);
+ DebugConsole.ThrowError("Error in SalvageMission: couldn't find an item prefab with the name "+itemName);
}
}
@@ -91,11 +91,7 @@ namespace Barotrauma
public override void End()
{
item.Remove();
- if (item.CurrentHull == null)
- {
- new GUIMessageBox("Quest failed", failureMessage);
- return;
- }
+ if (item.CurrentHull == null) return;
GiveReward();
diff --git a/Subsurface/Source/GUI/GUIMessageBox.cs b/Subsurface/Source/GUI/GUIMessageBox.cs
index a47b7fa4b..545eb9409 100644
--- a/Subsurface/Source/GUI/GUIMessageBox.cs
+++ b/Subsurface/Source/GUI/GUIMessageBox.cs
@@ -5,7 +5,7 @@ namespace Barotrauma
{
public class GUIMessageBox : GUIFrame
{
- public static Queue MessageBoxes = new Queue();
+ public static Queue MessageBoxes = new Queue();
const int DefaultWidth=400, DefaultHeight=200;
@@ -15,15 +15,15 @@ namespace Barotrauma
//GUIFrame frame;
public GUIButton[] Buttons;
- public static GUIMessageBox VisibleBox
+ public static GUIComponent VisibleBox
{
get { return MessageBoxes.Count==0 ? null : MessageBoxes.Peek(); }
}
public string Text
{
- get { return (children[1] as GUITextBlock).Text; }
- set { (children[1] as GUITextBlock).Text = value; }
+ get { return (children[0].children[1] as GUITextBlock).Text; }
+ set { (children[0].children[1] as GUITextBlock).Text = value; }
}
public GUIMessageBox(string header, string text)
@@ -39,17 +39,19 @@ namespace Barotrauma
}
public GUIMessageBox(string header, string text, string[] buttons, int width=DefaultWidth, int height=DefaultHeight, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
- : base(new Rectangle(0,0, width, height),
- null, Alignment.Center, GUI.Style, parent)
+ : base(new Rectangle(0,0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
+ Color.Black*0.5f, Alignment.TopLeft, null, parent)
{
- new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, this, true);
- new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.Style, this, true);
+ var frame = new GUIFrame(new Rectangle(0,0,width,height), null, Alignment.Center, GUI.Style, this);
+
+ new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
+ new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
int x = 0;
this.Buttons = new GUIButton[buttons.Length];
for (int i = 0; i < buttons.Length; i++)
{
- this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, GUI.Style, this);
+ this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, GUI.Style, frame);
x += this.Buttons[i].Rect.Width + 20;
}
@@ -57,6 +59,8 @@ namespace Barotrauma
MessageBoxes.Enqueue(this);
}
+
+
public bool Close(GUIButton button, object obj)
{
if (parent != null) parent.RemoveChild(this);
diff --git a/Subsurface/Source/GameSession/GameModes/GameMode.cs b/Subsurface/Source/GameSession/GameModes/GameMode.cs
index 169d28285..bc29bb920 100644
--- a/Subsurface/Source/GameSession/GameModes/GameMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/GameMode.cs
@@ -22,7 +22,7 @@ namespace Barotrauma
private string endMessage;
- public virtual Quest Quest
+ public virtual Mission Mission
{
get { return null; }
}
diff --git a/Subsurface/Source/GameSession/GameModes/GameModePreset.cs b/Subsurface/Source/GameSession/GameModes/GameModePreset.cs
index a0efba237..5acdf3392 100644
--- a/Subsurface/Source/GameSession/GameModes/GameModePreset.cs
+++ b/Subsurface/Source/GameSession/GameModes/GameModePreset.cs
@@ -48,7 +48,7 @@ namespace Barotrauma
+ "The rest of the crew will win if they reach the end of the level or kill the traitor "
+ "before the objective is completed.";
- mode = new GameModePreset("Quest", typeof(QuestMode), false);
+ mode = new GameModePreset("Mission", typeof(MissionMode), false);
mode.Description = "The crew must work together to complete a specific task, such as retrieving "
+ "an alien artifact or killing a creature that's terrorizing nearby outposts. The game ends "
+ "when the task is completed or everyone in the crew has died.";
diff --git a/Subsurface/Source/GameSession/GameModes/QuestMode.cs b/Subsurface/Source/GameSession/GameModes/QuestMode.cs
index acdac5151..1bfce67a2 100644
--- a/Subsurface/Source/GameSession/GameModes/QuestMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/QuestMode.cs
@@ -6,19 +6,19 @@ using System.Text;
namespace Barotrauma
{
- class QuestMode : GameMode
+ class MissionMode : GameMode
{
- Quest quest;
+ Mission mission;
- public override Quest Quest
+ public override Mission Mission
{
get
{
- return quest;
+ return mission;
}
}
- public QuestMode(GameModePreset preset)
+ public MissionMode(GameModePreset preset)
: base(preset)
{
Location[] locations = new Location[2];
@@ -29,14 +29,14 @@ namespace Barotrauma
{
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
}
- quest = Quest.LoadRandom(locations, rand);
+ mission = Mission.LoadRandom(locations, rand);
}
public override void Start()
{
base.Start();
- new GUIMessageBox(quest.Name, quest.Description, 400, 400);
+ new GUIMessageBox(mission.Name, mission.Description, 400, 400);
//quest.Start(Level.Loaded);
}
diff --git a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
index 58c41493d..46928b823 100644
--- a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
+++ b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
@@ -18,6 +18,8 @@ namespace Barotrauma
private GUIButton endShiftButton;
public readonly CargoManager CargoManager;
+
+ private ShiftSummary shiftSummary;
public Map Map;
@@ -26,11 +28,11 @@ namespace Barotrauma
private bool savedOnStart;
- public override Quest Quest
+ public override Mission Mission
{
get
{
- return Map.SelectedConnection.Quest;
+ return Map.SelectedConnection.Mission;
}
}
@@ -115,6 +117,8 @@ namespace Barotrauma
endTimer = 5.0f;
CrewManager.StartShift();
+
+ shiftSummary = new ShiftSummary(GameMain.GameSession);
}
public bool TryHireCharacter(HireManager hireManager, CharacterInfo characterInfo)
@@ -192,41 +196,31 @@ namespace Barotrauma
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
+ GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame();
+ GUIMessageBox.MessageBoxes.Enqueue(summaryFrame);
+ var okButton = new GUIButton(new Rectangle(0,0,100,30), "Ok", Alignment.BottomRight, GUI.Style, summaryFrame.children[0]);
+ okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
- StringBuilder sb = new StringBuilder();
- List casualties = CrewManager.characters.FindAll(c => c.IsDead);
-
- if (casualties.Count == CrewManager.characters.Count)
+ bool success = CrewManager.characters.Any(c => !c.IsDead);
+
+ if (success)
{
- sb.Append("Your entire crew has died!");
-
- var msgBox = new GUIMessageBox("", sb.ToString(), new string[] { "Load game", "Quit" });
- msgBox.Buttons[0].OnClicked += GameMain.GameSession.LoadPrevious;
- msgBox.Buttons[0].OnClicked += msgBox.Close;
- msgBox.Buttons[1].OnClicked = GameMain.LobbyScreen.QuitToMainMenu;
- msgBox.Buttons[1].OnClicked += msgBox.Close;
- }
- else
- {
- if (casualties.Any())
- {
- sb.Append("Casualties: \n");
- foreach (Character c in casualties)
- {
- sb.Append(" - " + c.Info.Name + "\n");
- }
- }
- else
- {
- sb.Append("No casualties!");
- }
-
if (Submarine.Loaded.AtEndPosition)
{
Map.MoveToNextLocation();
}
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
+
+
+ }
+ else
+ {
+ var msgBox = new GUIMessageBox("Game over", "Your entire crew has died!", new string[] { "Load game", "Quit" });
+ msgBox.Buttons[0].OnClicked += GameMain.GameSession.LoadPrevious;
+ msgBox.Buttons[0].OnClicked += msgBox.Close;
+ msgBox.Buttons[1].OnClicked = GameMain.LobbyScreen.QuitToMainMenu;
+ msgBox.Buttons[1].OnClicked += msgBox.Close;
}
CrewManager.EndShift();
diff --git a/Subsurface/Source/GameSession/GameSession.cs b/Subsurface/Source/GameSession/GameSession.cs
index a39764afe..34311a5af 100644
--- a/Subsurface/Source/GameSession/GameSession.cs
+++ b/Subsurface/Source/GameSession/GameSession.cs
@@ -1,11 +1,6 @@
using System;
-using System.IO;
-using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
-using System.Text;
-using System.Collections.Generic;
using System.Xml.Linq;
namespace Barotrauma
@@ -24,11 +19,11 @@ namespace Barotrauma
public CrewManager CrewManager;
- public Quest Quest
+ public Mission Mission
{
get
{
- if (gameMode != null) return gameMode.Quest;
+ if (gameMode != null) return gameMode.Mission;
return null;
}
}
@@ -71,7 +66,7 @@ namespace Barotrauma
guiRoot = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsWidth), Color.Transparent);
- if (gameModePreset!=null) this.gameMode = gameModePreset.Instantiate();
+ if (gameModePreset!=null) gameMode = gameModePreset.Instantiate();
this.submarine = submarine;
}
@@ -122,7 +117,7 @@ namespace Barotrauma
GameMain.GameScreen.BackgroundCreatureManager.SpawnSprites(80);
}
- if (Quest!=null) Quest.Start(Level.Loaded);
+ if (Mission!=null) Mission.Start(Level.Loaded);
if (gameMode!=null) gameMode.Start();
@@ -131,7 +126,7 @@ namespace Barotrauma
public void EndShift(string endMessage)
{
- if (Quest != null) Quest.End();
+ if (Mission != null) Mission.End();
if (GameMain.Server!=null)
{
@@ -172,7 +167,7 @@ namespace Barotrauma
guiRoot.Update(deltaTime);
if (gameMode != null) gameMode.Update(deltaTime);
- if (Quest != null) Quest.Update(deltaTime);
+ if (Mission != null) Mission.Update(deltaTime);
}
public void Draw(SpriteBatch spriteBatch)
@@ -185,7 +180,7 @@ namespace Barotrauma
public void Save(string filePath)
{
XDocument doc = new XDocument(
- new XElement((XName)"Gamesession"));
+ new XElement("Gamesession"));
var now = DateTime.Now;
doc.Root.Add(new XAttribute("savetime", now.Hour + ":" + now.Minute + ", " + now.ToShortDateString()));
diff --git a/Subsurface/Source/GameSession/InfoTextManager.cs b/Subsurface/Source/GameSession/InfoTextManager.cs
new file mode 100644
index 000000000..6571baefa
--- /dev/null
+++ b/Subsurface/Source/GameSession/InfoTextManager.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml.Linq;
+
+namespace Barotrauma
+{
+ static class InfoTextManager
+ {
+
+ private static Dictionary> infoTexts;
+
+ static InfoTextManager()
+ {
+ LoadInfoTexts(Path.Combine("Content", "InfoTexts.xml"));
+ }
+
+
+ private static void LoadInfoTexts(string file)
+ {
+ infoTexts = new Dictionary>();
+
+ XDocument doc = ToolBox.TryLoadXml(file);
+ if (doc == null) return;
+
+ foreach (XElement subElement in doc.Root.Elements())
+ {
+ string infoName = subElement.Name.ToString().ToLower();
+ List infoList = null;
+ if (!infoTexts.TryGetValue(infoName, out infoList))
+ {
+ infoList = new List();
+ infoTexts.Add(infoName, infoList);
+ }
+
+ infoList.Add(subElement.ElementInnerText());
+ }
+ }
+
+ public static string GetInfoText(string infoName)
+ {
+ List infoList = null;
+ if (!infoTexts.TryGetValue(infoName.ToLower(), out infoList) || !infoList.Any())
+ {
+#if DEBUG
+ return "Info text ''" + infoName + "'' not found";
+#else
+ return "";
+#endif
+ }
+
+ string text = infoList[Rand.Int(infoList.Count)];
+
+ if (Submarine.Loaded!=null) text = text.Replace("[sub]", Submarine.Loaded.Name);
+ if (GameMain.GameSession != null && GameMain.GameSession.Map != null)
+ {
+ if (GameMain.GameSession.Map.CurrentLocation!=null)
+ text = text.Replace("[location1]", GameMain.GameSession.Map.CurrentLocation.Name);
+
+ if (GameMain.GameSession.Map.SelectedLocation!= null)
+ text = text.Replace("[location2]", GameMain.GameSession.Map.SelectedLocation.Name);
+ }
+
+ return text;
+ }
+ }
+}
diff --git a/Subsurface/Source/GameSession/ShiftSummary.cs b/Subsurface/Source/GameSession/ShiftSummary.cs
new file mode 100644
index 000000000..5b3329789
--- /dev/null
+++ b/Subsurface/Source/GameSession/ShiftSummary.cs
@@ -0,0 +1,129 @@
+using Microsoft.Xna.Framework;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml.Linq;
+
+namespace Barotrauma
+{
+ class ShiftSummary
+ {
+ class Casualty
+ {
+ public readonly CharacterInfo character;
+ public readonly CauseOfDeath causeOfDeath;
+
+ public readonly string description;
+
+ public Casualty(CharacterInfo characterInfo, CauseOfDeath causeOfDeath, string description)
+ {
+ this.character = characterInfo;
+ this.causeOfDeath = causeOfDeath;
+ this.description = description;
+ }
+ }
+
+ private Location startLocation, endLocation;
+
+ private GameSession gameSession;
+
+ private List casualties;
+
+ private Mission selectedMission;
+
+ public ShiftSummary(GameSession gameSession)
+ {
+ this.gameSession = gameSession;
+
+ startLocation = gameSession.Map.CurrentLocation;
+ endLocation = gameSession.Map.SelectedLocation;
+
+ casualties = new List();
+
+ foreach (Character character in gameSession.CrewManager.characters)
+ {
+ character.OnDeath = AddCasualty;
+ }
+
+ selectedMission = gameSession.Mission;
+
+ }
+
+
+ public void AddCasualty(Character character, CauseOfDeath causeOfDeath)
+ {
+ casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
+ }
+
+ public GUIFrame CreateSummaryFrame()
+ {
+ bool gameOver = !gameSession.CrewManager.characters.Any(c => !c.IsDead);
+ bool progress = Submarine.Loaded.AtEndPosition;
+
+ GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f);
+
+ int width = 700, height = 400;
+ GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,width,height), null, Alignment.Center, GUI.Style, frame);
+
+ int y = 0;
+ string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
+ (progress ? "progress" : "return"));
+
+ var infoText = new GUITextBlock(new Rectangle(0,y,0,50), summaryText, GUI.Style, innerFrame, true);
+ y += infoText.Rect.Height;
+
+ new GUITextBlock(new Rectangle(0,y,0,20), "Crew status:", GUI.Style, innerFrame, GUI.LargeFont);
+ y += 30;
+
+ int x = 0;
+ foreach (Character character in gameSession.CrewManager.characters)
+ {
+ var characterFrame = new GUIFrame(new Rectangle(x,y,170,70), character.IsDead ? Color.DarkRed*0.7f : Color.Transparent, GUI.Style, innerFrame);
+ characterFrame.Padding = new Vector4(5.0f,5.0f,5.0f,5.0f);
+ character.Info.CreateCharacterFrame(characterFrame,
+ character.Info.Job!=null ? (character.Info.Name + '\n'+"("+character.Info.Job.Name+")") : character.Info.Name, null);
+
+ string statusText;
+
+ var casualty = casualties.Find(c => c.character == character.Info);
+
+ if (casualty != null)
+ {
+ statusText = InfoTextManager.GetInfoText("CauseOfDeath." + casualty.causeOfDeath.ToString());
+ }
+ else
+ {
+ statusText = (character.Health / character.MaxHealth > 0.8f) ? "OK" : "Injured";
+ }
+
+ new GUITextBlock(new Rectangle(0,0,0,20), statusText,
+ GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = Color.Black*0.7f;
+
+
+ x += characterFrame.Rect.Width + 10;
+ }
+
+ y += 80;
+
+ if (GameMain.GameSession.Mission != null)
+ {
+ new GUITextBlock(new Rectangle(0, y, 0, 20), "Mission: "+GameMain.GameSession.Mission.Name, GUI.Style, innerFrame, GUI.LargeFont);
+ y += 30;
+
+ new GUITextBlock(new Rectangle(0,y,0,30),
+ (GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage,
+ GUI.Style, innerFrame);
+
+ if (GameMain.GameSession.Mission.Completed)
+ {
+ new GUITextBlock(new Rectangle(0, y+40, 0, 30), "Reward: "+GameMain.GameSession.Mission.Reward, GUI.Style, innerFrame);
+ }
+
+ }
+
+ return frame;
+ }
+ }
+}
diff --git a/Subsurface/Source/Items/Components/Machines/Radar.cs b/Subsurface/Source/Items/Components/Machines/Radar.cs
index 78b0b2a7a..3f647db3c 100644
--- a/Subsurface/Source/Items/Components/Machines/Radar.cs
+++ b/Subsurface/Source/Items/Components/Machines/Radar.cs
@@ -236,15 +236,15 @@ namespace Barotrauma.Items.Components
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
(Level.Loaded.EndPosition), displayScale, center, (rect.Width * 0.55f));
- if (GameMain.GameSession.Quest != null)
+ if (GameMain.GameSession.Mission != null)
{
- var quest = GameMain.GameSession.Quest;
+ var mission = GameMain.GameSession.Mission;
- if (!string.IsNullOrWhiteSpace(quest.RadarLabel))
+ if (!string.IsNullOrWhiteSpace(mission.RadarLabel))
{
DrawMarker(spriteBatch,
- quest.RadarLabel,
- quest.RadarPosition, displayScale, center, (rect.Width * 0.55f));
+ mission.RadarLabel,
+ mission.RadarPosition, displayScale, center, (rect.Width * 0.55f));
}
}
diff --git a/Subsurface/Source/Map/Map.cs b/Subsurface/Source/Map/Map.cs
index 29848b186..077b48cc6 100644
--- a/Subsurface/Source/Map/Map.cs
+++ b/Subsurface/Source/Map/Map.cs
@@ -402,28 +402,28 @@ namespace Barotrauma
public List CrackSegments;
- private int questsCompleted;
+ private int missionsCompleted;
- private Quest quest;
- public Quest Quest
+ private Mission mission;
+ public Mission Mission
{
get
{
- if (quest==null || quest.Completed)
+ if (mission==null || mission.Completed)
{
- if (quest !=null && quest.Completed) questsCompleted++;
+ if (mission !=null && mission.Completed) missionsCompleted++;
int seed = (int)locations[0].MapPosition.X + (int)locations[0].MapPosition.Y * 100;
seed += (int)locations[1].MapPosition.X*10000 + (int)locations[1].MapPosition.Y * 1000000;
- Random rand = new Random(seed + questsCompleted);
+ Random rand = new Random(seed + missionsCompleted);
if (rand.NextDouble() < 0.3f) return null;
- quest = Quest.LoadRandom(locations, rand);
+ mission = Mission.LoadRandom(locations, rand);
}
- return quest;
+ return mission;
}
}
@@ -444,7 +444,7 @@ namespace Barotrauma
{
locations = new Location[] { location1, location2 };
- questsCompleted = 0;
+ missionsCompleted = 0;
}
public Location OtherLocation(Location location)
diff --git a/Subsurface/Source/Map/Submarine.cs b/Subsurface/Source/Map/Submarine.cs
index 9eaa1f72d..e2868a5d5 100644
--- a/Subsurface/Source/Map/Submarine.cs
+++ b/Subsurface/Source/Map/Submarine.cs
@@ -618,6 +618,7 @@ namespace Barotrauma
XDocument doc = OpenDoc(filePath);
if (doc == null) return;
+ name = ToolBox.GetAttributeString(doc.Root, "name", name);
foreach (XElement element in doc.Root.Elements())
{
diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs
index 5393f7f3d..30c984d72 100644
--- a/Subsurface/Source/Screens/LobbyScreen.cs
+++ b/Subsurface/Source/Screens/LobbyScreen.cs
@@ -230,15 +230,15 @@ namespace Barotrauma
new GUITextBlock(new Rectangle(0, 0, 250, 0), location.Name, GUI.Style, Alignment.TopLeft, Alignment.TopCenter, locationPanel, true, GUI.LargeFont);
- if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Quest != null)
+ if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Mission != null)
{
- var quest = GameMain.GameSession.Map.SelectedConnection.Quest;
+ var mission = GameMain.GameSession.Map.SelectedConnection.Mission;
- new GUITextBlock(new Rectangle(0, 80, 0, 20), "Quest: "+quest.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
+ new GUITextBlock(new Rectangle(0, 80, 0, 20), "Mission: "+mission.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
- new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + quest.Reward+" credits", Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
+ new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + mission.Reward+" credits", Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
- new GUITextBlock(new Rectangle(0, 120, 0, 0), quest.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true);
+ new GUITextBlock(new Rectangle(0, 120, 0, 0), mission.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true);
}
diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs
index 897da2c8d..1cf348360 100644
--- a/Subsurface/Source/Screens/MainMenuScreen.cs
+++ b/Subsurface/Source/Screens/MainMenuScreen.cs
@@ -476,10 +476,10 @@ namespace Barotrauma
GameMain.LobbyScreen.Select();
- new GUIMessageBox("Welcome to Barotrauma!", "Please note that the single player mode is very unfinished at the moment; "+
- "for example, the NPCs don't have an AI yet and there are only a couple of different quests to complete. The multiplayer "+
- "mode should be much more enjoyable to play at the moment, so my recommendation is to try out and get a hang of the game mechanics "+
- "in the single player mode and then move on to multiplayer. Have fun!\n - Regalis, the main dev of Subsurface", 400, 350);
+ //new GUIMessageBox("Welcome to Barotrauma!", "Please note that the single player mode is very unfinished at the moment; "+
+ //"for example, the NPCs don't have an AI yet and there are only a couple of different quests to complete. The multiplayer "+
+ //"mode should be much more enjoyable to play at the moment, so my recommendation is to try out and get a hang of the game mechanics "+
+ //"in the single player mode and then move on to multiplayer. Have fun!\n - Regalis, the main dev of Subsurface", 400, 350);
return true;
}
diff --git a/Subsurface/Source/Screens/ServerListScreen.cs b/Subsurface/Source/Screens/ServerListScreen.cs
index e3acdaddc..15db9d5a9 100644
--- a/Subsurface/Source/Screens/ServerListScreen.cs
+++ b/Subsurface/Source/Screens/ServerListScreen.cs
@@ -65,7 +65,7 @@ namespace Barotrauma
if (n > 0) columnX[n] += columnX[n - 1];
}
- SpriteFont font = serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
+ SpriteFont font = GUI.SmallFont; // serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", GUI.Style, menu).Font = font;