summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-02-04 01:34:22 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-05 14:45:30 (GMT)
commit68ab3ca3ca846ac5911cbfaa7c511b8f13108a54 (patch)
tree05de2af20a5756a2018532a26be65c1c4bb39f05 /src/elements
parent1a5cd45eb8949fd8e81019337e4a92278e83d19b (diff)
downloadpowder-68ab3ca3ca846ac5911cbfaa7c511b8f13108a54.zip
powder-68ab3ca3ca846ac5911cbfaa7c511b8f13108a54.tar.gz
More SPRK life checks for electronic elements
Check life>0, because SPRK changes back to its ctype when life==0. This could result in SPRK being found/not found depending on particle order, so pretend SPRK is not there if life==0 (it will disappear during the current frame).
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/aray.c2
-rw-r--r--src/elements/dlay.c2
-rw-r--r--src/elements/emp.c2
-rw-r--r--src/elements/pcln.c2
-rw-r--r--src/elements/pvod.c2
-rw-r--r--src/elements/stor.c2
-rw-r--r--src/elements/wire.c3
7 files changed, 7 insertions, 8 deletions
diff --git a/src/elements/aray.c b/src/elements/aray.c
index cce5e2d..4379635 100644
--- a/src/elements/aray.c
+++ b/src/elements/aray.c
@@ -11,7 +11,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4) {
+ if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4) {
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 = rx*-1, nyi = ry*-1; docontinue; nyy+=nyi, nxx+=nxi) {
diff --git a/src/elements/dlay.c b/src/elements/dlay.c
index 9fa32d5..cb2e2d8 100644
--- a/src/elements/dlay.c
+++ b/src/elements/dlay.c
@@ -19,7 +19,7 @@ int update_DLAY(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_SPRK && parts[i].life==0 && parts[r>>8].life<4 && parts[r>>8].ctype==PT_PSCN)
+ if ((r&0xFF)==PT_SPRK && parts[i].life==0 && parts[r>>8].life>0 && parts[r>>8].life<4 && parts[r>>8].ctype==PT_PSCN)
{
parts[i].life = (int)(parts[i].temp-273.15);
}
diff --git a/src/elements/emp.c b/src/elements/emp.c
index a9b555b..9f199cc 100644
--- a/src/elements/emp.c
+++ b/src/elements/emp.c
@@ -11,7 +11,7 @@ int update_EMP(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4)
+ if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4)
{
ok=1;
break;
diff --git a/src/elements/pcln.c b/src/elements/pcln.c
index aecd89c..aff8e76 100644
--- a/src/elements/pcln.c
+++ b/src/elements/pcln.c
@@ -11,7 +11,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4)
+ if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4)
{
if (parts[r>>8].ctype==PT_PSCN)
parts[i].life = 10;
diff --git a/src/elements/pvod.c b/src/elements/pvod.c
index 6ff508b..d52f758 100644
--- a/src/elements/pvod.c
+++ b/src/elements/pvod.c
@@ -11,7 +11,7 @@ int update_PVOD(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==PT_SPRK && parts[r>>8].life<4)
+ if ((r&0xFF)==PT_SPRK && parts[r>>8].life>0 && parts[r>>8].life<4)
{
if (parts[r>>8].ctype==PT_PSCN)
parts[i].life = 10;
diff --git a/src/elements/stor.c b/src/elements/stor.c
index b84f54f..16cd2c3 100644
--- a/src/elements/stor.c
+++ b/src/elements/stor.c
@@ -20,7 +20,7 @@ int update_STOR(UPDATE_FUNC_ARGS) {
parts[i].pavg[1] = parts[r>>8].ctype;
kill_part(r>>8);
}
- if(parts[i].tmp && (r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_PSCN && parts[r>>8].life<4)
+ if(parts[i].tmp && (r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_PSCN && parts[r>>8].life>0 && parts[r>>8].life<4)
{
for(ry1 = 1; ry1 >= -1; ry1--){
for(rx1 = 0; rx1 >= -1 && rx1 <= 1; rx1 = -rx1-rx1+1){ // Oscilate the X starting at 0, 1, -1, 3, -5, etc (Though stop at -1)
diff --git a/src/elements/wire.c b/src/elements/wire.c
index 2177ec7..2688e5a 100644
--- a/src/elements/wire.c
+++ b/src/elements/wire.c
@@ -29,10 +29,9 @@ int update_WIRE(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if((r&0xFF)==PT_SPRK && parts[r>>8].life<4 && parts[r>>8].ctype==PT_PSCN)
+ if((r&0xFF)==PT_SPRK && parts[r>>8].life==3 && parts[r>>8].ctype==PT_PSCN)
{
parts[i].ctype=1;
- parts[r>>8].life=0;
return 0;
}
else if((r&0xFF)==PT_NSCN && parts[i].tmp==1){create_part(-1, x+rx, y+ry, PT_SPRK);}