- Added support for a PALVERS lump. This specifies replacement textures to

be used when for walls and floors when the renderer is paletted. The format
  is very simple:
    rgbtex1 paltex1
    rgbtex2 paltex2
    ...
  The first texture is the one to be used normally, and the second is the one
  to be used in paletted modes.

  The vid_nopalsubstitutions cvar can be used to ignore this lump.



SVN r3311 (trunk)
This commit is contained in:
Randy Heit 2011-11-04 01:12:53 +00:00
commit 9acf65b9a4
4 changed files with 95 additions and 29 deletions

View file

@ -55,6 +55,8 @@
FTextureManager TexMan;
CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE)
//==========================================================================
//
// FTextureManager :: FTextureManager
@ -749,7 +751,7 @@ void FTextureManager::AddPatches (int lumpnum)
{
file->Read (name, 8);
if (CheckForTexture (name, FTexture::TEX_WallPatch, false) == -1)
if (CheckForTexture (name, FTexture::TEX_WallPatch, 0) == -1)
{
CreateTexture (Wads.CheckNumForName (name, ns_patches), FTexture::TEX_WallPatch);
}
@ -1001,6 +1003,57 @@ void FTextureManager::Init()
InitAnimDefs();
FixAnimations();
InitSwitchList();
InitPalettedVersions();
}
//==========================================================================
//
// FTextureManager :: InitPalettedVersions
//
//==========================================================================
void FTextureManager::InitPalettedVersions()
{
int lump, lastlump = 0;
PalettedVersions.Clear();
while ((lump = Wads.FindLump("PALVERS", &lastlump)) != -1)
{
FScanner sc(lump);
while (sc.GetString())
{
FTextureID pic1 = CheckForTexture(sc.String, FTexture::TEX_Any);
if (!pic1.isValid())
{
sc.ScriptMessage("Unknown texture %s to replace");
}
sc.MustGetString();
FTextureID pic2 = CheckForTexture(sc.String, FTexture::TEX_Any);
if (!pic2.isValid())
{
sc.ScriptMessage("Unknown texture %s to use as replacement");
}
if (pic1.isValid() && pic2.isValid())
{
PalettedVersions[pic1.GetIndex()] = pic2.GetIndex();
}
}
}
}
//==========================================================================
//
// FTextureManager :: PalCheck
//
//==========================================================================
FTextureID FTextureManager::PalCheck(FTextureID tex)
{
if (vid_nopalsubstitutions) return tex;
int *newtex = PalettedVersions.CheckKey(tex.GetIndex());
if (newtex == NULL || *newtex == 0) return tex;
return *newtex;
}
//==========================================================================
@ -1152,6 +1205,7 @@ int FTextureManager::CountLumpTextures (int lumpnum)
//
// R_PrecacheLevel
//
// Preloads all relevant graphics for the level.
//
//===========================================================================