- added global per-mod precaching lists, to be defined in MAPINFO's Gameinfo section.

This commit is contained in:
Christoph Oelckers 2017-01-10 01:00:06 +01:00
parent 96788850d3
commit 46179936ec
4 changed files with 22 additions and 0 deletions

View File

@ -307,6 +307,9 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_STRINGARRAY(finalePages, "finalePage", 8, true)
GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false)
GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8, true)
GAMEINFOKEY_STRINGARRAY(PrecachedClasses, "precacheclasses", 0, false)
GAMEINFOKEY_STRINGARRAY(PrecachedTextures, "precachetextures", 0, false)
GAMEINFOKEY_STRINGARRAY(PrecachedSounds, "precachesounds", 0, false)
GAMEINFOKEY_STRING(PauseSign, "pausesign")
GAMEINFOKEY_STRING(quitSound, "quitSound")
GAMEINFOKEY_STRING(BorderFlat, "borderFlat")

View File

@ -36,6 +36,7 @@
#include "basictypes.h"
#include "zstring.h"
#include "s_sound.h"
// Flags are not user configurable and only depend on the standard IWADs
#define GI_MAPxx 0x00000001
@ -120,6 +121,10 @@ struct gameinfo_t
TArray<FName> DefaultWeaponSlots[10];
TArray<FName> PlayerClasses;
TArray<FName> PrecachedClasses;
TArray<FString> PrecachedTextures;
TArray<FSoundID> PrecachedSounds;
FString titleMusic;
int titleOrder;
float titleTime;

View File

@ -3360,6 +3360,11 @@ static void P_PrecacheLevel()
actorhitlist[actor->GetClass()] = true;
}
for (auto n : gameinfo.PrecachedClasses)
{
PClassActor *cls = PClass::FindActor(n);
if (cls != NULL) actorhitlist[cls] = true;
}
for (unsigned i = 0; i < level.info->PrecacheClasses.Size(); i++)
{
// level.info can only store names, no class pointers.
@ -3396,6 +3401,11 @@ static void P_PrecacheLevel()
hitlist[sky2texture.GetIndex()] |= FTextureManager::HIT_Sky;
}
for (auto n : gameinfo.PrecachedTextures)
{
FTextureID tex = TexMan.CheckForTexture(n, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);
if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall;
}
for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++)
{
FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable | FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ReturnFirst);

View File

@ -481,6 +481,10 @@ void S_PrecacheLevel ()
{
actor->MarkPrecacheSounds();
}
for (auto i : gameinfo.PrecachedSounds)
{
level.info->PrecacheSounds[i].MarkUsed();
}
// Precache all extra sounds requested by this map.
for (i = 0; i < level.info->PrecacheSounds.Size(); ++i)
{