From e154ff888deef310a891c84e95cf79cd3b988e22 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 17 Jan 2017 01:43:45 +0100 Subject: [PATCH] Implement the todo that someone left in the source code --- src/swrenderer/things/r_sprite.cpp | 9 ++++----- src/swrenderer/things/r_voxel.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/swrenderer/things/r_sprite.cpp b/src/swrenderer/things/r_sprite.cpp index e58e5b428..6de827674 100644 --- a/src/swrenderer/things/r_sprite.cpp +++ b/src/swrenderer/things/r_sprite.cpp @@ -216,21 +216,20 @@ namespace swrenderer if (vis->RenderStyle.Flags & STYLEF_InvertSource) invertcolormap = !invertcolormap; - FDynamicColormap *mybasecolormap = basecolormap; if (current_sector->sectornum != thing->Sector->sectornum) // compare sectornums to account for R_FakeFlat copies. { - // Todo: The actor is from a different sector so we have to retrieve the proper basecolormap for that sector. + basecolormap = thing->Sector->ColorMap; } - if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && basecolormap->Fade != 0) { - mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); + basecolormap = GetSpecialLights(basecolormap->Color, 0, basecolormap->Desaturate); } bool fullbright = !vis->foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)); bool fadeToBlack = (vis->RenderStyle.Flags & STYLEF_FadeToBlack) != 0; - vis->SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, mybasecolormap, fullbright, invertcolormap, fadeToBlack); + vis->SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack); VisibleSpriteList::Instance()->Push(vis); } diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index b34caf1e4..664df761e 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -166,22 +166,21 @@ namespace swrenderer invertcolormap = !invertcolormap; } - FDynamicColormap *mybasecolormap = basecolormap; if (current_sector->sectornum != thing->Sector->sectornum) // compare sectornums to account for R_FakeFlat copies. { - // Todo: The actor is from a different sector so we have to retrieve the proper basecolormap for that sector. + basecolormap = thing->Sector->ColorMap; } // Sprites that are added to the scene must fade to black. - if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && basecolormap->Fade != 0) { - mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); + basecolormap = GetSpecialLights(basecolormap->Color, 0, basecolormap->Desaturate); } bool fullbright = !vis->foggy && ((renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)); bool fadeToBlack = (vis->RenderStyle.Flags & STYLEF_FadeToBlack) != 0; - vis->SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, mybasecolormap, fullbright, invertcolormap, fadeToBlack); + vis->SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack); VisibleSpriteList::Instance()->Push(vis); RenderTranslucentPass::DrewAVoxel = true;