mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- disabled the automatic location feature in the texture manager.
For something that was never used it is simply too costly as it sits in a critical segment of code where it prevents optimization of multiple calls to GetGameTexture in a code block. If this ever gets reimplemented it must be on a higher level - this simply does not work right.
This commit is contained in:
parent
afa821c2fd
commit
e37de147dc
1 changed files with 14 additions and 14 deletions
|
@ -25,50 +25,50 @@ public:
|
||||||
private:
|
private:
|
||||||
int ResolveLocalizedTexture(int texnum);
|
int ResolveLocalizedTexture(int texnum);
|
||||||
|
|
||||||
int ResolveTextureIndex(int texnum, bool animate, bool localize)
|
int ResolveTextureIndex(int texnum, bool animate) const
|
||||||
{
|
{
|
||||||
if ((unsigned)texnum >= Textures.Size()) return -1;
|
if ((unsigned)texnum >= Textures.Size()) return -1;
|
||||||
if (animate) texnum = Translation[texnum];
|
if (animate) texnum = Translation[texnum];
|
||||||
if (localize && Textures[texnum].Flags & TEXFLAG_HASLOCALIZATION) texnum = ResolveLocalizedTexture(texnum);
|
//if (localize && Textures[texnum].Flags & TEXFLAG_HASLOCALIZATION) texnum = ResolveLocalizedTexture(texnum);
|
||||||
return texnum;
|
return texnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGameTexture *InternalGetTexture(int texnum, bool animate, bool localize)
|
FGameTexture *InternalGetTexture(int texnum, bool animate) const
|
||||||
{
|
{
|
||||||
texnum = ResolveTextureIndex(texnum, animate, localize);
|
texnum = ResolveTextureIndex(texnum, animate);
|
||||||
if (texnum == -1) return nullptr;
|
if (texnum == -1) return nullptr;
|
||||||
return Textures[texnum].Texture;
|
return Textures[texnum].Texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
FTextureID ResolveTextureIndex(FTextureID texid, bool animate) const
|
||||||
FTextureID ResolveTextureIndex(FTextureID texid, bool animate, bool localize)
|
|
||||||
{
|
{
|
||||||
return FSetTextureID(ResolveTextureIndex(texid.GetIndex(), animate, localize));
|
return FSetTextureID(ResolveTextureIndex(texid.GetIndex(), animate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
// This only gets used in UI code so we do not need PALVERS handling.
|
// This only gets used in UI code so we do not need PALVERS handling.
|
||||||
FGameTexture* GetGameTextureByName(const char *name, bool animate = false, int flags = 0)
|
FGameTexture* GetGameTextureByName(const char *name, bool animate = false, int flags = 0)
|
||||||
{
|
{
|
||||||
FTextureID texnum = GetTextureID(name, ETextureType::MiscPatch, flags);
|
FTextureID texnum = GetTextureID(name, ETextureType::MiscPatch, flags);
|
||||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
return InternalGetTexture(texnum.GetIndex(), animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGameTexture* GetGameTexture(FTextureID texnum, bool animate = false)
|
FGameTexture* GetGameTexture(FTextureID texnum, bool animate = false) const
|
||||||
{
|
{
|
||||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
return InternalGetTexture(texnum.GetIndex(), animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGameTexture* GetPalettedTexture(FTextureID texnum, bool animate = false, bool allowsubstitute = true)
|
FGameTexture* GetPalettedTexture(FTextureID texnum, bool animate = false, bool allowsubstitute = true) const
|
||||||
{
|
{
|
||||||
auto texid = ResolveTextureIndex(texnum.GetIndex(), animate, true);
|
auto texid = ResolveTextureIndex(texnum.GetIndex(), animate);
|
||||||
if (texid == -1) return nullptr;
|
if (texid == -1) return nullptr;
|
||||||
if (allowsubstitute && Textures[texid].Paletted > 0) texid = Textures[texid].Paletted;
|
if (allowsubstitute && Textures[texid].Paletted > 0) texid = Textures[texid].Paletted;
|
||||||
return Textures[texid].Texture;
|
return Textures[texid].Texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGameTexture* GameByIndex(int i, bool animate = false)
|
FGameTexture* GameByIndex(int i, bool animate = false) const
|
||||||
{
|
{
|
||||||
return InternalGetTexture(i, animate, true);
|
return InternalGetTexture(i, animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGameTexture* FindGameTexture(const char* texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
|
FGameTexture* FindGameTexture(const char* texname, ETextureType usetype = ETextureType::MiscPatch, BITFIELD flags = TEXMAN_TryAny);
|
||||||
|
|
Loading…
Reference in a new issue