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 79831526cd
commit 22e8bea91b

View file

@ -134,15 +134,15 @@ static PClassActor* FindInfoName(int index, bool mustexist = false)
{ {
FStringf name("~Dsdhacked~%d", index); FStringf name("~Dsdhacked~%d", index);
auto cls = PClass::FindActor(name); 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) if (!mustexist)
{ {
cls = static_cast<PClassActor*>(RUNTIME_CLASS(AActor)->CreateDerivedClass(name.GetChars(), (unsigned)sizeof(AActor))); 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. 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; return cls;
} }
} }