@ -851,14 +851,16 @@ void Crawler::RenderWorld(float fElapsedTime){
}
# pragma region Foreground Rendering
for ( TileGroup & group : foregroundTileGroups ) {
if ( geom2d : : overlaps ( group . GetRange ( ) , player . pos ) ) {
group . playerBehind = true ;
} else {
group . playerBehind = false ;
}
if ( view . IsRectVisible ( group . GetRange ( ) . pos , group . GetRange ( ) . size ) ) {
if ( geom2d : : overlaps ( group . GetFadeRange ( ) , player . pos ) ) {
group . playerBehind = true ;
group . fadeFactor = std : : min ( group . fadeFactor + fElapsedTime , TileGroup : : FADE_TIME ) ;
} else {
group . playerBehind = false ;
group . fadeFactor = std : : max ( group . fadeFactor - fElapsedTime , 0.f ) ;
}
for ( TileRenderData & tile : group . GetTiles ( ) ) {
view . DrawPartialDecal ( tile . pos , { 24 , 24 } , tile . tileset , tile . tileSheetPos , { 24 , 24 } , { 255 , 255 , 255 , uint8_t ( group . playerBehind ? 128 : 255 ) } ) ;
view . DrawPartialDecal ( tile . pos , { 24 , 24 } , tile . tileset , tile . tileSheetPos , { 24 , 24 } , { 255 , 255 , 255 , uint8_t ( 255 - group . fadeFactor / TileGroup : : FADE_TIME * TileGroup : : FADE_AMT ) } ) ;
}
}
}