mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 23:21:41 +00:00
Level compatibility via ZScript -- PoC
This commit is contained in:
parent
80f57dfaf0
commit
640948703f
5 changed files with 52 additions and 15 deletions
|
@ -54,6 +54,7 @@
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "textures.h"
|
#include "textures.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
#include "vm.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -532,6 +533,16 @@ void CheckCompatibility(MapData *map)
|
||||||
|
|
||||||
void SetCompatibilityParams()
|
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)
|
if (ii_compatparams != -1)
|
||||||
{
|
{
|
||||||
unsigned i = ii_compatparams;
|
unsigned i = ii_compatparams;
|
||||||
|
|
|
@ -631,16 +631,6 @@ AAECADD4D97970AFF702D86FAFAC7D17 // doom.wad e4m4
|
||||||
setsectorspecial 264 0
|
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
|
CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04
|
||||||
{
|
{
|
||||||
// missing textures
|
// missing textures
|
||||||
|
@ -667,11 +657,6 @@ CEC791136A83EEC4B91D39718BDF9D82 // doom2.wad map04
|
||||||
setsectortag 4 0
|
setsectortag 4 0
|
||||||
setsectortag 153 0
|
setsectortag 153 0
|
||||||
}
|
}
|
||||||
66C46385EB1A23D60839D1532522076B // doom2.wad map08
|
|
||||||
{
|
|
||||||
// missing texture
|
|
||||||
setwalltexture 101 back top BRICK7
|
|
||||||
}
|
|
||||||
5BDA34DA60C0530794CC1EA2DA017976 // doom2.wad map14
|
5BDA34DA60C0530794CC1EA2DA017976 // doom2.wad map14
|
||||||
{
|
{
|
||||||
// missing textures
|
// missing textures
|
||||||
|
|
|
@ -7,6 +7,7 @@ version "3.3"
|
||||||
#include "zscript/actor.txt"
|
#include "zscript/actor.txt"
|
||||||
#include "zscript/actor_checks.txt"
|
#include "zscript/actor_checks.txt"
|
||||||
#include "zscript/events.txt"
|
#include "zscript/events.txt"
|
||||||
|
#include "zscript/level_compatibility.txt"
|
||||||
|
|
||||||
#include "zscript/menu/menuitembase.txt"
|
#include "zscript/menu/menuitembase.txt"
|
||||||
#include "zscript/menu/menu.txt"
|
#include "zscript/menu/menu.txt"
|
||||||
|
|
34
wadsrc/static/zscript/level_compatibility.txt
Normal file
34
wadsrc/static/zscript/level_compatibility.txt
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -102,6 +102,12 @@ struct Side native play
|
||||||
|
|
||||||
struct Line native play
|
struct Line native play
|
||||||
{
|
{
|
||||||
|
enum ESide
|
||||||
|
{
|
||||||
|
front=0,
|
||||||
|
back=1
|
||||||
|
}
|
||||||
|
|
||||||
enum ELineFlags
|
enum ELineFlags
|
||||||
{
|
{
|
||||||
ML_BLOCKING =0x00000001, // solid, is an obstacle
|
ML_BLOCKING =0x00000001, // solid, is an obstacle
|
||||||
|
|
Loading…
Reference in a new issue