38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -8,17 +8,10 @@ namespace Barotrauma
|
||||
{
|
||||
class Biome
|
||||
{
|
||||
public enum MapPlacement
|
||||
{
|
||||
Random = 1,
|
||||
Center = 2,
|
||||
Edge = 4
|
||||
}
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string Description;
|
||||
|
||||
public readonly MapPlacement Placement;
|
||||
public readonly List<int> AllowedZones = new List<int>();
|
||||
|
||||
public Biome(string name, string description)
|
||||
{
|
||||
@@ -30,46 +23,52 @@ namespace Barotrauma
|
||||
{
|
||||
Name = element.GetAttributeString("name", "Biome");
|
||||
Description = element.GetAttributeString("description", "");
|
||||
|
||||
string[] placementsStrs = element.GetAttributeString("MapPlacement", "Default").Split(',');
|
||||
foreach (string placementStr in placementsStrs)
|
||||
{
|
||||
MapPlacement parsedPlacement;
|
||||
if (Enum.TryParse(placementStr.Trim(), out parsedPlacement))
|
||||
{
|
||||
Placement |= parsedPlacement;
|
||||
}
|
||||
}
|
||||
|
||||
string allowedZonesStr = element.GetAttributeString("AllowedZones", "1,2,3,4,5,6,7,8,9");
|
||||
string[] zoneIndices = allowedZonesStr.Split(',');
|
||||
for (int i = 0; i < zoneIndices.Length; i++)
|
||||
{
|
||||
int zoneIndex = -1;
|
||||
if (!int.TryParse(zoneIndices[i].Trim(), out zoneIndex))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in biome config \"" + Name + "\" - \"" + zoneIndices[i] + "\" is not a valid zone index.");
|
||||
continue;
|
||||
}
|
||||
AllowedZones.Add(zoneIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LevelGenerationParams : ISerializableEntity
|
||||
{
|
||||
public static List<LevelGenerationParams> LevelParams
|
||||
{
|
||||
get { return levelParams; }
|
||||
}
|
||||
|
||||
private static List<LevelGenerationParams> levelParams;
|
||||
private static List<Biome> biomes;
|
||||
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private int minWidth, maxWidth, height;
|
||||
|
||||
private float width, height;
|
||||
|
||||
private Vector2 voronoiSiteInterval;
|
||||
private Point voronoiSiteInterval;
|
||||
//how much the sites are "scattered" on x- and y-axis
|
||||
//if Vector2.Zero, the sites will just be placed in a regular grid pattern
|
||||
private Vector2 voronoiSiteVariance;
|
||||
private Point voronoiSiteVariance;
|
||||
|
||||
//how far apart the nodes of the main path can be
|
||||
//x = min interval, y = max interval
|
||||
private Vector2 mainPathNodeIntervalRange;
|
||||
private Point mainPathNodeIntervalRange;
|
||||
|
||||
private int smallTunnelCount;
|
||||
//x = min length, y = max length
|
||||
private Vector2 smallTunnelLengthRange;
|
||||
private Point smallTunnelLengthRange;
|
||||
|
||||
//how large portion of the bottom of the level should be "carved out"
|
||||
//if 0.0f, the bottom will be completely solid (making the abyss unreachable)
|
||||
@@ -77,36 +76,28 @@ namespace Barotrauma
|
||||
private float bottomHoleProbability;
|
||||
|
||||
//the y-position of the ocean floor (= the position from which the bottom formations extend upwards)
|
||||
private float seaFloorBaseDepth;
|
||||
private int seaFloorBaseDepth;
|
||||
//how much random variance there can be in the height of the formations
|
||||
private float seaFloorVariance;
|
||||
private int seaFloorVariance;
|
||||
|
||||
private int cellSubdivisionLength;
|
||||
private float cellRoundingAmount;
|
||||
private float cellIrregularity;
|
||||
|
||||
private int mountainCountMin, mountainCountMax;
|
||||
|
||||
private float mountainHeightMin, mountainHeightMax;
|
||||
private int mountainHeightMin, mountainHeightMax;
|
||||
|
||||
private int ruinCount;
|
||||
|
||||
private float waterParticleScale;
|
||||
|
||||
//which biomes can this type of level appear in
|
||||
private List<Biome> allowedBiomes = new List<Biome>();
|
||||
|
||||
public Color BackgroundColor
|
||||
public IEnumerable<Biome> AllowedBiomes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Color WallColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(1000, false)]
|
||||
public int BackgroundSpriteAmount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get { return allowedBiomes; }
|
||||
}
|
||||
|
||||
public Dictionary<string, SerializableProperty> SerializableProperties
|
||||
@@ -115,83 +106,183 @@ namespace Barotrauma
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(100000.0f, false)]
|
||||
public float Width
|
||||
[Serialize("27,30,36", true), Editable]
|
||||
public Color AmbientLightColor
|
||||
{
|
||||
get { return width; }
|
||||
set { width = Math.Max(value, 2000.0f); }
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(50000.0f, false)]
|
||||
public float Height
|
||||
[Serialize("20,40,50", true), Editable()]
|
||||
public Color BackgroundTextureColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize("20,40,50", true), Editable]
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize("255,255,255", true), Editable]
|
||||
public Color WallColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(1000, true), Editable(MinValueInt = 0, MaxValueInt = 100000, ToolTip = "The total number of level objects (vegetation, vents, etc) in the level.")]
|
||||
public int LevelObjectAmount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(100000, true), Editable(MinValueInt = 10000, MaxValueInt = 1000000)]
|
||||
public int MinWidth
|
||||
{
|
||||
get { return minWidth; }
|
||||
set { minWidth = Math.Max(value, 2000); }
|
||||
}
|
||||
|
||||
[Serialize(100000, true), Editable(MinValueInt = 10000, MaxValueInt = 1000000)]
|
||||
public int MaxWidth
|
||||
{
|
||||
get { return maxWidth; }
|
||||
set { maxWidth = Math.Max(value, 2000); }
|
||||
}
|
||||
|
||||
[Serialize(50000, true), Editable(MinValueInt = 10000, MaxValueInt = 1000000)]
|
||||
public int Height
|
||||
{
|
||||
get { return height; }
|
||||
set { height = Math.Max(value, 2000.0f); }
|
||||
set { height = Math.Max(value, 2000); }
|
||||
}
|
||||
|
||||
public Vector2 VoronoiSiteInterval
|
||||
|
||||
[Serialize("3000, 3000", true), Editable(
|
||||
ToolTip = "How far from each other voronoi sites are placed. " +
|
||||
"Sites determine shape of the voronoi graph which the level walls are generated from. " +
|
||||
"(Decreasing this value causes the number of sites, and the complexity of the level, to increase exponentially - be careful when adjusting)")]
|
||||
public Point VoronoiSiteInterval
|
||||
{
|
||||
get { return voronoiSiteInterval; }
|
||||
set
|
||||
{
|
||||
voronoiSiteInterval.X = MathHelper.Clamp(value.X, 100.0f, width / 2);
|
||||
voronoiSiteInterval.Y = MathHelper.Clamp(value.Y, 100.0f, height / 2);
|
||||
voronoiSiteInterval.X = MathHelper.Clamp(value.X, 100, MinWidth / 2);
|
||||
voronoiSiteInterval.Y = MathHelper.Clamp(value.Y, 100, height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 VoronoiSiteVariance
|
||||
[Serialize("700,700", true), Editable(ToolTip = "How much random variation to apply to the positions of the voronoi sites on each axis. "+
|
||||
"Small values produce roughly rectangular level walls. The larger the values are, the less uniform the shapes get.")]
|
||||
public Point VoronoiSiteVariance
|
||||
{
|
||||
get { return voronoiSiteVariance; }
|
||||
set
|
||||
{
|
||||
voronoiSiteVariance = new Vector2(
|
||||
voronoiSiteVariance = new Point(
|
||||
MathHelper.Clamp(value.X, 0, voronoiSiteInterval.X),
|
||||
MathHelper.Clamp(value.Y, 0, voronoiSiteInterval.Y));
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(1000, true), Editable(MinValueInt = 100, MaxValueInt = 10000, ToolTip = "The edges of the individual wall cells are subdivided into edges of this size. "
|
||||
+ "Can be used in conjunction with the rounding values to make the cells rounder. Smaller values will make the cells look smoother, " +
|
||||
"but make the level more performance-intensive as the number of polygons used in rendering and physics calculations increases.")]
|
||||
public int CellSubdivisionLength
|
||||
{
|
||||
get { return cellSubdivisionLength; }
|
||||
set
|
||||
{
|
||||
cellSubdivisionLength = Math.Max(value, 10);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 MainPathNodeIntervalRange
|
||||
|
||||
[Serialize(0.5f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1.0f, ToolTip = "How much the individual wall cells are rounded. "
|
||||
+"Note that the final shape of the cells is also affected by the CellSubdivisionLength parameter.")]
|
||||
public float CellRoundingAmount
|
||||
{
|
||||
get { return cellRoundingAmount; }
|
||||
set
|
||||
{
|
||||
cellRoundingAmount = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(0.1f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 1.0f, ToolTip = "How much random variance is applied to the edges of the cells. "
|
||||
+ "Note that the final shape of the cells is also affected by the CellSubdivisionLength parameter.")]
|
||||
public float CellIrregularity
|
||||
{
|
||||
get { return cellIrregularity; }
|
||||
set
|
||||
{
|
||||
cellIrregularity = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Serialize("5000, 10000", true), Editable(ToolTip = "The distance between the nodes that are used to generate the main path through the level (min, max). Larger values produce a straighter path.")]
|
||||
public Point MainPathNodeIntervalRange
|
||||
{
|
||||
get { return mainPathNodeIntervalRange; }
|
||||
set
|
||||
{
|
||||
mainPathNodeIntervalRange.X = MathHelper.Clamp(value.X, 100.0f, width / 2);
|
||||
mainPathNodeIntervalRange.Y = MathHelper.Clamp(value.Y, mainPathNodeIntervalRange.X, width / 2);
|
||||
mainPathNodeIntervalRange.X = MathHelper.Clamp(value.X, 100, MinWidth / 2);
|
||||
mainPathNodeIntervalRange.Y = MathHelper.Clamp(value.Y, mainPathNodeIntervalRange.X, MinWidth / 2);
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(5, false)]
|
||||
[Serialize(5, true), Editable(ToolTip = "The number of small tunnels placed along the main path.")]
|
||||
public int SmallTunnelCount
|
||||
{
|
||||
get { return smallTunnelCount; }
|
||||
set { smallTunnelCount = MathHelper.Clamp(value, 0, 100); }
|
||||
}
|
||||
|
||||
public Vector2 SmallTunnelLengthRange
|
||||
|
||||
[Serialize("5000, 10000", true), Editable(ToolTip = "The minimum and maximum length of small tunnels placed along the main path.")]
|
||||
public Point SmallTunnelLengthRange
|
||||
{
|
||||
get { return smallTunnelLengthRange; }
|
||||
set
|
||||
{
|
||||
smallTunnelLengthRange.X = MathHelper.Clamp(value.X, 100.0f, width);
|
||||
smallTunnelLengthRange.Y = MathHelper.Clamp(value.Y, smallTunnelLengthRange.X, width);
|
||||
smallTunnelLengthRange.X = MathHelper.Clamp(value.X, 100, MinWidth);
|
||||
smallTunnelLengthRange.Y = MathHelper.Clamp(value.Y, smallTunnelLengthRange.X, MinWidth);
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(-300000.0f, false)]
|
||||
public float SeaFloorDepth
|
||||
[Serialize(100, true), Editable(MinValueInt = 0, MaxValueInt = 10000)]
|
||||
public int ItemCount
|
||||
{
|
||||
get { return seaFloorBaseDepth; }
|
||||
set { seaFloorBaseDepth = MathHelper.Clamp(value, Level.MaxEntityDepth, 0.0f); }
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(1000.0f, false)]
|
||||
public float SeaFloorVariance
|
||||
[Serialize(0, true), Editable(MinValueInt = 0, MaxValueInt = 20)]
|
||||
public int FloatingIceChunkCount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(300000, true), Editable(MinValueFloat = Level.MaxEntityDepth, MaxValueFloat = 0.0f, ToolTip = "How far below the level the sea floor is placed.")]
|
||||
public int SeaFloorDepth
|
||||
{
|
||||
get { return seaFloorBaseDepth; }
|
||||
set { seaFloorBaseDepth = MathHelper.Clamp(value, Level.MaxEntityDepth, 0); }
|
||||
}
|
||||
|
||||
[Serialize(1000, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100000.0f, ToolTip = "Variance of the depth of the sea floor. Smaller values produce a smoother sea floor.")]
|
||||
public int SeaFloorVariance
|
||||
{
|
||||
get { return seaFloorVariance; }
|
||||
set { seaFloorVariance = value; }
|
||||
}
|
||||
|
||||
[Serialize(0, false)]
|
||||
[Serialize(0, true), Editable(MinValueInt = 0, MaxValueInt = 20, ToolTip = "The minimum number of mountains on the sea floor.")]
|
||||
public int MountainCountMin
|
||||
{
|
||||
get { return mountainCountMin; }
|
||||
@@ -201,7 +292,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(0, false)]
|
||||
[Serialize(0, true), Editable(MinValueInt = 0, MaxValueInt = 20, ToolTip = "The maximum number of mountains on the sea floor.")]
|
||||
public int MountainCountMax
|
||||
{
|
||||
get { return mountainCountMax; }
|
||||
@@ -210,9 +301,9 @@ namespace Barotrauma
|
||||
mountainCountMax = Math.Max(value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(1000.0f, false)]
|
||||
public float MountainHeightMin
|
||||
|
||||
[Serialize(1000, true), Editable(MinValueInt = 0, MaxValueInt = 1000000, ToolTip = "The minimum height of the mountains on the sea floor.")]
|
||||
public int MountainHeightMin
|
||||
{
|
||||
get { return mountainHeightMin; }
|
||||
set
|
||||
@@ -220,9 +311,9 @@ namespace Barotrauma
|
||||
mountainHeightMin = Math.Max(value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(5000.0f, false)]
|
||||
public float MountainHeightMax
|
||||
|
||||
[Serialize(5000, true), Editable(MinValueInt = 0, MaxValueInt = 1000000, ToolTip = "The maximum height of the mountains on the sea floor.")]
|
||||
public int MountainHeightMax
|
||||
{
|
||||
get { return mountainHeightMax; }
|
||||
set
|
||||
@@ -231,19 +322,32 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(1, false)]
|
||||
[Serialize(1, true), Editable(MinValueInt = 0, MaxValueInt = 50, ToolTip = "The number of alien ruins in the level.")]
|
||||
public int RuinCount
|
||||
{
|
||||
get { return ruinCount; }
|
||||
set { ruinCount = MathHelper.Clamp(value, 0, 10); }
|
||||
}
|
||||
|
||||
[Serialize(0.4f, false)]
|
||||
[Serialize(0.4f, true), Editable(ToolTip = "The probability for wall cells to be removed from the bottom of the map. A value of 0 will produce a completely enclosed tunnel and 1 will make the entire bottom of the level completely open.")]
|
||||
public float BottomHoleProbability
|
||||
{
|
||||
get { return bottomHoleProbability; }
|
||||
set { bottomHoleProbability = MathHelper.Clamp(value, 0.0f, 1.0f); }
|
||||
}
|
||||
|
||||
[Serialize(1.0f, true), Editable(ToolTip = "Scale of the water particle texture.")]
|
||||
public float WaterParticleScale
|
||||
{
|
||||
get { return waterParticleScale; }
|
||||
private set { waterParticleScale = Math.Max(value, 0.01f); }
|
||||
}
|
||||
|
||||
public Sprite BackgroundSprite { get; private set; }
|
||||
public Sprite BackgroundTopSprite { get; private set; }
|
||||
public Sprite WallSprite { get; private set; }
|
||||
public Sprite WallEdgeSprite { get; private set; }
|
||||
public Sprite WaterParticles { get; private set; }
|
||||
|
||||
public static List<Biome> GetBiomes()
|
||||
{
|
||||
@@ -279,23 +383,8 @@ namespace Barotrauma
|
||||
{
|
||||
Name = element == null ? "default" : element.Name.ToString();
|
||||
SerializableProperties = SerializableProperty.DeserializeProperties(this, element);
|
||||
|
||||
Vector3 colorVector = element.GetAttributeVector3("BackgroundColor", new Vector3(50, 46, 20));
|
||||
BackgroundColor = new Color((int)colorVector.X, (int)colorVector.Y, (int)colorVector.Z);
|
||||
|
||||
colorVector = element.GetAttributeVector3("WallColor", new Vector3(255,255,255));
|
||||
WallColor = new Color((int)colorVector.X, (int)colorVector.Y, (int)colorVector.Z);
|
||||
|
||||
VoronoiSiteInterval = element.GetAttributeVector2("VoronoiSiteInterval", new Vector2(3000, 3000));
|
||||
|
||||
VoronoiSiteVariance = element.GetAttributeVector2("VoronoiSiteVariance", new Vector2(voronoiSiteInterval.X, voronoiSiteInterval.Y) * 0.4f);
|
||||
|
||||
MainPathNodeIntervalRange = element.GetAttributeVector2("MainPathNodeIntervalRange", new Vector2(5000.0f, 10000.0f));
|
||||
|
||||
SmallTunnelLengthRange = element.GetAttributeVector2("SmallTunnelLengthRange", new Vector2(5000.0f, 10000.0f));
|
||||
|
||||
|
||||
string biomeStr = element.GetAttributeString("biomes", "");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(biomeStr))
|
||||
{
|
||||
allowedBiomes = new List<Biome>(biomes);
|
||||
@@ -316,6 +405,28 @@ namespace Barotrauma
|
||||
allowedBiomes.Add(matchingBiome);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
case "background":
|
||||
BackgroundSprite = new Sprite(subElement);
|
||||
break;
|
||||
case "backgroundtop":
|
||||
BackgroundTopSprite = new Sprite(subElement);
|
||||
break;
|
||||
case "wall":
|
||||
WallSprite = new Sprite(subElement);
|
||||
break;
|
||||
case "walledge":
|
||||
WallEdgeSprite = new Sprite(subElement);
|
||||
break;
|
||||
case "waterparticles":
|
||||
WaterParticles = new Sprite(subElement);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadPresets()
|
||||
@@ -323,10 +434,10 @@ namespace Barotrauma
|
||||
levelParams = new List<LevelGenerationParams>();
|
||||
biomes = new List<Biome>();
|
||||
|
||||
var files = GameMain.SelectedPackage.GetFilesOfType(ContentType.LevelGenerationParameters);
|
||||
var files = GameMain.Instance.GetFilesOfType(ContentType.LevelGenerationParameters);
|
||||
if (!files.Any())
|
||||
{
|
||||
files.Add("Content/Map/LevelGenerationParameters.xml");
|
||||
files = new List<string>() { "Content/Map/LevelGenerationParameters.xml" };
|
||||
}
|
||||
|
||||
List<XElement> biomeElements = new List<XElement>();
|
||||
|
||||
Reference in New Issue
Block a user