summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-07 16:18:22 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-07 16:18:22 (GMT)
commitf3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2 (patch)
tree804bfff0e558daf780b4330db417e93e2ef695a2 /src
parentb661418d7ecd44960f0e24eb7abd79cfc5eb5f0e (diff)
downloadpowder-f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2.zip
powder-f3ded5f08c0bbb3523a0ab2ee6e07538fabd79c2.tar.gz
More function pointers.
Diffstat (limited to 'src')
-rw-r--r--src/elements/acid.c39
-rw-r--r--src/elements/aray.c76
-rw-r--r--src/elements/bcol.c31
-rw-r--r--src/elements/bmtl.c26
-rw-r--r--src/elements/coal.c40
-rw-r--r--src/elements/deut.c72
-rw-r--r--src/elements/dstw.c37
-rw-r--r--src/elements/fog.c25
-rw-r--r--src/elements/frzz.c22
-rw-r--r--src/elements/fsep.c36
-rw-r--r--src/elements/fuse.c46
-rw-r--r--src/elements/glow.c21
-rw-r--r--src/elements/iron.c25
-rw-r--r--src/elements/none.c1
-rw-r--r--src/elements/pcln.c1
-rw-r--r--src/elements/pipe.c121
-rw-r--r--src/elements/plnt.c61
-rw-r--r--src/elements/pste.c7
-rw-r--r--src/elements/rime.c28
-rw-r--r--src/elements/sltw.c32
-rw-r--r--src/elements/spng.c97
-rw-r--r--src/elements/stkm.c1
-rw-r--r--src/elements/thdr.c35
-rw-r--r--src/elements/thrm.c31
-rw-r--r--src/elements/vine.c23
-rw-r--r--src/elements/watr.c34
-rw-r--r--src/elements/wtrv.c33
-rw-r--r--src/powder.c897
28 files changed, 999 insertions, 899 deletions
diff --git a/src/elements/acid.c b/src/elements/acid.c
new file mode 100644
index 0000000..b42379a
--- /dev/null
+++ b/src/elements/acid.c
@@ -0,0 +1,39 @@
+#include <powder.h>
+
+int update_ACID(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((r&0xFF)!=PT_ACID)
+ {
+ if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD)
+ {
+ parts[i].type = PT_FIRE;
+ parts[i].life = 4;
+ parts[r>>8].type = PT_FIRE;
+ parts[r>>8].life = 4;
+ }
+ else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50)
+ {
+ if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)
+ {
+ parts[i].life--;
+ parts[r>>8].type = PT_NONE;
+ return 1;
+ }
+ }
+ else if (parts[i].life<=50)
+ {
+ parts[i].life = 0;
+ parts[i].type = PT_NONE;
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/aray.c b/src/elements/aray.c
new file mode 100644
index 0000000..e3d142f
--- /dev/null
+++ b/src/elements/aray.c
@@ -0,0 +1,76 @@
+#include <powder.h>
+
+int update_ARAY(UPDATE_FUNC_ARGS) {
+ int r, nxx, nyy, docontinue, nxi, nyi;
+ if (parts[i].life==0) {
+ int colored =0;
+ for (nx=-1; nx<2; nx++) {
+ for (ny=-1; ny<2; ny++) {
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((r&0xFF)==PT_SPRK) {
+ int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
+ int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
+ for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
+ if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
+ break;
+ }
+ r = pmap[y+nyi+nyy][x+nxi+nxx];
+ if (!((r>>8)>=NPART)) {
+ if (!r) {
+ int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
+ if (nr!=-1) {
+ if (destroy) {
+ parts[nr].tmp = 2;
+ parts[nr].life = 2;
+ } else
+ parts[nr].ctype = colored;
+ }
+ } else if (!destroy) {
+ if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0) {
+ if (nyy!=0 || nxx!=0) {
+ parts[r>>8].type = PT_BRAY;
+ parts[r>>8].life = 1020;
+ parts[r>>8].tmp = 1;
+ if (!parts[r>>8].ctype)
+ parts[r>>8].ctype = colored;
+ }
+ docontinue = 0;
+ } else if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1) {
+ parts[r>>8].life = 1020;
+ //docontinue = 1;
+ }
+ else if (parts[r>>8].type==PT_FILT) {
+ colored = parts[r>>8].ctype;
+ } else if (parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI) {
+ if (nyy!=0 || nxx!=0) {
+ create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
+ }
+ if (!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
+ docontinue = 0;
+ } else {
+ docontinue = 1;
+ }
+ }
+ } else if (destroy) {
+ if (parts[r>>8].type==PT_BRAY) {
+ parts[r>>8].life = 1;
+ docontinue = 1;
+ } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI) {
+ docontinue = 1;
+ } else {
+ docontinue = 0;
+ }
+ }
+ }
+ }
+ }
+ //parts[i].life = 4;
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/bcol.c b/src/elements/bcol.c
new file mode 100644
index 0000000..1054935
--- /dev/null
+++ b/src/elements/bcol.c
@@ -0,0 +1,31 @@
+#include <powder.h>
+
+int update_BCOL(UPDATE_FUNC_ARGS) {
+ int r;
+ if (parts[i].life<=0) {
+ parts[i].type = PT_NONE;
+ kill_part(i);
+ create_part(-1, x, y, PT_FIRE);
+ return 1;
+ } else if (parts[i].life < 100) {
+ parts[i].life--;
+ create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
+ }
+
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
+ {
+ if (parts[i].life>100) {
+ parts[i].life = 99;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/bmtl.c b/src/elements/bmtl.c
new file mode 100644
index 0000000..e47c9b7
--- /dev/null
+++ b/src/elements/bmtl.c
@@ -0,0 +1,26 @@
+#include <powder.h>
+
+int update_BMTL(UPDATE_FUNC_ARGS) {
+ int r, rt;
+ if (parts[i].tmp>1) {
+ parts[i].tmp--;
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ rt =parts[r>>8].type;
+ if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
+ {
+ parts[r>>8].type=PT_BMTL;
+ parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
+ }
+ }
+ } else if (parts[i].tmp==1 && 1>rand()%1000) {
+ parts[i].tmp = 0;
+ parts[i].type = PT_BRMT;
+ }
+ return 0;
+}
diff --git a/src/elements/coal.c b/src/elements/coal.c
new file mode 100644
index 0000000..58ba48c
--- /dev/null
+++ b/src/elements/coal.c
@@ -0,0 +1,40 @@
+#include <powder.h>
+
+int update_COAL(UPDATE_FUNC_ARGS) {
+ int r;
+ if (parts[i].life<=0) {
+ parts[i].type = PT_NONE;
+ kill_part(i);
+ create_part(-1, x, y, PT_FIRE);
+ return 1;
+ } else if (parts[i].life < 100) {
+ parts[i].life--;
+ create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
+ }
+ if ((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
+ parts[i].tmp=39;
+ else if (parts[i].tmp<40&&parts[i].tmp>0)
+ parts[i].tmp--;
+ else if (parts[i].tmp<=0) {
+ parts[i].type = PT_NONE;
+ kill_part(i);
+ r = create_part(-1, x, y, PT_BCOL);
+ return 1;
+ }
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
+ {
+ if (parts[i].life>100) {
+ parts[i].life = 99;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/deut.c b/src/elements/deut.c
new file mode 100644
index 0000000..dc96173
--- /dev/null
+++ b/src/elements/deut.c
@@ -0,0 +1,72 @@
+#include <powder.h>
+
+int update_DEUT(UPDATE_FUNC_ARGS) {
+ int r, trade;
+ int maxlife = ((10000/(parts[i].temp + 1))-1);
+ if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
+ maxlife ++;
+ if (parts[i].life < maxlife)
+ {
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
+ continue;
+ if (parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
+ {
+ if ((parts[i].life + parts[r>>8].life + 1) <= maxlife)
+ {
+ parts[i].life += parts[r>>8].life + 1;
+ parts[r>>8].type=PT_NONE;
+ }
+ }
+ }
+ }
+ else
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || (parts[i].life<=maxlife))
+ continue;
+ if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
+ bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
+ continue;
+ if ((!r)&&parts[i].life>=1)//if nothing then create deut
+ {
+ create_part(-1,x+nx,y+ny,PT_DEUT);
+ parts[i].life--;
+ parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
+ parts[pmap[y+ny][x+nx]>>8].life = 0;
+ }
+ }
+ for ( trade = 0; trade<4; trade ++)
+ {
+ nx = rand()%5-2;
+ ny = rand()%5-2;
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_DEUT&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
+ {
+ int temp = parts[i].life - parts[r>>8].life;
+ if (temp ==1)
+ {
+ parts[r>>8].life ++;
+ parts[i].life --;
+ }
+ else if (temp>0)
+ {
+ parts[r>>8].life += temp/2;
+ parts[i].life -= temp/2;
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/dstw.c b/src/elements/dstw.c
new file mode 100644
index 0000000..1e98851
--- /dev/null
+++ b/src/elements/dstw.c
@@ -0,0 +1,37 @@
+#include <powder.h>
+
+int update_DSTW(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
+ {
+ parts[i].type = PT_WTRV;
+ }
+ else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
+ {
+ parts[i].type = PT_SLTW;
+ parts[r>>8].type = PT_SLTW;
+ }
+ if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && 1>(rand()%500))
+ {
+ parts[i].type = PT_WATR;
+ }
+ if ((r&0xFF)==PT_SLTW && 1>(rand()%500))
+ {
+ parts[i].type = PT_SLTW;
+ }
+ if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>12.0f) && 1>(rand()%500))
+ {
+ parts[i].life = 4;
+ parts[i].type = PT_FIRE;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/fog.c b/src/elements/fog.c
new file mode 100644
index 0000000..59c432f
--- /dev/null
+++ b/src/elements/fog.c
@@ -0,0 +1,25 @@
+#include <powder.h>
+
+int update_FOG(UPDATE_FUNC_ARGS) {
+ int r;
+ if (parts[i].temp>=373.15)
+ parts[i].type = PT_WTRV;
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
+ {
+ parts[i].type = PT_RIME;
+ }
+ if (parts[r>>8].type==PT_SPRK)
+ {
+ parts[i].life += rand()%20;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/frzz.c b/src/elements/frzz.c
new file mode 100644
index 0000000..3d1fdb6
--- /dev/null
+++ b/src/elements/frzz.c
@@ -0,0 +1,22 @@
+#include <powder.h>
+
+int update_FRZZ(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_WATR&&5>rand()%100)
+ {
+ parts[r>>8].type=PT_FRZW;
+ parts[r>>8].life = 100;
+ parts[i].type = PT_NONE;
+ }
+
+ }
+ return 0;
+}
diff --git a/src/elements/fsep.c b/src/elements/fsep.c
new file mode 100644
index 0000000..b6f8de3
--- /dev/null
+++ b/src/elements/fsep.c
@@ -0,0 +1,36 @@
+#include <powder.h>
+
+int update_FSEP(UPDATE_FUNC_ARGS) {
+ int r;
+ if (parts[i].life<=0) {
+ //t = PT_NONE;
+ kill_part(i);
+ r = create_part(-1, x, y, PT_PLSM);
+ if (r!=-1)
+ parts[r].life = 50;
+ return 1;
+ } else if (parts[i].life < 40) {
+ parts[i].life--;
+ if ((rand()%10)==0) {
+ r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
+ if (r!=-1)
+ parts[r].life = 50;
+ }
+ }
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
+ {
+ if (parts[i].life>40) {
+ parts[i].life = 39;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/fuse.c b/src/elements/fuse.c
new file mode 100644
index 0000000..ed554ab
--- /dev/null
+++ b/src/elements/fuse.c
@@ -0,0 +1,46 @@
+#include <powder.h>
+
+int update_FUSE(UPDATE_FUNC_ARGS) {
+ int r;
+ if (parts[i].life<=0) {
+ //t = parts[i].life = PT_NONE;
+ kill_part(i);
+ r = create_part(-1, x, y, PT_PLSM);
+ if (r!=-1)
+ parts[r].life = 50;
+ return 1;
+ } else if (parts[i].life < 40) {
+ parts[i].life--;
+ if ((rand()%100)==0) {
+ r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
+ if (r!=-1)
+ parts[r].life = 50;
+ }
+ }
+ if ((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40)
+ parts[i].tmp=39;
+ else if (parts[i].tmp<40&&parts[i].tmp>0)
+ parts[i].tmp--;
+ else if (parts[i].tmp<=0) {
+ //t = PT_NONE;
+ kill_part(i);
+ r = create_part(-1, x, y, PT_FSEP);
+ return 1;
+ }
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
+ {
+ if (parts[i].life>40) {
+ parts[i].life = 39;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/glow.c b/src/elements/glow.c
new file mode 100644
index 0000000..a4a1c57
--- /dev/null
+++ b/src/elements/glow.c
@@ -0,0 +1,21 @@
+#include <powder.h>
+
+int update_GLOW(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_WATR&&5>(rand()%2000))
+ {
+ parts[i].type = PT_NONE;
+ parts[r>>8].type = PT_DEUT;
+ parts[r>>8].life = 10;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/elements/iron.c b/src/elements/iron.c
new file mode 100644
index 0000000..4e7fe74
--- /dev/null
+++ b/src/elements/iron.c
@@ -0,0 +1,25 @@
+#include <powder.h>
+
+int update_IRON(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
+ ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
+ ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
+ ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
+ ((r&0xFF) == PT_LO2))&&
+ (!(parts[i].life))
+ )
+ {
+ parts[i].type=PT_BMTL;
+ parts[i].tmp=(rand()/(RAND_MAX/10))+20;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/none.c b/src/elements/none.c
index fc9f9a9..7e38fd0 100644
--- a/src/elements/none.c
+++ b/src/elements/none.c
@@ -2,4 +2,5 @@
int update_(UPDATE_FUNC_ARGS) {
+ return 0;
}
diff --git a/src/elements/pcln.c b/src/elements/pcln.c
index 38af102..7b1df20 100644
--- a/src/elements/pcln.c
+++ b/src/elements/pcln.c
@@ -39,4 +39,5 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
}
+ return 0;
}
diff --git a/src/elements/pipe.c b/src/elements/pipe.c
new file mode 100644
index 0000000..8c66057
--- /dev/null
+++ b/src/elements/pipe.c
@@ -0,0 +1,121 @@
+#include <powder.h>
+
+int update_PIPE(UPDATE_FUNC_ARGS) {
+ int r, trade, q, ctype;
+ if (!parts[i].ctype && parts[i].life<=10)
+ {
+ if (parts[i].temp<272.15)
+ {
+ if (parts[i].temp>173.25&&parts[i].temp<273.15)
+ {
+ parts[i].ctype = 2;
+ parts[i].life = 0;
+ }
+ if (parts[i].temp>73.25&&parts[i].temp<=173.15)
+ {
+ parts[i].ctype = 3;
+ parts[i].life = 0;
+ }
+ if (parts[i].temp>=0&&parts[i].temp<=73.15)
+ {
+ parts[i].ctype = 4;
+ parts[i].life = 0;
+ }
+ }
+ else
+ {
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART )
+ continue;
+ if (!r)
+ create_part(-1,x+nx,y+ny,PT_BRCK);
+ }
+ if (parts[i].life==1)
+ parts[i].ctype = 1;
+ }
+ }
+ if (parts[i].ctype==1)
+ {
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ continue;
+ if (!r&&!parts[i].life)
+ parts[i].life=50;
+ }
+ if (parts[i].life==2)
+ {
+ parts[i].ctype = 2;
+ parts[i].life = 6;
+ }
+ }
+ if (parts[i].ctype>1)
+ for ( q = 0; q<3; q++)
+ for ( ctype = 2; ctype<5; ctype++)
+ {
+ if (parts[i].ctype==ctype)
+ {
+ if (parts[i].life==3)
+ {
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
+ {
+ parts[r>>8].ctype = (((ctype)%3)+2);//reverse
+ parts[r>>8].life = 6;
+ }
+ }
+ }
+ else
+ {
+ nx = rand()%3-1;
+ ny = rand()%3-1;
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ continue;
+ else if (!r&&parts[i].tmp!=0)
+ {
+ if (create_part(-1,x+nx,y+ny,parts[i].tmp))
+ {
+ parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now
+ parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags;
+ }
+ parts[i].tmp = 0;
+ continue;
+ }
+ else if (!r)
+ continue;
+ else if (parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
+ {
+ parts[i].tmp = parts[r>>8].type;
+ parts[i].temp = parts[r>>8].temp;
+ parts[i].flags = parts[r>>8].life;
+ parts[r>>8].type = PT_NONE;
+ }
+ else if (parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
+ {
+ parts[r>>8].tmp = parts[i].tmp;
+ parts[r>>8].temp = parts[i].temp;
+ parts[r>>8].flags = parts[i].flags;
+ parts[i].tmp = 0;
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/plnt.c b/src/elements/plnt.c
new file mode 100644
index 0000000..695e1b8
--- /dev/null
+++ b/src/elements/plnt.c
@@ -0,0 +1,61 @@
+#include <powder.h>
+
+int update_PLNT(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((r&0xFF)==PT_WATR && 1>(rand()%250))
+ {
+ parts[i].type = PT_PLNT;
+ parts[r>>8].type = PT_PLNT;
+ parts[r>>8].life = 0;
+ }
+ else if ((r&0xFF)==PT_LAVA && 1>(rand()%250))
+ {
+ parts[i].life = 4;
+ parts[i].type = PT_FIRE;
+ }
+ else if ((r&0xFF)==PT_SMKE && (1>rand()%250))
+ {
+ parts[r>>8].type = PT_NONE;
+ parts[i].life = rand()%60 + 60;
+ }
+ else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
+ {
+ int nnx = rand()%3 -1;
+ int nny = rand()%3 -1;
+ if (x+nx+nnx>=0 && y+ny+nny>0 &&
+ x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
+ {
+ if ((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx])
+ continue;
+ if (create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE))
+ parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp;
+ }
+ }
+ //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
+ //t = parts[i].type = PT_WATR;
+ }
+ if (parts[i].life==2)
+ {
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ continue;
+ if (!r)
+ create_part(-1,x+nx,y+ny,PT_O2);
+ }
+ parts[i].life = 0;
+ }
+ return 0;
+}
diff --git a/src/elements/pste.c b/src/elements/pste.c
deleted file mode 100644
index 89f965c..0000000
--- a/src/elements/pste.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <powder.h>
-
-int update_PSTE(UPDATE_FUNC_ARGS) {
- if (parts[i].temp>747.0f)
- parts[i].type = PT_BRCK;
- return 0;
-}
diff --git a/src/elements/rime.c b/src/elements/rime.c
new file mode 100644
index 0000000..d78e322
--- /dev/null
+++ b/src/elements/rime.c
@@ -0,0 +1,28 @@
+#include <powder.h>
+
+int update_RIME(UPDATE_FUNC_ARGS) {
+ int r, rt;
+ parts[i].vx = 0;
+ parts[i].vy = 0;
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ rt = parts[r>>8].type;
+ if (rt==PT_SPRK)
+ {
+ parts[i].type = PT_FOG;
+ parts[i].life = rand()%50 + 60;
+ }
+ else if (rt==PT_FOG&&parts[r>>8].life>0)
+ {
+ parts[i].type = PT_FOG;
+ parts[i].life = parts[r>>8].life;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/sltw.c b/src/elements/sltw.c
new file mode 100644
index 0000000..e45a03d
--- /dev/null
+++ b/src/elements/sltw.c
@@ -0,0 +1,32 @@
+#include <powder.h>
+
+int update_SLTW(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
+ {
+ parts[i].type = PT_SALT;
+ parts[r>>8].type = PT_WTRV;
+ }
+ else if ((r&0xFF)==PT_SALT && 1>(rand()%10000))
+ {
+ parts[r>>8].type = PT_NONE;
+ }
+ if ((r&0xFF)==PT_PLNT&&5>(rand()%1000))
+ parts[r>>8].type = PT_NONE;
+ if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && parts[i].temp>12.0f && 1>(rand()%500))
+ {
+ parts[i].life = 4;
+ parts[i].type = PT_FIRE;
+
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/spng.c b/src/elements/spng.c
new file mode 100644
index 0000000..4f0675d
--- /dev/null
+++ b/src/elements/spng.c
@@ -0,0 +1,97 @@
+#include <powder.h>
+
+int update_SPNG(UPDATE_FUNC_ARGS) {
+ int r, trade;
+ if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3)
+ {
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r || parts[i].temp>374.0f)
+ continue;
+ if (parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
+ {
+ parts[i].life++;
+ parts[r>>8].type=PT_NONE;
+ }
+ }
+ }
+ else
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ continue;
+ if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
+ bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
+ continue;
+ if ((!r)&&parts[i].life>=1)//if nothing then create water
+ {
+ create_part(-1,x+nx,y+ny,PT_WATR);
+ parts[i].life--;
+ }
+ }
+ for ( trade = 0; trade<9; trade ++)
+ {
+ nx = rand()%5-2;
+ ny = rand()%5-2;
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_SPNG&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
+ {
+ int temp = parts[i].life - parts[r>>8].life;
+ if (temp ==1)
+ {
+ parts[r>>8].life ++;
+ parts[i].life --;
+ trade = 9;
+ }
+ else if (temp>0)
+ {
+ parts[r>>8].life += temp/2;
+ parts[i].life -= temp/2;
+ trade = 9;
+ }
+ }
+ }
+ }
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (parts[r>>8].type==PT_FIRE&&parts[i].life>0)
+ {
+ if (parts[i].life<=2)
+ parts[i].life --;
+ parts[i].life -= parts[i].life/3;
+ }
+ }
+ if (parts[i].temp>=374)
+ for (nx=-1; nx<2; nx++)
+ for (ny=-1; ny<2; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ continue;
+ if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID))
+ continue;
+ if ((!r)&&parts[i].life>=1)//if nothing then create steam
+ {
+ create_part(-1,x+nx,y+ny,PT_WTRV);
+ parts[i].life--;
+ parts[i].temp -= 40.0f;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/stkm.c b/src/elements/stkm.c
index 0402d93..8b581b8 100644
--- a/src/elements/stkm.c
+++ b/src/elements/stkm.c
@@ -400,4 +400,5 @@ int update_STKM(UPDATE_FUNC_ARGS) {
parts[i].life -= 1;
isplayer = 1;
+ return 0;
}
diff --git a/src/elements/thdr.c b/src/elements/thdr.c
new file mode 100644
index 0000000..3592d9e
--- /dev/null
+++ b/src/elements/thdr.c
@@ -0,0 +1,35 @@
+#include <powder.h>
+
+int update_THDR(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK)
+ {
+ parts[i].type = PT_NONE;
+ parts[r>>8].ctype = parts[r>>8].type;
+ parts[r>>8].type = PT_SPRK;
+ parts[r>>8].life = 4;
+ }
+ else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF))
+ {
+ pv[y/CELL][x/CELL] += 100.0f;
+ if (legacy_enable&&1>(rand()%200))
+ {
+ parts[i].life = rand()%50+120;
+ parts[i].type = PT_FIRE;
+ }
+ else
+ {
+ parts[i].type = PT_NONE;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/thrm.c b/src/elements/thrm.c
new file mode 100644
index 0000000..3d82d46
--- /dev/null
+++ b/src/elements/thrm.c
@@ -0,0 +1,31 @@
+#include <powder.h>
+
+int update_THRM(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA))
+ {
+ if (1>(rand()%500)) {
+ parts[i].type = PT_LAVA;
+ parts[i].ctype = PT_BMTL;
+ parts[i].temp = 3500.0f;
+ pv[y/CELL][x/CELL] += 50.0f;
+ } else {
+ parts[i].type = PT_LAVA;
+ parts[i].life = 400;
+ parts[i].ctype = PT_THRM;
+ parts[i].temp = 3500.0f;
+ parts[i].tmp = 20;
+ }
+ }
+ //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
+ //t = parts[i].type = PT_WATR;
+ }
+ return 0;
+}
diff --git a/src/elements/vine.c b/src/elements/vine.c
new file mode 100644
index 0000000..3932263
--- /dev/null
+++ b/src/elements/vine.c
@@ -0,0 +1,23 @@
+#include <powder.h>
+
+int update_VINE(UPDATE_FUNC_ARGS) {
+ int r;
+ nx=(rand()%3)-1;
+ ny=(rand()%3)-1;
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART)
+ return 1;
+ if (1>rand()%15)
+ parts[i].type=PT_PLNT;
+ else if (!r)
+ {
+ create_part(-1,x+nx,y+ny,PT_VINE);
+ parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
+ parts[i].type=PT_PLNT;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/watr.c b/src/elements/watr.c
new file mode 100644
index 0000000..6583422
--- /dev/null
+++ b/src/elements/watr.c
@@ -0,0 +1,34 @@
+#include <powder.h>
+
+int update_WATR(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
+ {
+ parts[i].type = PT_WTRV;
+ }
+ else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
+ {
+ parts[i].type = PT_SLTW;
+ parts[r>>8].type = PT_SLTW;
+ }
+ if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||parts[i].temp>12.0f) && 1>(rand()%500))
+ {
+ parts[i].life = 4;
+ parts[i].type = PT_FIRE;
+ }
+ if ((r&0xFF)==PT_CNCT && 1>(rand()%500))
+ {
+ parts[i].type = PT_PSTE;
+ parts[r>>8].type = PT_NONE;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/wtrv.c b/src/elements/wtrv.c
new file mode 100644
index 0000000..ff7b869
--- /dev/null
+++ b/src/elements/wtrv.c
@@ -0,0 +1,33 @@
+#include <powder.h>
+
+int update_WTRV(UPDATE_FUNC_ARGS) {
+ int r;
+ for (nx=-2; nx<3; nx++)
+ for (ny=-2; ny<3; ny++)
+ if (x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable)
+ {
+ parts[i].type = PT_WATR;
+ parts[r>>8].type = PT_WATR;
+ }
+
+ if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && parts[i].temp>12.0f && 1>(rand()%500))
+ {
+ parts[i].life = 4;
+ parts[i].type = PT_FIRE;
+
+ }
+ if (((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable)
+ {
+ parts[i].type = PT_WATR;
+ if (1>(rand()%1000))
+ parts[r>>8].type = PT_WATR;
+ }
+ }
+ return 0;
+}
diff --git a/src/powder.c b/src/powder.c
index 8bd89d5..5345eea 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1610,7 +1610,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life = rand()%50+120;
}
}
-
+
s = 1;
if (pv[y/CELL][x/CELL]>ptransitions[t].phv&&ptransitions[t].pht>-1) {
if (ptransitions[t].pht!=PT_NUM)
@@ -1638,7 +1638,7 @@ void update_particles_i(pixel *vid, int start, int inc)
goto killed;
}
}
-
+
if (t==PT_GLAS)
{
parts[i].pavg[0] = parts[i].pavg[1];
@@ -1876,39 +1876,8 @@ void update_particles_i(pixel *vid, int start, int inc)
set_emap(nx, ny);
fe = 0;
- if (t==PT_THDR)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_METL || (r&0xFF)==PT_IRON || (r&0xFF)==PT_ETRD || (r&0xFF)==PT_PSCN || (r&0xFF)==PT_NSCN || (r&0xFF)==PT_NTCT || (r&0xFF)==PT_PTCT || (r&0xFF)==PT_BMTL || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD || (r&0xFF)==PT_BRMT || (r&0xFF)==PT_NBLE || (r&0xFF)==PT_INWR) && parts[r>>8].ctype!=PT_SPRK)
- {
- t = parts[i].type = PT_NONE;
- parts[r>>8].ctype = parts[r>>8].type;
- parts[r>>8].type = PT_SPRK;
- parts[r>>8].life = 4;
- }
- else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT&&(r&0xFF))
- {
- pv[y/CELL][x/CELL] += 100.0f;
- if (legacy_enable&&1>(rand()%200))
- {
- parts[i].life = rand()%50+120;
- t = parts[i].type = PT_FIRE;
- }
- else
- {
- t = parts[i].type = PT_NONE;
- }
- }
- }
- }
- else if (t==PT_ICEI || t==PT_SNOW)
+
+ if (t==PT_ICEI || t==PT_SNOW)
{
if (parts[i].ctype==PT_FRZW)
{
@@ -1942,50 +1911,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if (t==PT_BMTL) {
- if (parts[i].tmp>1) {
- parts[i].tmp--;
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- rt =parts[r>>8].type;
- if ((rt==PT_METL || rt==PT_IRON) && 1>(rand()/(RAND_MAX/100)))
- {
- parts[r>>8].type=PT_BMTL;
- parts[r>>8].tmp=(parts[i].tmp<=7)?parts[i].tmp=1:parts[i].tmp-(rand()%5);//rand()/(RAND_MAX/300)+100;
- }
- }
- } else if (parts[i].tmp==1 && 1>rand()%1000) {
- parts[i].tmp = 0;
- t = parts[i].type = PT_BRMT;
- }
- }
-
- else if (t==PT_IRON) {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if ((((r&0xFF) == PT_SALT && 15>(rand()/(RAND_MAX/700))) ||
- ((r&0xFF) == PT_SLTW && 30>(rand()/(RAND_MAX/2000))) ||
- ((r&0xFF) == PT_WATR && 5 >(rand()/(RAND_MAX/6000))) ||
- ((r&0xFF) == PT_O2 && 2 >(rand()/(RAND_MAX/500))) ||
- ((r&0xFF) == PT_LO2))&&
- (!(parts[i].life))
- )
- {
- parts[i].type=PT_BMTL;
- parts[i].tmp=(rand()/(RAND_MAX/10))+20;
- }
- }
- }
else if ((t==PT_SPRK||parts[i].type==PT_SPRK) && parts[i].ctype==PT_IRON) {
for (nx=-1; nx<2; nx++)
for (ny=-1; ny<2; ny++)
@@ -2003,217 +1928,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if (t==PT_COAL)
- {
- if (parts[i].life<=0) {
- t = PT_NONE;
- kill_part(i);
- create_part(-1, x, y, PT_FIRE);
- goto killed;
- } else if (parts[i].life < 100) {
- parts[i].life--;
- create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
- }
- if ((pv[y/CELL][x/CELL] > 4.3f)&&parts[i].tmp>40)
- parts[i].tmp=39;
- else if (parts[i].tmp<40&&parts[i].tmp>0)
- parts[i].tmp--;
- else if (parts[i].tmp<=0) {
- t = PT_NONE;
- kill_part(i);
- r = create_part(-1, x, y, PT_BCOL);
- goto killed;
- }
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
- {
- if (parts[i].life>100) {
- parts[i].life = 99;
- }
- }
- }
- }
- else if (t==PT_BCOL)
- {
- if (parts[i].life<=0) {
- t = PT_NONE;
- kill_part(i);
- create_part(-1, x, y, PT_FIRE);
- goto killed;
- } else if (parts[i].life < 100) {
- parts[i].life--;
- create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
- }
-
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM) && 1>(rand()%500))
- {
- if (parts[i].life>100) {
- parts[i].life = 99;
- }
- }
- }
- }
- else if (t==PT_ARAY && parts[i].life==0) {
- int colored =0;
- for (nx=-1; nx<2; nx++) {
- for (ny=-1; ny<2; ny++) {
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)) {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if ((r&0xFF)==PT_SPRK) {
- int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
- int nostop = (parts[r>>8].ctype==PT_INST)?1:0;
- for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
- if (!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)) {
- break;
- }
- r = pmap[y+nyi+nyy][x+nxi+nxx];
- if (!((r>>8)>=NPART)) {
- if (!r) {
- int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
- if (nr!=-1) {
- if (destroy) {
- parts[nr].tmp = 2;
- parts[nr].life = 2;
- } else
- parts[nr].ctype = colored;
- }
- } else if (!destroy) {
- if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0) {
- if (nyy!=0 || nxx!=0) {
- parts[r>>8].type = PT_BRAY;
- parts[r>>8].life = 1020;
- parts[r>>8].tmp = 1;
- if (!parts[r>>8].ctype)
- parts[r>>8].ctype = colored;
- }
- docontinue = 0;
- } else if (parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1) {
- parts[r>>8].life = 1020;
- //docontinue = 1;
- }
- else if (parts[r>>8].type==PT_FILT) {
- colored = parts[r>>8].ctype;
- } else if (parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI) {
- if (nyy!=0 || nxx!=0) {
- create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
- }
- if (!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
- docontinue = 0;
- } else {
- docontinue = 1;
- }
- }
- } else if (destroy) {
- if (parts[r>>8].type==PT_BRAY) {
- parts[r>>8].life = 1;
- docontinue = 1;
- } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI) {
- docontinue = 1;
- } else {
- docontinue = 0;
- }
- }
- }
- }
- }
- //parts[i].life = 4;
- }
- }
- }
- }
- else if (t==PT_FUSE)
- {
- if (parts[i].life<=0) {
- //t = parts[i].life = PT_NONE;
- kill_part(i);
- r = create_part(-1, x, y, PT_PLSM);
- if (r!=-1)
- parts[r].life = 50;
- goto killed;
- } else if (parts[i].life < 40) {
- parts[i].life--;
- if ((rand()%100)==0) {
- r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
- if (r!=-1)
- parts[r].life = 50;
- }
- }
- if ((pv[y/CELL][x/CELL] > 2.7f)&&parts[i].tmp>40)
- parts[i].tmp=39;
- else if (parts[i].tmp<40&&parts[i].tmp>0)
- parts[i].tmp--;
- else if (parts[i].tmp<=0) {
- //t = PT_NONE;
- kill_part(i);
- r = create_part(-1, x, y, PT_FSEP);
- goto killed;
- }
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20)))
- {
- if (parts[i].life>40) {
- parts[i].life = 39;
- }
- }
- }
- }
- else if (t==PT_FSEP)
- {
- if (parts[i].life<=0) {
- //t = PT_NONE;
- kill_part(i);
- r = create_part(-1, x, y, PT_PLSM);
- if (r!=-1)
- parts[r].life = 50;
- goto killed;
- } else if (parts[i].life < 40) {
- parts[i].life--;
- if ((rand()%10)==0) {
- r = create_part(-1, (nx=x+rand()%3-1), (ny=y+rand()%3-1), PT_PLSM);
- if (r!=-1)
- parts[r].life = 50;
- }
- }
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && 1>(rand()%15))
- {
- if (parts[i].life>40) {
- parts[i].life = 39;
- }
- }
- }
- }
else if (t==PT_NTCT||t==PT_PTCT||t==PT_INWR)
{
for (nx=-2; nx<3; nx++)
@@ -2230,210 +1944,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if (t==PT_PLNT)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if ((r&0xFF)==PT_WATR && 1>(rand()%250))
- {
- t = parts[i].type = PT_PLNT;
- parts[r>>8].type = PT_PLNT;
- parts[r>>8].life = 0;
- }
- else if ((r&0xFF)==PT_LAVA && 1>(rand()%250))
- {
- parts[i].life = 4;
- t = parts[i].type = PT_FIRE;
- }
- else if ((r&0xFF)==PT_SMKE && (1>rand()%250))
- {
- parts[r>>8].type = PT_NONE;
- parts[i].life = rand()%60 + 60;
- }
- else if ((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
- {
- int nnx = rand()%3 -1;
- int nny = rand()%3 -1;
- if (x+nx+nnx>=0 && y+ny+nny>0 &&
- x+nx+nnx<XRES && y+ny+nny<YRES && (nnx || nny))
- {
- if ((pmap[y+ny+nny][x+nx+nnx]>>8)>=NPART||pmap[y+ny+nny][x+nx+nnx])
- continue;
- if (create_part(-1,x+nx+nnx,y+ny+nny,PT_VINE))
- parts[pmap[y+ny+nny][x+nx+nnx]>>8].temp = parts[i].temp;
- }
- }
- //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
- //t = parts[i].type = PT_WATR;
- }
- if (parts[i].life==2)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART)
- continue;
- if (!r)
- create_part(-1,x+nx,y+ny,PT_O2);
- }
- parts[i].life = 0;
- }
- }
- else if (t==PT_VINE)
- {
- nx=(rand()%3)-1;
- ny=(rand()%3)-1;
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART)
- continue;
- if (1>rand()%15)
- parts[i].type=PT_PLNT;
- else if (!r)
- {
- create_part(-1,x+nx,y+ny,PT_VINE);
- parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
- parts[i].type=PT_PLNT;
- }
- }
- }
- else if (t==PT_THRM)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA))
- {
- if (1>(rand()%500)) {
- t = parts[i].type = PT_LAVA;
- parts[i].ctype = PT_BMTL;
- pt = parts[i].temp = 3500.0f;
- pv[y/CELL][x/CELL] += 50.0f;
- } else {
- t = parts[i].type = PT_LAVA;
- parts[i].life = 400;
- parts[i].ctype = PT_THRM;
- pt = parts[i].temp = 3500.0f;
- parts[i].tmp = 20;
- }
- }
- //if(t==PT_SNOW && (r&0xFF)==PT_WATR && 15>(rand()%1000))
- //t = parts[i].type = PT_WATR;
- }
- }
- else if (t==PT_WATR||t==PT_DSTW)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
- {
- t = parts[i].type = PT_WTRV;
- }
- else if ((r&0xFF)==PT_SALT && 1>(rand()%250))
- {
- t = parts[i].type = PT_SLTW;
- parts[r>>8].type = PT_SLTW;
- }
- if ((((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW)&&t==PT_DSTW) && 1>(rand()%500))
- {
- t = parts[i].type = PT_WATR;
- }
- if (((r&0xFF)==PT_SLTW&&t==PT_DSTW) && 1>(rand()%500))
- {
- t = parts[i].type = PT_SLTW;
- }
- if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (legacy_enable||pt>12.0f) && 1>(rand()%500))
- {
- parts[i].life = 4;
- t = parts[i].type = PT_FIRE;
- }
- if (((r&0xFF)==PT_CNCT&&t==PT_WATR) && 1>(rand()%500))
- {
- t = parts[i].type = PT_PSTE;
- parts[r>>8].type = PT_NONE;
- }
- }
- }
- else if (t==PT_SLTW)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_LAVA) && 1>(rand()%10) && legacy_enable)
- {
- t = parts[i].type = PT_SALT;
- parts[r>>8].type = PT_WTRV;
- }
- else if ((r&0xFF)==PT_SALT && 1>(rand()%10000))
- {
- parts[r>>8].type = PT_NONE;
- }
- if ((r&0xFF)==PT_PLNT&&5>(rand()%1000))
- parts[r>>8].type = PT_NONE;
- if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
- {
- parts[i].life = 4;
- t = parts[i].type = PT_FIRE;
-
- }
- }
- }
- else if (t==PT_WTRV)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (((r&0xFF)==PT_WATR||(r&0xFF)==PT_DSTW||(r&0xFF)==PT_SLTW) && 1>(rand()%1000) && legacy_enable)
- {
- t = parts[i].type = PT_WATR;
- parts[r>>8].type = PT_WATR;
- }
-
- if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && pt>12.0f && 1>(rand()%500))
- {
- parts[i].life = 4;
- t = parts[i].type = PT_FIRE;
-
- }
- if (((r&0xFF)==PT_ICEI || (r&0xFF)==PT_SNOW) && 1>(rand()%1000) && legacy_enable)
- {
- t = parts[i].type = PT_WATR;
- if (1>(rand()%1000))
- parts[r>>8].type = PT_WATR;
- }
- }
- }
else if (t==PT_YEST)
{
for (nx=-2; nx<3; nx++)
@@ -2450,40 +1960,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if (t==PT_ACID)
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if ((r&0xFF)!=PT_ACID)
- {
- if ((r&0xFF)==PT_PLEX || (r&0xFF)==PT_NITR || (r&0xFF)==PT_GUNP || (r&0xFF)==PT_RBDM || (r&0xFF)==PT_LRBD)
- {
- t = parts[i].type = PT_FIRE;
- parts[i].life = 4;
- parts[r>>8].type = PT_FIRE;
- parts[r>>8].life = 4;
- }
- else if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && ptypes[parts[r>>8].type].hardness>(rand()%1000))&&parts[i].life>=50)
- {
- if (parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)
- {
- parts[i].life--;
- parts[r>>8].type = PT_NONE;
- }
- }
- else if (parts[i].life<=50)
- {
- parts[i].life = 0;
- t = parts[i].type = PT_NONE;
- }
- }
- }
- }
else if (t==PT_NEUT)
{
rt = 3 + (int)pv[y/CELL][x/CELL];
@@ -2632,23 +2108,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if (t==PT_GLOW)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (parts[r>>8].type==PT_WATR&&5>(rand()%2000))
- {
- t = parts[i].type = PT_NONE;
- parts[r>>8].type = PT_DEUT;
- parts[r>>8].life = 10;
- }
- }
- }
else if (t==PT_MORT) {
create_part(-1, x, y-1, PT_SMKE);
}
@@ -2664,216 +2123,7 @@ void update_particles_i(pixel *vid, int start, int inc)
ISLOLZ=1;
else if (t==PT_GRAV)
ISGRAV=1;
- else if (t==PT_SPNG)
- {
- if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r || parts[i].temp>374.0f)
- continue;
- if (parts[r>>8].type==PT_WATR&&33>=rand()/(RAND_MAX/100)+1)
- {
- parts[i].life++;
- parts[r>>8].type=PT_NONE;
- }
- }
- }
- else
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART)
- continue;
- if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
- bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
- continue;
- if ((!r)&&parts[i].life>=1)//if nothing then create water
- {
- create_part(-1,x+nx,y+ny,PT_WATR);
- parts[i].life--;
- }
- }
- for ( trade = 0; trade<9; trade ++)
- {
- nx = rand()%5-2;
- ny = rand()%5-2;
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
- {
- int temp = parts[i].life - parts[r>>8].life;
- if (temp ==1)
- {
- parts[r>>8].life ++;
- parts[i].life --;
- trade = 9;
- }
- else if (temp>0)
- {
- parts[r>>8].life += temp/2;
- parts[i].life -= temp/2;
- trade = 9;
- }
- }
- }
- }
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (parts[r>>8].type==PT_FIRE&&parts[i].life>0)
- {
- if (parts[i].life<=2)
- parts[i].life --;
- parts[i].life -= parts[i].life/3;
- }
- }
- if (parts[i].temp>=374)
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART)
- continue;
- if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWLIQUID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID))
- continue;
- if ((!r)&&parts[i].life>=1)//if nothing then create steam
- {
- create_part(-1,x+nx,y+ny,PT_WTRV);
- parts[i].life--;
- parts[i].temp -= 40.0f;
- }
- }
- }
- else if (t==PT_FOG)
- {
- if (parts[i].temp>=373.15)
- t = parts[i].type = PT_WTRV;
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (pstates[parts[r>>8].type].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!(parts[r>>8].type==PT_CLNE||parts[r>>8].type==PT_PCLN))
- {
- t = parts[i].type = PT_RIME;
- }
- if (parts[r>>8].type==PT_SPRK)
- {
- parts[i].life += rand()%20;
- }
- }
- }
- else if (t==PT_RIME)
- {
- parts[i].vx = 0;
- parts[i].vy = 0;
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- rt = parts[r>>8].type;
- if (rt==PT_SPRK)
- {
- t = parts[i].type = PT_FOG;
- parts[i].life = rand()%50 + 60;
- }
- else if (rt==PT_FOG&&parts[r>>8].life>0)
- {
- t = parts[i].type = PT_FOG;
- parts[i].life = parts[r>>8].life;
- }
- }
- }
- else if (t==PT_DEUT)
- {
- int maxlife = ((10000/(parts[i].temp + 1))-1);
- if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
- maxlife ++;
- if (parts[i].life < maxlife)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r || (parts[i].life >=maxlife))
- continue;
- if (parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1)
- {
- if ((parts[i].life + parts[r>>8].life + 1) <= maxlife)
- {
- parts[i].life += parts[r>>8].life + 1;
- parts[r>>8].type=PT_NONE;
- }
- }
- }
- }
- else
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || (parts[i].life<=maxlife))
- continue;
- if ((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL||
- bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS))
- continue;
- if ((!r)&&parts[i].life>=1)//if nothing then create deut
- {
- create_part(-1,x+nx,y+ny,PT_DEUT);
- parts[i].life--;
- parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
- parts[pmap[y+ny][x+nx]>>8].life = 0;
- }
- }
- for ( trade = 0; trade<4; trade ++)
- {
- nx = rand()%5-2;
- ny = rand()%5-2;
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
- {
- int temp = parts[i].life - parts[r>>8].life;
- if (temp ==1)
- {
- parts[r>>8].life ++;
- parts[i].life --;
- }
- else if (temp>0)
- {
- parts[r>>8].life += temp/2;
- parts[i].life -= temp/2;
- }
- }
- }
- }
- }
+
else if (t==PT_WARP)
{
for ( trade = 0; trade<5; trade ++)
@@ -3067,143 +2317,6 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if (t==PT_PIPE)
- {
- if (!parts[i].ctype && parts[i].life<=10)
- {
- if (parts[i].temp<272.15)
- {
- if (parts[i].temp>173.25&&parts[i].temp<273.15)
- {
- parts[i].ctype = 2;
- parts[i].life = 0;
- }
- if (parts[i].temp>73.25&&parts[i].temp<=173.15)
- {
- parts[i].ctype = 3;
- parts[i].life = 0;
- }
- if (parts[i].temp>=0&&parts[i].temp<=73.15)
- {
- parts[i].ctype = 4;
- parts[i].life = 0;
- }
- }
- else
- {
- for (nx=-2; nx<3; nx++)
- for (ny=-2; ny<3; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART )
- continue;
- if (!r)
- create_part(-1,x+nx,y+ny,PT_BRCK);
- }
- if (parts[i].life==1)
- parts[i].ctype = 1;
- }
- }
- if (parts[i].ctype==1)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART)
- continue;
- if (!r&&!parts[i].life)
- parts[i].life=50;
- }
- if (parts[i].life==2)
- {
- parts[i].ctype = 2;
- parts[i].life = 6;
- }
- }
- if (parts[i].ctype>1)
- for ( q = 0; q<3; q++)
- for ( ctype = 2; ctype<5; ctype++)
- {
- if (parts[i].ctype==ctype)
- {
- if (parts[i].life==3)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (parts[r>>8].type==PT_PIPE&&parts[r>>8].ctype==1)
- {
- parts[r>>8].ctype = (((ctype)%3)+2);//reverse
- parts[r>>8].life = 6;
- }
- }
- }
- else
- {
- nx = rand()%3-1;
- ny = rand()%3-1;
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART)
- continue;
- else if (!r&&parts[i].tmp!=0)
- {
- if (create_part(-1,x+nx,y+ny,parts[i].tmp))
- {
- parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;//pipe saves temp and life now
- parts[pmap[y+ny][x+nx]>>8].life = parts[i].flags;
- }
- parts[i].tmp = 0;
- continue;
- }
- else if (!r)
- continue;
- else if (parts[i].tmp == 0 && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
- {
- parts[i].tmp = parts[r>>8].type;
- parts[i].temp = parts[r>>8].temp;
- parts[i].flags = parts[r>>8].life;
- parts[r>>8].type = PT_NONE;
- }
- else if (parts[r>>8].type==PT_PIPE && parts[r>>8].ctype!=(((ctype)%3)+2) && parts[r>>8].tmp==0&&parts[i].tmp>0)
- {
- parts[r>>8].tmp = parts[i].tmp;
- parts[r>>8].temp = parts[i].temp;
- parts[r>>8].flags = parts[i].flags;
- parts[i].tmp = 0;
- }
- }
- }
- }
- }
- }
- else if (t==PT_FRZZ)
- {
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 &&
- x+nx<XRES && y+ny<YRES && (nx || ny))
- {
- r = pmap[y+ny][x+nx];
- if ((r>>8)>=NPART || !r)
- continue;
- if (parts[r>>8].type==PT_WATR&&5>rand()%100)
- {
- parts[r>>8].type=PT_FRZW;
- parts[r>>8].life = 100;
- t = parts[i].type = PT_NONE;
- }
-
- }
- }
else if (t==PT_FRZW)
{
for (nx=-1; nx<2; nx++)