Skip to content

Commit 88bba5f

Browse files
committed
check whether damage is global
1 parent 83282b6 commit 88bba5f

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

code/ship/shiphit.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,7 @@ static int maybe_shockwave_damage_adjust(const object *ship_objp, const object *
23052305
// Goober5000 - sanity checked this whole function in the case that other_obj is NULL, which
23062306
// will happen with the explosion-effect sexp
23072307
void ai_update_lethality(const object *ship_objp, const object *weapon_obj, float damage);
2308-
static void ship_do_damage(object *ship_objp, object *other_obj, const vec3d *hitpos, float damage, int quadrant, int submodel_num, int damage_type_idx = -1, bool wash_damage = false, float hit_dot = 1.f, const vec3d* hit_normal = nullptr, const vec3d* local_hitpos = nullptr)
2308+
static void ship_do_damage(object *ship_objp, object *other_obj, const vec3d *hitpos, float damage, int quadrant, int submodel_num, int damage_type_idx = -1, bool wash_damage = false, float hit_dot = 1.f, const vec3d* hit_normal = nullptr, const vec3d* local_hitpos = nullptr, const bool global = false)
23092309
{
23102310
// mprintf(("doing damage\n"));
23112311

@@ -2437,7 +2437,9 @@ static void ship_do_damage(object *ship_objp, object *other_obj, const vec3d *hi
24372437
shipp->ship_max_hull_strength,
24382438
};
24392439
}
2440-
maybe_play_conditional_impacts(impact_data, other_obj, ship_objp, true, submodel_num, hitpos, local_hitpos, hit_normal);
2440+
if (!global) {
2441+
maybe_play_conditional_impacts(impact_data, other_obj, ship_objp, true, submodel_num, hitpos, local_hitpos, hit_normal);
2442+
}
24412443

24422444
shiphit_hit_after_death(ship_objp, (damage * difficulty_scale_factor));
24432445
return;
@@ -2681,7 +2683,9 @@ static void ship_do_damage(object *ship_objp, object *other_obj, const vec3d *hi
26812683
}
26822684
}
26832685

2684-
maybe_play_conditional_impacts(impact_data, other_obj, ship_objp, true, submodel_num, hitpos, local_hitpos, hit_normal);
2686+
if (!global) {
2687+
maybe_play_conditional_impacts(impact_data, other_obj, ship_objp, true, submodel_num, hitpos, local_hitpos, hit_normal);
2688+
}
26852689

26862690
// handle weapon and afterburner leeching here
26872691
if(other_obj_is_weapon || other_obj_is_beam) {
@@ -2945,7 +2949,7 @@ void ship_apply_local_damage(object *ship_objp, object *other_obj, const vec3d *
29452949
ship_do_healing(ship_objp, other_obj, hitpos, damage, submodel_num);
29462950
create_sparks = false;
29472951
} else {
2948-
ship_do_damage(ship_objp, other_obj, hitpos, damage, quadrant, submodel_num, damage_type_idx, false, hit_dot, hit_normal, local_hitpos);
2952+
ship_do_damage(ship_objp, other_obj, hitpos, damage, quadrant, submodel_num, damage_type_idx, false, hit_dot, hit_normal, local_hitpos, false);
29492953
}
29502954

29512955
// DA 5/5/98: move ship_hit_create_sparks() after do_damage() since number of sparks depends on hull strength
@@ -3024,7 +3028,7 @@ void ship_apply_global_damage(object *ship_objp, object *other_obj, const vec3d
30243028
ship_do_healing(ship_objp, other_obj, &world_hitpos, damage, -1, damage_type_idx);
30253029
else
30263030
// Do damage on local point
3027-
ship_do_damage(ship_objp, other_obj, &world_hitpos, damage, shield_quad, -1 , damage_type_idx);
3031+
ship_do_damage(ship_objp, other_obj, &world_hitpos, damage, shield_quad, -1 , damage_type_idx, false, 1.f, nullptr, nullptr, true);
30283032
} else {
30293033
// Since an force_center wasn't specified, this is probably just a debug key
30303034
// to kill an object. So pick a shield quadrant and a point on the
@@ -3033,7 +3037,7 @@ void ship_apply_global_damage(object *ship_objp, object *other_obj, const vec3d
30333037

30343038
int n_quadrants = static_cast<int>(ship_objp->shield_quadrant.size());
30353039
for (int i=0; i<n_quadrants; i++){
3036-
ship_do_damage(ship_objp, other_obj, &world_hitpos, damage/n_quadrants, i, -1, damage_type_idx );
3040+
ship_do_damage(ship_objp, other_obj, &world_hitpos, damage/n_quadrants, i, -1, damage_type_idx, false, 1.f, nullptr, nullptr, true );
30373041
}
30383042
}
30393043

@@ -3064,7 +3068,7 @@ void ship_apply_wash_damage(object *ship_objp, object *other_obj, float damage)
30643068

30653069
// Do damage to hull and not to shields
30663070
global_damage = true;
3067-
ship_do_damage(ship_objp, other_obj, &world_hitpos, damage, -1, -1, -1, true);
3071+
ship_do_damage(ship_objp, other_obj, &world_hitpos, damage, -1, -1, -1, true, 1.f, nullptr, nullptr, true);
30683072

30693073
// AL 3-30-98: Show flashing blast icon if player ship has taken blast damage
30703074
if ( ship_objp == Player_obj ) {

0 commit comments

Comments
 (0)