- 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(finalePages, "finalePage", 8, true)
GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false) GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false)
GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8, true) 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(PauseSign, "pausesign")
GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_STRING(quitSound, "quitSound")
GAMEINFOKEY_STRING(BorderFlat, "borderFlat") GAMEINFOKEY_STRING(BorderFlat, "borderFlat")

View file

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

View file

@ -3360,6 +3360,11 @@ static void P_PrecacheLevel()
actorhitlist[actor->GetClass()] = true; 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++) for (unsigned i = 0; i < level.info->PrecacheClasses.Size(); i++)
{ {
// level.info can only store names, no class pointers. // level.info can only store names, no class pointers.
@ -3396,6 +3401,11 @@ static void P_PrecacheLevel()
hitlist[sky2texture.GetIndex()] |= FTextureManager::HIT_Sky; 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++) 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); 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(); actor->MarkPrecacheSounds();
} }
for (auto i : gameinfo.PrecachedSounds)
{
level.info->PrecacheSounds[i].MarkUsed();
}
// Precache all extra sounds requested by this map. // Precache all extra sounds requested by this map.
for (i = 0; i < level.info->PrecacheSounds.Size(); ++i) for (i = 0; i < level.info->PrecacheSounds.Size(); ++i)
{ {