From ac68316527cbb9adcc4d354018b2be8f9a30c5f2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 25 Jan 2019 00:55:28 +0100 Subject: [PATCH] - 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. # Conflicts: # src/compatibility.cpp # wadsrc/static/zscript/level_compatibility.txt --- src/compatibility.cpp | 17 +++++++---------- wadsrc/static/zscript/level_compatibility.txt | 5 ++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 88d4ba448..8ecfb6319 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -346,19 +346,16 @@ IMPLEMENT_CLASS(DLevelCompatibility, true, false); void SetCompatibilityParams(FName checksum) { - if (checksum != NAME_None) + auto lc = Create(); + for (auto cls : PClass::AllClasses) { - auto lc = Create(); - for(auto cls : PClass::AllClasses) + if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelCompatibility))) { - if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelCompatibility))) + PFunction *const func = dyn_cast(cls->FindSymbol("Apply", false)); + if (func != nullptr) { - PFunction *const func = dyn_cast(cls->FindSymbol("Apply", false)); - if (func != nullptr) - { - VMValue param[] = { lc, (int)checksum }; - VMCall(func->Variants[0].Implementation, param, 2, nullptr, 0); - } + VMValue param[] = { lc, checksum.GetIndex(), &level.MapName }; + VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0); } } } diff --git a/wadsrc/static/zscript/level_compatibility.txt b/wadsrc/static/zscript/level_compatibility.txt index 9e16a14a6..46b286df0 100644 --- a/wadsrc/static/zscript/level_compatibility.txt +++ b/wadsrc/static/zscript/level_compatibility.txt @@ -1,10 +1,13 @@ class LevelCompatibility native play { - protected void Apply(Name checksum) + protected void Apply(Name checksum, String mapname) { switch (checksum) { + case 'none': + return; + case '9BC9E12781903D7C2D5697A5E0AEFD6F': // HACX.WAD map05 from 21.10.2010 case '9527DD0809FDA39CCFC316A21D135783': // HACX.WAD map05 from 20.10.2010 {