Fix PRTI/PRTO color, debug lines only drawn in debug mode. Fixes # 148

This commit is contained in:
jacob1 2012-09-06 17:38:00 -04:00 committed by Simon Robertshaw
parent 22de8ecb6c
commit c32035b8ca
3 changed files with 12 additions and 8 deletions

View File

@ -1177,6 +1177,8 @@ void GameView::OnMouseWheel(int x, int y, int d)
void GameView::ToggleDebug() void GameView::ToggleDebug()
{ {
showDebug = !showDebug; showDebug = !showDebug;
if (ren)
ren->debugLines = showDebug;
} }
void GameView::BeginStampSelection() void GameView::BeginStampSelection()

View File

@ -1762,9 +1762,9 @@ void Renderer::render_parts()
for (r = 0; r < 4; r++) { for (r = 0; r < 4; r++) {
ddist = ((float)orbd[r])/16.0f; ddist = ((float)orbd[r])/16.0f;
drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f; drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
nxo = ddist*cos(drad); nxo = (int)(ddist*cos(drad));
nyo = ddist*sin(drad); nyo = (int)(ddist*sin(drad));
if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES) 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]); 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++) { for (r = 0; r < 4; r++) {
ddist = ((float)orbd[r])/16.0f; ddist = ((float)orbd[r])/16.0f;
drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f; drad = (M_PI * ((float)orbl[r]) / 180.0f)*1.41f;
nxo = ddist*cos(drad); nxo = (int)(ddist*cos(drad));
nyo = ddist*sin(drad); nyo = (int)(ddist*sin(drad));
if (ny+nyo>0 && ny+nyo<YRES && nx+nxo>0 && nx+nxo<XRES) 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]); addpixel(nx+nxo, ny+nyo, colr, colg, colb, 255-orbd[r]);
} }
} }
if (pixel_mode & EFFECT_DBGLINES) 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 z;
int type = parts[i].type; int type = parts[i].type;
@ -2311,7 +2311,8 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
render_mode(0), render_mode(0),
colour_mode(0), colour_mode(0),
gridSize(0), gridSize(0),
blackDecorations(false) blackDecorations(false),
debugLines(false)
{ {
this->g = g; this->g = g;
this->sim = sim; this->sim = sim;

View File

@ -57,6 +57,7 @@ public:
bool gravityFieldEnabled; bool gravityFieldEnabled;
int decorations_enable; int decorations_enable;
bool blackDecorations; bool blackDecorations;
bool debugLines;
Simulation * sim; Simulation * sim;
Graphics * g; Graphics * g;
gcache_item *graphicscache; gcache_item *graphicscache;