From 81f521fe562bd5e562ce08bf2dce33007dd6d9c6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 2 Dec 2015 22:31:27 +0100 Subject: [PATCH] - fixed: Texture precaching from MAPINFO was broken The code assumed that it had access to the texture manager but that gets initialized after MAPINFO, which means that MAPINFO can only store the texture names and let the precaching code resolve the actual textures. --- src/g_level.h | 2 +- src/g_mapinfo.cpp | 11 ++--------- src/textures/texturemanager.cpp | 3 ++- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index 018737f09..2e8e8e4c5 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -339,7 +339,7 @@ struct level_info_t TArray specialactions; TArray PrecacheSounds; - TArray PrecacheTextures; + TArray PrecacheTextures; level_info_t() { diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index ac938797d..9dace3e23 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1077,15 +1077,8 @@ DEFINE_MAP_OPTION(PrecacheTextures, true) 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); - } + //the texture manager is not initialized here so all we can do is store the texture's name. + info->PrecacheTextures.Push(parse.sc.String); } while (parse.sc.CheckString(",")); } diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 2944e4200..4fc82ac0d 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1246,7 +1246,8 @@ void FTextureManager::PrecacheLevel (void) for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++) { - hitlist[level.info->PrecacheTextures[i].GetIndex()] |= FTextureManager::HIT_Wall; + FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst); + if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall; } for (int i = cnt - 1; i >= 0; i--)