From 3702438482785414076689bfb3b8ceeaaa1fbc3a Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sun, 19 Feb 2012 00:49:04 +0000 Subject: [PATCH] Prevent gaps in beams of photons from powered clone --- includes/powder.h | 1 + src/elements/pbcn.c | 5 +++++ src/elements/pcln.c | 5 +++++ src/powder.c | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/includes/powder.h b/includes/powder.h index f198ad735..3330bb396 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -249,6 +249,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 GRAPHICS_FUNC_ARGS particle *cpart, int nx, int ny, int *pixel_mode, int* cola, int *colr, int *colg, int *colb, int *firea, int *firer, int *fireg, int *fireb #define GRAPHICS_FUNC_SUBCALL_ARGS cpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb diff --git a/src/elements/pbcn.c b/src/elements/pbcn.c index 5fb361c1f..f8424fee4 100644 --- a/src/elements/pbcn.c +++ b/src/elements/pbcn.c @@ -69,6 +69,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.c b/src/elements/pcln.c index 197263281..924ce7a8d 100644 --- a/src/elements/pcln.c +++ b/src/elements/pcln.c @@ -59,6 +59,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/powder.c b/src/powder.c index 2f427595f..c869e594c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2214,6 +2214,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;