From 2417ad3b41589f07eecb6e32c913c8858589c13c Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 17 Apr 2012 18:07:22 +0100 Subject: [PATCH] TPT: Prevent gaps in beams of photons from powered clone 3702438482 --- src/elements/pbcn.cpp | 5 +++++ src/elements/pcln.cpp | 5 +++++ src/simulation/Elements.h | 1 + src/simulation/Simulation.cpp | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/src/elements/pbcn.cpp b/src/elements/pbcn.cpp index aa4c33678..3b992d4e1 100644 --- a/src/elements/pbcn.cpp +++ b/src/elements/pbcn.cpp @@ -71,6 +71,11 @@ int update_PBCN(UPDATE_FUNC_ARGS) { { parts[r].vx = rx * 3; parts[r].vy = ry * 3; + if (r>i) + { + // Make sure movement doesn't happen until next frame, to avoid gaps in the beams of photons produced + parts[r].flags |= FLAG_SKIPMOVE; + } } } } diff --git a/src/elements/pcln.cpp b/src/elements/pcln.cpp index 4fdffb6cf..ba2c7215c 100644 --- a/src/elements/pcln.cpp +++ b/src/elements/pcln.cpp @@ -61,6 +61,11 @@ int update_PCLN(UPDATE_FUNC_ARGS) { { parts[r].vx = rx * 3; parts[r].vy = ry * 3; + if (r>i) + { + // Make sure movement doesn't happen until next frame, to avoid gaps in the beams of photons produced + parts[r].flags |= FLAG_SKIPMOVE; + } } } } diff --git a/src/simulation/Elements.h b/src/simulation/Elements.h index 9e7e654ea..8acafded9 100644 --- a/src/simulation/Elements.h +++ b/src/simulation/Elements.h @@ -46,6 +46,7 @@ #define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle #define FLAG_STAGNANT 1 +#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT #define ST_NONE 0 #define ST_SOLID 1 diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 9b23ae23f..8396b9397 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2922,6 +2922,12 @@ killed: if ((t==PT_PHOT||t==PT_NEUT||t==PT_ELEC)) { if (t == PT_PHOT) { + if (parts[i].flags&FLAG_SKIPMOVE) + { + parts[i].flags &= ~FLAG_SKIPMOVE; + continue; + } + rt = pmap[fin_y][fin_x] & 0xFF; lt = pmap[y][x] & 0xFF;