- The commonness of scripted events can be overridden for specific level types (e.g. some monsters can be set to spawn more frequently in specific types of levels).
- The sub can be moved from location to another in the map view by double clicking in debug builds. - Level wall color can be changed in level generation parameters. - Fixed level geometry not being rendered if the ocean floor is visible (which isn't a problem in most level types, but there can be levels where the ocean floor is so close to the actual level that they can both be visible at the same time). - Background sprite scale is taken into account when calculating particle emitter positions. - Fixed limb lights being rendered even if the character is disabled.
This commit is contained in:
@@ -255,7 +255,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (s.Prefab.ParticleEmitterPrefab != null)
|
||||
{
|
||||
Vector2 emitterPos = new Vector2(s.Prefab.EmitterPosition.X, s.Prefab.EmitterPosition.Y);
|
||||
Vector2 emitterPos = new Vector2(s.Prefab.EmitterPosition.X, s.Prefab.EmitterPosition.Y) * s.Scale;
|
||||
|
||||
if (s.Rotation != 0.0f || s.Prefab.SwingAmount != 0.0f)
|
||||
{
|
||||
|
||||
@@ -261,14 +261,24 @@ namespace Barotrauma
|
||||
{
|
||||
if (wallVertices == null) return;
|
||||
|
||||
bool renderLevel = cam.WorldView.Y >= 0.0f;
|
||||
bool renderSeaFloor = cam.WorldView.Y - cam.WorldView.Height < level.SeaFloorTopPos + 1024;
|
||||
|
||||
if (!renderLevel && !renderSeaFloor) return;
|
||||
|
||||
wallEdgeEffect.World = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 100) * 0.5f;
|
||||
wallCenterEffect.World = wallEdgeEffect.World;
|
||||
|
||||
//render the solid center of the wall cells
|
||||
|
||||
graphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
|
||||
wallCenterEffect.CurrentTechnique.Passes[0].Apply();
|
||||
if (GameMain.GameScreen.Cam.WorldView.Y - GameMain.GameScreen.Cam.WorldView.Height < level.SeaFloorTopPos + 1024)
|
||||
|
||||
if (renderLevel)
|
||||
{
|
||||
graphicsDevice.SetVertexBuffer(bodyVertices);
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(bodyVertices.VertexCount / 3.0f));
|
||||
}
|
||||
if (renderSeaFloor)
|
||||
{
|
||||
foreach (LevelWall wall in level.ExtraWalls)
|
||||
{
|
||||
@@ -276,28 +286,23 @@ namespace Barotrauma
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wall.BodyVertices.VertexCount / 3.0f));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
graphicsDevice.SetVertexBuffer(bodyVertices);
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(bodyVertices.VertexCount / 3.0f));
|
||||
}
|
||||
|
||||
//render the edges of the wall cells
|
||||
wallEdgeEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
if (GameMain.GameScreen.Cam.WorldView.Y - GameMain.GameScreen.Cam.WorldView.Height < level.SeaFloorTopPos + 1024)
|
||||
if (renderLevel)
|
||||
{
|
||||
wallEdgeEffect.CurrentTechnique.Passes[0].Apply();
|
||||
graphicsDevice.SetVertexBuffer(wallVertices);
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wallVertices.VertexCount / 3.0f));
|
||||
}
|
||||
if (renderSeaFloor)
|
||||
{
|
||||
foreach (LevelWall wall in level.ExtraWalls)
|
||||
{
|
||||
graphicsDevice.SetVertexBuffer(wall.WallVertices);
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wall.WallVertices.VertexCount / 3.0f));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
graphicsDevice.SetVertexBuffer(wallVertices);
|
||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wallVertices.VertexCount / 3.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
foreach (LightSource light in lights)
|
||||
{
|
||||
if (light.Color.A < 1 || light.Range < 1.0f || !light.CastShadows) continue;
|
||||
if (light.Color.A < 1 || light.Range < 1.0f || !light.CastShadows || !light.Enabled) continue;
|
||||
if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, light.Range, viewRect)) continue;
|
||||
|
||||
light.Draw(spriteBatch, lightEffect, transform);
|
||||
|
||||
@@ -116,6 +116,8 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
}
|
||||
|
||||
public bool Enabled = true;
|
||||
|
||||
public LightSource (XElement element)
|
||||
: this(Vector2.Zero, 100.0f, Color.White, null)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,13 @@ namespace Barotrauma
|
||||
GameMain.LobbyScreen.SelectLocation(highlightedLocation, connection);
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (PlayerInput.DoubleClicked() && highlightedLocation != null)
|
||||
{
|
||||
currentLocation = highlightedLocation;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +123,11 @@ namespace Barotrauma
|
||||
new Vector2(0, 30), SpriteEffects.None, 0.01f);
|
||||
}
|
||||
|
||||
//TODO: remove
|
||||
Vector2 center = rectCenter + (connection.CenterPos + offset) * scale;
|
||||
GUI.DrawString(spriteBatch, center, connection.Biome.Name, Color.White);
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
Vector2 center = rectCenter + (connection.CenterPos + offset) * scale;
|
||||
GUI.DrawString(spriteBatch, center, connection.Biome.Name, Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
rect.Inflate(8, 8);
|
||||
|
||||
@@ -41,6 +41,12 @@ namespace Barotrauma
|
||||
{
|
||||
limb.body.Enabled = enabled;
|
||||
}
|
||||
#if CLIENT
|
||||
if (limb.LightSource != null)
|
||||
{
|
||||
limb.LightSource.Enabled = enabled;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
AnimController.Collider.Enabled = value;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
@@ -14,7 +15,9 @@ namespace Barotrauma
|
||||
protected int difficulty;
|
||||
|
||||
protected bool isFinished;
|
||||
|
||||
|
||||
public Dictionary<string, int> OverrideCommonness;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
@@ -65,6 +68,22 @@ namespace Barotrauma
|
||||
commonness = ToolBox.GetAttributeInt(element, "commonness", 1);
|
||||
|
||||
MusicType = ToolBox.GetAttributeString(element, "musictype", "default");
|
||||
|
||||
OverrideCommonness = new Dictionary<string, int>();
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
case "overridecommonness":
|
||||
string levelType = ToolBox.GetAttributeString(subElement, "leveltype", "");
|
||||
if (!OverrideCommonness.ContainsKey(levelType))
|
||||
{
|
||||
OverrideCommonness.Add(levelType, ToolBox.GetAttributeInt(subElement, "commonness", 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ namespace Barotrauma
|
||||
private List<Ruin> ruins;
|
||||
|
||||
private Color backgroundColor;
|
||||
private Color wallColor;
|
||||
|
||||
private LevelGenerationParams generationParams;
|
||||
|
||||
|
||||
public Vector2 StartPosition
|
||||
{
|
||||
get { return startPosition; }
|
||||
@@ -145,6 +145,11 @@ namespace Barotrauma
|
||||
{
|
||||
get { return backgroundColor; }
|
||||
}
|
||||
|
||||
public Color WallColor
|
||||
{
|
||||
get { return wallColor; }
|
||||
}
|
||||
|
||||
public Level(string seed, float difficulty, LevelGenerationParams generationParams)
|
||||
{
|
||||
@@ -448,13 +453,13 @@ namespace Barotrauma
|
||||
|
||||
cellGrid[x, y].Add(cell);
|
||||
}
|
||||
|
||||
|
||||
ruins = new List<Ruin>();
|
||||
for (int i = 0; i<generationParams.RuinCount; i++)
|
||||
for (int i = 0; i < generationParams.RuinCount; i++)
|
||||
{
|
||||
GenerateRuin(mainPath);
|
||||
}
|
||||
|
||||
|
||||
startPosition.Y = borders.Height;
|
||||
endPosition.Y = borders.Height;
|
||||
|
||||
@@ -464,8 +469,8 @@ namespace Barotrauma
|
||||
bodies = CaveGenerator.GeneratePolygons(cellsWithBody, out triangles);
|
||||
|
||||
#if CLIENT
|
||||
renderer.SetBodyVertices(CaveGenerator.GenerateRenderVerticeList(triangles).ToArray(), Color.White);
|
||||
renderer.SetWallVertices(CaveGenerator.GenerateWallShapes(cells), Color.White);
|
||||
renderer.SetBodyVertices(CaveGenerator.GenerateRenderVerticeList(triangles).ToArray(), generationParams.WallColor);
|
||||
renderer.SetWallVertices(CaveGenerator.GenerateWallShapes(cells), generationParams.WallColor);
|
||||
#endif
|
||||
|
||||
TopBarrier = BodyFactory.CreateEdge(GameMain.World,
|
||||
|
||||
@@ -96,6 +96,12 @@ namespace Barotrauma
|
||||
set;
|
||||
}
|
||||
|
||||
public Color WallColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(1000, false)]
|
||||
public int BackgroundSpriteAmount
|
||||
{
|
||||
@@ -277,6 +283,9 @@ namespace Barotrauma
|
||||
Vector3 colorVector = ToolBox.GetAttributeVector3(element, "BackgroundColor", new Vector3(50, 46, 20));
|
||||
BackgroundColor = new Color((int)colorVector.X, (int)colorVector.Y, (int)colorVector.Z);
|
||||
|
||||
colorVector = ToolBox.GetAttributeVector3(element, "WallColor", new Vector3(255,255,255));
|
||||
WallColor = new Color((int)colorVector.X, (int)colorVector.Y, (int)colorVector.Z);
|
||||
|
||||
VoronoiSiteInterval = ToolBox.GetAttributeVector2(element, "VoronoiSiteInterval", new Vector2(3000, 3000));
|
||||
|
||||
VoronoiSiteVariance = ToolBox.GetAttributeVector2(element, "VoronoiSiteVariance", new Vector2(voronoiSiteInterval.X, voronoiSiteInterval.Y) * 0.4f);
|
||||
|
||||
Reference in New Issue
Block a user