Skip to content

Commit

Permalink
- added guards against badly defined skies.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jan 22, 2022
1 parent 276597f commit 747648c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/build/src/polymost.cpp
Expand Up @@ -1309,7 +1309,7 @@ static void polymost_flatskyrender(FVector2 const* const dpxy, int32_t const n,

float const fglobalang = FixedToFloat(qglobalang);
auto sky = getSky(globalpicnum);
int32_t dapskybits = sky.lognumtiles, dapyoffs = sky.pmoffset, daptileyscale = sky.scale * 65536;
int32_t dapskybits = clamp(sky.lognumtiles, 0, 4), dapyoffs = sky.pmoffset, daptileyscale = sky.scale * 65536;
int16_t const * dapskyoff = sky.offsets;

int remap = TRANSLATION(Translation_Remap + curbasepal, globalpal);
Expand Down
2 changes: 1 addition & 1 deletion source/core/textures/skytexture.cpp
Expand Up @@ -46,7 +46,7 @@ FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilema
FString synthname;


if ((lognumtiles == 0 && remap == 0) || lognumtiles > 4)
if ((lognumtiles == 0 && remap == 0) || lognumtiles > 4 || lognumtiles < 0)
{
// no special handling - let the old code do its job as-is
return nullptr;
Expand Down

0 comments on commit 747648c

Please sign in to comment.