2011-01-28 13:34:16 -06:00
|
|
|
#include <element.h>
|
2011-01-07 10:18:22 -06:00
|
|
|
|
|
|
|
int update_FOG(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-13 15:24:19 -06:00
|
|
|
if (ptypes[r&0xFF].state==ST_SOLID&&5>=rand()%50&&parts[i].life==0&&!((r&0xFF)==PT_CLNE||(r&0xFF)==PT_PCLN)) // TODO: should this also exclude BCLN?
|
2011-01-07 10:18:22 -06:00
|
|
|
{
|
2011-01-10 08:41:03 -06:00
|
|
|
part_change_type(i,x,y,PT_RIME);
|
2011-01-07 10:18:22 -06:00
|
|
|
}
|
2011-01-10 08:41:03 -06:00
|
|
|
if ((r&0xFF)==PT_SPRK)
|
2011-01-07 10:18:22 -06:00
|
|
|
{
|
|
|
|
parts[i].life += rand()%20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|