- Changed FImageCollection so that it accepts a matching texture of any type.

This is necessary to load hires sprite replacements for certain icons.


SVN r655 (trunk)
This commit is contained in:
Christoph Oelckers 2007-12-28 22:00:41 +00:00
parent a329efe9a4
commit 5e56a6512a
4 changed files with 6 additions and 4 deletions

View file

@ -1,4 +1,6 @@
December 28, 2007 (Changes by Graf Zahl) December 28, 2007 (Changes by Graf Zahl)
- Changed FImageCollection so that it accepts a matching texture of any type.
This is necessary to load hires sprite replacements for certain icons.
- Added a check to Wads.CheckNumForName to return -1 for names longer than - Added a check to Wads.CheckNumForName to return -1 for names longer than
8 characters which contain path separators. 8 characters which contain path separators.
- Fixed: Hires texture replacement must replace all matching textures, not - Fixed: Hires texture replacement must replace all matching textures, not

View file

@ -290,13 +290,13 @@ void FTextureManager::ReplaceTexture (int picnum, FTexture *newtexture, bool fre
} }
} }
int FTextureManager::AddPatch (const char *patchname, int namespc) int FTextureManager::AddPatch (const char *patchname, int namespc, bool tryany)
{ {
if (patchname == NULL) if (patchname == NULL)
{ {
return -1; return -1;
} }
int lumpnum = CheckForTexture (patchname, FTexture::TEX_MiscPatch, false); int lumpnum = CheckForTexture (patchname, FTexture::TEX_MiscPatch, tryany);
if (lumpnum >= 0) if (lumpnum >= 0)
{ {

View file

@ -810,7 +810,7 @@ public:
int CreateTexture (int lumpnum, int usetype=FTexture::TEX_Any); // Also calls AddTexture int CreateTexture (int lumpnum, int usetype=FTexture::TEX_Any); // Also calls AddTexture
int AddTexture (FTexture *texture); int AddTexture (FTexture *texture);
int AddPatch (const char *patchname, int namespc=0); int AddPatch (const char *patchname, int namespc=0, bool tryany = false);
// Replaces one texture with another. The new texture will be assigned // Replaces one texture with another. The new texture will be assigned
// the same name, slot, and use type as the texture it is replacing. // the same name, slot, and use type as the texture it is replacing.

View file

@ -60,7 +60,7 @@ void FImageCollection::Init (const char **patchNames, int numPatches, int namesp
for (int i = 0; i < numPatches; ++i) for (int i = 0; i < numPatches; ++i)
{ {
int picnum = TexMan.AddPatch (patchNames[i], namespc); int picnum = TexMan.AddPatch (patchNames[i], namespc, true);
if (picnum == -1 && namespc != ns_sprites) if (picnum == -1 && namespc != ns_sprites)
{ {