Skip to content

Commit

Permalink
- fix sky palette in Polymost mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Apr 22, 2021
1 parent 6fca2de commit db7527f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 7 additions & 3 deletions source/build/src/polymost.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
7 changes: 3 additions & 4 deletions source/core/textures/skytexture.cpp
Expand Up @@ -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)
Expand All @@ -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;

Expand Down

0 comments on commit db7527f

Please sign in to comment.