diff options
| author | jacob1 <jfu614@gmail.com> | 2013-07-18 22:54:09 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-07-18 22:54:09 (GMT) |
| commit | da7d107f60f2e07ac6d859dbc562473ddaf321fe (patch) | |
| tree | 3670b0f757cd5f1c181108406402b08aecaa46ba /src | |
| parent | 40285e107a998aafaa6c88ee7ca650191ae5b400 (diff) | |
| download | powder-da7d107f60f2e07ac6d859dbc562473ddaf321fe.zip powder-da7d107f60f2e07ac6d859dbc562473ddaf321fe.tar.gz | |
remove specific delete for walls, doesn't work very well and it conflicts with specific delete for elements
Also prevent wall replace mode, could never do anything because walls already replace everything
Diffstat (limited to 'src')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 12 | ||||
| -rw-r--r-- | src/gui/game/GameView.cpp | 3 | ||||
| -rw-r--r-- | src/gui/game/Tool.cpp | 2 | ||||
| -rw-r--r-- | src/simulation/Simulation.cpp | 35 | ||||
| -rw-r--r-- | src/simulation/Simulation.h | 8 |
5 files changed, 24 insertions, 36 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index b1169f4..4bea8ed 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -1047,11 +1047,10 @@ int LuaScriptInterface::simulation_createWalls(lua_State * l) int rx = luaL_optint(l,3,0); int ry = luaL_optint(l,4,0); int c = luaL_optint(l,5,8); - int flags = luaL_optint(l,6,luacon_sim->replaceModeFlags); if (c < 0 || c >= UI_WALLCOUNT) return luaL_error(l, "Unrecognised wall id '%d'", c); - int ret = luacon_sim->CreateWalls(x, y, rx, ry, c, NULL, flags); + int ret = luacon_sim->CreateWalls(x, y, rx, ry, c, NULL); lua_pushinteger(l, ret); return 1; } @@ -1065,11 +1064,10 @@ int LuaScriptInterface::simulation_createWallLine(lua_State * l) int rx = luaL_optint(l,5,0); int ry = luaL_optint(l,6,0); int c = luaL_optint(l,7,8); - int flags = luaL_optint(l,8,luacon_sim->replaceModeFlags); if (c < 0 || c >= UI_WALLCOUNT) return luaL_error(l, "Unrecognised wall id '%d'", c); - luacon_sim->CreateWallLine(x1, y1, x2, y2, rx, ry, c, NULL, flags); + luacon_sim->CreateWallLine(x1, y1, x2, y2, rx, ry, c, NULL); return 0; } @@ -1080,11 +1078,10 @@ int LuaScriptInterface::simulation_createWallBox(lua_State * l) int x2 = luaL_optint(l,3,-1); int y2 = luaL_optint(l,4,-1); int c = luaL_optint(l,5,8); - int flags = luaL_optint(l,6,luacon_sim->replaceModeFlags); if (c < 0 || c >= UI_WALLCOUNT) return luaL_error(l, "Unrecognised wall id '%d'", c); - luacon_sim->CreateWallBox(x1, y1, x2, y2, c, flags); + luacon_sim->CreateWallBox(x1, y1, x2, y2, c); return 0; } @@ -1094,10 +1091,9 @@ int LuaScriptInterface::simulation_floodWalls(lua_State * l) int y = luaL_optint(l,2,-1); int c = luaL_optint(l,3,8); int bm = luaL_optint(l,4,-1); - int flags = luaL_optint(l,5,luacon_sim->replaceModeFlags); if (c < 0 || c >= UI_WALLCOUNT) return luaL_error(l, "Unrecognised wall id '%d'", c); - int ret = luacon_sim->FloodWalls(x, y, c, bm, flags); + int ret = luacon_sim->FloodWalls(x, y, c, bm); lua_pushinteger(l, ret); return 1; } diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 4abceac..f1b0450 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -519,7 +519,8 @@ public: { ToolButton *sender = (ToolButton*)sender_; if (v->CtrlBehaviour() && v->AltBehaviour() && !v->ShiftBehaviour()) - sender->SetSelectionState(3); + if (tool->GetIdentifier().find("DEFAULT_PT_") != tool->GetIdentifier().npos) + sender->SetSelectionState(3); if(sender->GetSelectionState() >= 0 && sender->GetSelectionState() <= 3) v->c->SetActiveTool(sender->GetSelectionState(), tool); } diff --git a/src/gui/game/Tool.cpp b/src/gui/game/Tool.cpp index fb3f7ed..b0def6c 100644 --- a/src/gui/game/Tool.cpp +++ b/src/gui/game/Tool.cpp @@ -87,7 +87,7 @@ void WallTool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui newFanVelX *= strength; float newFanVelY = (position2.Y-position1.Y)*0.005f; newFanVelY *= strength; - sim->FloodWalls(position1.X, position1.Y, WL_FLOODHELPER, WL_FAN, 0); + sim->FloodWalls(position1.X, position1.Y, WL_FLOODHELPER, WL_FAN); for (int j = 0; j < YRES/CELL; j++) for (int i = 0; i < XRES/CELL; i++) if (sim->bmap[j][i] == WL_FLOODHELPER) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index d598b30..678247d 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1038,17 +1038,13 @@ void Simulation::ToolBox(int x1, int y1, int x2, int y2, int tool, float strengt Tool(i, j, tool, strength); } -int Simulation::CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBrush, int flags) +int Simulation::CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBrush) { if(cBrush) { rx = cBrush->GetRadius().X; ry = cBrush->GetRadius().Y; } - if (wall == WL_ERASE) - wall = 0; - if (flags == -1) - flags = replaceModeFlags; ry = ry/CELL; rx = rx/CELL; @@ -1062,9 +1058,6 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBru { if (wallX >= 0 && wallX < XRES/CELL && wallY >= 0 && wallY < YRES/CELL) { - if ((flags&SPECIFIC_DELETE) && wall != WL_FLOODHELPER && wall == replaceModeSelected) - wall = 0; - if (wall == WL_FAN) { fvx[wallY][wallX] = 0.0f; @@ -1091,7 +1084,7 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBru return 1; } -void Simulation::CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, int wall, Brush * cBrush, int flags) +void Simulation::CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, int wall, Brush * cBrush) { int x, y, dx, dy, sy; bool reverseXY = abs(y2-y1) > abs(x2-x1); @@ -1125,9 +1118,9 @@ void Simulation::CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, for (x=x1; x<=x2; x++) { if (reverseXY) - CreateWalls(y, x, rx, ry, wall, cBrush, flags); + CreateWalls(y, x, rx, ry, wall, cBrush); else - CreateWalls(x, y, rx, ry, wall, cBrush, flags); + CreateWalls(x, y, rx, ry, wall, cBrush); e += de; if (e >= 0.5f) { @@ -1135,16 +1128,16 @@ void Simulation::CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, if (!(rx+ry) && ((y1<y2) ? (y<=y2) : (y>=y2))) { if (reverseXY) - CreateWalls(y, x, rx, ry, wall, cBrush, flags); + CreateWalls(y, x, rx, ry, wall, cBrush); else - CreateWalls(x, y, rx, ry, wall, cBrush, flags); + CreateWalls(x, y, rx, ry, wall, cBrush); } e -= 1.0f; } } } -void Simulation::CreateWallBox(int x1, int y1, int x2, int y2, int wall, int flags) +void Simulation::CreateWallBox(int x1, int y1, int x2, int y2, int wall) { int i, j; if (x1>x2) @@ -1161,10 +1154,10 @@ void Simulation::CreateWallBox(int x1, int y1, int x2, int y2, int wall, int fla } for (j=y1; j<=y2; j++) for (i=x1; i<=x2; i++) - CreateWalls(i, j, 0, 0, wall, NULL, flags); + CreateWalls(i, j, 0, 0, wall, NULL); } -int Simulation::FloodWalls(int x, int y, int wall, int bm, int flags) +int Simulation::FloodWalls(int x, int y, int wall, int bm) { int x1, x2, dy = CELL; if (bm==-1) @@ -1177,8 +1170,6 @@ int Simulation::FloodWalls(int x, int y, int wall, int bm, int flags) } else bm = 0; - if (flags == -1) - flags = replaceModeFlags; } if (bmap[y/CELL][x/CELL]!=bm) @@ -1206,19 +1197,19 @@ int Simulation::FloodWalls(int x, int y, int wall, int bm, int flags) // fill span for (x=x1; x<=x2; x++) { - if (!CreateWalls(x, y, 0, 0, wall, NULL, flags)) + if (!CreateWalls(x, y, 0, 0, wall, NULL)) return 0; } // fill children if (y>=CELL) for (x=x1; x<=x2; x++) if (bmap[(y-dy)/CELL][x/CELL]==bm) - if (!FloodWalls(x, y-dy, wall, bm, flags)) + if (!FloodWalls(x, y-dy, wall, bm)) return 0; if (y<YRES-CELL) for (x=x1; x<=x2; x++) if (bmap[(y+dy)/CELL][x/CELL]==bm) - if (!FloodWalls(x, y+dy, wall, bm, flags)) + if (!FloodWalls(x, y+dy, wall, bm)) return 0; return 1; } @@ -1442,7 +1433,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags) if (!cm) cm = photons[y][x]&0xFF; if (!cm && bmap[y/CELL][x/CELL]) - FloodWalls(x, y, WL_ERASE, -1, flags); + FloodWalls(x, y, WL_ERASE, -1); } else cm = 0; diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index 349ab12..9c900ab 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -177,10 +177,10 @@ public: void ToolBox(int x1, int y1, int x2, int y2, int tool, float strength = 1.0f); //Drawing Walls - int CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBrush = NULL, int flags = -1); - void CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, int wall, Brush * cBrush = NULL, int flags = -1); - void CreateWallBox(int x1, int y1, int x2, int y2, int wall, int flags = -1); - int FloodWalls(int x, int y, int wall, int bm, int flags = -1); + int CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBrush = NULL); + void CreateWallLine(int x1, int y1, int x2, int y2, int rx, int ry, int wall, Brush * cBrush = NULL); + void CreateWallBox(int x1, int y1, int x2, int y2, int wall); + int FloodWalls(int x, int y, int wall, int bm); //Drawing Particles int CreateParts(int positionX, int positionY, int c, Brush * cBrush, int flags = -1); |
