Various Ridley fixes

This commit is contained in:
Phillip Stephens 2020-05-13 06:20:40 -07:00
parent e9ea73ec98
commit a432a79cd4
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
8 changed files with 202 additions and 167 deletions

View File

@ -228,7 +228,7 @@ void CBurrower::Active(CStateManager& mgr, EStateMsg msg, float dt) {
x6ac_24_doFacePlayer = true; x6ac_24_doFacePlayer = true;
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 0);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x6ac_24_doFacePlayer = false; x6ac_24_doFacePlayer = false;
x6ac_25_inAir = true; x6ac_25_inAir = true;
@ -267,7 +267,7 @@ void CBurrower::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 1); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
if (x678_trailParticle) { if (x678_trailParticle) {

View File

@ -405,7 +405,7 @@ void CChozoGhost::Deactivate(CStateManager& mgr, EStateMsg msg, float) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
x665_24_ = true; x665_24_ = true;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 1); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
if (x32c_animState == EAnimState::Repeat) if (x32c_animState == EAnimState::Repeat)
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed); GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {

View File

@ -350,7 +350,7 @@ void CMagdolite::Generate(CStateManager& mgr, EStateMsg msg, float arg) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
x754_24_retreat = false; x754_24_retreat = false;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 0); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0);
if (x32c_animState == EAnimState::Repeat) { if (x32c_animState == EAnimState::Repeat) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed); GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed);
} }
@ -552,7 +552,7 @@ void CMagdolite::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState)); GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState));
x754_28_alert = true; x754_28_alert = true;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 1); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
if (x32c_animState == EAnimState::Repeat) { if (x32c_animState == EAnimState::Repeat) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal7); GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal7);
} }

View File

@ -132,30 +132,11 @@ constexpr std::array skWingBones{
}; };
constexpr std::array skWingEffects{ constexpr std::array skWingEffects{
"WingSmokeSmall1"sv, "WingSmokeSmall1"sv, "WingSmokeSmall2"sv, "WingSmokeSmall3"sv, "WingSmokeSmall4"sv, "WingSmokeSmall5"sv,
"WingSmokeSmall2"sv, "WingSmokeSmall6"sv, "WingSmokeSmall7"sv, "WingSmokeSmall8"sv, "WingFire1"sv, "WingFire2"sv,
"WingSmokeSmall3"sv, "WingFire3"sv, "WingFire4"sv, "WingFire5"sv, "WingFire6"sv, "WingFire7"sv,
"WingSmokeSmall4"sv, "WingFire8"sv, "WingSparks1"sv, "WingSparks2"sv, "WingSparks3"sv, "WingSparks4"sv,
"WingSmokeSmall5"sv, "WingSparks5"sv, "WingSparks6"sv, "WingSparks7"sv, "WingSparks8"sv,
"WingSmokeSmall6"sv,
"WingSmokeSmall7"sv,
"WingSmokeSmall8"sv,
"WingFire1"sv,
"WingFire2"sv,
"WingFire3"sv,
"WingFire4"sv,
"WingFire5"sv,
"WingFire6"sv,
"WingFire7"sv,
"WingFire8"sv,
"WingSparks1"sv,
"WingSparks2"sv,
"WingSparks3"sv,
"WingSparks4"sv,
"WingSparks5"sv,
"WingSparks6"sv,
"WingSparks7"sv,
"WingSparks8"sv,
}; };
constexpr std::array<SOBBRadiiJointInfo, 4> skTail{{ constexpr std::array<SOBBRadiiJointInfo, 4> skTail{{
@ -292,8 +273,9 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info,
xc14_.Token().Lock(); xc14_.Token().Lock();
xc3c_.Token().Lock(); xc3c_.Token().Lock();
if (xce0_) if (xce0_) {
xce0_->SetParticleEmission(false); xce0_->SetParticleEmission(false);
}
const auto& animData = GetModelData()->GetAnimationData(); const auto& animData = GetModelData()->GetAnimationData();
for (const auto& wingBone : skWingBones) { for (const auto& wingBone : skWingBones) {
@ -347,7 +329,6 @@ void CRidley::SetupCollisionActorManager(urde::CStateManager& mgr) {
include.Remove(EMaterialTypes::Platform); include.Remove(EMaterialTypes::Platform);
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude)); SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude));
AddMaterial(EMaterialTypes::ProjectilePassthrough); AddMaterial(EMaterialTypes::ProjectilePassthrough);
// mgr.SendScriptMsg(this, GetUniqueId(), EScriptObjectMessage::Reset);
} }
void CRidley::SetupCollisionActors(CStateManager& mgr) { void CRidley::SetupCollisionActors(CStateManager& mgr) {
@ -419,8 +400,9 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
} }
case EScriptObjectMessage::InitializedInArea: { case EScriptObjectMessage::InitializedInArea: {
TUniqueId wpId = GetWaypointForState(mgr, EScriptObjectState::Patrol, EScriptObjectMessage::Follow); TUniqueId wpId = GetWaypointForState(mgr, EScriptObjectState::Patrol, EScriptObjectMessage::Follow);
if (wpId == kInvalidUniqueId) if (wpId == kInvalidUniqueId) {
break; break;
}
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(wpId)) { if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(wpId)) {
xa84_ = wp->GetTransform(); xa84_ = wp->GetTransform();
@ -444,14 +426,29 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
colAct->HealthInfo(mgr)->SetHP(1000.f); colAct->HealthInfo(mgr)->SetHP(1000.f);
bool dontKnockback = false; bool dontKnockback = false;
if (xc64_aiStage == 2) { if (xc64_aiStage == 2) {
if (xa33_28_) { if (!xa33_28_) {
dontKnockback = true;
} else {
bool r26 = false; bool r26 = false;
xb10_ -= lowHealth; xb10_ -= lowHealth;
xb24_ = 0.33f; xb24_ = 0.33f;
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f); x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
if (xb10_ <= 0.f) { if (xb10_ > 0.f) {
if (xb10_ >= xcbc_) {
if (xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) {
dontKnockback = true;
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero));
}
} else {
xa32_27_ = true;
dontKnockback = true;
xcb0_ += 1;
xcb0_ = xcb0_ < 5 ? xcb0_ : 4;
r26 = true;
xcbc_ = .2f * (5 - (xcb0_ + 1)) * xcb8_;
xcb4_ = 0;
xcc8_ = 2.f * 0.33f;
}
} else {
xc64_aiStage = 3; xc64_aiStage = 3;
xa31_25_ = false; xa31_25_ = false;
sub80257650(mgr); sub80257650(mgr);
@ -464,78 +461,67 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
xcc8_ = 2.f * 0.33f; xcc8_ = 2.f * 0.33f;
xb10_ = 0.f; xb10_ = 0.f;
} else {
if (xb10_ < xcbc_) {
xa32_27_ = true;
dontKnockback = true;
xcb0_ += 1;
xcb0_ = xcb0_ < 5 ? xcb0_ : 4;
r26 = true;
xcbc_ = .2f * (5 - (xcb0_ + 1)) * xcb8_;
xcb4_ = 0;
xcc8_ = 2.f * 0.33f;
} else if (xa33_26_ && !xa31_31_ && lowHealth > x568_data.x3f4_) {
dontKnockback = true;
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Zero));
}
} }
sub80256914(2.f * 0.33f, r26); sub80256914(2.f * 0.33f, r26);
} else {
dontKnockback = true;
} }
} else if (xc64_aiStage == 3) { } else if (xc64_aiStage == 3) {
if (xa32_29_) { if (xa32_29_) {
zeus::CTransform xf = GetLctrTransform(xb90_headSegId); zeus::CTransform xf = GetLctrTransform(xb90_headSegId);
if (xf.basis[1].dot(mgr.GetPlayer().GetTranslation() - xf.origin) < 0.5f) { if ((mgr.GetPlayer().GetTranslation() - xf.origin).dot(xf.frontVector()) < 0.5f) {
dontKnockback = true; HealthInfo(mgr)->SetHP(xb1c_ + xb10_ + xb18_);
} else { break;
TakeDamage(zeus::skForward, 1.f); }
xb20_ = 0.33f; }
if (xa32_29_) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) { TakeDamage(zeus::skForward, 1.f);
CWeaponMode wMode = proj->GetDamageInfo().GetWeaponMode(); xb20_ = 0.33f;
if (!wMode.IsCharged() && !wMode.IsComboed() && wMode.GetType() == EWeaponType::Missile) if (xa32_29_) {
xb14_ = 0.f; if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) {
xb14_ -= lowHealth; CWeaponMode wMode = proj->GetDamageInfo().GetWeaponMode();
xb24_ = 0.33f; if (!wMode.IsCharged() && !wMode.IsComboed() && wMode.GetType() == EWeaponType::Missile)
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f); xb14_ = 0.f;
if (xb10_ <= 0.f) { xb14_ -= lowHealth;
xa32_29_ = false; xb24_ = 0.33f;
dontKnockback = true; x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
xa32_28_shotAt = true; if (xb10_ <= 0.f) {
xb14_ = x568_data.x38_; xa32_29_ = false;
} dontKnockback = true;
} xa32_28_shotAt = true;
} else if (xa31_27_) { xb14_ = x568_data.x38_;
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
if (xb18_ > 0.f) {
xb18_ -= lowHealth;
if (xb18_ <= 0.f) {
xa31_26_ = true;
dontKnockback = true;
xb18_ = 0.f;
xcbc_ = 0.6667 * x568_data.x40_;
} else if (xb18_ < xcbc_) {
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
xcbc_ -= (0.333f * x568_data.x3c_);
}
}
} else {
xb1c_ -= lowHealth;
if (xb1c_ <= 0.f) {
x401_30_pendingDeath = true;
mgr.GetPlayer().SetIsOverrideRadarRadius(false);
xb1c_ = 0.f;
} else if (xb1c_ < xcbc_) {
dontKnockback = true;
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
xcbc_ -= (0.333f * x568_data.x40_);
}
} }
} }
} else if (xa31_27_) {
x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f);
if (xb18_ > 0.f) {
xb18_ -= lowHealth;
if (xb18_ <= 0.f) {
xa31_26_ = true;
dontKnockback = true;
xb18_ = 0.f;
xcbc_ = 0.6667f * x568_data.x40_;
} else if (xb18_ < xcbc_) {
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
xcbc_ -= (0.333f * x568_data.x3c_);
}
}
} else {
xb1c_ -= lowHealth;
if (xb1c_ <= 0.f) {
x401_30_pendingDeath = true;
mgr.GetPlayer().SetIsOverrideRadarRadius(false);
xb1c_ = 0.f;
} else if (xb1c_ < xcbc_) {
dontKnockback = true;
x450_bodyController->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Six));
xcbc_ -= (0.333f * x568_data.x40_);
}
} }
} }
HealthInfo(mgr)->SetHP(xb1c_ + xb10_ + xb18_); HealthInfo(mgr)->SetHP(xb1c_ + xb10_ + xb18_);
if (!dontKnockback) { if (!dontKnockback) {
@ -549,29 +535,27 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
} }
case EScriptObjectMessage::InvulnDamage: { case EScriptObjectMessage::InvulnDamage: {
/* This code never executes, should have a `TCastTo<CCollisionActor>` followed by `GetLastTouchedObject` */ /* This code never executes, should have a `TCastTo<CCollisionActor>` followed by `GetLastTouchedObject` */
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(uid)) { if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(uid)) {
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(colAct->GetLastTouchedObject())) { TUniqueId tmpId = kInvalidUniqueId;
TUniqueId tmpId = kInvalidUniqueId; bool doDamage = false;
bool doDamage = false; if (xc64_aiStage == 3) {
if (xc64_aiStage == 3) { if (!xa32_29_ && xa31_27_) {
if (!xa32_29_ && xa31_27_) {
tmpId = x98a_breastPlateId;
doDamage = true;
} else {
tmpId = x988_headId;
doDamage = true;
}
} else if (xc64_aiStage == 2 && !xa31_31_) {
tmpId = x98a_breastPlateId; tmpId = x98a_breastPlateId;
doDamage = true; doDamage = true;
} else {
tmpId = x988_headId;
doDamage = true;
} }
} else if (xc64_aiStage == 2 && !xa31_31_) {
tmpId = x98a_breastPlateId;
doDamage = true;
}
if (doDamage) { if (doDamage) {
CDamageInfo info = proj->GetDamageInfo(); CDamageInfo info = proj->GetDamageInfo();
info.SetRadius(0.f); info.SetRadius(0.f);
mgr.ApplyDamage(uid, tmpId, proj->GetOwnerId(), info, mgr.ApplyDamage(uid, tmpId, proj->GetOwnerId(), info,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {}); CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
}
} }
} }
break; break;
@ -597,7 +581,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan
default: default:
break; break;
} }
} } // namespace urde::MP1
void CRidley::Think(float dt, CStateManager& mgr) { void CRidley::Think(float dt, CStateManager& mgr) {
if (!GetActive()) if (!GetActive())
@ -615,6 +599,7 @@ void CRidley::Think(float dt, CStateManager& mgr) {
sub80256624(dt, mgr); sub80256624(dt, mgr);
xb2c_.Update(dt); xb2c_.Update(dt);
} }
void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
CPatterned::PreRender(mgr, frustum); CPatterned::PreRender(mgr, frustum);
xb2c_.PreRender(mgr, *GetModelData()->GetAnimationData(), x34_transform, GetModelData()->GetScale(), xb2c_.PreRender(mgr, *GetModelData()->GetAnimationData(), x34_transform, GetModelData()->GetScale(),
@ -656,7 +641,7 @@ void CRidley::Render(CStateManager& mgr) {
if (xb24_ > 0.f) { if (xb24_ > 0.f) {
multiplyColor = zeus::CColor::lerp(zeus::skWhite, x430_damageColor, xb24_ / 0.33f); multiplyColor = zeus::CColor::lerp(zeus::skWhite, x430_damageColor, xb24_ / 0.33f);
} }
g_Renderer->SetWorldLightMultiplyColor(multiplyColor); g_Renderer->SetGXRegister1Color(multiplyColor);
const zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId); const zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId);
@ -685,6 +670,7 @@ void CRidley::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) {
g_Renderer->AddParticleGen(*xce0_); g_Renderer->AddParticleGen(*xce0_);
} }
} }
void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) { void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
switch (type) { switch (type) {
case EUserEventType::Projectile: { case EUserEventType::Projectile: {
@ -717,7 +703,7 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
break; break;
} }
if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 6)) if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 8))
break; break;
zeus::CVector3f vec = zeus::CVector3f vec =
@ -783,7 +769,7 @@ void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
} }
xbfc_ = xbf0_; xbfc_ = xbf0_;
xbe4_ = xa84_.origin - xabc_ * xbf0_; xbe4_ = xa84_.origin - xabc_ * xbf0_;
xbe4_ *= zeus::CVector3f((mgr.GetPlayer().GetTranslation() - xa84_.origin).dot(xa84_.basis[1])); xbe4_ += (mgr.GetPlayer().GetTranslation() - xa84_.origin).dot(xa84_.frontVector()) * xa84_.frontVector();
break; break;
} }
case EUserEventType::EndAction: { case EUserEventType::EndAction: {
@ -1018,28 +1004,26 @@ void CRidley::Patrol(CStateManager& mgr, EStateMsg msg, float arg) {
xa32_27_ = false; xa32_27_ = false;
xa33_26_ = true; xa33_26_ = true;
} }
void CRidley::Dead(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Dead(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg != EStateMsg::Activate) if (msg != EStateMsg::Activate)
return; return;
mgr.SetBossParams(kInvalidUniqueId, 0.f, 0); mgr.SetBossParams(kInvalidUniqueId, 0.f, 0);
} }
void CRidley::Generate(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Generate(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg != EStateMsg::Activate) if (msg != EStateMsg::Activate)
return; return;
xa34_26_ = false; xa34_26_ = false;
zeus::CVector3f vec; SetTranslation(xa84_ * zeus::CVector3f{0.f, xabc_, xac0_ - xadc_});
vec.x() = 0.f;
vec.y() = xabc_;
vec.z() = xac0_ - xadc_;
SetTranslation(xa84_ * vec);
x450_bodyController->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState)); x450_bodyController->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState));
} }
void CRidley::Attack(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
xbe4_ = (GetTranslation() + zeus::skUp) - (8.f * GetTransform().basis[0]); xbe4_ = (GetTranslation() + zeus::skUp) - (8.f * GetTransform().rightVector());
xbfc_ = xbf0_ = GetTransform().basis[0]; xbfc_ = xbf0_ = GetTransform().rightVector();
xc08_ = xc0c_ = 0.f; xc08_ = xc0c_ = 0.f;
xc10_ = 240.f; xc10_ = 240.f;
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
@ -1115,7 +1099,7 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
xbe4_ += (90.f * arg) * xbf0_; xbe4_ += (90.f * arg) * xbf0_;
} }
if (xa32_24_ && xcac_ != 0) { if (xa32_24_ && xcac_) {
CSfxManager::UpdateEmitter(xca8_, GetTranslation(), {}, 127); CSfxManager::UpdateEmitter(xca8_, GetTranslation(), {}, 127);
} }
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step) if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
@ -1125,17 +1109,21 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
zeus::CVector3f local_54 = xbc4_ - GetTranslation(); zeus::CVector3f local_54 = xbc4_ - GetTranslation();
float mag = local_54.magnitude(); float mag = local_54.magnitude();
if (mag <= 2.f || local_54.dot(xbc4_ - x2ec_reflectedDestPos) <= 0.f) { if (mag <= 2.f || local_54.dot(xbc4_ - x2ec_reflectedDestPos) <= 0.f) {
pas::EStepDirection dir = pas::EStepDirection::Right; auto dir = pas::EStepDirection::Right;
if (xa32_31_) if (xa32_31_) {
dir = pas::EStepDirection::Left; dir = pas::EStepDirection::Left;
if (xcc0_ == 3) }
dir = pas::EStepDirection::Up;
else if (xcc0_ == 2)
dir = pas::EStepDirection::Forward;
pas::EStepType type = pas::EStepType::Normal; if (xcc0_ == 3) {
if (xa33_24_) dir = pas::EStepDirection::Up;
} else if (xcc0_ == 2) {
dir = pas::EStepDirection::Forward;
}
auto type = pas::EStepType::Normal;
if (xa33_24_) {
type = pas::EStepType::BreakDodge; type = pas::EStepType::BreakDodge;
}
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(dir, type)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(dir, type));
xa31_30_ = true; xa31_30_ = true;
} else { } else {
@ -1150,7 +1138,7 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) {
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed); x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
if (xa32_25_) { if (xa32_25_) {
ResetPlasmaProjectile(mgr, 1); ResetPlasmaProjectile(mgr, true);
} }
if (xa32_24_) { if (xa32_24_) {
@ -1209,7 +1197,7 @@ void CRidley::JumpBack(CStateManager& mgr, EStateMsg msg, float arg) {
xc78_ = 0.f; xc78_ = 0.f;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 4); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 4);
if (x32c_animState == EAnimState::Repeat) { if (x32c_animState == EAnimState::Repeat) {
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed); x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
@ -1245,9 +1233,11 @@ void CRidley::DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) {
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
x402_28_isMakingBigStrike = false; x402_28_isMakingBigStrike = false;
x504_damageDur = 0.f;
xc8c_ = GetContactDamage(); xc8c_ = GetContactDamage();
} }
} }
void CRidley::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
@ -1280,6 +1270,7 @@ void CRidley::Crouch(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(zeus::skZero3f, faceDir, 1.f)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(zeus::skZero3f, faceDir, 1.f));
} }
} }
void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
@ -1291,12 +1282,13 @@ void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) {
xb68_.SetDamage(x568_data.x3fc_); xb68_.SetDamage(x568_data.x3fc_);
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 5); TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack_Front, 5);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
xcbc_ = 0.6667f * x568_data.x3c_; xcbc_ = 0.6667f * x568_data.x3c_;
} }
} }
void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
@ -1307,6 +1299,7 @@ void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
} }
} }
void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
zeus::CVector3f destPos = zeus::CVector3f destPos =
@ -1318,6 +1311,7 @@ void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) {
x450_bodyController->FaceDirection((x2e0_destPos - GetTranslation()).normalized(), arg); x450_bodyController->FaceDirection((x2e0_destPos - GetTranslation()).normalized(), arg);
} }
} }
void CRidley::Lurk(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) { void CRidley::Lurk(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
if (!xa33_25_) { if (!xa33_25_) {
@ -1350,6 +1344,7 @@ void CRidley::Lurk(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) {
FacePlayer(10.f * arg, mgr); FacePlayer(10.f * arg, mgr);
} }
} }
void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
@ -1364,24 +1359,26 @@ void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
xa33_31_ = false; xa33_31_ = false;
} }
} }
void CRidley::Flinch(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Flinch(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
sub80257744(mgr); sub80257744(mgr);
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 3); TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack_Front, 3);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
sub80257650(mgr); sub80257650(mgr);
xa32_28_shotAt = false; xa32_28_shotAt = false;
} }
} }
void CRidley::Hurled(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Hurled(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg != EStateMsg::Activate) if (msg != EStateMsg::Activate)
return; return;
sub80257650(mgr); sub80257650(mgr);
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Four)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Four));
} }
void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) {
@ -1399,17 +1396,20 @@ void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) {
xa32_25_ = false; xa32_25_ = false;
} }
} }
void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
xc88_ = (mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() <= xae4_ ? 4 : 5; xc88_ = (mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() <= xae4_ ? 4 : 5;
x402_28_isMakingBigStrike = x568_data.x3ac_ > 0.f; x402_28_isMakingBigStrike = x568_data.x3ac_ > 0.f;
x504_damageDur = x568_data.x3ac_;
xc8c_ = x568_data.x390_; xc8c_ = x568_data.x390_;
sub80256580(); sub80256580();
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, xc88_); TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, xc88_);
if (x330_stateMachineState.GetTime() < 1.75f) if (x330_stateMachineState.GetTime() < 1.75f) {
FacePlayer(arg, mgr); FacePlayer(arg, mgr);
}
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr); AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
x402_28_isMakingBigStrike = false; x402_28_isMakingBigStrike = false;
@ -1419,24 +1419,27 @@ void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) {
xa34_25_ = false; xa34_25_ = false;
} }
} }
void CRidley::Explode(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Explode(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
xa32_27_ = false; xa32_27_ = false;
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 2); TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack_Front, 2);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
} }
} }
void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
const zeus::CVector3f vec = zeus::CVector3f{GetTranslation().toVec2f() - xa84_.origin.toVec2f()}.normalized();
float dist = zeus::clamp(0.f, 2.f * vec.dot(xa84_.rightVector()) + 1.f, 1.f);
xc84_ = 2; xc84_ = 2;
float dist = zeus::clamp( if (dist < mgr.GetActiveRandom()->Float()) {
0.f, zeus::CVector3f(GetTranslation().toVec2f() - xa84_.origin.toVec2f()).normalized().dot(xa84_.basis[0]),
1.f);
if (dist < mgr.GetActiveRandom()->Float())
xc84_ = 3; xc84_ = 3;
}
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, xc84_); TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, xc84_);
@ -1445,31 +1448,34 @@ void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) {
zeus::CVector3f someVec(((xa84_.origin.x() + xabc_) * vec.x()) - GetTranslation().x(), zeus::CVector3f someVec(((xa84_.origin.x() + xabc_) * vec.x()) - GetTranslation().x(),
((xa84_.origin.y() + xabc_) * vec.y()) - GetTranslation().y(), ((xa84_.origin.y() + xabc_) * vec.y()) - GetTranslation().y(),
((xa84_.origin.z() + xac0_) - GetTranslation().z())); ((xa84_.origin.z() + xac0_) - GetTranslation().z()));
if (someVec.magnitude() > 1.f) if (someVec.magnitude() > 1.f) {
someVec.normalize(); someVec.normalize();
}
sub80255fe8(10.f, arg, someVec); sub80255fe8(10.f, arg, someVec);
} else {
x450_bodyController->FaceDirection((xa84_.origin - GetTranslation()).normalized(), arg);
} }
x450_bodyController->FaceDirection((xa84_.origin - GetTranslation()).normalized(), arg);
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
} }
} }
void CRidley::Retreat(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, 5); TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, 5); // Down
} else { } else {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
} }
} }
void CRidley::Approach(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Approach(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
zeus::CVector3f direction = (GetTranslation() - xa84_.origin).normalized(); zeus::CVector3f direction = (GetTranslation() - xa84_.origin).normalized();
zeus::CVector3f destPos(xa84_.origin.x() + xab4_ * direction.x(), xa84_.origin.y() + xab4_ * direction.y(), zeus::CVector3f destPos = xa84_.origin.toVec2f() + xab4_ * direction.toVec2f();
(xae8_ + xa84_.origin.z()) - 1.f); destPos.z() = (xae8_ + xa84_.origin.z()) - 1.f;
SetDestPos(destPos); SetDestPos(destPos);
xa33_26_ = false; xa33_26_ = false;
if (xc64_aiStage == 3 && !xa34_24_) { if (xc64_aiStage == 3 && !xa34_24_) {
@ -1509,6 +1515,7 @@ void CRidley::SpecialAttack(CStateManager& mgr, EStateMsg msg, float arg) {
x32c_animState = EAnimState::NotReady; x32c_animState = EAnimState::NotReady;
} }
} }
void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) { void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
zeus::CVector3f diff = zeus::CVector3f(mgr.GetPlayer().GetTranslation().x() - xa84_.origin.x(), zeus::CVector3f diff = zeus::CVector3f(mgr.GetPlayer().GetTranslation().x() - xa84_.origin.x(),
@ -1528,7 +1535,7 @@ void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) {
x402_28_isMakingBigStrike = x568_data.x38c_ > 0.f; x402_28_isMakingBigStrike = x568_data.x38c_ > 0.f;
x504_damageDur = x568_data.x38c_; x504_damageDur = x568_data.x38c_;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 8); TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack_TargetPos, 8);
if (x32c_animState == EAnimState::Repeat) { if (x32c_animState == EAnimState::Repeat) {
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat); x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
@ -1549,6 +1556,7 @@ void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) {
} }
} }
bool CRidley::Attacked(CStateManager& mgr, float arg) { return xa31_24_ && xa31_26_; } bool CRidley::Attacked(CStateManager& mgr, float arg) { return xa31_24_ && xa31_26_; }
bool CRidley::TooClose(CStateManager& mgr, float arg) { bool CRidley::TooClose(CStateManager& mgr, float arg) {
if (xb0c_ == 4) if (xb0c_ == 4)
return true; return true;
@ -1564,24 +1572,32 @@ bool CRidley::TooClose(CStateManager& mgr, float arg) {
return false; return false;
} }
bool CRidley::InRange(CStateManager& mgr, float arg) {
float mag = (GetTranslation() - x2e0_destPos).magnitude(); bool CRidley::InRange(CStateManager& mgr, float arg) { return (GetTranslation() - x2e0_destPos).magnitude() < 2.f; }
return mag < 2.f;
}
bool CRidley::ShouldAttack(CStateManager& mgr, float arg) { bool CRidley::ShouldAttack(CStateManager& mgr, float arg) {
return (xc64_aiStage == 3 && xb0c_ == 2) || (xc64_aiStage == 2 && xb04_ == 0); return (xc64_aiStage == 3 && xb0c_ == 2) || (xc64_aiStage == 2 && xb04_ == 0);
} }
bool CRidley::ShouldDoubleSnap(CStateManager& mgr, float arg) { return xa33_30_; } bool CRidley::ShouldDoubleSnap(CStateManager& mgr, float arg) { return xa33_30_; }
bool CRidley::ShouldTurn(CStateManager& mgr, float arg) { return xb04_ == 5; } bool CRidley::ShouldTurn(CStateManager& mgr, float arg) { return xb04_ == 5; }
bool CRidley::HitSomething(CStateManager& mgr, float arg) { return xa32_27_ || xc64_aiStage == 3; } bool CRidley::HitSomething(CStateManager& mgr, float arg) { return xa32_27_ || xc64_aiStage == 3; }
bool CRidley::AttackOver(CStateManager& mgr, float arg) { return xcc4_ == 0; } bool CRidley::AttackOver(CStateManager& mgr, float arg) { return xcc4_ == 0; }
bool CRidley::ShouldTaunt(CStateManager& mgr, float arg) { bool CRidley::ShouldTaunt(CStateManager& mgr, float arg) {
return (xc64_aiStage == 3 && xb0c_ == 1) || (xc64_aiStage == 2 && xb04_ == 4); return (xc64_aiStage == 3 && xb0c_ == 1) || (xc64_aiStage == 2 && xb04_ == 4);
} }
bool CRidley::ShouldFire(CStateManager& mgr, float arg) { return xc64_aiStage == 2 && xb04_ == 2; } bool CRidley::ShouldFire(CStateManager& mgr, float arg) { return xc64_aiStage == 2 && xb04_ == 2; }
bool CRidley::ShouldDodge(CStateManager& mgr, float arg) { return xb04_ == 3; } bool CRidley::ShouldDodge(CStateManager& mgr, float arg) { return xb04_ == 3; }
bool CRidley::ShouldRetreat(CStateManager& mgr, float arg) { return xa34_26_; } bool CRidley::ShouldRetreat(CStateManager& mgr, float arg) { return xa34_26_; }
bool CRidley::ShouldCrouch(CStateManager& mgr, float arg) { return xb04_ == 1; } bool CRidley::ShouldCrouch(CStateManager& mgr, float arg) { return xb04_ == 1; }
bool CRidley::ShouldMove(urde::CStateManager& mgr, float arg) { bool CRidley::ShouldMove(urde::CStateManager& mgr, float arg) {
if (xb0c_ == 5) { if (xb0c_ == 5) {
xa34_25_ = true; xa34_25_ = true;
@ -1599,12 +1615,16 @@ bool CRidley::ShouldMove(urde::CStateManager& mgr, float arg) {
return false; return false;
} }
bool CRidley::ShotAt(CStateManager& mgr, float arg) { return xa32_28_shotAt; } bool CRidley::ShotAt(CStateManager& mgr, float arg) { return xa32_28_shotAt; }
bool CRidley::SetAIStage(CStateManager& mgr, float arg) { bool CRidley::SetAIStage(CStateManager& mgr, float arg) {
xc64_aiStage = arg; xc64_aiStage = arg;
return true; return true;
} }
bool CRidley::AIStage(CStateManager& mgr, float arg) { return xc64_aiStage >= arg; } bool CRidley::AIStage(CStateManager& mgr, float arg) { return xc64_aiStage >= arg; }
bool CRidley::ShouldStrafe(CStateManager& mgr, float arg) { return xa33_29_doStrafe; } bool CRidley::ShouldStrafe(CStateManager& mgr, float arg) { return xa33_29_doStrafe; }
bool CRidley::IsDizzy(CStateManager& mgr, float arg) { bool CRidley::IsDizzy(CStateManager& mgr, float arg) {
if (xb0c_ == 3) if (xb0c_ == 3)
return true; return true;
@ -1619,13 +1639,15 @@ bool CRidley::IsDizzy(CStateManager& mgr, float arg) {
return false; return false;
} }
void CRidley::sub80255fe8(float f1, float f2, const zeus::CVector3f& vec) { void CRidley::sub80255fe8(float f1, float f2, const zeus::CVector3f& vec) {
xaf8_ = (0.2f * (f1 * f1)) * vec; xaf8_ = (f1 * (0.2f * f1)) * vec;
xaec_ += f2 * xaf8_; xaec_ += f2 * xaf8_;
if (xaec_.magnitude() > f1) { if (xaec_.magnitude() > f1) {
xaec_ = f1 * xaec_.normalized(); xaec_ = f1 * xaec_.normalized();
} }
} }
void CRidley::sub80255e5c(CStateManager& mgr) { void CRidley::sub80255e5c(CStateManager& mgr) {
zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation(); zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation();
if (posDiff.magnitude() < 8.f) { if (posDiff.magnitude() < 8.f) {
@ -1634,6 +1656,7 @@ void CRidley::sub80255e5c(CStateManager& mgr) {
mgr.GetPlayer().ApplyImpulseWR(impulse, {}); mgr.GetPlayer().ApplyImpulseWR(impulse, {});
} }
} }
void CRidley::FacePlayer(float arg, CStateManager& mgr) { void CRidley::FacePlayer(float arg, CStateManager& mgr) {
x450_bodyController->FaceDirection((mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized(), arg); x450_bodyController->FaceDirection((mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized(), arg);
} }

View File

@ -105,11 +105,11 @@ class CRidley : public CPatterned {
float xab4_ = 20.f; float xab4_ = 20.f;
float xab8_ = 12.f; float xab8_ = 12.f;
float xabc_ = 40.f; float xabc_ = 40.f;
float xac0_ = 10; float xac0_ = 10.f;
zeus::CAABox xac4_ = zeus::skInvertedBox; zeus::CAABox xac4_ = zeus::skInvertedBox;
float xadc_; float xadc_;
float xae0_; float xae0_;
u32 xae4_; float xae4_;
float xae8_; float xae8_;
zeus::CVector3f xaec_; zeus::CVector3f xaec_;
zeus::CVector3f xaf8_; zeus::CVector3f xaf8_;
@ -195,7 +195,8 @@ class CRidley : public CPatterned {
void sub80253710(CStateManager& mgr); void sub80253710(CStateManager& mgr);
bool sub80253960() { bool sub80253960() {
return (GetTranslation() + (1.75f * GetTransform().basis[1]) - xa84_.origin).magnitude() < 1.75f * (xab4_ + xabc_); const float mag = ((GetTranslation() + ((0.5f * xae4_) * GetTransform().frontVector())) - xa84_.origin).magnitude();
return mag < 0.5f * (xab4_ + xabc_);
} }
public: public:

View File

@ -196,7 +196,7 @@ void CSeedling::Generate(CStateManager& mgr, EStateMsg msg, float) {
if (msg == EStateMsg::Activate) if (msg == EStateMsg::Activate)
x32c_animState = EAnimState::Ready; x32c_animState = EAnimState::Ready;
else if (msg == EStateMsg::Update) else if (msg == EStateMsg::Update)
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 0); TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0);
} }
bool CSeedling::ShouldAttack(CStateManager& mgr, float) { bool CSeedling::ShouldAttack(CStateManager& mgr, float) {

View File

@ -881,15 +881,20 @@ void CPatterned::TryLoopReaction(CStateManager& mgr, int arg) {
void CPatterned::TryProjectileAttack(CStateManager&, int arg) { void CPatterned::TryProjectileAttack(CStateManager&, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCProjectileAttackCmd(pas::ESeverity(arg), x2e0_destPos, false)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCProjectileAttackCmd(pas::ESeverity(arg), x2e0_destPos, false));
} }
void CPatterned::TryMeleeAttack_TargetPos(CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity(arg), x2e0_destPos));
}
void CPatterned::TryMeleeAttack(CStateManager& mgr, int arg) { void CPatterned::TryMeleeAttack(CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity(arg))); x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(pas::ESeverity(arg)));
} }
void CPatterned::TryGenerate(CStateManager& mgr, int arg) { void CPatterned::TryGenerateNoXf(CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), x2e0_destPos, false)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), x2e0_destPos, false));
} }
void CPatterned::TryGenerateNoXf(CStateManager& mgr, int arg) { void CPatterned::TryGenerate(CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::Zero, x2e0_destPos, true)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::Zero, x2e0_destPos, true));
} }
@ -941,6 +946,10 @@ void CPatterned::TryKnockBack(CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTranslation(), pas::ESeverity(arg))); x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTranslation(), pas::ESeverity(arg)));
} }
void CPatterned::TryKnockBack_Front(CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity(arg)));
}
void CPatterned::TryGenerateDeactivate(urde::CStateManager& mgr, int arg) { void CPatterned::TryGenerateDeactivate(urde::CStateManager& mgr, int arg) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), zeus::skZero3f)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType(arg), zeus::skZero3f));
} }

View File

@ -320,9 +320,10 @@ public:
void TryCommand(CStateManager& mgr, pas::EAnimationState state, CPatternedTryFunc func, int arg); void TryCommand(CStateManager& mgr, pas::EAnimationState state, CPatternedTryFunc func, int arg);
void TryLoopReaction(CStateManager& mgr, int arg); void TryLoopReaction(CStateManager& mgr, int arg);
void TryProjectileAttack(CStateManager& mgr, int arg); void TryProjectileAttack(CStateManager& mgr, int arg);
void TryMeleeAttack_TargetPos(CStateManager& mgr, int arg);
void TryMeleeAttack(CStateManager& mgr, int arg); void TryMeleeAttack(CStateManager& mgr, int arg);
void TryGenerate(CStateManager& mgr, int arg);
void TryGenerateNoXf(CStateManager& mgr, int arg); void TryGenerateNoXf(CStateManager& mgr, int arg);
void TryGenerate(CStateManager& mgr, int arg);
void TryJump(CStateManager& mgr, int arg); void TryJump(CStateManager& mgr, int arg);
void TryTurn(CStateManager& mgr, int arg); void TryTurn(CStateManager& mgr, int arg);
void TryGetUp(CStateManager& mgr, int arg); void TryGetUp(CStateManager& mgr, int arg);
@ -334,6 +335,7 @@ public:
void TryCover(CStateManager& mgr, int arg); void TryCover(CStateManager& mgr, int arg);
void TryWallHang(CStateManager& mgr, int arg); void TryWallHang(CStateManager& mgr, int arg);
void TryKnockBack(CStateManager& mgr, int arg); void TryKnockBack(CStateManager& mgr, int arg);
void TryKnockBack_Front(CStateManager& mgr, int arg);
void TryGenerateDeactivate(CStateManager& mgr, int arg); void TryGenerateDeactivate(CStateManager& mgr, int arg);
void TryStep(CStateManager& mgr, int arg); void TryStep(CStateManager& mgr, int arg);