- Backend update from Raze.
Mainly optimizations for the sound system and texture manager.
This commit is contained in:
parent
79a38f1f3a
commit
941c0850ba
30 changed files with 323 additions and 261 deletions
|
|
@ -186,6 +186,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
|
|||
// The name matches, so check the texture type
|
||||
if (usetype == ETextureType::Any)
|
||||
{
|
||||
if (flags & TEXMAN_ReturnAll) return FTextureID(i); // user asked to skip all checks, including null textures.
|
||||
// All NULL textures should actually return 0
|
||||
if (texUseType == ETextureType::FirstDefined && !(flags & TEXMAN_ReturnFirst)) return 0;
|
||||
if (texUseType == ETextureType::SkinGraphic && !(flags & TEXMAN_AllowSkins)) return 0;
|
||||
|
|
@ -229,6 +230,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
|
|||
// Never return the index of NULL textures.
|
||||
if (firstfound != -1)
|
||||
{
|
||||
if (flags & TEXMAN_ReturnAll) return FTextureID(i); // user asked to skip all checks, including null textures.
|
||||
if (firsttype == ETextureType::Null) return FTextureID(0);
|
||||
if (firsttype == ETextureType::FirstDefined && !(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
|
||||
return FTextureID(firstfound);
|
||||
|
|
@ -426,7 +428,7 @@ FTextureID FTextureManager::AddGameTexture (FGameTexture *texture, bool addtohas
|
|||
hash = -1;
|
||||
}
|
||||
|
||||
TextureHash hasher = { texture, -1, -1, -1, hash };
|
||||
TextureDescriptor hasher = { texture, -1, -1, -1, hash };
|
||||
int trans = Textures.Push (hasher);
|
||||
Translation.Push (trans);
|
||||
if (bucket >= 0) HashFirst[bucket] = trans;
|
||||
|
|
@ -1150,7 +1152,7 @@ void FTextureManager::AddLocalizedVariants()
|
|||
uint32_t langid = MAKE_ID(lang[0], lang[1], lang[2], 0);
|
||||
uint64_t comboid = (uint64_t(langid) << 32) | origTex.GetIndex();
|
||||
LocalizedTextures.Insert(comboid, tex.GetIndex());
|
||||
Textures[origTex.GetIndex()].HasLocalization = true;
|
||||
Textures[origTex.GetIndex()].Flags |= TEXFLAG_HASLOCALIZATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1601,11 +1603,28 @@ void FTextureManager::SetTranslation(FTextureID fromtexnum, FTextureID totexnum)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FTextureManager::AddAlias(const char* name, FGameTexture* tex)
|
||||
void FTextureManager::AddAlias(const char* name, int texindex)
|
||||
{
|
||||
FTextureID id = tex->GetID();
|
||||
if (tex != Textures[id.GetIndex()].Texture || !tex->isValid()) return; // Whatever got passed in here was not valid, so ignore the alias.
|
||||
aliases.Insert(name, id.GetIndex());
|
||||
if (texindex < 0 || texindex >= NumTextures()) return; // Whatever got passed in here was not valid, so ignore the alias.
|
||||
aliases.Insert(name, texindex);
|
||||
}
|
||||
|
||||
void FTextureManager::Listaliases()
|
||||
{
|
||||
decltype(aliases)::Iterator it(aliases);
|
||||
decltype(aliases)::Pair* pair;
|
||||
|
||||
TArray<FString> list;
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
auto tex = GetGameTexture(pair->Value);
|
||||
list.Push(FStringf("%s -> %s%s", pair->Key.GetChars(), tex ? tex->GetName().GetChars() : "(null)", ((tex && tex->GetUseType() == ETextureType::Null) ? ", null" : "")));
|
||||
}
|
||||
std::sort(list.begin(), list.end(), [](const FString& l, const FString& r) { return l.CompareNoCase(r) < 0; });
|
||||
for (auto& s : list)
|
||||
{
|
||||
Printf("%s\n", s.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -1627,3 +1646,7 @@ CCMD(flushtextures)
|
|||
TexMan.FlushAll();
|
||||
}
|
||||
|
||||
CCMD(listtexturealiases)
|
||||
{
|
||||
TexMan.Listaliases();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue