diff --git a/src/compatibility.cpp b/src/compatibility.cpp index ff36f9434..7be7b4237 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -54,6 +54,7 @@ #include "w_wad.h" #include "textures.h" #include "g_levellocals.h" +#include "vm.h" // MACROS ------------------------------------------------------------------ @@ -532,6 +533,16 @@ void CheckCompatibility(MapData *map) void SetCompatibilityParams() { + PClass *const cls = PClass::FindClass("LevelCompatibility"); + if (cls != nullptr) + { + PFunction *const func = dyn_cast(cls->FindSymbol("Apply", true)); + if (func != nullptr) + { + VMCall(func->Variants[0].Implementation, nullptr, 0, nullptr, 0); + } + } + if (ii_compatparams != -1) { unsigned i = ii_compatparams; diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 673002877..7fec2a528 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -631,16 +631,6 @@ AAECADD4D97970AFF702D86FAFAC7D17 // doom.wad e4m4 setsectorspecial 264 0 } - -AB24AE6E2CB13CBDD04600A4D37F9189 // doom2.wad map02 -1EC0AF1E3985650F0C9000319C599D0C // doom2bfg.wad map02 -{ - // missing textures - setwalltexture 327 front bot STONE4 - setwalltexture 328 front bot STONE4 - setwalltexture 338 front bot STONE4 - setwalltexture 339 front bot STONE4 -} CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04 { // missing textures @@ -667,11 +657,6 @@ CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04 setsectortag 4 0 setsectortag 153 0 } -66C46385EB1A23D60839D1532522076B // doom2.wad map08 -{ - // missing texture - setwalltexture 101 back top BRICK7 -} 5BDA34DA60C0530794CC1EA2DA017976 // doom2.wad map14 { // missing textures diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 755e427dd..31531ed28 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -7,6 +7,7 @@ version "3.3" #include "zscript/actor.txt" #include "zscript/actor_checks.txt" #include "zscript/events.txt" +#include "zscript/level_compatibility.txt" #include "zscript/menu/menuitembase.txt" #include "zscript/menu/menu.txt" diff --git a/wadsrc/static/zscript/level_compatibility.txt b/wadsrc/static/zscript/level_compatibility.txt new file mode 100644 index 000000000..17bddba13 --- /dev/null +++ b/wadsrc/static/zscript/level_compatibility.txt @@ -0,0 +1,34 @@ + +class LevelCompatibility play +{ + private static void Apply() + { + string checksum = level.GetChecksum(); + + if ( checksum ~== "AB24AE6E2CB13CBDD04600A4D37F9189" // doom2.wad map02 + || checksum ~== "1EC0AF1E3985650F0C9000319C599D0C") // doom2bfg.wad map02 + { + // Missing textures + TextureID stone4 = TexMan.CheckForTexture("STONE4", TexMan.Type_Wall); + SetWallTextureID(327, Line.front, Side.bottom, stone4); + SetWallTextureID(328, Line.front, Side.bottom, stone4); + SetWallTextureID(338, Line.front, Side.bottom, stone4); + SetWallTextureID(339, Line.front, Side.bottom, stone4); + } + else if (checksum ~== "66C46385EB1A23D60839D1532522076B") // doom2.wad map08 + { + // Missing texture + SetWallTexture(101, Line.back, Side.top, "BRICK7"); + } + } + + private static void SetWallTexture(int line, int side, int texpart, String texture) + { + SetWallTextureID(line, side, texpart, TexMan.CheckForTexture(texture, TexMan.Type_Wall)); + } + + private static void SetWallTextureID(int line, int side, int texpart, TextureID texture) + { + level.Lines[line].sidedef[side].SetTexture(texpart, texture); + } +} diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index 4267b7b05..fb62faff7 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -102,6 +102,12 @@ struct Side native play struct Line native play { + enum ESide + { + front=0, + back=1 + } + enum ELineFlags { ML_BLOCKING =0x00000001, // solid, is an obstacle