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

25 lines
507 B
C
Raw Normal View History

2011-01-07 17:05:26 -06:00
#include <powder.h>
int update_LCRY(UPDATE_FUNC_ARGS) {
if (parts[i].life==10)
{
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 17:05:26 -06:00
{
2011-01-10 08:41:03 -06:00
r = pmap[y+ry][x+rx];
2011-01-07 17:05:26 -06:00
if ((r>>8)>=NPART || !r)
continue;
if ((r&0xFF)==PT_LCRY)
{
if (parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9;
else if (parts[r>>8].life==0)
parts[r>>8].life = 10;
}
}
}
return 0;
}