summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-12-18 19:08:53 (GMT)
committer jacob1 <jfu614@gmail.com>2012-12-18 19:08:53 (GMT)
commit771d71ea4619f30bd1b135697e83037ba333008f (patch)
tree81952978bc16b2418d5212b76b99054116c83b69 /src/simulation/Simulation.cpp
parente685e30d58f252ddca3dce0d67c3d2af56ce330d (diff)
downloadpowder-771d71ea4619f30bd1b135697e83037ba333008f.zip
powder-771d71ea4619f30bd1b135697e83037ba333008f.tar.gz
make water equalization use flags, not tmp2 (fixes EXOT / BUBW)
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 6506141..1ac5d48 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -840,7 +840,10 @@ int Simulation::flood_water(int x, int y, int i, int originaly, int check)
// fill span
for (x=x1; x<=x2; x++)
{
- parts[pmap[y][x]>>8].tmp2 = !check;//flag it as checked, maybe shouldn't use .tmp2
+ if (check)
+ parts[pmap[y][x]>>8].flags &= ~FLAG_WATEREQUAL;//flag it as checked (different from the original particle's checked flag)
+ else
+ parts[pmap[y][x]>>8].flags |= FLAG_WATEREQUAL;
//check above, maybe around other sides too?
if ( ((y-1) > originaly) && !pmap[y-1][x] && eval_move(parts[i].type, x, y-1, NULL))
{
@@ -857,12 +860,12 @@ int Simulation::flood_water(int x, int y, int i, int originaly, int check)
if (y>=CELL+1)
for (x=x1; x<=x2; x++)
- if ((elements[(pmap[y-1][x]&0xFF)].Falldown)==2 && parts[pmap[y-1][x]>>8].tmp2 == check)
+ if ((elements[(pmap[y-1][x]&0xFF)].Falldown)==2 && (parts[pmap[y-1][x]>>8].flags & FLAG_WATEREQUAL) == check)
if (!flood_water(x, y-1, i, originaly, check))
return 0;
if (y<YRES-CELL-1)
for (x=x1; x<=x2; x++)
- if ((elements[(pmap[y+1][x]&0xFF)].Falldown)==2 && parts[pmap[y+1][x]>>8].tmp2 == check)
+ if ((elements[(pmap[y+1][x]&0xFF)].Falldown)==2 && (parts[pmap[y+1][x]>>8].flags & FLAG_WATEREQUAL) == check)
if (!flood_water(x, y+1, i, originaly, check))
return 0;
return 1;
@@ -3693,7 +3696,7 @@ void Simulation::update_particles_i(int start, int inc)
pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
}
//velocity updates for the particle
- if (!(parts[i].flags&FLAG_MOVABLE))
+ if (t != PT_SPNG || !(parts[i].flags&FLAG_MOVABLE))
{
parts[i].vx *= elements[t].Loss;
parts[i].vy *= elements[t].Loss;
@@ -4373,7 +4376,7 @@ killed:
{
if (water_equal_test && elements[t].Falldown == 2 && 1>= rand()%400)//checking stagnant is cool, but then it doesn't update when you change it later.
{
- if (!flood_water(x,y,i,y, parts[i].tmp2))
+ if (!flood_water(x,y,i,y, parts[i].flags&FLAG_WATEREQUAL))
goto movedone;
}
// liquids and powders