mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Added support for non-1.2 pixel ratios if view stretching is enabled (reported by Nash); Fixed: map names in quotes were not recognized properly.
This commit is contained in:
parent
b8e68083c0
commit
e7328e4caa
7 changed files with 72 additions and 16 deletions
|
@ -209,13 +209,33 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region ================== Constructor / Disposer
|
internal const float DOOM_PIXEL_RATIO = 1.2f;
|
||||||
|
|
||||||
// Constructor
|
public float VerticalViewStretch
|
||||||
internal DataManager()
|
{
|
||||||
|
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
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#region ================== Namespaces
|
#region ================== Namespaces
|
||||||
|
|
||||||
|
using CodeImp.DoomBuilder.Data;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -46,6 +47,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
||||||
private int vertwallshade;
|
private int vertwallshade;
|
||||||
private int horizwallshade;
|
private int horizwallshade;
|
||||||
|
|
||||||
|
// [ZZ]
|
||||||
|
private float pixelratio;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Properties
|
#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 VertWallShade { get { return vertwallshade; } internal set { vertwallshade = value; isdefined = true; } }
|
||||||
public int HorizWallShade { get { return horizwallshade; } internal set { horizwallshade = 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
|
#endregion
|
||||||
|
|
||||||
#region ================== Constructor
|
#region ================== Constructor
|
||||||
|
@ -82,6 +89,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
||||||
fogdensity = 255;
|
fogdensity = 255;
|
||||||
outsidefogdensity = 255;
|
outsidefogdensity = 255;
|
||||||
lightmode = GZDoomLightMode.UNDEFINED;
|
lightmode = GZDoomLightMode.UNDEFINED;
|
||||||
|
pixelratio = DataManager.DOOM_PIXEL_RATIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
||||||
{
|
{
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
transform = rotation * Matrix.Scaling(scale) * offset;
|
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
|
//mxd. This greatly speeds up Dictionary lookups
|
||||||
|
|
|
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.3.0.2985")]
|
[assembly: AssemblyVersion("2.3.0.2988")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||||
[assembly: AssemblyHash("113d86a")]
|
[assembly: AssemblyHash("b8e6808")]
|
||||||
|
|
|
@ -38,8 +38,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
|
|
||||||
private const float PROJ_NEAR_PLANE = 1f;
|
private const float PROJ_NEAR_PLANE = 1f;
|
||||||
private const float FOG_RANGE = 0.9f;
|
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_LIGHT = 17; //mxd
|
||||||
private const int SHADERPASS_SKYBOX = 5; //mxd
|
private const int SHADERPASS_SKYBOX = 5; //mxd
|
||||||
|
@ -138,7 +136,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
internal Renderer3D(D3DDevice graphics) : base(graphics)
|
internal Renderer3D(D3DDevice graphics) : base(graphics)
|
||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
CreateProjection();
|
//CreateProjection(); // [ZZ] don't do undefined things once not even ready
|
||||||
CreateMatrices2D();
|
CreateMatrices2D();
|
||||||
renderthingcages = true;
|
renderthingcages = true;
|
||||||
showselection = true;
|
showselection = true;
|
||||||
|
@ -235,7 +233,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
internal void CreateProjection()
|
internal void CreateProjection()
|
||||||
{
|
{
|
||||||
// Calculate aspect
|
// 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;
|
float aspect = General.Map.Graphics.RenderTarget.ClientSize.Width / screenheight;
|
||||||
|
|
||||||
// The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows:
|
// The DirectX PerspectiveFovRH matrix method calculates the scaling in X and Y as follows:
|
||||||
|
|
|
@ -116,10 +116,12 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
// Get map lump name
|
// Get map lump name
|
||||||
SkipWhitespace(true);
|
SkipWhitespace(true);
|
||||||
token = ReadToken().ToLowerInvariant();
|
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...
|
// Map number? Try to build map name from it...
|
||||||
int n;
|
int n;
|
||||||
if(int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n))
|
if(int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n))
|
||||||
{
|
{
|
||||||
token = ((n > 0 && n < 10) ? "map0" + n : "map" + n);
|
token = ((n > 0 && n < 10) ? "map0" + n : "map" + n);
|
||||||
|
@ -472,6 +474,11 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
if(!ParseLightMode()) return false;
|
if(!ParseLightMode()) return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// [ZZ]
|
||||||
|
case "pixelratio":
|
||||||
|
if (!ParsePixelRatio()) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
case "}": return true; // Block end
|
case "}": return true; // Block end
|
||||||
|
|
||||||
case "{": // Skip inner blocks
|
case "{": // Skip inner blocks
|
||||||
|
@ -724,6 +731,29 @@ namespace CodeImp.DoomBuilder.ZDoom
|
||||||
return true;
|
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
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,5 @@ using System.Resources;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.3.0.2985")]
|
[assembly: AssemblyVersion("2.3.0.2988")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||||
|
|
Loading…
Reference in a new issue