diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index fca6511a..69f0e865 100755 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -209,13 +209,33 @@ namespace CodeImp.DoomBuilder.Data return false; } } - - #endregion - #region ================== Constructor / Disposer + internal const float DOOM_PIXEL_RATIO = 1.2f; - // Constructor - internal DataManager() + public float VerticalViewStretch + { + get + { + if (mapinfo == null) + return DOOM_PIXEL_RATIO; + return mapinfo.PixelRatio; + } + } + + public float InvertedVerticalViewStretch + { + get + { + return 1.0f / VerticalViewStretch; + } + } + + #endregion + + #region ================== Constructor / Disposer + + // Constructor + internal DataManager() { // We have no destructor GC.SuppressFinalize(this); diff --git a/Source/Core/GZBuilder/Data/MapInfo.cs b/Source/Core/GZBuilder/Data/MapInfo.cs index a4cc03e4..c439c973 100755 --- a/Source/Core/GZBuilder/Data/MapInfo.cs +++ b/Source/Core/GZBuilder/Data/MapInfo.cs @@ -1,5 +1,6 @@ #region ================== Namespaces +using CodeImp.DoomBuilder.Data; using SlimDX; #endregion @@ -46,6 +47,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data private int vertwallshade; private int horizwallshade; + // [ZZ] + private float pixelratio; + #endregion #region ================== Properties @@ -71,6 +75,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data public int VertWallShade { get { return vertwallshade; } internal set { vertwallshade = value; isdefined = true; } } public int HorizWallShade { get { return horizwallshade; } internal set { horizwallshade = value; isdefined = true; } } + // [ZZ] + public float PixelRatio { get { return pixelratio; } internal set { pixelratio = value; isdefined = true; } } + #endregion #region ================== Constructor @@ -82,6 +89,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data fogdensity = 255; outsidefogdensity = 255; lightmode = GZDoomLightMode.UNDEFINED; + pixelratio = DataManager.DOOM_PIXEL_RATIO; } #endregion diff --git a/Source/Core/GZBuilder/Data/ModelData.cs b/Source/Core/GZBuilder/Data/ModelData.cs index 6cbbcb70..2f8396cf 100755 --- a/Source/Core/GZBuilder/Data/ModelData.cs +++ b/Source/Core/GZBuilder/Data/ModelData.cs @@ -94,7 +94,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data { this.scale = scale; transform = rotation * Matrix.Scaling(scale) * offset; - transformstretched = Matrix.Scaling(1.0f, 1.0f, Renderer3D.GZDOOM_INVERTED_VERTICAL_VIEW_STRETCH) * transform; + transformstretched = Matrix.Scaling(1.0f, 1.0f, General.Map.Data.InvertedVerticalViewStretch) * transform; } //mxd. This greatly speeds up Dictionary lookups diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs index a35c48f3..22d65d45 100755 --- a/Source/Core/Properties/AssemblyInfo.cs +++ b/Source/Core/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ using CodeImp.DoomBuilder; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2985")] +[assembly: AssemblyVersion("2.3.0.2988")] [assembly: NeutralResourcesLanguageAttribute("en")] -[assembly: AssemblyHash("113d86a")] +[assembly: AssemblyHash("b8e6808")] diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index a858ec3e..01af3684 100755 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -38,8 +38,6 @@ namespace CodeImp.DoomBuilder.Rendering private const float PROJ_NEAR_PLANE = 1f; private const float FOG_RANGE = 0.9f; - internal const float GZDOOM_VERTICAL_VIEW_STRETCH = 1.2f; - internal const float GZDOOM_INVERTED_VERTICAL_VIEW_STRETCH = 1.0f / GZDOOM_VERTICAL_VIEW_STRETCH; private const int SHADERPASS_LIGHT = 17; //mxd private const int SHADERPASS_SKYBOX = 5; //mxd @@ -138,7 +136,7 @@ namespace CodeImp.DoomBuilder.Rendering internal Renderer3D(D3DDevice graphics) : base(graphics) { // Initialize - CreateProjection(); + //CreateProjection(); // [ZZ] don't do undefined things once not even ready CreateMatrices2D(); renderthingcages = true; showselection = true; @@ -235,7 +233,7 @@ namespace CodeImp.DoomBuilder.Rendering internal void CreateProjection() { // Calculate aspect - float screenheight = General.Map.Graphics.RenderTarget.ClientSize.Height * (General.Settings.GZStretchView ? GZDOOM_INVERTED_VERTICAL_VIEW_STRETCH : 1.0f); //mxd + float screenheight = General.Map.Graphics.RenderTarget.ClientSize.Height * (General.Settings.GZStretchView ? General.Map.Data.InvertedVerticalViewStretch : 1.0f); //mxd float aspect = General.Map.Graphics.RenderTarget.ClientSize.Width / screenheight; // The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows: diff --git a/Source/Core/ZDoom/MapinfoParser.cs b/Source/Core/ZDoom/MapinfoParser.cs index b614333a..746537c7 100755 --- a/Source/Core/ZDoom/MapinfoParser.cs +++ b/Source/Core/ZDoom/MapinfoParser.cs @@ -116,10 +116,12 @@ namespace CodeImp.DoomBuilder.ZDoom // Get map lump name SkipWhitespace(true); token = ReadToken().ToLowerInvariant(); - if(token != this.mapname) + // [ZZ] Note: map name is sometimes in quotes. I think this was "fixed" some time ago, but apparently not. + token = StripQuotes(token); + if (token != this.mapname) { - // Map number? Try to build map name from it... - int n; + // Map number? Try to build map name from it... + int n; if(int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n)) { token = ((n > 0 && n < 10) ? "map0" + n : "map" + n); @@ -472,6 +474,11 @@ namespace CodeImp.DoomBuilder.ZDoom if(!ParseLightMode()) return false; break; + // [ZZ] + case "pixelratio": + if (!ParsePixelRatio()) return false; + break; + case "}": return true; // Block end case "{": // Skip inner blocks @@ -724,6 +731,29 @@ namespace CodeImp.DoomBuilder.ZDoom return true; } + private bool ParsePixelRatio() + { + SkipWhitespace(true); + if (!NextTokenIs("=")) return false; // New format only + SkipWhitespace(true); + string token = ReadToken(); + + float val; + if (!float.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out val)) + { + // Not numeric! + ReportError("Expected PixelRatio value, but got \"" + token + "\""); + return false; + } + + // Store + mapinfo.PixelRatio = val; + + // All done here + return true; + + } + #endregion } diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs index 147bae56..9cd5aadd 100755 --- a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs +++ b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Resources; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.2985")] +[assembly: AssemblyVersion("2.3.0.2988")] [assembly: NeutralResourcesLanguageAttribute("en")]