- Changed: Textures without a name no longer get added to the texture manager's
hash chains. - Fixed: specifying texture patches or font characters by full lump name instead of texture name didn't work. To do this properly the texture manager needs an option to look for a texture by lump number so that such textures can be maintained without interfering with regular operation. - added 'skystretch' and 'autosequences' keywords for MAPINFO so that the effects of 'noautosequences' and 'forcenoskystretch' can be cancelled. - Added a 'gamedefaults' section to MAPINFO after discovering that 'defaultmap' gets reset for each MAPINFO. A global section is needed to define a game's default setting in zdoom.pk3. The gamedefaults should normally not be changed by PWADs but it can be done if some mod intends to change gameplay settings but wants to allow custom add-ons on its own. SVN r1300 (trunk)
This commit is contained in:
parent
c35be830c3
commit
3f2d5db348
19 changed files with 212 additions and 145 deletions
|
|
@ -211,6 +211,30 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list)
|
|||
return list.Size();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: FindTextureByLumpNum
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureID FTextureManager::FindTextureByLumpNum (int lumpnum)
|
||||
{
|
||||
if (lumpnum < 0)
|
||||
{
|
||||
return FTextureID(-1);
|
||||
}
|
||||
// This can't use hashing because using ReplaceTexture would break the hash chains. :(
|
||||
for(unsigned i = 0; i <Textures.Size(); i++)
|
||||
{
|
||||
if (Textures[i].Texture->SourceLump == lumpnum)
|
||||
{
|
||||
return FTextureID(i);
|
||||
}
|
||||
}
|
||||
return FTextureID(-1);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: GetTextures
|
||||
|
|
@ -273,12 +297,29 @@ void FTextureManager::UnloadAll ()
|
|||
|
||||
FTextureID FTextureManager::AddTexture (FTexture *texture)
|
||||
{
|
||||
size_t bucket;
|
||||
int hash;
|
||||
|
||||
if (texture == NULL) return FTextureID(-1);
|
||||
|
||||
// Later textures take precedence over earlier ones
|
||||
size_t bucket = MakeKey (texture->Name) % HASH_SIZE;
|
||||
TextureHash hasher = { texture, HashFirst[bucket] };
|
||||
|
||||
// Textures without name can't be looked for
|
||||
if (texture->Name[0] != 0)
|
||||
{
|
||||
bucket = MakeKey (texture->Name) % HASH_SIZE;
|
||||
hash = HashFirst[bucket];
|
||||
}
|
||||
else
|
||||
{
|
||||
bucket = -1;
|
||||
hash = -1;
|
||||
}
|
||||
|
||||
TextureHash hasher = { texture, hash };
|
||||
int trans = Textures.Push (hasher);
|
||||
Translation.Push (trans);
|
||||
HashFirst[bucket] = trans;
|
||||
if (bucket >= 0) HashFirst[bucket] = trans;
|
||||
return FTextureID(trans);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue