Merge branch 'master' into zscript

This commit is contained in:
Christoph Oelckers 2016-10-26 12:18:06 +02:00
commit d4ea991763
4 changed files with 36 additions and 11 deletions

View file

@ -292,7 +292,6 @@ void FIWadManager::ParseIWadInfos(const char *fn)
int FIWadManager::ScanIWAD (const char *iwad) int FIWadManager::ScanIWAD (const char *iwad)
{ {
FResourceFile *iwadfile = FResourceFile::OpenResourceFile(iwad, NULL, true); FResourceFile *iwadfile = FResourceFile::OpenResourceFile(iwad, NULL, true);
if (iwadfile == NULL) iwadfile = FResourceFile::OpenDirectory(iwad, true); //mxd. A directory can also work as an IWAD
if (iwadfile != NULL) if (iwadfile != NULL)
{ {
@ -345,7 +344,7 @@ int FIWadManager::CheckIWAD (const char *doomwaddir, WadStuff *wads)
iwad.Format ("%s%s%s", doomwaddir, slash, mIWadNames[i].GetChars()); iwad.Format ("%s%s%s", doomwaddir, slash, mIWadNames[i].GetChars());
FixPathSeperator (iwad); FixPathSeperator (iwad);
if (DirEntryExists(iwad)) if (FileExists (iwad))
{ {
wads[i].Type = ScanIWAD (iwad); wads[i].Type = ScanIWAD (iwad);
if (wads[i].Type != -1) if (wads[i].Type != -1)
@ -414,7 +413,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
} }
else else
{ {
if(FileExists(custwad)) DefaultExtension (custwad, ".wad"); //mxd. Don't treat folders as .wads DefaultExtension (custwad, ".wad");
iwadparm = custwad; iwadparm = custwad;
mIWadNames[0] = custwad; mIWadNames[0] = custwad;
CheckIWAD ("", &wads[0]); CheckIWAD ("", &wads[0]);

View file

@ -297,8 +297,6 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
Printf ("Texture %s is left without any patches\n", Name.GetChars()); Printf ("Texture %s is left without any patches\n", Name.GetChars());
} }
CheckForHacks ();
DefinitionLump = deflumpnum; DefinitionLump = deflumpnum;
} }
@ -1323,6 +1321,29 @@ void FMultiPatchTexture::ResolvePatches()
for (int i = 0; i < NumParts; i++) for (int i = 0; i < NumParts; i++)
{ {
FTextureID texno = TexMan.CheckForTexture(Inits[i].TexName, Inits[i].UseType); FTextureID texno = TexMan.CheckForTexture(Inits[i].TexName, Inits[i].UseType);
if (texno == id) // we found ourselves. Try looking for another one with the same name which is not a multipatch texture itself.
{
TArray<FTextureID> list;
TexMan.ListTextures(Inits[i].TexName, list, true);
for (int i = list.Size() - 1; i >= 0; i--)
{
if (list[i] != id && !TexMan[list[i]]->bMultiPatch)
{
texno = list[i];
break;
}
}
if (texno == id)
{
if (Inits[i].HasLine) Inits[i].sc.Message(MSG_WARNING, "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars());
else Printf(TEXTCOLOR_YELLOW "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars());
}
else
{
// If it could be resolved, just print a developer warning.
DPrintf(DMSG_WARNING, "Resolved self-referencing texture by picking an older entry for %s", Inits[i].TexName.GetChars());
}
}
if (!texno.isValid()) if (!texno.isValid())
{ {
@ -1352,6 +1373,8 @@ void FMultiPatchTexture::ResolvePatches()
delete[] Inits; delete[] Inits;
Inits = nullptr; Inits = nullptr;
CheckForHacks();
// If this texture is just a wrapper around a single patch, we can simply // If this texture is just a wrapper around a single patch, we can simply
// forward GetPixels() and GetColumn() calls to that patch. // forward GetPixels() and GetColumn() calls to that patch.

View file

@ -267,7 +267,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
// //
//========================================================================== //==========================================================================
int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list) int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list, bool listall)
{ {
int i; int i;
@ -293,12 +293,15 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list)
// NULL textures must be ignored. // NULL textures must be ignored.
if (tex->UseType!=FTexture::TEX_Null) if (tex->UseType!=FTexture::TEX_Null)
{ {
unsigned int j; unsigned int j = list.Size();
if (!listall)
{
for (j = 0; j < list.Size(); j++) for (j = 0; j < list.Size(); j++)
{ {
// Check for overriding definitions from newer WADs // Check for overriding definitions from newer WADs
if (Textures[list[j].GetIndex()].Texture->UseType == tex->UseType) break; if (Textures[list[j].GetIndex()].Texture->UseType == tex->UseType) break;
} }
}
if (j==list.Size()) list.Push(FTextureID(i)); if (j==list.Size()) list.Push(FTextureID(i));
} }
} }

View file

@ -350,7 +350,7 @@ public:
FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny); FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0); FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0);
int ListTextures (const char *name, TArray<FTextureID> &list); int ListTextures (const char *name, TArray<FTextureID> &list, bool listall = false);
void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false); void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false);
void AddTexturesLumps (int lump1, int lump2, int patcheslump); void AddTexturesLumps (int lump1, int lump2, int patcheslump);