Dirty workaround for background music breaking during loading (the music is switched when a round starts), the "wall" at the top of the levels is drawn on top of the lightmap, small fixes in AIObjectiveGetItem and BackGroundSpriteManager
This commit is contained in:
@@ -117,7 +117,7 @@
|
|||||||
<Compile Include="Source\GameSession\ShiftSummary.cs" />
|
<Compile Include="Source\GameSession\ShiftSummary.cs" />
|
||||||
<Compile Include="Source\GUI\GUIDropDown.cs" />
|
<Compile Include="Source\GUI\GUIDropDown.cs" />
|
||||||
<Compile Include="Source\GUI\GUIMessage.cs" />
|
<Compile Include="Source\GUI\GUIMessage.cs" />
|
||||||
<Compile Include="Source\GUI\TitleScreen.cs" />
|
<Compile Include="Source\GUI\LoadingScreen.cs" />
|
||||||
<Compile Include="Source\Items\Components\Holdable\MeleeWeapon.cs" />
|
<Compile Include="Source\Items\Components\Holdable\MeleeWeapon.cs" />
|
||||||
<Compile Include="Source\Items\Components\Holdable\Propulsion.cs" />
|
<Compile Include="Source\Items\Components\Holdable\Propulsion.cs" />
|
||||||
<Compile Include="Source\Items\Components\Machines\Deconstructor.cs" />
|
<Compile Include="Source\Items\Components\Machines\Deconstructor.cs" />
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ namespace Barotrauma
|
|||||||
if (targetItem == null) return;
|
if (targetItem == null) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (moveToTarget == null) return;
|
||||||
|
|
||||||
if (Vector2.Distance(character.Position, moveToTarget.Position) < targetItem.PickDistance*2.0f)
|
if (Vector2.Distance(character.Position, moveToTarget.Position) < targetItem.PickDistance*2.0f)
|
||||||
{
|
{
|
||||||
int targetSlot = -1;
|
int targetSlot = -1;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Barotrauma
|
|||||||
int x = (int)Math.Floor(((Vector2)pos).X / GridSize);
|
int x = (int)Math.Floor(((Vector2)pos).X / GridSize);
|
||||||
if (x<0 || x >= sprites.GetLength(0)) continue;
|
if (x<0 || x >= sprites.GetLength(0)) continue;
|
||||||
int y = (int)Math.Floor(((Vector2)pos).Y / GridSize);
|
int y = (int)Math.Floor(((Vector2)pos).Y / GridSize);
|
||||||
if (y<0 || 1 >= sprites.GetLength(1)) continue;
|
if (y<0 || y >= sprites.GetLength(1)) continue;
|
||||||
|
|
||||||
sprites[x,y].Add(newSprite);
|
sprites[x,y].Add(newSprite);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ namespace Barotrauma
|
|||||||
TaskManager.StartShift(level);
|
TaskManager.StartShift(level);
|
||||||
|
|
||||||
GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f);
|
GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f);
|
||||||
|
SoundPlayer.SwitchMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndShift(string endMessage)
|
public void EndShift(string endMessage)
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Barotrauma
|
|||||||
spriteBatch.Draw(shaftTexture,
|
spriteBatch.Draw(shaftTexture,
|
||||||
new Rectangle((int)(MathUtils.Round(pos.X, 512.0f)), (int)pos.Y, width, 512),
|
new Rectangle((int)(MathUtils.Round(pos.X, 512.0f)), (int)pos.Y, width, 512),
|
||||||
new Rectangle(0, 0, width, 256),
|
new Rectangle(0, 0, width, 256),
|
||||||
Color.White, 0.0f,
|
level.BackgroundColor, 0.0f,
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
SpriteEffects.None, 0.0f);
|
SpriteEffects.None, 0.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,12 +310,19 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Submarine.DrawFront(spriteBatch);
|
Submarine.DrawFront(spriteBatch);
|
||||||
|
|
||||||
if (Level.Loaded!=null) Level.Loaded.DrawFront(spriteBatch);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
GameMain.LightManager.DrawLightMap(spriteBatch, cam, lightBlur.Effect);
|
GameMain.LightManager.DrawLightMap(spriteBatch, cam, lightBlur.Effect);
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||||
|
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
||||||
|
null, null, null,
|
||||||
|
cam.Transform);
|
||||||
|
|
||||||
|
if (Level.Loaded!=null) Level.Loaded.DrawFront(spriteBatch);
|
||||||
|
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
if (Character.Controlled != null)
|
if (Character.Controlled != null)
|
||||||
{
|
{
|
||||||
GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam, lightBlur.Effect);
|
GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam, lightBlur.Effect);
|
||||||
|
|||||||
@@ -229,44 +229,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (musicClips == null) return;
|
if (musicClips == null) return;
|
||||||
|
|
||||||
Task criticalTask = null;
|
List<BackgroundMusic> suitableMusic = GetSuitableMusicClips();
|
||||||
if (GameMain.GameSession!=null && GameMain.GameSession.TaskManager != null)
|
|
||||||
{
|
|
||||||
foreach (Task task in GameMain.GameSession.TaskManager.Tasks)
|
|
||||||
{
|
|
||||||
if (!task.IsStarted) continue;
|
|
||||||
if (criticalTask == null || task.Priority > criticalTask.Priority)
|
|
||||||
{
|
|
||||||
criticalTask = task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<BackgroundMusic> suitableMusic = null;
|
|
||||||
if (OverrideMusicType != null)
|
|
||||||
{
|
|
||||||
suitableMusic = musicClips.Where(x => x != null && x.type == OverrideMusicType).ToList();
|
|
||||||
}
|
|
||||||
else if (Character.Controlled != null && Level.Loaded != null && Level.Loaded.Ruins.Any(r => r.Area.Contains(Character.Controlled.WorldPosition)))
|
|
||||||
{
|
|
||||||
suitableMusic = musicClips.Where(x => x != null && x.type == "ruins").ToList();
|
|
||||||
}
|
|
||||||
else if (Submarine.Loaded != null && Submarine.Loaded.AtDamageDepth)
|
|
||||||
{
|
|
||||||
suitableMusic = musicClips.Where(x => x != null && x.type == "deep").ToList();
|
|
||||||
}
|
|
||||||
else if (criticalTask == null)
|
|
||||||
{
|
|
||||||
suitableMusic = musicClips.Where(x => x != null && x.type == "default").ToList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
suitableMusic = musicClips.Where(x =>
|
|
||||||
x != null &&
|
|
||||||
x.type == criticalTask.MusicType &&
|
|
||||||
x.priorityRange.X < criticalTask.Priority &&
|
|
||||||
x.priorityRange.Y > criticalTask.Priority).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (suitableMusic.Count > 0 && !suitableMusic.Contains(currentMusic))
|
if (suitableMusic.Count > 0 && !suitableMusic.Contains(currentMusic))
|
||||||
{
|
{
|
||||||
@@ -297,6 +260,56 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SwitchMusic()
|
||||||
|
{
|
||||||
|
var suitableMusic = GetSuitableMusicClips();
|
||||||
|
|
||||||
|
if (suitableMusic.Count > 1)
|
||||||
|
{
|
||||||
|
targetMusic = suitableMusic.Find(m => m != currentMusic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<BackgroundMusic> GetSuitableMusicClips()
|
||||||
|
{
|
||||||
|
Task criticalTask = null;
|
||||||
|
if (GameMain.GameSession != null && GameMain.GameSession.TaskManager != null)
|
||||||
|
{
|
||||||
|
foreach (Task task in GameMain.GameSession.TaskManager.Tasks)
|
||||||
|
{
|
||||||
|
if (!task.IsStarted) continue;
|
||||||
|
if (criticalTask == null || task.Priority > criticalTask.Priority)
|
||||||
|
{
|
||||||
|
criticalTask = task;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OverrideMusicType != null)
|
||||||
|
{
|
||||||
|
return musicClips.Where(x => x != null && x.type == OverrideMusicType).ToList();
|
||||||
|
}
|
||||||
|
else if (Character.Controlled != null && Level.Loaded != null && Level.Loaded.Ruins.Any(r => r.Area.Contains(Character.Controlled.WorldPosition)))
|
||||||
|
{
|
||||||
|
return musicClips.Where(x => x != null && x.type == "ruins").ToList();
|
||||||
|
}
|
||||||
|
else if (Submarine.Loaded != null && Submarine.Loaded.AtDamageDepth)
|
||||||
|
{
|
||||||
|
return musicClips.Where(x => x != null && x.type == "deep").ToList();
|
||||||
|
}
|
||||||
|
else if (criticalTask == null)
|
||||||
|
{
|
||||||
|
return musicClips.Where(x => x != null && x.type == "default").ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return musicClips.Where(x =>
|
||||||
|
x != null &&
|
||||||
|
x.type == criticalTask.MusicType &&
|
||||||
|
x.priorityRange.X < criticalTask.Priority &&
|
||||||
|
x.priorityRange.Y > criticalTask.Priority).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void PlaySplashSound(Vector2 worldPosition, float strength)
|
public static void PlaySplashSound(Vector2 worldPosition, float strength)
|
||||||
{
|
{
|
||||||
int splashIndex = MathHelper.Clamp((int)(strength + Rand.Range(-2,2)), 0, SplashSounds.Length-1);
|
int splashIndex = MathHelper.Clamp((int)(strength + Rand.Range(-2,2)), 0, SplashSounds.Length-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user