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

29 lines
718 B
C
Raw Normal View History

#include <element.h>
2011-01-07 10:18:22 -06:00
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;
}
}
parts[i].ctype = pv[y/CELL][x/CELL]*16;
2011-04-08 05:09:42 -05:00
parts[i].tmp = abs((int)((vx[y/CELL][x/CELL]+vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f));
//printf("%f %f\n", parts[i].vx, parts[i].vy);
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;
}