2014-05-03 14:44:59 +00:00
|
|
|
|
#region Namespaces
|
|
|
|
|
|
|
|
|
|
using System;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
using CodeImp.DoomBuilder.VisualModes;
|
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
2014-10-22 13:07:17 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Windows;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderEffects
|
|
|
|
|
{
|
2014-10-22 13:07:17 +00:00
|
|
|
|
public partial class JitterThingsForm : DelayedForm
|
2013-03-18 13:52:27 +00:00
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
#region Variables
|
|
|
|
|
|
|
|
|
|
private readonly string editingModeName;
|
|
|
|
|
private readonly List<Thing> selection;
|
|
|
|
|
private readonly List<VisualThing> visualSelection;
|
|
|
|
|
private readonly List<ThingData> thingData;
|
|
|
|
|
private readonly int MaxSafeDistance;
|
|
|
|
|
private readonly int MaxSafeHeightDistance;
|
|
|
|
|
|
|
|
|
|
private static bool relativePitch;
|
|
|
|
|
private static bool relativeRoll;
|
|
|
|
|
private static bool allowNegativePitch;
|
|
|
|
|
private static bool allowNegativeRoll;
|
|
|
|
|
private static bool relativeScale;
|
|
|
|
|
private static bool allowNegativeScaleX;
|
|
|
|
|
private static bool allowNegativeScaleY;
|
|
|
|
|
private static bool uniformScale;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private struct ThingData
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
public Vector3D Position;
|
|
|
|
|
public int Angle;
|
2014-05-03 14:44:59 +00:00
|
|
|
|
public int Pitch;
|
|
|
|
|
public int Roll;
|
|
|
|
|
public float ScaleX;
|
|
|
|
|
public float ScaleY;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
public int SectorHeight;
|
|
|
|
|
public int ZOffset;
|
|
|
|
|
public int SafeDistance;
|
2014-05-03 14:44:59 +00:00
|
|
|
|
public int OffsetAngle; //position jitter angle, not Thing angle!
|
|
|
|
|
public float JitterRotation;
|
|
|
|
|
public float JitterPitch;
|
|
|
|
|
public float JitterRoll;
|
|
|
|
|
public float JitterScaleX;
|
|
|
|
|
public float JitterScaleY;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
public float JitterHeight;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructor
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public JitterThingsForm(string editingModeName)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
this.editingModeName = editingModeName;
|
2014-02-21 14:42:12 +00:00
|
|
|
|
this.HelpRequested += JitterThingsForm_HelpRequested;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
//have thing height?
|
|
|
|
|
heightJitterAmmount.Enabled = General.Map.FormatInterface.HasThingHeight;
|
|
|
|
|
bUpdateHeight.Enabled = General.Map.FormatInterface.HasThingHeight;
|
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
//disable pitch/roll/scale?
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(!General.Map.UDMF)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
pitchAmmount.Enabled = false;
|
|
|
|
|
rollAmmount.Enabled = false;
|
|
|
|
|
bUpdatePitch.Enabled = false;
|
|
|
|
|
bUpdateRoll.Enabled = false;
|
|
|
|
|
scalegroup.Enabled = false;
|
|
|
|
|
cbRelativePitch.Enabled = false;
|
|
|
|
|
cbRelativeRoll.Enabled = false;
|
|
|
|
|
cbNegativePitch.Enabled = false;
|
|
|
|
|
cbNegativeRoll.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//get selection
|
|
|
|
|
selection = new List<Thing>();
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(editingModeName == "BaseVisualMode")
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
visualSelection = ((VisualMode)General.Editing.Mode).GetSelectedVisualThings(false);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
foreach(VisualThing t in visualSelection) selection.Add(t.Thing);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
foreach(Thing t in list) selection.Add(t);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update window header
|
2014-05-03 14:44:59 +00:00
|
|
|
|
this.Text = "Randomize " + selection.Count + (selection.Count > 1 ? " things" : " thing");
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//store intial properties
|
|
|
|
|
thingData = new List<ThingData>();
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(Thing t in selection)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
ThingData d = new ThingData();
|
|
|
|
|
|
|
|
|
|
Thing closest = MapSet.NearestThing(General.Map.Map.Things, t);
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(closest != null)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
d.SafeDistance = (int)Math.Round(Vector2D.Distance(t.Position, closest.Position));
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
d.SafeDistance = 512;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(d.SafeDistance > 0) d.SafeDistance /= 2;
|
|
|
|
|
if(MaxSafeDistance < d.SafeDistance) MaxSafeDistance = d.SafeDistance;
|
|
|
|
|
d.Position = t.Position;
|
|
|
|
|
d.Angle = t.AngleDoom;
|
2014-05-03 14:44:59 +00:00
|
|
|
|
d.Pitch = t.Pitch;
|
|
|
|
|
d.Roll = t.Roll;
|
|
|
|
|
d.ScaleX = t.ScaleX;
|
|
|
|
|
d.ScaleY = t.ScaleY;
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(General.Map.FormatInterface.HasThingHeight)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(t.Sector == null) t.DetermineSector();
|
|
|
|
|
if(t.Sector == null) continue;
|
|
|
|
|
|
2015-06-03 13:20:06 +00:00
|
|
|
|
d.SectorHeight = Math.Max(0, t.Sector.CeilHeight - (int)t.Height - t.Sector.FloorHeight);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
if(MaxSafeHeightDistance < d.SectorHeight) MaxSafeHeightDistance = d.SectorHeight;
|
|
|
|
|
d.ZOffset = (int)t.Position.z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
thingData.Add(d);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
positionJitterAmmount.Maximum = MaxSafeDistance;
|
|
|
|
|
heightJitterAmmount.Maximum = MaxSafeHeightDistance;
|
|
|
|
|
|
2014-10-29 13:11:35 +00:00
|
|
|
|
//create undo
|
|
|
|
|
General.Map.UndoRedo.ClearAllRedos();
|
|
|
|
|
General.Map.UndoRedo.CreateUndo("Randomize " + selection.Count + (selection.Count > 1 ? " things" : " thing"));
|
|
|
|
|
|
|
|
|
|
//update controls
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateOffsetAngles();
|
|
|
|
|
UpdateHeights();
|
|
|
|
|
UpdateRotationAngles();
|
|
|
|
|
UpdatePitchAngles();
|
|
|
|
|
UpdateRollAngles();
|
|
|
|
|
UpdateScaleX();
|
|
|
|
|
UpdateScaleY();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
//apply settings
|
|
|
|
|
cbRelativeScale.Checked = relativeScale;
|
|
|
|
|
cbUniformScale.Checked = uniformScale;
|
|
|
|
|
cbNegativeScaleX.Checked = allowNegativeScaleX;
|
|
|
|
|
cbNegativeScaleY.Checked = allowNegativeScaleY;
|
|
|
|
|
cbRelativePitch.Checked = relativePitch;
|
|
|
|
|
cbRelativeRoll.Checked = relativeRoll;
|
|
|
|
|
cbNegativePitch.Checked = allowNegativePitch;
|
|
|
|
|
cbNegativeRoll.Checked = allowNegativeRoll;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//add event listeners
|
|
|
|
|
cbRelativeScale.CheckedChanged += cbRelativeScale_CheckedChanged;
|
|
|
|
|
cbUniformScale.CheckedChanged += cbUniformScale_CheckedChanged;
|
|
|
|
|
cbNegativeScaleX.CheckedChanged += cbNegativeScaleX_CheckedChanged;
|
|
|
|
|
cbNegativeScaleY.CheckedChanged += cbNegativeScaleY_CheckedChanged;
|
|
|
|
|
cbRelativePitch.CheckedChanged += cbRelativePitch_CheckedChanged;
|
|
|
|
|
cbRelativeRoll.CheckedChanged += cbRelativeRoll_CheckedChanged;
|
|
|
|
|
cbNegativePitch.CheckedChanged += cbNegativePitch_CheckedChanged;
|
|
|
|
|
cbNegativeRoll.CheckedChanged += cbNegativeRoll_CheckedChanged;
|
|
|
|
|
|
|
|
|
|
//disable controls if necessary
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(uniformScale) cbUniformScale_CheckedChanged(cbUniformScale, EventArgs.Empty);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
//tricky way to actually store undo information...
|
|
|
|
|
foreach(Thing t in selection) t.Move(t.Position);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
#endregion
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
#region Apply logic
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyTranslation(int ammount)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
int curAmmount = ammount > thingData[i].SafeDistance ? thingData[i].SafeDistance : ammount;
|
|
|
|
|
selection[i].Move(new Vector2D(thingData[i].Position.x + (int)(Math.Sin(thingData[i].OffsetAngle) * curAmmount), thingData[i].Position.y + (int)(Math.Cos(thingData[i].OffsetAngle) * curAmmount)));
|
|
|
|
|
selection[i].DetermineSector();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateGeometry();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyRotation(int ammount)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
2016-06-15 22:02:51 +00:00
|
|
|
|
{
|
|
|
|
|
int newangle = (int)Math.Round(thingData[i].Angle + ammount * thingData[i].JitterRotation);
|
|
|
|
|
if(General.Map.Config.DoomThingRotationAngles) newangle = newangle / 45 * 45;
|
|
|
|
|
selection[i].Rotate(newangle % 360);
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2016-06-15 22:02:51 +00:00
|
|
|
|
// Update view
|
2014-05-03 14:44:59 +00:00
|
|
|
|
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyPitch(int ammount)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
int p;
|
|
|
|
|
if(cbRelativePitch.Checked)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
p = (int)((thingData[i].Pitch + ammount * thingData[i].JitterPitch) % 360);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
p = (int)((ammount * thingData[i].JitterPitch) % 360);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
2014-05-03 14:44:59 +00:00
|
|
|
|
|
|
|
|
|
selection[i].SetPitch(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update view
|
|
|
|
|
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyRoll(int ammount)
|
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
int r;
|
|
|
|
|
if(cbRelativeRoll.Checked)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
r = (int)((thingData[i].Roll + ammount * thingData[i].JitterRoll) % 360);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
r = (int)((ammount * thingData[i].JitterRoll) % 360);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
2014-05-03 14:44:59 +00:00
|
|
|
|
|
|
|
|
|
selection[i].SetRoll(r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//update view
|
|
|
|
|
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyHeight(int ammount)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
int curAmmount = Math.Min(thingData[i].SectorHeight, Math.Max(0, thingData[i].ZOffset + ammount));
|
|
|
|
|
selection[i].Move(selection[i].Position.x, selection[i].Position.y, curAmmount * thingData[i].JitterHeight);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
UpdateGeometry();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyScale()
|
|
|
|
|
{
|
2015-07-02 10:07:43 +00:00
|
|
|
|
ApplyScale((float)minScaleX.Value, (float)maxScaleX.Value, (float)minScaleY.Value, (float)maxScaleY.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
|
|
|
|
|
//update view
|
|
|
|
|
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ApplyScale(float minX, float maxX, float minY, float maxY)
|
|
|
|
|
{
|
2015-07-02 10:07:43 +00:00
|
|
|
|
if(cbUniformScale.Checked)
|
|
|
|
|
{
|
|
|
|
|
minY = minX;
|
|
|
|
|
maxY = maxX;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-03 14:44:59 +00:00
|
|
|
|
if(minX > maxX) General.Swap(ref minX, ref maxX);
|
|
|
|
|
if(minY > maxY) General.Swap(ref minY, ref maxY);
|
|
|
|
|
|
|
|
|
|
float diffX = maxX - minX;
|
|
|
|
|
float diffY = maxY - minY;
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
|
|
|
|
{
|
2015-07-02 10:07:43 +00:00
|
|
|
|
float jitterX = thingData[i].JitterScaleX;
|
|
|
|
|
float jitterY = (cbUniformScale.Checked ? jitterX : thingData[i].JitterScaleY);
|
2015-12-28 15:01:53 +00:00
|
|
|
|
float sx, sy;
|
|
|
|
|
|
|
|
|
|
if(cbRelativeScale.Checked)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2015-07-02 10:07:43 +00:00
|
|
|
|
sx = thingData[i].ScaleX + minX + diffX * jitterX;
|
|
|
|
|
sy = thingData[i].ScaleY + minY + diffY * jitterY;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-07-02 10:07:43 +00:00
|
|
|
|
sx = minX + diffX * jitterX;
|
|
|
|
|
sy = minY + diffY * jitterY;
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection[i].SetScale(sx, sy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Update logic
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateGeometry()
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
// Update what must be updated
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(editingModeName == "BaseVisualMode")
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
VisualMode vm = ((VisualMode)General.Editing.Mode);
|
|
|
|
|
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
for(int i = 0; i < selection.Count; i++)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
visualSelection[i].SetPosition(new Vector3D(selection[i].Position.x, selection[i].Position.y, selection[i].Sector.FloorHeight + selection[i].Position.z));
|
Removed "Paste Properties Options" action.
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action.
Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them.
Changed, Paste Properties Special window: only options relevant to current map format are now displayed.
Changed, Paste Properties Special window, UDMF: all UI-managed options are now available.
Fixed: MAPINFO parser was unable to process "include" directives.
Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection.
Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode.
Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time.
Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map.
Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled.
Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category.
Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll.
Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format.
Internal: merged methods from UDMFTools into UniFields, removed UDMFTools.
Updated Inno Setup script (added VC++ 2008 SP1 distributive).
Updated ZDoom_DECORATE.cfg (A_CheckBlock).
Updated documentation (added "System Requirements" page).
2015-10-09 12:38:12 +00:00
|
|
|
|
visualSelection[i].Update();
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
|
|
if(vm.VisualSectorExists(visualSelection[i].Thing.Sector))
|
|
|
|
|
vm.GetVisualSector(visualSelection[i].Thing.Sector).UpdateSectorGeometry(true);
|
|
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
//update view
|
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateOffsetAngles()
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
ThingData td = thingData[i];
|
2014-05-03 14:44:59 +00:00
|
|
|
|
td.OffsetAngle = General.Random(0, 359);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateHeights()
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
ThingData td = thingData[i];
|
2014-05-03 14:44:59 +00:00
|
|
|
|
td.JitterHeight = (General.Random(0, 100) / 100f);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateRotationAngles()
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
ThingData td = thingData[i];
|
|
|
|
|
td.JitterRotation = (General.Random(-100, 100) / 100f);
|
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdatePitchAngles()
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
int min = (cbNegativePitch.Checked ? -100 : 0);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
ThingData td = thingData[i];
|
2014-05-03 14:44:59 +00:00
|
|
|
|
td.JitterPitch = (General.Random(min, 100) / 100f);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateRollAngles()
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
int min = (cbNegativeRoll.Checked ? -100 : 0);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
ThingData td = thingData[i];
|
|
|
|
|
td.JitterRoll = (General.Random(min, 100) / 100f);
|
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateScaleX()
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
int min = (cbNegativeScaleX.Checked ? -100 : 0);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
ThingData td = thingData[i];
|
|
|
|
|
td.JitterScaleX = (General.Random(min, 100) / 100f);
|
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void UpdateScaleY()
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
int min = (cbNegativeScaleY.Checked ? -100 : 0);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = 0; i < thingData.Count; i++)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
ThingData td = thingData[i];
|
|
|
|
|
td.JitterScaleY = (General.Random(min, 100) / 100f);
|
|
|
|
|
thingData[i] = td;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Events
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bApply_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-10-29 14:51:30 +00:00
|
|
|
|
// Store settings
|
|
|
|
|
relativePitch = cbRelativePitch.Checked;
|
|
|
|
|
relativeRoll = cbRelativeRoll.Checked;
|
|
|
|
|
relativeScale = cbRelativeScale.Checked;
|
|
|
|
|
allowNegativeScaleX = cbNegativeScaleX.Checked;
|
|
|
|
|
allowNegativeScaleY = cbNegativeScaleY.Checked;
|
|
|
|
|
uniformScale = cbUniformScale.Checked;
|
|
|
|
|
allowNegativePitch = cbNegativePitch.Checked;
|
|
|
|
|
allowNegativeRoll = cbNegativeRoll.Checked;
|
|
|
|
|
|
|
|
|
|
// Update
|
2014-05-03 14:44:59 +00:00
|
|
|
|
foreach(Thing t in selection) t.DetermineSector();
|
2014-10-20 12:16:51 +00:00
|
|
|
|
|
|
|
|
|
// Clear selection
|
|
|
|
|
General.Actions.InvokeAction("builder_clearselection");
|
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
|
this.DialogResult = DialogResult.Cancel;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void JitterThingsForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(this.DialogResult == DialogResult.Cancel)
|
2014-10-29 14:51:30 +00:00
|
|
|
|
General.Map.UndoRedo.WithdrawUndo(); //undo changes
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void positionJitterAmmount_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyTranslation(positionJitterAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void rotationJitterAmmount_OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyRotation(rotationJitterAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void heightJitterAmmount_OnValueChanging(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyHeight(heightJitterAmmount.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void pitchAmmount_OnValueChanging(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyPitch(pitchAmmount.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void rollAmmount_OnValueChanging(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyRoll(rollAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void minScaleX_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void minScaleY_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Buttons & checkboxes events
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdateTranslation_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateOffsetAngles();
|
|
|
|
|
ApplyTranslation(positionJitterAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdateHeight_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateHeights();
|
|
|
|
|
ApplyHeight(heightJitterAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdateAngle_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateRotationAngles();
|
|
|
|
|
ApplyRotation(rotationJitterAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdatePitch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdatePitchAngles();
|
|
|
|
|
ApplyPitch(pitchAmmount.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdateRoll_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateRollAngles();
|
|
|
|
|
ApplyRoll(rollAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdateScaleX_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateScaleX();
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bUpdateScaleY_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateScaleY();
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbRelativePitch_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdatePitchAngles();
|
|
|
|
|
ApplyPitch(pitchAmmount.Value);
|
2013-03-18 13:52:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbRelativeRoll_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateRollAngles();
|
|
|
|
|
ApplyRoll(rollAmmount.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbNegativePitch_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdatePitchAngles();
|
|
|
|
|
ApplyPitch(pitchAmmount.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbNegativeRoll_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateRollAngles();
|
|
|
|
|
ApplyRoll(rollAmmount.Value);
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbRelativeScale_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbUniformScale_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-05-03 14:44:59 +00:00
|
|
|
|
bUpdateScaleY.Enabled = !cbUniformScale.Checked;
|
|
|
|
|
minScaleY.Enabled = !cbUniformScale.Checked;
|
|
|
|
|
maxScaleY.Enabled = !cbUniformScale.Checked;
|
|
|
|
|
minScaleYLabel.Enabled = !cbUniformScale.Checked;
|
|
|
|
|
maxScaleYLabel.Enabled = !cbUniformScale.Checked;
|
2014-12-03 23:15:26 +00:00
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbNegativeScaleX_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateScaleX();
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void cbNegativeScaleY_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
UpdateScaleY();
|
|
|
|
|
ApplyScale();
|
2014-05-03 14:44:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//HALP!
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void JitterThingsForm_HelpRequested(object sender, HelpEventArgs hlpevent)
|
|
|
|
|
{
|
2013-08-19 12:12:31 +00:00
|
|
|
|
General.ShowHelp("gzdb/features/all_modes/jitter.html");
|
2013-03-18 13:52:27 +00:00
|
|
|
|
hlpevent.Handled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|