summaryrefslogtreecommitdiff
path: root/src/game/Tool.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-05 15:14:33 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-05 15:14:33 (GMT)
commit3030d675169d240fcc833a93c0c5ca5b3b95ebc8 (patch)
treeddb4e3fad98ac7055e7a3888ecd69d79ac1310f3 /src/game/Tool.cpp
parent50103aa074917803479ea7957b54f3b982cb9887 (diff)
downloadpowder-3030d675169d240fcc833a93c0c5ca5b3b95ebc8.zip
powder-3030d675169d240fcc833a93c0c5ca5b3b95ebc8.tar.gz
Fan wall line tool, fixes #61
Diffstat (limited to 'src/game/Tool.cpp')
-rw-r--r--src/game/Tool.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp
index e3f1ded..3a9fc1e 100644
--- a/src/game/Tool.cpp
+++ b/src/game/Tool.cpp
@@ -77,7 +77,26 @@ void WallTool::Draw(Simulation * sim, Brush * brush, ui::Point position){
sim->CreateWalls(position.X, position.Y, 1, 1, toolID, 0, brush);
}
void WallTool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) {
- sim->CreateWallLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush);
+ int wallX = position1.X/CELL;
+ int wallY = position1.Y/CELL;
+ if(dragging == false && toolID == WL_FAN && sim->bmap[wallY][wallX]==WL_FAN)
+ {
+ float newFanVelX = (position2.X-position1.X)*0.005f;
+ float newFanVelY = (position2.Y-position1.Y)*0.005f;
+ 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++)
+ if (sim->bmap[j][i] == WL_FLOODHELPER)
+ {
+ sim->fvx[j][i] = newFanVelX;
+ sim->fvy[j][i] = newFanVelY;
+ sim->bmap[j][i] = WL_FAN;
+ }
+ }
+ else
+ {
+ sim->CreateWallLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, toolID, 0, brush);
+ }
}
void WallTool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {
sim->CreateWallBox(position1.X, position1.Y, position2.X, position2.Y, toolID, 0);