Added compatibility parameter to set wall textures

This commit is contained in:
alexey.lysiuk 2016-12-22 12:50:34 +02:00 committed by Christoph Oelckers
parent cd8aa252ae
commit de97b753f6

View file

@ -83,6 +83,7 @@ enum
CP_SECTORFLOOROFFSET, CP_SECTORFLOOROFFSET,
CP_SETSECTORSPECIAL, CP_SETSECTORSPECIAL,
CP_SETWALLYSCALE, CP_SETWALLYSCALE,
CP_SETWALLTEXTURE,
CP_SETTHINGZ, CP_SETTHINGZ,
CP_SETTAG, CP_SETTAG,
CP_SETTHINGFLAGS, CP_SETTHINGFLAGS,
@ -169,6 +170,7 @@ static const char *const WallTiers[] =
static TArray<int> CompatParams; static TArray<int> CompatParams;
static int ii_compatparams; static int ii_compatparams;
static TArray<FString> TexNames;
// CODE -------------------------------------------------------------------- // CODE --------------------------------------------------------------------
@ -320,6 +322,26 @@ void ParseCompatibility()
sc.MustGetFloat(); sc.MustGetFloat();
CompatParams.Push(int(sc.Float*65536.)); CompatParams.Push(int(sc.Float*65536.));
} }
else if (sc.Compare("setwalltexture"))
{
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
CompatParams.Push(CP_SETWALLTEXTURE);
sc.MustGetNumber();
CompatParams.Push(sc.Number);
sc.MustGetString();
CompatParams.Push(sc.MustMatchString(LineSides));
sc.MustGetString();
CompatParams.Push(sc.MustMatchString(WallTiers));
sc.MustGetString();
const FString texName = sc.String;
const unsigned int texIndex = TexNames.Find(texName);
const unsigned int texCount = TexNames.Size();
if (texIndex == texCount)
{
TexNames.Push(texName);
}
CompatParams.Push(texIndex);
}
else if (sc.Compare("setthingz")) else if (sc.Compare("setthingz"))
{ {
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
@ -587,6 +609,21 @@ void SetCompatibilityParams()
i += 5; i += 5;
break; break;
} }
case CP_SETWALLTEXTURE:
{
if (CompatParams[i + 1] < numlines)
{
side_t *side = lines[CompatParams[i + 1]].sidedef[CompatParams[i + 2]];
if (side != NULL)
{
assert(TexNames.Size() > (unsigned int)CompatParams[i + 4]);
const FTextureID texID = TexMan.GetTexture(TexNames[CompatParams[i + 4]], FTexture::TEX_Any);
side->SetTexture(CompatParams[i + 3], texID);
}
}
i += 5;
break;
}
case CP_SETTHINGZ: case CP_SETTHINGZ:
{ {
// When this is called, the things haven't been spawned yet so we can alter the position inside the MapThings array. // When this is called, the things haven't been spawned yet so we can alter the position inside the MapThings array.