summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/aray.c4
-rw-r--r--src/elements/boyl.c43
-rw-r--r--src/elements/neut.c8
-rw-r--r--src/elements/prti.c1
-rw-r--r--src/elements/prto.c2
-rw-r--r--src/elements/stkm.c5
-rw-r--r--src/elements/stkm2.c5
-rw-r--r--src/elements/swch.c8
8 files changed, 68 insertions, 8 deletions
diff --git a/src/elements/aray.c b/src/elements/aray.c
index 136158a..a931b1a 100644
--- a/src/elements/aray.c
+++ b/src/elements/aray.c
@@ -44,7 +44,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
}
else if ((r&0xFF)==PT_FILT) {
colored = parts[r>>8].ctype;
- } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI) {
+ } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI && !((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
if (nyy!=0 || nxx!=0) {
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}
@@ -58,7 +58,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
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) {
+ } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI || parts[r>>8].type==PT_FILT || (parts[r>>8].type==PT_SWCH && parts[r>>8].life>=10)) {
docontinue = 1;
} else {
docontinue = 0;
diff --git a/src/elements/boyl.c b/src/elements/boyl.c
new file mode 100644
index 0000000..7486d2e
--- /dev/null
+++ b/src/elements/boyl.c
@@ -0,0 +1,43 @@
+#include <powder.h>
+
+int update_BOYL(UPDATE_FUNC_ARGS) {
+ int r, rx, ry;
+ if (pv[y/CELL][x/CELL]<(parts[i].temp/100))
+ pv[y/CELL][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL]);
+ if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp/100))
+ pv[y/CELL+1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL]);
+ if (x+CELL<XRES)
+ {
+ pv[y/CELL][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL+1]);
+ if (y+CELL<YRES)
+ pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL+1]);
+ }
+ if (y+CELL>0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100))
+ pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL]);
+ if (x+CELL>0)
+ {
+ pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL-1]);
+ if (y+CELL>0)
+ pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL-1]);
+ }
+ 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))
+ {
+ r = pmap[y+ry][x+rx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if ((r&0xFF)==PT_WATR && 1>rand()%30)
+ {
+ part_change_type(r>>8,x+rx,y+ry,PT_FOG);
+ }
+ else if ((r&0xFF)==PT_O2 && 1>rand()%9)
+ {
+ kill_part(r>>8);
+ part_change_type(i,x,y,PT_WATR);
+ pv[y/CELL][x/CELL] += 4.0;
+ }
+ }
+ return 0;
+}
diff --git a/src/elements/neut.c b/src/elements/neut.c
index 61511d1..564b74c 100644
--- a/src/elements/neut.c
+++ b/src/elements/neut.c
@@ -57,12 +57,8 @@ int update_NEUT(UPDATE_FUNC_ARGS) {
part_change_type(i,x,y,PT_DUST);
else if ((r&0xFF)==PT_DYST && 15>(rand()%1000))
part_change_type(i,x,y,PT_YEST);
- else if ((r&0xFF)==PT_YEST) {
- if (15>(rand()%100000)&&isplayer==0)
- create_part(r>>8, x+rx, y+ry, PT_STKM);
- else
- part_change_type(i,x,y,PT_DYST);
- }
+ else if ((r&0xFF)==PT_YEST)
+ part_change_type(i,x,y,PT_DYST);
else if ((r&0xFF)==PT_WATR && 15>(rand()%100))
part_change_type(r>>8,x+rx,y+ry,PT_DSTW);
else if ((r&0xFF)==PT_PLEX && 15>(rand()%1000))
diff --git a/src/elements/prti.c b/src/elements/prti.c
index 4d3a4be..a7e2013 100644
--- a/src/elements/prti.c
+++ b/src/elements/prti.c
@@ -18,6 +18,7 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
{
portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type;
portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp;
+ portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype;
if (parts[r>>8].type==PT_SPRK)
part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype);
else
diff --git a/src/elements/prto.c b/src/elements/prto.c
index a5d2c7e..4889e89 100644
--- a/src/elements/prto.c
+++ b/src/elements/prto.c
@@ -40,8 +40,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]);
if (np<0) continue;
parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx];
+ parts[np].ctype = portalctype[parts[i].tmp][randomness-1][nnx];
portal[parts[i].tmp][randomness-1][nnx] = 0;
portaltemp[parts[i].tmp][randomness-1][nnx] = 0;
+ portalctype[parts[i].tmp][randomness-1][nnx] = 0;
break;
}
}
diff --git a/src/elements/stkm.c b/src/elements/stkm.c
index 2403bc2..66f9b2e 100644
--- a/src/elements/stkm.c
+++ b/src/elements/stkm.c
@@ -20,6 +20,11 @@ int update_STKM(UPDATE_FUNC_ARGS) {
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
parts[i].temp += 1;
+ if (isplayer) { //Already a stickman in the simulation
+ death = 1;
+ parts[i].type = PT_NONE;
+ }
+
//Death
if (parts[i].life<1 || death || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c
index b0a2be3..7c02043 100644
--- a/src/elements/stkm2.c
+++ b/src/elements/stkm2.c
@@ -20,6 +20,11 @@ int update_STKM2(UPDATE_FUNC_ARGS) {
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
parts[i].temp += 1;
+ if (isplayer2) { //Already a stickman2 in the simulation
+ death2 = 1;
+ parts[i].type = PT_NONE;
+ }
+
//Death
if (parts[i].life<1 || death2 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
{
diff --git a/src/elements/swch.c b/src/elements/swch.c
index 2c538cc..5d623cd 100644
--- a/src/elements/swch.c
+++ b/src/elements/swch.c
@@ -25,5 +25,13 @@ int update_SWCH(UPDATE_FUNC_ARGS) {
}
}
}
+ if (parts[i].life==10 && (!(pmap[y-1][x-1]&0xFF) && ((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) && !(pmap[y-1][x+1]&0xFF) && ((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2)))
+ {
+ parts[i].life = 9;
+ }
+ else if (parts[i].life<=5 && (!(pmap[y-1][x-1]&0xFF) && (((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) || ((pmap[y+1][x]&0xFF)==PT_BRAY&&parts[pmap[y+1][x]>>8].tmp==2)) && !(pmap[y-1][x+1]&0xFF) && (((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2) || ((pmap[y][x-1]&0xFF)==PT_BRAY&&parts[pmap[y][x-1]>>8].tmp==2))))
+ {
+ parts[i].life = 14;
+ }
return 0;
}