Skip to content

Commit eaf66e5

Browse files
committed
cleanup
1 parent 6f0d263 commit eaf66e5

File tree

1 file changed

+6
-71
lines changed

1 file changed

+6
-71
lines changed

code/object/collideshipweapon.cpp

Lines changed: 6 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -678,88 +678,23 @@ static std::tuple<bool, bool, ship_weapon_collision_data> prop_weapon_check_coll
678678
if (next_hit && hit) {
679679
// find hit time
680680
*next_hit = (int)(1000.0f * (mc.hit_dist * (flFrametime + time_limit) - flFrametime));
681-
if (*next_hit > 0)
682-
// if hit occurs outside of this frame, do not do damage
681+
if (*next_hit > 0) {
682+
// if hit occurs outside of this frame, do not do damage
683683
valid_hit_occurred = 1;
684684
bool postproc = true;
685685
bool recheck = false;
686686
// most of this data is irrevelant for props but let's match it to make it easy
687-
ship_weapon_collision_data cd{
688-
mc,
689-
-1,
690-
postproc,
691-
-1,
692-
-1,
693-
ZERO_VECTOR
694-
};
687+
ship_weapon_collision_data cd{mc, -1, postproc, -1, -1, ZERO_VECTOR};
695688
return {postproc, recheck, cd};
696-
}
697-
698-
if (hit)
699-
{
700-
/*wp->collisionInfo = new mc_info; // The weapon will free this memory later
701-
*wp->collisionInfo = mc;
702-
703-
bool prop_override = false, weapon_override = false;
704-
705-
// get submodel handle if scripting needs it
706-
bool has_submodel = (mc.hit_submodel >= 0);
707-
scripting::api::submodel_h smh(mc.model_num, mc.hit_submodel);
708-
709-
710-
if (scripting::hooks::OnWeaponCollision->isActive()) {
711-
prop_override = scripting::hooks::OnWeaponCollision->isOverride(scripting::hooks::CollisionConditions{ {prop_objp, weapon_objp} },
712-
scripting::hook_param_list(scripting::hook_param("Self", 'o', prop_objp),
713-
scripting::hook_param("Object", 'o', weapon_objp),
714-
scripting::hook_param("Prop", 'o', prop_objp),
715-
scripting::hook_param("Weapon", 'o', weapon_objp),
716-
scripting::hook_param("Hitpos", 'o', mc.hit_point_world)));
717-
}
718-
if (scripting::hooks::OnPropCollision->isActive()) {
719-
weapon_override = scripting::hooks::OnPropCollision->isOverride(scripting::hooks::CollisionConditions{ {prop_objp, weapon_objp} },
720-
scripting::hook_param_list(scripting::hook_param("Self", 'o', weapon_objp),
721-
scripting::hook_param("Object", 'o', prop_objp),
722-
scripting::hook_param("Prop", 'o', prop_objp),
723-
scripting::hook_param("Weapon", 'o', weapon_objp),
724-
scripting::hook_param("Hitpos", 'o', mc.hit_point_world),
725-
scripting::hook_param("PropSubmodel", 'o', scripting::api::l_Submodel.Set(smh), has_submodel)));
726-
}
727-
728-
if (!prop_override && !weapon_override) {
729-
weapon_hit(weapon_objp, prop_objp, &mc.hit_point_world, MISS_SHIELDS); //, &mc.hit_normal, &mc.hit_point, mc.hit_submodel); This was changed by PR 6785 and the changes were not documented
730689
}
731-
732-
if (scripting::hooks::OnWeaponCollision->isActive() && !(weapon_override && !prop_override)) {
733-
scripting::hooks::OnWeaponCollision->run(scripting::hooks::CollisionConditions{ {prop_objp, weapon_objp} },
734-
scripting::hook_param_list(scripting::hook_param("Self", 'o', prop_objp),
735-
scripting::hook_param("Object", 'o', weapon_objp),
736-
scripting::hook_param("Prop", 'o', prop_objp),
737-
scripting::hook_param("Weapon", 'o', weapon_objp),
738-
scripting::hook_param("Hitpos", 'o', mc.hit_point_world)));
739-
}
740-
if (scripting::hooks::OnPropCollision->isActive() && !prop_override) {
741-
scripting::hooks::OnPropCollision->run(scripting::hooks::CollisionConditions{ {prop_objp, weapon_objp} },
742-
scripting::hook_param_list(scripting::hook_param("Self", 'o', weapon_objp),
743-
scripting::hook_param("Object", 'o', prop_objp),
744-
scripting::hook_param("Prop", 'o', prop_objp),
745-
scripting::hook_param("Weapon", 'o', weapon_objp),
746-
scripting::hook_param("Hitpos", 'o', mc.hit_point_world),
747-
scripting::hook_param("PropSubmodel", 'o', scripting::api::l_Submodel.Set(smh), has_submodel)));
748-
}*/
749-
valid_hit_occurred = 1;
750690
}
751691

692+
valid_hit_occurred = hit ? 1 : 0;
693+
752694
bool postproc = (valid_hit_occurred != 0);
753695
bool recheck = (valid_hit_occurred == 0);
754696
// most of this data is irrevelant for props but let's match it to make it easy
755-
ship_weapon_collision_data cd{
756-
(valid_hit_occurred ? mc : mc_info{}),
757-
-1,
758-
postproc,
759-
-1,
760-
-1,
761-
ZERO_VECTOR
762-
};
697+
ship_weapon_collision_data cd{(valid_hit_occurred ? mc : mc_info{}), -1, postproc, -1, -1, ZERO_VECTOR};
763698

764699
return{postproc, recheck, cd};
765700
}

0 commit comments

Comments
 (0)