From db7527fa438420b117698a10a52a8fbf07366160 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 22 Apr 2021 22:03:16 +0200 Subject: [PATCH] - fix sky palette in Polymost mode. --- source/build/src/polymost.cpp | 10 +++++++--- source/core/textures/skytexture.cpp | 7 +++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index dc35c2997..4e52720b6 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -396,7 +396,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal); GLInterface.SetFade(globalfloorpal); - bool success = GLInterface.SetTexture(globalskytex? globalskytex : tileGetTexture(globalpicnum), palid, sampleroverride); + bool success = GLInterface.SetTexture(globalskytex? globalskytex : tileGetTexture(globalpicnum), globalskytex? 0 : palid, sampleroverride); if (!success) { tsiz.x = tsiz.y = 1; @@ -1319,9 +1319,13 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i float const fglobalang = FixedToFloat(qglobalang); int32_t dapyscale, dapskybits, dapyoffs, daptileyscale; int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale); - globalskytex = skytile? nullptr : GetSkyTexture(globalpicnum, dapskybits, dapskyoff); + int remap = TRANSLATION(Translation_Remap + curbasepal, globalpal); + globalskytex = skytile? nullptr : GetSkyTexture(globalpicnum, dapskybits, dapskyoff, remap); int realskybits = dapskybits; - if (globalskytex) dapskybits = 0; + if (globalskytex) + { + dapskybits = 0; + } ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyscale*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect; diff --git a/source/core/textures/skytexture.cpp b/source/core/textures/skytexture.cpp index 1004353a0..55c38c571 100644 --- a/source/core/textures/skytexture.cpp +++ b/source/core/textures/skytexture.cpp @@ -43,7 +43,7 @@ FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilemap, int remap) { - char synthname[60]; + FString synthname; if ((lognumtiles == 0 && remap == 0) || lognumtiles > 4) @@ -53,12 +53,11 @@ FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilema } int numtiles = 1 << lognumtiles; - mysnprintf(synthname, 60, "%04x", basetile); + synthname.Format("Sky%04x%02x", basetile, remap); for(int i = 0; i < numtiles; i++) { - synthname[4+i] = 'A' + tilemap[i]; + synthname += 'A' + tilemap[i]; }; - synthname[4+numtiles] = 0; auto tex = TexMan.FindGameTexture(synthname); if (tex) return tex;