The-Powder-Toy/src/elements/glow.c

25 lines
506 B
C
Raw Normal View History

2011-01-07 10:18:22 -06:00
#include <powder.h>
int update_GLOW(UPDATE_FUNC_ARGS) {
2011-01-10 08:41:03 -06:00
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))
2011-01-07 10:18:22 -06:00
{
2011-01-10 08:41:03 -06:00
r = pmap[y+ry][x+rx];
2011-01-07 10:18:22 -06:00
if ((r>>8)>=NPART || !r)
continue;
2011-01-10 08:41:03 -06:00
if ((r&0xFF)==PT_WATR&&5>(rand()%2000))
2011-01-07 10:18:22 -06:00
{
parts[i].type = PT_NONE;
2011-01-10 08:41:03 -06:00
part_change_type(r>>8,x+rx,y+ry,PT_DEUT);
2011-01-07 10:18:22 -06:00
parts[r>>8].life = 10;
}
}
2011-01-10 08:41:03 -06:00
if (parts[i].type==PT_NONE) {
kill_part(i);
return 1;
}
2011-01-07 10:18:22 -06:00
return 0;
}