mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 15:11:46 +00:00
- added precaching of textures via MAPINFO.
This commit is contained in:
parent
267054071f
commit
3849cb8623
3 changed files with 26 additions and 0 deletions
|
@ -336,6 +336,7 @@ struct level_info_t
|
|||
TArray<FSpecialAction> specialactions;
|
||||
|
||||
TArray<FSoundID> PrecacheSounds;
|
||||
TArray<FTextureID> PrecacheTextures;
|
||||
|
||||
level_info_t()
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue