mirror of https://github.com/AxioDL/metaforce.git
CFlyingPirate: Small fixes
This commit is contained in:
parent
1bcd0916ca
commit
26ae8beb74
|
@ -459,7 +459,6 @@ public:
|
|||
const zeus::CVector3f& GetMoveVector() const { return x0_move; }
|
||||
const zeus::CVector3f& GetFaceVector() const { return xc_face; }
|
||||
const zeus::CVector3f& GetTargetVector() const { return x18_target; }
|
||||
void SetTargetVector(const zeus::CVector3f& target) { x18_target = target; }
|
||||
const zeus::CVector3f& GetAdditiveTargetVector() const { return x24_additiveTarget; }
|
||||
};
|
||||
|
||||
|
|
|
@ -708,7 +708,7 @@ void CBabygoth::FollowPattern(CStateManager& mgr, EStateMsg msg, float) {
|
|||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
} else if (x568_stateProg == 3) {
|
||||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
else
|
||||
x568_stateProg = 4;
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ void CChozoGhost::Attack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
xfc_constantForce.zeroOut();
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, x67c_attackType);
|
||||
GetBodyController()->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
GetBodyController()->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
if (x67c_attackType != 2)
|
||||
FloatToLevel(x678_floorLevel, dt);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
|
|
@ -785,7 +785,7 @@ void CFlaahgra::Growth(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
UpdateScale((x7c4_ > 0.f ? 1.f - (GetEndActionTime() / x7c4_) : 1.f), x81c_, x56c_.x4_);
|
||||
}
|
||||
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
UpdateScale(1.f, x81c_, x56c_.x4_);
|
||||
|
@ -983,7 +983,7 @@ void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::MeleeAttack)
|
||||
x568_ = 4;
|
||||
else
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x78c_);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x78c_);
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
SetCollisionActorBounds(mgr, x79c_leftArmCollision, {});
|
||||
|
@ -1100,7 +1100,7 @@ void CFlaahgra::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float) {
|
|||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
|
||||
x568_ = 4;
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ void CFlaahgra::Cover(CStateManager& mgr, EStateMsg msg, float) {
|
|||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::MeleeAttack)
|
||||
x568_ = 4;
|
||||
else if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(x77c_)) {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(wp->GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(wp->GetTranslation() - GetTranslation());
|
||||
}
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
|
|
@ -567,7 +567,7 @@ void CFlyingPirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& nod
|
|||
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());
|
||||
TUniqueId& target = x6a1_26_isAttackingObject ? x85c_attackObjectId : x8_uid;
|
||||
TUniqueId target = x6a1_26_isAttackingObject ? x85c_attackObjectId : mgr.GetPlayer().GetUniqueId();
|
||||
CEnergyProjectile* projectile = new CEnergyProjectile(
|
||||
true, pInfo.Token(), EWeaponType::AI, xf, EMaterialTypes::Floor, pInfo.GetDamage(), mgr.AllocateUniqueId(),
|
||||
x4_areaId, x8_uid, target, EProjectileAttrib::None, false, zeus::skOne3f, std::nullopt, -1, false);
|
||||
|
@ -928,7 +928,9 @@ void CFlyingPirate::Lurk(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
}
|
||||
if (x32c_animState != EAnimState::Repeat) {
|
||||
x2e0_destPos = GetTargetPos(mgr);
|
||||
if (x34_transform.frontVector().dot((x2e0_destPos - GetTranslation()).normalized()) < 0.8f) {
|
||||
zeus::CVector3f dist = x2e0_destPos - GetTranslation();
|
||||
dist.z() = 0.f;
|
||||
if (x34_transform.frontVector().dot(dist.normalized()) < 0.8f) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
}
|
||||
}
|
||||
|
@ -1020,7 +1022,7 @@ void CFlyingPirate::Patrol(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x870_ += x87c_;
|
||||
}
|
||||
if (x30c_behaviourOrient == EBehaviourOrient::Constant) {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
}
|
||||
UpdateCanSeePlayer(mgr);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
@ -1331,7 +1333,7 @@ void CFlyingPirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
x870_ += x87c_;
|
||||
}
|
||||
if (x30c_behaviourOrient == EBehaviourOrient::Constant) {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
}
|
||||
UpdateCanSeePlayer(mgr);
|
||||
}
|
||||
|
@ -1341,7 +1343,8 @@ void CFlyingPirate::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
if (msg == EStateMsg::Activate) {
|
||||
x6a0_28_ = true;
|
||||
x7a0_boneTracking.SetActive(true);
|
||||
x7a0_boneTracking.SetTarget(x8_uid);
|
||||
const TUniqueId& playerUid = mgr.GetPlayer().GetUniqueId();
|
||||
x7a0_boneTracking.SetTarget(playerUid);
|
||||
bool foundPirate = false;
|
||||
for (const auto& obj : *mgr.ObjectListById(EGameObjectList::AiWaypoint)) {
|
||||
if (const CSpacePirate* const pirate = CPatterned::CastTo<CSpacePirate>(obj)) {
|
||||
|
@ -1354,7 +1357,7 @@ void CFlyingPirate::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
}
|
||||
x79c_ = foundPirate ? 0 : 1;
|
||||
if (x7e8_targetId == kInvalidUniqueId) {
|
||||
x7e8_targetId = mgr.GetPlayer().GetUniqueId();
|
||||
x7e8_targetId = playerUid;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
if (x79c_ == 0) {
|
||||
|
@ -1526,25 +1529,24 @@ LAB_801f7bb8:
|
|||
x34_transform.transposeRotate(GetTargetPos(mgr) - GetTranslation()));
|
||||
}
|
||||
if (0.f < x870_.magSquared()) {
|
||||
float fVar27 = x870_.magnitude();
|
||||
float fVar4 = 1.f / fVar27;
|
||||
float fVar5 = 0.2;
|
||||
float mag = x870_.magnitude();
|
||||
float fVar5 = 0.2f;
|
||||
if (0.f == x87c_.magSquared()) {
|
||||
fVar5 = 0.2f * 3.f;
|
||||
}
|
||||
float mul = -(dt * fVar27 * fVar5 * fVar27 - fVar27);
|
||||
x870_ = mul * fVar4 * x870_;
|
||||
float mul = -(dt * mag * fVar5 * mag - mag);
|
||||
x870_ = mul * (1.f / mag) * x870_;
|
||||
}
|
||||
pas::EAnimationState state = x450_bodyController->GetCurrentStateId();
|
||||
if (!x400_25_alive || state == pas::EAnimationState::LoopReaction || state == pas::EAnimationState::LieOnGround ||
|
||||
state == pas::EAnimationState::Getup) {
|
||||
if (!x400_25_alive || state == pas::EAnimationState::LoopReaction || state == pas::EAnimationState::Hurled ||
|
||||
state == pas::EAnimationState::LieOnGround || state == pas::EAnimationState::Getup) {
|
||||
x870_.zeroOut();
|
||||
x87c_.zeroOut();
|
||||
} else {
|
||||
ApplyImpulseWR(xe8_mass * x870_, {});
|
||||
}
|
||||
|
||||
if (auto& handle = GetSfxHandle()) {
|
||||
if (const auto& handle = GetSfxHandle()) {
|
||||
x898_ = std::clamp(x898_, 1.f, 1.999f);
|
||||
x894_ += std::clamp(x898_ - x894_, -dt, dt);
|
||||
CSfxManager::PitchBend(handle, x894_); // TODO * 8192.f?
|
||||
|
@ -1569,10 +1571,7 @@ LAB_801f7bb8:
|
|||
zeus::CVector3f v128 = x34_transform.frontVector().cross(v1dc);
|
||||
zeus::CVector3f v20c = v1dc.cross(v128).normalized();
|
||||
zeus::CVector3f v128_2 = v20c.cross(v1dc);
|
||||
x34_transform = zeus::CTransform(v128_2, v20c, v1dc, GetTranslation());
|
||||
xe4_27_notInSortedLists = true;
|
||||
xe4_28_transformDirty = true;
|
||||
xe4_29_actorLightsDirty = true;
|
||||
SetTransform({v128_2, v20c, v1dc, x34_transform.origin});
|
||||
}
|
||||
|
||||
if (!x450_bodyController->IsFrozen()) {
|
||||
|
|
|
@ -107,7 +107,7 @@ void CJellyZap::Suck(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
RemoveAllAttractors(mgr);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::LoopReaction, &CPatterned::TryLoopReaction, 0);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(
|
||||
(mgr.GetPlayer().GetTranslation() + zeus::CVector3f(0.f, 0.f, 1.f)) - GetTranslation());
|
||||
|
||||
float intensity = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit) ? 0.1f : 1.f;
|
||||
|
@ -133,7 +133,7 @@ void CJellyZap::Active(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
} else if (msg == EStateMsg::Update) {
|
||||
zeus::CVector3f targetVector =
|
||||
GetTranslation() - (zeus::CVector3f(0.f, 0.f, 1.f) + mgr.GetPlayer().GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(targetVector);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(targetVector);
|
||||
if (x5b8_26_) {
|
||||
zeus::CVector3f moveToImpulse =
|
||||
GetMoveToORImpulseWR(GetTransform().transposeRotate(arg * (zeus::CVector3f(0.f, 1.f, 0.f) * x598_)), arg);
|
||||
|
|
|
@ -144,7 +144,7 @@ void CMetaree::Active(CStateManager& mgr, EStateMsg msg, float) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::Zero, x584_lookPos));
|
||||
SetMomentumWR({0.f, 0.f, -GetGravityConstant() * GetMass()});
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(
|
||||
(mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized());
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
SetMomentumWR({});
|
||||
|
|
|
@ -1497,7 +1497,7 @@ void CSpacePirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
}
|
||||
if (r28)
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
}
|
||||
x828_patrolDestPos = x2e0_destPos;
|
||||
break;
|
||||
|
@ -1553,7 +1553,7 @@ void CSpacePirate::Generate(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
TryCommand(mgr, pas::EAnimationState::Jump, &CPatterned::TryJump, x634_25_ceilingAmbush ? 2 : 0);
|
||||
if (x32c_animState == EAnimState::Repeat)
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
|
@ -1609,7 +1609,7 @@ void CSpacePirate::Attack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
if (x636_26_enableMeleeAttack) {
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 1);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
CheckBlade(mgr);
|
||||
if (x635_27_shadowPirate) {
|
||||
if (x32c_animState == EAnimState::Over) {
|
||||
|
@ -1668,7 +1668,7 @@ void CSpacePirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (!x639_25_useJumpBackJump) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
} else {
|
||||
TryCommand(mgr, pas::EAnimationState::Jump, &CPatterned::TryJump, 0);
|
||||
}
|
||||
|
@ -1713,7 +1713,7 @@ void CSpacePirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
if (x639_30_closeMelee)
|
||||
x648_targetDelta = GetTargetPos(mgr) - GetTranslation();
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
if (x635_27_shadowPirate) {
|
||||
if (x32c_animState == EAnimState::Over) {
|
||||
x3e8_alphaDelta = -0.4f;
|
||||
|
@ -1829,7 +1829,7 @@ void CSpacePirate::Crouch(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x79c_coverDir = pas::ECoverDirection::Invalid;
|
||||
break;
|
||||
case EStateMsg::Update:
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
UpdateCantSeePlayer(mgr);
|
||||
break;
|
||||
default:
|
||||
|
@ -2089,7 +2089,7 @@ void CSpacePirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::Cover, &CPatterned::TryCover, int(x79c_coverDir));
|
||||
if (CScriptCoverPoint* cp = GetCoverPoint(mgr, x640_coverPoint))
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(-cp->GetTransform().basis[1]);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(-cp->GetTransform().basis[1]);
|
||||
UpdateCantSeePlayer(mgr);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
|
@ -2134,7 +2134,7 @@ void CSpacePirate::WallHang(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
break;
|
||||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::WallHang, &CSpacePirate::TryWallHang, 0);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x7c4_burstFire.SetBurstType(1);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
|
@ -2173,7 +2173,7 @@ void CSpacePirate::SpecialAttack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, int(pas::ESeverity::One));
|
||||
if (x32c_animState == EAnimState::Ready)
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
|
|
Loading…
Reference in New Issue