- SDL_Rect src, dest;
-
- src.x = 0; src.y = 0;
-
- for(i = 0; i<MAXROCKS; i++) {
- if(rock[i].active) {
- src.w = rock[i].image->w;
- src.h = rock[i].image->h;
-
- dest.w = src.w;
- dest.h = src.h;
- dest.x = (int) rock[i].x;
- dest.y = (int) rock[i].y;
-
- SDL_BlitSurface(rock[i].image,&src,surf_screen,&dest);
-
- }
- }
-}
-
-int
-hit_rocks(float x, float y, struct shape *shape)
-{
- int i;
-
- for(i=0; i<MAXROCKS; i++) {
- if(rock[i].active) {
- if(collide(x-rock[i].x, y-rock[i].y, rock[i].shape, shape))
- return 1;
- }
- }
- return 0;
-}
-
-void
-blast_rocks(float x, float y, float radius, int onlyslow)
-{
- int i;
- float dx, dy, n;
-
- if(onlyslow) return;
-
- for(i = 0; i<MAXROCKS; i++ ) {
- if(rock[i].x <= 0) continue;
-
- // This makes it so your explosion from dying magically doesn't leave
- // any rocks that aren't moving much on the x axis. If onlyslow is set,
- // only rocks that are barely moving will be pushed.
- if(onlyslow && (rock[i].dx-screendx < -4 || rock[i].dx-screendx > 3)) continue;
-
- dx = rock[i].x - x;
- dy = rock[i].y - y;
-
- n = sqrt(dx*dx + dy*dy);
- if(n < radius) {
- n *= 15;
- rock[i].dx += 54.0*dx/n;
- rock[i].dy += 54.0*dy/n;
- }
- }