38f1ddb...178a853: v0.8.9.1, removed content folder

This commit is contained in:
Joonas Rikkonen
2019-03-18 19:46:58 +02:00
parent 38f1ddb6fe
commit 6c0679c297
1054 changed files with 151673 additions and 144931 deletions
@@ -1,5 +1,10 @@
using Microsoft.Xna.Framework;
using Barotrauma.Networking;
using Lidgren.Network;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FarseerPhysics.Dynamics;
using System.Linq;
using System.Collections.Generic;
namespace Barotrauma
{
@@ -8,11 +13,42 @@ namespace Barotrauma
private LevelRenderer renderer;
private BackgroundCreatureManager backgroundCreatureManager;
public LevelRenderer Renderer => renderer;
public void ReloadTextures()
{
renderer.ReloadTextures();
HashSet<Texture2D> uniqueTextures = new HashSet<Texture2D>();
HashSet<Sprite> uniqueSprites = new HashSet<Sprite>();
var allLevelObjects = levelObjectManager.GetAllObjects();
foreach (var levelObj in allLevelObjects)
{
if (levelObj.Prefab.Sprite != null &&
!uniqueTextures.Contains(levelObj.Prefab.Sprite.Texture))
{
uniqueTextures.Add(levelObj.Prefab.Sprite.Texture);
uniqueSprites.Add(levelObj.Prefab.Sprite);
}
if (levelObj.Prefab.SpecularSprite != null &&
!uniqueTextures.Contains(levelObj.Prefab.SpecularSprite.Texture))
{
uniqueTextures.Add(levelObj.Prefab.SpecularSprite.Texture);
uniqueSprites.Add(levelObj.Prefab.SpecularSprite);
}
}
foreach (Sprite sprite in uniqueSprites)
{
sprite.ReloadTexture();
}
}
public void DrawFront(SpriteBatch spriteBatch)
public void DrawFront(SpriteBatch spriteBatch, Camera cam)
{
if (renderer == null) return;
renderer.Draw(spriteBatch);
renderer.Draw(spriteBatch, cam);
if (GameMain.DebugDraw)
{
@@ -43,13 +79,37 @@ namespace Barotrauma
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam)
{
float brightness = MathHelper.Clamp(1.1f + (cam.Position.Y - Size.Y) / 100000.0f, 0.1f, 1.0f);
GameMain.LightManager.AmbientLight = new Color(backgroundColor * brightness, 1.0f);
float brightness = MathHelper.Clamp(1.1f + (cam.Position.Y - Size.Y) / 100000.0f, 0.1f, 1.0f);
var lightColorHLS = generationParams.AmbientLightColor.RgbToHLS();
lightColorHLS.Y *= brightness;
graphics.Clear(backgroundColor);
GameMain.LightManager.AmbientLight = ToolBox.HLSToRGB(lightColorHLS);
graphics.Clear(BackgroundColor);
if (renderer == null) return;
renderer.DrawBackground(spriteBatch, cam, backgroundSpriteManager, backgroundCreatureManager);
renderer.DrawBackground(spriteBatch, cam, levelObjectManager, backgroundCreatureManager);
}
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
{
if (GameMain.Server != null) return;
foreach (LevelWall levelWall in extraWalls)
{
if (levelWall.Body.BodyType == BodyType.Static) continue;
Vector2 bodyPos = new Vector2(
msg.ReadSingle(),
msg.ReadSingle());
levelWall.MoveState = msg.ReadRangedSingle(0.0f, MathHelper.TwoPi, 16);
if (Vector2.DistanceSquared(bodyPos, levelWall.Body.Position) > 0.5f)
{
levelWall.Body.SetTransform(bodyPos, levelWall.Body.Rotation);
}
}
}
}
}