Sprites for custom Things can be supplied with a "#$Sprite" comment.

This commit is contained in:
MascaraSnake 2016-04-06 12:08:14 +02:00
parent ed578eab72
commit e501646989
3 changed files with 12 additions and 3 deletions

View file

@ -412,7 +412,7 @@ namespace CodeImp.DoomBuilder.Config
for (int i = 0; i < Linedef.NUM_ARGS; i++) this.args[i] = new ArgumentInfo(i);
// Read properties
this.sprite = cat.Sprite;
this.sprite = o.sprite;
this.color = cat.Color;
this.alpha = cat.Alpha; //mxd
this.alphabyte = (byte)(this.alpha * 255); //mxd

View file

@ -6,6 +6,7 @@ using System.Globalization;
using System.IO;
using System.Text;
using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.ZDoom;
using CodeImp.DoomBuilder.GZBuilder.Data;
@ -137,6 +138,7 @@ namespace CodeImp.DoomBuilder.SRB2
private bool ParseObject(string name)
{
if (name == null) return false;
string sprite = DataManager.INTERNAL_PREFIX + "unknownthing";
string[] states = new string[8];
int mapThingNum = -1;
int radius = 0;
@ -146,6 +148,11 @@ namespace CodeImp.DoomBuilder.SRB2
string line = streamreader.ReadLine();
linenumber++;
if (String.IsNullOrEmpty(line) || line.StartsWith("\n")) break;
if (line.StartsWith("#$Sprite "))
{
sprite = line.Substring(9);
continue;
}
if (line.StartsWith("#")) continue;
line = RemoveComments(line);
string[] tokens = line.Split(new char[] { '=' });
@ -210,7 +217,7 @@ namespace CodeImp.DoomBuilder.SRB2
}
if (mapThingNum > 0)
{
SRB2Object o = new SRB2Object(name, states, mapThingNum, radius, height);
SRB2Object o = new SRB2Object(name, sprite, states, mapThingNum, radius, height);
if (objects.ContainsKey(name))
objects[name] = o;
else

View file

@ -33,6 +33,7 @@ namespace CodeImp.DoomBuilder.SRB2
#region ================== Variables
public readonly string name;
public readonly string sprite;
public readonly string[] states;
public readonly int mapThingNum;
public readonly int radius;
@ -43,9 +44,10 @@ namespace CodeImp.DoomBuilder.SRB2
#region ================== Constructor / Disposer
// Constructor
internal SRB2Object(string name, string[] states, int mapThingNum, int radius, int height)
internal SRB2Object(string name, string sprite, string[] states, int mapThingNum, int radius, int height)
{
this.name = name;
this.sprite = sprite;
this.states = states;
this.mapThingNum = mapThingNum;
this.radius = radius;