diff --git a/src/compatibility.cpp b/src/compatibility.cpp index cf2aa78ab..04b3f2ce3 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -83,6 +83,7 @@ enum CP_SECTORFLOOROFFSET, CP_SETSECTORSPECIAL, CP_SETWALLYSCALE, + CP_SETWALLTEXTURE, CP_SETTHINGZ, CP_SETTAG, CP_SETTHINGFLAGS, @@ -169,6 +170,7 @@ static const char *const WallTiers[] = static TArray CompatParams; static int ii_compatparams; +static TArray TexNames; // CODE -------------------------------------------------------------------- @@ -320,6 +322,26 @@ void ParseCompatibility() sc.MustGetFloat(); 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")) { if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); @@ -587,6 +609,21 @@ void SetCompatibilityParams() i += 5; 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: { // When this is called, the things haven't been spawned yet so we can alter the position inside the MapThings array.