Skip to content

Commit

Permalink
updateLightMap: Dynamically adjust level when BITS_MARKED
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Sep 8, 2023
1 parent 0d0350c commit 7ab63df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/terrain.cpp
Expand Up @@ -1465,6 +1465,7 @@ static void updateLightMap()
{
MAPTILE *psTile = mapTile(i, j);
PIELIGHT colour = psTile->colour;
UBYTE level = static_cast<UBYTE>(psTile->level);

if (psTile->tileInfoBits & BITS_GATEWAY && showGateways)
{
Expand All @@ -1474,6 +1475,7 @@ static void updateLightMap()
{
int m = getModularScaledGraphicsTime(2048, 255);
colour.byte.r = MAX(m, 255 - m);
level = std::max<UBYTE>(level, colour.byte.r / 2);
}

lightMapWritePtr[(i + j * lightmapWidth) * lightmapChannels + 0] = colour.byte.r;
Expand All @@ -1482,7 +1484,7 @@ static void updateLightMap()
// store the "brightness" level in byte.a
// NOTE: This differs depending on whether using the single-pass terrain shader or the fallback terrain shaders
// (For more, see avUpdateTiles() and getTileIllumination())
lightMapWritePtr[(i + j * lightmapWidth) * lightmapChannels + 3] = static_cast<UBYTE>(psTile->level);
lightMapWritePtr[(i + j * lightmapWidth) * lightmapChannels + 3] = level;

if (!pie_GetFogStatus())
{
Expand Down

0 comments on commit 7ab63df

Please sign in to comment.