Merge remote-tracking branch 'barotrauma/master' into new-netcode
# Conflicts: # Subsurface/Source/Characters/Character.cs # Subsurface/Source/Items/Components/Machines/Steering.cs # Subsurface/Source/Map/Structure.cs # Subsurface/Source/Networking/GameClient.cs # Subsurface/Source/Networking/GameServer.cs
This commit is contained in:
@@ -17,15 +17,9 @@ namespace Barotrauma
|
||||
public MissionMode(GameModePreset preset, object param)
|
||||
: base(preset, param)
|
||||
{
|
||||
Location[] locations = new Location[2];
|
||||
Location[] locations = { GameMain.GameSession.StartLocation, GameMain.GameSession.EndLocation };
|
||||
|
||||
MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed));
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
|
||||
}
|
||||
|
||||
mission = Mission.LoadRandom(locations, rand, param as string);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,13 +197,13 @@ namespace Barotrauma
|
||||
}
|
||||
else if (leavingSub.AtEndPosition)
|
||||
{
|
||||
endShiftButton.Text = "Enter " + Map.SelectedLocation.Name;
|
||||
endShiftButton.Text = ToolBox.LimitString("Enter " + Map.SelectedLocation.Name, endShiftButton.Font, endShiftButton.Rect.Width - 5);
|
||||
endShiftButton.UserData = leavingSub;
|
||||
endShiftButton.Visible = true;
|
||||
}
|
||||
else if (leavingSub.AtStartPosition)
|
||||
{
|
||||
endShiftButton.Text = "Enter " + Map.CurrentLocation.Name;
|
||||
endShiftButton.Text = ToolBox.LimitString("Enter " + Map.CurrentLocation.Name, endShiftButton.Font, endShiftButton.Rect.Width - 5);
|
||||
endShiftButton.UserData = leavingSub;
|
||||
endShiftButton.Visible = true;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ namespace Barotrauma
|
||||
|
||||
public readonly GameMode gameMode;
|
||||
|
||||
//two locations used as the start and end in the MP mode
|
||||
private Location[] dummyLocations;
|
||||
|
||||
private InfoFrameTab selectedTab;
|
||||
private GUIButton infoButton;
|
||||
private GUIFrame infoFrame;
|
||||
@@ -50,7 +53,37 @@ namespace Barotrauma
|
||||
return (mode == null) ? null : mode.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Location StartLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Map != null) return Map.CurrentLocation;
|
||||
|
||||
if (dummyLocations==null)
|
||||
{
|
||||
CreateDummyLocations();
|
||||
}
|
||||
|
||||
return dummyLocations[0];
|
||||
}
|
||||
}
|
||||
|
||||
public Location EndLocation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Map != null) return Map.SelectedLocation;
|
||||
|
||||
if (dummyLocations == null)
|
||||
{
|
||||
CreateDummyLocations();
|
||||
}
|
||||
|
||||
return dummyLocations[1];
|
||||
}
|
||||
}
|
||||
|
||||
public Submarine Submarine
|
||||
{
|
||||
get { return submarine; }
|
||||
@@ -81,12 +114,10 @@ namespace Barotrauma
|
||||
|
||||
this.saveFile = saveFile;
|
||||
|
||||
//guiRoot = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsWidth), Color.Transparent);
|
||||
|
||||
infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", GUI.Style, null);
|
||||
infoButton.OnClicked = ToggleInfoFrame;
|
||||
|
||||
if (gameModePreset!=null) gameMode = gameModePreset.Instantiate(missionType);
|
||||
if (gameModePreset != null) gameMode = gameModePreset.Instantiate(missionType);
|
||||
this.submarine = submarine;
|
||||
}
|
||||
|
||||
@@ -109,6 +140,17 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateDummyLocations()
|
||||
{
|
||||
dummyLocations = new Location[2];
|
||||
|
||||
MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed));
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
dummyLocations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
|
||||
}
|
||||
}
|
||||
|
||||
public void StartShift(string levelSeed, bool loadSecondSub = true)
|
||||
{
|
||||
Level level = Level.CreateRandom(levelSeed);
|
||||
@@ -166,8 +208,6 @@ namespace Barotrauma
|
||||
|
||||
if (gameMode!=null) gameMode.Start();
|
||||
|
||||
Items.Components.Radar.StartMarker = "Start";
|
||||
Items.Components.Radar.EndMarker = "End";
|
||||
if (gameMode.Mission != null) Mission.Start(Level.Loaded);
|
||||
|
||||
TaskManager.StartShift(level);
|
||||
|
||||
@@ -58,10 +58,9 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
if (Submarine.MainSub != null) text = text.Replace("[sub]", Submarine.MainSub.Name);
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.Map != null)
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.StartLocation != null)
|
||||
{
|
||||
if (GameMain.GameSession.Map.CurrentLocation!=null)
|
||||
text = text.Replace("[location]", GameMain.GameSession.Map.CurrentLocation.Name);
|
||||
text = text.Replace("[location]", GameMain.GameSession.StartLocation.Name);
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Barotrauma
|
||||
{
|
||||
this.gameSession = gameSession;
|
||||
|
||||
startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation;
|
||||
endLocation = gameSession.Map==null ? null : gameSession.Map.SelectedLocation;
|
||||
startLocation = gameSession.StartLocation;
|
||||
endLocation = gameSession.EndLocation;
|
||||
|
||||
selectedMission = gameSession.Mission;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user