mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 05:40:44 +00:00
Fix and restrict level postprocessor instance
This commit is contained in:
parent
ab9b6320cb
commit
702ef493f0
1 changed files with 8 additions and 5 deletions
|
@ -56,19 +56,16 @@
|
||||||
|
|
||||||
class DLevelPostProcessor : public DObject
|
class DLevelPostProcessor : public DObject
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(DLevelPostProcessor, DObject)
|
DECLARE_CLASS(DLevelPostProcessor, DObject)
|
||||||
public:
|
public:
|
||||||
MapLoader *loader;
|
MapLoader *loader;
|
||||||
FLevelLocals *Level;
|
FLevelLocals *Level;
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DLevelPostProcessor, true, false);
|
IMPLEMENT_CLASS(DLevelPostProcessor, false, false);
|
||||||
|
|
||||||
void MapLoader::PostProcessLevel(FName checksum)
|
void MapLoader::PostProcessLevel(FName checksum)
|
||||||
{
|
{
|
||||||
auto lc = Create<DLevelPostProcessor>();
|
|
||||||
lc->loader = this;
|
|
||||||
lc->Level = Level;
|
|
||||||
for(auto cls : PClass::AllClasses)
|
for(auto cls : PClass::AllClasses)
|
||||||
{
|
{
|
||||||
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor)))
|
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor)))
|
||||||
|
@ -87,8 +84,14 @@ void MapLoader::PostProcessLevel(FName checksum)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto lc = static_cast<DLevelPostProcessor*>(cls->CreateNew());
|
||||||
|
lc->loader = this;
|
||||||
|
lc->Level = Level;
|
||||||
|
|
||||||
VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
|
VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
|
||||||
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
||||||
|
|
||||||
|
lc->Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue