Renamed Jitter mode to Randomize mode.

Randomize mode: randomized pitch, roll and scale can now be applied to things.
Randomize mode: removed "Relative" option, because results with this option enabled were almost the same as without it.
Classic modes, model rendering: selected models are now rendered using highlight color, so they no longer blend with thing rectangle/circle.
Model rendering, UDMF: scale was applied incorrectly to models with pitch or roll.
Updated documentation.
This commit is contained in:
MaxED 2014-05-03 14:44:59 +00:00
parent 5e205d3b73
commit cf4b2d1935
21 changed files with 1352 additions and 855 deletions

View file

@ -14,12 +14,12 @@
</object> </object>
<div id="gz_title"> <div id="gz_title">
<h1>Jitter</h1> <h1>Randomize</h1>
</div> </div>
<div id="contents"> <div id="contents">
<p>Jitter can be used to add some randomness to any kind of selection, which can be helpful when you are creating natural (caves) or distorted (CAVES IN HELL!!!) environments. </p> <p>Randomize mode can be used to add some randomness to any kind of selection, which can be helpful when you are creating natural (caves) or distorted (CAVES IN HELL!!!) environments. </p>
<p><b>Menu path:</b> Mode -&gt; Jitter.<br /> <p><b>Menu path:</b> Mode -&gt; Randomize.<br />
<b>Action category:</b> Transform.<br /> <b>Action category:</b> Transform.<br />
<b>Default key:</b> Ctrl-J.<br /> <b>Default key:</b> Ctrl-J.<br />
<table border="0" cellspacing="3" cellpadding="3"> <table border="0" cellspacing="3" cellpadding="3">
@ -36,12 +36,11 @@
Depending on selection type, different sets of settings can be used:<br /> Depending on selection type, different sets of settings can be used:<br />
<br /> <br />
When vertices or linedefs are selected in <strong>Vertices</strong> or <strong>Linedefs mode</strong>, or only walls are selected in <strong>Visual mode</strong>, you'll get this:</p> When vertices or linedefs are selected in <strong>Vertices</strong> or <strong>Linedefs mode</strong>, or only walls are selected in <strong>Visual mode</strong>, you'll get this:</p>
<p><img src="jitter_verts.jpg" alt="" width="372" height="92" /></p> <p><img src="jitter_verts.jpg" alt="" /></p>
<p>When sectors are selected in <strong>Sectors mode</strong>, or floors/ceilings are selected in <strong>Visual mode</strong>, you'll get this:</p> <p>When sectors are selected in <strong>Sectors mode</strong>, or floors/ceilings are selected in <strong>Visual mode</strong>, you'll get this:</p>
<p><img src="jitter_sectors.jpg" alt="" width="388" height="376" /></p> <p><img src="jitter_sectors.jpg" alt="" /></p>
<p>When things are selected in <strong>Things</strong> or <strong>Visual mode</strong>, you'll get this:</p> <p>When things are selected in <strong>Things</strong> or <strong>Visual mode</strong>, you'll get this:</p>
<p><img src="jitter_things.jpg" alt="" width="372" height="146" /></p> <p><img src="jitter_things.jpg" alt="" /></p>
<p>You can use <img src="jitter_update.jpg" alt="" width="22" height="24" /> button to update random values for a given property.<br /> <p>You can use <img src="jitter_update.jpg" alt="" width="22" height="24" /> button to update random values for a given property.</p>
If you enable the <strong>Relative</strong> option, the property value will be calculated as a percentage of a maximum possible value.</p>
</div> </div>
</body> </body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

@ -93,7 +93,7 @@ Jump to: <a href="#general">General interface</a> |
<li>You can use <a href="all_modes/tagexplorer.html">Tag Explorer plugin</a> to view all tags and actions used in current map.</li> <li>You can use <a href="all_modes/tagexplorer.html">Tag Explorer plugin</a> to view all tags and actions used in current map.</li>
<li><span class="style1"><strong>[new]</strong></span> You can pick, which properties are pasted by &quot;Paste Properties&quot; action using &quot;Paste Properties Options&quot; window. <input class="spoilerbutton" type="button" onclick="ToggleSpoiler(this);" href="javascript:void(0);" value="Show image"/> <li><span class="style1"><strong>[new]</strong></span> You can pick, which properties are pasted by &quot;Paste Properties&quot; action using &quot;Paste Properties Options&quot; window. <input class="spoilerbutton" type="button" onclick="ToggleSpoiler(this);" href="javascript:void(0);" value="Show image"/>
<div style="display: none; margin: 0px; padding: 6px; border: 1px inset;"> <img src="all_modes/paste_properties_options.jpg" alt="" /></div></li> <div style="display: none; margin: 0px; padding: 6px; border: 1px inset;"> <img src="all_modes/paste_properties_options.jpg" alt="" /></div></li>
<li><span class="style1"><strong>[new]</strong></span> You can apply <a href="all_modes/jitter.html">jitter transform</a> to any map element.</li> <li><span class="style1"><strong>[new]</strong></span> You can apply <a href="all_modes/jitter.html">randomized transformations</a> to any map element.</li>
<li>Image browser shows directory structure of Folder, PK3 and PK7 resources and can filter images by texture type and size. <a href="all_modes/texture_browser.html">More info</a>.</li> <li>Image browser shows directory structure of Folder, PK3 and PK7 resources and can filter images by texture type and size. <a href="all_modes/texture_browser.html">More info</a>.</li>
<li><span class="style1"><strong>[new]</strong></span> Most controls of Edit Sector/Linedef/Thing forms now work in realtime (e.g. you can immediately see texture offset/scale/rotation changes while you are changing appropriate values). Action and Tag changes are still applied only after you press &quot;OK&quot; button.</li> <li><span class="style1"><strong>[new]</strong></span> Most controls of Edit Sector/Linedef/Thing forms now work in realtime (e.g. you can immediately see texture offset/scale/rotation changes while you are changing appropriate values). Action and Tag changes are still applied only after you press &quot;OK&quot; button.</li>
<li><span class="style1"><strong>[new]</strong></span><strong> [UDMF] </strong>All UDMF properties (except &quot;comment&quot;) can be edited using Edit Sector/Linedef/Thing/Vertex forms user interface.</li> <li><span class="style1"><strong>[new]</strong></span><strong> [UDMF] </strong>All UDMF properties (except &quot;comment&quot;) can be edited using Edit Sector/Linedef/Thing/Vertex forms user interface.</li>

View file

@ -1303,7 +1303,7 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.Things2D.BeginPass(2); graphics.Shaders.Things2D.BeginPass(2);
Color4 cSel = General.Colors.Selection.ToColorValue(); Color4 cHighlight = General.Colors.Highlight.ToColorValue();
Color4 cWire = General.Colors.ModelWireframe.ToColorValue(); Color4 cWire = General.Colors.ModelWireframe.ToColorValue();
Matrix viewscale = Matrix.Scaling(scale, -scale, 0.0f); Matrix viewscale = Matrix.Scaling(scale, -scale, 0.0f);
ModelData mde; ModelData mde;
@ -1324,15 +1324,17 @@ namespace CodeImp.DoomBuilder.Rendering
((screenpos.y + maxSize * modelScale) <= 0.0f) || ((screenpos.y - maxSize * modelScale) >= windowsize.Height)) ((screenpos.y + maxSize * modelScale) <= 0.0f) || ((screenpos.y - maxSize * modelScale) >= windowsize.Height))
continue; continue;
graphics.Shaders.Things2D.FillColor = t.Selected ? cSel : cWire; graphics.Shaders.Things2D.FillColor = t.Selected ? cHighlight : cWire;
for(int i = 0; i < mde.Model.Meshes.Count; i++) { for(int i = 0; i < mde.Model.Meshes.Count; i++) {
Matrix finalscale = viewscale * Matrix.Scaling(t.ScaleX, t.ScaleX, t.ScaleY); Matrix modelcale = Matrix.Scaling(t.ScaleX, t.ScaleX, t.ScaleY);
Matrix rotation = Matrix.RotationY(-(t.RollRad - General.Map.Data.ModeldefEntries[t.Type].RollOffset)) Matrix rotation = Matrix.RotationY(-(t.RollRad - General.Map.Data.ModeldefEntries[t.Type].RollOffset))
* Matrix.RotationX(-(t.PitchRad + General.Map.Data.ModeldefEntries[t.Type].PitchOffset)) * Matrix.RotationX(-(t.PitchRad + General.Map.Data.ModeldefEntries[t.Type].PitchOffset))
* Matrix.RotationZ(t.Angle); * Matrix.RotationZ(t.Angle);
Matrix position = Matrix.Translation(screenpos.x, screenpos.y, 0.0f);
Matrix world = modelcale * rotation * viewscale * position;
graphics.Shaders.Things2D.SetTransformSettings(screenpos, rotation, finalscale); graphics.Shaders.Things2D.SetTransformSettings(world);
graphics.Shaders.Things2D.ApplySettings(); graphics.Shaders.Things2D.ApplySettings();
// Draw // Draw

View file

@ -1067,7 +1067,7 @@ namespace CodeImp.DoomBuilder.Rendering
* Matrix.RotationX(-(t.Thing.PitchRad + General.Map.Data.ModeldefEntries[t.Thing.Type].PitchOffset)) * Matrix.RotationX(-(t.Thing.PitchRad + General.Map.Data.ModeldefEntries[t.Thing.Type].PitchOffset))
* Matrix.RotationZ(t.Thing.Angle); * Matrix.RotationZ(t.Thing.Angle);
world = rotation * Matrix.Scaling(sx, sx, sy) * t.Position; world = Matrix.Scaling(sx, sx, sy) * rotation * t.Position;
ApplyMatrices3D(); ApplyMatrices3D();
//mxd. set variables for fog rendering //mxd. set variables for fog rendering

View file

@ -115,13 +115,10 @@ namespace CodeImp.DoomBuilder.Rendering
} }
//mxd. Used to render models //mxd. Used to render models
public void SetTransformSettings(Vector2D position, Matrix rotation, Matrix scale) public void SetTransformSettings(Matrix world)
{ {
if (manager.Enabled) { if (manager.Enabled) {
Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View); Matrix view = manager.D3DDevice.Device.GetTransform(TransformState.View);
Matrix m_position = Matrix.Translation(position.x, position.y, 0.0f);
Matrix world = rotation * scale * m_position;
effect.SetValue(transformsettings, Matrix.Multiply(world, view)); effect.SetValue(transformsettings, Matrix.Multiply(world, view));
} }
} }

View file

@ -59,7 +59,7 @@
// //
// numericUpDown1 // numericUpDown1
// //
this.numericUpDown1.Location = new System.Drawing.Point(96, 1); this.numericUpDown1.Location = new System.Drawing.Point(96, 2);
this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(52, 20); this.numericUpDown1.Size = new System.Drawing.Size(52, 20);
this.numericUpDown1.TabIndex = 8; this.numericUpDown1.TabIndex = 8;
@ -67,6 +67,7 @@
// //
// labelMaximum // labelMaximum
// //
this.labelMaximum.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelMaximum.AutoSize = true; this.labelMaximum.AutoSize = true;
this.labelMaximum.Location = new System.Drawing.Point(237, 5); this.labelMaximum.Location = new System.Drawing.Point(237, 5);
this.labelMaximum.Name = "labelMaximum"; this.labelMaximum.Name = "labelMaximum";

View file

@ -30,9 +30,6 @@
this.bUpdateTranslation = new System.Windows.Forms.Button(); this.bUpdateTranslation = new System.Windows.Forms.Button();
this.bUpdateCeilingHeight = new System.Windows.Forms.Button(); this.bUpdateCeilingHeight = new System.Windows.Forms.Button();
this.bUpdateFloorHeight = new System.Windows.Forms.Button(); this.bUpdateFloorHeight = new System.Windows.Forms.Button();
this.cbRelativeFloorHeight = new System.Windows.Forms.CheckBox();
this.cbRelativeCeilHeight = new System.Windows.Forms.CheckBox();
this.cbRelativePos = new System.Windows.Forms.CheckBox();
this.gbUpperTexture = new System.Windows.Forms.GroupBox(); this.gbUpperTexture = new System.Windows.Forms.GroupBox();
this.textureUpper = new CodeImp.DoomBuilder.Controls.TextureSelectorControl(); this.textureUpper = new CodeImp.DoomBuilder.Controls.TextureSelectorControl();
this.cbPegTop = new System.Windows.Forms.CheckBox(); this.cbPegTop = new System.Windows.Forms.CheckBox();
@ -105,39 +102,6 @@
this.bUpdateFloorHeight.UseVisualStyleBackColor = true; this.bUpdateFloorHeight.UseVisualStyleBackColor = true;
this.bUpdateFloorHeight.Click += new System.EventHandler(this.bUpdateFloorHeight_Click); this.bUpdateFloorHeight.Click += new System.EventHandler(this.bUpdateFloorHeight_Click);
// //
// cbRelativeFloorHeight
//
this.cbRelativeFloorHeight.AutoSize = true;
this.cbRelativeFloorHeight.Location = new System.Drawing.Point(12, 79);
this.cbRelativeFloorHeight.Name = "cbRelativeFloorHeight";
this.cbRelativeFloorHeight.Size = new System.Drawing.Size(64, 18);
this.cbRelativeFloorHeight.TabIndex = 21;
this.cbRelativeFloorHeight.Text = "Relative";
this.cbRelativeFloorHeight.UseVisualStyleBackColor = true;
this.cbRelativeFloorHeight.CheckedChanged += new System.EventHandler(this.cbRelativeFloorHeight_CheckedChanged);
//
// cbRelativeCeilHeight
//
this.cbRelativeCeilHeight.AutoSize = true;
this.cbRelativeCeilHeight.Location = new System.Drawing.Point(12, 49);
this.cbRelativeCeilHeight.Name = "cbRelativeCeilHeight";
this.cbRelativeCeilHeight.Size = new System.Drawing.Size(64, 18);
this.cbRelativeCeilHeight.TabIndex = 22;
this.cbRelativeCeilHeight.Text = "Relative";
this.cbRelativeCeilHeight.UseVisualStyleBackColor = true;
this.cbRelativeCeilHeight.CheckedChanged += new System.EventHandler(this.cbRelativeCeilHeight_CheckedChanged);
//
// cbRelativePos
//
this.cbRelativePos.AutoSize = true;
this.cbRelativePos.Location = new System.Drawing.Point(12, 19);
this.cbRelativePos.Name = "cbRelativePos";
this.cbRelativePos.Size = new System.Drawing.Size(64, 18);
this.cbRelativePos.TabIndex = 23;
this.cbRelativePos.Text = "Relative";
this.cbRelativePos.UseVisualStyleBackColor = true;
this.cbRelativePos.CheckedChanged += new System.EventHandler(this.cbRelativePos_CheckedChanged);
//
// gbUpperTexture // gbUpperTexture
// //
this.gbUpperTexture.Controls.Add(this.textureUpper); this.gbUpperTexture.Controls.Add(this.textureUpper);
@ -152,6 +116,7 @@
// textureUpper // textureUpper
// //
this.textureUpper.Location = new System.Drawing.Point(47, 41); this.textureUpper.Location = new System.Drawing.Point(47, 41);
this.textureUpper.MultipleTextures = false;
this.textureUpper.Name = "textureUpper"; this.textureUpper.Name = "textureUpper";
this.textureUpper.Required = false; this.textureUpper.Required = false;
this.textureUpper.Size = new System.Drawing.Size(83, 112); this.textureUpper.Size = new System.Drawing.Size(83, 112);
@ -173,6 +138,7 @@
// textureLower // textureLower
// //
this.textureLower.Location = new System.Drawing.Point(47, 41); this.textureLower.Location = new System.Drawing.Point(47, 41);
this.textureLower.MultipleTextures = false;
this.textureLower.Name = "textureLower"; this.textureLower.Name = "textureLower";
this.textureLower.Required = false; this.textureLower.Required = false;
this.textureLower.Size = new System.Drawing.Size(83, 112); this.textureLower.Size = new System.Drawing.Size(83, 112);
@ -247,48 +213,48 @@
this.positionJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.positionJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.positionJitterAmmount.ExtendedLimits = true; this.positionJitterAmmount.ExtendedLimits = true;
this.positionJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.positionJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.positionJitterAmmount.Label = "Position (%):"; this.positionJitterAmmount.Label = "Position:";
this.positionJitterAmmount.Location = new System.Drawing.Point(75, 15); this.positionJitterAmmount.Location = new System.Drawing.Point(12, 15);
this.positionJitterAmmount.Maximum = 100; this.positionJitterAmmount.Maximum = 100;
this.positionJitterAmmount.Minimum = 0; this.positionJitterAmmount.Minimum = 0;
this.positionJitterAmmount.Name = "positionJitterAmmount"; this.positionJitterAmmount.Name = "positionJitterAmmount";
this.positionJitterAmmount.Size = new System.Drawing.Size(266, 22); this.positionJitterAmmount.Size = new System.Drawing.Size(329, 22);
this.positionJitterAmmount.TabIndex = 18; this.positionJitterAmmount.TabIndex = 18;
this.positionJitterAmmount.Value = 0; this.positionJitterAmmount.Value = 0;
this.positionJitterAmmount.OnValueChanging += new System.EventHandler(this.positionJitterAmmount_OnValueChanging); this.positionJitterAmmount.OnValueChanging += new System.EventHandler(this.positionJitterAmmount_OnValueChanging);
// //
// ceilingHeightAmmount
//
this.ceilingHeightAmmount.AllowNegative = false;
this.ceilingHeightAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ceilingHeightAmmount.ExtendedLimits = false;
this.ceilingHeightAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ceilingHeightAmmount.Label = "Ceil. Height (%):";
this.ceilingHeightAmmount.Location = new System.Drawing.Point(75, 45);
this.ceilingHeightAmmount.Maximum = 100;
this.ceilingHeightAmmount.Minimum = 0;
this.ceilingHeightAmmount.Name = "ceilingHeightAmmount";
this.ceilingHeightAmmount.Size = new System.Drawing.Size(266, 22);
this.ceilingHeightAmmount.TabIndex = 19;
this.ceilingHeightAmmount.Value = 0;
this.ceilingHeightAmmount.OnValueChanging += new System.EventHandler(this.ceilingHeightAmmount_OnValueChanging);
//
// floorHeightAmmount // floorHeightAmmount
// //
this.floorHeightAmmount.AllowNegative = false; this.floorHeightAmmount.AllowNegative = false;
this.floorHeightAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.floorHeightAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.floorHeightAmmount.ExtendedLimits = false; this.floorHeightAmmount.ExtendedLimits = false;
this.floorHeightAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.floorHeightAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.floorHeightAmmount.Label = "Floor Height (%):"; this.floorHeightAmmount.Label = "Floor height:";
this.floorHeightAmmount.Location = new System.Drawing.Point(75, 75); this.floorHeightAmmount.Location = new System.Drawing.Point(12, 75);
this.floorHeightAmmount.Maximum = 100; this.floorHeightAmmount.Maximum = 100;
this.floorHeightAmmount.Minimum = 0; this.floorHeightAmmount.Minimum = 0;
this.floorHeightAmmount.Name = "floorHeightAmmount"; this.floorHeightAmmount.Name = "floorHeightAmmount";
this.floorHeightAmmount.Size = new System.Drawing.Size(266, 22); this.floorHeightAmmount.Size = new System.Drawing.Size(329, 22);
this.floorHeightAmmount.TabIndex = 20; this.floorHeightAmmount.TabIndex = 20;
this.floorHeightAmmount.Value = 0; this.floorHeightAmmount.Value = 0;
this.floorHeightAmmount.OnValueChanging += new System.EventHandler(this.floorHeightAmmount_OnValueChanging); this.floorHeightAmmount.OnValueChanging += new System.EventHandler(this.floorHeightAmmount_OnValueChanging);
// //
// ceilingHeightAmmount
//
this.ceilingHeightAmmount.AllowNegative = false;
this.ceilingHeightAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ceilingHeightAmmount.ExtendedLimits = false;
this.ceilingHeightAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ceilingHeightAmmount.Label = "Ceil. height:";
this.ceilingHeightAmmount.Location = new System.Drawing.Point(12, 45);
this.ceilingHeightAmmount.Maximum = 100;
this.ceilingHeightAmmount.Minimum = 0;
this.ceilingHeightAmmount.Name = "ceilingHeightAmmount";
this.ceilingHeightAmmount.Size = new System.Drawing.Size(329, 22);
this.ceilingHeightAmmount.TabIndex = 19;
this.ceilingHeightAmmount.Value = 0;
this.ceilingHeightAmmount.OnValueChanging += new System.EventHandler(this.ceilingHeightAmmount_OnValueChanging);
//
// JitterSectorsForm // JitterSectorsForm
// //
this.AcceptButton = this.bApply; this.AcceptButton = this.bApply;
@ -301,9 +267,6 @@
this.Controls.Add(this.cbLowerTexStyle); this.Controls.Add(this.cbLowerTexStyle);
this.Controls.Add(this.cbUpperTexStyle); this.Controls.Add(this.cbUpperTexStyle);
this.Controls.Add(this.gbUpperTexture); this.Controls.Add(this.gbUpperTexture);
this.Controls.Add(this.cbRelativePos);
this.Controls.Add(this.cbRelativeCeilHeight);
this.Controls.Add(this.cbRelativeFloorHeight);
this.Controls.Add(this.floorHeightAmmount); this.Controls.Add(this.floorHeightAmmount);
this.Controls.Add(this.ceilingHeightAmmount); this.Controls.Add(this.ceilingHeightAmmount);
this.Controls.Add(this.positionJitterAmmount); this.Controls.Add(this.positionJitterAmmount);
@ -339,9 +302,6 @@
private IntControl positionJitterAmmount; private IntControl positionJitterAmmount;
private IntControl ceilingHeightAmmount; private IntControl ceilingHeightAmmount;
private IntControl floorHeightAmmount; private IntControl floorHeightAmmount;
private System.Windows.Forms.CheckBox cbRelativeFloorHeight;
private System.Windows.Forms.CheckBox cbRelativeCeilHeight;
private System.Windows.Forms.CheckBox cbRelativePos;
private System.Windows.Forms.GroupBox gbUpperTexture; private System.Windows.Forms.GroupBox gbUpperTexture;
private CodeImp.DoomBuilder.Controls.TextureSelectorControl textureLower; private CodeImp.DoomBuilder.Controls.TextureSelectorControl textureLower;
private CodeImp.DoomBuilder.Controls.TextureSelectorControl textureUpper; private CodeImp.DoomBuilder.Controls.TextureSelectorControl textureUpper;

View file

@ -10,19 +10,16 @@ namespace CodeImp.DoomBuilder.BuilderEffects
{ {
public partial class JitterSectorsForm : Form public partial class JitterSectorsForm : Form
{ {
private string editingModeName; private readonly string editingModeName;
private List<VisualSector> visualSectors; private readonly List<VisualSector> visualSectors;
private VertexData[] vertexData; private readonly VertexData[] vertexData;
private List<SectorData> sectorData; private readonly List<SectorData> sectorData;
private List<SidedefData> sidedefData; private readonly List<SidedefData> sidedefData;
private int MaxSafeDistance; private readonly int MaxSafeDistance;
private int MaxSafeHeightDistance; private readonly int MaxSafeHeightDistance;
//settings //settings
private static bool keepExistingSideTextures = true; private static bool keepExistingSideTextures = true;
private static bool relativeFloorHeight;
private static bool relativeCeilingHeight;
private static bool relativePosition;
private struct VertexData private struct VertexData
{ {
@ -133,7 +130,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
//update window header //update window header
this.Text = "Jitter Transform (" + sectors.Count + (sectors.Count > 1 ? " sectors)" : " sector)"); this.Text = "Randomize " + sectors.Count + (sectors.Count > 1 ? " sectors" : " sector");
//store intial properties //store intial properties
//process verts... //process verts...
@ -236,15 +233,12 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
} }
positionJitterAmmount.Maximum = MaxSafeDistance;
floorHeightAmmount.Maximum = MaxSafeHeightDistance;
ceilingHeightAmmount.Maximum = MaxSafeHeightDistance;
//set editing settings //set editing settings
cbKeepExistingTextures.Checked = keepExistingSideTextures; cbKeepExistingTextures.Checked = keepExistingSideTextures;
cbRelativeCeilHeight.Checked = relativeCeilingHeight;
cbRelativeFloorHeight.Checked = relativeFloorHeight;
cbRelativePos.Checked = relativePosition;
cbRelativeCeilHeight_CheckedChanged(this, EventArgs.Empty);
cbRelativeFloorHeight_CheckedChanged(this, EventArgs.Empty);
cbRelativePos_CheckedChanged(this, EventArgs.Empty);
//texture pickers //texture pickers
textureLower.Initialize(); textureLower.Initialize();
@ -256,30 +250,24 @@ namespace CodeImp.DoomBuilder.BuilderEffects
cbLowerTexStyle.SelectedIndex = 0; cbLowerTexStyle.SelectedIndex = 0;
updateTextureSelectors(); //update interface updateTextureSelectors(); //update interface
updateAngles(); //create some random values //create random values
updateAngles();
updateFloorHeights(); updateFloorHeights();
updateCeilingHeights(); updateCeilingHeights();
//create undo //create undo
General.Map.UndoRedo.ClearAllRedos(); General.Map.UndoRedo.ClearAllRedos();
General.Map.UndoRedo.CreateUndo("Jitter Transform (" + sectors.Count + " sector" + (sectors.Count > 1 ? "s)" : ")")); General.Map.UndoRedo.CreateUndo("Randomize " + sectors.Count + (sectors.Count > 1 ? " sectors" : " sector"));
} }
//utility //utility
private void applyTranslationJitter(int ammount) { private void applyTranslationJitter(int ammount) {
int curAmmount; int curAmmount;
if(relativePosition) {
for(int i = 0; i < vertexData.Length; i++) {
curAmmount = (int)Math.Round(ammount * (vertexData[i].SafeDistance / 100f));
vertexData[i].Vertex.Move(new Vector2D(vertexData[i].InitialPosition.x + (int)(Math.Sin(vertexData[i].JitterAngle) * curAmmount), vertexData[i].InitialPosition.y + (int)(Math.Cos(vertexData[i].JitterAngle) * curAmmount)));
}
} else {
for(int i = 0; i < vertexData.Length; i++) { for(int i = 0; i < vertexData.Length; i++) {
curAmmount = ammount > vertexData[i].SafeDistance ? vertexData[i].SafeDistance : ammount; curAmmount = ammount > vertexData[i].SafeDistance ? vertexData[i].SafeDistance : ammount;
vertexData[i].Vertex.Move(new Vector2D(vertexData[i].InitialPosition.x + (int)(Math.Sin(vertexData[i].JitterAngle) * curAmmount), vertexData[i].InitialPosition.y + (int)(Math.Cos(vertexData[i].JitterAngle) * curAmmount))); vertexData[i].Vertex.Move(new Vector2D(vertexData[i].InitialPosition.x + (int)(Math.Sin(vertexData[i].JitterAngle) * curAmmount), vertexData[i].InitialPosition.y + (int)(Math.Cos(vertexData[i].JitterAngle) * curAmmount)));
} }
}
//update view //update view
if(editingModeName == "BaseVisualMode") { if(editingModeName == "BaseVisualMode") {
@ -294,17 +282,10 @@ namespace CodeImp.DoomBuilder.BuilderEffects
private void applyCeilingHeightJitter(int ammount) { private void applyCeilingHeightJitter(int ammount) {
int curAmmount; int curAmmount;
if(relativeCeilingHeight) {
for(int i = 0; i < sectorData.Count; i++) {
curAmmount = (int)Math.Round(ammount * (sectorData[i].SafeDistance / 100f));
sectorData[i].Sector.CeilHeight = sectorData[i].InitialCeilingHeight - (int)Math.Floor(curAmmount * sectorData[i].JitterCeilingHeight);
}
} else {
for(int i = 0; i < sectorData.Count; i++) { for(int i = 0; i < sectorData.Count; i++) {
curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount; curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount;
sectorData[i].Sector.CeilHeight = sectorData[i].InitialCeilingHeight - (int)Math.Floor(curAmmount * sectorData[i].JitterCeilingHeight); sectorData[i].Sector.CeilHeight = sectorData[i].InitialCeilingHeight - (int)Math.Floor(curAmmount * sectorData[i].JitterCeilingHeight);
} }
}
//update view //update view
if(editingModeName == "BaseVisualMode") { if(editingModeName == "BaseVisualMode") {
@ -319,17 +300,10 @@ namespace CodeImp.DoomBuilder.BuilderEffects
private void applyFloorHeightJitter(int ammount) { private void applyFloorHeightJitter(int ammount) {
int curAmmount; int curAmmount;
if(relativeFloorHeight) {
for(int i = 0; i < sectorData.Count; i++) {
curAmmount = (int)Math.Round(ammount * (sectorData[i].SafeDistance / 100f));
sectorData[i].Sector.FloorHeight = sectorData[i].InitialFloorHeight + (int)Math.Floor(curAmmount * sectorData[i].JitterFloorHeight);
}
} else {
for(int i = 0; i < sectorData.Count; i++) { for(int i = 0; i < sectorData.Count; i++) {
curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount; curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount;
sectorData[i].Sector.FloorHeight = sectorData[i].InitialFloorHeight + (int)Math.Floor(curAmmount * sectorData[i].JitterFloorHeight); sectorData[i].Sector.FloorHeight = sectorData[i].InitialFloorHeight + (int)Math.Floor(curAmmount * sectorData[i].JitterFloorHeight);
} }
}
//update view //update view
if(editingModeName == "BaseVisualMode") { if(editingModeName == "BaseVisualMode") {
@ -342,14 +316,9 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
private void updateVisualGeometry() { private void updateVisualGeometry() {
foreach(VisualSector vs in visualSectors) foreach(VisualSector vs in visualSectors) vs.UpdateSectorGeometry(true);
vs.UpdateSectorGeometry(true); foreach(VisualSector vs in visualSectors) vs.UpdateSectorData();
foreach(VisualSector vs in visualSectors) vs.UpdateSectorData();
foreach(VisualSector vs in visualSectors)
vs.UpdateSectorData();
foreach(VisualSector vs in visualSectors)
vs.UpdateSectorData();
} }
private void updateTextureSelectors() { private void updateTextureSelectors() {
@ -362,9 +331,9 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
private void updateUpperTextures(int index, bool updateGeometry) { private void updateUpperTextures(int index, bool updateGeometry) {
if(index == -1) { if(index == -1) return;
return;
}else if(index == 0) { //revert if(index == 0) { //revert
foreach(SidedefData sd in sidedefData) foreach(SidedefData sd in sidedefData)
setUpperTexture(sd, sd.HighTexture); setUpperTexture(sd, sd.HighTexture);
} else if(index == 1) { //use ceiling texture } else if(index == 1) { //use ceiling texture
@ -386,9 +355,9 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
private void updateLowerTextures(int index, bool updateGeometry) { private void updateLowerTextures(int index, bool updateGeometry) {
if(index == -1) { if(index == -1) return;
return;
}else if(index == 0) { //revert if(index == 0) { //revert
foreach(SidedefData sd in sidedefData) foreach(SidedefData sd in sidedefData)
setLowerTexture(sd, sd.LowTexture); setLowerTexture(sd, sd.LowTexture);
} else if(index == 1) { //use floor texture } else if(index == 1) { //use floor texture
@ -436,31 +405,25 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//jitter generation //jitter generation
private void updateAngles() { private void updateAngles() {
Random rnd = new Random();
for(int i = 0; i < vertexData.Length; i++) { for(int i = 0; i < vertexData.Length; i++) {
VertexData vd = vertexData[i]; VertexData vd = vertexData[i];
vd.JitterAngle = (float)(rnd.Next(359) * Math.PI / 180f); vd.JitterAngle = (float)(General.Random(0, 359) * Math.PI / 180f);
vertexData[i] = vd; vertexData[i] = vd;
} }
} }
private void updateFloorHeights() { private void updateFloorHeights() {
Random rnd = new Random();
for(int i = 0; i < sectorData.Count; i++) { for(int i = 0; i < sectorData.Count; i++) {
SectorData sd = sectorData[i]; SectorData sd = sectorData[i];
sd.JitterFloorHeight = rnd.Next(-100, 100) / 100f; sd.JitterFloorHeight = General.Random(-100, 100) / 100f;
sectorData[i] = sd; sectorData[i] = sd;
} }
} }
private void updateCeilingHeights() { private void updateCeilingHeights() {
Random rnd = new Random();
for(int i = 0; i < sectorData.Count; i++) { for(int i = 0; i < sectorData.Count; i++) {
SectorData sd = sectorData[i]; SectorData sd = sectorData[i];
sd.JitterCeilingHeight = rnd.Next(-100, 100) / 100f; sd.JitterCeilingHeight = General.Random(-100, 100) / 100f;
sectorData[i] = sd; sectorData[i] = sd;
} }
} }
@ -475,7 +438,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
sd.Side.Other.RemoveUnneededTextures(false); sd.Side.Other.RemoveUnneededTextures(false);
} }
//
General.Map.Map.ClearAllSelected(); General.Map.Map.ClearAllSelected();
// Update cached values // Update cached values
@ -485,7 +447,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
if(editingModeName != "BaseVisualMode") if(editingModeName != "BaseVisualMode")
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
//settingsApplied = true;
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
Close(); Close();
} }
@ -550,31 +511,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
applyFloorHeightJitter(floorHeightAmmount.Value); applyFloorHeightJitter(floorHeightAmmount.Value);
} }
//rel/abs
private void cbRelativePos_CheckedChanged(object sender, EventArgs e) {
positionJitterAmmount.Label = "Position" + (cbRelativePos.Checked ? " (%):" : ":");
relativePosition = cbRelativePos.Checked;
positionJitterAmmount.Maximum = cbRelativePos.Checked ? 100 : MaxSafeDistance;
applyTranslationJitter(positionJitterAmmount.Value);
}
private void cbRelativeCeilHeight_CheckedChanged(object sender, EventArgs e) {
ceilingHeightAmmount.Label = "Ceil. Height" + (cbRelativeCeilHeight.Checked ? " (%):" : ":");
relativeCeilingHeight = cbRelativeCeilHeight.Checked;
ceilingHeightAmmount.Maximum = cbRelativeCeilHeight.Checked ? 100 : MaxSafeHeightDistance;
applyCeilingHeightJitter(ceilingHeightAmmount.Value);
}
private void cbRelativeFloorHeight_CheckedChanged(object sender, EventArgs e) {
floorHeightAmmount.Label = "Floor Height" + (cbRelativeFloorHeight.Checked ? " (%):" : ":");
relativeFloorHeight = cbRelativeFloorHeight.Checked;
floorHeightAmmount.Maximum = cbRelativeFloorHeight.Checked ? 100 : MaxSafeHeightDistance;
applyFloorHeightJitter(floorHeightAmmount.Value);
}
//texture pegging //texture pegging
private void cbPegTop_CheckedChanged(object sender, EventArgs e) { private void cbPegTop_CheckedChanged(object sender, EventArgs e) {
if(cbPegTop.Checked) { //apply flag if(cbPegTop.Checked) { //apply flag

View file

@ -25,22 +25,54 @@
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.bApply = new System.Windows.Forms.Button(); this.bApply = new System.Windows.Forms.Button();
this.bCancel = new System.Windows.Forms.Button(); this.bCancel = new System.Windows.Forms.Button();
this.bUpdateTranslation = new System.Windows.Forms.Button(); this.bUpdateTranslation = new System.Windows.Forms.Button();
this.bUpdateAngle = new System.Windows.Forms.Button();
this.bUpdateHeight = new System.Windows.Forms.Button();
this.cbRelativePos = new System.Windows.Forms.CheckBox();
this.cbRelativeHeight = new System.Windows.Forms.CheckBox();
this.positionJitterAmmount = new IntControl(); this.positionJitterAmmount = new IntControl();
this.bUpdateAngle = new System.Windows.Forms.Button();
this.rotationJitterAmmount = new IntControl(); this.rotationJitterAmmount = new IntControl();
this.heightJitterAmmount = new IntControl(); this.heightJitterAmmount = new IntControl();
this.bUpdateHeight = new System.Windows.Forms.Button();
this.pitchAmmount = new IntControl();
this.rollAmmount = new IntControl();
this.bUpdatePitch = new System.Windows.Forms.Button();
this.bUpdateRoll = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cbRelativeRoll = new System.Windows.Forms.CheckBox();
this.cbRelativePitch = new System.Windows.Forms.CheckBox();
this.scalegroup = new System.Windows.Forms.GroupBox();
this.cbNegativeScaleY = new System.Windows.Forms.CheckBox();
this.cbNegativeScaleX = new System.Windows.Forms.CheckBox();
this.cbUniformScale = new System.Windows.Forms.CheckBox();
this.cbRelativeScale = new System.Windows.Forms.CheckBox();
this.bUpdateScaleY = new System.Windows.Forms.Button();
this.maxScaleYLabel = new System.Windows.Forms.Label();
this.maxScaleY = new System.Windows.Forms.NumericUpDown();
this.minScaleYLabel = new System.Windows.Forms.Label();
this.minScaleY = new System.Windows.Forms.NumericUpDown();
this.bUpdateScaleX = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.maxScaleX = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.minScaleX = new System.Windows.Forms.NumericUpDown();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.cbNegativeRoll = new System.Windows.Forms.CheckBox();
this.cbNegativePitch = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.scalegroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.maxScaleY)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.minScaleY)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.maxScaleX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.minScaleX)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// bApply // bApply
// //
this.bApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bApply.Location = new System.Drawing.Point(282, 96); this.bApply.Location = new System.Drawing.Point(216, 399);
this.bApply.Name = "bApply"; this.bApply.Name = "bApply";
this.bApply.Size = new System.Drawing.Size(75, 23); this.bApply.Size = new System.Drawing.Size(75, 23);
this.bApply.TabIndex = 0; this.bApply.TabIndex = 0;
@ -50,8 +82,8 @@
// //
// bCancel // bCancel
// //
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bCancel.Location = new System.Drawing.Point(201, 96); this.bCancel.Location = new System.Drawing.Point(135, 399);
this.bCancel.Name = "bCancel"; this.bCancel.Name = "bCancel";
this.bCancel.Size = new System.Drawing.Size(75, 23); this.bCancel.Size = new System.Drawing.Size(75, 23);
this.bCancel.TabIndex = 1; this.bCancel.TabIndex = 1;
@ -61,63 +93,23 @@
// //
// bUpdateTranslation // bUpdateTranslation
// //
this.bUpdateTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateTranslation.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update; this.bUpdateTranslation.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateTranslation.Location = new System.Drawing.Point(337, 11); this.bUpdateTranslation.Location = new System.Drawing.Point(247, 18);
this.bUpdateTranslation.Name = "bUpdateTranslation"; this.bUpdateTranslation.Name = "bUpdateTranslation";
this.bUpdateTranslation.Size = new System.Drawing.Size(23, 23); this.bUpdateTranslation.Size = new System.Drawing.Size(23, 23);
this.bUpdateTranslation.TabIndex = 5; this.bUpdateTranslation.TabIndex = 5;
this.bUpdateTranslation.UseVisualStyleBackColor = true; this.bUpdateTranslation.UseVisualStyleBackColor = true;
this.bUpdateTranslation.Click += new System.EventHandler(this.bUpdateTranslation_Click); this.bUpdateTranslation.Click += new System.EventHandler(this.bUpdateTranslation_Click);
// //
// bUpdateAngle
//
this.bUpdateAngle.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateAngle.Location = new System.Drawing.Point(337, 67);
this.bUpdateAngle.Name = "bUpdateAngle";
this.bUpdateAngle.Size = new System.Drawing.Size(23, 23);
this.bUpdateAngle.TabIndex = 5;
this.bUpdateAngle.UseVisualStyleBackColor = true;
this.bUpdateAngle.Click += new System.EventHandler(this.bUpdateAngle_Click);
//
// bUpdateHeight
//
this.bUpdateHeight.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateHeight.Location = new System.Drawing.Point(337, 39);
this.bUpdateHeight.Name = "bUpdateHeight";
this.bUpdateHeight.Size = new System.Drawing.Size(23, 23);
this.bUpdateHeight.TabIndex = 5;
this.bUpdateHeight.UseVisualStyleBackColor = true;
this.bUpdateHeight.Click += new System.EventHandler(this.bUpdateHeight_Click);
//
// cbRelativePos
//
this.cbRelativePos.AutoSize = true;
this.cbRelativePos.Location = new System.Drawing.Point(12, 16);
this.cbRelativePos.Name = "cbRelativePos";
this.cbRelativePos.Size = new System.Drawing.Size(64, 18);
this.cbRelativePos.TabIndex = 11;
this.cbRelativePos.Text = "Relative";
this.cbRelativePos.UseVisualStyleBackColor = true;
this.cbRelativePos.CheckedChanged += new System.EventHandler(this.cbRelativePos_CheckedChanged);
//
// cbRelativeHeight
//
this.cbRelativeHeight.AutoSize = true;
this.cbRelativeHeight.Location = new System.Drawing.Point(12, 44);
this.cbRelativeHeight.Name = "cbRelativeHeight";
this.cbRelativeHeight.Size = new System.Drawing.Size(64, 18);
this.cbRelativeHeight.TabIndex = 12;
this.cbRelativeHeight.Text = "Relative";
this.cbRelativeHeight.UseVisualStyleBackColor = true;
this.cbRelativeHeight.CheckedChanged += new System.EventHandler(this.cbRelativeHeight_CheckedChanged);
//
// positionJitterAmmount // positionJitterAmmount
// //
this.positionJitterAmmount.AllowNegative = false; this.positionJitterAmmount.AllowNegative = false;
this.positionJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.positionJitterAmmount.ExtendedLimits = true; this.positionJitterAmmount.ExtendedLimits = true;
this.positionJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.positionJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.positionJitterAmmount.Label = "Position (%):"; this.positionJitterAmmount.Label = "Position:";
this.positionJitterAmmount.Location = new System.Drawing.Point(65, 12); this.positionJitterAmmount.Location = new System.Drawing.Point(-25, 19);
this.positionJitterAmmount.Maximum = 100; this.positionJitterAmmount.Maximum = 100;
this.positionJitterAmmount.Minimum = 0; this.positionJitterAmmount.Minimum = 0;
this.positionJitterAmmount.Name = "positionJitterAmmount"; this.positionJitterAmmount.Name = "positionJitterAmmount";
@ -126,13 +118,25 @@
this.positionJitterAmmount.Value = 0; this.positionJitterAmmount.Value = 0;
this.positionJitterAmmount.OnValueChanging += new System.EventHandler(this.positionJitterAmmount_OnValueChanged); this.positionJitterAmmount.OnValueChanging += new System.EventHandler(this.positionJitterAmmount_OnValueChanged);
// //
// bUpdateAngle
//
this.bUpdateAngle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateAngle.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateAngle.Location = new System.Drawing.Point(247, 18);
this.bUpdateAngle.Name = "bUpdateAngle";
this.bUpdateAngle.Size = new System.Drawing.Size(23, 23);
this.bUpdateAngle.TabIndex = 5;
this.bUpdateAngle.UseVisualStyleBackColor = true;
this.bUpdateAngle.Click += new System.EventHandler(this.bUpdateAngle_Click);
//
// rotationJitterAmmount // rotationJitterAmmount
// //
this.rotationJitterAmmount.AllowNegative = false; this.rotationJitterAmmount.AllowNegative = false;
this.rotationJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.rotationJitterAmmount.ExtendedLimits = false; this.rotationJitterAmmount.ExtendedLimits = false;
this.rotationJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rotationJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rotationJitterAmmount.Label = "Angle:"; this.rotationJitterAmmount.Label = "Angle:";
this.rotationJitterAmmount.Location = new System.Drawing.Point(65, 68); this.rotationJitterAmmount.Location = new System.Drawing.Point(-25, 19);
this.rotationJitterAmmount.Maximum = 359; this.rotationJitterAmmount.Maximum = 359;
this.rotationJitterAmmount.Minimum = 0; this.rotationJitterAmmount.Minimum = 0;
this.rotationJitterAmmount.Name = "rotationJitterAmmount"; this.rotationJitterAmmount.Name = "rotationJitterAmmount";
@ -144,10 +148,11 @@
// heightJitterAmmount // heightJitterAmmount
// //
this.heightJitterAmmount.AllowNegative = false; this.heightJitterAmmount.AllowNegative = false;
this.heightJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.heightJitterAmmount.ExtendedLimits = false; this.heightJitterAmmount.ExtendedLimits = false;
this.heightJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.heightJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.heightJitterAmmount.Label = "Height (%):"; this.heightJitterAmmount.Label = "Height:";
this.heightJitterAmmount.Location = new System.Drawing.Point(65, 40); this.heightJitterAmmount.Location = new System.Drawing.Point(-25, 47);
this.heightJitterAmmount.Maximum = 100; this.heightJitterAmmount.Maximum = 100;
this.heightJitterAmmount.Minimum = 0; this.heightJitterAmmount.Minimum = 0;
this.heightJitterAmmount.Name = "heightJitterAmmount"; this.heightJitterAmmount.Name = "heightJitterAmmount";
@ -156,19 +161,388 @@
this.heightJitterAmmount.Value = 0; this.heightJitterAmmount.Value = 0;
this.heightJitterAmmount.OnValueChanging += new System.EventHandler(this.heightJitterAmmount_OnValueChanging); this.heightJitterAmmount.OnValueChanging += new System.EventHandler(this.heightJitterAmmount_OnValueChanging);
// //
// bUpdateHeight
//
this.bUpdateHeight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateHeight.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateHeight.Location = new System.Drawing.Point(247, 46);
this.bUpdateHeight.Name = "bUpdateHeight";
this.bUpdateHeight.Size = new System.Drawing.Size(23, 23);
this.bUpdateHeight.TabIndex = 5;
this.bUpdateHeight.UseVisualStyleBackColor = true;
this.bUpdateHeight.Click += new System.EventHandler(this.bUpdateHeight_Click);
//
// pitchAmmount
//
this.pitchAmmount.AllowNegative = false;
this.pitchAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pitchAmmount.ExtendedLimits = false;
this.pitchAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.pitchAmmount.Label = "Pitch:";
this.pitchAmmount.Location = new System.Drawing.Point(-25, 47);
this.pitchAmmount.Maximum = 359;
this.pitchAmmount.Minimum = 0;
this.pitchAmmount.Name = "pitchAmmount";
this.pitchAmmount.Size = new System.Drawing.Size(266, 24);
this.pitchAmmount.TabIndex = 13;
this.pitchAmmount.Value = 0;
this.pitchAmmount.OnValueChanging += new System.EventHandler(this.pitchAmmount_OnValueChanging);
//
// rollAmmount
//
this.rollAmmount.AllowNegative = false;
this.rollAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.rollAmmount.ExtendedLimits = false;
this.rollAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rollAmmount.Label = "Roll:";
this.rollAmmount.Location = new System.Drawing.Point(-25, 77);
this.rollAmmount.Maximum = 359;
this.rollAmmount.Minimum = 0;
this.rollAmmount.Name = "rollAmmount";
this.rollAmmount.Size = new System.Drawing.Size(266, 24);
this.rollAmmount.TabIndex = 14;
this.rollAmmount.Value = 0;
this.rollAmmount.OnValueChanging += new System.EventHandler(this.rollAmmount_OnValueChanging);
//
// bUpdatePitch
//
this.bUpdatePitch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdatePitch.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdatePitch.Location = new System.Drawing.Point(247, 47);
this.bUpdatePitch.Name = "bUpdatePitch";
this.bUpdatePitch.Size = new System.Drawing.Size(23, 23);
this.bUpdatePitch.TabIndex = 15;
this.bUpdatePitch.UseVisualStyleBackColor = true;
this.bUpdatePitch.Click += new System.EventHandler(this.bUpdatePitch_Click);
//
// bUpdateRoll
//
this.bUpdateRoll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateRoll.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateRoll.Location = new System.Drawing.Point(247, 76);
this.bUpdateRoll.Name = "bUpdateRoll";
this.bUpdateRoll.Size = new System.Drawing.Size(23, 23);
this.bUpdateRoll.TabIndex = 16;
this.bUpdateRoll.UseVisualStyleBackColor = true;
this.bUpdateRoll.Click += new System.EventHandler(this.bUpdateRoll_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.positionJitterAmmount);
this.groupBox1.Controls.Add(this.bUpdateTranslation);
this.groupBox1.Controls.Add(this.bUpdateHeight);
this.groupBox1.Controls.Add(this.heightJitterAmmount);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(279, 82);
this.groupBox1.TabIndex = 17;
this.groupBox1.TabStop = false;
this.groupBox1.Text = " Position: ";
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.cbNegativeRoll);
this.groupBox2.Controls.Add(this.cbNegativePitch);
this.groupBox2.Controls.Add(this.cbRelativeRoll);
this.groupBox2.Controls.Add(this.cbRelativePitch);
this.groupBox2.Controls.Add(this.rotationJitterAmmount);
this.groupBox2.Controls.Add(this.bUpdateAngle);
this.groupBox2.Controls.Add(this.bUpdateRoll);
this.groupBox2.Controls.Add(this.pitchAmmount);
this.groupBox2.Controls.Add(this.rollAmmount);
this.groupBox2.Controls.Add(this.bUpdatePitch);
this.groupBox2.Location = new System.Drawing.Point(12, 100);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(279, 159);
this.groupBox2.TabIndex = 18;
this.groupBox2.TabStop = false;
this.groupBox2.Text = " Rotation: ";
//
// cbRelativeRoll
//
this.cbRelativeRoll.AutoSize = true;
this.cbRelativeRoll.Location = new System.Drawing.Point(9, 134);
this.cbRelativeRoll.Name = "cbRelativeRoll";
this.cbRelativeRoll.Size = new System.Drawing.Size(119, 18);
this.cbRelativeRoll.TabIndex = 18;
this.cbRelativeRoll.Text = "Relative to initial roll";
this.cbRelativeRoll.UseVisualStyleBackColor = true;
//
// cbRelativePitch
//
this.cbRelativePitch.AutoSize = true;
this.cbRelativePitch.Location = new System.Drawing.Point(9, 110);
this.cbRelativePitch.Name = "cbRelativePitch";
this.cbRelativePitch.Size = new System.Drawing.Size(128, 18);
this.cbRelativePitch.TabIndex = 17;
this.cbRelativePitch.Text = "Relative to initial pitch";
this.cbRelativePitch.UseVisualStyleBackColor = true;
//
// scalegroup
//
this.scalegroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.scalegroup.Controls.Add(this.cbNegativeScaleY);
this.scalegroup.Controls.Add(this.cbNegativeScaleX);
this.scalegroup.Controls.Add(this.cbUniformScale);
this.scalegroup.Controls.Add(this.cbRelativeScale);
this.scalegroup.Controls.Add(this.bUpdateScaleY);
this.scalegroup.Controls.Add(this.maxScaleYLabel);
this.scalegroup.Controls.Add(this.maxScaleY);
this.scalegroup.Controls.Add(this.minScaleYLabel);
this.scalegroup.Controls.Add(this.minScaleY);
this.scalegroup.Controls.Add(this.bUpdateScaleX);
this.scalegroup.Controls.Add(this.label3);
this.scalegroup.Controls.Add(this.maxScaleX);
this.scalegroup.Controls.Add(this.label2);
this.scalegroup.Controls.Add(this.minScaleX);
this.scalegroup.Location = new System.Drawing.Point(12, 265);
this.scalegroup.Name = "scalegroup";
this.scalegroup.Size = new System.Drawing.Size(279, 127);
this.scalegroup.TabIndex = 19;
this.scalegroup.TabStop = false;
this.scalegroup.Text = " Scale: ";
//
// cbNegativeScaleY
//
this.cbNegativeScaleY.AutoSize = true;
this.cbNegativeScaleY.Location = new System.Drawing.Point(150, 102);
this.cbNegativeScaleY.Name = "cbNegativeScaleY";
this.cbNegativeScaleY.Size = new System.Drawing.Size(121, 18);
this.cbNegativeScaleY.TabIndex = 25;
this.cbNegativeScaleY.Text = "Use negative height";
this.toolTip.SetToolTip(this.cbNegativeScaleY, "When checked, height scale will be picked from\r\n[-max .. -min] - [min .. max] ran" +
"ge");
this.cbNegativeScaleY.UseVisualStyleBackColor = true;
//
// cbNegativeScaleX
//
this.cbNegativeScaleX.AutoSize = true;
this.cbNegativeScaleX.Location = new System.Drawing.Point(150, 78);
this.cbNegativeScaleX.Name = "cbNegativeScaleX";
this.cbNegativeScaleX.Size = new System.Drawing.Size(119, 18);
this.cbNegativeScaleX.TabIndex = 24;
this.cbNegativeScaleX.Text = "Use negative width";
this.toolTip.SetToolTip(this.cbNegativeScaleX, "When checked, width scale will be picked from\r\n[-max .. -min] - [min .. max] rang" +
"e");
this.cbNegativeScaleX.UseVisualStyleBackColor = true;
//
// cbUniformScale
//
this.cbUniformScale.AutoSize = true;
this.cbUniformScale.Location = new System.Drawing.Point(9, 102);
this.cbUniformScale.Name = "cbUniformScale";
this.cbUniformScale.Size = new System.Drawing.Size(136, 18);
this.cbUniformScale.TabIndex = 23;
this.cbUniformScale.Text = "Same width and height";
this.cbUniformScale.UseVisualStyleBackColor = true;
//
// cbRelativeScale
//
this.cbRelativeScale.AutoSize = true;
this.cbRelativeScale.Location = new System.Drawing.Point(9, 78);
this.cbRelativeScale.Name = "cbRelativeScale";
this.cbRelativeScale.Size = new System.Drawing.Size(131, 18);
this.cbRelativeScale.TabIndex = 13;
this.cbRelativeScale.Text = "Relative to initial scale";
this.cbRelativeScale.UseVisualStyleBackColor = true;
//
// bUpdateScaleY
//
this.bUpdateScaleY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateScaleY.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateScaleY.Location = new System.Drawing.Point(247, 45);
this.bUpdateScaleY.Name = "bUpdateScaleY";
this.bUpdateScaleY.Size = new System.Drawing.Size(23, 23);
this.bUpdateScaleY.TabIndex = 22;
this.bUpdateScaleY.UseVisualStyleBackColor = true;
this.bUpdateScaleY.Click += new System.EventHandler(this.bUpdateScaleY_Click);
//
// maxScaleYLabel
//
this.maxScaleYLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.maxScaleYLabel.AutoSize = true;
this.maxScaleYLabel.Location = new System.Drawing.Point(147, 51);
this.maxScaleYLabel.Name = "maxScaleYLabel";
this.maxScaleYLabel.Size = new System.Drawing.Size(33, 14);
this.maxScaleYLabel.TabIndex = 21;
this.maxScaleYLabel.Text = "max.:";
//
// maxScaleY
//
this.maxScaleY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.maxScaleY.DecimalPlaces = 2;
this.maxScaleY.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.maxScaleY.Location = new System.Drawing.Point(186, 48);
this.maxScaleY.Minimum = new decimal(new int[] {
100,
0,
0,
-2147483648});
this.maxScaleY.Name = "maxScaleY";
this.maxScaleY.Size = new System.Drawing.Size(55, 20);
this.maxScaleY.TabIndex = 20;
this.maxScaleY.Value = new decimal(new int[] {
1,
0,
0,
0});
this.maxScaleY.ValueChanged += new System.EventHandler(this.minScaleY_ValueChanged);
//
// minScaleYLabel
//
this.minScaleYLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.minScaleYLabel.AutoSize = true;
this.minScaleYLabel.Location = new System.Drawing.Point(16, 51);
this.minScaleYLabel.Name = "minScaleYLabel";
this.minScaleYLabel.Size = new System.Drawing.Size(62, 14);
this.minScaleYLabel.TabIndex = 19;
this.minScaleYLabel.Text = "Height min.:";
//
// minScaleY
//
this.minScaleY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.minScaleY.DecimalPlaces = 2;
this.minScaleY.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.minScaleY.Location = new System.Drawing.Point(84, 48);
this.minScaleY.Minimum = new decimal(new int[] {
100,
0,
0,
-2147483648});
this.minScaleY.Name = "minScaleY";
this.minScaleY.Size = new System.Drawing.Size(55, 20);
this.minScaleY.TabIndex = 18;
this.minScaleY.Value = new decimal(new int[] {
1,
0,
0,
0});
this.minScaleY.ValueChanged += new System.EventHandler(this.minScaleY_ValueChanged);
//
// bUpdateScaleX
//
this.bUpdateScaleX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateScaleX.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateScaleX.Location = new System.Drawing.Point(247, 19);
this.bUpdateScaleX.Name = "bUpdateScaleX";
this.bUpdateScaleX.Size = new System.Drawing.Size(23, 23);
this.bUpdateScaleX.TabIndex = 17;
this.bUpdateScaleX.UseVisualStyleBackColor = true;
this.bUpdateScaleX.Click += new System.EventHandler(this.bUpdateScaleX_Click);
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(147, 25);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 14);
this.label3.TabIndex = 4;
this.label3.Text = "max.:";
//
// maxScaleX
//
this.maxScaleX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.maxScaleX.DecimalPlaces = 2;
this.maxScaleX.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.maxScaleX.Location = new System.Drawing.Point(186, 22);
this.maxScaleX.Minimum = new decimal(new int[] {
100,
0,
0,
-2147483648});
this.maxScaleX.Name = "maxScaleX";
this.maxScaleX.Size = new System.Drawing.Size(55, 20);
this.maxScaleX.TabIndex = 3;
this.maxScaleX.Value = new decimal(new int[] {
1,
0,
0,
0});
this.maxScaleX.ValueChanged += new System.EventHandler(this.minScaleX_ValueChanged);
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(19, 25);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 14);
this.label2.TabIndex = 2;
this.label2.Text = "Width min.:";
//
// minScaleX
//
this.minScaleX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.minScaleX.DecimalPlaces = 2;
this.minScaleX.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.minScaleX.Location = new System.Drawing.Point(84, 22);
this.minScaleX.Minimum = new decimal(new int[] {
100,
0,
0,
-2147483648});
this.minScaleX.Name = "minScaleX";
this.minScaleX.Size = new System.Drawing.Size(55, 20);
this.minScaleX.TabIndex = 1;
this.minScaleX.Value = new decimal(new int[] {
1,
0,
0,
0});
this.minScaleX.ValueChanged += new System.EventHandler(this.minScaleX_ValueChanged);
//
// cbNegativeRoll
//
this.cbNegativeRoll.AutoSize = true;
this.cbNegativeRoll.Location = new System.Drawing.Point(150, 134);
this.cbNegativeRoll.Name = "cbNegativeRoll";
this.cbNegativeRoll.Size = new System.Drawing.Size(106, 18);
this.cbNegativeRoll.TabIndex = 20;
this.cbNegativeRoll.Text = "Use negative roll";
this.toolTip.SetToolTip(this.cbNegativeRoll, "When checked, 50% of the time \r\nnegative roll will be used");
this.cbNegativeRoll.UseVisualStyleBackColor = true;
//
// cbNegativePitch
//
this.cbNegativePitch.AutoSize = true;
this.cbNegativePitch.Location = new System.Drawing.Point(150, 110);
this.cbNegativePitch.Name = "cbNegativePitch";
this.cbNegativePitch.Size = new System.Drawing.Size(115, 18);
this.cbNegativePitch.TabIndex = 19;
this.cbNegativePitch.Text = "Use negative pitch";
this.toolTip.SetToolTip(this.cbNegativePitch, "When checked, 50% of the time \r\nnegative pitch will be used.");
this.cbNegativePitch.UseVisualStyleBackColor = true;
//
// JitterThingsForm // JitterThingsForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(366, 122); this.ClientSize = new System.Drawing.Size(303, 428);
this.Controls.Add(this.cbRelativeHeight); this.Controls.Add(this.scalegroup);
this.Controls.Add(this.cbRelativePos); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.rotationJitterAmmount); this.Controls.Add(this.groupBox1);
this.Controls.Add(this.bUpdateAngle);
this.Controls.Add(this.heightJitterAmmount);
this.Controls.Add(this.bUpdateHeight);
this.Controls.Add(this.bUpdateTranslation);
this.Controls.Add(this.positionJitterAmmount);
this.Controls.Add(this.bCancel); this.Controls.Add(this.bCancel);
this.Controls.Add(this.bApply); this.Controls.Add(this.bApply);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
@ -176,10 +550,18 @@
this.Name = "JitterThingsForm"; this.Name = "JitterThingsForm";
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Jitter Settings"; this.Text = "Randomize Things!";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.JitterThingsForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.JitterThingsForm_FormClosing);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.scalegroup.ResumeLayout(false);
this.scalegroup.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.maxScaleY)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.minScaleY)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.maxScaleX)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.minScaleX)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@ -188,12 +570,36 @@
private System.Windows.Forms.Button bApply; private System.Windows.Forms.Button bApply;
private System.Windows.Forms.Button bCancel; private System.Windows.Forms.Button bCancel;
private System.Windows.Forms.Button bUpdateTranslation; private System.Windows.Forms.Button bUpdateTranslation;
private IntControl positionJitterAmmount; private CodeImp.DoomBuilder.BuilderEffects.IntControl positionJitterAmmount;
private System.Windows.Forms.Button bUpdateAngle; private System.Windows.Forms.Button bUpdateAngle;
private IntControl rotationJitterAmmount; private CodeImp.DoomBuilder.BuilderEffects.IntControl rotationJitterAmmount;
private IntControl heightJitterAmmount; private CodeImp.DoomBuilder.BuilderEffects.IntControl heightJitterAmmount;
private System.Windows.Forms.Button bUpdateHeight; private System.Windows.Forms.Button bUpdateHeight;
private System.Windows.Forms.CheckBox cbRelativePos; private CodeImp.DoomBuilder.BuilderEffects.IntControl pitchAmmount;
private System.Windows.Forms.CheckBox cbRelativeHeight; private CodeImp.DoomBuilder.BuilderEffects.IntControl rollAmmount;
private System.Windows.Forms.Button bUpdatePitch;
private System.Windows.Forms.Button bUpdateRoll;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox scalegroup;
private System.Windows.Forms.NumericUpDown minScaleX;
private System.Windows.Forms.CheckBox cbUniformScale;
private System.Windows.Forms.CheckBox cbRelativeScale;
private System.Windows.Forms.Button bUpdateScaleY;
private System.Windows.Forms.Label maxScaleYLabel;
private System.Windows.Forms.NumericUpDown maxScaleY;
private System.Windows.Forms.Label minScaleYLabel;
private System.Windows.Forms.NumericUpDown minScaleY;
private System.Windows.Forms.Button bUpdateScaleX;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown maxScaleX;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox cbNegativeScaleX;
private System.Windows.Forms.CheckBox cbRelativeRoll;
private System.Windows.Forms.CheckBox cbRelativePitch;
private System.Windows.Forms.CheckBox cbNegativeScaleY;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.CheckBox cbNegativeRoll;
private System.Windows.Forms.CheckBox cbNegativePitch;
} }
} }

View file

@ -1,35 +1,59 @@
using System; #region Namespaces
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.VisualModes; using CodeImp.DoomBuilder.VisualModes;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
#endregion
namespace CodeImp.DoomBuilder.BuilderEffects namespace CodeImp.DoomBuilder.BuilderEffects
{ {
public partial class JitterThingsForm : Form public partial class JitterThingsForm : Form
{ {
private string editingModeName; #region Variables
private List<Thing> selection;
private List<VisualThing> visualSelection;
private List<ThingData> thingData;
private int MaxSafeDistance;
private int MaxSafeHeightDistance;
private static bool relativePosition; private readonly string editingModeName;
private static bool relativeHeight; 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;
private struct ThingData { private struct ThingData {
public Vector3D Position; public Vector3D Position;
public int Angle; public int Angle;
public int Pitch;
public int Roll;
public float ScaleX;
public float ScaleY;
public int SectorHeight; public int SectorHeight;
public int ZOffset; public int ZOffset;
public int SafeDistance; public int SafeDistance;
public int JitterAngle; //position jitter angle, not Thing angle! public int OffsetAngle; //position jitter angle, not Thing angle!
public float JitterRotation; //Thing angle public float JitterRotation;
public float JitterPitch;
public float JitterRoll;
public float JitterScaleX;
public float JitterScaleY;
public float JitterHeight; public float JitterHeight;
} }
#endregion
#region Constructor
public JitterThingsForm(string editingModeName) { public JitterThingsForm(string editingModeName) {
this.editingModeName = editingModeName; this.editingModeName = editingModeName;
this.HelpRequested += JitterThingsForm_HelpRequested; this.HelpRequested += JitterThingsForm_HelpRequested;
@ -40,21 +64,32 @@ namespace CodeImp.DoomBuilder.BuilderEffects
heightJitterAmmount.Enabled = General.Map.FormatInterface.HasThingHeight; heightJitterAmmount.Enabled = General.Map.FormatInterface.HasThingHeight;
bUpdateHeight.Enabled = General.Map.FormatInterface.HasThingHeight; bUpdateHeight.Enabled = General.Map.FormatInterface.HasThingHeight;
//disable pitch/roll/scale?
if (!General.Map.UDMF) {
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;
}
//get selection //get selection
selection = new List<Thing>(); selection = new List<Thing>();
if(editingModeName == "BaseVisualMode") { if(editingModeName == "BaseVisualMode") {
visualSelection = ((VisualMode)General.Editing.Mode).GetSelectedVisualThings(false); visualSelection = ((VisualMode)General.Editing.Mode).GetSelectedVisualThings(false);
foreach(VisualThing t in visualSelection) foreach(VisualThing t in visualSelection) selection.Add(t.Thing);
selection.Add(t.Thing);
} else { } else {
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true); ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
foreach(Thing t in list) foreach(Thing t in list) selection.Add(t);
selection.Add(t);
} }
//update window header //update window header
this.Text = "Jitter Transform (" + selection.Count + " thing" + (selection.Count > 1 ? "s" : "") + ")"; this.Text = "Randomize " + selection.Count + (selection.Count > 1 ? " things" : " thing");
//store intial properties //store intial properties
thingData = new List<ThingData>(); thingData = new List<ThingData>();
@ -74,6 +109,10 @@ namespace CodeImp.DoomBuilder.BuilderEffects
if(MaxSafeDistance < d.SafeDistance) MaxSafeDistance = d.SafeDistance; if(MaxSafeDistance < d.SafeDistance) MaxSafeDistance = d.SafeDistance;
d.Position = t.Position; d.Position = t.Position;
d.Angle = t.AngleDoom; d.Angle = t.AngleDoom;
d.Pitch = t.Pitch;
d.Roll = t.Roll;
d.ScaleX = t.ScaleX;
d.ScaleY = t.ScaleY;
if(General.Map.FormatInterface.HasThingHeight) { if(General.Map.FormatInterface.HasThingHeight) {
if(t.Sector == null) t.DetermineSector(); if(t.Sector == null) t.DetermineSector();
@ -87,73 +126,150 @@ namespace CodeImp.DoomBuilder.BuilderEffects
thingData.Add(d); thingData.Add(d);
} }
updateAngles(); positionJitterAmmount.Maximum = MaxSafeDistance;
heightJitterAmmount.Maximum = MaxSafeHeightDistance;
updateOffsetAngles();
updateHeights(); updateHeights();
updateRotationAngles(); updateRotationAngles();
updatePitchAngles();
//set editing mode updateRollAngles();
cbRelativePos.Checked = relativePosition; updateScaleX();
cbRelativePos_CheckedChanged(this, EventArgs.Empty); updateScaleY();
cbRelativeHeight.Checked = relativeHeight;
cbRelativeHeight_CheckedChanged(this, EventArgs.Empty);
//create undo //create undo
General.Map.UndoRedo.ClearAllRedos(); General.Map.UndoRedo.ClearAllRedos();
General.Map.UndoRedo.CreateUndo("Jitter Transform (" + selection.Count + " thing" + (selection.Count > 1 ? "s)" : ")")); General.Map.UndoRedo.CreateUndo("Randomize " + selection.Count +(selection.Count > 1 ? " things" : " thing"));
//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
if (uniformScale) cbUniformScale_CheckedChanged(cbUniformScale, EventArgs.Empty);
//tricky way to actually store undo information... //tricky way to actually store undo information...
foreach(Thing t in selection) t.Move(t.Position); foreach(Thing t in selection) t.Move(t.Position);
} }
//utility #endregion
private void applyTranslationJitter(int ammount) {
int curAmmount;
if(relativePosition) { #region Apply logic
private void applyTranslation(int ammount) {
for(int i = 0; i < selection.Count; i++) { for(int i = 0; i < selection.Count; i++) {
curAmmount = (int)Math.Round(ammount * (thingData[i].SafeDistance / 100f)); int curAmmount = ammount > thingData[i].SafeDistance ? thingData[i].SafeDistance : ammount;
selection[i].Move(new Vector2D(thingData[i].Position.x + (int)(Math.Sin(thingData[i].JitterAngle) * curAmmount), thingData[i].Position.y + (int)(Math.Cos(thingData[i].JitterAngle) * curAmmount))); 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(); selection[i].DetermineSector();
} }
} else {
for(int i = 0; i < selection.Count; i++) {
curAmmount = ammount > thingData[i].SafeDistance ? thingData[i].SafeDistance : ammount;
selection[i].Move(new Vector2D(thingData[i].Position.x + (int)(Math.Sin(thingData[i].JitterAngle) * curAmmount), thingData[i].Position.y + (int)(Math.Cos(thingData[i].JitterAngle) * curAmmount)));
selection[i].DetermineSector();
}
}
updateGeometry(); updateGeometry();
} }
private void applyRotationJitter(int ammount) { private void applyRotation(int ammount) {
for(int i = 0; i < selection.Count; i++) for(int i = 0; i < selection.Count; i++)
selection[i].Rotate((int)((thingData[i].Angle + ammount * thingData[i].JitterRotation) % 360)); selection[i].Rotate((int)((thingData[i].Angle + ammount * thingData[i].JitterRotation) % 360));
//update view //update view
if(editingModeName == "ThingsMode") if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
General.Interface.RedrawDisplay();
} }
private void applyHeightJitter(int ammount) { private void applyPitch(int ammount) {
int curAmmount; int p;
float a = ammount / 100f;
if(relativePosition) {
for(int i = 0; i < selection.Count; i++) { for(int i = 0; i < selection.Count; i++) {
curAmmount = Math.Min(thingData[i].SectorHeight, Math.Max(0, thingData[i].ZOffset + (int)(thingData[i].SectorHeight * a))); if (cbRelativePitch.Checked) {
selection[i].Move(selection[i].Position.x, selection[i].Position.y, curAmmount * thingData[i].JitterHeight); p = (int)((thingData[i].Pitch + ammount * thingData[i].JitterPitch) % 360);
}
} else { } else {
for(int i = 0; i < selection.Count; i++) { p = (int)((ammount * thingData[i].JitterPitch) % 360);
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);
} }
selection[i].SetPitch(p);
}
//update view
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
}
private void applyRoll(int ammount) {
int r;
for (int i = 0; i < selection.Count; i++) {
if (cbRelativeRoll.Checked) {
r = (int)((thingData[i].Roll + ammount * thingData[i].JitterRoll) % 360);
} else {
r = (int)((ammount * thingData[i].JitterRoll) % 360);
}
selection[i].SetRoll(r);
}
//update view
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
}
private void applyHeight(int ammount) {
for(int i = 0; i < selection.Count; i++) {
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);
} }
updateGeometry(); updateGeometry();
} }
private void applyScale() {
if(cbUniformScale.Checked) {
applyScale((float)minScaleX.Value, (float)maxScaleX.Value, (float)minScaleX.Value, (float)maxScaleX.Value);
} else {
applyScale((float)minScaleX.Value, (float)maxScaleX.Value, (float)minScaleY.Value, (float)maxScaleY.Value);
}
//update view
if(editingModeName == "ThingsMode") General.Interface.RedrawDisplay();
}
private void applyScale(float minX, float maxX, float minY, float maxY) {
if(minX > maxX) General.Swap(ref minX, ref maxX);
if(minY > maxY) General.Swap(ref minY, ref maxY);
float sx, sy;
float diffX = maxX - minX;
float diffY = maxY - minY;
for(int i = 0; i < selection.Count; i++) {
if (cbRelativeScale.Checked) {
sx = thingData[i].ScaleX + minX + diffX * thingData[i].JitterScaleX;
sy = thingData[i].ScaleY + minY + diffY * thingData[i].JitterScaleY;
} else {
sx = minX + diffX * thingData[i].JitterScaleX;
sy = minY + diffY * thingData[i].JitterScaleY;
}
selection[i].SetScale(sx, sy);
}
}
#endregion
#region Update logic
private void updateGeometry() { private void updateGeometry() {
// Update what must be updated // Update what must be updated
if(editingModeName == "BaseVisualMode") { if(editingModeName == "BaseVisualMode") {
@ -171,41 +287,72 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
} }
private void updateAngles() { private void updateOffsetAngles() {
Random rnd = new Random();
for(int i = 0; i < thingData.Count; i++) { for(int i = 0; i < thingData.Count; i++) {
ThingData td = thingData[i]; ThingData td = thingData[i];
td.JitterAngle = rnd.Next(359); //(float)(rnd.Next(359) * Math.PI / 180f); td.OffsetAngle = General.Random(0, 359);
thingData[i] = td; thingData[i] = td;
} }
} }
private void updateHeights() { private void updateHeights() {
Random rnd = new Random();
for(int i = 0; i < thingData.Count; i++) { for(int i = 0; i < thingData.Count; i++) {
ThingData td = thingData[i]; ThingData td = thingData[i];
td.JitterHeight = (rnd.Next(100) / 100f); td.JitterHeight = (General.Random(0, 100) / 100f);
thingData[i] = td; thingData[i] = td;
} }
} }
private void updateRotationAngles() { private void updateRotationAngles() {
Random rnd = new Random();
for(int i = 0; i < thingData.Count; i++) { for(int i = 0; i < thingData.Count; i++) {
ThingData td = thingData[i]; ThingData td = thingData[i];
td.JitterRotation = (rnd.Next(-100, 100) / 100f); td.JitterRotation = (General.Random(-100, 100) / 100f);
thingData[i] = td; thingData[i] = td;
} }
} }
//EVENTS private void updatePitchAngles() {
private void bApply_Click(object sender, EventArgs e) { int min = (cbNegativePitch.Checked ? -100 : 0);
foreach(Thing t in selection) for(int i = 0; i < thingData.Count; i++) {
t.DetermineSector(); ThingData td = thingData[i];
td.JitterPitch = (General.Random(min, 100) / 100f);
thingData[i] = td;
}
}
private void updateRollAngles() {
int min = (cbNegativeRoll.Checked ? -100 : 0);
for(int i = 0; i < thingData.Count; i++) {
ThingData td = thingData[i];
td.JitterRoll = (General.Random(min, 100) / 100f);
thingData[i] = td;
}
}
private void updateScaleX() {
int min = (cbNegativeScaleX.Checked ? -100 : 0);
for(int i = 0; i < thingData.Count; i++) {
ThingData td = thingData[i];
td.JitterScaleX = (General.Random(min, 100) / 100f);
thingData[i] = td;
}
}
private void updateScaleY() {
int min = (cbNegativeScaleY.Checked ? -100 : 0);
for(int i = 0; i < thingData.Count; i++) {
ThingData td = thingData[i];
td.JitterScaleY = (General.Random(min, 100) / 100f);
thingData[i] = td;
}
}
#endregion
#region Events
private void bApply_Click(object sender, EventArgs e) {
foreach(Thing t in selection) t.DetermineSector();
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
Close(); Close();
} }
@ -216,54 +363,134 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
private void JitterThingsForm_FormClosing(object sender, FormClosingEventArgs e) { private void JitterThingsForm_FormClosing(object sender, FormClosingEventArgs e) {
if(this.DialogResult == DialogResult.Cancel) if (this.DialogResult == DialogResult.Cancel) {
General.Map.UndoRedo.WithdrawUndo();//undo changes //undo changes
General.Map.UndoRedo.WithdrawUndo();
} else {
//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;
}
} }
private void positionJitterAmmount_OnValueChanged(object sender, EventArgs e) { private void positionJitterAmmount_OnValueChanged(object sender, EventArgs e) {
applyTranslationJitter(positionJitterAmmount.Value); applyTranslation(positionJitterAmmount.Value);
} }
private void rotationJitterAmmount_OnValueChanged(object sender, EventArgs e) { private void rotationJitterAmmount_OnValueChanged(object sender, EventArgs e) {
applyRotationJitter(rotationJitterAmmount.Value); applyRotation(rotationJitterAmmount.Value);
} }
private void heightJitterAmmount_OnValueChanging(object sender, EventArgs e) { private void heightJitterAmmount_OnValueChanging(object sender, EventArgs e) {
applyHeightJitter(heightJitterAmmount.Value); applyHeight(heightJitterAmmount.Value);
} }
//buttons & checkboxes private void pitchAmmount_OnValueChanging(object sender, EventArgs e) {
applyPitch(pitchAmmount.Value);
}
private void rollAmmount_OnValueChanging(object sender, EventArgs e) {
applyRoll(rollAmmount.Value);
}
private void minScaleX_ValueChanged(object sender, EventArgs e) {
applyScale();
}
private void minScaleY_ValueChanged(object sender, EventArgs e) {
applyScale();
}
#endregion
#region Buttons & checkboxes events
private void bUpdateTranslation_Click(object sender, EventArgs e) { private void bUpdateTranslation_Click(object sender, EventArgs e) {
updateAngles(); updateOffsetAngles();
applyTranslationJitter(positionJitterAmmount.Value); applyTranslation(positionJitterAmmount.Value);
} }
private void bUpdateHeight_Click(object sender, EventArgs e) { private void bUpdateHeight_Click(object sender, EventArgs e) {
updateHeights(); updateHeights();
applyHeightJitter(heightJitterAmmount.Value); applyHeight(heightJitterAmmount.Value);
} }
private void bUpdateAngle_Click(object sender, EventArgs e) { private void bUpdateAngle_Click(object sender, EventArgs e) {
updateRotationAngles(); updateRotationAngles();
applyRotationJitter(rotationJitterAmmount.Value); applyRotation(rotationJitterAmmount.Value);
} }
private void cbRelativeHeight_CheckedChanged(object sender, EventArgs e) { private void bUpdatePitch_Click(object sender, EventArgs e) {
heightJitterAmmount.Label = "Height" + (cbRelativePos.Checked ? " (%):" : ":"); updatePitchAngles();
relativeHeight = cbRelativeHeight.Checked; applyPitch(pitchAmmount.Value);
heightJitterAmmount.Maximum = relativeHeight ? 100 : MaxSafeHeightDistance;
applyHeightJitter(heightJitterAmmount.Value);
} }
private void cbRelativePos_CheckedChanged(object sender, EventArgs e) { private void bUpdateRoll_Click(object sender, EventArgs e) {
positionJitterAmmount.Label = "Position" + (cbRelativePos.Checked ? " (%):" : ":"); updateRollAngles();
relativePosition = cbRelativePos.Checked; applyRoll(rollAmmount.Value);
positionJitterAmmount.Maximum = relativePosition ? 100 : MaxSafeDistance;
applyTranslationJitter(positionJitterAmmount.Value);
} }
private void bUpdateScaleX_Click(object sender, EventArgs e) {
updateScaleX();
applyScale();
}
private void bUpdateScaleY_Click(object sender, EventArgs e) {
updateScaleY();
applyScale();
}
private void cbRelativePitch_CheckedChanged(object sender, EventArgs e) {
updatePitchAngles();
applyPitch(pitchAmmount.Value);
}
private void cbRelativeRoll_CheckedChanged(object sender, EventArgs e) {
updateRollAngles();
applyRoll(rollAmmount.Value);
}
private void cbNegativePitch_CheckedChanged(object sender, EventArgs e) {
updatePitchAngles();
applyPitch(pitchAmmount.Value);
}
private void cbNegativeRoll_CheckedChanged(object sender, EventArgs e) {
updateRollAngles();
applyRoll(rollAmmount.Value);
}
private void cbRelativeScale_CheckedChanged(object sender, EventArgs e) {
applyScale();
}
private void cbUniformScale_CheckedChanged(object sender, EventArgs e) {
bUpdateScaleY.Enabled = !cbUniformScale.Checked;
minScaleY.Enabled = !cbUniformScale.Checked;
maxScaleY.Enabled = !cbUniformScale.Checked;
minScaleYLabel.Enabled = !cbUniformScale.Checked;
maxScaleYLabel.Enabled = !cbUniformScale.Checked;
applyScale();
}
private void cbNegativeScaleX_CheckedChanged(object sender, EventArgs e) {
updateScaleX();
applyScale();
}
private void cbNegativeScaleY_CheckedChanged(object sender, EventArgs e) {
updateScaleY();
applyScale();
}
#endregion
//HALP! //HALP!
private void JitterThingsForm_HelpRequested(object sender, HelpEventArgs hlpevent) { private void JitterThingsForm_HelpRequested(object sender, HelpEventArgs hlpevent) {
General.ShowHelp("gzdb/features/all_modes/jitter.html"); General.ShowHelp("gzdb/features/all_modes/jitter.html");

View file

@ -117,4 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View file

@ -28,7 +28,6 @@
this.bCancel = new System.Windows.Forms.Button(); this.bCancel = new System.Windows.Forms.Button();
this.bApply = new System.Windows.Forms.Button(); this.bApply = new System.Windows.Forms.Button();
this.bUpdateTranslation = new System.Windows.Forms.Button(); this.bUpdateTranslation = new System.Windows.Forms.Button();
this.cbRelativePos = new System.Windows.Forms.CheckBox();
this.positionJitterAmmount = new IntControl(); this.positionJitterAmmount = new IntControl();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -36,7 +35,7 @@
// //
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.bCancel.Location = new System.Drawing.Point(201, 40); this.bCancel.Location = new System.Drawing.Point(141, 45);
this.bCancel.Name = "bCancel"; this.bCancel.Name = "bCancel";
this.bCancel.Size = new System.Drawing.Size(75, 23); this.bCancel.Size = new System.Drawing.Size(75, 23);
this.bCancel.TabIndex = 7; this.bCancel.TabIndex = 7;
@ -47,7 +46,7 @@
// bApply // bApply
// //
this.bApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bApply.Location = new System.Drawing.Point(282, 40); this.bApply.Location = new System.Drawing.Point(222, 45);
this.bApply.Name = "bApply"; this.bApply.Name = "bApply";
this.bApply.Size = new System.Drawing.Size(75, 23); this.bApply.Size = new System.Drawing.Size(75, 23);
this.bApply.TabIndex = 6; this.bApply.TabIndex = 6;
@ -59,32 +58,21 @@
// //
this.bUpdateTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bUpdateTranslation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateTranslation.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update; this.bUpdateTranslation.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateTranslation.Location = new System.Drawing.Point(334, 11); this.bUpdateTranslation.Location = new System.Drawing.Point(274, 11);
this.bUpdateTranslation.Name = "bUpdateTranslation"; this.bUpdateTranslation.Name = "bUpdateTranslation";
this.bUpdateTranslation.Size = new System.Drawing.Size(23, 23); this.bUpdateTranslation.Size = new System.Drawing.Size(23, 23);
this.bUpdateTranslation.TabIndex = 8; this.bUpdateTranslation.TabIndex = 8;
this.bUpdateTranslation.UseVisualStyleBackColor = true; this.bUpdateTranslation.UseVisualStyleBackColor = true;
this.bUpdateTranslation.Click += new System.EventHandler(this.bUpdateTranslation_Click); this.bUpdateTranslation.Click += new System.EventHandler(this.bUpdateTranslation_Click);
// //
// cbRelativePos
//
this.cbRelativePos.AutoSize = true;
this.cbRelativePos.Location = new System.Drawing.Point(12, 16);
this.cbRelativePos.Name = "cbRelativePos";
this.cbRelativePos.Size = new System.Drawing.Size(64, 18);
this.cbRelativePos.TabIndex = 10;
this.cbRelativePos.Text = "Relative";
this.cbRelativePos.UseVisualStyleBackColor = true;
this.cbRelativePos.CheckedChanged += new System.EventHandler(this.cbRelativePos_CheckedChanged);
//
// positionJitterAmmount // positionJitterAmmount
// //
this.positionJitterAmmount.AllowNegative = false; this.positionJitterAmmount.AllowNegative = false;
this.positionJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.positionJitterAmmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.positionJitterAmmount.ExtendedLimits = true; this.positionJitterAmmount.ExtendedLimits = true;
this.positionJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.positionJitterAmmount.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.positionJitterAmmount.Label = "Position (%):"; this.positionJitterAmmount.Label = "Position:";
this.positionJitterAmmount.Location = new System.Drawing.Point(62, 12); this.positionJitterAmmount.Location = new System.Drawing.Point(2, 12);
this.positionJitterAmmount.Maximum = 100; this.positionJitterAmmount.Maximum = 100;
this.positionJitterAmmount.Minimum = 0; this.positionJitterAmmount.Minimum = 0;
this.positionJitterAmmount.Name = "positionJitterAmmount"; this.positionJitterAmmount.Name = "positionJitterAmmount";
@ -99,8 +87,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.bCancel; this.CancelButton = this.bCancel;
this.ClientSize = new System.Drawing.Size(366, 68); this.ClientSize = new System.Drawing.Size(306, 72);
this.Controls.Add(this.cbRelativePos);
this.Controls.Add(this.positionJitterAmmount); this.Controls.Add(this.positionJitterAmmount);
this.Controls.Add(this.bUpdateTranslation); this.Controls.Add(this.bUpdateTranslation);
this.Controls.Add(this.bCancel); this.Controls.Add(this.bCancel);
@ -113,7 +100,6 @@
this.Text = "Jitter Settings"; this.Text = "Jitter Settings";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.JitterVerticesForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.JitterVerticesForm_FormClosing);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@ -123,6 +109,5 @@
private System.Windows.Forms.Button bCancel; private System.Windows.Forms.Button bCancel;
private System.Windows.Forms.Button bApply; private System.Windows.Forms.Button bApply;
private IntControl positionJitterAmmount; private IntControl positionJitterAmmount;
private System.Windows.Forms.CheckBox cbRelativePos;
} }
} }

View file

@ -10,13 +10,11 @@ namespace CodeImp.DoomBuilder.BuilderEffects
{ {
public partial class JitterVerticesForm : Form public partial class JitterVerticesForm : Form
{ {
private string editingModeName; private readonly string editingModeName;
private List<Vertex> selection; private readonly List<Vertex> selection;
private List<VisualSector> visualSectors; private readonly List<VisualSector> visualSectors;
private VertexData[] vertexData; private readonly VertexData[] vertexData;
private int MaxSafeDistance; private readonly int MaxSafeDistance;
private static bool relativePosition;
private struct VertexData private struct VertexData
{ {
@ -56,7 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
//update window header //update window header
this.Text = "Jitter Transform (" + linesCount + (linesCount > 1 ? " linedefs" : " linedef") + ")"; this.Text = "Randomize " + linesCount + (linesCount > 1 ? " linedefs" : " linedef");
} else if(editingModeName == "LinedefsMode") { } else if(editingModeName == "LinedefsMode") {
ICollection<Linedef> list = General.Map.Map.GetSelectedLinedefs(true); ICollection<Linedef> list = General.Map.Map.GetSelectedLinedefs(true);
int linesCount = 0; int linesCount = 0;
@ -70,7 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
//update window header //update window header
this.Text = "Jitter Transform (" + linesCount + (linesCount > 1 ? " linedefs" : " linedef") + ")"; this.Text = "Randomize " + linesCount + (linesCount > 1 ? " linedefs" : " linedef");
} else { } else {
ICollection<Vertex> list = General.Map.Map.GetSelectedVertices(true); ICollection<Vertex> list = General.Map.Map.GetSelectedVertices(true);
@ -78,7 +76,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
selection.Add(v); selection.Add(v);
//update window header //update window header
this.Text = "Jitter Transform (" + selection.Count + (selection.Count > 1 ? " vertices" : " vertex") + ")"; this.Text = "Randomize " + selection.Count + (selection.Count > 1 ? " vertices" : " vertex");
} }
if(selection.Count == 0) { if(selection.Count == 0) {
@ -89,8 +87,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
Dictionary<Vertex, VertexData> data = new Dictionary<Vertex, VertexData>(); Dictionary<Vertex, VertexData> data = new Dictionary<Vertex, VertexData>();
foreach(Vertex v in selection) { foreach(Vertex v in selection) {
VertexData vd = new VertexData(); VertexData vd = new VertexData {Position = v.Position};
vd.Position = v.Position;
data.Add(v, vd); data.Add(v, vd);
} }
@ -150,32 +147,23 @@ namespace CodeImp.DoomBuilder.BuilderEffects
MaxSafeDistance = vertexData[i].SafeDistance; MaxSafeDistance = vertexData[i].SafeDistance;
} }
updateAngles(); positionJitterAmmount.Maximum = MaxSafeDistance;
//set editing mode updateAngles();
cbRelativePos.Checked = relativePosition;
cbRelativePos_CheckedChanged(this, EventArgs.Empty);
//create undo //create undo
General.Map.UndoRedo.ClearAllRedos(); General.Map.UndoRedo.ClearAllRedos();
General.Map.UndoRedo.CreateUndo("Jitter Transform (" + selection.Count + (selection.Count > 1 ? " vertices)" : " vertex)")); General.Map.UndoRedo.CreateUndo("Randomize " + selection.Count + (selection.Count > 1 ? " vertices" : " vertex"));
} }
//utility //utility
private void applyTranslationJitter(int ammount) { private void applyTranslationJitter(int ammount) {
int curAmmount; int curAmmount;
if(relativePosition) {
for(int i = 0; i < selection.Count; i++) {
curAmmount = (int)Math.Round(ammount * (vertexData[i].SafeDistance / 100f));
selection[i].Move(new Vector2D(vertexData[i].Position.x + (int)(Math.Sin(vertexData[i].JitterAngle) * curAmmount), vertexData[i].Position.y + (int)(Math.Cos(vertexData[i].JitterAngle) * curAmmount)));
}
} else {
for(int i = 0; i < selection.Count; i++) { for(int i = 0; i < selection.Count; i++) {
curAmmount = ammount > vertexData[i].SafeDistance ? vertexData[i].SafeDistance : ammount; curAmmount = ammount > vertexData[i].SafeDistance ? vertexData[i].SafeDistance : ammount;
selection[i].Move(new Vector2D(vertexData[i].Position.x + (int)(Math.Sin(vertexData[i].JitterAngle) * curAmmount), vertexData[i].Position.y + (int)(Math.Cos(vertexData[i].JitterAngle) * curAmmount))); selection[i].Move(new Vector2D(vertexData[i].Position.x + (int)(Math.Sin(vertexData[i].JitterAngle) * curAmmount), vertexData[i].Position.y + (int)(Math.Cos(vertexData[i].JitterAngle) * curAmmount)));
} }
}
//update view //update view
if(editingModeName == "BaseVisualMode") { if(editingModeName == "BaseVisualMode") {
@ -193,11 +181,9 @@ namespace CodeImp.DoomBuilder.BuilderEffects
} }
private void updateAngles() { private void updateAngles() {
Random rnd = new Random();
for(int i = 0; i < vertexData.Length; i++) { for(int i = 0; i < vertexData.Length; i++) {
VertexData vd = vertexData[i]; VertexData vd = vertexData[i];
vd.JitterAngle = (float)(rnd.Next(359) * Math.PI / 180f); vd.JitterAngle = (float)(General.Random(0, 359) * Math.PI / 180f);
vertexData[i] = vd; vertexData[i] = vd;
} }
} }
@ -234,14 +220,6 @@ namespace CodeImp.DoomBuilder.BuilderEffects
applyTranslationJitter(positionJitterAmmount.Value); applyTranslationJitter(positionJitterAmmount.Value);
} }
private void cbRelativePos_CheckedChanged(object sender, EventArgs e) {
positionJitterAmmount.Label = "Position" + (cbRelativePos.Checked ? " (%):" : ":");
relativePosition = cbRelativePos.Checked;
positionJitterAmmount.Maximum = relativePosition ? 100 : MaxSafeDistance;
applyTranslationJitter(positionJitterAmmount.Value);
}
private void JitterVerticesForm_HelpRequested(object sender, HelpEventArgs hlpevent) { private void JitterVerticesForm_HelpRequested(object sender, HelpEventArgs hlpevent) {
General.ShowHelp("gzdb/features/all_modes/jitter.html"); General.ShowHelp("gzdb/features/all_modes/jitter.html");
hlpevent.Handled = true; hlpevent.Handled = true;

View file

@ -27,11 +27,11 @@
private void InitializeComponent() { private void InitializeComponent() {
this.menuStrip = new System.Windows.Forms.MenuStrip(); this.menuStrip = new System.Windows.Forms.MenuStrip();
this.importStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.importStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.jitterItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip = new System.Windows.Forms.ToolStrip(); this.toolStrip = new System.Windows.Forms.ToolStrip();
this.jitterButton = new System.Windows.Forms.ToolStripButton(); this.jitterButton = new System.Windows.Forms.ToolStripButton();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.jitterItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
this.toolStrip.SuspendLayout(); this.toolStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -55,6 +55,15 @@
this.importStripMenuItem.Size = new System.Drawing.Size(55, 20); this.importStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.importStripMenuItem.Text = "Import"; this.importStripMenuItem.Text = "Import";
// //
// toolStripMenuItem1
//
this.toolStripMenuItem1.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Terrain;
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(215, 22);
this.toolStripMenuItem1.Tag = "importobjasterrain";
this.toolStripMenuItem1.Text = "Wavefront .obj as Terrain...";
this.toolStripMenuItem1.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -63,6 +72,15 @@
this.toolStripMenuItem3.Size = new System.Drawing.Size(55, 20); this.toolStripMenuItem3.Size = new System.Drawing.Size(55, 20);
this.toolStripMenuItem3.Text = "Modes"; this.toolStripMenuItem3.Text = "Modes";
// //
// jitterItem
//
this.jitterItem.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Jitter;
this.jitterItem.Name = "jitterItem";
this.jitterItem.Size = new System.Drawing.Size(152, 22);
this.jitterItem.Tag = "applyjitter";
this.jitterItem.Text = "Randomize";
this.jitterItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStrip // toolStrip
// //
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -81,27 +99,9 @@
this.jitterButton.Name = "jitterButton"; this.jitterButton.Name = "jitterButton";
this.jitterButton.Size = new System.Drawing.Size(23, 22); this.jitterButton.Size = new System.Drawing.Size(23, 22);
this.jitterButton.Tag = "applyjitter"; this.jitterButton.Tag = "applyjitter";
this.jitterButton.Text = "Apply Jitter"; this.jitterButton.Text = "Randomize";
this.jitterButton.Click += new System.EventHandler(this.InvokeTaggedAction); this.jitterButton.Click += new System.EventHandler(this.InvokeTaggedAction);
// //
// toolStripMenuItem1
//
this.toolStripMenuItem1.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Terrain;
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(215, 22);
this.toolStripMenuItem1.Tag = "importobjasterrain";
this.toolStripMenuItem1.Text = "Wavefront .obj as Terrain...";
this.toolStripMenuItem1.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// jitterItem
//
this.jitterItem.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Jitter;
this.jitterItem.Name = "jitterItem";
this.jitterItem.Size = new System.Drawing.Size(133, 22);
this.jitterItem.Tag = "applyjitter";
this.jitterItem.Text = "Apply Jitter";
this.jitterItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// MenusForm // MenusForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View file

@ -6,9 +6,9 @@ categories
applyjitter applyjitter
{ {
title = "Jitter"; title = "Randomize";
category = "transform"; category = "transform";
description = "Applies jitter effect to selection."; description = "Allows to apply a variety of randomized transformations to the selection.";
allowkeys = true; allowkeys = true;
allowmouse = false; allowmouse = false;
allowscroll = false; allowscroll = false;