summaryrefslogtreecommitdiff
path: root/src/elements/fsep.c
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-10 14:41:03 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-10 14:41:03 (GMT)
commit54f9f872b9e4d5a0086d6de104e84d43b125c349 (patch)
treeb567fb9d3710acbce22f8193bfe2585bb2988bed /src/elements/fsep.c
parent855281295fbc23366e8b84d7c8e55816d6f47a87 (diff)
downloadpowder-54f9f872b9e4d5a0086d6de104e84d43b125c349.zip
powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.tar.gz
Finish update function cleanup
Diffstat (limited to 'src/elements/fsep.c')
-rw-r--r--src/elements/fsep.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/elements/fsep.c b/src/elements/fsep.c
index b6f8de3..0149b15 100644
--- a/src/elements/fsep.c
+++ b/src/elements/fsep.c
@@ -1,36 +1,35 @@
#include <powder.h>
int update_FSEP(UPDATE_FUNC_ARGS) {
- int r;
+ int r, rx, ry;
if (parts[i].life<=0) {
- //t = PT_NONE;
- kill_part(i);
- r = create_part(-1, x, y, PT_PLSM);
+ r = create_part(i, 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);
+ r = create_part(-1, (rx=x+rand()%3-1), (ry=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))
+ else {
+ for (rx=-2; rx<3; rx++)
+ for (ry=-2; ry<3; ry++)
+ if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{
- if (parts[i].life>40) {
- parts[i].life = 39;
+ r = pmap[y+ry][x+rx];
+ 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;
}