WIND tool creates WIND just by holding down the line tool again

This commit is contained in:
jacob1 2013-06-06 11:52:33 -04:00
parent 2119343b6a
commit b594d68258
3 changed files with 13 additions and 2 deletions

View File

@ -494,6 +494,7 @@ void LuaScriptInterface::initSimulationAPI()
SETCONST(l, XRES); SETCONST(l, XRES);
SETCONST(l, YRES); SETCONST(l, YRES);
SETCONST(l, PT_NUM); SETCONST(l, PT_NUM);
lua_pushinteger(l, 0); lua_setfield(l, -2, "NUM_PARTS");
SETCONST(l, R_TEMP); SETCONST(l, R_TEMP);
SETCONST(l, MAX_TEMP); SETCONST(l, MAX_TEMP);
SETCONST(l, MIN_TEMP); SETCONST(l, MIN_TEMP);

View File

@ -183,6 +183,7 @@ GameView::GameView():
introTextMessage(introTextData), introTextMessage(introTextData),
wallBrush(false), wallBrush(false),
toolBrush(false), toolBrush(false),
windTool(false),
doScreenshot(false), doScreenshot(false),
recording(false), recording(false),
screenshotIndex(0), screenshotIndex(0),
@ -622,6 +623,10 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender)
{ {
toolButtons[i]->SetSelectionState(0); //Primary toolButtons[i]->SetSelectionState(0); //Primary
c->ActiveToolChanged(0, tool); 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) else if(sender->GetActiveTool(1) == tool)
{ {
@ -1326,7 +1331,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
} }
else else
{ {
if (drawMode != DrawLine) if (drawMode != DrawLine && !windTool)
isMouseDown = false; isMouseDown = false;
zoomCursorFixed = false; zoomCursorFixed = false;
c->SetZoomEnabled(true); c->SetZoomEnabled(true);
@ -1530,10 +1535,14 @@ void GameView::OnTick(float dt)
c->DrawPoints(toolIndex, pointQueue); c->DrawPoints(toolIndex, pointQueue);
} }
} }
if(drawMode == DrawFill && isMouseDown) else if(drawMode == DrawFill && isMouseDown)
{ {
c->DrawFill(toolIndex, c->PointTranslate(currentMouse)); 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) if(introText)
{ {
introText -= int(dt)>0?((int)dt < 5? dt:5):1; introText -= int(dt)>0?((int)dt < 5? dt:5):1;

View File

@ -51,6 +51,7 @@ private:
bool showDebug; bool showDebug;
bool wallBrush; bool wallBrush;
bool toolBrush; bool toolBrush;
bool windTool;
int introText; int introText;
std::string introTextMessage; std::string introTextMessage;
int toolIndex; int toolIndex;