Simplify bullet code even more.

This commit is contained in:
Guus Sliepen 2011-09-05 21:55:23 +02:00
parent bde2d5c8cf
commit 7a59631189
1 changed files with 13 additions and 24 deletions

View File

@ -187,30 +187,19 @@ void fireBullet(object *attacker, int weaponType)
} }
else else
{ {
switch (theWeapon->ammo[0]) if(theWeapon->ammo[0] & 1)
addBullet(theWeapon, attacker, y * 3, 0);
if(theWeapon->ammo[0] >= 2)
{ {
case 1: addBullet(theWeapon, attacker, y * 2, 0);
addBullet(theWeapon, attacker, y * 3, 0); addBullet(theWeapon, attacker, y * 4, 0);
break; }
case 2:
addBullet(theWeapon, attacker, y * 2, 0); if(theWeapon->ammo[0] >= 4)
addBullet(theWeapon, attacker, y * 4, 0); {
break; addBullet(theWeapon, attacker, y * 1, 0);
case 3: addBullet(theWeapon, attacker, y * 5, 0);
addBullet(theWeapon, attacker, y * 2, 0);
addBullet(theWeapon, attacker, y * 3, 0);
addBullet(theWeapon, attacker, y * 4, 0);
break;
case 4:
addBullet(theWeapon, attacker, y, 0);
addBullet(theWeapon, attacker, y * 2, 0);
addBullet(theWeapon, attacker, y * 4, 0);
addBullet(theWeapon, attacker, y * 5, 0);
break;
case 5:
for (int i = 1 ; i < 6; i++)
addBullet(theWeapon, attacker, y * i, 0);
break;
} }
} }
@ -532,7 +521,7 @@ void doBullets()
addExplosion(bullet->x, bullet->y, E_TINY_EXPLOSION); addExplosion(bullet->x, bullet->y, E_TINY_EXPLOSION);
} }
if ((bullet->flags & WF_AIMED) || (bullet->flags & WF_SPREAD)) if ((bullet->flags & WF_AIMED))
{ {
blit(bullet->image[0], (int)(bullet->x - bullet->dx), (int)(bullet->y - bullet->dy)); blit(bullet->image[0], (int)(bullet->x - bullet->dx), (int)(bullet->y - bullet->dy));
} }