diff --git a/Build/Scripting/ZDoom_DECORATE.cfg b/Build/Scripting/ZDoom_DECORATE.cfg index f5a69ce5..ce3e1cf0 100644 --- a/Build/Scripting/ZDoom_DECORATE.cfg +++ b/Build/Scripting/ZDoom_DECORATE.cfg @@ -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; diff --git a/Help/Contents.hhc b/Help/Contents.hhc index 0135999d..e0a89112 100644 --- a/Help/Contents.hhc +++ b/Help/Contents.hhc @@ -259,7 +259,7 @@
  • - +
  • - +
  • - +
  • - +
  • - + + + +
  • + + + +
  • + + + +
  • + + + +
  • + + + +
  • + + + +
  • + + + +
  • + + + +
  • +
  • - +
  • @@ -394,6 +394,14 @@ +
  • + + + +
  • + + +
  • @@ -404,14 +412,6 @@ -
  • - - - -
  • - - -
  • diff --git a/Help/gzdb/features/all_modes/jitter_sectors.jpg b/Help/gzdb/features/all_modes/jitter_sectors.jpg index 41c1d5f0..05f816c0 100644 Binary files a/Help/gzdb/features/all_modes/jitter_sectors.jpg and b/Help/gzdb/features/all_modes/jitter_sectors.jpg differ diff --git a/Help/gzdb/features/features.html b/Help/gzdb/features/features.html index 3071f316..8c54381c 100644 --- a/Help/gzdb/features/features.html +++ b/Help/gzdb/features/features.html @@ -82,7 +82,7 @@
  • -

    Scripting:

    +

    Scripting:

    • Enhanced scripting workflow.
    • [new] Code snippets.
    • diff --git a/Source/Core/GZBuilder/Windows/ExceptionDialog.cs b/Source/Core/GZBuilder/Windows/ExceptionDialog.cs index 59e226e0..181804ed 100644 --- a/Source/Core/GZBuilder/Windows/ExceptionDialog.cs +++ b/Source/Core/GZBuilder/Windows/ExceptionDialog.cs @@ -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)]; } diff --git a/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.Designer.cs b/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.Designer.cs index c9134355..087b6d4e 100644 --- a/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.Designer.cs +++ b/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs b/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs index b5aed860..95ea5a82 100644 --- a/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs +++ b/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs @@ -12,7 +12,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects { private readonly string editingModeName; private readonly List visualSectors; - private readonly VertexData[] vertexData; + private readonly TranslationOffsetVertexData[] vertexData; private readonly List sectorData; private readonly List 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 data = new Dictionary(); + Dictionary data = new Dictionary(); 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 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 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 GetSectors(Vertex v) { + List result = new List(); + 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 result = new List(); + 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,7 +378,14 @@ namespace CodeImp.DoomBuilder.BuilderEffects for(int i = 0; i < sectorData.Count; i++) { curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount; - sectorData[i].Sector.CeilHeight = sectorData[i].InitialCeilingHeight - (int)Math.Floor(curAmmount * sectorData[i].JitterCeilingHeight); + + 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 @@ -302,7 +403,14 @@ namespace CodeImp.DoomBuilder.BuilderEffects for(int i = 0; i < sectorData.Count; i++) { curAmmount = ammount > sectorData[i].SafeDistance ? sectorData[i].SafeDistance : ammount; - sectorData[i].Sector.FloorHeight = sectorData[i].InitialFloorHeight + (int)Math.Floor(curAmmount * sectorData[i].JitterFloorHeight); + + 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 @@ -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(); diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index ae57360b..fa368271 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -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 sectordata;