summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-17 17:07:22 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-17 17:07:22 (GMT)
commit2417ad3b41589f07eecb6e32c913c8858589c13c (patch)
tree77e5afe0749d87eb16e5a281ff670b1f4b981475 /src
parent89788d43c3c45bf0535b200a7703b91e0297208b (diff)
downloadpowder-2417ad3b41589f07eecb6e32c913c8858589c13c.zip
powder-2417ad3b41589f07eecb6e32c913c8858589c13c.tar.gz
TPT: Prevent gaps in beams of photons from powered clone 3702438482
Diffstat (limited to 'src')
-rw-r--r--src/elements/pbcn.cpp5
-rw-r--r--src/elements/pcln.cpp5
-rw-r--r--src/simulation/Elements.h1
-rw-r--r--src/simulation/Simulation.cpp6
4 files changed, 17 insertions, 0 deletions
diff --git a/src/elements/pbcn.cpp b/src/elements/pbcn.cpp
index aa4c336..3b992d4 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 4fdffb6..ba2c721 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 9e7e654..8acafde 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 9b23ae2..8396b93 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;