Updated, Visual mode, UDMF: "Change Texture Scale" actions now take camera and texture angles into account when used on floors/ceilings.

Changed: "+++" and "---" prefixes are now incremented on the first step instead of the second when used in any numeric inputs, which support prefixes, except action arguments.
Fixed, Visual mode, UDMF: texture offset/scale/rotation changes were applied several times when used on several 3d-floor floors/ceilings linked to the same control sector, when using "Move Texture Offsets" / "Change Texture Scale" / "Rotate Texture CW/CCW" actions.
Updated ZDoom ACC (DamageActor).
Updated ZDoom_ACS.cfg (DamageActor).
This commit is contained in:
MaxED 2016-09-06 12:05:47 +00:00 committed by spherallic
parent d1d0e93cef
commit 960db60973
17 changed files with 243 additions and 200 deletions

View file

@ -397,6 +397,7 @@ special
// -1xx are reserved for Zandronum // -1xx are reserved for Zandronum
-200:CheckClass(1), -200:CheckClass(1),
-201:DamageActor(6), // [arookas]
// ZDaemon's // ZDaemon's
-19620:GetTeamScore(1), -19620:GetTeamScore(1),

View file

@ -1375,7 +1375,7 @@ forcefield
147 147
{ {
title = "ForceField Remove Around Tagged Sector"; title = "ForceField Remove Around Tagged Sector";
prefix = "SR"; prefix = "S1";
} }
148 148

View file

@ -401,7 +401,7 @@ ammunition
153 153
{ {
title = "Phoshorus-Grenade Rounds"; title = "Phosphorus-Grenade Rounds";
sprite = "GRN2A0"; sprite = "GRN2A0";
} }

View file

@ -123,6 +123,7 @@ keywords
//ConsoleCommand = "void ConsoleCommand(str command)"; //ConsoleCommand = "void ConsoleCommand(str command)";
Cos = "fixed Cos(int angle)"; Cos = "fixed Cos(int angle)";
CreateTranslation = "void CreateTranslation(int transnumber, a:b=c:d, ...)"; CreateTranslation = "void CreateTranslation(int transnumber, a:b=c:d, ...)";
DamageActor = "int DamageActor(int targettid, int targetptr, int inflictortid, int inflictorptr, int damage, str damagetype)";
DamageThing = "DamageThing(amount, mod)"; DamageThing = "DamageThing(amount, mod)";
Delay = "void Delay(int tics)"; Delay = "void Delay(int tics)";
Door_Animated = "Door_Animated(tag, speed, delay, lock)"; Door_Animated = "Door_Animated(tag, speed, delay, lock)";

View file

@ -23,7 +23,8 @@
<br> <br>
<b>Action category:</b> Modes.<br> <b>Action category:</b> Modes.<br>
<b>Default key:</b> none.<br><br> <b>Default key:</b> none.<br><br>
This mode shows the sound environments in ZDoom maps (both Hexen format and UDMF). The gray areas do not belong to a sound environment.<br><br> This mode shows the sound environments in ZDoom UDMF maps. The gray areas do not belong to a sound environment.<br>
<br>
The mode also supplies a docker that supplies information about the sound environments. It will display the sound environments, the SoundEnvironment things belonging to them and also the lines that are limit the sound environments. Clicking on the sound environments, things or lines in the list will center the map view on those objects. The mode also supplies a docker that supplies information about the sound environments. It will display the sound environments, the SoundEnvironment things belonging to them and also the lines that are limit the sound environments. Clicking on the sound environments, things or lines in the list will center the map view on those objects.
<br><br> <br><br>

View file

@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Controls
public NumericTextbox() public NumericTextbox()
{ {
this.ImeMode = ImeMode.Off; this.ImeMode = ImeMode.Off;
this.incrementstep = 1; //mxd
//mxd. Setup tooltip //mxd. Setup tooltip
this.tooltip = new ToolTip { AutomaticDelay = 100, AutoPopDelay = 8000, InitialDelay = 100, ReshowDelay = 100 }; this.tooltip = new ToolTip { AutomaticDelay = 100, AutoPopDelay = 8000, InitialDelay = 100, ReshowDelay = 100 };
@ -96,7 +97,7 @@ namespace CodeImp.DoomBuilder.Controls
// When a key is pressed // When a key is pressed
protected override void OnKeyPress(KeyPressEventArgs e) protected override void OnKeyPress(KeyPressEventArgs e)
{ {
incrementstep = 0; //mxd incrementstep = 1; //mxd
string allowedchars = "0123456789\b"; string allowedchars = "0123456789\b";
// Determine allowed chars // Determine allowed chars

View file

@ -181,60 +181,76 @@ namespace CodeImp.DoomBuilder.BuilderModes
offsetx = (int)Math.Round(v.x); offsetx = (int)Math.Round(v.x);
offsety = (int)Math.Round(v.y); offsety = (int)Math.Round(v.y);
// Apply offsets // Calculate deltas
int deltax, deltay;
if(General.Interface.CtrlState && General.Interface.ShiftState) if(General.Interface.CtrlState && General.Interface.ShiftState)
{ {
//mxd. Clamp to grid size? //mxd. Clamp to grid size?
int newoffsetx = startoffsetx - (int)Math.Round(offsetx); int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
int newoffsety = startoffsety + (int)Math.Round(offsety); int newoffsety = startoffsety + (int)Math.Round(offsety);
int dx = prevoffsetx - newoffsetx; deltax = prevoffsetx - newoffsetx;
int dy = prevoffsety - newoffsety; deltay = prevoffsety - newoffsety;
if(Math.Abs(dx) >= General.Map.Grid.GridSize) if(Math.Abs(deltax) >= General.Map.Grid.GridSize)
{ {
dx = General.Map.Grid.GridSize * Math.Sign(dx); deltax = General.Map.Grid.GridSize * Math.Sign(deltax);
prevoffsetx = newoffsetx; prevoffsetx = newoffsetx;
} }
else else
{ {
dx = 0; deltax = 0;
} }
if(Math.Abs(dy) >= General.Map.Grid.GridSize) if(Math.Abs(deltay) >= General.Map.Grid.GridSize)
{ {
dy = General.Map.Grid.GridSize * Math.Sign(dy); deltay = General.Map.Grid.GridSize * Math.Sign(deltay);
prevoffsety = newoffsety; prevoffsety = newoffsety;
} }
else else
{ {
dy = 0; deltay = 0;
} }
if(dx != 0 || dy != 0) mode.ApplyFlatOffsetChange(dx, dy);
} }
else else
{ {
int newoffsetx = startoffsetx - (int)Math.Round(offsetx); int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
int newoffsety = startoffsety + (int)Math.Round(offsety); int newoffsety = startoffsety + (int)Math.Round(offsety);
mode.ApplyFlatOffsetChange(prevoffsetx - newoffsetx, prevoffsety - newoffsety);
deltax = prevoffsetx - newoffsetx;
deltay = prevoffsety - newoffsety;
prevoffsetx = newoffsetx; prevoffsetx = newoffsetx;
prevoffsety = newoffsety; prevoffsety = newoffsety;
} }
//mxd. Apply offset?
if(deltax != 0 || deltay != 0)
{
mode.ApplyFlatOffsetChange(deltax, deltay);
// Update sector geometry
Sector s = GetControlSector();
if(s.Index != Sector.Sector.Index)
{
s.UpdateNeeded = true;
s.UpdateCache();
mode.GetSectorData(s).Update();
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s);
vs.UpdateSectorGeometry(false);
vs.Rebuild();
}
Sector.Sector.UpdateNeeded = true;
Sector.Sector.UpdateCache();
Sector.UpdateSectorGeometry(false);
Sector.Rebuild();
}
mode.ShowTargetInfo(); mode.ShowTargetInfo();
} }
//mxd //mxd
public override Sector GetControlSector() public override Sector GetControlSector() { return level.sector; }
{
return level.sector;
}
//mxd
public virtual bool IsSelected()
{
return selected;
}
//mxd //mxd
protected void AlignTextureToClosestLine(bool alignx, bool aligny) protected void AlignTextureToClosestLine(bool alignx, bool aligny)
@ -453,7 +469,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public virtual void OnInsert() { } public virtual void OnInsert() { }
protected virtual void SetTexture(string texturename) { } protected virtual void SetTexture(string texturename) { }
public virtual void ApplyLinedefFlag(string flag, bool set) { } public virtual void ApplyLinedefFlag(string flag, bool set) { }
protected abstract void MoveTextureOffset(Point xy); protected abstract void MoveTextureOffset(int offsetx, int offsety);
protected abstract Point GetTextureOffset(); protected abstract Point GetTextureOffset();
public virtual void OnPaintSelectEnd() { } // biwa public virtual void OnPaintSelectEnd() { } // biwa
@ -874,7 +890,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
undoticket = mode.CreateUndo("Change texture offsets"); undoticket = mode.CreateUndo("Change texture offsets");
//mxd //mxd
if(General.Map.UDMF && doSurfaceAngleCorrection) changed = true;
//mxd
if(General.Map.UDMF && doSurfaceAngleCorrection)
{ {
Point p = new Point(horizontal, vertical); Point p = new Point(horizontal, vertical);
float angle = Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY); float angle = Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY);
@ -907,24 +926,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Apply offsets // Apply offsets
MoveTextureOffset(new Point(-horizontal, -vertical)); MoveTextureOffset(-horizontal, -vertical);
// Update sector geometry // Rebuild sector
Sector s = GetControlSector(); BaseVisualSector vs;
if(s.Index != Sector.Sector.Index) if(mode.VisualSectorExists(level.sector))
{ {
s.UpdateNeeded = true; vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
s.UpdateCache(); }
mode.GetSectorData(s).Update(); else
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s); {
vs.UpdateSectorGeometry(false); //mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
vs.Rebuild(); vs = mode.CreateBaseVisualSector(level.sector);
} }
Sector.Sector.UpdateNeeded = true; if(vs != null) vs.UpdateSectorGeometry(false);
Sector.Sector.UpdateCache();
Sector.UpdateSectorGeometry(false);
Sector.Rebuild();
} }
//mxd //mxd
@ -938,23 +954,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
string key = (GeometryType == VisualGeometryType.FLOOR ? "rotationfloor" : "rotationceiling"); string key = (GeometryType == VisualGeometryType.FLOOR ? "rotationfloor" : "rotationceiling");
mode.SetActionResult( (GeometryType == VisualGeometryType.FLOOR ? "Floor" : "Ceiling") + " rotation changed to " + angle); mode.SetActionResult( (GeometryType == VisualGeometryType.FLOOR ? "Floor" : "Ceiling") + " rotation changed to " + angle);
//set value // Set new angle
Sector s = GetControlSector(); Sector s = GetControlSector();
s.Fields.BeforeFieldsChange(); s.Fields.BeforeFieldsChange();
UniFields.SetFloat(s.Fields, key, angle, 0.0f); UniFields.SetFloat(s.Fields, key, angle, 0.0f);
if(s.Index != Sector.Sector.Index) // Mark as changed
changed = true;
// Rebuild sector
BaseVisualSector vs;
if(mode.VisualSectorExists(level.sector))
{ {
s.UpdateNeeded = true; vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
s.UpdateCache(); }
mode.GetSectorData(s).Update(); else
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s); {
vs.UpdateSectorGeometry(false); //mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
vs = mode.CreateBaseVisualSector(level.sector);
} }
Sector.Sector.UpdateNeeded = true; if(vs != null) vs.UpdateSectorGeometry(false);
Sector.Sector.UpdateCache();
Sector.UpdateSectorGeometry(false);
} }
//mxd //mxd
@ -962,10 +982,47 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(!General.Map.UDMF || !Texture.IsImageLoaded) return; if(!General.Map.UDMF || !Texture.IsImageLoaded) return;
changed = true;
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Change texture scale"); undoticket = mode.CreateUndo("Change texture scale");
ChangeTextureScale(incrementX, incrementY); // Adjust to camera view
float angle = Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY);
if(GeometryType == VisualGeometryType.CEILING) angle += level.sector.Fields.GetValue("rotationceiling", 0f);
else angle += level.sector.Fields.GetValue("rotationfloor", 0f);
angle = General.ClampAngle(angle);
if(angle > 315 || angle < 46)
{
ChangeTextureScale(incrementX, incrementY);
}
else if(angle > 225)
{
ChangeTextureScale(incrementY, incrementX);
}
else if(angle > 135)
{
ChangeTextureScale(incrementX, incrementY);
}
else
{
ChangeTextureScale(incrementY, incrementX);
}
// Rebuild sector
BaseVisualSector vs;
if(mode.VisualSectorExists(level.sector))
{
vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
}
else
{
//mxd. Need this to apply changes to 3d-floor even if control sector doesn't exist as BaseVisualSector
vs = mode.CreateBaseVisualSector(level.sector);
}
if(vs != null) vs.UpdateSectorGeometry(false);
} }
// biwa // biwa

View file

@ -786,7 +786,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected abstract void SetTextureOffsetX(int x); protected abstract void SetTextureOffsetX(int x);
protected abstract void SetTextureOffsetY(int y); protected abstract void SetTextureOffsetY(int y);
protected virtual void ResetTextureScale() { } //mxd protected virtual void ResetTextureScale() { } //mxd
protected abstract void MoveTextureOffset(Point xy); protected abstract void MoveTextureOffset(int offsetx, int offsety);
protected abstract Point GetTextureOffset(); protected abstract Point GetTextureOffset();
public virtual void OnTextureFit(FitTextureOptions options) { } //mxd public virtual void OnTextureFit(FitTextureOptions options) { } //mxd
public virtual void OnPaintSelectEnd() { } // biwa public virtual void OnPaintSelectEnd() { } // biwa
@ -1565,8 +1565,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd //mxd
if(General.Map.UDMF) if(General.Map.UDMF)
{ {
// Apply UDMF offsets // Apply per-texture offsets
MoveTextureOffset(new Point(-horizontal, -vertical)); MoveTextureOffset(-horizontal, -vertical);
Point p = GetTextureOffset(); Point p = GetTextureOffset();
mode.SetActionResult("Changed texture offsets to " + p.X + ", " + p.Y + "."); mode.SetActionResult("Changed texture offsets to " + p.X + ", " + p.Y + ".");

View file

@ -2884,41 +2884,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
PostAction(); PostAction();
} }
[BeginAction("movetextureleft")] [BeginAction("movetextureleft")] public void MoveTextureLeft1() { MoveTextureByOffset(-1, 0); }
public void MoveTextureLeft1() { MoveTextureByOffset(-1, 0); } [BeginAction("movetextureright")] public void MoveTextureRight1() { MoveTextureByOffset(1, 0); }
[BeginAction("movetextureup")] public void MoveTextureUp1() { MoveTextureByOffset(0, -1); }
[BeginAction("movetextureright")] [BeginAction("movetexturedown")] public void MoveTextureDown1() { MoveTextureByOffset(0, 1); }
public void MoveTextureRight1() { MoveTextureByOffset(1, 0); } [BeginAction("movetextureleft8")] public void MoveTextureLeft8() { MoveTextureByOffset(-8, 0); }
[BeginAction("movetextureright8")] public void MoveTextureRight8() { MoveTextureByOffset(8, 0); }
[BeginAction("movetextureup")] [BeginAction("movetextureup8")] public void MoveTextureUp8() { MoveTextureByOffset(0, -8); }
public void MoveTextureUp1() { MoveTextureByOffset(0, -1); } [BeginAction("movetexturedown8")] public void MoveTextureDown8() { MoveTextureByOffset(0, 8); }
[BeginAction("movetextureleftgs")] public void MoveTextureLeftGrid() { MoveTextureByOffset(-General.Map.Grid.GridSize, 0); } //mxd
[BeginAction("movetexturedown")] [BeginAction("movetexturerightgs")] public void MoveTextureRightGrid() { MoveTextureByOffset(General.Map.Grid.GridSize, 0); } //mxd
public void MoveTextureDown1() { MoveTextureByOffset(0, 1); } [BeginAction("movetextureupgs")] public void MoveTextureUpGrid() { MoveTextureByOffset(0, -General.Map.Grid.GridSize); } //mxd
[BeginAction("movetexturedowngs")] public void MoveTextureDownGrid() { MoveTextureByOffset(0, General.Map.Grid.GridSize); } //mxd
[BeginAction("movetextureleft8")]
public void MoveTextureLeft8() { MoveTextureByOffset(-8, 0); }
[BeginAction("movetextureright8")]
public void MoveTextureRight8() { MoveTextureByOffset(8, 0); }
[BeginAction("movetextureup8")]
public void MoveTextureUp8() { MoveTextureByOffset(0, -8); }
[BeginAction("movetexturedown8")]
public void MoveTextureDown8() { MoveTextureByOffset(0, 8); }
[BeginAction("movetextureleftgs")] //mxd
public void MoveTextureLeftGrid() { MoveTextureByOffset(-General.Map.Grid.GridSize, 0); }
[BeginAction("movetexturerightgs")] //mxd
public void MoveTextureRightGrid() { MoveTextureByOffset(General.Map.Grid.GridSize, 0); }
[BeginAction("movetextureupgs")] //mxd
public void MoveTextureUpGrid() { MoveTextureByOffset(0, -General.Map.Grid.GridSize); }
[BeginAction("movetexturedowngs")] //mxd
public void MoveTextureDownGrid() { MoveTextureByOffset(0, General.Map.Grid.GridSize); }
//mxd //mxd
private void MoveTextureByOffset(int ox, int oy) private void MoveTextureByOffset(int ox, int oy)
@ -2930,62 +2907,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
//mxd //mxd
[BeginAction("scaleup")] [BeginAction("scaleup")] public void ScaleTextureUp() { ScaleTexture(1, 1); }
public void ScaleTextureUp() [BeginAction("scaledown")] public void ScaleTextureDown() { ScaleTexture(-1, -1); }
{ [BeginAction("scaleupx")] public void ScaleTextureUpX() { ScaleTexture(1, 0); }
PreAction(UndoGroup.TextureScaleChange); [BeginAction("scaledownx")] public void ScaleTextureDownX() { ScaleTexture(-1, 0); }
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false); [BeginAction("scaleupy")] public void ScaleTextureUpY() { ScaleTexture(0, 1); }
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(1, 1); [BeginAction("scaledowny")] public void ScaleTextureDownY() { ScaleTexture(0, -1); }
PostAction();
}
//mxd //mxd
[BeginAction("scaledown")] private void ScaleTexture(int incrementx, int incrementy)
public void ScaleTextureDown()
{ {
PreAction(UndoGroup.TextureScaleChange); PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false); List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(-1, -1); foreach(IVisualEventReceiver i in objs) i.OnChangeScale(incrementx, incrementy);
PostAction();
}
//mxd
[BeginAction("scaleupx")]
public void ScaleTextureUpX()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(1, 0);
PostAction();
}
//mxd
[BeginAction("scaledownx")]
public void ScaleTextureDownX()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(-1, 0);
PostAction();
}
//mxd
[BeginAction("scaleupy")]
public void ScaleTextureUpY()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(0, 1);
PostAction();
}
//mxd
[BeginAction("scaledowny")]
public void ScaleTextureDownY()
{
PreAction(UndoGroup.TextureScaleChange);
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, true, false);
foreach(IVisualEventReceiver i in objs) i.OnChangeScale(0, -1);
PostAction(); PostAction();
} }

View file

@ -243,15 +243,54 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods #region ================== Methods
// Return texture coordinates //mxd
protected override Point GetTextureOffset() public override void OnChangeScale(int incrementX, int incrementY)
{
// Only do this when not done yet in this call
// Because we may be able to select the same 3D floor multiple times through multiple sectors
SectorData sd = mode.GetSectorData(level.sector);
if(!sd.CeilingChanged)
{
sd.CeilingChanged = true;
base.OnChangeScale(incrementX, incrementY);
}
}
//mxd
public override void OnChangeTextureRotation(float angle)
{
// Only do this when not done yet in this call
// Because we may be able to select the same 3D floor multiple times through multiple sectors
SectorData sd = mode.GetSectorData(level.sector);
if(!sd.CeilingChanged)
{
sd.CeilingChanged = true;
base.OnChangeTextureRotation(angle);
}
}
// Return texture coordinates
protected override Point GetTextureOffset()
{ {
return new Point { X = (int)Sector.Sector.Fields.GetValue("xpanningceiling", 0.0f), return new Point { X = (int)Sector.Sector.Fields.GetValue("xpanningceiling", 0.0f),
Y = (int)Sector.Sector.Fields.GetValue("ypanningceiling", 0.0f) }; Y = (int)Sector.Sector.Fields.GetValue("ypanningceiling", 0.0f) };
} }
//mxd
public override void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection)
{
// Only do this when not done yet in this call
// Because we may be able to select the same 3D floor multiple times through multiple sectors
SectorData sd = mode.GetSectorData(level.sector);
if(!sd.CeilingChanged)
{
sd.CeilingChanged = true;
base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection);
}
}
// Move texture coordinates // Move texture coordinates
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
//mxd //mxd
Sector s = GetControlSector(); Sector s = GetControlSector();
@ -274,8 +313,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!alignment.IsFlagSet("8192")) if (!alignment.IsFlagSet("8192"))
alignment.SetFlag("8192", true); alignment.SetFlag("8192", true);
alignment.Front.OffsetX += xy.X; alignment.Front.OffsetX += offsetx;
alignment.Front.OffsetY += xy.Y; alignment.Front.OffsetY += offsety;
float rotation = General.ClampAngle(90f - alignment.Angle * Angle2D.PIDEG); float rotation = General.ClampAngle(90f - alignment.Angle * Angle2D.PIDEG);
float rotationrad = rotation / Angle2D.PIDEG; float rotationrad = rotation / Angle2D.PIDEG;
@ -297,8 +336,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
else else
{ {
float nx = (s.Fields.GetValue("xpanningceiling", 0.0f) + xy.X) % (Texture.ScaledWidth / s.Fields.GetValue("xscaleceiling", 1.0f)); float nx = (s.Fields.GetValue("xpanningceiling", 0.0f) + offsetx) % (Texture.ScaledWidth / s.Fields.GetValue("xscaleceiling", 1.0f));
float ny = (s.Fields.GetValue("ypanningceiling", 0.0f) + xy.Y) % (Texture.ScaledHeight / s.Fields.GetValue("yscaleceiling", 1.0f)); float ny = (s.Fields.GetValue("ypanningceiling", 0.0f) + offsety) % (Texture.ScaledHeight / s.Fields.GetValue("yscaleceiling", 1.0f));
s.Fields["xpanningceiling"] = new UniValue(UniversalType.Float, nx); s.Fields["xpanningceiling"] = new UniValue(UniversalType.Float, nx);
s.Fields["ypanningceiling"] = new UniValue(UniversalType.Float, ny); s.Fields["ypanningceiling"] = new UniValue(UniversalType.Float, ny);
s.UpdateNeeded = true; s.UpdateNeeded = true;
@ -333,21 +372,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
UniFields.SetFloat(s.Fields, "yscaleceiling", scaleY, 1.0f); UniFields.SetFloat(s.Fields, "yscaleceiling", scaleY, 1.0f);
} }
// Update
if(mode.VisualSectorExists(level.sector))
{
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
vs.UpdateSectorGeometry(false);
}
s.UpdateNeeded = true;
s.UpdateCache();
if(s.Index != Sector.Sector.Index)
{
Sector.Sector.UpdateNeeded = true;
Sector.Sector.UpdateCache();
}
mode.SetActionResult("Ceiling scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ")."); mode.SetActionResult("Ceiling scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ").");
} }

View file

@ -227,6 +227,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods #region ================== Methods
//mxd
public override void OnChangeScale(int incrementX, int incrementY)
{
// Only do this when not done yet in this call
// Because we may be able to select the same 3D floor multiple times through multiple sectors
SectorData sd = mode.GetSectorData(level.sector);
if(!sd.FloorChanged)
{
sd.FloorChanged = true;
base.OnChangeScale(incrementX, incrementY);
}
}
//mxd
public override void OnChangeTextureRotation(float angle)
{
// Only do this when not done yet in this call
// Because we may be able to select the same 3D floor multiple times through multiple sectors
SectorData sd = mode.GetSectorData(level.sector);
if(!sd.FloorChanged)
{
sd.FloorChanged = true;
base.OnChangeTextureRotation(angle);
}
}
// Return texture coordinates // Return texture coordinates
protected override Point GetTextureOffset() protected override Point GetTextureOffset()
{ {
@ -234,8 +260,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
Y = (int)Sector.Sector.Fields.GetValue("ypanningfloor", 0.0f) }; Y = (int)Sector.Sector.Fields.GetValue("ypanningfloor", 0.0f) };
} }
//mxd
public override void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection)
{
// Only do this when not done yet in this call
// Because we may be able to select the same 3D floor multiple times through multiple sectors
SectorData sd = mode.GetSectorData(level.sector);
if(!sd.FloorChanged)
{
sd.FloorChanged = true;
base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection);
}
}
// Move texture coordinates // Move texture coordinates
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
//mxd //mxd
Sector s = GetControlSector(); Sector s = GetControlSector();
@ -258,8 +297,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (!alignment.IsFlagSet("8192")) if (!alignment.IsFlagSet("8192"))
alignment.SetFlag("8192", true); alignment.SetFlag("8192", true);
alignment.Front.OffsetX += xy.X; alignment.Front.OffsetX += offsetx;
alignment.Front.OffsetY += xy.Y; alignment.Front.OffsetY += offsety;
float rotation = General.ClampAngle(90f - alignment.Angle * Angle2D.PIDEG); float rotation = General.ClampAngle(90f - alignment.Angle * Angle2D.PIDEG);
float rotationrad = rotation / Angle2D.PIDEG; float rotationrad = rotation / Angle2D.PIDEG;
@ -279,8 +318,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
else else
{ {
float nx = (s.Fields.GetValue("xpanningfloor", 0.0f) + xy.X) % (Texture.ScaledWidth / s.Fields.GetValue("xscalefloor", 1.0f)); float nx = (s.Fields.GetValue("xpanningfloor", 0.0f) + offsetx) % (Texture.ScaledWidth / s.Fields.GetValue("xscalefloor", 1.0f));
float ny = (s.Fields.GetValue("ypanningfloor", 0.0f) + xy.Y) % (Texture.ScaledHeight / s.Fields.GetValue("yscalefloor", 1.0f)); float ny = (s.Fields.GetValue("ypanningfloor", 0.0f) + offsety) % (Texture.ScaledHeight / s.Fields.GetValue("yscalefloor", 1.0f));
s.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, nx); s.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, nx);
s.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, ny); s.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, ny);
s.UpdateNeeded = true; s.UpdateNeeded = true;
@ -315,21 +354,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
UniFields.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0f); UniFields.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0f);
} }
// Update geometry
if(mode.VisualSectorExists(level.sector))
{
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
vs.UpdateSectorGeometry(false);
}
s.UpdateNeeded = true;
s.UpdateCache();
if(s.Index != Sector.Sector.Index)
{
Sector.Sector.UpdateNeeded = true;
Sector.Sector.UpdateCache();
}
mode.SetActionResult("Floor scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ")."); mode.SetActionResult("Floor scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ").");
} }

View file

@ -151,7 +151,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Unused // Unused
protected override void SetTextureOffsetX(int x) { } protected override void SetTextureOffsetX(int x) { }
protected override void SetTextureOffsetY(int y) { } protected override void SetTextureOffsetY(int y) { }
protected override void MoveTextureOffset(Point xy) { } protected override void MoveTextureOffset(int offsetx, int offsety) { }
protected override Point GetTextureOffset() { return Point.Empty; } protected override Point GetTextureOffset() { return Point.Empty; }
#endregion #endregion

View file

@ -299,7 +299,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, (float)y); Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, (float)y);
} }
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
Sidedef.Fields.BeforeFieldsChange(); Sidedef.Fields.BeforeFieldsChange();
float oldx = Sidedef.Fields.GetValue("offsetx_bottom", 0.0f); float oldx = Sidedef.Fields.GetValue("offsetx_bottom", 0.0f);
@ -307,8 +307,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
float scalex = Sidedef.Fields.GetValue("scalex_bottom", 1.0f); float scalex = Sidedef.Fields.GetValue("scalex_bottom", 1.0f);
float scaley = Sidedef.Fields.GetValue("scaley_bottom", 1.0f); float scaley = Sidedef.Fields.GetValue("scaley_bottom", 1.0f);
bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd
Sidedef.Fields["offsetx_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, textureloaded ? Texture.Width : -1)); //mxd Sidedef.Fields["offsetx_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, textureloaded ? Texture.Width : -1)); //mxd
Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, textureloaded ? Texture.Height : -1)); //mxd Sidedef.Fields["offsety_bottom"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, textureloaded ? Texture.Height : -1)); //mxd
} }
protected override Point GetTextureOffset() protected override Point GetTextureOffset()

View file

@ -452,15 +452,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y); Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y);
} }
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
Sidedef.Fields.BeforeFieldsChange(); Sidedef.Fields.BeforeFieldsChange();
float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f); float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
float oldy = Sidedef.Fields.GetValue("offsety_mid", 0.0f); float oldy = Sidedef.Fields.GetValue("offsety_mid", 0.0f);
float scalex = extrafloor.Linedef.Front.Fields.GetValue("scalex_mid", 1.0f); //mxd float scalex = extrafloor.Linedef.Front.Fields.GetValue("scalex_mid", 1.0f); //mxd
float scaley = extrafloor.Linedef.Front.Fields.GetValue("scaley_mid", 1.0f); //mxd float scaley = extrafloor.Linedef.Front.Fields.GetValue("scaley_mid", 1.0f); //mxd
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, Texture.Width)); //mxd Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, Texture.Width)); //mxd
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, Texture.Height)); //mxd Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, Texture.Height)); //mxd
} }
protected override Point GetTextureOffset() protected override Point GetTextureOffset()

View file

@ -464,7 +464,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y); Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y);
} }
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
Sidedef.Fields.BeforeFieldsChange(); Sidedef.Fields.BeforeFieldsChange();
float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f); float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
@ -472,11 +472,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
float scalex = Sidedef.Fields.GetValue("scalex_mid", 1.0f); float scalex = Sidedef.Fields.GetValue("scalex_mid", 1.0f);
float scaley = Sidedef.Fields.GetValue("scaley_mid", 1.0f); float scaley = Sidedef.Fields.GetValue("scaley_mid", 1.0f);
bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, textureloaded ? Texture.Width : -1)); //mxd Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, textureloaded ? Texture.Width : -1)); //mxd
//mxd. Don't clamp offsetY of clipped mid textures //mxd. Don't clamp offsetY of clipped mid textures
bool dontClamp = (!textureloaded || (!Sidedef.IsFlagSet("wrapmidtex") && !Sidedef.Line.IsFlagSet("wrapmidtex"))); bool dontClamp = (!textureloaded || (!Sidedef.IsFlagSet("wrapmidtex") && !Sidedef.Line.IsFlagSet("wrapmidtex")));
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, dontClamp ? -1 : Texture.Height)); Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, dontClamp ? -1 : Texture.Height));
} }
protected override Point GetTextureOffset() protected override Point GetTextureOffset()

View file

@ -293,15 +293,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y); Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, (float)y);
} }
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
Sidedef.Fields.BeforeFieldsChange(); Sidedef.Fields.BeforeFieldsChange();
float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f); float oldx = Sidedef.Fields.GetValue("offsetx_mid", 0.0f);
float oldy = Sidedef.Fields.GetValue("offsety_mid", 0.0f); float oldy = Sidedef.Fields.GetValue("offsety_mid", 0.0f);
float scalex = Sidedef.Fields.GetValue("scalex_mid", 1.0f); float scalex = Sidedef.Fields.GetValue("scalex_mid", 1.0f);
float scaley = Sidedef.Fields.GetValue("scaley_mid", 1.0f); float scaley = Sidedef.Fields.GetValue("scaley_mid", 1.0f);
Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, Texture.Width)); //mxd Sidedef.Fields["offsetx_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, Texture.Width)); //mxd
Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, Texture.Height)); //mxd Sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, Texture.Height)); //mxd
} }
protected override Point GetTextureOffset() protected override Point GetTextureOffset()

View file

@ -294,7 +294,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, (float)y); Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, (float)y);
} }
protected override void MoveTextureOffset(Point xy) protected override void MoveTextureOffset(int offsetx, int offsety)
{ {
Sidedef.Fields.BeforeFieldsChange(); Sidedef.Fields.BeforeFieldsChange();
float oldx = Sidedef.Fields.GetValue("offsetx_top", 0.0f); float oldx = Sidedef.Fields.GetValue("offsetx_top", 0.0f);
@ -302,8 +302,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
float scalex = Sidedef.Fields.GetValue("scalex_top", 1.0f); float scalex = Sidedef.Fields.GetValue("scalex_top", 1.0f);
float scaley = Sidedef.Fields.GetValue("scaley_top", 1.0f); float scaley = Sidedef.Fields.GetValue("scaley_top", 1.0f);
bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd bool textureloaded = (Texture != null && Texture.IsImageLoaded); //mxd
Sidedef.Fields["offsetx_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, xy.X, scalex, textureloaded ? Texture.Width : -1)); //mxd Sidedef.Fields["offsetx_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldx, offsetx, scalex, textureloaded ? Texture.Width : -1)); //mxd
Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, xy.Y, scaley, textureloaded ? Texture.Height : -1)); //mxd Sidedef.Fields["offsety_top"] = new UniValue(UniversalType.Float, GetRoundedTextureOffset(oldy, offsety, scaley, textureloaded ? Texture.Height : -1)); //mxd
} }
protected override Point GetTextureOffset() protected override Point GetTextureOffset()