summaryrefslogtreecommitdiff
path: root/src/game/Tool.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-10 13:03:23 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-10 13:03:23 (GMT)
commit810ea42f99cf9f56c1ac998ce8a203bea01e97b2 (patch)
treeb3c2bc39bfed051003a6eeab6e990e73ddad5dec /src/game/Tool.cpp
parentfd40ed234ab157c4e315cb748163969c8ff83b0f (diff)
downloadpowder-810ea42f99cf9f56c1ac998ce8a203bea01e97b2.zip
powder-810ea42f99cf9f56c1ac998ce8a203bea01e97b2.tar.gz
Only render gravity lensing if it's enabled, Ctrl and Shift to alter tool strength (Shift = x10, Ctrl = x0.1)
Diffstat (limited to 'src/game/Tool.cpp')
-rw-r--r--src/game/Tool.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp
index 763fc82..a93afaf 100644
--- a/src/game/Tool.cpp
+++ b/src/game/Tool.cpp
@@ -19,7 +19,8 @@ Tool::Tool(int id, string name, string description, int r, int g, int b, VideoBu
colRed(r),
colGreen(g),
colBlue(b),
- textureGen(textureGen)
+ textureGen(textureGen),
+ strength(1.0f)
{
}
VideoBuffer * Tool::GetTexture(int width, int height)
@@ -39,13 +40,13 @@ string Tool::GetDescription() { return toolDescription; }
Tool::~Tool() {}
void Tool::Click(Simulation * sim, Brush * brush, ui::Point position) { }
void Tool::Draw(Simulation * sim, Brush * brush, ui::Point position) {
- sim->ToolBrush(position.X, position.Y, toolID, brush);
+ sim->ToolBrush(position.X, position.Y, toolID, brush, strength);
}
void Tool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) {
- sim->ToolLine(position1.X, position1.Y, position2.X, position2.Y, toolID, brush);
+ sim->ToolLine(position1.X, position1.Y, position2.X, position2.Y, toolID, brush, strength);
}
void Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {
- sim->ToolBox(position1.X, position1.Y, position2.X, position2.Y, toolID, brush);
+ sim->ToolBox(position1.X, position1.Y, position2.X, position2.Y, toolID, brush, strength);
}
void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {};
@@ -82,7 +83,9 @@ void WallTool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui
if(dragging == false && toolID == WL_FAN && sim->bmap[wallY][wallX]==WL_FAN)
{
float newFanVelX = (position2.X-position1.X)*0.005f;
+ newFanVelX *= strength;
float newFanVelY = (position2.Y-position1.Y)*0.005f;
+ newFanVelY *= strength;
sim->FloodWalls(position1.X, position1.Y, WL_FLOODHELPER, -1, WL_FAN, 0);
for (int j = 0; j < YRES/CELL; j++)
for (int i = 0; i < XRES/CELL; i++)
@@ -138,6 +141,7 @@ void WindTool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui
int radiusX, radiusY, sizeX, sizeY;
float strength = dragging?0.01f:0.002f;
+ strength *= this->strength;
radiusX = brush->GetRadius().X;
radiusY = brush->GetRadius().Y;