Almost match CPlayerGun::GetTargetId

Former-commit-id: c059b527ec
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-06 19:57:29 +03:00
parent f3656746b6
commit 291515c5ee
2 changed files with 20 additions and 1 deletions

View File

@ -167,6 +167,10 @@ public:
CPlayerGun* PlayerGun() { return x490_gun.get(); }
const CPlayerGun* GetPlayerGun() const { return x490_gun.get(); }
TUniqueId GetOrbitTargetId() const { return x310_orbitTargetId; }
TUniqueId GetOrbitNextTargetId() const { return x33c_orbitNextTargetId; }
TUniqueId GetScanningObjectId() const { return x3b4_scanningObject; }
private:
struct CVisorSteam {

View File

@ -570,7 +570,22 @@ float CPlayerGun::GetBeamVelocity() const {
return 10.f;
}
TUniqueId CPlayerGun::GetTargetId(CStateManager&) { return TUniqueId(0, 0); }
TUniqueId CPlayerGun::GetTargetId(CStateManager& mgr) {
TUniqueId ret = mgr.GetPlayer()->GetOrbitTargetId();
if (x832_26_comboFiring && ret == kInvalidUniqueId && x310_currentBeam == CPlayerState::kBI_Wave)
ret = mgr.GetPlayer()->GetOrbitNextTargetId();
if (ret != kInvalidUniqueId) {
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(ret));
if (act != nullptr) {
if (!act->GetMaterialList().HasMaterial(kMT_Target)) {
ret = kInvalidUniqueId;
}
}
}
return ret;
}
CPlayerGun::CGunMorph::CGunMorph(float gunTransformTime, float holoHoldTime)
: x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {}