v0.14.6.0

This commit is contained in:
Joonas Rikkonen
2021-06-17 17:54:52 +03:00
parent 3f324b14e8
commit c27e2ea5ab
348 changed files with 13156 additions and 4266 deletions
@@ -1,63 +0,0 @@
using System.Collections.Generic;
using System.Threading;
namespace Barotrauma
{
public static class CrossThread
{
public delegate void TaskDelegate();
private class Task
{
public TaskDelegate Deleg;
public ManualResetEvent Mre;
public bool Done;
public Task(TaskDelegate d)
{
Deleg = d;
Mre = new ManualResetEvent(false);
Done = false;
}
public void PerformWait()
{
if (!Done) { Mre.WaitOne(); }
}
}
private static List<Task> enqueuedTasks;
static CrossThread() { enqueuedTasks = new List<Task>(); }
public static void ProcessTasks()
{
lock (enqueuedTasks)
{
foreach (var task in enqueuedTasks)
{
task.Deleg();
task.Mre.Set();
task.Done = true;
}
enqueuedTasks.Clear();
}
}
public static void RequestExecutionOnMainThread(TaskDelegate deleg)
{
if (GameMain.MainThread == null || Thread.CurrentThread == GameMain.MainThread)
{
deleg();
}
else
{
Task newTask = new Task(deleg);
lock (enqueuedTasks)
{
enqueuedTasks.Add(newTask);
}
newTask.PerformWait();
}
}
}
}
@@ -215,15 +215,10 @@ namespace Barotrauma
}
else
{
DebugConsole.NewMessage($"Could not compress a texture because the dimensions aren't a multiple of 4 (path: {path ?? "null"}, size: {width}x{height})", Color.Orange);
DebugConsole.AddWarning($"Could not compress a texture because the dimensions aren't a multiple of 4 (path: {path ?? "null"}, size: {width}x{height})");
}
}
if (((width & 0x03) != 0) || ((height & 0x03) != 0))
{
DebugConsole.AddWarning($"Cannot compress a texture because the dimensions are not a multiple of 4 (path: {path ?? "null"}, size: {width}x{height})");
}
Texture2D tex = null;
CrossThread.RequestExecutionOnMainThread(() =>
{
@@ -112,7 +112,7 @@ namespace Barotrauma
GameMain.Instance.GraphicsDevice.Viewport = prevViewport;
using (FileStream fs = File.Open("wikiimage.png", System.IO.FileMode.Create))
{
rt.SaveAsPng(fs, boundingBox.Width, boundingBox.Height);
rt.SaveAsPng(fs, texWidth, texHeight);
}
}
}