From 92f3ad5814fcf77da7782f4664d4041370a41884 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 28 Aug 2012 15:53:07 +0100 Subject: [PATCH] Black decorations only in thumbnails --- src/graphics/Renderer.cpp | 20 ++++++++++++++++---- src/graphics/Renderer.h | 1 + src/simulation/SaveRenderer.cpp | 6 ++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index 0b6680f65..728b2136e 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -1128,6 +1128,17 @@ void Renderer::render_parts() decg = (sim->parts[i].dcolour>>8)&0xFF; decb = (sim->parts[i].dcolour)&0xFF; + if(decorations_enable && blackDecorations) + { + if(deca < 250 || decr > 5 || decg > 5 || decb > 5) + deca = 0; + else + { + deca = 255; + decr = decg = decb = 0; + } + } + { if (graphicscache[t].isready) { @@ -1226,16 +1237,16 @@ void Renderer::render_parts() } //Apply decoration colour - if(!(colour_mode & ~COLOUR_GRAD)) + if(!(colour_mode & ~COLOUR_GRAD) && decorations_enable && deca) { - if(!(pixel_mode & NO_DECO) && decorations_enable) + if(!(pixel_mode & NO_DECO)) { colr = (deca*decr + (255-deca)*colr) >> 8; colg = (deca*decg + (255-deca)*colg) >> 8; colb = (deca*decb + (255-deca)*colb) >> 8; } - if((pixel_mode & DECO_FIRE) && decorations_enable) + if(pixel_mode & DECO_FIRE) { firer = (deca*decr + (255-deca)*firer) >> 8; fireg = (deca*decg + (255-deca)*fireg) >> 8; @@ -2299,7 +2310,8 @@ Renderer::Renderer(Graphics * g, Simulation * sim): display_mode(0), render_mode(0), colour_mode(0), - gridSize(0) + gridSize(0), + blackDecorations(false) { this->g = g; this->sim = sim; diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index 9c216ed2d..fa9bd3744 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -43,6 +43,7 @@ public: bool gravityZonesEnabled; bool gravityFieldEnabled; int decorations_enable; + bool blackDecorations; Simulation * sim; Graphics * g; gcache_item *graphicscache; diff --git a/src/simulation/SaveRenderer.cpp b/src/simulation/SaveRenderer.cpp index 2de9a6cce..483172b33 100644 --- a/src/simulation/SaveRenderer.cpp +++ b/src/simulation/SaveRenderer.cpp @@ -17,7 +17,8 @@ SaveRenderer::SaveRenderer(){ g = new Graphics(); sim = new Simulation(); ren = new Renderer(g, sim); - ren->decorations_enable = false; + ren->decorations_enable = true; + ren->blackDecorations = true; #if defined(OGLR) || defined(OGLI) glEnable(GL_TEXTURE_2D); @@ -52,7 +53,8 @@ Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations) if(!sim->Load(save)) { - ren->decorations_enable = decorations; + ren->decorations_enable = true; + ren->blackDecorations = !decorations; #if defined(OGLR) || defined(OGLI) pixel * pData = NULL; unsigned char * texData = NULL;