- call level compatibility handlers for all levels and pass the map name as a second parameter.

This is for user-made handlers for which the checksum is rather useless both for deciding whether to call the handler and for identifying the map.
This commit is contained in:
Christoph Oelckers 2019-01-25 00:55:28 +01:00
parent 68f0cf111d
commit b2ee99c7cc
2 changed files with 13 additions and 13 deletions

View File

@ -353,8 +353,6 @@ IMPLEMENT_CLASS(DLevelCompatibility, true, false);
void MapLoader::SetCompatibilityParams(FName checksum) void MapLoader::SetCompatibilityParams(FName checksum)
{ {
if (checksum != NAME_None)
{
auto lc = Create<DLevelCompatibility>(); auto lc = Create<DLevelCompatibility>();
lc->loader = this; lc->loader = this;
lc->Level = Level; lc->Level = Level;
@ -365,9 +363,8 @@ void MapLoader::SetCompatibilityParams(FName checksum)
PFunction *const func = dyn_cast<PFunction>(cls->FindSymbol("Apply", false)); PFunction *const func = dyn_cast<PFunction>(cls->FindSymbol("Apply", false));
if (func != nullptr) if (func != nullptr)
{ {
VMValue param[] = { lc, (int)checksum }; VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
VMCall(func->Variants[0].Implementation, param, 2, nullptr, 0); VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
}
} }
} }
} }

View File

@ -3,10 +3,13 @@ class LevelCompatibility native play
{ {
native LevelLocals level; native LevelLocals level;
protected void Apply(Name checksum) protected void Apply(Name checksum, String mapname)
{ {
switch (checksum) switch (checksum)
{ {
case 'none':
return;
case '9BC9E12781903D7C2D5697A5E0AEFD6F': // HACX.WAD map05 from 21.10.2010 case '9BC9E12781903D7C2D5697A5E0AEFD6F': // HACX.WAD map05 from 21.10.2010
case '9527DD0809FDA39CCFC316A21D135783': // HACX.WAD map05 from 20.10.2010 case '9527DD0809FDA39CCFC316A21D135783': // HACX.WAD map05 from 20.10.2010
{ {