Fixed, Visual mode: GLDEFS glow color was incorrectly interpolated on sidedefs.

Fixed, Visual mode: in some cases GLDEFS glow effect was not updated after changing floor/ceiling texture.
Fixed, Draw Rectangle and Draw Ellipse modes: in some cases pressing "Reset" button did not update the shape preview.
Fixed, DB2 bug: sector geometry was not updated after undoing "Flip Sidedefs" action.
This commit is contained in:
MaxED 2016-03-08 20:37:44 +00:00 committed by spherallic
parent a6b70e54a0
commit f048600bbf
9 changed files with 63 additions and 53 deletions

View file

@ -1116,8 +1116,12 @@ namespace CodeImp.DoomBuilder.Editing
Sidedef sd = (sindex >= 0) ? General.Map.Map.GetSidedefByIndex(sindex) : null; Sidedef sd = (sindex >= 0) ? General.Map.Map.GetSidedefByIndex(sindex) : null;
l.AttachFront(sd); l.AttachFront(sd);
l.Marked = true; l.Marked = true;
if (l.Tag != 0) linedeftags.Add(l.Tag); if (l.Tag != 0) linedeftags.Add(l.Tag);
if (sd != null) sd.Marked = true; if (sd != null)
{
sd.Marked = true;
if(sd.Sector != null) sd.Sector.UpdateNeeded = true; //mxd. Sector needs to be updated as well...
}
geometrychanged = true; geometrychanged = true;
} }
@ -1141,8 +1145,12 @@ namespace CodeImp.DoomBuilder.Editing
Sidedef sd = (sindex >= 0) ? General.Map.Map.GetSidedefByIndex(sindex) : null; Sidedef sd = (sindex >= 0) ? General.Map.Map.GetSidedefByIndex(sindex) : null;
l.AttachBack(sd); l.AttachBack(sd);
l.Marked = true; l.Marked = true;
if (l.Tag != 0) linedeftags.Add(l.Tag); if (l.Tag != 0) linedeftags.Add(l.Tag);
if (sd != null) sd.Marked = true; if (sd != null)
{
sd.Marked = true;
if(sd.Sector != null) sd.Sector.UpdateNeeded = true; //mxd. Sector needs to be updated as well...
}
geometrychanged = true; geometrychanged = true;
} }

View file

@ -2236,7 +2236,7 @@ namespace CodeImp.DoomBuilder.Geometry
/// <summary>Flips sector linedefs so they all face either inward or outward.</summary> /// <summary>Flips sector linedefs so they all face either inward or outward.</summary>
public static void FlipSectorLinedefs(ICollection<Sector> sectors, bool selectedlinesonly) public static void FlipSectorLinedefs(ICollection<Sector> sectors, bool selectedlinesonly)
{ {
Dictionary<Linedef, bool> processed = new Dictionary<Linedef, bool>(); HashSet<Linedef> processed = new HashSet<Linedef>();
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
@ -2248,7 +2248,7 @@ namespace CodeImp.DoomBuilder.Geometry
//sort lines //sort lines
foreach(Sidedef side in s.Sidedefs) foreach(Sidedef side in s.Sidedefs)
{ {
if(processed.ContainsKey(side.Line)) continue; if(processed.Contains(side.Line)) continue;
if(selectedlinesonly && !side.Line.Selected) if(selectedlinesonly && !side.Line.Selected)
{ {
if(side == side.Line.Front) unselectedfrontlines++; if(side == side.Line.Front) unselectedfrontlines++;
@ -2261,7 +2261,7 @@ namespace CodeImp.DoomBuilder.Geometry
else else
backlines.Add(side.Line); backlines.Add(side.Line);
processed.Add(side.Line, false); processed.Add(side.Line);
} }
//flip lines //flip lines

View file

@ -168,8 +168,8 @@ namespace CodeImp.DoomBuilder.Rendering
device.SetRenderState(RenderState.NormalizeNormals, false); device.SetRenderState(RenderState.NormalizeNormals, false);
device.SetRenderState(RenderState.PointSpriteEnable, false); device.SetRenderState(RenderState.PointSpriteEnable, false);
device.SetRenderState(RenderState.RangeFogEnable, false); device.SetRenderState(RenderState.RangeFogEnable, false);
device.SetRenderState(RenderState.ShadeMode, ShadeMode.Flat); //mxd device.SetRenderState(RenderState.ShadeMode, ShadeMode.Gouraud);
device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha); device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
device.SetRenderState(RenderState.SpecularEnable, false); device.SetRenderState(RenderState.SpecularEnable, false);
device.SetRenderState(RenderState.StencilEnable, false); device.SetRenderState(RenderState.StencilEnable, false);
device.SetRenderState(RenderState.TextureFactor, -1); device.SetRenderState(RenderState.TextureFactor, -1);

View file

@ -60,11 +60,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void reset_Click(object sender, EventArgs e) private void reset_Click(object sender, EventArgs e)
{ {
// Reset values
blockevents = true; blockevents = true;
spikiness.Value = 0; spikiness.Value = 0;
angle.Value = 0; angle.Value = 0;
blockevents = false;
subdivs.Value = 6; subdivs.Value = 6;
blockevents = false;
// Dispatch event
OnValueChanged(this, EventArgs.Empty);
} }
private void continuousdrawing_CheckedChanged(object sender, EventArgs e) private void continuousdrawing_CheckedChanged(object sender, EventArgs e)

View file

@ -54,10 +54,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void reset_Click(object sender, EventArgs e) private void reset_Click(object sender, EventArgs e)
{ {
// Reset values
blockevents = true; blockevents = true;
radius.Value = 0; radius.Value = 0;
blockevents = false;
subdivs.Value = 0; subdivs.Value = 0;
blockevents = false;
// Dispatch event
OnValueChanged(this, EventArgs.Empty);
} }
private void continuousdrawing_CheckedChanged(object sender, EventArgs e) private void continuousdrawing_CheckedChanged(object sender, EventArgs e)

View file

@ -263,9 +263,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.autodrawonedit.AutoSize = true; this.autodrawonedit.AutoSize = true;
this.autodrawonedit.Location = new System.Drawing.Point(13, 24); this.autodrawonedit.Location = new System.Drawing.Point(13, 24);
this.autodrawonedit.Name = "autodrawonedit"; this.autodrawonedit.Name = "autodrawonedit";
this.autodrawonedit.Size = new System.Drawing.Size(346, 17); this.autodrawonedit.Size = new System.Drawing.Size(353, 30);
this.autodrawonedit.TabIndex = 11; this.autodrawonedit.TabIndex = 11;
this.autodrawonedit.Text = "Start drawing when Edit pressed over empty space in Classic modes"; this.autodrawonedit.Text = "Start drawing when Edit pressed over empty space in Classic modes\r\nInsert new thi" +
"ng when Edit pressed over empty space in Things mode";
this.autodrawonedit.UseVisualStyleBackColor = true; this.autodrawonedit.UseVisualStyleBackColor = true;
// //
// syncSelection // syncSelection
@ -331,7 +332,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// editnewthing // editnewthing
// //
this.editnewthing.AutoSize = true; this.editnewthing.AutoSize = true;
this.editnewthing.Location = new System.Drawing.Point(13, 49); this.editnewthing.Location = new System.Drawing.Point(13, 62);
this.editnewthing.Name = "editnewthing"; this.editnewthing.Name = "editnewthing";
this.editnewthing.Size = new System.Drawing.Size(248, 17); this.editnewthing.Size = new System.Drawing.Size(248, 17);
this.editnewthing.TabIndex = 1; this.editnewthing.TabIndex = 1;
@ -341,7 +342,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// editnewsector // editnewsector
// //
this.editnewsector.AutoSize = true; this.editnewsector.AutoSize = true;
this.editnewsector.Location = new System.Drawing.Point(13, 74); this.editnewsector.Location = new System.Drawing.Point(13, 87);
this.editnewsector.Name = "editnewsector"; this.editnewsector.Name = "editnewsector";
this.editnewsector.Size = new System.Drawing.Size(258, 17); this.editnewsector.Size = new System.Drawing.Size(258, 17);
this.editnewsector.TabIndex = 2; this.editnewsector.TabIndex = 2;
@ -351,7 +352,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// additiveselect // additiveselect
// //
this.additiveselect.AutoSize = true; this.additiveselect.AutoSize = true;
this.additiveselect.Location = new System.Drawing.Point(13, 99); this.additiveselect.Location = new System.Drawing.Point(13, 112);
this.additiveselect.Name = "additiveselect"; this.additiveselect.Name = "additiveselect";
this.additiveselect.Size = new System.Drawing.Size(205, 17); this.additiveselect.Size = new System.Drawing.Size(205, 17);
this.additiveselect.TabIndex = 3; this.additiveselect.TabIndex = 3;

View file

@ -3030,7 +3030,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.SetCrosshairBusy(true); renderer.SetCrosshairBusy(true);
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
GetTargetEventReceiver(false).OnSelectTexture(); GetTargetEventReceiver(false).OnSelectTexture();
UpdateChangedObjects();
RebuildElementData(); //mxd. Extrafloors or Glow effects may've been changed RebuildElementData(); //mxd. Extrafloors or Glow effects may've been changed
renderer.SetCrosshairBusy(false); renderer.SetCrosshairBusy(false);
PostAction(); PostAction();

View file

@ -369,27 +369,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(BuilderPlug.Me.CopiedFlat != null) if(BuilderPlug.Me.CopiedFlat != null)
{ {
mode.CreateUndo("Paste ceiling '" + BuilderPlug.Me.CopiedFlat + "'"); mode.CreateUndo("Paste ceiling \"" + BuilderPlug.Me.CopiedFlat + "\"");
mode.SetActionResult("Pasted flat '" + BuilderPlug.Me.CopiedFlat + "' on ceiling."); mode.SetActionResult("Pasted flat \"" + BuilderPlug.Me.CopiedFlat + "\" on ceiling.");
//mxd. Glow effect may require SectorData and geometry update
bool prevtextureglows = General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongCeilTexture);
SetTexture(BuilderPlug.Me.CopiedFlat); SetTexture(BuilderPlug.Me.CopiedFlat);
//mxd. Glow effect may require SectorData and geometry update
if(prevtextureglows && !General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongCeilTexture))
{
SectorData sd = mode.GetSectorData(level.sector);
sd.UpdateForced();
if(mode.VisualSectorExists(level.sector))
{
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
vs.UpdateSectorGeometry(false);
}
}
//mxd. 3D floors may need updating... //mxd. 3D floors may need updating...
OnTextureChanged(); OnTextureChanged();
} }
@ -591,7 +575,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This changes the texture // This changes the texture
protected override void SetTexture(string texturename) protected override void SetTexture(string texturename)
{ {
//mxd. Glow effect may require SectorData and geometry update
bool prevtextureglows = General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongCeilTexture);
// Set new texture
level.sector.SetCeilTexture(texturename); level.sector.SetCeilTexture(texturename);
//mxd. Glow effect may require SectorData and geometry update
if(prevtextureglows
&& !General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongCeilTexture)
&& mode.VisualSectorExists(level.sector))
{
((BaseVisualSector)mode.GetVisualSector(level.sector)).Changed = true;
}
General.Map.Data.UpdateUsedTextures(); General.Map.Data.UpdateUsedTextures();
} }

View file

@ -368,27 +368,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(BuilderPlug.Me.CopiedFlat != null) if(BuilderPlug.Me.CopiedFlat != null)
{ {
mode.CreateUndo("Paste floor '" + BuilderPlug.Me.CopiedFlat + "'"); mode.CreateUndo("Paste floor \"" + BuilderPlug.Me.CopiedFlat + "\"");
mode.SetActionResult("Pasted flat '" + BuilderPlug.Me.CopiedFlat + "' on floor."); mode.SetActionResult("Pasted flat \"" + BuilderPlug.Me.CopiedFlat + "\" on floor.");
//mxd. Glow effect may require SectorData and geometry update
bool prevtextureglows = General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongFloorTexture);
SetTexture(BuilderPlug.Me.CopiedFlat); SetTexture(BuilderPlug.Me.CopiedFlat);
//mxd. Glow effect may require SectorData and geometry update
if(prevtextureglows && !General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongFloorTexture))
{
SectorData sd = mode.GetSectorData(level.sector);
sd.UpdateForced();
if(mode.VisualSectorExists(level.sector))
{
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
vs.UpdateSectorGeometry(false);
}
}
//mxd. 3D floors may need updating... //mxd. 3D floors may need updating...
OnTextureChanged(); OnTextureChanged();
} }
@ -562,7 +546,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This changes the texture // This changes the texture
protected override void SetTexture(string texturename) protected override void SetTexture(string texturename)
{ {
//mxd. Glow effect may require SectorData and geometry update
bool prevtextureglows = General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongFloorTexture);
// Set new texture
level.sector.SetFloorTexture(texturename); level.sector.SetFloorTexture(texturename);
//mxd. Glow effect may require SectorData and geometry update
if(prevtextureglows
&& !General.Map.Data.GlowingFlats.ContainsKey(Sector.Sector.LongFloorTexture)
&& mode.VisualSectorExists(level.sector))
{
((BaseVisualSector)mode.GetVisualSector(level.sector)).Changed = true;
}
General.Map.Data.UpdateUsedTextures(); General.Map.Data.UpdateUsedTextures();
} }