From b594d6825858615c835d26510a6cc9a22bc239e2 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 6 Jun 2013 11:52:33 -0400 Subject: [PATCH] WIND tool creates WIND just by holding down the line tool again --- src/cat/LuaScriptInterface.cpp | 1 + src/gui/game/GameView.cpp | 13 +++++++++++-- src/gui/game/GameView.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index fb0180268..df7176dce 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -494,6 +494,7 @@ void LuaScriptInterface::initSimulationAPI() SETCONST(l, XRES); SETCONST(l, YRES); SETCONST(l, PT_NUM); + lua_pushinteger(l, 0); lua_setfield(l, -2, "NUM_PARTS"); SETCONST(l, R_TEMP); SETCONST(l, MAX_TEMP); SETCONST(l, MIN_TEMP); diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index aba0d6ffc..ca4272cc4 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -183,6 +183,7 @@ GameView::GameView(): introTextMessage(introTextData), wallBrush(false), toolBrush(false), + windTool(false), doScreenshot(false), recording(false), screenshotIndex(0), @@ -622,6 +623,10 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender) { toolButtons[i]->SetSelectionState(0); //Primary c->ActiveToolChanged(0, tool); + if (tool->GetIdentifier().find("DEFAULT_UI_WIND") != tool->GetIdentifier().npos) + windTool = true; + else + windTool = false; } else if(sender->GetActiveTool(1) == tool) { @@ -1326,7 +1331,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool } else { - if (drawMode != DrawLine) + if (drawMode != DrawLine && !windTool) isMouseDown = false; zoomCursorFixed = false; c->SetZoomEnabled(true); @@ -1530,10 +1535,14 @@ void GameView::OnTick(float dt) c->DrawPoints(toolIndex, pointQueue); } } - if(drawMode == DrawFill && isMouseDown) + else if(drawMode == DrawFill && isMouseDown) { c->DrawFill(toolIndex, c->PointTranslate(currentMouse)); } + else if (windTool && isMouseDown && drawMode == DrawLine) + { + c->DrawLine(toolIndex, c->PointTranslate(drawPoint1), lineSnapCoords(c->PointTranslate(drawPoint1), currentMouse)); + } if(introText) { introText -= int(dt)>0?((int)dt < 5? dt:5):1; diff --git a/src/gui/game/GameView.h b/src/gui/game/GameView.h index a34729721..f7f636124 100644 --- a/src/gui/game/GameView.h +++ b/src/gui/game/GameView.h @@ -51,6 +51,7 @@ private: bool showDebug; bool wallBrush; bool toolBrush; + bool windTool; int introText; std::string introTextMessage; int toolIndex;