Slight speed improvement for liquids and powders
This commit is contained in:
parent
7543a3d05e
commit
ddaed2ad69
12
src/powder.c
12
src/powder.c
@ -1935,7 +1935,12 @@ killed:
|
||||
}
|
||||
else
|
||||
{
|
||||
s = 1;
|
||||
r = (rand()%2)*2-1;
|
||||
if (clear_x!=x || clear_y!=y || nt || surround_space)
|
||||
{
|
||||
// allow diagonal movement if target position is blocked
|
||||
// but no point trying this if particle is stuck in a block of identical particles
|
||||
if (fin_y!=clear_y && try_move(i, x, y, clear_x+r, fin_y))
|
||||
{
|
||||
parts[i].x = clear_xf+r;
|
||||
@ -1964,9 +1969,14 @@ killed:
|
||||
parts[i].vx *= ptypes[t].collision;
|
||||
parts[i].vy *= ptypes[t].collision;
|
||||
}
|
||||
else if (ptypes[t].falldown>1 && (parts[i].vy>fabs(parts[i].vx) || gravityMode==2))
|
||||
else s = 0;
|
||||
}
|
||||
else s = 0;
|
||||
// s==0 means particle has not yet moved, allow liquids code to run
|
||||
if (s==0 && ptypes[t].falldown>1 && (parts[i].vy>fabs(parts[i].vx) || gravityMode==2))
|
||||
{
|
||||
s = 0;
|
||||
// rt is true if FLAG_STAGNANT was set for this particle in previous frame
|
||||
if (!rt || nt) //nt is if there is an something else besides the current particle type, around the particle
|
||||
rt = 30;//slight less water lag, although it changes how it moves a lot
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user