summaryrefslogtreecommitdiff
path: root/src/elements/fwrk.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-01-28 23:54:50 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-01-28 23:54:50 (GMT)
commitbcea95c5ca9b899be193c20760c634e2a3f5ad91 (patch)
tree7af3857d49748fb75c7c02d6ff3af38fbaa3450c /src/elements/fwrk.c
parent60d3f0047b21c6a1b34d07f0c0ac8c3cbc708289 (diff)
downloadpowder-bcea95c5ca9b899be193c20760c634e2a3f5ad91.zip
powder-bcea95c5ca9b899be193c20760c634e2a3f5ad91.tar.gz
update to latest
Diffstat (limited to 'src/elements/fwrk.c')
-rw-r--r--src/elements/fwrk.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/elements/fwrk.c b/src/elements/fwrk.c
new file mode 100644
index 0000000..def28e4
--- /dev/null
+++ b/src/elements/fwrk.c
@@ -0,0 +1,51 @@
+#include <element.h>
+
+int update_FWRK(UPDATE_FUNC_ARGS) {
+ int r, rx, ry, np;
+ if ((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)
+ {
+ np = create_part(-1, x , y-1 , PT_FWRK);
+ if (np!=-1)
+ {
+ parts[r>>8].vy = rand()%8-22;
+ parts[r>>8].vx = rand()%20-rand()%20;
+ parts[r>>8].life=rand()%15+25;
+ kill_part(i);
+ return 1;
+ }
+ }
+ if (parts[i].life>=45)
+ parts[i].life=0;
+ if ((parts[i].life<3&&parts[i].life>0)||parts[i].vy>6&&parts[i].life>0)
+ {
+ int q = (rand()%255+1);
+ int w = (rand()%255+1);
+ int e = (rand()%255+1);
+ for (rx=-1; rx<2; rx++)
+ for (ry=-2; ry<3; ry++)
+ if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
+ {
+ if (5>=rand()%8)
+ {
+ if (!pmap[y+ry][x+rx])
+ {
+ np = create_part(-1, x+rx, y+ry , PT_DUST);
+ pv[y/CELL][x/CELL] += 2.00f*CFDS;
+ if (np!=-1)
+ {
+ parts[r>>8].vy = -(rand()%10-1);
+ parts[r>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
+ parts[r>>8].life= rand()%37+18;
+ parts[r>>8].tmp=q;
+ parts[r>>8].flags=w;
+ parts[r>>8].ctype=e;
+ parts[r>>8].temp= rand()%20+6000;
+ }
+ }
+ }
+ }
+ kill_part(i);
+ return 1;
+ }
+ return 0;
+}