- fix sky palette in Polymost mode.

This commit is contained in:
Christoph Oelckers 2021-04-22 22:03:16 +02:00
parent 6fca2de7f3
commit db7527fa43
2 changed files with 10 additions and 7 deletions

View file

@ -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); int palid = TRANSLATION(Translation_Remap + curbasepal, globalpal);
GLInterface.SetFade(globalfloorpal); 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) if (!success)
{ {
tsiz.x = tsiz.y = 1; 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); float const fglobalang = FixedToFloat(qglobalang);
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale; int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
int16_t const * dapskyoff = getpsky(globalpicnum, &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; 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; ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyscale*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect;

View file

@ -43,7 +43,7 @@
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilemap, int remap) FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilemap, int remap)
{ {
char synthname[60]; FString synthname;
if ((lognumtiles == 0 && remap == 0) || lognumtiles > 4) 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; int numtiles = 1 << lognumtiles;
mysnprintf(synthname, 60, "%04x", basetile); synthname.Format("Sky%04x%02x", basetile, remap);
for(int i = 0; i < numtiles; i++) 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); auto tex = TexMan.FindGameTexture(synthname);
if (tex) return tex; if (tex) return tex;