- allow optional decal generator definitions.

This commit is contained in:
Christoph Oelckers 2015-11-29 11:41:14 +01:00
parent 5515cb02a6
commit 1a0faf4761

View file

@ -603,16 +603,17 @@ void FDecalLib::ParseGenerator (FScanner &sc)
{
const PClass *type;
FDecalBase *decal;
AActor *actor;
bool optional = false;
// Get name of generator (actor)
sc.MustGetString ();
optional = sc.Compare("optional");
type = PClass::FindClass (sc.String);
if (type == NULL || type->ActorInfo == NULL)
{
sc.ScriptError ("%s is not an actor.", sc.String);
if (!optional) sc.ScriptError ("%s is not an actor.", sc.String);
}
actor = (AActor *)type->Defaults;
// Get name of generated decal
sc.MustGetString ();
@ -628,13 +629,16 @@ void FDecalLib::ParseGenerator (FScanner &sc)
sc.ScriptError ("%s has not been defined.", sc.String);
}
}
if (type != NULL)
{
AActor *actor = (AActor *)type->Defaults;
actor->DecalGenerator = decal;
if (decal != NULL)
{
decal->Users.Push(type);
}
}
}
void FDecalLib::ParseFader (FScanner &sc)
{