mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Added "localsidedeftextureoffsets" Game configuration setting. When set to true, enables in-editor support for individual offsets of upper/middle/lower sidedef textures. Affects UDMF map format only. - based on diff patch by Altazimuth.
This commit is contained in:
parent
f9b5597951
commit
5baa770d24
8 changed files with 46 additions and 14 deletions
|
@ -340,6 +340,9 @@ mapformat_udmf
|
|||
// WARNING: this should only be enabled for UDMF game configurations!
|
||||
// WARNING: enabling this will make maps incompatible with Doom Builder 2 and can lead to problems in Slade 3!
|
||||
longtexturenames = true;
|
||||
|
||||
// Enables support for individual offsets of upper/middle/lower sidedef textures
|
||||
localsidedeftextureoffsets = true;
|
||||
|
||||
// Default nodebuilder configurations
|
||||
defaultsavecompiler = "zdbsp_udmf_normal";
|
||||
|
|
|
@ -149,7 +149,11 @@ damagetypes = "None BFGSplash Drowning Slime";
|
|||
Default value is <b>true</b>.<br />
|
||||
<br />
|
||||
<b class="fat">doomthingrotationangles</b> (boolean) - <span class="red">GZDB only</span>.<br />
|
||||
When set to <b>true</b>, editor actions related to changing thing angle will snap the resulting angle to 45 degree increments.<br />
|
||||
When set to <b>true</b>, editor actions related to changing thing angle will snap the resulting angle to 45 degree increments.<br />
|
||||
Default value is <b>false</b>.<br />
|
||||
<br />
|
||||
<b class="fat">localsidedeftextureoffsets</b> (boolean) - <span class="red">GZDB only</span>.<br />
|
||||
When set to <b>true</b>, enables in-editor support for individual offsets of upper/middle/lower sidedef textures. Affects UDMF map format only.<br />
|
||||
Default value is <b>false</b>.<br />
|
||||
<br />
|
||||
<b class="fat">start3dmode</b> (integer)<br />
|
||||
|
|
|
@ -89,6 +89,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private readonly string actionspecialhelp; //mxd
|
||||
private readonly string thingclasshelp; //mxd
|
||||
private readonly bool sidedefcompressionignoresaction; //mxd
|
||||
private readonly bool localsidedeftextureoffsets; //MaxW
|
||||
|
||||
// Skills
|
||||
private readonly List<SkillInfo> skills;
|
||||
|
@ -225,6 +226,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public bool HEXEN { get { return hexenmapformat; } }
|
||||
public bool DOOM { get { return doommapformat; } }
|
||||
|
||||
public bool UseLocalSidedefTextureOffsets { get { return localsidedeftextureoffsets; } } //MaxW
|
||||
|
||||
// Texture/flat/voxel sources
|
||||
public IDictionary TextureRanges { get { return textureranges; } }
|
||||
public IDictionary HiResRanges { get { return hiresranges; } } //mxd
|
||||
|
@ -372,6 +375,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
thingclasshelp = cfg.ReadSetting("thingclasshelp", string.Empty); //mxd
|
||||
sidedefcompressionignoresaction = cfg.ReadSetting("sidedefcompressionignoresaction", false); //mxd
|
||||
defaultlinedefactivation = cfg.ReadSetting("defaultlinedefactivation", ""); //mxd
|
||||
localsidedeftextureoffsets = (cfg.ReadSetting("localsidedeftextureoffsets", false)); //MaxW
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++) makedoorargs[i] = cfg.ReadSetting("makedoorarg" + i.ToString(CultureInfo.InvariantCulture), 0);
|
||||
|
||||
//mxd. Update map format flags
|
||||
|
|
|
@ -1564,7 +1564,7 @@ namespace CodeImp.DoomBuilder.Geometry
|
|||
float totalLength = 0f;
|
||||
foreach(Linedef l in strip) totalLength += l.Length;
|
||||
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
AutoAlignTexturesOnSidesUdmf(strip, totalLength, (strip[0].End != strip[1].Start));
|
||||
else
|
||||
AutoAlignTexturesOnSides(strip, totalLength, (strip[0].End != strip[1].Start));
|
||||
|
|
|
@ -1340,7 +1340,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
if((oldline.back.MiddleRequired() && oldline.back.LongMiddleTexture != MapSet.EmptyLongName) || oldline.back.HighRequired() || oldline.back.LowRequired())
|
||||
{
|
||||
int distance = (int)Vector2D.Distance(newline.start.Position, newline.end.Position);
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
if(distance != 0) oldline.back.SetUdmfTextureOffsetX(distance);
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
if(newline.front != null && ((newline.front.MiddleRequired() || newline.front.LongMiddleTexture != MapSet.EmptyLongName) || newline.front.HighRequired() || newline.front.LowRequired()))
|
||||
{
|
||||
int distance = (int)Vector2D.Distance(oldline.start.Position, oldline.end.Position);
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
if(distance != 0) newline.front.SetUdmfTextureOffsetX(distance);
|
||||
}
|
||||
|
@ -1408,7 +1408,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
newline.front.OffsetY = oldline.front.OffsetY;
|
||||
|
||||
//mxd. Copy UDMF offsets as well
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
UniFields.SetFloat(newline.front.Fields, "offsetx_top", oldline.front.Fields.GetValue("offsetx_top", 0f));
|
||||
UniFields.SetFloat(newline.front.Fields, "offsetx_mid", oldline.front.Fields.GetValue("offsetx_mid", 0f));
|
||||
|
@ -1426,7 +1426,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
newline.back.OffsetY = oldline.back.OffsetY;
|
||||
|
||||
//mxd. Copy UDMF offsets as well
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
UniFields.SetFloat(newline.back.Fields, "offsetx_top", oldline.back.Fields.GetValue("offsetx_top", 0f));
|
||||
UniFields.SetFloat(newline.back.Fields, "offsetx_mid", oldline.back.Fields.GetValue("offsetx_mid", 0f));
|
||||
|
@ -1446,7 +1446,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
newline.front.OffsetY = oldline.front.OffsetY;
|
||||
|
||||
//mxd. Reset UDMF X offset as well
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
UniFields.SetFloat(newline.front.Fields, "offsetx_top", 0f);
|
||||
UniFields.SetFloat(newline.front.Fields, "offsetx_mid", 0f);
|
||||
|
@ -1460,7 +1460,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
newline.back.OffsetY = oldline.back.OffsetY;
|
||||
|
||||
//mxd. Reset UDMF X offset and copy Y offset as well
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
UniFields.SetFloat(newline.back.Fields, "offsetx_top", 0f);
|
||||
UniFields.SetFloat(newline.back.Fields, "offsetx_mid", 0f);
|
||||
|
@ -1479,7 +1479,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
newline.front.OffsetX = 0;
|
||||
newline.front.OffsetY = 0;
|
||||
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
UniFields.SetFloat(newline.front.Fields, "offsetx_top", 0f);
|
||||
UniFields.SetFloat(newline.front.Fields, "offsetx_mid", 0f);
|
||||
|
@ -1496,7 +1496,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
newline.back.OffsetX = 0;
|
||||
newline.back.OffsetY = 0;
|
||||
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
UniFields.SetFloat(newline.back.Fields, "offsetx_top", 0f);
|
||||
UniFields.SetFloat(newline.back.Fields, "offsetx_mid", 0f);
|
||||
|
|
|
@ -232,6 +232,26 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
pfcBackScaleTop.LinkValues = linkBackTopScale;
|
||||
pfcBackScaleMid.LinkValues = linkBackMidScale;
|
||||
pfcBackScaleBottom.LinkValues = linkBackBottomScale;
|
||||
|
||||
// Disable top/mid/bottom texture offset controls?
|
||||
if(!General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
pfcFrontOffsetTop.Enabled = false;
|
||||
pfcFrontOffsetMid.Enabled = false;
|
||||
pfcFrontOffsetBottom.Enabled = false;
|
||||
|
||||
pfcBackOffsetTop.Enabled = false;
|
||||
pfcBackOffsetMid.Enabled = false;
|
||||
pfcBackOffsetBottom.Enabled = false;
|
||||
|
||||
labelFrontOffsetTop.Enabled = false;
|
||||
labelFrontOffsetMid.Enabled = false;
|
||||
labelFrontOffsetBottom.Enabled = false;
|
||||
|
||||
labelBackOffsetTop.Enabled = false;
|
||||
labelBackOffsetMid.Enabled = false;
|
||||
labelBackOffsetBottom.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1468,9 +1468,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
undoticket = mode.CreateUndo("Change texture offsets");
|
||||
|
||||
//mxd
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
// Apply UDMF offsets
|
||||
// Apply per-texture offsets
|
||||
MoveTextureOffset(new Point(-horizontal, -vertical));
|
||||
Point p = GetTextureOffset();
|
||||
mode.SetActionResult("Changed texture offsets to " + p.X + ", " + p.Y + ".");
|
||||
|
|
|
@ -1553,7 +1553,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
List<IVisualEventReceiver> objs = GetSelectedObjects(false, true, false, false);
|
||||
|
||||
//mxd. Because Upper/Middle/Lower textures offsets should be threated separately in UDMF
|
||||
if(General.Map.UDMF)
|
||||
//MaxW. But they're not for Eternity, so this needs its own config setting
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
{
|
||||
HashSet<BaseVisualGeometrySidedef> donesides = new HashSet<BaseVisualGeometrySidedef>();
|
||||
foreach(IVisualEventReceiver i in objs)
|
||||
|
@ -3710,7 +3711,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd. If checkSelectedSidedefParts is set to true, only selected linedef parts will be aligned (when a sidedef has both top and bottom parts, but only bottom is selected, top texture won't be aligned)
|
||||
internal void AutoAlignTextures(BaseVisualGeometrySidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks, bool checkSelectedSidedefParts)
|
||||
{
|
||||
if(General.Map.UDMF)
|
||||
if(General.Map.UDMF && General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||
AutoAlignTexturesUDMF(start, texture, alignx, aligny, resetsidemarks, checkSelectedSidedefParts);
|
||||
else
|
||||
AutoAlignTextures(start, texture, alignx, aligny, resetsidemarks);
|
||||
|
|
Loading…
Reference in a new issue