From: Joshua Grams Date: Sun, 26 Mar 2006 11:16:30 +0000 (+0000) Subject: made bang dots hit rocks, removed blast_rocks function. X-Git-Tag: 0.4~4 X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=commitdiff_plain;h=0224eb908d4084f52a22c8d64404a0efb4acfa35 made bang dots hit rocks, removed blast_rocks function. --- diff --git a/main.c b/main.c index d2627f2..f7de24e 100644 --- a/main.c +++ b/main.c @@ -190,6 +190,7 @@ draw_bang_dots(SDL_Surface *s) int first_i, last_i; uint16_t *pixels, *pixel, c; int row_inc = s->pitch/sizeof(uint16_t); + Sprite *hit; pixels = (uint16_t *) s->pixels; first_i = -1; @@ -211,7 +212,14 @@ draw_bang_dots(SDL_Surface *s) } // check collisions - if(pixel_collides(bdot[i].x, bdot[i].y)) { bdot[i].active = 0; continue; } + if((hit = pixel_collides(bdot[i].x, bdot[i].y))) { + if(hit->type != SHIP) { // they shouldn't hit the ship, but they do + bdot[i].active = 0; + hit->dx += ENGINE_DOT_WEIGHT * bdot[i].life * bdot[i].dx / sprite_mass(hit); + hit->dy += ENGINE_DOT_WEIGHT * bdot[i].life * bdot[i].dy / sprite_mass(hit); + continue; + } + } pixel = pixels + row_inc*(int)(bdot[i].y) + (int)(bdot[i].x); if(bdot[i].c) c = bdot[i].c; else c = heatcolor[(int)(bdot[i].life)*3]; diff --git a/rocks.c b/rocks.c index ed98cac..5f637e0 100644 --- a/rocks.c +++ b/rocks.c @@ -201,27 +201,3 @@ draw_rocks(void) int i; for(i=0; ix <= 0) continue; - - dx = r->x - x; - dy = r->y - y; - - n = sqrt(dx*dx + dy*dy); - if(n < radius) { - n *= 15; - r->dx += 54.0*dx/n; - r->dy += 54.0*dy/n; - } - } -}