[Change] Fewer explosions with beam weapons.

This commit is contained in:
Allanis 2013-09-24 23:31:44 +01:00
parent 55bb07c560
commit f2144b1053

View File

@ -297,13 +297,27 @@ static void weapons_updateLayer(const double dt, const WeaponLayer layer) {
case OUTFIT_TYPE_BOLT: case OUTFIT_TYPE_BOLT:
case OUTFIT_TYPE_TURRET_BOLT: case OUTFIT_TYPE_TURRET_BOLT:
case OUTFIT_TYPE_MISSILE_DUMB_AMMO: /* Dumb missiles are like bolts. */ case OUTFIT_TYPE_MISSILE_DUMB_AMMO: /* Dumb missiles are like bolts. */
case OUTFIT_TYPE_BEAM: /* Timer usage is actually more complicated for beams.. */ wlayer[i]->timer -= dt;
if(wlayer[i]->timer < 0.) {
weapon_destroy(wlayer[i], layer);
continue;
}
break;
/* Beam weapons handled apart. */
case OUTFIT_TYPE_BEAM:
case OUTFIT_TYPE_TURRET_BEAM: case OUTFIT_TYPE_TURRET_BEAM:
wlayer[i]->timer -= dt; wlayer[i]->timer -= dt;
if(wlayer[i]->timer < 0.) { if(wlayer[i]->timer < 0.) {
weapon_destroy(wlayer[i],layer); weapon_destroy(wlayer[i],layer);
continue; continue;
} }
wlayer[i]->lockon -= dt;
if(wlayer[i]->lockon < 0.) {
if(wlayer[i]->lockon < -1.)
wlayer[i]->lockon = 0.100;
else
wlayer[i]->lockon = -1.;
}
break; break;
default: default:
WARN("Weapon of type '%s' has no update implemented yet!", WARN("Weapon of type '%s' has no update implemented yet!",
@ -499,12 +513,14 @@ static void weapon_hitBeam(Weapon* w, Pilot* p, WeaponLayer layer,
} }
ai_attacked(p, w->parent); ai_attacked(p, w->parent);
} }
spfx_add(outfit_spfx(w->outfit), pos[0].x, pos[0].y, if(w->lockon == -1.) { /* Code to signal create explosions. */
VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_BACK); spfx_add(outfit_spfx(w->outfit), pos[0].x, pos[0].y,
spfx_add(outfit_spfx(w->outfit), pos[1].x, pos[1].y, VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_BACK);
VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_BACK); spfx_add(outfit_spfx(w->outfit), pos[1].x, pos[1].y,
VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_BACK);
} else { }
}
else if(w->lockon == -1.) {
spfx_add(outfit_spfx(w->outfit), pos[0].x, pos[0].y, spfx_add(outfit_spfx(w->outfit), pos[0].x, pos[0].y,
VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_FRONT); VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_FRONT);
spfx_add(outfit_spfx(w->outfit), pos[1].x, pos[1].y, spfx_add(outfit_spfx(w->outfit), pos[1].x, pos[1].y,
@ -538,9 +554,7 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2*
/* Bolts treated together. */ /* Bolts treated together. */
case OUTFIT_TYPE_BOLT: case OUTFIT_TYPE_BOLT:
case OUTFIT_TYPE_TURRET_BOLT: case OUTFIT_TYPE_TURRET_BOLT:
/* Only difference is the direction of fire. */ if((outfit->type == OUTFIT_TYPE_TURRET_BEAM) && (w->parent != w->target)) {
if((outfit->type == OUTFIT_TYPE_TURRET_BOLT) && (w->parent != w->target) &&
(w->target != 0)) { /* Must have a valid target. */
pilot_target = pilot_get(w->target); pilot_target = pilot_get(w->target);
/* Get the distance. */ /* Get the distance. */