Skip some calls to do_move for liquids

No liquid can occupy the same space as itself unless in E-Hole
This commit is contained in:
jacksonmj 2011-05-28 17:33:13 +08:00 committed by Simon Robertshaw
parent 420f8e7442
commit ab7cd2e5f6

View File

@ -2061,19 +2061,21 @@ killed:
rt = 10; rt = 10;
for (j=clear_x+r; j>=0 && j>=clear_x-rt && j<clear_x+rt && j<XRES; j+=r) for (j=clear_x+r; j>=0 && j>=clear_x-rt && j<clear_x+rt && j<XRES; j+=r)
{ {
if (s=do_move(i, x, y, (float)j, fin_yf)) if (((pmap[fin_y][j]&0xFF)!=t || bmap[fin_y/CELL][j/CELL])
&& (s=do_move(i, x, y, (float)j, fin_yf)))
{ {
nx = (int)(parts[i].x+0.5f); nx = (int)(parts[i].x+0.5f);
ny = (int)(parts[i].y+0.5f); ny = (int)(parts[i].y+0.5f);
break; break;
} }
if (fin_y!=clear_y && (s=do_move(i, x, y, (float)j, clear_yf))) if (fin_y!=clear_y && ((pmap[clear_y][j]&0xFF)!=t || bmap[clear_y/CELL][j/CELL])
&& (s=do_move(i, x, y, (float)j, clear_yf)))
{ {
nx = (int)(parts[i].x+0.5f); nx = (int)(parts[i].x+0.5f);
ny = (int)(parts[i].y+0.5f); ny = (int)(parts[i].y+0.5f);
break; break;
} }
if ((pmap[y][j]&255)!=t || (bmap[y/CELL][j/CELL] && bmap[y/CELL][j/CELL]!=WL_STREAM)) if ((pmap[fin_y][j]&0xFF)!=t || (bmap[fin_y/CELL][j/CELL] && bmap[fin_y/CELL][j/CELL]!=WL_STREAM))
break; break;
} }
if (parts[i].vy>0) if (parts[i].vy>0)
@ -2083,7 +2085,7 @@ killed:
if (s==1) if (s==1)
for (j=ny+r; j>=0 && j<YRES && j>=ny-rt && j<ny+rt; j+=r) for (j=ny+r; j>=0 && j<YRES && j>=ny-rt && j<ny+rt; j+=r)
{ {
if (do_move(i, nx, ny, (float)nx, (float)j)) if (((pmap[j][nx]&0xFF)!=t || bmap[j/CELL][nx/CELL]) && do_move(i, nx, ny, (float)nx, (float)j))
break; break;
if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM)) if ((pmap[j][nx]&255)!=t || (bmap[j/CELL][nx/CELL] && bmap[j/CELL][nx/CELL]!=WL_STREAM))
break; break;