I think I've finally 'fixed' the problem. Instead of finding water every time it warps, I'm simply going to have a 256 loop when it's created, and check every 4x4 square, and if it's water, add it to an array, and when it's time to warp, pick it's position from the array.
EDIT: seems this is not working...
PHP Code:
this.gmapo={int(thiso.x/64),int(thiso.y/64)};
this.waterspots = new[256];
for (i=0;i<256;i++) {
this.waterspots[i]=i;
if (!onwater2((this.gmapo[0]*64)+((i%16)*4),(this.gmapo[1]*64)+(int(i/16)*4),4,4)) {
this.waterspots[i]=-1;
showimg(i+500,"door.png",(this.gmapo[0]*64)+((i%16)*4),(this.gmapo[1]*64)+(int(i/16)*4));
}
}
The point of this is to run through the level and whatever is NOT water, erase it from the array. Now, even besides that, check out the showimg bit. It should show a door at ever 4x4 square that is NOT water. It shows doors throughout the whole level, even where there is water. It makes absolutely no sense!