- added precaching of textures via MAPINFO.

This commit is contained in:
Christoph Oelckers 2015-03-29 13:02:45 +02:00
parent 267054071f
commit 3849cb8623
3 changed files with 26 additions and 0 deletions

View file

@ -336,6 +336,7 @@ struct level_info_t
TArray<FSpecialAction> specialactions;
TArray<FSoundID> PrecacheSounds;
TArray<FTextureID> PrecacheTextures;
level_info_t()
{

View file

@ -1065,6 +1065,25 @@ DEFINE_MAP_OPTION(PrecacheSounds, true)
} while (parse.sc.CheckString(","));
}
DEFINE_MAP_OPTION(PrecacheTextures, true)
{
parse.ParseAssign();
do
{
parse.sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(parse.sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst);
if (!tex.isValid())
{
parse.sc.ScriptMessage("Unknown texture \"%s\"", parse.sc.String);
}
else
{
info->PrecacheTextures.Push(tex);
}
} while (parse.sc.CheckString(","));
}
DEFINE_MAP_OPTION(redirect, true)
{
parse.ParseAssign();

View file

@ -1243,6 +1243,12 @@ void FTextureManager::PrecacheLevel (void)
memset (hitlist, 0, cnt);
screen->GetHitlist(hitlist);
for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++)
{
hitlist[level.info->PrecacheTextures[i].GetIndex()] |= 1;
}
for (int i = cnt - 1; i >= 0; i--)
{
Renderer->PrecacheTexture(ByIndex(i), hitlist[i]);