- fixed: Software renderer's colormap variables should not be accessed from common renderer interface code.

This commit is contained in:
Christoph Oelckers 2015-06-04 09:20:55 +02:00
parent c1bbd81762
commit ae3b52a68a
2 changed files with 7 additions and 11 deletions

View file

@ -267,6 +267,11 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
BYTE *Pixels = const_cast<BYTE*>(tex->GetPixels());
DSimpleCanvas *Canvas = tex->GetCanvas();
// curse Doom's overuse of global variables in the renderer.
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
unsigned char *savecolormap = fixedcolormap;
FSpecialColormap *savecm = realfixedcolormap;
float savedfov = LastFOV;
R_SetFOV ((float)fov);
R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
@ -280,6 +285,8 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
FTexture::FlipNonSquareBlockRemap (Pixels, Canvas->GetBuffer(), tex->GetWidth(), tex->GetHeight(), Canvas->GetPitch(), GPalette.Remap);
}
tex->SetUpdated();
fixedcolormap = savecolormap;
realfixedcolormap = savecm;
}
//==========================================================================

View file

@ -62,9 +62,6 @@
extern bool DrawFSHUD; // [RH] Defined in d_main.cpp
EXTERN_CVAR (Bool, cl_capfps)
extern lighttable_t* fixedcolormap;
extern FSpecialColormap*realfixedcolormap;
// TYPES -------------------------------------------------------------------
struct InterpolationViewer
@ -1101,11 +1098,6 @@ void FCanvasTextureInfo::UpdateAll ()
{
FCanvasTextureInfo *probe;
// curse Doom's overuse of global variables in the renderer.
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
unsigned char *savecolormap = fixedcolormap;
FSpecialColormap *savecm = realfixedcolormap;
for (probe = List; probe != NULL; probe = probe->Next)
{
if (probe->Viewpoint != NULL && probe->Texture->bNeedsUpdate)
@ -1113,9 +1105,6 @@ void FCanvasTextureInfo::UpdateAll ()
Renderer->RenderTextureView(probe->Texture, probe->Viewpoint, probe->FOV);
}
}
fixedcolormap = savecolormap;
realfixedcolormap = savecm;
}
//==========================================================================