mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-20 19:02:12 +00:00
Dehacked: added support for editor keys
Dehacked: Dehacked files are now properly loaded from directories
This commit is contained in:
parent
4b1e5d8e22
commit
fca82f5c91
4 changed files with 38 additions and 12 deletions
|
@ -650,6 +650,9 @@ namespace CodeImp.DoomBuilder.Config
|
|||
blocking = thing.Bits.Contains("solid") ? 1 : 0;
|
||||
hangs = thing.Bits.Contains("spawnceiling");
|
||||
|
||||
if (thing.Props.ContainsKey("$editor angled"))
|
||||
arrow = thing.Angled == ThingAngled.YES;
|
||||
|
||||
if (thing.Color >= 0 && thing.Color <= 19)
|
||||
color = thing.Color;
|
||||
|
||||
|
|
|
@ -500,12 +500,12 @@ namespace CodeImp.DoomBuilder.Data
|
|||
string pathname = Path.GetDirectoryName(pname);
|
||||
|
||||
if (filename.IndexOf('.') > -1)
|
||||
{
|
||||
allfilenames = GetFileAtPath(filename, pathname, "DEHACKED");
|
||||
}
|
||||
else
|
||||
allfilenames = GetAllFilesWithTitle(pathname, filename, false);
|
||||
|
||||
result.Add(new TextResourceData(this, LoadFile(allfilenames[allfilenames.Length - 1]), allfilenames[allfilenames.Length - 1], true));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -359,8 +359,11 @@ namespace CodeImp.DoomBuilder.Dehacked
|
|||
{
|
||||
line = GetLine();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(line)) break;
|
||||
if (line.StartsWith("#")) continue;
|
||||
if (string.IsNullOrWhiteSpace(line))
|
||||
break;
|
||||
else if (line.StartsWith("#$"))
|
||||
line = line.Substring(1);
|
||||
else if (line.StartsWith("#")) continue;
|
||||
|
||||
if (!GetKeyValueFromLine(line, out fieldkey, out fieldvalue))
|
||||
return false;
|
||||
|
|
|
@ -30,6 +30,13 @@ using System.Collections.Generic;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Dehacked
|
||||
{
|
||||
public enum ThingAngled
|
||||
{
|
||||
UNCHANGED,
|
||||
YES,
|
||||
NO
|
||||
}
|
||||
|
||||
public class DehackedThing
|
||||
{
|
||||
#region ================== Variables
|
||||
|
@ -46,6 +53,7 @@ namespace CodeImp.DoomBuilder.Dehacked
|
|||
private string category;
|
||||
private int color;
|
||||
private bool bright;
|
||||
private ThingAngled angled;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -63,6 +71,7 @@ namespace CodeImp.DoomBuilder.Dehacked
|
|||
public string Category { get { return category; } }
|
||||
public int Color { get { return color; } }
|
||||
public bool Bright { get { return bright; } }
|
||||
public ThingAngled Angled { get { return angled; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -73,6 +82,8 @@ namespace CodeImp.DoomBuilder.Dehacked
|
|||
this.number = number;
|
||||
this.name = name;
|
||||
color = -1;
|
||||
sprite = null;
|
||||
angled = ThingAngled.UNCHANGED;
|
||||
|
||||
props = new Dictionary<string, string>();
|
||||
bits = new List<string>();
|
||||
|
@ -117,7 +128,7 @@ namespace CodeImp.DoomBuilder.Dehacked
|
|||
int.TryParse(value, out doomednum);
|
||||
break;
|
||||
case "initial frame":
|
||||
if (int.TryParse(value, out initialframe))
|
||||
if (sprite == null && int.TryParse(value, out initialframe))
|
||||
{
|
||||
if (frames.ContainsKey(initialframe))
|
||||
{
|
||||
|
@ -174,13 +185,22 @@ namespace CodeImp.DoomBuilder.Dehacked
|
|||
bits.Add(mnemonic.Trim().ToLowerInvariant());
|
||||
}
|
||||
break;
|
||||
//case "$category":
|
||||
// category = value;
|
||||
// break;
|
||||
//case "$color":
|
||||
// if (!int.TryParse(value, out color))
|
||||
// color = 18; // Default light brown
|
||||
// break;
|
||||
case "$editor category":
|
||||
category = value;
|
||||
break;
|
||||
case "$editor color id":
|
||||
if (!int.TryParse(value, out color))
|
||||
color = 18; // Default light brown
|
||||
break;
|
||||
case "$editor sprite":
|
||||
sprite = value;
|
||||
break;
|
||||
case "$editor angled":
|
||||
if (value.ToLowerInvariant() == "true")
|
||||
angled = ThingAngled.YES;
|
||||
else
|
||||
angled = ThingAngled.NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue