Shield smash bug fix.

This commit is contained in:
Steve 2015-12-14 14:04:48 +00:00
parent 310637b4eb
commit 691068a634
2 changed files with 25 additions and 8 deletions

View File

@ -79,7 +79,24 @@ void doEntities(void)
self = e;
e->reload = MAX(e->reload - 1, 0);
e->shieldRecharge = MAX(e->shieldRecharge - 1, 0);
if (e->shieldRechargeRate)
{
if (e->shield >= 0)
{
if (--e->shieldRecharge <= 0)
{
e->shield = MIN(e->shield + 1, e->maxShield);
e->shieldRecharge = e->shieldRechargeRate;
}
}
else
{
e->shield++;
}
}
e->armourHit = MAX(e->armourHit - 25, 0);
e->shieldHit = MAX(e->shieldHit - 5, 0);
e->systemHit = MAX(e->systemHit - 25, 0);

View File

@ -198,12 +198,6 @@ void doFighter(void)
addEngineEffect();
}
if (!self->shieldRecharge)
{
self->shield = MIN(self->shield + 1, self->maxShield);
self->shieldRecharge = self->shieldRechargeRate;
}
if (self->health <= 0)
{
self->health = 0;
@ -403,13 +397,16 @@ void damageFighter(Entity *e, int amount, long flags)
}
else if (flags & BF_SHIELD_DAMAGE)
{
e->shield = MAX(-(FPS * 10), e->shield - amount);
e->shield -= amount;
if (e->shield <= 0 && prevShield > 0)
{
playBattleSound(SND_SHIELD_BREAK, e->x, e->y);
addShieldSplinterEffect(e);
e->shield = -(FPS * 10);
}
e->shield = MAX(-(FPS * 10), e->shield);
}
else
{
@ -436,6 +433,9 @@ void damageFighter(Entity *e, int amount, long flags)
{
e->shieldHit = 255;
/* don't allow the shield to recharge immediately after taking a hit */
e->shieldRecharge = e->shieldRechargeRate;
playBattleSound(SND_SHIELD_HIT, e->x, e->y);
}
}