+ int ix, iy;
+ int l, r, t, b;
+ struct rock **bucket;
+
+ ix = x + grid_size; iy = y + grid_size;
+ l = ix / grid_size; r = (ix+shape->w)/grid_size;
+ t = iy / grid_size; b = (iy+shape->h)/grid_size;
+ bucket = &rock_buckets[p][l + t*bw];
+
+ if(hit_in_bucket(*bucket, x, y, shape)) return true;
+ if(l > 0 && hit_in_bucket(*(bucket-1), x, y, shape)) return true;
+ if(t > 0 && hit_in_bucket(*(bucket-bw), x, y, shape)) return true;
+ if(l > 0 && t > 0 && hit_in_bucket(*(bucket-1-bw), x, y, shape)) return true;
+
+ if(r > l) {
+ if(hit_in_bucket(*(bucket+1), x, y, shape)) return true;
+ if(t > 0 && hit_in_bucket(*(bucket+1-bw), x, y, shape)) return true;
+ }
+ if(b > t) {
+ if(hit_in_bucket(*(bucket+bw), x, y, shape)) return true;
+ if(l > 0 && hit_in_bucket(*(bucket-1+bw), x, y, shape)) return true;
+ }
+ if(r > l && b > t && hit_in_bucket(*(bucket+1+bw), x, y, shape)) return true;
+ return false;
+}