diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-10 14:41:03 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-01-10 14:41:03 (GMT) |
| commit | 54f9f872b9e4d5a0086d6de104e84d43b125c349 (patch) | |
| tree | b567fb9d3710acbce22f8193bfe2585bb2988bed /src/elements/fuse.c | |
| parent | 855281295fbc23366e8b84d7c8e55816d6f47a87 (diff) | |
| download | powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.zip powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.tar.gz | |
Finish update function cleanup
Diffstat (limited to 'src/elements/fuse.c')
| -rw-r--r-- | src/elements/fuse.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/elements/fuse.c b/src/elements/fuse.c index ed554ab..1b6e8bf 100644 --- a/src/elements/fuse.c +++ b/src/elements/fuse.c @@ -1,18 +1,16 @@ #include <powder.h> int update_FUSE(UPDATE_FUNC_ARGS) { - int r; + int r, rx, ry; if (parts[i].life<=0) { - //t = parts[i].life = 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()%100)==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; } @@ -22,17 +20,14 @@ int update_FUSE(UPDATE_FUNC_ARGS) { else if (parts[i].tmp<40&&parts[i].tmp>0) parts[i].tmp--; else if (parts[i].tmp<=0) { - //t = PT_NONE; - kill_part(i); - r = create_part(-1, x, y, PT_FSEP); + create_part(i, x, y, PT_FSEP); return 1; } - 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)) + 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)) { - r = pmap[y+ny][x+nx]; + r = pmap[y+ry][x+rx]; if ((r>>8)>=NPART || !r) continue; if ((r&0xFF)==PT_SPRK || ((parts[i].temp>=(273.15+700.0f)) && 1>(rand()%20))) |
