fixed actor class creation for DSDHacked

* the did not get defaults assigned.
* the RETARGETAFTERSLAM flag must also be set for newly created classes here
This commit is contained in:
Professor Hastig 2023-09-25 08:42:30 +02:00 committed by Christoph Oelckers
parent cd5cf6b7fe
commit 9d737afa9c

View file

@ -134,15 +134,15 @@ static PClassActor* FindInfoName(int index, bool mustexist = false)
{
FStringf name("~Dsdhacked~%d", index);
auto cls = PClass::FindActor(name);
if (cls)
{
GetDefaultByType(cls)->flags8 |= MF8_RETARGETAFTERSLAM; // This flag is not a ZDoom default, but it must be a Dehacked default.
return cls;
}
if (!mustexist)
{
cls = static_cast<PClassActor*>(RUNTIME_CLASS(AActor)->CreateDerivedClass(name.GetChars(), (unsigned)sizeof(AActor)));
NewClassType(cls, -1); // This needs a VM type to work as intended.
cls->InitializeDefaults();
}
if (cls)
{
GetDefaultByType(cls)->flags8 |= MF8_RETARGETAFTERSLAM; // This flag is not a ZDoom default, but it must be a Dehacked default.
return cls;
}
}