mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-03-22 07:09:58 +01:00
Adds STASIS wall. (#556)
This commit is contained in:
parent
d7ced6020c
commit
3f99a59cb2
@ -589,7 +589,7 @@ VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
|
||||
newTexture->SetPixel(i, j, 0x80, 0x80, 0x80, 255);
|
||||
}
|
||||
}
|
||||
else if (wt==WL_EHOLE)
|
||||
else if (wt==WL_EHOLE || wt==WL_STASIS)
|
||||
{
|
||||
for (j=0; j<height; j++)
|
||||
{
|
||||
@ -746,9 +746,10 @@ void Renderer::DrawWalls()
|
||||
switch (sim->wtypes[wt].drawstyle)
|
||||
{
|
||||
case 0:
|
||||
if (wt == WL_EWALL)
|
||||
if (wt == WL_EWALL || wt == WL_STASIS)
|
||||
{
|
||||
if (powered)
|
||||
bool reverse = wt == WL_STASIS;
|
||||
if ((powered>0) ^ reverse)
|
||||
{
|
||||
for (int j = 0; j < CELL; j++)
|
||||
for (int i =0; i < CELL; i++)
|
||||
@ -2974,4 +2975,3 @@ Renderer::~Renderer()
|
||||
#endif
|
||||
|
||||
#undef PIXELMETHODS_CLASS
|
||||
|
||||
|
@ -1919,12 +1919,12 @@ void Simulation::orbitalparts_set(int *block1, int *block2, int resblock1[], int
|
||||
|
||||
inline int Simulation::is_wire(int x, int y)
|
||||
{
|
||||
return bmap[y][x]==WL_DETECT || bmap[y][x]==WL_EWALL || bmap[y][x]==WL_ALLOWLIQUID || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_ALLOWALLELEC || bmap[y][x]==WL_EHOLE;
|
||||
return bmap[y][x]==WL_DETECT || bmap[y][x]==WL_EWALL || bmap[y][x]==WL_ALLOWLIQUID || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_ALLOWALLELEC || bmap[y][x]==WL_EHOLE || bmap[y][x]==WL_STASIS;
|
||||
}
|
||||
|
||||
inline int Simulation::is_wire_off(int x, int y)
|
||||
{
|
||||
return (bmap[y][x]==WL_DETECT || bmap[y][x]==WL_EWALL || bmap[y][x]==WL_ALLOWLIQUID || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_ALLOWALLELEC || bmap[y][x]==WL_EHOLE) && emap[y][x]<8;
|
||||
return (bmap[y][x]==WL_DETECT || bmap[y][x]==WL_EWALL || bmap[y][x]==WL_ALLOWLIQUID || bmap[y][x]==WL_WALLELEC || bmap[y][x]==WL_ALLOWALLELEC || bmap[y][x]==WL_EHOLE || bmap[y][x]==WL_STASIS) && emap[y][x]<8;
|
||||
}
|
||||
|
||||
// implement __builtin_ctz and __builtin_clz on msvc
|
||||
@ -3661,11 +3661,18 @@ void Simulation::UpdateParticles(int start, int end)
|
||||
for (i = start; i <= end && i <= parts_lastActiveIndex; i++)
|
||||
if (parts[i].type)
|
||||
{
|
||||
|
||||
|
||||
t = parts[i].type;
|
||||
|
||||
x = (int)(parts[i].x+0.5f);
|
||||
y = (int)(parts[i].y+0.5f);
|
||||
|
||||
// Make sure that STASIS'd particles don't tick.
|
||||
if (bmap[y/CELL][x/CELL] == WL_STASIS && emap[y/CELL][x/CELL]<8) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//this kills any particle out of the screen, or in a wall where it isn't supposed to go
|
||||
if (x<CELL || y<CELL || x>=XRES-CELL || y>=YRES-CELL ||
|
||||
(bmap[y/CELL][x/CELL] &&
|
||||
@ -4196,7 +4203,7 @@ void Simulation::UpdateParticles(int start, int end)
|
||||
{
|
||||
if (t!=PT_SPRK)
|
||||
{
|
||||
if (emap[ny][nx]==12 && !parts[i].life)
|
||||
if (emap[ny][nx]==12 && !parts[i].life && bmap[ny][nx] != WL_STASIS)
|
||||
{
|
||||
part_change_type(i,x,y,PT_SPRK);
|
||||
parts[i].life = 4;
|
||||
@ -5064,8 +5071,9 @@ void Simulation::RecalcFreeParticles(bool do_life_dec)
|
||||
elementCount[t]++;
|
||||
|
||||
unsigned int elem_properties = elements[t].Properties;
|
||||
if (parts[i].life>0 && (elem_properties&PROP_LIFE_DEC))
|
||||
if (parts[i].life>0 && (elem_properties&PROP_LIFE_DEC) && !(bmap[y/CELL][x/CELL] == WL_STASIS && emap[y/CELL][x/CELL]<8))
|
||||
{
|
||||
|
||||
// automatically decrease life
|
||||
parts[i].life--;
|
||||
if (parts[i].life<=0 && (elem_properties&(PROP_LIFE_KILL_DEC|PROP_LIFE_KILL)))
|
||||
@ -5075,7 +5083,7 @@ void Simulation::RecalcFreeParticles(bool do_life_dec)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (parts[i].life<=0 && (elem_properties&PROP_LIFE_KILL))
|
||||
else if (parts[i].life<=0 && (elem_properties&PROP_LIFE_KILL) && !(bmap[y/CELL][x/CELL] == WL_STASIS && emap[y/CELL][x/CELL]<8))
|
||||
{
|
||||
// kill if no life
|
||||
kill_part(i);
|
||||
|
@ -132,6 +132,7 @@ wall_type * LoadWalls(int & wallCount)
|
||||
{PIXPACK(0xFFAA00), PIXPACK(0xAA5500), 4, Renderer::WallIcon, "ENERGY WALL", "DEFAULT_WL_ENRGY", "Allows energy particles, blocks all other particles."},
|
||||
{PIXPACK(0xDCDCDC), PIXPACK(0x000000), 1, Renderer::WallIcon, "AIRBLOCK WALL", "DEFAULT_WL_NOAIR", "Allows all particles, but blocks air."},
|
||||
{PIXPACK(0x808080), PIXPACK(0x000000), 0, Renderer::WallIcon, "ERASEALL", "DEFAULT_WL_ERASEA","Erases walls, particles, and signs."},
|
||||
{PIXPACK(0x800080), PIXPACK(0x000000), 0, Renderer::WallIcon, "STASIS WALL", "DEFAULT_WL_STASIS", "Freezes particles inside the wall in place"},
|
||||
};
|
||||
wallCount = UI_WALLCOUNT;
|
||||
wall_type * wtypesT = (wall_type*)malloc(UI_WALLCOUNT*sizeof(wall_type));
|
||||
|
@ -57,9 +57,10 @@
|
||||
#define WL_ALLOWENERGY 15
|
||||
#define WL_BLOCKAIR 16
|
||||
#define WL_ERASEALL 17
|
||||
#define WL_STASIS 18
|
||||
#define WL_FLOODHELPER 255
|
||||
|
||||
#define UI_WALLCOUNT 18
|
||||
#define UI_WALLCOUNT 19
|
||||
|
||||
#define OLD_SPC_AIR 236
|
||||
#define SPC_AIR 256
|
||||
|
Loading…
x
Reference in New Issue
Block a user