Fixed, Script Editor: resources navigator was always loading the first WAD lump with matching name when trying to open any of several WAD lumps with matching names.

Reverted, Visual mode: looks like all additional cases of displaying sky hack added in r2755 were actually undefined engine behaviors, not the "proper" shy hack... Reverted implementation to the wiki definition of the sky hack.
This commit is contained in:
MaxED 2016-11-30 20:12:32 +00:00
parent 019e26f1a2
commit a31c6b6652
11 changed files with 90 additions and 147 deletions

View file

@ -994,7 +994,7 @@ namespace CodeImp.DoomBuilder.Controls
if(!(tab is ScriptResourceDocumentTab)) continue;
ScriptResourceDocumentTab restab = (ScriptResourceDocumentTab)tab;
if(restab.Filename == resource.FilePathName)
if(restab.Resource.LumpIndex == resource.LumpIndex && restab.Resource.FilePathName == resource.FilePathName)
{
tabs.SelectedTab = restab;
return restab;

View file

@ -30,6 +30,7 @@ namespace CodeImp.DoomBuilder.Controls
public override bool IsSaveAsRequired { get { return false; } }
public override bool IsReadOnly { get { return source.IsReadOnly; } }
public override string Filename { get { return filepathname; } }
internal ScriptResource Resource { get { return source; } }
#endregion

View file

@ -97,7 +97,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This changes the height
protected abstract void ChangeHeight(int amount);
protected abstract void ChangeTextureScale(int incrementX, int incrementY); //mxd
protected abstract void UpdateSkyRenderFlag(); //mxd
public virtual void SelectNeighbours(bool select, bool withSameTexture, bool withSameHeight) { } //mxd
//mxd

View file

@ -200,46 +200,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Update sky render flag
UpdateSkyRenderFlag();
// Apply vertices
base.SetVertices(verts);
return (verts.Length > 0);
}
//mxd
protected override void UpdateSkyRenderFlag()
{
bool isrenderedassky = renderassky;
renderassky = (level.sector.CeilTexture == General.Map.Config.SkyFlatName);
if(isrenderedassky != renderassky && Sector.Sides != null)
{
// Upper/middle geometry may need updating...
// Upper sidedef geometry may need updating...
foreach(Sidedef side in level.sector.Sidedefs)
{
VisualSidedefParts parts = Sector.GetSidedefParts(side);
if(parts.upper != null)
// Upper side can exist in either our, or the neightbouring sector, right?
if(parts.upper != null && parts.upper.Triangles > 0)
{
parts.upper.UpdateSkyRenderFlag();
// On the other side as well...
if(side.Other != null && side.Other.Sector != null &&
(side.Other.HighTexture == "-" || side.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName))
{
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
if(other != null && other.Sides != null)
{
parts = other.GetSidedefParts(side.Other);
if(parts.upper != null) parts.upper.UpdateSkyRenderFlag();
}
}
}
else if(parts.middlesingle != null)
else if(side.Other != null && side.Other.Sector != null && side.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName)
{
parts.middlesingle.UpdateSkyRenderFlag();
// Update upper side of the neightbouring sector
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
if(other != null && other.Sides != null)
{
parts = other.GetSidedefParts(side.Other);
if(parts.upper != null && parts.upper.Triangles > 0)
parts.upper.UpdateSkyRenderFlag();
}
}
}
}
// Apply vertices
base.SetVertices(verts);
return (verts.Length > 0);
}
#endregion

View file

@ -184,48 +184,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//mxd. Update sky render flag
UpdateSkyRenderFlag();
renderassky = (level.sector.FloorTexture == General.Map.Config.SkyFlatName);
// Apply vertices
base.SetVertices(verts);
return (verts.Length > 0);
}
//mxd
protected override void UpdateSkyRenderFlag()
{
bool isrenderedassky = renderassky;
renderassky = (level.sector.FloorTexture == General.Map.Config.SkyFlatName || level.sector.LongFloorTexture == MapSet.EmptyLongName);
if(isrenderedassky != renderassky && Sector.Sides != null)
{
// Middle/Lower geometry may need updating...
foreach(Sidedef side in level.sector.Sidedefs)
{
VisualSidedefParts parts = Sector.GetSidedefParts(side);
if(parts.lower != null)
{
parts.lower.UpdateSkyRenderFlag();
// On the other side as well...
if(side.Other != null && side.Other.Sector != null &&
(side.Other.LowTexture == "-" || side.Other.Sector.FloorTexture == General.Map.Config.SkyFlatName))
{
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
if(other != null && other.Sides != null)
{
parts = other.GetSidedefParts(side.Other);
if(parts.lower != null) parts.lower.UpdateSkyRenderFlag();
}
}
}
else if(parts.middlesingle != null)
{
parts.middlesingle.UpdateSkyRenderFlag();
}
}
}
}
#endregion
#region ================== Methods

View file

@ -61,19 +61,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override bool Setup()
{
Vector2D vl, vr;
//mxd. Apply sky hack?
UpdateSkyRenderFlag();
//mxd. lightfog flag support
int lightvalue;
bool lightabsolute;
GetLightValue(out lightvalue, out lightabsolute);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_bottom", 1.0f),
Sidedef.Fields.GetValue("scaley_bottom", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_bottom", 0.0f),
Sidedef.Fields.GetValue("offsety_bottom", 0.0f));
// Left and right vertices for this sidedef
if(Sidedef.IsFront)
@ -91,6 +78,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
SectorData sd = Sector.GetSectorData();
SectorData osd = mode.GetSectorData(Sidedef.Other.Sector);
if(!osd.Updated) osd.Update();
//mxd
float vlzf = sd.Floor.plane.GetZ(vl);
float vrzf = sd.Floor.plane.GetZ(vr);
float ovlzf = osd.Floor.plane.GetZ(vl);
float ovrzf = osd.Floor.plane.GetZ(vr);
//mxd. Side is visible when our sector's floor is lower than the other's at any vertex
if(!(vlzf < ovlzf || vrzf < ovrzf))
{
base.SetVertices(null);
return false;
}
//mxd. lightfog flag support
int lightvalue;
bool lightabsolute;
GetLightValue(out lightvalue, out lightabsolute);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_bottom", 1.0f),
Sidedef.Fields.GetValue("scaley_bottom", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_bottom", 0.0f),
Sidedef.Fields.GetValue("offsety_bottom", 0.0f));
// Texture given?
if(Sidedef.LongLowTexture != MapSet.EmptyLongName)
@ -168,10 +178,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Create initial polygon, which is just a quad between floor and ceiling
WallPolygon poly = new WallPolygon();
poly.Add(new Vector3D(vl.x, vl.y, sd.Floor.plane.GetZ(vl)));
poly.Add(new Vector3D(vl.x, vl.y, vlzf));
poly.Add(new Vector3D(vl.x, vl.y, sd.Ceiling.plane.GetZ(vl)));
poly.Add(new Vector3D(vr.x, vr.y, sd.Ceiling.plane.GetZ(vr)));
poly.Add(new Vector3D(vr.x, vr.y, sd.Floor.plane.GetZ(vr)));
poly.Add(new Vector3D(vr.x, vr.y, vrzf));
// Determine initial color
int lightlevel = lightabsolute ? lightvalue : sd.Ceiling.brightnessbelow + lightvalue;
@ -184,7 +194,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Cut off the part above the other floor
CropPoly(ref poly, osd.Floor.plane, false);
CropPoly(ref poly, osd.Ceiling.plane, true);
//INFO: Makes sence only when ceiling plane is lower than floor plane. Also ZDoom clips ceiling instead here.
if(ovlzf > osd.Ceiling.plane.GetZ(vl) || ovrzf > osd.Ceiling.plane.GetZ(vr))
CropPoly(ref poly, osd.Ceiling.plane, true);
// Cut out pieces that overlap 3D floors in this sector
List<WallPolygon> polygons = new List<WallPolygon> { poly };
@ -209,28 +222,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.SetVertices(null); //mxd
return false;
}
//mxd
internal void UpdateSkyRenderFlag()
{
bool isdoublesided = (Sidedef.Other != null && Sidedef.Sector != null && Sidedef.Other.Sector != null);
//TECH: when a side part has no texture, sky hack will be applied when either front or back sectors' floor uses SkyFlatName texture
//TECH: this glitches in both ZDoom and GZDoom when only lower sector's floor has SkyFlatName
if(Sidedef.LowTexture == "-")
{
renderassky = (isdoublesided
&& (Sidedef.Sector.FloorTexture == General.Map.Config.SkyFlatName
|| Sidedef.Other.Sector.FloorTexture == General.Map.Config.SkyFlatName));
}
//TECH: otherwise, sky hack will be applied when both front and back sector floors use SkyFlatName texture
else
{
renderassky = (isdoublesided
&& Sidedef.Sector.FloorTexture == General.Map.Config.SkyFlatName
&& Sidedef.Other.Sector.FloorTexture == General.Map.Config.SkyFlatName);
}
}
#endregion

View file

@ -68,7 +68,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.extrafloor = extrafloor;
//mxd. Extrafloor may've become invalid during undo/redo...
if(sourceside == null) return false;
if(sourceside == null)
{
base.SetVertices(null);
return false;
}
Vector2D vl, vr;

View file

@ -68,7 +68,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override bool Setup()
{
//mxd
if(Sidedef.LongMiddleTexture == MapSet.EmptyLongName) return false;
if(Sidedef.LongMiddleTexture == MapSet.EmptyLongName)
{
base.SetVertices(null);
return false;
}
Vector2D vl, vr;

View file

@ -62,9 +62,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
Vector2D vl, vr;
//mxd. Apply sky hack?
UpdateSkyRenderFlag();
//mxd. lightfog flag support
int lightvalue;
bool lightabsolute;
@ -205,12 +202,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
return false;
}
//mxd
internal void UpdateSkyRenderFlag()
{
renderassky = (Sidedef.LongMiddleTexture == MapSet.EmptyLongName && Sidedef.Sector != null && Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName);
}
#endregion
#region ================== Methods

View file

@ -61,19 +61,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override bool Setup()
{
Vector2D vl, vr;
//mxd. Apply sky hack?
UpdateSkyRenderFlag();
//mxd. lightfog flag support
int lightvalue;
bool lightabsolute;
GetLightValue(out lightvalue, out lightabsolute);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_top", 1.0f),
Sidedef.Fields.GetValue("scaley_top", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_top", 0.0f),
Sidedef.Fields.GetValue("offsety_top", 0.0f));
// Left and right vertices for this sidedef
if(Sidedef.IsFront)
@ -91,6 +78,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
SectorData sd = Sector.GetSectorData();
SectorData osd = mode.GetSectorData(Sidedef.Other.Sector);
if(!osd.Updated) osd.Update();
//mxd
float vlzc = sd.Ceiling.plane.GetZ(vl);
float vrzc = sd.Ceiling.plane.GetZ(vr);
//mxd. Side is visible when our sector's ceiling is higher than the other's at any vertex
if(!(vlzc > osd.Ceiling.plane.GetZ(vl) || vrzc > osd.Ceiling.plane.GetZ(vr)))
{
base.SetVertices(null);
return false;
}
//mxd. Apply sky hack?
UpdateSkyRenderFlag();
//mxd. lightfog flag support
int lightvalue;
bool lightabsolute;
GetLightValue(out lightvalue, out lightabsolute);
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_top", 1.0f),
Sidedef.Fields.GetValue("scaley_top", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_top", 0.0f),
Sidedef.Fields.GetValue("offsety_top", 0.0f));
// Texture given?
if((Sidedef.LongHighTexture != MapSet.EmptyLongName))
@ -161,8 +172,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Create initial polygon, which is just a quad between floor and ceiling
WallPolygon poly = new WallPolygon();
poly.Add(new Vector3D(vl.x, vl.y, sd.Floor.plane.GetZ(vl)));
poly.Add(new Vector3D(vl.x, vl.y, sd.Ceiling.plane.GetZ(vl)));
poly.Add(new Vector3D(vr.x, vr.y, sd.Ceiling.plane.GetZ(vr)));
poly.Add(new Vector3D(vl.x, vl.y, vlzc));
poly.Add(new Vector3D(vr.x, vr.y, vrzc));
poly.Add(new Vector3D(vr.x, vr.y, sd.Floor.plane.GetZ(vr)));
// Determine initial color
@ -204,23 +215,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
internal void UpdateSkyRenderFlag()
{
bool isdoublesided = (Sidedef.Other != null && Sidedef.Sector != null && Sidedef.Other.Sector != null);
//TECH: when a side part has no texture, sky hack will be applied when either front or back sectors' ceiling uses SkyFlatName texture
//TECH: this glitches in both ZDoom and GZDoom when only higher sector's ceiling has SkyFlatName
if(Sidedef.HighTexture == "-")
{
renderassky = (isdoublesided
&& (Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName
|| Sidedef.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName));
}
//TECH: otherwise, sky hack will be applied when both front and back sector ceilings use SkyFlatName texture
else
{
renderassky = (isdoublesided
&& Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName
&& Sidedef.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName);
}
renderassky = (Sidedef.Other != null && Sidedef.Sector != null && Sidedef.Other.Sector != null
&& Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName
&& Sidedef.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName);
}
#endregion

View file

@ -660,7 +660,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
bExportToFile.Enabled = (treeView.Nodes != null && treeView.Nodes.Count > 0);
// Loose focus when the main windows is active
if(focusDisplay && Form.ActiveForm == General.Interface) General.Interface.FocusDisplay();
if(focusDisplay) General.Interface.FocusDisplay();
}
//tag/action search
@ -1098,7 +1098,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
private void updatetimer_Tick(object sender, EventArgs e)
{
updatetimer.Stop();
UpdateTree(true);
UpdateTree(Form.ActiveForm == General.Interface);
}
private void bExportToFile_Click(object sender, EventArgs e)