mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 20:42:36 +02:00
Prevent heat convection in liquids looking farther than 1px away.
This commit is contained in:
@@ -2329,8 +2329,8 @@ void Simulation::UpdateParticles(int start, int end)
|
|||||||
{
|
{
|
||||||
float convGravX, convGravY;
|
float convGravX, convGravY;
|
||||||
GetGravityField(x, y, -2.0f, -2.0f, convGravX, convGravY);
|
GetGravityField(x, y, -2.0f, -2.0f, convGravX, convGravY);
|
||||||
auto offsetX = int(std::round(convGravX + x));
|
auto offsetX = std::clamp(int(std::round(convGravX + x)), x-1, x+1);
|
||||||
auto offsetY = int(std::round(convGravY + y));
|
auto offsetY = std::clamp(int(std::round(convGravY + y)), y-1, y+1);
|
||||||
if ((offsetX != x || offsetY != y) && offsetX >= 0 && offsetX < XRES && offsetY >= 0 && offsetY < YRES) {//some heat convection for liquids
|
if ((offsetX != x || offsetY != y) && offsetX >= 0 && offsetX < XRES && offsetY >= 0 && offsetY < YRES) {//some heat convection for liquids
|
||||||
auto r = pmap[offsetY][offsetX];
|
auto r = pmap[offsetY][offsetX];
|
||||||
if (!(!r || parts[i].type != TYP(r))) {
|
if (!(!r || parts[i].type != TYP(r))) {
|
||||||
|
Reference in New Issue
Block a user