Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Added screen entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Saalvage committed Jan 17, 2021
1 parent 63b8d34 commit f96b3fa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CBRE.DataStructures/GameData/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions CBRE.Editor/CBRE.Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,9 @@
<None Include="Sprites\waypoint.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Sprites\screen.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ToolTextures\BLOCK_LIGHT.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
14 changes: 13 additions & 1 deletion CBRE.Editor/Compiling/RMeshExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public static void SaveToFile(string filename, Document document, ExportForm for

IEnumerable<Entity> props = map.WorldSpawn.Find(x => x.ClassName != null && x.ClassName.ToLower() == "model").OfType<Entity>();

IEnumerable<Entity> screens = map.WorldSpawn.Find(x => x.ClassName != null && x.ClassName.ToLower() == "screen").OfType<Entity>();

FileStream stream = new FileStream(filepath + "/" + filename, FileMode.Create);
BinaryWriter br = new BinaryWriter(stream);

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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();

Expand Down
Binary file added CBRE.Editor/Sprites/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f96b3fa

Please sign in to comment.