diff --git a/Leditor.Renderer/Partial/Engine.Materials.cs b/Leditor.Renderer/Partial/Engine.Materials.cs
index 4a6260c..af8444b 100644
--- a/Leditor.Renderer/Partial/Engine.Materials.cs
+++ b/Leditor.Renderer/Partial/Engine.Materials.cs
@@ -3860,4 +3860,109 @@ in RenderTexture2D rt
}
}
}
+
+ protected virtual void DrawCeramicMaterial_MTX(
+ in MaterialDefinition mat,
+ int x,
+ int y,
+ int layer,
+ in RenderCamera camera,
+ in RenderTexture2D rt
+ ) {
+ double chaos = 0;
+ var doColor = 0;
+
+ var eff = Level!.Effects.FirstOrDefault(e => e.Name == "Ceramic Chaos");
+
+ if (eff != null && eff.Options.Length > 1) {
+ var opt = eff.Options[2];
+
+ var (dmin, dmax) = (opt.Choice as string) switch {
+ "1" => (0, 0),
+ "2" => (1, 1),
+ "3" => (2, 2),
+ "1:st and 2:nd" => (0, 1),
+ "2:nd and 3:rd" => (1, 2),
+ _ => (0, 2)
+ };
+
+ if (layer <= dmax && layer >= dmin)
+ chaos = Data.Utils.InBounds(eff.Matrix, x, y) ? eff.Matrix[y, x] : 0;
+
+ doColor = Utils.BoolInt(eff.Options[1].Choice is "Colored");
+ }
+
+ if (doColor > 0) _anyDecals = true;
+
+ chaos *= 0.01;
+
+ var sublayer = layer * 10;
+ var pos = (new Vector2(x, y) - camera.Coords/20f) * 20 - Vector2.One * 10;
+ var color = new Color(239, 255, 255, 255);
+
+ int left = 0, top = 0, right = 0, bottom = 0;
+
+ var leftCell = Utils.GetGeoCellType(Level!.GeoMatrix, x - 1, y, layer);
+ var topCell = Utils.GetGeoCellType(Level!.GeoMatrix, x, y - 1, layer);
+ var rightCell = Utils.GetGeoCellType(Level!.GeoMatrix, x + 1, y, layer);
+ var bottomCell = Utils.GetGeoCellType(Level!.GeoMatrix, x, y + 1, layer);
+
+ if (leftCell != GeoType.Solid && (!Configuration.MaterialFixes || leftCell is not GeoType.SlopeNE or GeoType.SlopeNW or GeoType.SlopeES or GeoType.SlopeSW or GeoType.Platform))
+ {
+ left = 1;
+ }
+ if (topCell != GeoType.Solid && (!Configuration.MaterialFixes || topCell is not GeoType.SlopeNE or GeoType.SlopeNW or GeoType.SlopeES or GeoType.SlopeSW or GeoType.Platform))
+ {
+ top = 1;
+ }
+ if (rightCell != GeoType.Solid && (!Configuration.MaterialFixes || rightCell is not GeoType.SlopeNE or GeoType.SlopeNW or GeoType.SlopeES or GeoType.SlopeSW or GeoType.Platform))
+ {
+ right = 1;
+ }
+ if (bottomCell != GeoType.Solid && (!Configuration.MaterialFixes || bottomCell is not GeoType.SlopeNE or GeoType.SlopeNW or GeoType.SlopeES or GeoType.SlopeSW or GeoType.Platform))
+ {
+ bottom = 1;
+ }
+
+ var thisCell = Utils.GetGeoCellType(Level!.GeoMatrix, x, y, layer);
+
+ var socketTexture = thisCell switch {
+ GeoType.SlopeNE => State.ceramicTileSocketNE,
+ GeoType.SlopeNW => State.ceramicTileSocketNW,
+ GeoType.SlopeES => State.ceramicTileSocketSE,
+ GeoType.SlopeSW => State.ceramicTileSocketSW,
+ GeoType.Platform => State.ceramicTileSocketFL,
+ _ => State.ceramicTileSocket
+ };
+
+ var texture = thisCell switch {
+ GeoType.SlopeNE => State.ceramicTileSilhCPNE,
+ GeoType.SlopeNW => State.ceramicTileSilhCPNW,
+ GeoType.SlopeES => State.ceramicTileSilhCPSE,
+ GeoType.SlopeSW => State.ceramicTileSilhCPSW,
+ GeoType.Platform => State.ceramicTileSilhCPFL,
+ _ => State.ceramicTileSilhCPFL
+ };
+
+ if (thisCell is
+ GeoType.Solid or
+ GeoType.SlopeNE or
+ GeoType.SlopeNW or
+ GeoType.SlopeES or
+ GeoType.SlopeSW
+ ) {
+ if (thisCell is GeoType.Solid) {
+ for (var q = 1; q <= 9; q++) {
+ BeginTextureMode(_layers[sublayer + q]);
+ DrawRectangleRec(
+ new Rectangle(-10+left, -10+top, 20-left-right, 20-top-bottom),
+ new Color(255 * (1 - doColor), 255*doColor, 0, 255)
+ );
+ EndTextureMode();
+ }
+ } else {
+
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Leditor.Renderer/Partial/Engine.cs b/Leditor.Renderer/Partial/Engine.cs
index db266bd..6348c18 100644
--- a/Leditor.Renderer/Partial/Engine.cs
+++ b/Leditor.Renderer/Partial/Engine.cs
@@ -153,6 +153,20 @@ protected class RenderState
public Texture2D circuitsImage;
public Texture2D densePipesImage;
+ public Texture2D ceramicTileSocket;
+ public Texture2D ceramicTileSocketNE;
+ public Texture2D ceramicTileSocketNW;
+ public Texture2D ceramicTileSocketSW;
+ public Texture2D ceramicTileSocketSE;
+ public Texture2D ceramicTileSocketFL;
+
+ public Texture2D ceramicTileSilhCPSW;
+ public Texture2D ceramicTileSilhCPNW;
+ public Texture2D ceramicTileSilhCPSE;
+ public Texture2D ceramicTileSilhCPNE;
+ public Texture2D ceramicTileSilhCPFL;
+
+
public virtual void Initialize(Registry registry)
{
if (Initialized) return;
@@ -315,6 +329,21 @@ public virtual void Initialize(Registry registry)
.ToDictionary(m => m.Item1, m => m.Item2, StringComparer.OrdinalIgnoreCase);
});
+ var ceramicTilesTask = Task.Run(() => {
+ ceramicTileSocket = internalLib["ceramicTileSocket"].Texture;
+ ceramicTileSocketNE = droughtLib["ceramicTileSocketNE"].Texture;
+ ceramicTileSocketNW = droughtLib["ceramicTileSocketNW"].Texture;
+ ceramicTileSocketSW = droughtLib["ceramicTileSocketSW"].Texture;
+ ceramicTileSocketSE = droughtLib["ceramicTileSocketSE"].Texture;
+ ceramicTileSocketFL = droughtLib["ceramicTileSocketFL"].Texture;
+
+ ceramicTileSilhCPSW = droughtLib["ceramicTileSilhCPSW"].Texture;
+ ceramicTileSilhCPNW = droughtLib["ceramicTileSilhCPNW"].Texture;
+ ceramicTileSilhCPSE = droughtLib["ceramicTileSilhCPSE"].Texture;
+ ceramicTileSilhCPNE = droughtLib["ceramicTileSilhCPNE"].Texture;
+ ceramicTileSilhCPFL = droughtLib["ceramicTileSilhCPFL"].Texture;
+ });
+
var memberTask = Task.Run(() => {
registry.Tiles?.Names.TryGetValue("Temple Stone Wedge", out TempleStoneWedge);
registry.Tiles?.Names.TryGetValue("Temple Stone Slope SE", out TempleStoneSlopeSE);
@@ -446,6 +475,7 @@ public virtual void Initialize(Registry registry)
wvTilesTask.Wait();
desnsePipesImagesTask.Wait();
desnsePipesImages2Task.Wait();
+ ceramicTilesTask.Wait();
Initialized = true;
}
@@ -538,6 +568,7 @@ public class Config
protected const int Height = 1200;
protected bool _tinySignsDrawn;
+ protected bool _anyDecals;
protected int _currentLayer;
@@ -698,6 +729,7 @@ protected virtual void Clear()
Level = null;
_tinySignsDrawn = false;
+ _anyDecals = false;
_currentLayer = 0;
}
diff --git a/Leditor/Program.cs b/Leditor/Program.cs
index b6c9a35..2a57b1c 100644
--- a/Leditor/Program.cs
+++ b/Leditor/Program.cs
@@ -2494,6 +2494,29 @@ void main() {
CloseWindow();
break;
}
+ catch (InvalidCastException ice)
+ {
+ Console.WriteLine(ice);
+ logger.Fatal($"Bruh Moment detected: loop try-catch block has caught an unexpected error: {ice}");
+
+ if (GLOBALS.Settings.Misc.FunnyDeathScreen)
+ {
+ var screenshot = LoadImageFromScreen();
+ screenshotTexture = LoadTextureFromImage(screenshot);
+ UnloadImage(screenshot);
+ }
+
+ deathScreen = new()
+ {
+ Screenshot = screenshotTexture,
+ Exception = ice,
+ Logger = logger
+ };
+
+
+
+ GLOBALS.Page = 99; // game over
+ }
catch (Exception e)
{
logger.Fatal($"Bruh Moment detected: loop try-catch block has caught an unexpected error: {e}");
diff --git a/Leditor/Serialization/Importers.cs b/Leditor/Serialization/Importers.cs
index 8511142..5022755 100644
--- a/Leditor/Serialization/Importers.cs
+++ b/Leditor/Serialization/Importers.cs
@@ -416,11 +416,11 @@ public static ((string category, Color color)[] categories, InitPropBase[][] ini
/// retrieved prop is missing a setting
public static ListGetProps(AstNode.Base? @base)
{
- if (@base is null) {
+ if (@base is null || @base is not AstNode.PropertyList pl) {
return [];
}
- var list = (AstNode.List)((AstNode.PropertyList)@base).Values.Single(p => ((AstNode.Symbol)p.Key).Value == "props").Value;
+ var list = (AstNode.List)(pl).Values.Single(p => ((AstNode.Symbol)p.Key).Value == "props").Value;
List props = [];
diff --git a/Leditor/Utils.cs b/Leditor/Utils.cs
index 7a04b0e..8baca8c 100644
--- a/Leditor/Utils.cs
+++ b/Leditor/Utils.cs
@@ -193,25 +193,26 @@ internal static async Task LoadProjectAsync(string filePath)
if (text.Length < 7) return new LoadFileResult();
- var objTask = Task.Factory.StartNew(() =>
+ var objTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[0]));
- var tilesObjTask = Task.Factory.StartNew(() =>
+ var tilesObjTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[1]));
- var terrainObjTask = Task.Factory.StartNew(() =>
+ var terrainObjTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[4]));
- var obj2Task = Task.Factory.StartNew(() =>
+ var obj2Task = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[5]));
- var effObjTask = Task.Factory.StartNew(() =>
+ var effObjTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[2]));
- var lightObjTask = Task.Factory.StartNew(() =>
+ var lightObjTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[3]));
- var camsObjTask = Task.Factory.StartNew(() =>
+ var camsObjTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[6]));
- var waterObjTask = Task.Factory.StartNew(() =>
+ var waterObjTask = Task.Run(() =>
LingoParser.Expression.ParseOrThrow(text[7]));
- var propsObjTask = string.IsNullOrEmpty(text[8]) ? null : Task.Factory.StartNew(() =>
- LingoParser.Expression.ParseOrThrow(text[8]));
+ var propsObjTask = string.IsNullOrEmpty(text[8])
+ ? null
+ : Task.Run(() => LingoParser.Expression.Parse(text[8]));
AstNode.Base obj;
AstNode.Base tilesObj;
@@ -274,7 +275,8 @@ internal static async Task LoadProjectAsync(string filePath)
}
try {
- propsObj = propsObjTask is null ? null : await propsObjTask;
+ var parseRes = propsObjTask is null ? null : await propsObjTask;
+ propsObj = parseRes?.Success == true ? parseRes.Value : null;
} catch (Exception e) {
propsObj = null;
propsLoadException = e;
diff --git a/Leditor/imgui.ini b/Leditor/imgui.ini
index acde668..23f0867 100644
--- a/Leditor/imgui.ini
+++ b/Leditor/imgui.ini
@@ -172,7 +172,7 @@ Collapsed=0
[Window][WindowOverViewport_11111111]
Pos=0,19
-Size=1920,972
+Size=1300,831
Collapsed=0
[Window][Shortcuts##EditorShortcuts]
@@ -196,7 +196,7 @@ Size=256,477
Collapsed=0
[Docking][Data]
-DockSpace ID=0x7C6B3D9B Window=0xA87D555D Pos=0,19 Size=1920,972 CentralNode=1
+DockSpace ID=0x7C6B3D9B Window=0xA87D555D Pos=0,19 Size=1300,831 CentralNode=1
DockSpace ID=0x8B93E3BD Pos=0,19 Size=1280,781 Split=X
DockNode ID=0x0000001B Parent=0x8B93E3BD SizeRef=939,800 Split=X
DockNode ID=0x00000011 Parent=0x0000001B SizeRef=887,991 Split=X
diff --git a/Release_Notes.txt b/Release_Notes.txt
index 234a5b6..3556029 100644
--- a/Release_Notes.txt
+++ b/Release_Notes.txt
@@ -1 +1 @@
-- Fixed cameras snapping back afteer dragging them.
\ No newline at end of file
+- Midigated the chances of the program crashing when loading levels with malformed props line.
\ No newline at end of file
diff --git a/Version.txt b/Version.txt
index 9ad1fa9..2dcfdf8 100644
--- a/Version.txt
+++ b/Version.txt
@@ -1 +1 @@
-0.9.99-6
\ No newline at end of file
+0.9.99-7
\ No newline at end of file