From 181181a8651f9b018d0df4e46d6a131b6fc9530c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 23 Jul 2013 12:31:44 +0200 Subject: [PATCH 1/2] - removed player_t destructor call in CopyPlayer. --- src/p_saveg.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index d33f21f6f..bf0da0cbe 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -267,7 +267,6 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name) bool usedown = dst->usedown; - dst->~player_t(); // ensure that the userinfo in dst does not contain anything before copying everything over. *dst = *src; // To avoid memory leaks at this point the userinfo in src must be empty which is taken care of by the TransferFrom call above. dst->cheats |= chasecam; From af470b3d56f700b0b188c53897af93f78e82b475 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 23 Jul 2013 12:32:33 +0200 Subject: [PATCH 2/2] - fixed: The global variables holding the view's fixed colormap must be preserved when rendering to a camera texture. --- src/r_utility.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index b5382ccad..0b51578ed 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -62,6 +62,9 @@ extern bool DrawFSHUD; // [RH] Defined in d_main.cpp EXTERN_CVAR (Bool, cl_capfps) +extern lighttable_t* fixedcolormap; +extern FSpecialColormap*realfixedcolormap; + // TYPES ------------------------------------------------------------------- struct InterpolationViewer @@ -1005,6 +1008,11 @@ 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) @@ -1012,6 +1020,9 @@ void FCanvasTextureInfo::UpdateAll () Renderer->RenderTextureView(probe->Texture, probe->Viewpoint, probe->FOV); } } + + fixedcolormap = savecolormap; + realfixedcolormap = savecm; } //==========================================================================