summaryrefslogtreecommitdiff
path: root/src/powder.c
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-02-03 23:35:44 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-05 14:45:29 (GMT)
commit6bdc05cc40a89b6454fdbaca7a2315a07f085bf9 (patch)
treeddda52ecac10186b524f397983ebcb2c116fba02 /src/powder.c
parenta4ad6ee428759346604437f416e27606b6ce09a1 (diff)
downloadpowder-6bdc05cc40a89b6454fdbaca7a2315a07f085bf9.zip
powder-6bdc05cc40a89b6454fdbaca7a2315a07f085bf9.tar.gz
Separate loop for updating life, and add SPRK life checks to most electronics
Diffstat (limited to 'src/powder.c')
-rw-r--r--src/powder.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/powder.c b/src/powder.c
index ac710f6..6360529 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1432,6 +1432,7 @@ void update_particles_i(pixel *vid, int start, int inc)
int surround[8];
int surround_hconduct[8];
int lighting_ok=1;
+ unsigned int elem_properties;
float pGravX, pGravY, pGravD;
if (sys_pause&&lighting_recreate>0)
@@ -1706,7 +1707,6 @@ void update_particles_i(pixel *vid, int start, int inc)
else
wireless[q][1] = 0;
}
- //the main particle loop function, goes over all particles.
for (i=0; i<=parts_lastActiveIndex; i++)
if (parts[i].type)
{
@@ -1716,26 +1716,30 @@ void update_particles_i(pixel *vid, int start, int inc)
kill_part(i);
continue;
}
- //printf("parts[%d].type: %d\n", i, parts[i].type);
-
- if (parts[i].life>0 && (ptypes[t].properties&PROP_LIFE_DEC))
+ elem_properties = ptypes[t].properties;
+ if (parts[i].life>0 && (elem_properties&PROP_LIFE_DEC))
{
// automatically decrease life
parts[i].life--;
- if (parts[i].life<=0 && (ptypes[t].properties&(PROP_LIFE_KILL_DEC|PROP_LIFE_KILL)))
+ if (parts[i].life<=0 && (elem_properties&(PROP_LIFE_KILL_DEC|PROP_LIFE_KILL)))
{
// kill on change to no life
kill_part(i);
continue;
}
}
- else if (parts[i].life<=0 && (ptypes[t].properties&PROP_LIFE_KILL))
+ else if (parts[i].life<=0 && (elem_properties&PROP_LIFE_KILL))
{
// kill if no life
kill_part(i);
continue;
}
-
+ }
+ //the main particle loop function, goes over all particles.
+ for (i=0; i<=parts_lastActiveIndex; i++)
+ if (parts[i].type)
+ {
+ t = parts[i].type;
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);