- SDL_Rect dest;
-
- for(i=0; i<MAXROCKS; i++) {
- if(!rocks[i].image) continue;
- dest.x = rocks[i].x; dest.y = rocks[i].y;
- SDL_BlitSurface(rocks[i].image,NULL,surf_screen,&dest);
- }
-}
-
-int
-hit_in_bucket(int b, float x, float y, struct shape *shape)
-{
- struct rock_struct *r;
-
- for(r=rock_buckets[p][b]; r; r=r->next) {
- if(collide(x - r->x, y - r->y, r->shape, shape)) return 1;
- }
- return 0;
-}
-
-int
-hit_rocks(float x, float y, struct shape *shape)
-{
- int b = bucket(x, y);
- int bdx = ((int)x+shape->w)/grid_size - (int)x/grid_size;
- int bdy = ((int)y+shape->h)/grid_size - (int)y/grid_size;
- if(hit_in_bucket(b, x, y, shape)) return 1;
- if(bdx && hit_in_bucket(b+1, x, y, shape)) return 1;
- if(bdy && hit_in_bucket(b+bw, x, y, shape)) return 1;
- if(bdx && bdy && hit_in_bucket(b+bw+1, x, y, shape)) return 1;
- return 0;
-}
-
-int
-pixel_hit_in_bucket(int b, float x, float y)
-{
- struct rock_struct *r;
- for(r=rock_buckets[p][b]; r; r=r->next) {
- if(x < r->x || y < r->y) continue;
- if(pixel_collide(x - r->x, y - r->y, r->shape)) return 1;
- }
- return 0;
-}
-
-int
-pixel_hit_rocks(float x, float y)
-{
- int b = bucket(x, y);
- if(pixel_hit_in_bucket(b, x, y)) return 1;
- if(pixel_hit_in_bucket(b-1, x, y)) return 1;
- if(pixel_hit_in_bucket(b-bw, x, y)) return 1;
- if(pixel_hit_in_bucket(b-bw-1, x, y)) return 1;
- return 0;