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

Function Baddy2Hit

TombEngine/Objects/TR4/Entity/tr4_baddy.cpp:1287–1313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1285 }
1286
1287 void Baddy2Hit(ItemInfo& target, ItemInfo& source, std::optional<GameVector> pos, int damage, bool isExplosive, int jointIndex)
1288 {
1289 const auto& player = *GetLaraInfo(&source);
1290 const auto& object = Objects[target.ObjectNumber];
1291
1292 if (pos.has_value())
1293 {
1294 if (target.Animation.ActiveState == BADDY_STATE_DODGE &&
1295 (player.Control.Weapon.GunType == LaraWeaponType::Pistol ||
1296 player.Control.Weapon.GunType == LaraWeaponType::Shotgun ||
1297 player.Control.Weapon.GunType == LaraWeaponType::Uzi ||
1298 player.Control.Weapon.GunType == LaraWeaponType::HK ||
1299 player.Control.Weapon.GunType == LaraWeaponType::Revolver))
1300 {
1301 // Baddy2 bullet deflection with sword.
1302 SoundEffect(SFX_TR4_BADDY_SWORD_RICOCHET, &target.Pose);
1303 TriggerRicochetSpark(*pos, source.Pose.Orientation.y, false);
1304 return;
1305 }
1306 else if (object.hitEffect == HitEffect::Blood)
1307 {
1308 DoBloodSplat(pos->x, pos->y, pos->z, Random::GenerateInt(4, 8), source.Pose.Orientation.y, pos->RoomNumber);
1309 }
1310 }
1311
1312 DoItemHit(&target, damage, isExplosive);
1313 }
1314}

Callers

nothing calls this directly

Calls 6

SoundEffectFunction · 0.85
DoBloodSplatFunction · 0.85
GenerateIntFunction · 0.85
DoItemHitFunction · 0.85
TriggerRicochetSparkFunction · 0.50
has_valueMethod · 0.45

Tested by

no test coverage detected