diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h index 781a8f8ae..937b4cb0c 100644 --- a/src/simulation/Elements.h +++ b/src/simulation/Elements.h @@ -37,9 +37,10 @@ #define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle #define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat. -#define FLAG_STAGNANT 1 +#define FLAG_STAGNANT 0x1 #define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT -#define FLAG_MOVABLE 0x4 // if can move +#define FLAG_WATEREQUAL 0x4 +#define FLAG_MOVABLE 0x8 // if can move #define ST_NONE 0 #define ST_SOLID 1 diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 65061413c..1ac5d489b 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>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