diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-11-01 20:44:49 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-11-01 20:44:49 (GMT) |
| commit | 3723147a1d0b69202dfc6e67137a19e5d0f01d25 (patch) | |
| tree | 8f9703137b62622401b20f0b22bd870903c1cb67 /src/elements | |
| parent | b0458bd5fa6903628cb663a0b789b2869ab3bad9 (diff) | |
| download | powder-3723147a1d0b69202dfc6e67137a19e5d0f01d25.zip powder-3723147a1d0b69202dfc6e67137a19e5d0f01d25.tar.gz | |
ACEL and DCEL, need to be in a better section
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/acel.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/elements/acel.c b/src/elements/acel.c new file mode 100644 index 0000000..1fe4821 --- /dev/null +++ b/src/elements/acel.c @@ -0,0 +1,58 @@ +#include <element.h> + +int update_ACEL(UPDATE_FUNC_ARGS) { + int r, rx, ry; + parts[i].tmp = 0; + for (rx=-1; rx<2; rx++) + for (ry=-1; ry<2; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry)) + { + r = pmap[y+ry][x+rx]; + if(!r) + r = photons[y+ry][x+rx]; + if ((r>>8)>=NPART || !r) + continue; + if(ptypes[r&0xFF].properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) + { + parts[r>>8].vx *= 1.1f; + parts[r>>8].vy *= 1.1f; + parts[i].tmp = 1; + } + } + return 0; +} + +int graphics_ACEL(GRAPHICS_FUNC_ARGS) +{ + if(cpart->tmp) + *pixel_mode |= PMODE_GLOW; + return 0; +} +int update_DCEL(UPDATE_FUNC_ARGS) { + int r, rx, ry; + parts[i].tmp = 0; + for (rx=-1; rx<2; rx++) + for (ry=-1; ry<2; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry)) + { + r = pmap[y+ry][x+rx]; + if(!r) + r = photons[y+ry][x+rx]; + if ((r>>8)>=NPART || !r) + continue; + if(ptypes[r&0xFF].properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) + { + parts[r>>8].vx *= 0.9f; + parts[r>>8].vy *= 0.9f; + parts[i].tmp = 1; + } + } + return 0; +} + +int graphics_DCEL(GRAPHICS_FUNC_ARGS) +{ + if(cpart->tmp) + *pixel_mode |= PMODE_GLOW; + return 0; +}
\ No newline at end of file |
