summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-12-19 15:21:27 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-12-19 15:21:27 (GMT)
commit5e0bec261c621246170f356285851601e603ba9a (patch)
tree28f36c8e1671b16015264ca4f4aeed78106594ee /src/elements
parentd6953be3a8271785b5912f3105f3ca92cc17aaae (diff)
downloadpowder-5e0bec261c621246170f356285851601e603ba9a.zip
powder-5e0bec261c621246170f356285851601e603ba9a.tar.gz
CLST+NITR = TNT, Use ARAY to clear large arrays of STOR
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/aray.c114
-rw-r--r--src/elements/clst.c5
2 files changed, 76 insertions, 43 deletions
diff --git a/src/elements/aray.c b/src/elements/aray.c
index 22ee26c..713fcc4 100644
--- a/src/elements/aray.c
+++ b/src/elements/aray.c
@@ -1,7 +1,7 @@
#include <element.h>
int update_ARAY(UPDATE_FUNC_ARGS) {
- int r, nxx, nyy, docontinue, nxi, nyi, rx, ry, nr;
+ int r, nxx, nyy, docontinue, nxi, nyi, rx, ry, nr, ry1, rx1;
if (parts[i].life==0) {
int colored =0;
for (rx=-1; rx<2; rx++)
@@ -19,54 +19,82 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
break;
}
r = pmap[y+nyi+nyy][x+nxi+nxx];
- if (!r) {
- int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
- if (nr!=-1) {
- if (destroy) {//if it came from PSCN
- parts[nr].tmp = 2;
- parts[nr].life = 2;
- } else
- parts[nr].ctype = colored;
- parts[nr].temp = parts[i].temp;
+ if (!r) {
+ int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
+ if (nr!=-1) {
+ if (destroy) {//if it came from PSCN
+ parts[nr].tmp = 2;
+ parts[nr].life = 2;
+ } else
+ parts[nr].ctype = colored;
+ parts[nr].temp = parts[i].temp;
+ }
+ } else if (!destroy) {
+ if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==0) {//if it hits another BRAY that isn't red
+ if (nyy!=0 || nxx!=0) {
+ parts[r>>8].life = 1020;//makes it last a while
+ parts[r>>8].tmp = 1;
+ if (!parts[r>>8].ctype)//and colors it if it isn't already
+ parts[r>>8].ctype = colored;
}
- } else if (!destroy) {
- if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==0) {//if it hits another BRAY that isn't red
- if (nyy!=0 || nxx!=0) {
- parts[r>>8].life = 1020;//makes it last a while
- parts[r>>8].tmp = 1;
- if (!parts[r>>8].ctype)//and colors it if it isn't already
- parts[r>>8].ctype = colored;
- }
- docontinue = 0;//then stop it
- } else if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==1) {//if it hits one that already was a long life, reset it
- parts[r>>8].life = 1020;
- //docontinue = 1;
+ docontinue = 0;//then stop it
+ } else if ((r&0xFF)==PT_BRAY&&parts[r>>8].tmp==1) {//if it hits one that already was a long life, reset it
+ parts[r>>8].life = 1020;
+ //docontinue = 1;
+ } else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
+ colored = parts[r>>8].ctype;
+ //this if prevents BRAY from stopping on certain materials
+ } else if ((r&0xFF)!=PT_STOR && (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);
}
- else if ((r&0xFF)==PT_FILT) {//get color if passed through FILT
- colored = parts[r>>8].ctype;
- //this if prevents BRAY from stopping on certain materials
- } 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);
- }
- //if (!(nostop && (ptypes[r&0xFF].properties&PROP_CONDUCTS))) {
- if (!(nostop && parts[r>>8].ctype >= 0 && parts[r>>8].ctype < PT_NUM && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
- docontinue = 0;
- } else {
- docontinue = 1;
+ //if (!(nostop && (ptypes[r&0xFF].properties&PROP_CONDUCTS))) {
+ if (!(nostop && parts[r>>8].ctype >= 0 && parts[r>>8].ctype < PT_NUM && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))) {
+ docontinue = 0;
+ } else {
+ docontinue = 1;
+ }
+ } else if((r&0xFF)==PT_STOR) {
+ if(parts[r>>8].tmp)
+ {
+ //Cause STOR to release
+ for(ry1 = 1; ry1 >= -1; ry1--){
+ for(rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1-rx1+1){
+ int np = create_part(-1, x+nxi+nxx+rx1, y+nyi+nyy+ry1, parts[r>>8].tmp);
+ if (np!=-1)
+ {
+ parts[np].temp = parts[r>>8].temp;
+ parts[np].life = parts[r>>8].flags;
+ parts[np].tmp = parts[r>>8].pavg[0];
+ parts[np].ctype = parts[r>>8].pavg[1];
+ parts[r>>8].tmp = 0;
+ parts[r>>8].life = 10;
+ break;
+ }
+ }
}
}
- } else if (destroy) {
- if ((r&0xFF)==PT_BRAY) {
- parts[r>>8].life = 1;
- docontinue = 1;
- //this if prevents red BRAY from stopping on certain materials
- } else if ((r&0xFF)==PT_INWR || (r&0xFF)==PT_ARAY || (r&0xFF)==PT_WIFI || (r&0xFF)==PT_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
- docontinue = 1;
- } else {
- docontinue = 0;
+ else
+ {
+ parts[r>>8].life = 10;
}
}
+ } else if (destroy) {
+ if ((r&0xFF)==PT_BRAY) {
+ parts[r>>8].life = 1;
+ docontinue = 1;
+ //this if prevents red BRAY from stopping on certain materials
+ } else if ((r&0xFF)==PT_STOR || (r&0xFF)==PT_INWR || (r&0xFF)==PT_ARAY || (r&0xFF)==PT_WIFI || (r&0xFF)==PT_FILT || ((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) {
+ if((r&0xFF)==PT_STOR)
+ {
+ parts[r>>8].tmp = 0;
+ parts[r>>8].life = 0;
+ }
+ docontinue = 1;
+ } else {
+ docontinue = 0;
+ }
+ }
}
}
//parts[i].life = 4;
diff --git a/src/elements/clst.c b/src/elements/clst.c
index 8666582..a9e07e1 100644
--- a/src/elements/clst.c
+++ b/src/elements/clst.c
@@ -15,6 +15,11 @@ int update_CLST(UPDATE_FUNC_ARGS) {
part_change_type(i,x,y,PT_PSTS);
kill_part(r>>8);
}
+ if ((r&0xFF)==PT_NITR)
+ {
+ create_part(i, x, y, PT_BANG);
+ create_part(r>>8, x+rx, y+ry, PT_BANG);
+ }
if ((r&0xFF)==PT_CLST)
{
if(parts[i].temp <195)