From b5ad3b9f3b948b78ea2ff010a961e8cc7ce44a4d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 25 Nov 2022 12:33:52 +0100 Subject: [PATCH] - imported two fixes from GZDoom --- source/common/models/models_iqm.cpp | 2 +- source/common/textures/texturemanager.cpp | 5 +++-- source/common/textures/texturemanager.h | 10 +++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/source/common/models/models_iqm.cpp b/source/common/models/models_iqm.cpp index 95c2549de..9d4ab2652 100644 --- a/source/common/models/models_iqm.cpp +++ b/source/common/models/models_iqm.cpp @@ -436,7 +436,7 @@ int IQMModel::FindFrame(const char* name, bool nodefault) { // [MK] allow looking up frames by animation name plus offset (using a colon as separator) const char* colon = strrchr(name,':'); - int nlen = (colon==nullptr)?strlen(name):(colon-name); + size_t nlen = (colon==nullptr)?strlen(name):(colon-name); for (unsigned i = 0; i < Anims.Size(); i++) { if (!strnicmp(name, Anims[i].Name.GetChars(), nlen)) diff --git a/source/common/textures/texturemanager.cpp b/source/common/textures/texturemanager.cpp index 21b9013f7..ebdfab465 100644 --- a/source/common/textures/texturemanager.cpp +++ b/source/common/textures/texturemanager.cpp @@ -1300,11 +1300,12 @@ void FTextureManager::InitPalettedVersions() // //========================================================================== -FTextureID FTextureManager::GetRawTexture(FTextureID texid) +FTextureID FTextureManager::GetRawTexture(FTextureID texid, bool dontlookup) { int texidx = texid.GetIndex(); if ((unsigned)texidx >= Textures.Size()) return texid; - if (Textures[texidx].FrontSkyLayer != -1) return FSetTextureID(Textures[texidx].FrontSkyLayer); + if (Textures[texidx].RawTexture != -1) return FSetTextureID(Textures[texidx].RawTexture); + if (dontlookup) return texid; // Reject anything that cannot have been a front layer for the sky in original Hexen, i.e. it needs to be an unscaled wall texture only using Doom patches. auto tex = Textures[texidx].Texture; diff --git a/source/common/textures/texturemanager.h b/source/common/textures/texturemanager.h index bed10e659..7d9815991 100644 --- a/source/common/textures/texturemanager.h +++ b/source/common/textures/texturemanager.h @@ -77,7 +77,15 @@ public: void FlushAll(); FTextureID GetFrontSkyLayer(FTextureID); - FTextureID GetRawTexture(FTextureID); + FTextureID GetRawTexture(FTextureID tex, bool dontlookup = false); + void SetRawTexture(FTextureID texid) + { + int texidx = texid.GetIndex(); + if ((unsigned)texidx < Textures.Size()) + { + Textures[texidx].RawTexture = texidx; + } + } enum