mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-01-31 05:00:34 +00:00
Changed texture offset behavior of 3D floors to match with SRB2
This commit is contained in:
parent
0489386e7a
commit
8b5a2916b8
3 changed files with 98 additions and 29 deletions
|
@ -1521,21 +1521,38 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
else
|
||||
{
|
||||
//mxd. Apply classic offsets
|
||||
Sidedef.OffsetX = (Sidedef.OffsetX - horizontal);
|
||||
if(Texture != null) Sidedef.OffsetX %= Texture.Width;
|
||||
Sidedef.OffsetY = (Sidedef.OffsetY - vertical);
|
||||
if(geometrytype != VisualGeometryType.WALL_MIDDLE && Texture != null) Sidedef.OffsetY %= Texture.Height;
|
||||
int newOffsetX = ChangeOffsetX(horizontal);
|
||||
int newOffsetY = ChangeOffsetY(vertical);
|
||||
|
||||
mode.SetActionResult("Changed texture offsets to " + Sidedef.OffsetX + ", " + Sidedef.OffsetY + ".");
|
||||
mode.SetActionResult("Changed texture offsets to " + newOffsetX + ", " + newOffsetY + ".");
|
||||
}
|
||||
|
||||
// Update sidedef geometry
|
||||
VisualSidedefParts parts = Sector.GetSidedefParts(Sidedef);
|
||||
parts.SetupAllParts();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public virtual void OnChangeScale(int incrementX, int incrementY)
|
||||
// Update sidedef geometry
|
||||
UpdateAfterTextureOffsetChange();
|
||||
}
|
||||
|
||||
protected virtual int ChangeOffsetX(int amount)
|
||||
{
|
||||
Sidedef.OffsetX -= amount;
|
||||
if (Texture != null) Sidedef.OffsetX %= Texture.Width;
|
||||
return Sidedef.OffsetX;
|
||||
}
|
||||
|
||||
protected virtual int ChangeOffsetY(int amount)
|
||||
{
|
||||
Sidedef.OffsetY -= amount;
|
||||
if (geometrytype != VisualGeometryType.WALL_MIDDLE && Texture != null) Sidedef.OffsetY %= Texture.Height;
|
||||
return Sidedef.OffsetY;
|
||||
}
|
||||
|
||||
protected virtual void UpdateAfterTextureOffsetChange()
|
||||
{
|
||||
VisualSidedefParts parts = Sector.GetSidedefParts(Sidedef);
|
||||
parts.SetupAllParts();
|
||||
}
|
||||
|
||||
//mxd
|
||||
public virtual void OnChangeScale(int incrementX, int incrementY)
|
||||
{
|
||||
if(!General.Map.UDMF || !Texture.IsImageLoaded) return;
|
||||
|
||||
|
|
|
@ -143,7 +143,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
tsz = tsz / tscale;
|
||||
|
||||
// Get texture offsets
|
||||
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY) + new Vector2D(sourceside.OffsetX, sourceside.OffsetY);
|
||||
// MascaraSnake: In SRB2, take only the X offset of the target sidedef and the Y offset of the source sidedef. Yes, this is silly.
|
||||
Vector2D tof = new Vector2D(Sidedef.OffsetX, General.Map.SRB2 ? 0.0f : Sidedef.OffsetY) + new Vector2D(General.Map.SRB2 ? 0.0f : sourceside.OffsetX, sourceside.OffsetY);
|
||||
tof = tof + toffset1 + toffset2;
|
||||
tof = tof / tscale;
|
||||
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
|
||||
|
@ -305,13 +306,38 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
base.SetVertices(null); //mxd
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This performs a fast test in object picking (mxd)
|
||||
public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir)
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
protected override int ChangeOffsetY(int amount)
|
||||
{
|
||||
if (General.Map.SRB2)
|
||||
{
|
||||
Sidedef sourceside = extrafloor.Linedef.Front;
|
||||
sourceside.OffsetY -= amount;
|
||||
if (geometrytype != VisualGeometryType.WALL_MIDDLE && Texture != null) sourceside.OffsetY %= Texture.Height;
|
||||
return sourceside.OffsetY;
|
||||
}
|
||||
else return base.ChangeOffsetY(amount);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterTextureOffsetChange()
|
||||
{
|
||||
if (General.Map.SRB2)
|
||||
{
|
||||
//Update all sidedefs in the sector, since the Y offset of the 3D floor may have changed.
|
||||
foreach (Sidedef sd in Sidedef.Sector.Sidedefs)
|
||||
{
|
||||
VisualSidedefParts parts = Sector.GetSidedefParts(sd);
|
||||
parts.SetupAllParts();
|
||||
}
|
||||
}
|
||||
else base.UpdateAfterTextureOffsetChange();
|
||||
}
|
||||
|
||||
// This performs a fast test in object picking (mxd)
|
||||
public override bool PickFastReject(Vector3D from, Vector3D to, Vector3D dir)
|
||||
{
|
||||
// Top and bottom are swapped in Vavoom-type 3d floors
|
||||
if(extrafloor.VavoomType)
|
||||
|
|
|
@ -118,10 +118,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Get texture scaled size
|
||||
Vector2D tsz = new Vector2D(base.Texture.ScaledWidth, base.Texture.ScaledHeight);
|
||||
tsz = tsz / tscale;
|
||||
|
||||
// Get texture offsets
|
||||
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY) + new Vector2D(sourceside.OffsetX, sourceside.OffsetY);
|
||||
tof = tof + toffset1 + toffset2;
|
||||
|
||||
// Get texture offsets
|
||||
// MascaraSnake: In SRB2, take only the X offset of the target sidedef and the Y offset of the source sidedef. Yes, this is silly.
|
||||
Vector2D tof = new Vector2D(Sidedef.OffsetX, General.Map.SRB2 ? 0.0f : Sidedef.OffsetY) + new Vector2D(General.Map.SRB2 ? 0.0f : sourceside.OffsetX, sourceside.OffsetY);
|
||||
tof = tof + toffset1 + toffset2;
|
||||
tof = tof / tscale;
|
||||
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
|
||||
tof = tof * base.Texture.Scale;
|
||||
|
@ -279,13 +280,38 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
base.SetVertices(null); //mxd
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// Return texture name
|
||||
public override string GetTextureName()
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
protected override int ChangeOffsetY(int amount)
|
||||
{
|
||||
if (General.Map.SRB2)
|
||||
{
|
||||
Sidedef sourceside = extrafloor.Linedef.Front;
|
||||
sourceside.OffsetY -= amount;
|
||||
if (geometrytype != VisualGeometryType.WALL_MIDDLE && Texture != null) sourceside.OffsetY %= Texture.Height;
|
||||
return sourceside.OffsetY;
|
||||
}
|
||||
else return base.ChangeOffsetY(amount);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterTextureOffsetChange()
|
||||
{
|
||||
if (General.Map.SRB2)
|
||||
{
|
||||
//Update all sidedefs in the sector, since the Y offset of the 3D floor may have changed.
|
||||
foreach (Sidedef sd in Sidedef.Sector.Sidedefs)
|
||||
{
|
||||
VisualSidedefParts parts = Sector.GetSidedefParts(sd);
|
||||
parts.SetupAllParts();
|
||||
}
|
||||
}
|
||||
else base.UpdateAfterTextureOffsetChange();
|
||||
}
|
||||
|
||||
// Return texture name
|
||||
public override string GetTextureName()
|
||||
{
|
||||
//mxd
|
||||
if((extrafloor.Linedef.Args[2] & (int)Effect3DFloor.Flags.UseUpperTexture) != 0)
|
||||
|
|
Loading…
Reference in a new issue