CFlyingPirate: Remove useless references

This commit is contained in:
Luke Street 2020-07-12 23:28:03 -04:00
parent a2bcb4d086
commit 61577b16d2
1 changed files with 39 additions and 39 deletions

View File

@ -122,9 +122,9 @@ CFlyingPirate::CFlyingPirateRagDoll::CFlyingPirateRagDoll(CStateManager& mgr, CF
CAnimData* animData = modelData->GetAnimationData();
const zeus::CVector3f& scale = modelData->GetScale();
animData->BuildPose();
const zeus::CVector3f& center = actor->GetBoundingBox().center();
const zeus::CVector3f center = actor->GetBoundingBox().center();
for (size_t i = 0; i < skParts.size(); ++i) {
const CSegId& id = animData->GetLocatorSegId(skParts[i]);
const CSegId id = animData->GetLocatorSegId(skParts[i]);
AddParticle(id, center, actor->GetTransform() * (scale * animData->GetPose().GetOffset(id)),
skRadii[i] * scale.z());
}
@ -185,7 +185,7 @@ void CFlyingPirate::CFlyingPirateRagDoll::PreRender(const zeus::CVector3f& v, CM
CAnimData* const animData = mData.GetAnimationData();
const CCharLayoutInfo& layout = animData->GetCharLayoutInfo();
CHierarchyPoseBuilder& poseBuilder = animData->PoseBuilder();
for (const auto& id : layout.GetSegIdList().GetList()) {
for (const auto id : layout.GetSegIdList().GetList()) {
if (layout.GetRootNode()->GetBoneMap()[id].x10_children.size() > 1) {
poseBuilder.GetTreeMap()[id].x4_rotation = zeus::CQuaternion();
}
@ -231,7 +231,7 @@ void CFlyingPirate::CFlyingPirateRagDoll::Update(CStateManager& mgr, float dt, f
if (!x68_25_over) {
if (x6c_actor->x6a1_30_spinToDeath) {
x84_ -= dt;
const zeus::CVector3f& v9c = (x6c_actor->x2e0_destPos - x4_particles[14].GetPosition()).normalized();
const zeus::CVector3f v9c = (x6c_actor->x2e0_destPos - x4_particles[14].GetPosition()).normalized();
x74_ = zeus::CVector3f::slerp(x74_, v9c, zeus::degToRad(360.f * dt));
x70_ = 25.f;
zeus::CVector3f mul = x70_ * x74_;
@ -393,7 +393,7 @@ void CFlyingPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
SetMomentumWR({0.f, 0.f, -xe8_mass * GetGravityConstant()});
AddMaterial(EMaterialTypes::GroundCollider, mgr);
SetDestPos(cover->GetTranslation());
const zeus::CVector3f& dist = cover->GetTranslation() - GetTranslation();
const zeus::CVector3f dist = cover->GetTranslation() - GetTranslation();
if (dist.z() < 0.f) {
zeus::CVector3f velocity = GetVelocity();
const float gravity = GetGravityConstant();
@ -402,7 +402,7 @@ void CFlyingPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
float dVar9 = (-velocity.z() + fVar3) / gravity;
if (0.f < dVar9) {
zeus::CVector2f dist2f(dist.x(), dist.y());
const zeus::CVector2f& normal = dist2f.normalized();
const zeus::CVector2f normal = dist2f.normalized();
const float mag = dist2f.magnitude();
velocity.x() = (mag / dVar9) * normal.x();
velocity.y() = (mag / dVar9) * normal.y();
@ -534,16 +534,16 @@ void CFlyingPirate::CalculateRenderBounds() {
if (!x89c_ragDoll || !x89c_ragDoll->IsPrimed()) {
CActor::CalculateRenderBounds();
} else {
const zeus::CAABox& bounds = x89c_ragDoll->CalculateRenderBounds();
const zeus::CVector3f& scale = 0.25f * GetModelData()->GetScale();
const zeus::CAABox bounds = x89c_ragDoll->CalculateRenderBounds();
const zeus::CVector3f scale = 0.25f * GetModelData()->GetScale();
x9c_renderBounds = {bounds.min - scale, bounds.max + scale};
}
}
bool CFlyingPirate::CanFireMissiles(CStateManager& mgr) {
for (const auto& seg : x864_missileSegments) {
const zeus::CTransform& xf = GetLctrTransform(seg);
const zeus::CVector3f& dir = xf.origin + (3.f * xf.frontVector());
for (const auto seg : x864_missileSegments) {
const zeus::CTransform xf = GetLctrTransform(seg);
const zeus::CVector3f dir = xf.origin + (3.f * xf.frontVector());
CMaterialList matList(EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough);
if (!LineOfSightTest(mgr, xf.origin, dir, matList) || !LineOfSightTest(mgr, dir, GetTargetPos(mgr), matList)) {
x6a1_28_ = true;
@ -563,7 +563,7 @@ void CFlyingPirate::CheckForProjectiles(CStateManager& mgr) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(EMaterialTypes::Projectile), this);
for (const auto& id : nearList) {
for (const auto id : nearList) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(id)) {
zeus::CVector3f dist = GetBoundingBox().center() - proj->GetTranslation();
if (dist.isMagnitudeSafe()) {
@ -662,7 +662,7 @@ void CFlyingPirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& nod
CProjectileInfo& pInfo =
x6a1_26_isAttackingObject ? x568_data.x60_altProjectileInfo2 : x568_data.x38_altProjectileInfo1;
if (pInfo.Token().IsLoaded() && mgr.CanCreateProjectile(x8_uid, EWeaponType::AI, 16)) {
const zeus::CTransform& xf = GetLctrTransform(node.GetLocatorName());
const zeus::CTransform xf = GetLctrTransform(node.GetLocatorName());
TUniqueId target = x6a1_26_isAttackingObject ? x85c_attackObjectId : mgr.GetPlayer().GetUniqueId();
CEnergyProjectile* projectile =
new CEnergyProjectile(true, pInfo.Token(), EWeaponType::AI, xf, EMaterialTypes::Character, pInfo.GetDamage(),
@ -721,7 +721,7 @@ void CFlyingPirate::MassiveDeath(CStateManager& mgr) {
void CFlyingPirate::FireProjectile(CStateManager& mgr, float dt) {
bool projectileFired = false;
const zeus::CTransform& xf = GetLctrTransform(x7e0_gunSegId);
const zeus::CTransform xf = GetLctrTransform(x7e0_gunSegId);
if (!x400_25_alive) {
LaunchProjectile(xf, mgr, 8, EProjectileAttrib::None, false, std::nullopt, -1, false, zeus::skOne3f);
projectileFired = true;
@ -746,7 +746,7 @@ void CFlyingPirate::FireProjectile(CStateManager& mgr, float dt) {
}
}
if (projectileFired) {
const std::pair<float, s32>& anim = x450_bodyController->GetPASDatabase().FindBestAnimation(
const std::pair<float, s32> anim = x450_bodyController->GetPASDatabase().FindBestAnimation(
CPASAnimParmData{24, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1);
if (anim.first > 0.f) {
GetModelData()->GetAnimationData()->AddAdditiveAnimation(anim.second, 1.f, false, true);
@ -766,7 +766,7 @@ pas::EStepDirection CFlyingPirate::GetDodgeDirection(CStateManager& mgr, float a
if (entity == this)
continue;
if (TCastToPtr<CPhysicsActor> actor = entity) {
const zeus::CVector3f& dist = actor->GetTranslation() - GetTranslation();
const zeus::CVector3f dist = actor->GetTranslation() - GetTranslation();
float distMagSquared = dist.magSquared();
if (distMagSquared < argSquared) {
float rightVecMag = GetTransform().rightVector().magSquared();
@ -785,7 +785,7 @@ pas::EStepDirection CFlyingPirate::GetDodgeDirection(CStateManager& mgr, float a
}
}
const zeus::CVector3f& center = GetBoundingBox().center();
const zeus::CVector3f center = GetBoundingBox().center();
if (canDodgeRight) {
canDodgeRight = LineOfSightTest(mgr, center, center + (arg * GetTransform().rightVector()), {});
}
@ -816,7 +816,7 @@ pas::EStepDirection CFlyingPirate::GetDodgeDirection(CStateManager& mgr, float a
}
}
if (canDodgeUp && canDodgeDown) {
const zeus::CVector3f& target = GetTargetPos(mgr);
const zeus::CVector3f target = GetTargetPos(mgr);
if (target.z() - (GetTranslation().z() + x568_data.x8c_flyingHeight) <= 0.f) {
canDodgeUp = false;
} else {
@ -838,7 +838,7 @@ pas::EStepDirection CFlyingPirate::GetDodgeDirection(CStateManager& mgr, float a
zeus::CVector3f CFlyingPirate::GetTargetPos(CStateManager& mgr) {
const CPlayer& player = mgr.GetPlayer();
const TUniqueId& playerUid = player.GetUniqueId();
const TUniqueId playerUid = player.GetUniqueId();
if (x7e8_targetId != playerUid) {
if (TCastToPtr<CActor> actor = mgr.ObjectById(x7e8_targetId)) {
if (actor->GetActive()) {
@ -883,7 +883,7 @@ bool CFlyingPirate::InPosition(CStateManager& mgr, float) {
if (cover == nullptr) {
return true;
}
const zeus::CVector3f& dist = cover->GetTranslation() - GetTranslation();
const zeus::CVector3f dist = cover->GetTranslation() - GetTranslation();
return dist.z() < 0.f && dist.magnitude() < 4.f;
}
@ -929,8 +929,8 @@ void CFlyingPirate::KnockBack(const zeus::CVector3f& pos, CStateManager& mgr, co
// if (waypointId != kInvalidUniqueId) {
// casts and then does nothing?
// }
const zeus::CVector3f& homingPosition = mgr.GetPlayer().GetHomingPosition(mgr, 0.f);
const zeus::CVector3f& homingDist = homingPosition - GetTranslation();
const zeus::CVector3f homingPosition = mgr.GetPlayer().GetHomingPosition(mgr, 0.f);
const zeus::CVector3f homingDist = homingPosition - GetTranslation();
zeus::CVector3f cross = homingDist.cross(zeus::skUp);
if (zeus::close_enough(cross, zeus::skZero3f, 1.0E-4f)) {
cross = homingDist.cross(zeus::skForward);
@ -993,7 +993,7 @@ bool CFlyingPirate::Listen(const zeus::CVector3f& pos, EListenNoiseType type) {
bool ret = false;
if (x400_25_alive) {
float x4Squared = x568_data.x4_hearingDistance * x568_data.x4_hearingDistance;
const zeus::CVector3f& dist = pos - GetTranslation();
const zeus::CVector3f dist = pos - GetTranslation();
if (dist.magSquared() < x4Squared && (x3c0_detectionHeightRange == 0.f || (dist.z() * dist.z() < x4Squared))) {
ret = true;
x6a0_26_hearShot = true;
@ -1061,7 +1061,7 @@ void CFlyingPirate::PathFind(CStateManager& mgr, EStateMsg msg, float arg) {
if (search->GetResult() == CPathFindSearch::EResult::Success &&
search->GetCurrentWaypoint() < search->GetWaypoints().size() - 1) {
zeus::CVector3f out = GetTranslation();
const zeus::CVector3f& front = out + GetTransform().frontVector();
const zeus::CVector3f front = out + GetTransform().frontVector();
search->GetSplinePointWithLookahead(out, front, 3.f);
if (search->SegmentOver(out)) {
search->SetCurrentWaypoint(search->GetCurrentWaypoint() + 1);
@ -1086,7 +1086,7 @@ void CFlyingPirate::PathFind(CStateManager& mgr, EStateMsg msg, float arg) {
x898_ = fVar2;
x870_ += x87c_;
const zeus::CVector3f& face = (GetTargetPos(mgr) - GetTranslation()).normalized();
const zeus::CVector3f face = (GetTargetPos(mgr) - GetTranslation()).normalized();
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, face, 1.f));
UpdateCanSeePlayer(mgr);
} else if (msg == EStateMsg::Deactivate) {
@ -1153,7 +1153,7 @@ void CFlyingPirate::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
const zeus::CVector3f& origin = GetTranslation();
const zeus::CVector3f& playerOrigin = mgr.GetPlayer().GetTranslation();
const zeus::CVector3f& dist = (playerOrigin - origin).normalized();
const zeus::CVector3f dist = (playerOrigin - origin).normalized();
zeus::CVector3f target{
origin.x() - x2fc_minAttackRange * dist.x(),
origin.y() - x2fc_minAttackRange * dist.y(),
@ -1203,7 +1203,7 @@ void CFlyingPirate::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
x898_ = fVar2;
x870_ += x87c_;
const zeus::CVector3f& face = (GetTargetPos(mgr) - GetTranslation()).normalized();
const zeus::CVector3f face = (GetTargetPos(mgr) - GetTranslation()).normalized();
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, face, 1.f));
UpdateCanSeePlayer(mgr);
}
@ -1241,7 +1241,7 @@ bool CFlyingPirate::ShouldMove(CStateManager& mgr, float) {
const CPlayer& player = mgr.GetPlayer();
const zeus::CVector3f& origin = GetTranslation();
const zeus::CVector3f& playerOrigin = player.GetTranslation();
const zeus::CVector3f& dist = origin - playerOrigin;
const zeus::CVector3f dist = origin - playerOrigin;
CRandom16* activeRandom = mgr.GetActiveRandom();
float rand = activeRandom->Float();
@ -1251,7 +1251,7 @@ bool CFlyingPirate::ShouldMove(CStateManager& mgr, float) {
rand = activeRandom->Range(-25.f, -15.f);
}
const zeus::CVector3f& cross = dist.cross(zeus::skUp).normalized();
const zeus::CVector3f cross = dist.cross(zeus::skUp).normalized();
SetDestPos({
origin.x() + (rand * cross.x()),
origin.y() + (rand * cross.y()),
@ -1307,7 +1307,7 @@ bool CFlyingPirate::ShouldSpecialAttack(CStateManager& mgr, float) {
}
bool CFlyingPirate::SpotPlayer(CStateManager& mgr, float) {
const zeus::CVector3f& dir = mgr.GetPlayer().GetAimPosition(mgr, 0.f) - GetGunEyePos();
const zeus::CVector3f dir = mgr.GetPlayer().GetAimPosition(mgr, 0.f) - GetGunEyePos();
return dir.magnitude() * x3c4_detectionAngle < dir.dot(GetTransform().frontVector());
}
@ -1326,7 +1326,7 @@ void CFlyingPirate::UpdateLandingSmoke(CStateManager& mgr, bool active) {
if (cover != nullptr) {
particleLevel = cover->GetTranslation().z() - 1.f;
}
const CRayCastResult& result = mgr.RayStaticIntersection(origin, zeus::skDown, origin.z() - particleLevel,
const CRayCastResult result = mgr.RayStaticIntersection(origin, zeus::skDown, origin.z() - particleLevel,
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}));
int idx = 1;
if (result.IsValid()) {
@ -1385,8 +1385,8 @@ void CFlyingPirate::DeliverGetUp() {
void CFlyingPirate::UpdateCanSeePlayer(CStateManager& mgr) {
if (x7dc_ % 7 == 0) {
bool bVar4 = true;
const zeus::CVector3f& start = GetGunEyePos() - GetTransform().rightVector();
const zeus::CVector3f& end = GetAimPosition(mgr, 0.f);
const zeus::CVector3f start = GetGunEyePos() - GetTransform().rightVector();
const zeus::CVector3f end = GetAimPosition(mgr, 0.f);
const CMaterialList matList(EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough);
if (LineOfSightTest(mgr, start, end, matList)) {
bVar4 = !LineOfSightTest(mgr, start, end, matList);
@ -1433,7 +1433,7 @@ void CFlyingPirate::Taunt(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) {
x6a0_28_ = true;
x7a0_boneTracking.SetActive(true);
const TUniqueId& playerUid = mgr.GetPlayer().GetUniqueId();
const TUniqueId playerUid = mgr.GetPlayer().GetUniqueId();
x7a0_boneTracking.SetTarget(playerUid);
bool foundPirate = false;
for (const auto& obj : *mgr.ObjectListById(EGameObjectList::AiWaypoint)) {
@ -1540,7 +1540,7 @@ void CFlyingPirate::Think(float dt, CStateManager& mgr) {
}
if (!x6a0_25_isAquaPirate && xc4_fluidId != kInvalidUniqueId) {
if (TCastToPtr<CScriptWater> water = mgr.ObjectById(xc4_fluidId)) {
const zeus::CAABox& box = water->GetTriggerBoundsWR();
const zeus::CAABox box = water->GetTriggerBoundsWR();
if (2.f + GetTranslation().z() < box.max.z()) {
x401_30_pendingDeath = true;
}
@ -1575,11 +1575,11 @@ void CFlyingPirate::Think(float dt, CStateManager& mgr) {
x7ec_burstFire.Start(mgr);
if (x400_25_alive) {
x7e4_ = x308_attackTimeVariation * mgr.GetActiveRandom()->Float() + x304_averageAttackTime;
const zeus::CVector3f& dist =
const zeus::CVector3f dist =
(GetBoundingBox().center() - mgr.GetPlayer().GetAimPosition(mgr, 0.f)).normalized();
if (dist.magSquared() < 0.9f) {
for (const auto& obj : *mgr.ObjectListById(EGameObjectList::AiWaypoint)) {
if (const CSpacePirate* pirate = CPatterned::CastTo<const CSpacePirate>(obj)) {
if (const auto* pirate = CPatterned::CastTo<const CSpacePirate>(obj)) {
if (pirate->GetEnableAim() && pirate->GetAreaIdAlways() == x4_areaId) {
x7e4_ += 0.2f;
}
@ -1647,8 +1647,8 @@ void CFlyingPirate::Think(float dt, CStateManager& mgr) {
vf8.normalize();
}
zeus::CVector3f v1d0 = std::min(0.333f * x87c_.magnitude(), 0.333f) * vf8;
const zeus::CVector3f& v104 = (zeus::skUp + v1d0).normalized();
const zeus::CVector3f& v110 = GetTransform().upVector();
const zeus::CVector3f v104 = (zeus::skUp + v1d0).normalized();
const zeus::CVector3f v110 = GetTransform().upVector();
float f26c = std::abs(zeus::CVector3f::getAngleDiff(v110, v104));
if (f26c > 0.f) {
float f1f4 = std::min(f26c, 30.f * zeus::degToRad(dt)); // ?