MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / HitCorpse

Function HitCorpse

TombEngine/Objects/TR3/Object/corpse.cpp:209–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 }
208
209 void HitCorpse(ItemInfo& target, ItemInfo& source, std::optional<GameVector> pos, int damage, bool isExplosive, int jointIndex)
210 {
211 const auto& object = Objects[target.ObjectNumber];
212 const auto& player = *GetLaraInfo(&source);
213
214 if (pos.has_value() && (player.Control.Weapon.GunType == LaraWeaponType::Pistol ||
215 player.Control.Weapon.GunType == LaraWeaponType::Shotgun ||
216 player.Control.Weapon.GunType == LaraWeaponType::Uzi ||
217 player.Control.Weapon.GunType == LaraWeaponType::HK ||
218 player.Control.Weapon.GunType == LaraWeaponType::Revolver))
219 {
220 DoBloodSplat(pos->x, pos->y, pos->z, Random::GenerateInt(4, 8), source.Pose.Orientation.y, pos->RoomNumber);
221
222 if (target.ItemFlags[7] == (int)CorpseFlag::Hang)
223 {
224 target.ItemFlags[7] = (int)CorpseFlag::Fall;
225 target.Animation.AnimNumber = CORPSE_ANIM_FALL;
226 target.Animation.ActiveState = CORPSE_STATE_FALL;
227 }
228 }
229 else if (player.Weapons[(int)LaraWeaponType::GrenadeLauncher].SelectedAmmo == WeaponAmmoType::Ammo2)
230 {
231 DoItemHit(&target,0, isExplosive, false);
232 }
233 else
234 {
235 DoItemHit(&target, 0, isExplosive, false);
236 }
237 }
238}

Callers

nothing calls this directly

Calls 4

DoBloodSplatFunction · 0.85
GenerateIntFunction · 0.85
DoItemHitFunction · 0.85
has_valueMethod · 0.45

Tested by

no test coverage detected