summaryrefslogtreecommitdiff
path: root/src/elements/glow.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/glow.c
parent855281295fbc23366e8b84d7c8e55816d6f47a87 (diff)
downloadpowder-54f9f872b9e4d5a0086d6de104e84d43b125c349.zip
powder-54f9f872b9e4d5a0086d6de104e84d43b125c349.tar.gz
Finish update function cleanup
Diffstat (limited to 'src/elements/glow.c')
-rw-r--r--src/elements/glow.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/elements/glow.c b/src/elements/glow.c
index a4a1c57..aa4d2b0 100644
--- a/src/elements/glow.c
+++ b/src/elements/glow.c
@@ -1,21 +1,24 @@
#include <powder.h>
int update_GLOW(UPDATE_FUNC_ARGS) {
- int r;
- for (nx=-1; nx<2; nx++)
- for (ny=-1; ny<2; ny++)
- if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ int r, rx, ry;
+ for (rx=-1; rx<2; rx++)
+ for (ry=-1; ry<2; 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 (parts[r>>8].type==PT_WATR&&5>(rand()%2000))
+ if ((r&0xFF)==PT_WATR&&5>(rand()%2000))
{
parts[i].type = PT_NONE;
- parts[r>>8].type = PT_DEUT;
+ part_change_type(r>>8,x+rx,y+ry,PT_DEUT);
parts[r>>8].life = 10;
}
}
-
+ if (parts[i].type==PT_NONE) {
+ kill_part(i);
+ return 1;
+ }
return 0;
}