mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 03:39:57 +02:00
add ERASEALL wall from my mod (erases walls, particles, and signs)
This commit is contained in:
@@ -627,6 +627,42 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
|||||||
newTexture->SetPixel(-j+20, j, 0xFF, 0, 0, 255);
|
newTexture->SetPixel(-j+20, j, 0xFF, 0, 0, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (wt == WL_ERASEALL)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < height; j++)
|
||||||
|
{
|
||||||
|
int r = 100, g = 150, b = 50;
|
||||||
|
int rd = 1, gd = -1, bd = -1;
|
||||||
|
for (int i = 0; i < width; i++)
|
||||||
|
{
|
||||||
|
r += 15*rd;
|
||||||
|
g += 15*gd;
|
||||||
|
b += 15*bd;
|
||||||
|
if (r > 200) rd = -1;
|
||||||
|
if (g > 200) gd = -1;
|
||||||
|
if (b > 200) bd = -1;
|
||||||
|
if (r < 15) rd = 1;
|
||||||
|
if (g < 15) gd = 1;
|
||||||
|
if (b < 15) bd = 1;
|
||||||
|
int rc = std::min(150, std::max(0, r));
|
||||||
|
int gc = std::min(200, std::max(0, g));
|
||||||
|
int bc = std::min(200, std::max(0, b));
|
||||||
|
newTexture->SetPixel(i, j, rc, gc, bc, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int j = 3; j < (width-4)/2; j++)
|
||||||
|
{
|
||||||
|
newTexture->SetPixel(j+0, j, 0xFF, 0, 0, 255);
|
||||||
|
newTexture->SetPixel(j+1, j, 0xFF, 0, 0, 255);
|
||||||
|
newTexture->SetPixel(-j+13, j, 0xFF, 0, 0, 255);
|
||||||
|
newTexture->SetPixel(-j+14, j, 0xFF, 0, 0, 255);
|
||||||
|
|
||||||
|
newTexture->SetPixel(j+11, j, 0xFF, 0, 0, 255);
|
||||||
|
newTexture->SetPixel(j+12, j, 0xFF, 0, 0, 255);
|
||||||
|
newTexture->SetPixel(-j+24, j, 0xFF, 0, 0, 255);
|
||||||
|
newTexture->SetPixel(-j+25, j, 0xFF, 0, 0, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(wt == WL_STREAM)
|
else if(wt == WL_STREAM)
|
||||||
{
|
{
|
||||||
for (j=0; j<height; j++)
|
for (j=0; j<height; j++)
|
||||||
|
@@ -1123,7 +1123,21 @@ int Simulation::CreateWalls(int x, int y, int rx, int ry, int wall, Brush * cBru
|
|||||||
}
|
}
|
||||||
if (wall == WL_GRAV || bmap[wallY][wallX] == WL_GRAV)
|
if (wall == WL_GRAV || bmap[wallY][wallX] == WL_GRAV)
|
||||||
gravWallChanged = true;
|
gravWallChanged = true;
|
||||||
bmap[wallY][wallX] = wall;
|
|
||||||
|
if (wall == WL_ERASEALL)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < CELL; i++)
|
||||||
|
for (int j = 0; j < CELL; j++)
|
||||||
|
{
|
||||||
|
delete_part(wallX*CELL+i, wallY*CELL+j);
|
||||||
|
}
|
||||||
|
for (int i = signs.size()-1; i >= 0; i--)
|
||||||
|
if (signs[i].x >= wallX*CELL && signs[i].y >= wallY*CELL && signs[i].x <= (wallX+1)*CELL && signs[i].y <= (wallY+1)*CELL)
|
||||||
|
signs.erase(signs.begin()+i);
|
||||||
|
bmap[wallY][wallX] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bmap[wallY][wallX] = wall;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1208,7 +1222,7 @@ 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)
|
||||||
{
|
{
|
||||||
if (wall==WL_ERASE)
|
if (wall==WL_ERASE || wall==WL_ERASEALL)
|
||||||
{
|
{
|
||||||
bm = bmap[y/CELL][x/CELL];
|
bm = bmap[y/CELL][x/CELL];
|
||||||
if (!bm)
|
if (!bm)
|
||||||
|
@@ -131,6 +131,7 @@ wall_type * LoadWalls(int & wallCount)
|
|||||||
{PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, Renderer::WallIcon, "GRAVITY WALL", "Gravity wall. Newtonian Gravity has no effect inside a box drawn with this."},
|
{PIXPACK(0xFFEE00), PIXPACK(0xAA9900), 4, Renderer::WallIcon, "GRAVITY WALL", "Gravity wall. Newtonian Gravity has no effect inside a box drawn with this."},
|
||||||
{PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "ENERGY WALL", "Allows energy particles, blocks all other particles."},
|
{PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "ENERGY WALL", "Allows energy particles, blocks all other particles."},
|
||||||
{PIXPACK(0xDCDCDC), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRBLOCK WALL", "Allows all particles, but blocks air."},
|
{PIXPACK(0xDCDCDC), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRBLOCK WALL", "Allows all particles, but blocks air."},
|
||||||
|
{PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASEALL", "Erases walls, particles, and signs."},
|
||||||
};
|
};
|
||||||
wallCount = UI_WALLCOUNT;
|
wallCount = UI_WALLCOUNT;
|
||||||
wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type));
|
wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type));
|
||||||
|
@@ -55,9 +55,10 @@
|
|||||||
#define WL_GRAV 14
|
#define WL_GRAV 14
|
||||||
#define WL_ALLOWENERGY 15
|
#define WL_ALLOWENERGY 15
|
||||||
#define WL_BLOCKAIR 16
|
#define WL_BLOCKAIR 16
|
||||||
|
#define WL_ERASEALL 17
|
||||||
#define WL_FLOODHELPER 255
|
#define WL_FLOODHELPER 255
|
||||||
|
|
||||||
#define UI_WALLCOUNT 17
|
#define UI_WALLCOUNT 18
|
||||||
|
|
||||||
#define OLD_SPC_AIR 236
|
#define OLD_SPC_AIR 236
|
||||||
#define SPC_AIR 256
|
#define SPC_AIR 256
|
||||||
|
Reference in New Issue
Block a user