diff --git a/src/alien.cpp b/src/alien.cpp index cc275be..4395892 100644 --- a/src/alien.cpp +++ b/src/alien.cpp @@ -1051,7 +1051,7 @@ void alien_addSmallAsteroid(object *hostAlien) return; int index = -1; - int debris = 1 + rand() % 10; + int debris = RANDRANGE(1, 10); for (int i = 0 ; i < debris ; i++) bullet_add(&weapon[W_ROCKETS], hostAlien, 0, 0); diff --git a/src/bullet.cpp b/src/bullet.cpp index dfabd9a..4cfcf9b 100644 --- a/src/bullet.cpp +++ b/src/bullet.cpp @@ -51,24 +51,21 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy) } else { - bullet->dx = (0 - theWeapon->speed); + bullet->dx = -theWeapon->speed; } if (bullet->flags & WF_VARIABLE_SPEED) { - bullet->dx = RANDRANGE(100, 200); - bullet->dx /= 10; + bullet->dx = RANDRANGE(100, 200) / 10; if (attacker->face == 1) - bullet->dx = 0 - bullet->dx; + bullet->dx = -bullet->dx; } bullet->dy = dy; if (bullet->flags & WF_SCATTER) { - bullet->dy = RANDRANGE(-200, 200); - if (bullet->dy != 0) - bullet->dy /= 200; + bullet->dy = RANDRANGE(-200, 200) / 200; } if (attacker->flags & FL_WEAPCO) diff --git a/src/game.cpp b/src/game.cpp index 2e2557f..d80dd85 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1007,8 +1007,10 @@ static void game_doAliens() if (aliens[i].classDef == CD_ASTEROID) { n = 1 + (rand() % 3); - for (int i = 0 ; i < n ; i++) + for (int j = 0 ; j < n ; j++) + { alien_addSmallAsteroid(&aliens[i]); + } } } }