Randomize Sectors form: added "Use vertex heights" check-boxes. When enabled and used on triangular sectors, it can be used to create a terrain-like look.

Updated ZDoom_DECORATE.cfg.
Updated documentation, rearranged contents a bit.
This commit is contained in:
MaxED 2014-10-28 14:35:59 +00:00
parent 064b790d1d
commit 5eba596a02
8 changed files with 277 additions and 75 deletions

View file

@ -20,7 +20,7 @@ keywords
{
#Include = "#Include";
//Monster AI
A_AlertMonsters = "A_AlertMonsters[(float maxrange[, int flags)]]";
A_AlertMonsters = "A_AlertMonsters[(float maxrange[, int flags])]";
A_Burst = "A_Burst(string classname)";
A_CentaurDefend = "A_CentaurDefend";
A_Chase = "A_Chase[(string meleestate[, string rangedstate[, int flags]])]";
@ -71,10 +71,10 @@ keywords
A_BasicAttack = "A_BasicAttack(int meleedamage, string meleesound, string missiletype, float missileheight)";
A_BulletAttack = "A_BulletAttack";
A_MonsterRail = "A_MonsterRail";
A_Explode = "A_Explode[(int explosiondamage[, int explosionradius[, bool hurtshooter[, bool alert[, int fulldamageradius[, int nails[, int naildamage]]]]]])]";
A_Explode = "A_Explode[(int explosiondamage = 128[, int explosionradius = 128[, int flags = XF_HURTSOURCE[, bool alert = false[, int fulldamageradius = 0[, int nails = 0[, int naildamage = 10[, string pufftype = 'BulletPuff']]]]]]])]";
A_RadiusThrust = "A_RadiusThrust(int force, int distance[, int flags[, int fullthrustdistance]])";
A_Detonate = "A_Detonate";
A_ThrowGrenade = "A_ThrowGrenade(string spawntype [float spawnheight[, float throwspeed_horz[, float throwspeed_vert[, bool useammo]]]])";
A_ThrowGrenade = "A_ThrowGrenade(string spawntype[, float spawnheight[, float throwspeed_horz[, float throwspeed_vert[, bool useammo]]]])";
//Freeze death functions
A_FreezeDeath = "A_FreezeDeath";
A_GenericFreezeDeath = "A_GenericFreezeDeath";
@ -156,7 +156,7 @@ keywords
A_NoBlocking = "A_NoBlocking";
A_NoGravity = "A_NoGravity";
A_QueueCorpse = "A_QueueCorpse";
A_RearrangePointers = "A_RearrangePointers(pointer target, pointer master, pointer tracer[, int flags])";
A_RearrangePointers = "A_RearrangePointers(pointer target, pointer master, pointer tracer, int flags)";
A_Respawn = "A_Respawn[(bool fog)]";
A_ScaleVelocity = "A_ScaleVelocity(float scale)";
A_ScreamAndUnblock = "A_ScreamAndUnblock";
@ -422,6 +422,8 @@ constants
MSF_DontHurt;
TF_TELEFRAG;
TF_RANDOMDECIDE;
XF_HURTSOURCE;
XF_NOTMISSILE;
//combo flags
Monster;
Projectile;

View file

@ -259,7 +259,7 @@
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Classic and Visual modes">
<param name="Name" value="New features in Classic and Visual modes">
<param name="Local" value="gzdb\features\features.html#allmodes">
</OBJECT>
<UL>
@ -291,17 +291,13 @@
<param name="Name" value="Tag Explorer plugin">
<param name="Local" value="gzdb\features\all_modes\tagexplorer.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Jitter command">
<param name="Local" value="gzdb\features\all_modes\jitter.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Image Browser">
<param name="Local" value="gzdb\features\all_modes\texture_browser.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Classic modes">
<param name="Name" value="New features in Classic modes">
<param name="Local" value="gzdb\features\features.html#classic">
</OBJECT>
<UL>
@ -309,10 +305,6 @@
<param name="Name" value="Draw Settings Panel">
<param name="Local" value="gzdb\features\classic_modes\drawsettingspanel.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Import Terrain mode">
<param name="Local" value="gzdb\features\classic_modes\mode_importterrain.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Custom linedef colors">
<param name="Local" value="gzdb\features\classic_modes\linedef_color_presets.html">
@ -321,6 +313,15 @@
<param name="Name" value="Enhanced rectangular selection">
<param name="Local" value="gzdb\features\classic_modes\selection.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="New features in Sectors mode">
<param name="Local" value="gzdb\features\features.html#sectors">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="New features in Linedefs mode">
<param name="Local" value="gzdb\features\features.html#linedefs">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Draw Rectangle mode">
<param name="Local" value="gzdb\features\classic_modes\mode_drawrect.html">
@ -337,25 +338,24 @@
<param name="Name" value="Draw Grid mode">
<param name="Local" value="gzdb\features\classic_modes\mode_drawgrid.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Randomize mode">
<param name="Local" value="gzdb\features\all_modes\jitter.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Bridge mode">
<param name="Local" value="gzdb\features\classic_modes\mode_drawbridge.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Import Terrain mode">
<param name="Local" value="gzdb\features\classic_modes\mode_importterrain.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Snap geometry mode">
<param name="Local" value="gzdb\features\classic_modes\mode_snapelements.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Sectors mode">
<param name="Local" value="gzdb\features\features.html#sectors">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Linedefs mode">
<param name="Local" value="gzdb\features\features.html#linedefs">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Things mode">
<param name="Name" value="New features in Things mode">
<param name="Local" value="gzdb\features\features.html#things">
</OBJECT>
<UL>
@ -369,7 +369,7 @@
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Vertices mode">
<param name="Name" value="New features in Vertices mode">
<param name="Local" value="gzdb\features\features.html#vertices">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
@ -394,6 +394,14 @@
<param name="Local" value="gzdb\features\visual_mode\autoalign_to_selection.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="New features in Map Analysis mode">
<param name="Local" value="gzdb\features\features.html#mapanalysis">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="New features in Find and Replace mode">
<param name="Local" value="gzdb\features\features.html#findreplace">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Custom Fields">
<param name="Local" value="gzdb\features\features.html#fields">
@ -404,14 +412,6 @@
<param name="Local" value="gzdb\features\custom_fields\newfieldtypes.html">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Map Analysis mode">
<param name="Local" value="gzdb\features\features.html#mapanalysis">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Find and Replace mode">
<param name="Local" value="gzdb\features\features.html#findreplace">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="(G)ZDoom features support">
<param name="Local" value="gzdb\features\features.html#formats">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View file

@ -82,7 +82,7 @@
</ul>
</li>
<li>
<h3><a name="scripting" id="allmodes"></a>Scripting:</h3>
<h3><a name="scripting" id="scripting"></a>Scripting:</h3>
<ul>
<li><a href="scripting/acs.html">Enhanced scripting workflow</a>.</li>
<li><span class="style1"><strong>[new]</strong></span> <a href="scripting/snippets.html">Code snippets.</a></li>

View file

@ -101,7 +101,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
"Thanks, Obama",
"The God Of Exceptions Demands MORE Exceptions!",
"Good. It's boring here anyway.",
"Shameful display!"
"Shameful display!",
"It's CRASHENING!",
};
this.Text = titles[new Random().Next(0, titles.Length - 1)];
}

View file

@ -42,6 +42,8 @@
this.positionJitterAmmount = new IntControl();
this.floorHeightAmmount = new IntControl();
this.ceilingHeightAmmount = new IntControl();
this.cbUseFloorVertexHeights = new System.Windows.Forms.CheckBox();
this.cbUseCeilingVertexHeights = new System.Windows.Forms.CheckBox();
this.gbUpperTexture.SuspendLayout();
this.gbLowerTexture.SuspendLayout();
this.SuspendLayout();
@ -50,7 +52,7 @@
//
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.bCancel.Location = new System.Drawing.Point(195, 324);
this.bCancel.Location = new System.Drawing.Point(195, 368);
this.bCancel.Name = "bCancel";
this.bCancel.Size = new System.Drawing.Size(75, 25);
this.bCancel.TabIndex = 10;
@ -61,7 +63,7 @@
// bApply
//
this.bApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bApply.Location = new System.Drawing.Point(276, 324);
this.bApply.Location = new System.Drawing.Point(276, 368);
this.bApply.Name = "bApply";
this.bApply.Size = new System.Drawing.Size(95, 25);
this.bApply.TabIndex = 9;
@ -95,7 +97,7 @@
//
this.bUpdateFloorHeight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bUpdateFloorHeight.Image = global::CodeImp.DoomBuilder.BuilderEffects.Properties.Resources.Update;
this.bUpdateFloorHeight.Location = new System.Drawing.Point(347, 74);
this.bUpdateFloorHeight.Location = new System.Drawing.Point(347, 93);
this.bUpdateFloorHeight.Name = "bUpdateFloorHeight";
this.bUpdateFloorHeight.Size = new System.Drawing.Size(23, 25);
this.bUpdateFloorHeight.TabIndex = 16;
@ -104,9 +106,10 @@
//
// gbUpperTexture
//
this.gbUpperTexture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.gbUpperTexture.Controls.Add(this.textureUpper);
this.gbUpperTexture.Controls.Add(this.cbPegTop);
this.gbUpperTexture.Location = new System.Drawing.Point(12, 159);
this.gbUpperTexture.Location = new System.Drawing.Point(12, 203);
this.gbUpperTexture.Name = "gbUpperTexture";
this.gbUpperTexture.Size = new System.Drawing.Size(176, 159);
this.gbUpperTexture.TabIndex = 24;
@ -159,13 +162,14 @@
//
// cbUpperTexStyle
//
this.cbUpperTexStyle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbUpperTexStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbUpperTexStyle.FormattingEnabled = true;
this.cbUpperTexStyle.Items.AddRange(new object[] {
"Don\'t change upper texture",
"Use ceiling texture",
"Pick upper texture"});
this.cbUpperTexStyle.Location = new System.Drawing.Point(12, 131);
this.cbUpperTexStyle.Location = new System.Drawing.Point(12, 175);
this.cbUpperTexStyle.Name = "cbUpperTexStyle";
this.cbUpperTexStyle.Size = new System.Drawing.Size(176, 22);
this.cbUpperTexStyle.TabIndex = 26;
@ -173,13 +177,14 @@
//
// cbLowerTexStyle
//
this.cbLowerTexStyle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbLowerTexStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbLowerTexStyle.FormattingEnabled = true;
this.cbLowerTexStyle.Items.AddRange(new object[] {
"Don\'t change lower texture",
"Use floor texture",
"Pick lower texture"});
this.cbLowerTexStyle.Location = new System.Drawing.Point(195, 131);
this.cbLowerTexStyle.Location = new System.Drawing.Point(195, 175);
this.cbLowerTexStyle.Name = "cbLowerTexStyle";
this.cbLowerTexStyle.Size = new System.Drawing.Size(175, 22);
this.cbLowerTexStyle.TabIndex = 27;
@ -187,9 +192,10 @@
//
// gbLowerTexture
//
this.gbLowerTexture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.gbLowerTexture.Controls.Add(this.textureLower);
this.gbLowerTexture.Controls.Add(this.cbPegBottom);
this.gbLowerTexture.Location = new System.Drawing.Point(195, 159);
this.gbLowerTexture.Location = new System.Drawing.Point(195, 203);
this.gbLowerTexture.Name = "gbLowerTexture";
this.gbLowerTexture.Size = new System.Drawing.Size(176, 159);
this.gbLowerTexture.TabIndex = 29;
@ -198,8 +204,9 @@
//
// cbKeepExistingTextures
//
this.cbKeepExistingTextures.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbKeepExistingTextures.AutoSize = true;
this.cbKeepExistingTextures.Location = new System.Drawing.Point(12, 107);
this.cbKeepExistingTextures.Location = new System.Drawing.Point(12, 151);
this.cbKeepExistingTextures.Name = "cbKeepExistingTextures";
this.cbKeepExistingTextures.Size = new System.Drawing.Size(211, 18);
this.cbKeepExistingTextures.TabIndex = 30;
@ -207,6 +214,17 @@
this.cbKeepExistingTextures.UseVisualStyleBackColor = true;
this.cbKeepExistingTextures.CheckedChanged += new System.EventHandler(this.cbKeepExistingTextures_CheckedChanged);
//
// cbUseFloorVertexHeights
//
this.cbUseFloorVertexHeights.AutoSize = true;
this.cbUseFloorVertexHeights.Location = new System.Drawing.Point(108, 119);
this.cbUseFloorVertexHeights.Name = "cbUseFloorVertexHeights";
this.cbUseFloorVertexHeights.Size = new System.Drawing.Size(117, 18);
this.cbUseFloorVertexHeights.TabIndex = 31;
this.cbUseFloorVertexHeights.Text = "Use vertex heights";
this.cbUseFloorVertexHeights.UseVisualStyleBackColor = true;
this.cbUseFloorVertexHeights.CheckedChanged += new System.EventHandler(this.cbUseFloorVertexHeights_CheckedChanged);
//
// positionJitterAmmount
//
this.positionJitterAmmount.AllowNegative = false;
@ -230,7 +248,7 @@
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.Label = "Floor height:";
this.floorHeightAmmount.Location = new System.Drawing.Point(12, 75);
this.floorHeightAmmount.Location = new System.Drawing.Point(12, 94);
this.floorHeightAmmount.Maximum = 100;
this.floorHeightAmmount.Minimum = 0;
this.floorHeightAmmount.Name = "floorHeightAmmount";
@ -255,13 +273,26 @@
this.ceilingHeightAmmount.Value = 0;
this.ceilingHeightAmmount.OnValueChanging += new System.EventHandler(this.ceilingHeightAmmount_OnValueChanging);
//
// cbUseCeilingVertexHeights
//
this.cbUseCeilingVertexHeights.AutoSize = true;
this.cbUseCeilingVertexHeights.Location = new System.Drawing.Point(108, 70);
this.cbUseCeilingVertexHeights.Name = "cbUseCeilingVertexHeights";
this.cbUseCeilingVertexHeights.Size = new System.Drawing.Size(117, 18);
this.cbUseCeilingVertexHeights.TabIndex = 32;
this.cbUseCeilingVertexHeights.Text = "Use vertex heights";
this.cbUseCeilingVertexHeights.UseVisualStyleBackColor = true;
this.cbUseCeilingVertexHeights.CheckedChanged += new System.EventHandler(this.cbUseCeilingVertexHeights_CheckedChanged);
//
// JitterSectorsForm
//
this.AcceptButton = this.bApply;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.bCancel;
this.ClientSize = new System.Drawing.Size(382, 352);
this.ClientSize = new System.Drawing.Size(382, 396);
this.Controls.Add(this.cbUseCeilingVertexHeights);
this.Controls.Add(this.cbUseFloorVertexHeights);
this.Controls.Add(this.cbKeepExistingTextures);
this.Controls.Add(this.gbLowerTexture);
this.Controls.Add(this.cbLowerTexStyle);
@ -280,6 +311,7 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "JitterSectorsForm";
this.Opacity = 1;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
@ -314,5 +346,7 @@
private System.Windows.Forms.ComboBox cbLowerTexStyle;
private System.Windows.Forms.GroupBox gbLowerTexture;
private System.Windows.Forms.CheckBox cbKeepExistingTextures;
private System.Windows.Forms.CheckBox cbUseFloorVertexHeights;
private System.Windows.Forms.CheckBox cbUseCeilingVertexHeights;
}
}

View file

@ -12,7 +12,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
{
private readonly string editingModeName;
private readonly List<VisualSector> visualSectors;
private readonly VertexData[] vertexData;
private readonly TranslationOffsetVertexData[] vertexData;
private readonly List<SectorData> sectorData;
private readonly List<SidedefData> sidedefData;
private readonly int MaxSafeDistance;
@ -20,8 +20,10 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//settings
private static bool keepExistingSideTextures = true;
private static bool useFloorVertexHeights;
private static bool useCeilingVertexHeights;
private struct VertexData
private struct TranslationOffsetVertexData
{
public Vertex Vertex;
public Vector2D InitialPosition;
@ -29,14 +31,27 @@ namespace CodeImp.DoomBuilder.BuilderEffects
public float JitterAngle;
}
private struct HeightOffsetVertexData
{
public Vertex Vertex;
public float InitialFloorHeight;
public float InitialCeilingHeight;
public float ZFloor;
public float ZCeiling;
public float JitterFloorHeight;
public float JitterCeilingHeight;
}
private struct SectorData
{
public Sector Sector;
public HeightOffsetVertexData[] Verts;
public int InitialCeilingHeight;
public int InitialFloorHeight;
public int SafeDistance;
public float JitterFloorHeight;
public float JitterCeilingHeight;
public bool Triangular;
}
private struct SidedefData
@ -134,10 +149,10 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//store intial properties
//process verts...
Dictionary<Vertex, VertexData> data = new Dictionary<Vertex, VertexData>();
Dictionary<Vertex, TranslationOffsetVertexData> data = new Dictionary<Vertex, TranslationOffsetVertexData>();
foreach(Vertex v in verts) {
VertexData vd = new VertexData();
TranslationOffsetVertexData vd = new TranslationOffsetVertexData();
vd.Vertex = v;
vd.InitialPosition = v.Position;
data.Add(v, vd);
@ -169,12 +184,12 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//check SafeDistance of closest line
if(data.ContainsKey(closestLine.Start) && data[closestLine.Start].SafeDistance > closestLineDistance) {
VertexData vd = data[closestLine.Start];
TranslationOffsetVertexData vd = data[closestLine.Start];
vd.SafeDistance = (int)Math.Floor(closestLineDistance);
data[closestLine.Start] = vd;
}
if(data.ContainsKey(closestLine.End) && data[closestLine.End].SafeDistance > closestLineDistance) {
VertexData vd = data[closestLine.End];
TranslationOffsetVertexData vd = data[closestLine.End];
vd.SafeDistance = (int)Math.Floor(closestLineDistance);
data[closestLine.End] = vd;
}
@ -182,17 +197,17 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//save SafeDistance
int dist = (int)Math.Floor(closestLineDistance);
if(data[v].SafeDistance == 0 || data[v].SafeDistance > dist) {
VertexData vd = data[v];
TranslationOffsetVertexData vd = data[v];
vd.SafeDistance = dist;
data[v] = vd;
}
}
//store properties
vertexData = new VertexData[data.Values.Count];
vertexData = new TranslationOffsetVertexData[data.Values.Count];
data.Values.CopyTo(vertexData, 0);
for(int i = 0; i < vertexData.Length; i++) {
for(int i = 0; i < data.Count; i++) {
if(vertexData[i].SafeDistance > 0)
vertexData[i].SafeDistance /= 2;
if(MaxSafeDistance < vertexData[i].SafeDistance)
@ -209,6 +224,23 @@ namespace CodeImp.DoomBuilder.BuilderEffects
sd.Sector = s;
sd.InitialCeilingHeight = s.CeilHeight;
sd.InitialFloorHeight = s.FloorHeight;
sd.Triangular = General.Map.UDMF && s.Sidedefs.Count == 3;
if (sd.Triangular)
{
Vertex[] sectorverts = GetSectorVerts(s);
sd.Verts = new HeightOffsetVertexData[sectorverts.Length];
for(int i = 0; i < sectorverts.Length; i++)
{
HeightOffsetVertexData vd = new HeightOffsetVertexData();
vd.Vertex = sectorverts[i];
vd.ZFloor = sectorverts[i].ZFloor;
vd.ZCeiling = sectorverts[i].ZCeiling;
vd.InitialFloorHeight = float.IsNaN(vd.ZFloor) ? GetHighestFloor(sectorverts[i]) : sectorverts[i].ZFloor;
vd.InitialCeilingHeight = float.IsNaN(vd.ZCeiling) ? GetLowestCeiling(sectorverts[i]) : sectorverts[i].ZCeiling;
sd.Verts[i] = vd;
}
}
sd.SafeDistance = (s.CeilHeight - s.FloorHeight) / 2;
if(sd.SafeDistance > MaxSafeHeightDistance) MaxSafeHeightDistance = sd.SafeDistance;
sectorData.Add(sd);
@ -239,6 +271,18 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//set editing settings
cbKeepExistingTextures.Checked = keepExistingSideTextures;
if (General.Map.UDMF) {
cbUseFloorVertexHeights.Checked = useFloorVertexHeights;
cbUseCeilingVertexHeights.Checked = useCeilingVertexHeights;
} else {
useFloorVertexHeights = false;
cbUseFloorVertexHeights.Checked = false;
cbUseFloorVertexHeights.Enabled = false;
useCeilingVertexHeights = false;
cbUseCeilingVertexHeights.Checked = false;
cbUseCeilingVertexHeights.Enabled = false;
}
//texture pickers
textureLower.Initialize();
@ -260,6 +304,56 @@ namespace CodeImp.DoomBuilder.BuilderEffects
General.Map.UndoRedo.CreateUndo("Randomize " + sectors.Count + (sectors.Count > 1 ? " sectors" : " sector"));
}
private float GetLowestCeiling(Vertex v) {
if (v.Linedefs.Count == 0) return float.NaN;
List<Sector> sectors = GetSectors(v);
if (sectors.Count == 0) return float.NaN;
float target = sectors[0].CeilHeight;
for(int i = 1; i < sectors.Count; i++) {
if(target > sectors[i].CeilHeight && sectors[i].Sidedefs.Count == 3)
target = sectors[i].CeilHeight;
}
return target;
}
private float GetHighestFloor(Vertex v) {
if(v.Linedefs.Count == 0) return float.NaN;
List<Sector> sectors = GetSectors(v);
if(sectors.Count == 0) return float.NaN;
float target = sectors[0].FloorHeight;
for(int i = 1; i < sectors.Count; i++) {
if(target < sectors[i].FloorHeight && sectors[i].Sidedefs.Count == 3)
target = sectors[i].FloorHeight;
}
return target;
}
private List<Sector> GetSectors(Vertex v) {
List<Sector> result = new List<Sector>();
foreach (Linedef l in v.Linedefs) {
if(l.Front != null && l.Front.Sector != null && !result.Contains(l.Front.Sector))
result.Add(l.Front.Sector);
if(l.Back != null && l.Back.Sector != null && !result.Contains(l.Back.Sector))
result.Add(l.Back.Sector);
}
return result;
}
private Vertex[] GetSectorVerts(Sector s) {
List<Vertex> result = new List<Vertex>();
foreach (Sidedef side in s.Sidedefs) {
if(side.Line == null) continue;
if(!result.Contains(side.Line.Start)) result.Add(side.Line.Start);
if(!result.Contains(side.Line.End)) result.Add(side.Line.End);
}
return result.ToArray();
}
//utility
private void applyTranslationJitter(int ammount) {
int curAmmount;
@ -284,8 +378,15 @@ namespace CodeImp.DoomBuilder.BuilderEffects
for(int i = 0; i < sectorData.Count; i++) {
curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount;
if (sectorData[i].Triangular && useCeilingVertexHeights) {
foreach(HeightOffsetVertexData vd in sectorData[i].Verts) {
vd.Vertex.ZCeiling = vd.InitialCeilingHeight + (float)Math.Floor(curAmmount * vd.JitterCeilingHeight);
}
} else {
sectorData[i].Sector.CeilHeight = sectorData[i].InitialCeilingHeight - (int) Math.Floor(curAmmount * sectorData[i].JitterCeilingHeight);
}
}
//update view
if(editingModeName == "BaseVisualMode") {
@ -302,8 +403,15 @@ namespace CodeImp.DoomBuilder.BuilderEffects
for(int i = 0; i < sectorData.Count; i++) {
curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount;
if (sectorData[i].Triangular && useFloorVertexHeights) {
foreach(HeightOffsetVertexData vd in sectorData[i].Verts) {
vd.Vertex.ZFloor = vd.InitialFloorHeight + (float)Math.Floor(curAmmount * vd.JitterFloorHeight);
}
} else {
sectorData[i].Sector.FloorHeight = sectorData[i].InitialFloorHeight + (int) Math.Floor(curAmmount * sectorData[i].JitterFloorHeight);
}
}
//update view
if(editingModeName == "BaseVisualMode") {
@ -406,7 +514,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
//jitter generation
private void updateAngles() {
for(int i = 0; i < vertexData.Length; i++) {
VertexData vd = vertexData[i];
TranslationOffsetVertexData vd = vertexData[i];
vd.JitterAngle = (float)(General.Random(0, 359) * Math.PI / 180f);
vertexData[i] = vd;
}
@ -415,6 +523,15 @@ namespace CodeImp.DoomBuilder.BuilderEffects
private void updateFloorHeights() {
for(int i = 0; i < sectorData.Count; i++) {
SectorData sd = sectorData[i];
if (sd.Triangular) {
for(int c = 0; c < 3; c++) {
HeightOffsetVertexData vd = sd.Verts[c];
vd.JitterFloorHeight = General.Random(-100, 100) / 100f;
sd.Verts[c] = vd;
}
}
sd.JitterFloorHeight = General.Random(-100, 100) / 100f;
sectorData[i] = sd;
}
@ -423,6 +540,16 @@ namespace CodeImp.DoomBuilder.BuilderEffects
private void updateCeilingHeights() {
for(int i = 0; i < sectorData.Count; i++) {
SectorData sd = sectorData[i];
if(sd.Triangular) {
for(int c = 0; c < 3; c++)
{
HeightOffsetVertexData vd = sd.Verts[c];
vd.JitterCeilingHeight = General.Random(-100, 100) / 100f;
sd.Verts[c] = vd;
}
}
sd.JitterCeilingHeight = General.Random(-100, 100) / 100f;
sectorData[i] = sd;
}
@ -493,6 +620,44 @@ namespace CodeImp.DoomBuilder.BuilderEffects
}
}
private void cbUseFloorVertexHeights_CheckedChanged(object sender, EventArgs e)
{
useFloorVertexHeights = cbUseFloorVertexHeights.Checked;
//Reset values?
if (!useFloorVertexHeights || floorHeightAmmount.Value == 0)
{
foreach (SectorData data in sectorData)
{
if(!data.Triangular) continue;
foreach(HeightOffsetVertexData vd in data.Verts) vd.Vertex.ZFloor = vd.ZFloor;
}
}
//update changes
applyFloorHeightJitter(floorHeightAmmount.Value);
updateTextureSelectors();
}
private void cbUseCeilingVertexHeights_CheckedChanged(object sender, EventArgs e)
{
useCeilingVertexHeights = cbUseCeilingVertexHeights.Checked;
//Reset values?
if(!useCeilingVertexHeights || ceilingHeightAmmount.Value == 0)
{
foreach(SectorData data in sectorData)
{
if(!data.Triangular) continue;
foreach(HeightOffsetVertexData vd in data.Verts) vd.Vertex.ZCeiling = vd.ZCeiling;
}
}
//update changes
applyCeilingHeightJitter(ceilingHeightAmmount.Value);
updateTextureSelectors();
}
//update buttons
private void bUpdateTranslation_Click(object sender, EventArgs e) {
updateAngles();

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private float lastpicktime;
private bool locktarget;
private bool useSelectionFromClassicMode;//mxd
private Timer selectioninfoupdatetimer; //mxd
private readonly Timer selectioninfoupdatetimer; //mxd
// This keeps extra element info
private Dictionary<Sector, SectorData> sectordata;