From 8e72e094ce15ed3bbaaf62709a47eb0a8f6fcfbd Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 17 Jan 2017 02:16:13 +0100 Subject: [PATCH] Fix floor brightness affects sprites not in sector --- src/swrenderer/scene/r_opaque_pass.cpp | 14 +++++++++++--- src/swrenderer/things/r_sprite.cpp | 5 ----- src/swrenderer/things/r_voxel.cpp | 5 ----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 8c70ab1fe..5b064e456 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -872,17 +872,25 @@ namespace swrenderer ThingSprite sprite; if (GetThingSprite(thing, sprite)) { + FDynamicColormap *thingColormap = basecolormap; + if (sec->sectornum != thing->Sector->sectornum) // compare sectornums to account for R_FakeFlat copies. + { + int lightlevel = thing->Sector->GetTexture(sector_t::ceiling) == skyflatnum ? thing->Sector->GetCeilingLight() : thing->Sector->GetFloorLight(); + spriteshade = LIGHT2SHADE(lightlevel + R_ActualExtraLight(foggy)); + thingColormap = thing->Sector->ColorMap; + } + if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) { - RenderWallSprite::Project(thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, spriteshade, foggy, basecolormap); + RenderWallSprite::Project(thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, spriteshade, foggy, thingColormap); } else if (sprite.voxel) { - RenderVoxel::Project(thing, sprite.pos, sprite.voxel, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, spriteshade, foggy, basecolormap); + RenderVoxel::Project(thing, sprite.pos, sprite.voxel, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, spriteshade, foggy, thingColormap); } else { - RenderSprite::Project(thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, spriteshade, foggy, basecolormap); + RenderSprite::Project(thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, spriteshade, foggy, thingColormap); } } } diff --git a/src/swrenderer/things/r_sprite.cpp b/src/swrenderer/things/r_sprite.cpp index 6de827674..d237348f4 100644 --- a/src/swrenderer/things/r_sprite.cpp +++ b/src/swrenderer/things/r_sprite.cpp @@ -216,11 +216,6 @@ namespace swrenderer if (vis->RenderStyle.Flags & STYLEF_InvertSource) invertcolormap = !invertcolormap; - if (current_sector->sectornum != thing->Sector->sectornum) // compare sectornums to account for R_FakeFlat copies. - { - basecolormap = thing->Sector->ColorMap; - } - if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && basecolormap->Fade != 0) { basecolormap = GetSpecialLights(basecolormap->Color, 0, basecolormap->Desaturate); diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index 664df761e..7706da69b 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -166,11 +166,6 @@ namespace swrenderer invertcolormap = !invertcolormap; } - if (current_sector->sectornum != thing->Sector->sectornum) // compare sectornums to account for R_FakeFlat copies. - { - basecolormap = thing->Sector->ColorMap; - } - // Sprites that are added to the scene must fade to black. if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && basecolormap->Fade != 0) {