X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=rocks.c;h=e098fa0ef40d14307af58069dcff0d6e7732d094;hp=a2aa31eb2351f9d6664982669812328b087e66a8;hb=a77978e0c9bc91ea3d7b192ce136621e78d4ec5b;hpb=f3887c5ba3c117c7a3c2cc74e9ebdcce162a53fc diff --git a/rocks.c b/rocks.c index a2aa31e..e098fa0 100644 --- a/rocks.c +++ b/rocks.c @@ -308,12 +308,9 @@ hit_rocks(float x, float y, struct shape *shape) } int -pixel_hit_rocks(float x, float y) +pixel_hit_in_bucket(int b, float x, float y) { - int b; struct rock_struct *r; - - b = bucket(x, y); 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; @@ -321,6 +318,17 @@ pixel_hit_rocks(float x, float y) 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; +} + void blast_rocks(float x, float y, float radius, int onlyslow) {