summaryrefslogtreecommitdiff
path: root/src/elements/fwrk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements/fwrk.c')
-rw-r--r--src/elements/fwrk.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/elements/fwrk.c b/src/elements/fwrk.c
new file mode 100644
index 0000000..9a8b62f
--- /dev/null
+++ b/src/elements/fwrk.c
@@ -0,0 +1,55 @@
+#include <powder.h>
+
+int update_FWRK(UPDATE_FUNC_ARGS) {
+ int r, a;
+ 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)
+ {
+ create_part(-1, x , y-1 , PT_FWRK);
+ r = pmap[y-1][x];
+ if ((r&0xFF)==PT_FWRK)
+ {
+ parts[r>>8].vy = rand()%8-22;
+ parts[r>>8].vx = rand()%20-rand()%20;
+ parts[r>>8].life=rand()%15+25;
+ parts[i].type=PT_NONE;
+ }
+ }
+ if (parts[i].life>1)
+ {
+ if (parts[i].life>=45&&parts[i].type==PT_FWRK)
+ 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 (nx=-1; nx<2; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES)
+ {
+ if (5>=rand()%8)
+ {
+ if (!pmap[y+ny][x+nx])
+ {
+ create_part(-1, x+nx, y+ny , PT_DUST);
+ pv[y/CELL][x/CELL] += 2.00f*CFDS;
+ a= pmap[y+ny][x+nx];
+ if (parts[a>>8].type==PT_DUST)
+ {
+ parts[a>>8].vy = -(rand()%10-1);
+ parts[a>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
+ parts[a>>8].life= rand()%37+18;
+ parts[a>>8].tmp=q;
+ parts[a>>8].flags=w;
+ parts[a>>8].ctype=e;
+ parts[a>>8].temp= rand()%20+6000;
+ }
+ }
+ }
+ }
+ parts[i].type=PT_NONE;
+ }
+ return 0;
+}