Add setting to scale flat offsets, matching SRB2

This commit is contained in:
spherallic 2024-04-23 13:55:12 +02:00
parent 6f5f53aee6
commit e780de2ae9
5 changed files with 29 additions and 7 deletions

View file

@ -39,6 +39,7 @@ common
defaulttexturescale = 1.0f;
defaultflatscale = 1.0f;
scaledtextureoffsets = true;
scaledflatoffsets = true;
// Colormap/fade related options
maxcolormapalpha = 25;

View file

@ -74,6 +74,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly string defaultfloortexture; //mxd
private readonly string defaultceilingtexture; //mxd
private readonly bool scaledtextureoffsets;
private readonly bool scaledflatoffsets; //sphere
private readonly string defaultsavecompiler;
private readonly string defaulttestcompiler;
private readonly string formatinterface;
@ -255,6 +256,7 @@ namespace CodeImp.DoomBuilder.Config
public string DefaultFloorTexture { get { return defaultfloortexture; } } //mxd
public string DefaultCeilingTexture { get { return defaultceilingtexture; } } //mxd
public bool ScaledTextureOffsets { get { return scaledtextureoffsets; } }
public bool ScaledFlatOffsets { get { return scaledflatoffsets; } } // sphere
public string FormatInterface { get { return formatinterface; } }
public string DefaultLinedefActivationFlag { get { return defaultlinedefactivation; } } //mxd
public string SingleSidedFlag { get { return singlesidedflag; } }
@ -484,6 +486,7 @@ namespace CodeImp.DoomBuilder.Config
defaultfloortexture = cfg.ReadSetting("defaultfloortexture", "FLOOR0_1"); //mxd
defaultceilingtexture = cfg.ReadSetting("defaultceilingtexture", "CEIL1_1"); //mxd
scaledtextureoffsets = cfg.ReadSetting("scaledtextureoffsets", true);
scaledflatoffsets = cfg.ReadSetting("scaledflatoffsets", true);
formatinterface = cfg.ReadSetting("formatinterface", "");
mixtexturesflats = cfg.ReadSetting("mixtexturesflats", false);
generalizedactions = cfg.ReadSetting("generalizedlinedefs", false);

View file

@ -387,6 +387,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
int color, light;
bool absolute;
if (General.Map.Config.ScaledFlatOffsets)
offset /= scale;
//mxd. Apply GLDEFS override?
if(General.Map.Data.GlowingFlats.ContainsKey(s.LongFloorTexture)
&& General.Map.Data.GlowingFlats[s.LongFloorTexture].Fullbright)
@ -447,8 +450,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
int color, light;
bool absolute;
if (General.Map.Config.ScaledFlatOffsets)
offset /= scale;
//mxd. Apply GLDEFS override?
if(General.Map.Data.GlowingFlats.ContainsKey(s.LongCeilTexture)
if (General.Map.Data.GlowingFlats.ContainsKey(s.LongCeilTexture)
&& General.Map.Data.GlowingFlats[s.LongCeilTexture].Fullbright)
{
color = -1;

View file

@ -84,8 +84,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D scale = new Vector2D(s.Fields.GetValue("xscaleceiling", 1.0),
s.Fields.GetValue("yscaleceiling", 1.0));
if (General.Map.Config.ScaledFlatOffsets)
offset /= scale;
//Load ceiling texture
if(s.LongCeilTexture != MapSet.EmptyLongName)
if (s.LongCeilTexture != MapSet.EmptyLongName)
{
base.Texture = General.Map.Data.GetFlatImage(s.LongCeilTexture);
if(base.Texture == null || base.Texture is UnknownImage)
@ -544,8 +547,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D scale = new Vector2D(level.sector.Fields.GetValue("xscaleceiling", 1.0), level.sector.Fields.GetValue("yscaleceiling", 1.0));
Vector2D texscale = new Vector2D(1.0f / Texture.ScaledWidth, 1.0f / Texture.ScaledHeight);
// Texture coordinates
Vector2D o = pickintersect;
if (General.Map.Config.ScaledFlatOffsets)
offset /= scale;
// Texture coordinates
Vector2D o = pickintersect;
o = o.GetRotated(rotate);
o.y = -o.y;
o = (o + offset) * scale * texscale;

View file

@ -84,6 +84,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D scale = new Vector2D(s.Fields.GetValue("xscalefloor", 1.0),
s.Fields.GetValue("yscalefloor", 1.0));
if (General.Map.Config.ScaledFlatOffsets)
offset /= scale;
//Load floor texture
if(s.LongFloorTexture != MapSet.EmptyLongName)
{
@ -492,8 +495,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D scale = new Vector2D(level.sector.Fields.GetValue("xscalefloor", 1.0), level.sector.Fields.GetValue("yscalefloor", 1.0));
Vector2D texscale = new Vector2D(1.0 / Texture.ScaledWidth, 1.0 / Texture.ScaledHeight);
// Texture coordinates
Vector2D o = pickintersect;
if (General.Map.Config.ScaledFlatOffsets)
offset /= scale;
// Texture coordinates
Vector2D o = pickintersect;
o = o.GetRotated(rotate);
o.y = -o.y;
o = (o + offset) * scale * texscale;