- Fixed: The first texture in a TEXTURE1 lump, although invalid when used

elsewhere, must be usable as sky (see Requiem.wad's SKY3.)


SVN r993 (trunk)
This commit is contained in:
Christoph Oelckers 2008-05-23 14:04:16 +00:00
parent 656d0b4ab5
commit 4434e322e2
6 changed files with 19 additions and 6 deletions

View file

@ -1,4 +1,6 @@
May 23, 2008 (Changes by Graf Zahl) May 23, 2008 (Changes by Graf Zahl)
- Fixed: The first texture in a TEXTURE1 lump, although invalid when used
elsewhere, must be usable as sky (see Requiem.wad's SKY3.)
- Fixed: side_t::GetLightLevel relied on the global 'linedef' variable for - Fixed: side_t::GetLightLevel relied on the global 'linedef' variable for
automatic fake contrast. automatic fake contrast.
- Changed: Fake contrast now uses the WALLF_AUTOCONTRAST globally instead - Changed: Fake contrast now uses the WALLF_AUTOCONTRAST globally instead

View file

@ -2043,8 +2043,8 @@ void G_DoLoadLevel (int position, bool autosave)
// DOOM determines the sky texture to be used // DOOM determines the sky texture to be used
// depending on the current episode and the game version. // depending on the current episode and the game version.
// [RH] Fetch sky parameters from FLevelLocals. // [RH] Fetch sky parameters from FLevelLocals.
sky1texture = TexMan.GetTexture (level.skypic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); sky1texture = TexMan.GetTexture (level.skypic1, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
sky2texture = TexMan.GetTexture (level.skypic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); sky2texture = TexMan.GetTexture (level.skypic2, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
// [RH] Set up details about sky rendering // [RH] Set up details about sky rendering
R_InitSkyMap (); R_InitSkyMap ();

View file

@ -5065,12 +5065,12 @@ int DLevelScript::RunScript ()
if (sky1name[0] != 0) if (sky1name[0] != 0)
{ {
strncpy (level.skypic1, sky1name, 8); strncpy (level.skypic1, sky1name, 8);
sky1texture = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); sky1texture = TexMan.GetTexture (sky1name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
} }
if (sky2name[0] != 0) if (sky2name[0] != 0)
{ {
strncpy (level.skypic2, sky2name, 8); strncpy (level.skypic2, sky2name, 8);
sky2texture = TexMan.GetTexture (sky2name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); sky2texture = TexMan.GetTexture (sky2name, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_ReturnFirst);
} }
R_InitSkyMap (); R_InitSkyMap ();
} }

View file

@ -796,6 +796,7 @@ public:
TEX_Override, // For patches between TX_START/TX_END TEX_Override, // For patches between TX_START/TX_END
TEX_Autopage, // Automap background - used to enable the use of FAutomapTexture TEX_Autopage, // Automap background - used to enable the use of FAutomapTexture
TEX_Null, TEX_Null,
TEX_FirstDefined,
}; };
struct Span struct Span
@ -945,6 +946,7 @@ public:
{ {
TEXMAN_TryAny = 1, TEXMAN_TryAny = 1,
TEXMAN_Overridable = 2, TEXMAN_Overridable = 2,
TEXMAN_ReturnFirst = 4,
}; };
int CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny); int CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);

View file

@ -807,7 +807,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
FMultiPatchTexture *tex = new FMultiPatchTexture ((const BYTE *)maptex + offset, patchlookup, numpatches, isStrife, deflumpnum); FMultiPatchTexture *tex = new FMultiPatchTexture ((const BYTE *)maptex + offset, patchlookup, numpatches, isStrife, deflumpnum);
if (i == 1 && texture1) if (i == 1 && texture1)
{ {
tex->UseType = FTexture::TEX_Null; tex->UseType = FTexture::TEX_FirstDefined;
} }
TexMan.AddTexture (tex); TexMan.AddTexture (tex);
StartScreen->Progress(); StartScreen->Progress();

View file

@ -125,6 +125,11 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
{ {
return i; return i;
} }
else if (tex->UseType == FTexture::TEX_FirstDefined && usetype == FTexture::TEX_Wall)
{
if (!(flags & TEXMAN_ReturnFirst)) return 0;
else return i;
}
else if (tex->UseType == FTexture::TEX_Null && usetype == FTexture::TEX_Wall) else if (tex->UseType == FTexture::TEX_Null && usetype == FTexture::TEX_Wall)
{ {
// We found a NULL texture on a wall -> return 0 // We found a NULL texture on a wall -> return 0
@ -147,7 +152,11 @@ int FTextureManager::CheckForTexture (const char *name, int usetype, BITFIELD fl
if ((flags & TEXMAN_TryAny) && usetype != FTexture::TEX_Any) if ((flags & TEXMAN_TryAny) && usetype != FTexture::TEX_Any)
{ {
// Never return the index of NULL textures. // Never return the index of NULL textures.
if (firstfound != -1 && firsttype == FTexture::TEX_Null) return 0; if (firstfound != -1)
{
if (firsttype == FTexture::TEX_Null) return 0;
if (firsttype == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return 0;
}
return firstfound; return firstfound;
} }