summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/clst.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/elements/clst.c b/src/elements/clst.c
new file mode 100644
index 0000000..db0eb7c
--- /dev/null
+++ b/src/elements/clst.c
@@ -0,0 +1,23 @@
+#include <element.h>
+
+int update_CLST(UPDATE_FUNC_ARGS) {
+ int r, rx, ry;
+ for (rx=-2; rx<3; rx++)
+ for (ry=-2; ry<3; ry++)
+ if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((r&0xFF)==PT_WATR && 1>(rand()%1500))
+ {
+ part_change_type(i,x,y,PT_PSTS);
+ kill_part(r>>8);
+ }
+ if ((r&0xFF)==PT_CLST)
+ {
+ parts[i].vx += 0.01*rx; parts[i].vy += 0.01*ry;
+ }
+ }
+ return 0;
+}