This is a image of what it says:
The image is a bit to big.
I think I failed typing...
Yeah...I found a bit of an issue here:
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) //don't do this, use BOUNDS_CHECK function, more reliable
{ r = pmap[y+ry][x+rx]; if (!r || (r&0xFF)==PT_WSTE) continue;
Use this:
if (BOUNDS_CHECK && (rx || ry))
{ r = pmap[y+ry][x+rx]; if (!r || (r&0xFF)==PT_WSTE) continue;
EDIT: Sorry it looks weird, I don't know HTML
make elements from powdersim
you can PM me the code