From f96b3fa35fe3c5be9df949367005af4e1aa67203 Mon Sep 17 00:00:00 2001
From: Saalvage <29021710+Saalvage@users.noreply.github.com>
Date: Sun, 17 Jan 2021 01:53:22 +0100
Subject: [PATCH] Added screen entity
---
CBRE.DataStructures/GameData/GameData.cs | 5 +++++
CBRE.Editor/CBRE.Editor.csproj | 3 +++
CBRE.Editor/Compiling/RMeshExport.cs | 14 +++++++++++++-
CBRE.Editor/Sprites/screen.png | Bin 0 -> 582 bytes
4 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 CBRE.Editor/Sprites/screen.png
diff --git a/CBRE.DataStructures/GameData/GameData.cs b/CBRE.DataStructures/GameData/GameData.cs
index 89b02492e..1ff86da26 100644
--- a/CBRE.DataStructures/GameData/GameData.cs
+++ b/CBRE.DataStructures/GameData/GameData.cs
@@ -49,6 +49,11 @@ public GameData() {
modelDataObj.Properties.Add(new Property("scale", VariableType.Vector) { ShortDescription = "Scale", DefaultValue = "1 1 1" });
Classes.Add(modelDataObj);
+ var screenDataObj = new GameDataObject("screen", "Savescreen.", ClassType.Point);
+ screenDataObj.Properties.Add(new Property("imgpath", VariableType.Other) { ShortDescription = "Image Path", DefaultValue = "" });
+ screenDataObj.Behaviours.Add(new Behaviour("sprite", "sprites/screen"));
+ Classes.Add(screenDataObj);
+
var noShadowObj = new GameDataObject("noshadow", "Disables shadow casting for this brush.", ClassType.Solid);
Classes.Add(noShadowObj);
diff --git a/CBRE.Editor/CBRE.Editor.csproj b/CBRE.Editor/CBRE.Editor.csproj
index 353be2214..f4d22accb 100644
--- a/CBRE.Editor/CBRE.Editor.csproj
+++ b/CBRE.Editor/CBRE.Editor.csproj
@@ -792,6 +792,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/CBRE.Editor/Compiling/RMeshExport.cs b/CBRE.Editor/Compiling/RMeshExport.cs
index d15602ca7..29d83a1fb 100644
--- a/CBRE.Editor/Compiling/RMeshExport.cs
+++ b/CBRE.Editor/Compiling/RMeshExport.cs
@@ -65,6 +65,8 @@ public static void SaveToFile(string filename, Document document, ExportForm for
IEnumerable props = map.WorldSpawn.Find(x => x.ClassName != null && x.ClassName.ToLower() == "model").OfType();
+ IEnumerable screens = map.WorldSpawn.Find(x => x.ClassName != null && x.ClassName.ToLower() == "screen").OfType();
+
FileStream stream = new FileStream(filepath + "/" + filename, FileMode.Create);
BinaryWriter br = new BinaryWriter(stream);
@@ -232,7 +234,7 @@ public static void SaveToFile(string filename, Document document, ExportForm for
br.Write((Int32)0);
}
- br.Write((Int32)(lights.Count + waypoints.Count + soundEmitters.Count() + props.Count()));
+ br.Write((Int32)(lights.Count + waypoints.Count + soundEmitters.Count() + props.Count() + screens.Count()));
foreach (Light light in lights) {
br.WriteB3DString("light");
@@ -296,6 +298,16 @@ public static void SaveToFile(string filename, Document document, ExportForm for
br.Write((float)scale.Z);
}
+ foreach (Entity screen in screens) {
+ br.WriteB3DString("screen");
+
+ br.Write((float)screen.Origin.X);
+ br.Write((float)screen.Origin.Z);
+ br.Write((float)screen.Origin.Y);
+
+ br.WriteB3DString(screen.EntityData.GetPropertyValue("imgpath"));
+ }
+
br.Dispose();
stream.Dispose();
diff --git a/CBRE.Editor/Sprites/screen.png b/CBRE.Editor/Sprites/screen.png
new file mode 100644
index 0000000000000000000000000000000000000000..da8c97b05d9a9f26f8b0fdfea6dd4c3718d34ffb
GIT binary patch
literal 582
zcmV-M0=fN(P)19!22v&LJU9@Ps&??5X7hYoPt0ARI~5F0wi|`0J`&e%U5GdxB}R_)O~!u
zS^sy}^5@6bUF{QuO#n)Z^(ys1aRX>Yv;;?j;R4XQc!H9GU;^kxyaWLNmUDtQ3Bm$0
zFK?Ikuhl&D^z!igT_~gX(r5ZHug4pW%i}UW4-|KSShNPff)k76b-MxJ9p&l)a5qSq
zy*1+8a=dV=c7fRMw*ruSo`b0#Kx*={CP>ZXivX}@ddpl>f~*PBY7-lwg+O&K;62&p
zss{ipZcuz9lxt+Y?Z5(H0k@$uxB!mBf6omO51{7)JS>iYNalcuce%P(JuHJ*2C)p@
zco+5o*au)AfQ=A#g4hb
zA+(Y&L_+o?O{oxS^W!c3(Q*foIH{0qKAFnO8l|A9W=)4qo?gufTl}t~x@v~}55oBu
UFNyiuC;$Ke07*qoM6N<$f~2wp_y7O^
literal 0
HcmV?d00001