From c32035b8ca99f0bb9db6fcc5e9759e28a03f2961 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 6 Sep 2012 17:38:00 -0400 Subject: [PATCH] Fix PRTI/PRTO color, debug lines only drawn in debug mode. Fixes # 148 --- src/game/GameView.cpp | 2 ++ src/graphics/Renderer.cpp | 17 +++++++++-------- src/graphics/Renderer.h | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 27c363786..56dbbcebb 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -1177,6 +1177,8 @@ void GameView::OnMouseWheel(int x, int y, int d) void GameView::ToggleDebug() { showDebug = !showDebug; + if (ren) + ren->debugLines = showDebug; } void GameView::BeginStampSelection() diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index 728b2136e..43261493b 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -1762,9 +1762,9 @@ void Renderer::render_parts() for (r = 0; r < 4; r++) { ddist = ((float)orbd[r])/16.0f; drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f; - nxo = ddist*cos(drad); - nyo = ddist*sin(drad); - if (ny+nyo>0 && ny+nyo0 && nx+nxo0 && ny+nyo0 && nx+nxopmap[ny+nyo][nx+nxo]&0xFF) != PT_PRTI) addpixel(nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]); } } @@ -1780,15 +1780,15 @@ void Renderer::render_parts() for (r = 0; r < 4; r++) { ddist = ((float)orbd[r])/16.0f; drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f; - nxo = ddist*cos(drad); - nyo = ddist*sin(drad); - if (ny+nyo>0 && ny+nyo0 && nx+nxo0 && ny+nyo0 && nx+nxopmap[ny+nyo][nx+nxo]&0xFF) != PT_PRTO) addpixel(nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]); } } if (pixel_mode & EFFECT_DBGLINES) { - if (mousePosX == nx && mousePosY == ny)//draw lines connecting wifi/portal channels + if (mousePosX == nx && mousePosY == ny && debugLines)//draw lines connecting wifi/portal channels { int z; int type = parts[i].type; @@ -2311,7 +2311,8 @@ Renderer::Renderer(Graphics * g, Simulation * sim): render_mode(0), colour_mode(0), gridSize(0), - blackDecorations(false) + blackDecorations(false), + debugLines(false) { this->g = g; this->sim = sim; diff --git a/src/graphics/Renderer.h b/src/graphics/Renderer.h index 0bf32fa54..b72744c79 100644 --- a/src/graphics/Renderer.h +++ b/src/graphics/Renderer.h @@ -57,6 +57,7 @@ public: bool gravityFieldEnabled; int decorations_enable; bool blackDecorations; + bool debugLines; Simulation * sim; Graphics * g; gcache_item *graphicscache;