From 226a66a860f7651ec94062ad2ab80897207c7eb9 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 10 Jan 2016 22:23:06 -0500 Subject: [PATCH] add ctrl+f shortcut to easily locate elements in red from my mod doesn't support walls or better life finding because tools are much harder to work with here --- src/graphics/Renderer.cpp | 72 ++++++++++++++++++++++++++++++++++----- src/graphics/Renderer.h | 1 + src/gui/game/GameView.cpp | 21 +++++++++++- 3 files changed, 85 insertions(+), 9 deletions(-) diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index ca8d769d4..6dad1ceaa 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -735,6 +735,12 @@ void Renderer::DrawWalls() pixel pc = PIXPACK(sim->wtypes[wt].colour); pixel gc = PIXPACK(sim->wtypes[wt].eglow); + if (findingElement) + { + pc = PIXRGB(PIXR(pc)/10,PIXG(pc)/10,PIXB(pc)/10); + gc = PIXRGB(PIXR(gc)/10,PIXG(gc)/10,PIXB(gc)/10); + } + switch (sim->wtypes[wt].drawstyle) { case 0: @@ -1058,7 +1064,7 @@ void Renderer::render_fire() #ifndef OGLR if(!(render_mode & FIREMODE)) return; - int i,j,x,y,r,g,b; + int i,j,x,y,r,g,b,a; for (j=0; jparts[i].life<100)-2*(sim->parts[i].life<10), mousePos.Y-12, buff, 255, 255, 255, 255); } - if (colour_mode!=COLOUR_HEAT) + if (findingElement == t) + { + colr = 255; + colg = colb = 0; + } + else if (colour_mode != COLOUR_HEAT) { if (cplayer->elemelem > 0) { @@ -1470,6 +1508,7 @@ void Renderer::render_parts() colb = 0xFF; } } + #ifdef OGLR glColor4f(((float)colr)/255.0f, ((float)colg)/255.0f, ((float)colb)/255.0f, 1.0f); glBegin(GL_LINE_STRIP); @@ -1513,7 +1552,18 @@ void Renderer::render_parts() glVertex2f(cplayer->legs[12], cplayer->legs[13]); glEnd(); #else - if (t==PT_STKM2) + if (findingElement && findingElement == t) + { + legr = 255; + legg = legb = 0; + } + else if (colour_mode==COLOUR_HEAT) + { + legr = colr; + legg = colg; + legb = colb; + } + else if (t==PT_STKM2) { legr = 100; legg = 100; @@ -1526,11 +1576,14 @@ void Renderer::render_parts() legb = 255; } - if (colour_mode==COLOUR_HEAT) + if (findingElement && findingElement != t) { - legr = colr; - legg = colg; - legb = colb; + colr /= 10; + colg /= 10; + colb /= 10; + legr /= 10; + legg /= 10; + legb /= 10; } //head @@ -2359,6 +2412,8 @@ void Renderer::draw_air() c = PIXRGB(r, g, b); } } + if (findingElement) + c = PIXRGB(PIXR(c)/10,PIXG(c)/10,PIXB(c)/10); for (j=0; jActiveToolChanged(0, sender->GetActiveTool(0)); + if (sender->GetRenderer()->findingElement) + { + Tool *active = sender->GetActiveTool(0); + if (active->GetIdentifier().find("_PT_") == active->GetIdentifier().npos) + ren->findingElement = 0; + else + ren->findingElement = sender->GetActiveTool(0)->GetToolID()%256; + } c->ActiveToolChanged(1, sender->GetActiveTool(1)); c->ActiveToolChanged(2, sender->GetActiveTool(2)); c->ActiveToolChanged(3, sender->GetActiveTool(3)); @@ -1436,7 +1444,16 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool else c->FrameStep(); #else - c->FrameStep(); + if (ctrl) + { + Tool *active = c->GetActiveTool(0); + if (active->GetIdentifier().find("_PT_") == active->GetIdentifier().npos || ren->findingElement == active->GetToolID()) + ren->findingElement = 0; + else + ren->findingElement = active->GetToolID()%256; + } + else + c->FrameStep(); #endif break; case 'g': @@ -2398,6 +2415,8 @@ void GameView::OnDraw() fpsInfo << " [SPECIFIC DELETE]"; if (ren->GetGridSize()) fpsInfo << " [GRID: " << ren->GetGridSize() << "]"; + if (ren->findingElement) + fpsInfo << " [FIND]"; int textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str()); int alpha = 255-introText*5;