diff --git a/src/simulation/elements/PSNS.cpp b/src/simulation/elements/PSNS.cpp index eb7a35be3..70189d604 100644 --- a/src/simulation/elements/PSNS.cpp +++ b/src/simulation/elements/PSNS.cpp @@ -48,6 +48,8 @@ Element_PSNS::Element_PSNS() int Element_PSNS::update(UPDATE_FUNC_ARGS) { int r, rx, ry, rt; + float photonWl = 0.0f; + bool setFilt = false; if (sim->pv[y/CELL][x/CELL] > parts[i].temp-273.15f) { parts[i].life = 0; @@ -70,6 +72,35 @@ int Element_PSNS::update(UPDATE_FUNC_ARGS) } } } + if (parts[i].tmp == 1) + { + parts[i].life = 0; + setFilt = true; + photonWl = sim->pv[y / CELL][x / CELL]; + if (setFilt) + { + int nx, ny; + for (rx = -1; rx < 2; rx++) + for (ry = -1; ry < 2; ry++) + if (BOUNDS_CHECK && (rx || ry)) + { + r = pmap[y + ry][x + rx]; + if (!r) + continue; + nx = x + rx; + ny = y + ry; + while (TYP(r) == PT_FILT) + { + parts[ID(r)].ctype = 0x10000000 + roundl(photonWl) + 256; + nx += rx; + ny += ry; + if (nx < 0 || ny < 0 || nx >= XRES || ny >= YRES) + break; + r = pmap[ny][nx]; + } + } + } + } return 0; } diff --git a/src/simulation/elements/PUMP.cpp b/src/simulation/elements/PUMP.cpp index b05592e49..aafdc9739 100644 --- a/src/simulation/elements/PUMP.cpp +++ b/src/simulation/elements/PUMP.cpp @@ -63,7 +63,7 @@ int Element_PUMP::update(UPDATE_FUNC_ARGS) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) - if (!(rx && ry)) + if (parts[i].tmp != 1 && (!(rx && ry))) { sim->pv[(y/CELL)+ry][(x/CELL)+rx] += 0.1f*((parts[i].temp-273.15)-sim->pv[(y/CELL)+ry][(x/CELL)+rx]); } @@ -81,6 +81,17 @@ int Element_PUMP::update(UPDATE_FUNC_ARGS) else if (parts[ID(r)].life==0) parts[ID(r)].life = 10; } + if (parts[i].tmp == 1 && (TYP(r) == PT_FILT || TYP(r) == PT_PHOT || TYP(r) == PT_BRAY)) + { + if (parts[ID(r)].ctype >= 0x10000000 && parts[ID(r)].ctype <= 0x10000000 + 512) + { + sim->pv[(y / CELL) + ry][(x / CELL) + rx] = (parts[ID(r)].ctype - 0x10000000) - 256; + } + else + { + sim->pv[(y / CELL) + ry][(x / CELL) + rx] = 0.0f; + } + } } } return 0;