Fixed the bug that caused mobile rays to shoot bullets.
This was a strange cause, and I wonder why it happened. Quite simply, there was an assumption in the code that any alien's primary weapon was a bullet, despite the fact that the secondary weapon code could handle any weapon, including bullets. I've fixed this by getting rid of the special primary weapon mechanism; the one for the secondary weapons is used on primary weapons as well.
This commit is contained in:
parent
6dad38bd20
commit
e7abfe30a6
|
@ -522,7 +522,7 @@ void alien_defs_init()
|
|||
alien_defs[CD_MOBILE_RAY].weaponType[0] = W_ENERGYRAY;
|
||||
alien_defs[CD_MOBILE_RAY].weaponType[1] = W_ENERGYRAY;
|
||||
alien_defs[CD_MOBILE_RAY].chance[0] = 50;
|
||||
alien_defs[CD_MOBILE_RAY].chance[1] = 50;
|
||||
alien_defs[CD_MOBILE_RAY].chance[1] = 0;
|
||||
alien_defs[CD_MOBILE_RAY].collectChance = 75;
|
||||
alien_defs[CD_MOBILE_RAY].collectType = P_ANYTHING;
|
||||
alien_defs[CD_MOBILE_RAY].collectValue = 100;
|
||||
|
|
35
src/game.cpp
35
src/game.cpp
|
@ -1022,38 +1022,35 @@ static void game_doAliens()
|
|||
|
||||
if (canFire)
|
||||
{
|
||||
if ((aliens[i].reload[0] == 0) &&
|
||||
((rand() % 1000 < aliens[i].chance[0]) ||
|
||||
for (int j = 0 ; j < 2 ; j++)
|
||||
{
|
||||
if ((aliens[i].reload[j] == 0) &&
|
||||
((rand() % 1000 < aliens[i].chance[j]) ||
|
||||
(aliens[i].flags & FL_CONTINUOUS_FIRE)))
|
||||
{
|
||||
// FIXME: I'm pretty sure this is the line that's causing mobile energy ray cannons
|
||||
// to fire off 5 plasma bullets. Need to find out exactly what
|
||||
// this line is for and make the appropriate adjustments.
|
||||
ship_fireBullet(&aliens[i], 0);
|
||||
}
|
||||
if ((aliens[i].reload[1] == 0) &&
|
||||
((rand() % 1000 < aliens[i].chance[1]) ||
|
||||
(aliens[i].flags & FL_CONTINUOUS_FIRE)))
|
||||
if ((aliens[i].weaponType[j] != W_ENERGYRAY) &&
|
||||
(aliens[i].weaponType[j] != W_LASER))
|
||||
{
|
||||
if ((aliens[i].weaponType[1] != W_ENERGYRAY) &&
|
||||
(aliens[i].weaponType[1] != W_LASER))
|
||||
{
|
||||
if (aliens[i].weaponType[1] == W_CHARGER)
|
||||
aliens[i].ammo[1] = 50 + rand() % 150;
|
||||
ship_fireBullet(&aliens[i], 1);
|
||||
if (aliens[i].weaponType[j] == W_CHARGER)
|
||||
aliens[i].ammo[j] = 50 + rand() % 150;
|
||||
ship_fireBullet(&aliens[i], j);
|
||||
}
|
||||
else if (aliens[i].weaponType[1] == W_LASER)
|
||||
else if (aliens[i].weaponType[j] == W_LASER)
|
||||
{
|
||||
aliens[i].flags += FL_FIRELASER;
|
||||
}
|
||||
else if ((aliens[i].weaponType[1] == W_ENERGYRAY) &&
|
||||
(aliens[i].ammo[0] == 250))
|
||||
// XXX: This ammo check only seems to work for ammo[0],
|
||||
// not ammo[1], thus necessitating using ammo[0] instead of
|
||||
// ammo[j]. Should be investigated in the future.
|
||||
else if ((aliens[i].weaponType[j] == W_ENERGYRAY) &&
|
||||
(aliens[i].ammo[0] >= 250))
|
||||
{
|
||||
aliens[i].flags += FL_FIRERAY;
|
||||
audio_playSound(SFX_ENERGYRAY, aliens[i].x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aliens[i].flags & FL_FIRERAY)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue