summaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-09-06 21:38:00 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-06 23:37:17 (GMT)
commitc32035b8ca99f0bb9db6fcc5e9759e28a03f2961 (patch)
tree9b59d8e37ff1102c28e12181a6200e9e2d580f20 /src/graphics
parent22de8ecb6ce64d947a7e4efd50660525ab36b943 (diff)
downloadpowder-c32035b8ca99f0bb9db6fcc5e9759e28a03f2961.zip
powder-c32035b8ca99f0bb9db6fcc5e9759e28a03f2961.tar.gz
Fix PRTI/PRTO color, debug lines only drawn in debug mode. Fixes # 148
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/Renderer.cpp17
-rw-r--r--src/graphics/Renderer.h1
2 files changed, 10 insertions, 8 deletions
diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp
index 728b213..4326149 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+nyo<YRES && nx+nxo>0 && nx+nxo<XRES)
+ nxo = (int)(ddist*cos(drad));
+ nyo = (int)(ddist*sin(drad));
+ if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES && (sim->pmap[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+nyo<YRES && nx+nxo>0 && nx+nxo<XRES)
+ nxo = (int)(ddist*cos(drad));
+ nyo = (int)(ddist*sin(drad));
+ if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES && (sim->pmap[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 0bf32fa..b72744c 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;