mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-21 11:20:58 +00:00
Updated, Visual mode: some cases when the sky hack must be applied were not handled.
Updated, Script editor: script editor was unable to show error location after double-clicking on it in the Warnings and Errors window when said location was inside of a WAD located in a PK3 file. Updated, text lumps tracking: already parsed DECORATE/GLDEFS lumps are now added to the text lumps list even when DECORATE/GLDEFS parsing fails, allowing you to fix errors without the need to use external tools. Fixed: in some cases the editor could stuck in an infinite loop when searching for wad lumps.
This commit is contained in:
parent
18dc8cebba
commit
1523d06ee3
9 changed files with 167 additions and 30 deletions
|
@ -628,12 +628,35 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
{
|
{
|
||||||
// Resource exists?
|
// Resource exists?
|
||||||
DataReader dr = null;
|
DataReader dr = null;
|
||||||
foreach(DataReader reader in General.Map.Data.Containers)
|
|
||||||
|
// Resource is a temporary file?
|
||||||
|
if(item.ResourceLocation.StartsWith(General.Map.TempPath))
|
||||||
{
|
{
|
||||||
if(reader.Location.location == item.ResourceLocation)
|
// Search in PK3-embedded wads only
|
||||||
|
foreach(DataReader reader in General.Map.Data.Containers)
|
||||||
{
|
{
|
||||||
dr = reader;
|
if(!(reader is PK3Reader)) continue;
|
||||||
break;
|
PK3Reader pkr = (PK3Reader)reader;
|
||||||
|
foreach(WADReader wadreader in pkr.Wads)
|
||||||
|
{
|
||||||
|
if(wadreader.Location.location == item.ResourceLocation)
|
||||||
|
{
|
||||||
|
dr = wadreader;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Search among resources
|
||||||
|
foreach(DataReader reader in General.Map.Data.Containers)
|
||||||
|
{
|
||||||
|
if(reader.Location.location == item.ResourceLocation)
|
||||||
|
{
|
||||||
|
dr = reader;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,9 +666,14 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
TextResourceData trd = new TextResourceData(dr, dr.LoadFile(item.LumpName, item.LumpIndex), item.LumpName, item.LumpIndex, false);
|
TextResourceData trd = new TextResourceData(dr, dr.LoadFile(item.LumpName, item.LumpIndex), item.LumpName, item.LumpIndex, false);
|
||||||
var targettab = OpenResource(new ScriptResource(trd, item.ScriptType));
|
var targettab = OpenResource(new ScriptResource(trd, item.ScriptType));
|
||||||
|
|
||||||
// Go to error line
|
if(targettab != null)
|
||||||
if(targettab != null && item.LineNumber != CompilerError.NO_LINE_NUMBER)
|
{
|
||||||
targettab.MoveToLine(item.LineNumber);
|
// Go to error line
|
||||||
|
if(item.LineNumber != CompilerError.NO_LINE_NUMBER) targettab.MoveToLine(item.LineNumber);
|
||||||
|
|
||||||
|
// Show in resources tree
|
||||||
|
scriptresources.SelectItem(item.ResourceLocation, item.LumpName, item.LumpIndex, item.ScriptType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
|
|
|
@ -185,6 +185,41 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
#region ================== Methods
|
#region ================== Methods
|
||||||
|
|
||||||
|
public void SelectItem(string resourcelocation, string lumpname, int lumpindex, ScriptType scripttype)
|
||||||
|
{
|
||||||
|
TreeNode target = FindItem(projecttree.Nodes, resourcelocation, lumpname, lumpindex, scripttype);
|
||||||
|
if(target != null)
|
||||||
|
{
|
||||||
|
projecttree.SelectedNode = target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TreeNode FindItem(TreeNodeCollection nodes, string resourcelocation, string lumpname, int lumpindex, ScriptType scripttype)
|
||||||
|
{
|
||||||
|
foreach(TreeNode node in nodes)
|
||||||
|
{
|
||||||
|
// Is this the item we are looking for?
|
||||||
|
TextResourceNodeData data = (TextResourceNodeData)node.Tag;
|
||||||
|
|
||||||
|
if(data.NodeType == TextResourceNodeType.NODE && data.ResourceLocation == resourcelocation
|
||||||
|
&& data.ScriptType == scripttype && data.Resource.Filename == lumpname && data.Resource.LumpIndex == lumpindex)
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try children...
|
||||||
|
if(node.Nodes.Count > 0)
|
||||||
|
{
|
||||||
|
TreeNode item = FindItem(node.Nodes, resourcelocation, lumpname, lumpindex, scripttype);
|
||||||
|
if(item != null) return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No dice...
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateResourcesTree()
|
private void UpdateResourcesTree()
|
||||||
{
|
{
|
||||||
ScriptType targettype = (filterbytype.SelectedIndex > -1 ? ((ScriptTypeItem)filterbytype.SelectedItem).Type : ScriptType.UNKNOWN);
|
ScriptType targettype = (filterbytype.SelectedIndex > -1 ? ((ScriptTypeItem)filterbytype.SelectedItem).Type : ScriptType.UNKNOWN);
|
||||||
|
@ -352,6 +387,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
LocationInResource = path,
|
LocationInResource = path,
|
||||||
NodeType = TextResourceNodeType.NODE,
|
NodeType = TextResourceNodeType.NODE,
|
||||||
Resource = res,
|
Resource = res,
|
||||||
|
ScriptType = res.ScriptType,
|
||||||
};
|
};
|
||||||
string includepath = (res.ScriptType == ScriptType.ACS ? "\nInclude path: \"" + res.Filename + "\"" : "");
|
string includepath = (res.ScriptType == ScriptType.ACS ? "\nInclude path: \"" + res.Filename + "\"" : "");
|
||||||
TreeNode scriptnode = new TreeNode(res.ToString(), iconindex, iconindex) { Tag = data, ToolTipText = data + includepath };
|
TreeNode scriptnode = new TreeNode(res.ToString(), iconindex, iconindex) { Tag = data, ToolTipText = data + includepath };
|
||||||
|
|
|
@ -1831,8 +1831,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(decorate.HasError)
|
if(decorate.HasError)
|
||||||
{
|
{
|
||||||
decorate.LogError();
|
decorate.LogError();
|
||||||
currentreader = null;
|
break;
|
||||||
return counter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2022,6 +2021,11 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Return after adding parsed resources
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output info
|
// Output info
|
||||||
|
@ -2375,6 +2379,8 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
// Load gldefs from resources
|
// Load gldefs from resources
|
||||||
foreach(DataReader dr in containers)
|
foreach(DataReader dr in containers)
|
||||||
{
|
{
|
||||||
|
if(parser.HasError) break;
|
||||||
|
|
||||||
currentreader = dr;
|
currentreader = dr;
|
||||||
parser.ClearIncludesList();
|
parser.ClearIncludesList();
|
||||||
IEnumerable<TextResourceData> streams = dr.GetGldefsData(General.Map.Config.BaseGame);
|
IEnumerable<TextResourceData> streams = dr.GetGldefsData(General.Map.Config.BaseGame);
|
||||||
|
@ -2387,8 +2393,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(parser.HasError)
|
if(parser.HasError)
|
||||||
{
|
{
|
||||||
parser.LogError();
|
parser.LogError();
|
||||||
currentreader = null;
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2397,6 +2402,9 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
scriptresources[parser.ScriptType] = new HashSet<ScriptResource>(parser.ScriptResources.Values);
|
scriptresources[parser.ScriptType] = new HashSet<ScriptResource>(parser.ScriptResources.Values);
|
||||||
currentreader = null;
|
currentreader = null;
|
||||||
|
|
||||||
|
//mxd. Abort on errors, but after adding parsed text resources
|
||||||
|
if(parser.HasError) return;
|
||||||
|
|
||||||
// Create Gldefs Entries dictionary
|
// Create Gldefs Entries dictionary
|
||||||
foreach(KeyValuePair<string, string> e in parser.Objects) //<ClassName, Light name>
|
foreach(KeyValuePair<string, string> e in parser.Objects) //<ClassName, Light name>
|
||||||
{
|
{
|
||||||
|
|
|
@ -508,12 +508,12 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
// This finds a lump by name, returns -1 when not found
|
// This finds a lump by name, returns -1 when not found
|
||||||
public int FindLumpIndex(string name, int start, int end)
|
public int FindLumpIndex(string name, int start, int end)
|
||||||
{
|
{
|
||||||
if(name.Length > 8 || lumps.Count == 0) return -1; //mxd. Can't be here. Go away!
|
if(name.Length > 8 || lumps.Count == 0 || start > lumps.Count - 1) return -1; //mxd. Can't be here. Go away!
|
||||||
|
|
||||||
long longname = Lump.MakeLongName(name);
|
long longname = Lump.MakeLongName(name);
|
||||||
|
|
||||||
// Fix start/end when they exceed safe bounds
|
// Fix start/end when they exceed safe bounds
|
||||||
start = General.Clamp(start, 0, lumps.Count - 1);
|
start = Math.Max(start, 0);
|
||||||
end = General.Clamp(end, 0, lumps.Count - 1);
|
end = General.Clamp(end, 0, lumps.Count - 1);
|
||||||
|
|
||||||
// Loop through the lumps
|
// Loop through the lumps
|
||||||
|
|
|
@ -213,15 +213,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
int brightness = level.brightnessbelow;
|
int brightness = level.brightnessbelow;
|
||||||
|
|
||||||
//mxd. Apply lightfloor value
|
//mxd. Apply lightfloor value
|
||||||
|
// According to Graf, this is incorrect behaviour...
|
||||||
// TECH: In (G)ZDoom, this is ignored when ceiling texture is sky or a thing is below a 3D floor
|
// TECH: In (G)ZDoom, this is ignored when ceiling texture is sky or a thing is below a 3D floor
|
||||||
// It's probably more involved than this, but for now let's do it only when there are no 3d floors in Thing.Sector...
|
// It's probably more involved than this, but for now let's do it only when there are no 3d floors in Thing.Sector...
|
||||||
if(General.Map.UDMF && sd.LightLevels.Count == 2 && Thing.Sector.CeilTexture != General.Map.Config.SkyFlatName)
|
/*if(General.Map.UDMF && sd.LightLevels.Count == 2 && Thing.Sector.CeilTexture != General.Map.Config.SkyFlatName)
|
||||||
{
|
{
|
||||||
if(sd.Sector.Fields.GetValue("lightfloorabsolute", false))
|
if(sd.Sector.Fields.GetValue("lightfloorabsolute", false))
|
||||||
brightness = UniFields.GetInteger(sd.Sector.Fields, "lightfloor");
|
brightness = UniFields.GetInteger(sd.Sector.Fields, "lightfloor");
|
||||||
else
|
else
|
||||||
brightness += UniFields.GetInteger(sd.Sector.Fields, "lightfloor");
|
brightness += UniFields.GetInteger(sd.Sector.Fields, "lightfloor");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Level is glowing
|
// Level is glowing
|
||||||
if(level.affectedbyglow && level.type == SectorLevelType.Floor)
|
if(level.affectedbyglow && level.type == SectorLevelType.Floor)
|
||||||
|
|
|
@ -218,20 +218,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
foreach(Sidedef side in level.sector.Sidedefs)
|
foreach(Sidedef side in level.sector.Sidedefs)
|
||||||
{
|
{
|
||||||
VisualSidedefParts parts = Sector.GetSidedefParts(side);
|
VisualSidedefParts parts = Sector.GetSidedefParts(side);
|
||||||
if(parts.upper != null) parts.upper.UpdateSkyRenderFlag();
|
if(parts.upper != null)
|
||||||
else if(parts.middlesingle != null) parts.middlesingle.UpdateSkyRenderFlag();
|
|
||||||
|
|
||||||
// On the other side as well...
|
|
||||||
if(side.Other != null && side.Other.Sector != null &&
|
|
||||||
side.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName)
|
|
||||||
{
|
{
|
||||||
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
|
parts.upper.UpdateSkyRenderFlag();
|
||||||
if(other != null && other.Sides != null)
|
|
||||||
|
// 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))
|
||||||
{
|
{
|
||||||
parts = other.GetSidedefParts(side.Other);
|
BaseVisualSector other = (BaseVisualSector)mode.GetVisualSector(side.Other.Sector);
|
||||||
if(parts.upper != null) parts.upper.UpdateSkyRenderFlag();
|
if(other != null && other.Sides != null)
|
||||||
|
{
|
||||||
|
parts = other.GetSidedefParts(side.Other);
|
||||||
|
if(parts.upper != null) parts.upper.UpdateSkyRenderFlag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(parts.middlesingle != null)
|
||||||
|
{
|
||||||
|
parts.middlesingle.UpdateSkyRenderFlag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,11 +198,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
renderassky = (level.sector.FloorTexture == General.Map.Config.SkyFlatName || level.sector.LongFloorTexture == MapSet.EmptyLongName);
|
renderassky = (level.sector.FloorTexture == General.Map.Config.SkyFlatName || level.sector.LongFloorTexture == MapSet.EmptyLongName);
|
||||||
if(isrenderedassky != renderassky && Sector.Sides != null)
|
if(isrenderedassky != renderassky && Sector.Sides != null)
|
||||||
{
|
{
|
||||||
// Middle geometry may need updating...
|
// Middle/Lower geometry may need updating...
|
||||||
foreach(Sidedef side in level.sector.Sidedefs)
|
foreach(Sidedef side in level.sector.Sidedefs)
|
||||||
{
|
{
|
||||||
VisualSidedefParts parts = Sector.GetSidedefParts(side);
|
VisualSidedefParts parts = Sector.GetSidedefParts(side);
|
||||||
if(parts.middlesingle != null) parts.middlesingle.UpdateSkyRenderFlag();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
Vector2D vl, vr;
|
Vector2D vl, vr;
|
||||||
|
|
||||||
|
//mxd. Apply sky hack?
|
||||||
|
UpdateSkyRenderFlag();
|
||||||
|
|
||||||
//mxd. lightfog flag support
|
//mxd. lightfog flag support
|
||||||
int lightvalue;
|
int lightvalue;
|
||||||
bool lightabsolute;
|
bool lightabsolute;
|
||||||
|
@ -206,6 +209,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
base.SetVertices(null); //mxd
|
base.SetVertices(null); //mxd
|
||||||
return false;
|
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
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -204,9 +204,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
//mxd
|
//mxd
|
||||||
internal void UpdateSkyRenderFlag()
|
internal void UpdateSkyRenderFlag()
|
||||||
{
|
{
|
||||||
renderassky = (Sidedef.Other != null && Sidedef.Sector != null && Sidedef.Other.Sector != null &&
|
bool isdoublesided = (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);
|
//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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue