From c2d5729644618a5b4e8a432268aab4b26e6e6beb Mon Sep 17 00:00:00 2001 From: codeimp Date: Wed, 29 Jul 2009 16:34:17 +0000 Subject: [PATCH] @ Added sidedef functions to get the heights of high/mid/low wall parts --- Source/Core/Map/Sidedef.cs | 72 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/Source/Core/Map/Sidedef.cs b/Source/Core/Map/Sidedef.cs index d970bdab..a7a2448f 100644 --- a/Source/Core/Map/Sidedef.cs +++ b/Source/Core/Map/Sidedef.cs @@ -286,7 +286,9 @@ namespace CodeImp.DoomBuilder.Map } } - // This checks if a texture is required + /// + /// This checks if a texture is required + /// public bool HighRequired() { // Doublesided? @@ -301,14 +303,18 @@ namespace CodeImp.DoomBuilder.Map } } - // This checks if a texture is required + /// + /// This checks if a texture is required + /// public bool MiddleRequired() { // Texture is required when the line is singlesided return (Other == null); } - // This checks if a texture is required + /// + /// This checks if a texture is required + /// public bool LowRequired() { // Doublesided? @@ -323,6 +329,66 @@ namespace CodeImp.DoomBuilder.Map } } + /// + /// This returns the height of the upper wall part. Returns 0 when no upper part exists. + /// + public int GetHighHeight() + { + Sidedef other = this.Other; + if(other != null) + { + int top = this.sector.CeilHeight; + int bottom = other.sector.CeilHeight; + int height = top - bottom; + return (height > 0) ? height : 0; + } + else + { + return 0; + } + } + + /// + /// This returns the height of the middle wall part. + /// + public int GetMiddleHeight() + { + Sidedef other = this.Other; + if(other != null) + { + int top = Math.Min(this.Sector.CeilHeight, other.Sector.CeilHeight); + int bottom = Math.Max(this.Sector.FloorHeight, other.Sector.FloorHeight); + int height = top - bottom; + return (height > 0) ? height : 0; + } + else + { + int top = this.Sector.CeilHeight; + int bottom = this.Sector.FloorHeight; + int height = top - bottom; + return (height > 0) ? height : 0; + } + } + + /// + /// This returns the height of the lower wall part. Returns 0 when no lower part exists. + /// + public int GetLowHeight() + { + Sidedef other = this.Other; + if(other != null) + { + int top = other.sector.FloorHeight; + int bottom = this.sector.FloorHeight; + int height = top - bottom; + return (height > 0) ? height : 0; + } + else + { + return 0; + } + } + // This creates a checksum from the sidedef properties // Used for faster sidedefs compression public uint GetChecksum()