From d174843ce9e623d848f45605fabf0f82f0edac22 Mon Sep 17 00:00:00 2001 From: Will Date: Wed, 28 Oct 2015 22:46:37 -0600 Subject: [PATCH] Add empty constructors to MAP classes. These will be used with object initializers. --- LibBSP/src/Structs/MAP/MAPBrush.cs | 14 ++++++++++---- LibBSP/src/Structs/MAP/MAPBrushSide.cs | 9 +++++++-- LibBSP/src/Structs/MAP/MAPDisplacement.cs | 14 +++++++------- LibBSP/src/Structs/MAP/MAPPatch.cs | 7 ++++++- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/LibBSP/src/Structs/MAP/MAPBrush.cs b/LibBSP/src/Structs/MAP/MAPBrush.cs index 9fa997c..3fea722 100644 --- a/LibBSP/src/Structs/MAP/MAPBrush.cs +++ b/LibBSP/src/Structs/MAP/MAPBrush.cs @@ -6,19 +6,25 @@ using System.Collections.Generic; namespace LibBSP { /// - /// Class containing all data for a single brush, including side definitions or a patch definition + /// Class containing all data for a single brush, including side definitions or a patch definition. /// public class MAPBrush { public List sides = new List(6); public MAPPatch patch; - public bool isDetail { get; private set; } + public bool isDetail = false; + public bool isWater = false; /// - /// Creates a new MAPBrush object using the supplied string array as data + /// Creates a new empty MAPBrush object. Internal data will have to be set manually. /// - /// Data to parse + public MAPBrush() { } + + /// + /// Creates a new MAPBrush object using the supplied string array as data. + /// + /// Data to parse. public MAPBrush(string[] lines) { int braceCount = 0; bool brushDef3 = false; diff --git a/LibBSP/src/Structs/MAP/MAPBrushSide.cs b/LibBSP/src/Structs/MAP/MAPBrushSide.cs index 7dddfa6..51f0388 100644 --- a/LibBSP/src/Structs/MAP/MAPBrushSide.cs +++ b/LibBSP/src/Structs/MAP/MAPBrushSide.cs @@ -13,7 +13,7 @@ namespace LibBSP { using Vector3 = Vector3d; #endif /// - /// Class containing data for a brush side. Please note vertices must be set manually or generated through CSG + /// Class containing data for a brush side. Please note vertices must be set manually or generated through CSG. /// public class MAPBrushSide { @@ -34,10 +34,15 @@ namespace LibBSP { public int id; public MAPDisplacement displacement; + /// + /// Creates a new empty MAPBrushSide object. Internal data will have to be set manually. + /// + public MAPBrushSide() { } + /// /// Constructs a MAPBrushSide object using the provided string array as the data. /// - /// Data to parse + /// Data to parse. public MAPBrushSide(string[] lines) { // If lines.Length is 1, then this line contains all data for a brush side if (lines.Length == 1) { diff --git a/LibBSP/src/Structs/MAP/MAPDisplacement.cs b/LibBSP/src/Structs/MAP/MAPDisplacement.cs index 6ff2edf..922798f 100644 --- a/LibBSP/src/Structs/MAP/MAPDisplacement.cs +++ b/LibBSP/src/Structs/MAP/MAPDisplacement.cs @@ -16,7 +16,7 @@ namespace LibBSP { /// /// Class containing all data necessary to render a displacement from Source engine. /// - public struct MAPDisplacement { + public class MAPDisplacement { public int power; public Vector3 start; @@ -24,16 +24,16 @@ namespace LibBSP { public float[][] distances; public float[][] alphas; + /// + /// Creates a new empty MAPDisplacement object. Internal data will have to be set manually. + /// + public MAPDisplacement() { } + /// /// Constructs a MAPDisplacement object using the provided string array as the data. /// - /// Data to parse + /// Data to parse. public MAPDisplacement(string[] lines) { - power = 0; - start = new Vector3(Single.NaN, Single.NaN, Single.NaN); - normals = null; - distances = null; - alphas = null; Dictionary normalsTokens = new Dictionary(5); Dictionary distancesTokens = new Dictionary(5); Dictionary alphasTokens = new Dictionary(5); diff --git a/LibBSP/src/Structs/MAP/MAPPatch.cs b/LibBSP/src/Structs/MAP/MAPPatch.cs index e6cd8d1..0a24b9e 100644 --- a/LibBSP/src/Structs/MAP/MAPPatch.cs +++ b/LibBSP/src/Structs/MAP/MAPPatch.cs @@ -24,10 +24,15 @@ namespace LibBSP { public Vector2 dims; public string texture; + /// + /// Creates a new empty MAPPatch object. Internal data will have to be set manually. + /// + public MAPPatch() { } + /// /// Constructs a new MAPPatch object using the supplied string array as data. /// - /// Data to parse + /// Data to parse. public MAPPatch(string[] lines) { texture = lines[2];