Level compatibility via ZScript -- PoC

This commit is contained in:
alexey.lysiuk 2018-04-09 17:53:52 +03:00
parent 80f57dfaf0
commit 640948703f
5 changed files with 52 additions and 15 deletions

View file

@ -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<PFunction>(cls->FindSymbol("Apply", true));
if (func != nullptr)
{
VMCall(func->Variants[0].Implementation, nullptr, 0, nullptr, 0);
}
}
if (ii_compatparams != -1)
{
unsigned i = ii_compatparams;

View file

@ -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

View file

@ -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"

View file

@ -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);
}
}

View file

@ -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