Fixed a duplicate variable.

The only effect I noticed was creating asteroid explosions in the
wrong places, but it could be that it had far more disasterous results.
This commit is contained in:
onpon4 2015-04-14 18:50:07 -04:00
parent dd6723ffc2
commit fdd780ca0f
3 changed files with 8 additions and 9 deletions

View File

@ -1051,7 +1051,7 @@ void alien_addSmallAsteroid(object *hostAlien)
return; return;
int index = -1; int index = -1;
int debris = 1 + rand() % 10; int debris = RANDRANGE(1, 10);
for (int i = 0 ; i < debris ; i++) for (int i = 0 ; i < debris ; i++)
bullet_add(&weapon[W_ROCKETS], hostAlien, 0, 0); bullet_add(&weapon[W_ROCKETS], hostAlien, 0, 0);

View File

@ -51,24 +51,21 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy)
} }
else else
{ {
bullet->dx = (0 - theWeapon->speed); bullet->dx = -theWeapon->speed;
} }
if (bullet->flags & WF_VARIABLE_SPEED) if (bullet->flags & WF_VARIABLE_SPEED)
{ {
bullet->dx = RANDRANGE(100, 200); bullet->dx = RANDRANGE(100, 200) / 10;
bullet->dx /= 10;
if (attacker->face == 1) if (attacker->face == 1)
bullet->dx = 0 - bullet->dx; bullet->dx = -bullet->dx;
} }
bullet->dy = dy; bullet->dy = dy;
if (bullet->flags & WF_SCATTER) if (bullet->flags & WF_SCATTER)
{ {
bullet->dy = RANDRANGE(-200, 200); bullet->dy = RANDRANGE(-200, 200) / 200;
if (bullet->dy != 0)
bullet->dy /= 200;
} }
if (attacker->flags & FL_WEAPCO) if (attacker->flags & FL_WEAPCO)

View File

@ -1007,8 +1007,10 @@ static void game_doAliens()
if (aliens[i].classDef == CD_ASTEROID) if (aliens[i].classDef == CD_ASTEROID)
{ {
n = 1 + (rand() % 3); n = 1 + (rand() % 3);
for (int i = 0 ; i < n ; i++) for (int j = 0 ; j < n ; j++)
{
alien_addSmallAsteroid(&aliens[i]); alien_addSmallAsteroid(&aliens[i]);
}
} }
} }
} }