JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
bumped dev version to 0.5pre
[vor.git] / main.c
diff --git a/main.c b/main.c
index d2627f2..a2d7bee 100644 (file)
--- 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];
@@ -555,8 +563,6 @@ static inline void
 kill_ship(Sprite *ship)
 {
        ship->flags = MOVE;
-       // ship->flags = MOVE|DRAW;  // FADE SHIP
-       // SDL_SetAlpha(ship->image, SDL_SRCALPHA, 0); // FADE SHIP
        bang = true;
 }
 
@@ -624,18 +630,7 @@ gameloop() {
                                }
                        } else {
                                if(state == DEAD_PAUSE) {
-                                       float blast_radius;
-                                       // float alpha;  // FADE SHIP
-                                       if(state_timeout >= DEAD_PAUSE_LENGTH - 20.0) {
-                                               blast_radius = BLAST_RADIUS * (DEAD_PAUSE_LENGTH - state_timeout) / 20.0;
-                                               blast_rocks(bangx, bangy, blast_radius);
-                                       }
-
                                        if(bangx < 60) bangx = 60;
-
-                                       // FADE SHIP
-                                       // alpha = 255.0 * (DEAD_PAUSE_LENGTH - state_timeout) / DEAD_PAUSE_LENGTH;
-                                       // SDL_SetAlpha(ship.image, SDL_SRCALPHA, (uint8_t)alpha);
                                }
                        }
 
@@ -724,7 +719,6 @@ gameloop() {
                                        ship.dx = screendx; ship.dy = screendy;
                                        ship.lives = 4;
                                        ship.flags = MOVE|DRAW|COLLIDE;
-                                       // SDL_SetAlpha(ship.image, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);  // FADE SHIP
                                        add_sprite(SPRITE(&ship));
 
                                        score = 0;