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
This commit is contained in:
parent
40285e107a
commit
da7d107f60
@ -1047,11 +1047,10 @@ int LuaScriptInterface::simulation_createWalls(lua_State * l)
|
|||||||
int rx = luaL_optint(l,3,0);
|
int rx = luaL_optint(l,3,0);
|
||||||
int ry = luaL_optint(l,4,0);
|
int ry = luaL_optint(l,4,0);
|
||||||
int c = luaL_optint(l,5,8);
|
int c = luaL_optint(l,5,8);
|
||||||
int flags = luaL_optint(l,6,luacon_sim->replaceModeFlags);
|
|
||||||
if (c < 0 || c >= UI_WALLCOUNT)
|
if (c < 0 || c >= UI_WALLCOUNT)
|
||||||
return luaL_error(l, "Unrecognised wall id '%d'", c);
|
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);
|
lua_pushinteger(l, ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1065,11 +1064,10 @@ int LuaScriptInterface::simulation_createWallLine(lua_State * l)
|
|||||||
int rx = luaL_optint(l,5,0);
|
int rx = luaL_optint(l,5,0);
|
||||||
int ry = luaL_optint(l,6,0);
|
int ry = luaL_optint(l,6,0);
|
||||||
int c = luaL_optint(l,7,8);
|
int c = luaL_optint(l,7,8);
|
||||||
int flags = luaL_optint(l,8,luacon_sim->replaceModeFlags);
|
|
||||||
if (c < 0 || c >= UI_WALLCOUNT)
|
if (c < 0 || c >= UI_WALLCOUNT)
|
||||||
return luaL_error(l, "Unrecognised wall id '%d'", c);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1080,11 +1078,10 @@ int LuaScriptInterface::simulation_createWallBox(lua_State * l)
|
|||||||
int x2 = luaL_optint(l,3,-1);
|
int x2 = luaL_optint(l,3,-1);
|
||||||
int y2 = luaL_optint(l,4,-1);
|
int y2 = luaL_optint(l,4,-1);
|
||||||
int c = luaL_optint(l,5,8);
|
int c = luaL_optint(l,5,8);
|
||||||
int flags = luaL_optint(l,6,luacon_sim->replaceModeFlags);
|
|
||||||
if (c < 0 || c >= UI_WALLCOUNT)
|
if (c < 0 || c >= UI_WALLCOUNT)
|
||||||
return luaL_error(l, "Unrecognised wall id '%d'", c);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1094,10 +1091,9 @@ int LuaScriptInterface::simulation_floodWalls(lua_State * l)
|
|||||||
int y = luaL_optint(l,2,-1);
|
int y = luaL_optint(l,2,-1);
|
||||||
int c = luaL_optint(l,3,8);
|
int c = luaL_optint(l,3,8);
|
||||||
int bm = luaL_optint(l,4,-1);
|
int bm = luaL_optint(l,4,-1);
|
||||||
int flags = luaL_optint(l,5,luacon_sim->replaceModeFlags);
|
|
||||||
if (c < 0 || c >= UI_WALLCOUNT)
|
if (c < 0 || c >= UI_WALLCOUNT)
|
||||||
return luaL_error(l, "Unrecognised wall id '%d'", c);
|
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);
|
lua_pushinteger(l, ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,8 @@ public:
|
|||||||
{
|
{
|
||||||
ToolButton *sender = (ToolButton*)sender_;
|
ToolButton *sender = (ToolButton*)sender_;
|
||||||
if (v->CtrlBehaviour() && v->AltBehaviour() && !v->ShiftBehaviour())
|
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)
|
if(sender->GetSelectionState() >= 0 && sender->GetSelectionState() <= 3)
|
||||||
v->c->SetActiveTool(sender->GetSelectionState(), tool);
|
v->c->SetActiveTool(sender->GetSelectionState(), tool);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ void WallTool::DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui
|
|||||||
newFanVelX *= strength;
|
newFanVelX *= strength;
|
||||||
float newFanVelY = (position2.Y-position1.Y)*0.005f;
|
float newFanVelY = (position2.Y-position1.Y)*0.005f;
|
||||||
newFanVelY *= strength;
|
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 j = 0; j < YRES/CELL; j++)
|
||||||
for (int i = 0; i < XRES/CELL; i++)
|
for (int i = 0; i < XRES/CELL; i++)
|
||||||
if (sim->bmap[j][i] == WL_FLOODHELPER)
|
if (sim->bmap[j][i] == WL_FLOODHELPER)
|
||||||
|
@ -1038,17 +1038,13 @@ void Simulation::ToolBox(int x1, int y1, int x2, int y2, int tool, float strengt
|
|||||||
Tool(i, j, tool, strength);
|
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)
|
if(cBrush)
|
||||||
{
|
{
|
||||||
rx = cBrush->GetRadius().X;
|
rx = cBrush->GetRadius().X;
|
||||||
ry = cBrush->GetRadius().Y;
|
ry = cBrush->GetRadius().Y;
|
||||||
}
|
}
|
||||||
if (wall == WL_ERASE)
|
|
||||||
wall = 0;
|
|
||||||
if (flags == -1)
|
|
||||||
flags = replaceModeFlags;
|
|
||||||
|
|
||||||
ry = ry/CELL;
|
ry = ry/CELL;
|
||||||
rx = rx/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 (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)
|
if (wall == WL_FAN)
|
||||||
{
|
{
|
||||||
fvx[wallY][wallX] = 0.0f;
|
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;
|
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;
|
int x, y, dx, dy, sy;
|
||||||
bool reverseXY = abs(y2-y1) > abs(x2-x1);
|
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++)
|
for (x=x1; x<=x2; x++)
|
||||||
{
|
{
|
||||||
if (reverseXY)
|
if (reverseXY)
|
||||||
CreateWalls(y, x, rx, ry, wall, cBrush, flags);
|
CreateWalls(y, x, rx, ry, wall, cBrush);
|
||||||
else
|
else
|
||||||
CreateWalls(x, y, rx, ry, wall, cBrush, flags);
|
CreateWalls(x, y, rx, ry, wall, cBrush);
|
||||||
e += de;
|
e += de;
|
||||||
if (e >= 0.5f)
|
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 (!(rx+ry) && ((y1<y2) ? (y<=y2) : (y>=y2)))
|
||||||
{
|
{
|
||||||
if (reverseXY)
|
if (reverseXY)
|
||||||
CreateWalls(y, x, rx, ry, wall, cBrush, flags);
|
CreateWalls(y, x, rx, ry, wall, cBrush);
|
||||||
else
|
else
|
||||||
CreateWalls(x, y, rx, ry, wall, cBrush, flags);
|
CreateWalls(x, y, rx, ry, wall, cBrush);
|
||||||
}
|
}
|
||||||
e -= 1.0f;
|
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;
|
int i, j;
|
||||||
if (x1>x2)
|
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 (j=y1; j<=y2; j++)
|
||||||
for (i=x1; i<=x2; i++)
|
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;
|
int x1, x2, dy = CELL;
|
||||||
if (bm==-1)
|
if (bm==-1)
|
||||||
@ -1177,8 +1170,6 @@ int Simulation::FloodWalls(int x, int y, int wall, int bm, int flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
bm = 0;
|
bm = 0;
|
||||||
if (flags == -1)
|
|
||||||
flags = replaceModeFlags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmap[y/CELL][x/CELL]!=bm)
|
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
|
// fill span
|
||||||
for (x=x1; x<=x2; x++)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
// fill children
|
// fill children
|
||||||
if (y>=CELL)
|
if (y>=CELL)
|
||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
if (bmap[(y-dy)/CELL][x/CELL]==bm)
|
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 0;
|
||||||
if (y<YRES-CELL)
|
if (y<YRES-CELL)
|
||||||
for (x=x1; x<=x2; x++)
|
for (x=x1; x<=x2; x++)
|
||||||
if (bmap[(y+dy)/CELL][x/CELL]==bm)
|
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 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1442,7 +1433,7 @@ int Simulation::FloodParts(int x, int y, int fullc, int cm, int flags)
|
|||||||
if (!cm)
|
if (!cm)
|
||||||
cm = photons[y][x]&0xFF;
|
cm = photons[y][x]&0xFF;
|
||||||
if (!cm && bmap[y/CELL][x/CELL])
|
if (!cm && bmap[y/CELL][x/CELL])
|
||||||
FloodWalls(x, y, WL_ERASE, -1, flags);
|
FloodWalls(x, y, WL_ERASE, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cm = 0;
|
cm = 0;
|
||||||
|
@ -177,10 +177,10 @@ public:
|
|||||||
void ToolBox(int x1, int y1, int x2, int y2, int tool, float strength = 1.0f);
|
void ToolBox(int x1, int y1, int x2, int y2, int tool, float strength = 1.0f);
|
||||||
|
|
||||||
//Drawing Walls
|
//Drawing Walls
|
||||||
int CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBrush = NULL, 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, int flags = -1);
|
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 flags = -1);
|
void CreateWallBox(int x1, int y1, int x2, int y2, int wall);
|
||||||
int FloodWalls(int x, int y, int wall, int bm, int flags = -1);
|
int FloodWalls(int x, int y, int wall, int bm);
|
||||||
|
|
||||||
//Drawing Particles
|
//Drawing Particles
|
||||||
int CreateParts(int positionX, int positionY, int c, Brush * cBrush, int flags = -1);
|
int CreateParts(int positionX, int positionY, int c, Brush * cBrush, int flags = -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user