From 46179936ec8c2c035fe80a5e0212e101e783a698 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 10 Jan 2017 01:00:06 +0100 Subject: [PATCH] - added global per-mod precaching lists, to be defined in MAPINFO's Gameinfo section. --- src/gi.cpp | 3 +++ src/gi.h | 5 +++++ src/p_setup.cpp | 10 ++++++++++ src/s_sound.cpp | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/src/gi.cpp b/src/gi.cpp index 9d45d2724..c82128889 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -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") diff --git a/src/gi.h b/src/gi.h index c5b8f79cf..d9e81bcf1 100644 --- a/src/gi.h +++ b/src/gi.h @@ -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 DefaultWeaponSlots[10]; TArray PlayerClasses; + TArray PrecachedClasses; + TArray PrecachedTextures; + TArray PrecachedSounds; + FString titleMusic; int titleOrder; float titleTime; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 82a2adc9c..8c8476be0 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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); diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 3888ee3dc..3a9ae5ea1 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -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) {