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[0] = W_ENERGYRAY;
|
||||||
alien_defs[CD_MOBILE_RAY].weaponType[1] = 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[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].collectChance = 75;
|
||||||
alien_defs[CD_MOBILE_RAY].collectType = P_ANYTHING;
|
alien_defs[CD_MOBILE_RAY].collectType = P_ANYTHING;
|
||||||
alien_defs[CD_MOBILE_RAY].collectValue = 100;
|
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 (canFire)
|
||||||
{
|
{
|
||||||
if ((aliens[i].reload[0] == 0) &&
|
for (int j = 0 ; j < 2 ; j++)
|
||||||
((rand() % 1000 < aliens[i].chance[0]) ||
|
{
|
||||||
|
if ((aliens[i].reload[j] == 0) &&
|
||||||
|
((rand() % 1000 < aliens[i].chance[j]) ||
|
||||||
(aliens[i].flags & FL_CONTINUOUS_FIRE)))
|
(aliens[i].flags & FL_CONTINUOUS_FIRE)))
|
||||||
{
|
{
|
||||||
// FIXME: I'm pretty sure this is the line that's causing mobile energy ray cannons
|
if ((aliens[i].weaponType[j] != W_ENERGYRAY) &&
|
||||||
// to fire off 5 plasma bullets. Need to find out exactly what
|
(aliens[i].weaponType[j] != W_LASER))
|
||||||
// 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[1] != W_ENERGYRAY) &&
|
if (aliens[i].weaponType[j] == W_CHARGER)
|
||||||
(aliens[i].weaponType[1] != W_LASER))
|
aliens[i].ammo[j] = 50 + rand() % 150;
|
||||||
{
|
ship_fireBullet(&aliens[i], j);
|
||||||
if (aliens[i].weaponType[1] == W_CHARGER)
|
|
||||||
aliens[i].ammo[1] = 50 + rand() % 150;
|
|
||||||
ship_fireBullet(&aliens[i], 1);
|
|
||||||
}
|
}
|
||||||
else if (aliens[i].weaponType[1] == W_LASER)
|
else if (aliens[i].weaponType[j] == W_LASER)
|
||||||
{
|
{
|
||||||
aliens[i].flags += FL_FIRELASER;
|
aliens[i].flags += FL_FIRELASER;
|
||||||
}
|
}
|
||||||
else if ((aliens[i].weaponType[1] == W_ENERGYRAY) &&
|
// XXX: This ammo check only seems to work for ammo[0],
|
||||||
(aliens[i].ammo[0] == 250))
|
// 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;
|
aliens[i].flags += FL_FIRERAY;
|
||||||
audio_playSound(SFX_ENERGYRAY, aliens[i].x);
|
audio_playSound(SFX_ENERGYRAY, aliens[i].x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (aliens[i].flags & FL_FIRERAY)
|
if (aliens[i].flags & FL_FIRERAY)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue