/* ru physics: water physics, and possibly other physics will be added later */ namespace rogue_unlike { array scale_down, scale_up; void room::physics_init() { for(int y=0; y 1 ? (o-1) / 4.1 : 0; auto flow = o / 1000. + 1e-4; if(watery(x, y+1)) { auto q = clamp(flow + pressure); water_pressure[y][x] -= q; water_pressure[y+1][x] += q * scale_down[y]; current_y[y+1][x] += q; current_y[y][x] += q; } if(flip && watery(x+1, y)) { auto q = clamp(flow + pressure); water_pressure[y][x] -= q; water_pressure[y][x+1] += q; current_x[y][x+1] += q; current_x[y][x] += q; } if(watery(x-1, y)) { auto q = clamp(flow + pressure); water_pressure[y][x] -= q; water_pressure[y][x-1] += q; current_x[y][x-1] += -q; current_x[y][x] += -q; } if(!flip && watery(x+1, y)) { auto q = clamp(flow + pressure); water_pressure[y][x] -= q; water_pressure[y][x+1] += q; current_x[y][x+1] += q; current_x[y][x] += q; } if(o > 1 && watery(x, y-1)) { auto q = clamp(pressure); water_pressure[y][x] -= q; water_pressure[y-1][x] += q * scale_up[y]; current_y[y-1][x] -= q; current_y[y][x] -= q; } } } } } for(int y=0; y 0) replace_block(x, y, wWater); } } } }