mirror of https://github.com/AxioDL/metaforce.git
Various fixes and minor code cleanup, issue warning when attempting to load an unimplemented object
This commit is contained in:
parent
7d29c6e25a
commit
0bb51f067c
|
@ -82,10 +82,14 @@ void ViewManager::TestGameView::think() {
|
|||
overlayText += hecl::Format(
|
||||
"Player Position: x %f, y %f, z %f\n"
|
||||
" Roll: %f, Pitch: %f, Yaw: %f\n"
|
||||
" Momentum: x %f, y: %f, z: %f\n"
|
||||
" Velocity: x %f, y: %f, z: %f\n"
|
||||
"Camera Position: x %f, y %f, z %f\n"
|
||||
" Roll: %f, Pitch: %f, Yaw: %f\n",
|
||||
pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(),
|
||||
zeus::radToDeg(plQ.roll()), zeus::radToDeg(plQ.pitch()), zeus::radToDeg(plQ.yaw()),
|
||||
pl.GetMomentum().x(), pl.GetMomentum().y(), pl.GetMomentum().z(),
|
||||
pl.GetVelocity().x(), pl.GetVelocity().y(), pl.GetVelocity().z(),
|
||||
camXf.origin.x(), camXf.origin.y(), camXf.origin.z(),
|
||||
zeus::radToDeg(camQ.roll()), zeus::radToDeg(camQ.pitch()), zeus::radToDeg(camQ.yaw()));
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
|||
x90c_loaderFuncs[int(EScriptObjectType::AIKeyframe)] = ScriptLoader::LoadAIKeyframe;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::PointOfInterest)] = ScriptLoader::LoadPointOfInterest;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::Drone)] = ScriptLoader::LoadDrone;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::MetroidAlpha)] = ScriptLoader::LoadMetroidAlpha;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::Metroid)] = ScriptLoader::LoadMetroid;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::DebrisExtended)] = ScriptLoader::LoadDebrisExtended;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::Steam)] = ScriptLoader::LoadSteam;
|
||||
x90c_loaderFuncs[int(EScriptObjectType::Ripple)] = ScriptLoader::LoadRipple;
|
||||
|
|
|
@ -7,17 +7,13 @@
|
|||
|
||||
#include "CStateManager.hpp"
|
||||
namespace urde::MP1 {
|
||||
const std::string_view CAtomicAlpha::skBombLocators[4] = {
|
||||
"bomb1_LCTR"sv,
|
||||
"bomb2_LCTR"sv,
|
||||
"bomb3_LCTR"sv,
|
||||
"bomb4_LCTR"sv
|
||||
};
|
||||
const std::string_view CAtomicAlpha::skBombLocators[4] = {"bomb1_LCTR"sv, "bomb2_LCTR"sv, "bomb3_LCTR"sv,
|
||||
"bomb4_LCTR"sv};
|
||||
|
||||
CAtomicAlpha::CAtomicAlpha(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo,
|
||||
CAssetId bombWeapon, const CDamageInfo& bombDamage, float bombDropDelay, float f2, float f3, CAssetId cmdl,
|
||||
bool invisible, bool b2)
|
||||
CAssetId bombWeapon, const CDamageInfo& bombDamage, float bombDropDelay, float f2, float f3,
|
||||
CAssetId cmdl, bool invisible, bool b2)
|
||||
: CPatterned(ECharacter::AtomicAlpha, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::Flyer, EColliderType::One, EBodyType::Flyer, actParms, EKnockBackVariant::Medium)
|
||||
, x568_24_inRange(false)
|
||||
|
@ -32,7 +28,7 @@ CAtomicAlpha::CAtomicAlpha(TUniqueId uid, std::string_view name, const CEntityIn
|
|||
const_cast<TToken<CWeaponDescription>*>(&x668_bombProjectile.Token())->Lock();
|
||||
for (u32 i = 0; i < skBombCount; ++i) {
|
||||
x6dc_bombLocators.push_back(
|
||||
SBomb(skBombLocators[i], pas::ELocomotionType(u32(pas::ELocomotionType::Internal10) + i)));
|
||||
SBomb(skBombLocators[i], pas::ELocomotionType(u32(pas::ELocomotionType::Internal10) + i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,8 +50,10 @@ void CAtomicAlpha::Render(const CStateManager& mgr) const {
|
|||
|
||||
CPatterned::Render(mgr);
|
||||
for (const SBomb& bomb : x6dc_bombLocators) {
|
||||
zeus::CTransform locatorXf = GetTransform() * GetScaledLocatorTransform(bomb.x0_locatorName) *
|
||||
zeus::CTransform::Scale(std::min(1.f, std::max(0.f, bomb.x14_scaleTime - x570_bombReappearDelay) / x570_bombReappearDelay));
|
||||
zeus::CTransform locatorXf =
|
||||
GetTransform() * GetScaledLocatorTransform(bomb.x0_locatorName) *
|
||||
zeus::CTransform::Scale(
|
||||
std::min(1.f, std::max(0.f, bomb.x14_scaleTime - x570_bombReappearDelay) / x570_bombReappearDelay));
|
||||
CModelFlags flags;
|
||||
flags.x2_flags = 1 | 2;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
|
|
|
@ -13,8 +13,7 @@ class CAtomicAlpha : public CPatterned {
|
|||
pas::ELocomotionType x10_locomotionType;
|
||||
float x14_scaleTime = FLT_MAX;
|
||||
SBomb(const std::string_view locator, pas::ELocomotionType locomotionType)
|
||||
: x0_locatorName(locator.data())
|
||||
, x10_locomotionType(locomotionType) {}
|
||||
: x0_locatorName(locator.data()), x10_locomotionType(locomotionType) {}
|
||||
};
|
||||
bool x568_24_inRange : 1;
|
||||
bool x568_25_invisible : 1;
|
||||
|
@ -29,6 +28,7 @@ class CAtomicAlpha : public CPatterned {
|
|||
CProjectileInfo x668_bombProjectile;
|
||||
CModelData x690_bombModel;
|
||||
rstl::reserved_vector<SBomb, skBombCount> x6dc_bombLocators;
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(AtomicAlpha)
|
||||
|
||||
|
|
|
@ -8,17 +8,13 @@
|
|||
#include "CSimplePool.hpp"
|
||||
|
||||
namespace urde::MP1 {
|
||||
const std::string_view CAtomicBeta::skBombLocators[3] = {
|
||||
"bomb2_LCTR"sv,
|
||||
"bomb3_LCTR"sv,
|
||||
"bomb4_LCTR"sv
|
||||
};
|
||||
const std::string_view CAtomicBeta::skBombLocators[3] = {"bomb2_LCTR"sv, "bomb3_LCTR"sv, "bomb4_LCTR"sv};
|
||||
|
||||
CAtomicBeta::CAtomicBeta(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo,
|
||||
CAssetId electricId, CAssetId weaponId, const CDamageInfo& dInfo, CAssetId particleId,
|
||||
float f1, float beamRadius, float f3, const CDamageVulnerability& dVuln, float f4, float f5, float f6,
|
||||
s16 sId1, s16 sId2, s16 sId3, float f7)
|
||||
float f1, float beamRadius, float f3, const CDamageVulnerability& dVuln, float f4, float f5,
|
||||
float f6, s16 sId1, s16 sId2, s16 sId3, float f7)
|
||||
: CPatterned(ECharacter::AtomicBeta, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::Flyer, EColliderType::One, EBodyType::RestrictedFlyer, actParms, EKnockBackVariant::Small)
|
||||
, x578_(f5)
|
||||
|
@ -115,7 +111,7 @@ void CAtomicBeta::Think(float dt, CStateManager& mgr) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(movementVec, x5f4_, 1.f));
|
||||
|
||||
float mag =
|
||||
x63c_ * std::max(1.f - (mgr.GetPlayer().GetTranslation() - GetTranslation()).magSquared() / (x640_ / x640_), 0.f);
|
||||
x63c_ * std::max(1.f - (mgr.GetPlayer().GetTranslation() - GetTranslation()).magSquared() / (x640_ / x640_), 0.f);
|
||||
if (!zeus::close_enough(mag, 0.f))
|
||||
mgr.GetPlayerState()->GetStaticInterference().AddSource(GetUniqueId(), mag, 0.5f);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class CWeaponDescription;
|
|||
namespace urde::MP1 {
|
||||
class CAtomicBeta final : public CPatterned {
|
||||
static const std::string_view skBombLocators[3];
|
||||
static constexpr u32 kBombCount = 3;
|
||||
static constexpr u32 kBombCount = 3;
|
||||
rstl::reserved_vector<TUniqueId, kBombCount> x568_projectileIds;
|
||||
bool x574_beamFired = false;
|
||||
float x578_;
|
||||
|
|
|
@ -33,8 +33,9 @@ CBeetle::CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
|||
, x814_attackDelayTimer(initialAttackDelay)
|
||||
, x834_retreatTime(retreatTime) {
|
||||
x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1)));
|
||||
x5a4_jumpBackwardDist = x64_modelData->GetScale().y() *
|
||||
GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0)));
|
||||
x5a4_jumpBackwardDist =
|
||||
x64_modelData->GetScale().y() *
|
||||
GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0)));
|
||||
MakeThermalColdAndHot();
|
||||
if (x3fc_flavor == EFlavorType::One)
|
||||
x460_knockBackController.SetLocomotionDuringElectrocution(true);
|
||||
|
@ -45,8 +46,8 @@ void CBeetle::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|||
void CBeetle::SquadAdd(CStateManager& mgr) {
|
||||
if (x570_aiMgr != kInvalidUniqueId)
|
||||
if (TCastToPtr<CTeamAiMgr> aimgr = mgr.ObjectById(x570_aiMgr))
|
||||
aimgr->AssignTeamAiRole(*this, CTeamAiRole::ETeamAiRole::Melee,
|
||||
CTeamAiRole::ETeamAiRole::Unknown, CTeamAiRole::ETeamAiRole::Invalid);
|
||||
aimgr->AssignTeamAiRole(*this, CTeamAiRole::ETeamAiRole::Melee, CTeamAiRole::ETeamAiRole::Unknown,
|
||||
CTeamAiRole::ETeamAiRole::Invalid);
|
||||
}
|
||||
|
||||
void CBeetle::SquadRemove(CStateManager& mgr) {
|
||||
|
@ -60,9 +61,9 @@ void CBeetle::Think(float dt, CStateManager& mgr) {
|
|||
if (!GetActive())
|
||||
return;
|
||||
if (CTeamAiRole* role = CTeamAiMgr::GetTeamAiRole(mgr, x570_aiMgr, GetUniqueId())) {
|
||||
x450_bodyController->SetLocomotionType(
|
||||
role->GetTeamAiRole() == CTeamAiRole::ETeamAiRole::Melee ?
|
||||
pas::ELocomotionType::Lurk : pas::ELocomotionType::Relaxed);
|
||||
x450_bodyController->SetLocomotionType(role->GetTeamAiRole() == CTeamAiRole::ETeamAiRole::Melee
|
||||
? pas::ELocomotionType::Lurk
|
||||
: pas::ELocomotionType::Relaxed);
|
||||
} else {
|
||||
SquadAdd(mgr);
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Lurk);
|
||||
|
@ -119,8 +120,7 @@ void CBeetle::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
|
|||
SquadAdd(mgr);
|
||||
}
|
||||
SetupRetreatPoints(mgr);
|
||||
x5fc_pathFindSearch.SetArea(
|
||||
mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
|
||||
x5fc_pathFindSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -174,8 +174,7 @@ const CDamageVulnerability* CBeetle::GetDamageVulnerability() const {
|
|||
return CAi::GetDamageVulnerability();
|
||||
}
|
||||
|
||||
const CDamageVulnerability* CBeetle::GetDamageVulnerability(const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir,
|
||||
const CDamageVulnerability* CBeetle::GetDamageVulnerability(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const CDamageInfo& dInfo) const {
|
||||
if (x838_25_burrowing)
|
||||
return &CDamageVulnerability::PassThroughVulnerabilty();
|
||||
|
@ -220,13 +219,12 @@ zeus::CVector3f CBeetle::GetAimPosition(const CStateManager& mgr, float dt) cons
|
|||
}
|
||||
}
|
||||
|
||||
EWeaponCollisionResponseTypes CBeetle::GetCollisionResponseType(const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir,
|
||||
EWeaponCollisionResponseTypes CBeetle::GetCollisionResponseType(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const CWeaponMode& wMode,
|
||||
EProjectileAttrib attribs) const {
|
||||
if (x450_bodyController->IsFrozen() && wMode.GetType() == EWeaponType::Ice)
|
||||
return EWeaponCollisionResponseTypes::None;
|
||||
if(x838_25_burrowing)
|
||||
if (x838_25_burrowing)
|
||||
return EWeaponCollisionResponseTypes::Unknown69;
|
||||
if (x3fc_flavor == EFlavorType::One) {
|
||||
if (GetTransform().basis[1].dot(dir) > 0.f &&
|
||||
|
@ -254,11 +252,11 @@ void CBeetle::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUs
|
|||
break;
|
||||
case EUserEventType::DamageOn: {
|
||||
zeus::CVector3f center =
|
||||
GetTransform() * (x64_modelData->GetScale() * GetLocatorTransform("LCTR_GARMOUTH"sv).origin);
|
||||
GetTransform() * (x64_modelData->GetScale() * GetLocatorTransform("LCTR_GARMOUTH"sv).origin);
|
||||
zeus::CVector3f extent = x64_modelData->GetScale() * zeus::CVector3f(2.f, 2.f, 0.5f);
|
||||
if (zeus::CAABox(center - extent, center + extent).intersects(mgr.GetPlayer().GetBoundingBox())) {
|
||||
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x584_touchDamage,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::CVector3f::skZero);
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::CVector3f::skZero);
|
||||
}
|
||||
handled = true;
|
||||
break;
|
||||
|
@ -297,13 +295,9 @@ void CBeetle::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScrip
|
|||
}
|
||||
}
|
||||
|
||||
void CBeetle::TakeDamage(const zeus::CVector3f& direction, float magnitude) {
|
||||
x428_damageCooldownTimer = 0.33f;
|
||||
}
|
||||
void CBeetle::TakeDamage(const zeus::CVector3f& direction, float magnitude) { x428_damageCooldownTimer = 0.33f; }
|
||||
|
||||
bool CBeetle::IsListening() const {
|
||||
return true;
|
||||
}
|
||||
bool CBeetle::IsListening() const { return true; }
|
||||
|
||||
zeus::CVector3f CBeetle::GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
||||
const zeus::CVector3f& aimPos) const {
|
||||
|
@ -326,14 +320,12 @@ void CBeetle::FollowPattern(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Step) {
|
||||
x568_stateProg = 3;
|
||||
} else if (IsOnGround()) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Left, pas::EStepType::Normal));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(pas::EStepDirection::Left, pas::EStepType::Normal));
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (x450_bodyController->GetCurrentStateId() != pas::EAnimationState::Step && IsOnGround()) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Right, pas::EStepType::Normal));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(pas::EStepDirection::Right, pas::EStepType::Normal));
|
||||
x568_stateProg = 2;
|
||||
}
|
||||
break;
|
||||
|
@ -344,8 +336,7 @@ void CBeetle::FollowPattern(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(
|
||||
mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -359,7 +350,7 @@ void CBeetle::RefinePathFindDest(CStateManager& mgr, zeus::CVector3f& dest) {
|
|||
} else {
|
||||
zeus::CVector3f thisToDest = dest - GetTranslation();
|
||||
dest += (thisToDest.canBeNormalized() ? thisToDest.normalized() : GetTransform().basis[1]) *
|
||||
(0.5f * (x2fc_minAttackRange + x300_maxAttackRange));
|
||||
(0.5f * (x2fc_minAttackRange + x300_maxAttackRange));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,8 +487,8 @@ void CBeetle::Deactivate(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
switch (x568_stateProg) {
|
||||
case 0:
|
||||
if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Generate) {
|
||||
RemoveMaterial(EMaterialTypes::Character, EMaterialTypes::Solid,
|
||||
EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
RemoveMaterial(EMaterialTypes::Character, EMaterialTypes::Solid, EMaterialTypes::Target, EMaterialTypes::Orbit,
|
||||
mgr);
|
||||
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||
x838_25_burrowing = true;
|
||||
x5a8_animTimeRem = x450_bodyController->GetAnimTimeRemaining();
|
||||
|
@ -506,7 +497,7 @@ void CBeetle::Deactivate(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::One));
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(
|
||||
x45c_steeringBehaviors.Seek(*this, mgr.GetPlayer().GetTranslation()), zeus::CVector3f::skZero, 1.f));
|
||||
x45c_steeringBehaviors.Seek(*this, mgr.GetPlayer().GetTranslation()), zeus::CVector3f::skZero, 1.f));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -603,7 +594,7 @@ void CBeetle::JumpBack(CStateManager&, EStateMsg msg, float dt) {
|
|||
x568_stateProg = 2;
|
||||
} else if (IsOnGround()) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -671,8 +662,8 @@ void CBeetle::Shuffle(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (GetTransform().basis[1].dot(move) >= 0.f || GetTransform().basis[1].dot(playerToThis) >= 0.f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::CVector3f::skZero, 1.f));
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move,
|
||||
playerToThis.canBeNormalized() ? -playerToThis.normalized() : GetTransform().basis[1], 1.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(
|
||||
move, playerToThis.canBeNormalized() ? -playerToThis.normalized() : GetTransform().basis[1], 1.f));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -707,8 +698,9 @@ void CBeetle::TurnAround(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x568_stateProg = 2;
|
||||
} else {
|
||||
zeus::CVector3f thisToPlayer = mgr.GetPlayer().GetTranslation() - GetTranslation();
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(zeus::CVector3f::skZero,
|
||||
(thisToPlayer.magnitude() > FLT_EPSILON) ? thisToPlayer.normalized() : zeus::CVector3f::skZero, 1.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(
|
||||
zeus::CVector3f::skZero,
|
||||
(thisToPlayer.magnitude() > FLT_EPSILON) ? thisToPlayer.normalized() : zeus::CVector3f::skZero, 1.f));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -748,7 +740,7 @@ void CBeetle::Taunt(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
switch (msg) {
|
||||
case EStateMsg::Activate:
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCTauntCmd(mgr.GetActiveRandom()->Float() < 0.75f ? pas::ETauntType::One : pas::ETauntType::Zero));
|
||||
CBCTauntCmd(mgr.GetActiveRandom()->Float() < 0.75f ? pas::ETauntType::One : pas::ETauntType::Zero));
|
||||
x568_stateProg = 2;
|
||||
break;
|
||||
case EStateMsg::Update:
|
||||
|
@ -795,10 +787,9 @@ void CBeetle::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
switch (x568_stateProg) {
|
||||
case 0:
|
||||
if (x450_bodyController->GetCurrentStateId() == pas::EAnimationState::Generate) {
|
||||
RemoveMaterial(EMaterialTypes::Character, EMaterialTypes::Solid,
|
||||
EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(),
|
||||
CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||
RemoveMaterial(EMaterialTypes::Character, EMaterialTypes::Solid, EMaterialTypes::Target, EMaterialTypes::Orbit,
|
||||
mgr);
|
||||
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||
x838_25_burrowing = true;
|
||||
x5a8_animTimeRem = x450_bodyController->GetAnimTimeRemaining();
|
||||
x568_stateProg = 2;
|
||||
|
@ -806,7 +797,7 @@ void CBeetle::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::One));
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(
|
||||
x45c_steeringBehaviors.Seek(*this, mgr.GetPlayer().GetTranslation()), zeus::CVector3f::skZero, 1.f));
|
||||
x45c_steeringBehaviors.Seek(*this, mgr.GetPlayer().GetTranslation()), zeus::CVector3f::skZero, 1.f));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -828,8 +819,8 @@ void CBeetle::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
} else {
|
||||
auto aabb = GetBoundingBox();
|
||||
zeus::CVector3f downVec = (aabb.max.z() - aabb.min.z()) * 3.f * zeus::CVector3f::skDown;
|
||||
SetTranslation(((x834_retreatTime > 0.f) ?
|
||||
(1.f / x834_retreatTime) * downVec : downVec) * dt + GetTranslation());
|
||||
SetTranslation(((x834_retreatTime > 0.f) ? (1.f / x834_retreatTime) * downVec : downVec) * dt +
|
||||
GetTranslation());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -840,8 +831,7 @@ void CBeetle::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
s32 idx = FindFurthestRetreatPoint(mgr);
|
||||
if (idx != -1) {
|
||||
SetTranslation(x6e0_retreatPoints[idx]);
|
||||
AddMaterial(EMaterialTypes::Character, EMaterialTypes::Solid,
|
||||
EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
AddMaterial(EMaterialTypes::Character, EMaterialTypes::Solid, EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
} else {
|
||||
SendScriptMsgs(EScriptObjectState::DeactivateState, mgr, EScriptObjectMessage::None);
|
||||
mgr.FreeScriptObject(GetUniqueId());
|
||||
|
@ -862,9 +852,7 @@ bool CBeetle::InAttackPosition(CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CBeetle::PathShagged(CStateManager&, float arg) {
|
||||
return false;
|
||||
}
|
||||
bool CBeetle::PathShagged(CStateManager&, float arg) { return false; }
|
||||
|
||||
bool CBeetle::InRange(CStateManager& mgr, float arg) {
|
||||
zeus::CVector3f targetPos = mgr.GetPlayer().GetTranslation();
|
||||
|
@ -875,17 +863,11 @@ bool CBeetle::InRange(CStateManager& mgr, float arg) {
|
|||
return (targetPos - GetTranslation()).magSquared() < 100.f;
|
||||
}
|
||||
|
||||
bool CBeetle::PatternOver(CStateManager& mgr, float arg) {
|
||||
return AnimOver(mgr, arg);
|
||||
}
|
||||
bool CBeetle::PatternOver(CStateManager& mgr, float arg) { return AnimOver(mgr, arg); }
|
||||
|
||||
bool CBeetle::HasAttackPattern(CStateManager&, float arg) {
|
||||
return true;
|
||||
}
|
||||
bool CBeetle::HasAttackPattern(CStateManager&, float arg) { return true; }
|
||||
|
||||
bool CBeetle::AnimOver(CStateManager&, float arg) {
|
||||
return x568_stateProg == 4;
|
||||
}
|
||||
bool CBeetle::AnimOver(CStateManager&, float arg) { return x568_stateProg == 4; }
|
||||
|
||||
bool CBeetle::ShouldAttack(CStateManager& mgr, float arg) {
|
||||
if (x814_attackDelayTimer <= 0.f) {
|
||||
|
@ -908,10 +890,11 @@ bool CBeetle::ShouldDoubleSnap(CStateManager& mgr, float arg) {
|
|||
if (delta.magSquared() > dist * dist && GetTransform().basis[1].dot(delta.normalized()) > 0.98f) {
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
mgr.BuildNearList(nearList, GetTranslation(), GetTransform().basis[1], x5a0_headbuttDist,
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
|
||||
TUniqueId bestId = kInvalidUniqueId;
|
||||
CRayCastResult res = mgr.RayWorldIntersection(bestId, GetTranslation(), GetTransform().basis[1],
|
||||
x5a0_headbuttDist, CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
|
||||
CRayCastResult res =
|
||||
mgr.RayWorldIntersection(bestId, GetTranslation(), GetTransform().basis[1], x5a0_headbuttDist,
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
|
||||
if (res.IsInvalid())
|
||||
return true;
|
||||
}
|
||||
|
@ -921,12 +904,11 @@ bool CBeetle::ShouldDoubleSnap(CStateManager& mgr, float arg) {
|
|||
|
||||
bool CBeetle::ShouldTurn(CStateManager& mgr, float arg) {
|
||||
return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(),
|
||||
(mgr.GetPlayer().GetTranslation() - GetTranslation()).toVec2f()) > zeus::degToRad(30.f);
|
||||
(mgr.GetPlayer().GetTranslation() - GetTranslation()).toVec2f()) >
|
||||
zeus::degToRad(30.f);
|
||||
}
|
||||
|
||||
bool CBeetle::HitSomething(CStateManager&, float arg) {
|
||||
return x838_24_hitSomething;
|
||||
}
|
||||
bool CBeetle::HitSomething(CStateManager&, float arg) { return x838_24_hitSomething; }
|
||||
|
||||
bool CBeetle::ShouldJumpBack(CStateManager& mgr, float arg) {
|
||||
zeus::CVector3f backDir = -GetTransform().basis[1];
|
||||
|
@ -934,20 +916,16 @@ bool CBeetle::ShouldJumpBack(CStateManager& mgr, float arg) {
|
|||
zeus::CVector3f pos = GetTranslation() + zeus::CVector3f(0.f, 0.f, (aabb.max.z() - aabb.min.z()) * 0.5f);
|
||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
mgr.BuildNearList(nearList, pos, backDir, x5a4_jumpBackwardDist,
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Character}), this);
|
||||
TUniqueId bestId = kInvalidUniqueId;
|
||||
CRayCastResult res = mgr.RayWorldIntersection(bestId, pos, backDir, x5a4_jumpBackwardDist,
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
|
||||
return res.IsInvalid();
|
||||
}
|
||||
|
||||
bool CBeetle::Stuck(CStateManager&, float arg) {
|
||||
return x820_posDeviationCounter > 30;
|
||||
}
|
||||
bool CBeetle::Stuck(CStateManager&, float arg) { return x820_posDeviationCounter > 30; }
|
||||
|
||||
bool CBeetle::NoPathNodes(CStateManager&, float arg) {
|
||||
return false;
|
||||
}
|
||||
bool CBeetle::NoPathNodes(CStateManager&, float arg) { return false; }
|
||||
|
||||
bool CBeetle::ShouldTaunt(CStateManager& mgr, float arg) {
|
||||
if (CTeamAiRole* role = CTeamAiMgr::GetTeamAiRole(mgr, x570_aiMgr, GetUniqueId())) {
|
||||
|
@ -1001,12 +979,8 @@ void CBeetle::Shock(CStateManager& mgr, float duration, float damage) {
|
|||
}
|
||||
}
|
||||
|
||||
CPathFindSearch* CBeetle::GetSearchPath() {
|
||||
return &x5fc_pathFindSearch;
|
||||
}
|
||||
CPathFindSearch* CBeetle::GetSearchPath() { return &x5fc_pathFindSearch; }
|
||||
|
||||
float CBeetle::GetGravityConstant() const {
|
||||
return 4.f * 24.525f;
|
||||
}
|
||||
float CBeetle::GetGravityConstant() const { return 4.f * 24.525f; }
|
||||
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -51,11 +51,10 @@ private:
|
|||
|
||||
public:
|
||||
DEFINE_PATTERNED(Beetle)
|
||||
CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor,
|
||||
CBeetle::EEntranceType entranceType, const CDamageInfo& touchDamage,
|
||||
const CDamageVulnerability& platingVuln, const zeus::CVector3f& tailAimReference,
|
||||
float initialAttackDelay, float retreatTime, float f3,
|
||||
CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor, CBeetle::EEntranceType entranceType,
|
||||
const CDamageInfo& touchDamage, const CDamageVulnerability& platingVuln,
|
||||
const zeus::CVector3f& tailAimReference, float initialAttackDelay, float retreatTime, float f3,
|
||||
const CDamageVulnerability& tailVuln, const CActorParameters& aParams,
|
||||
const rstl::optional<CStaticRes>& tailModel);
|
||||
|
||||
|
@ -66,22 +65,18 @@ public:
|
|||
void Render(const CStateManager& mgr) const;
|
||||
|
||||
const CDamageVulnerability* GetDamageVulnerability() const;
|
||||
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir,
|
||||
const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const CDamageInfo& dInfo) const;
|
||||
zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
|
||||
zeus::CVector3f GetAimPosition(const CStateManager& mgr, float) const;
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& dir,
|
||||
const CWeaponMode& wMode,
|
||||
EProjectileAttrib attribs) const;
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const CWeaponMode& wMode, EProjectileAttrib attribs) const;
|
||||
void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float dt);
|
||||
void CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
|
||||
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state);
|
||||
void TakeDamage(const zeus::CVector3f& direction, float magnitude);
|
||||
bool IsListening() const;
|
||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
||||
const zeus::CVector3f& aimPos) const;
|
||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role, const zeus::CVector3f& aimPos) const;
|
||||
|
||||
void FollowPattern(CStateManager&, EStateMsg msg, float dt);
|
||||
void PathFind(CStateManager& mgr, EStateMsg msg, float dt);
|
||||
|
@ -118,7 +113,6 @@ public:
|
|||
|
||||
CPathFindSearch* GetSearchPath();
|
||||
float GetGravityConstant() const;
|
||||
|
||||
};
|
||||
} // namespace MP1
|
||||
} // namespace urde
|
||||
|
|
|
@ -120,9 +120,9 @@ void CEyeball::CreateBeam(CStateManager& mgr) {
|
|||
if (x5ec_projectileId != kInvalidUniqueId)
|
||||
return;
|
||||
|
||||
CBeamInfo beamInfo(3, x5dc_beamContactFxId, x5e0_beamPulseFxId, x5e4_beamTextureId, x5e8_beamGlowTextureId,
|
||||
50, 0.05f, 1.f, 2.f, 20.f, 1.f, 1.f, 2.f, zeus::CColor(1.f, 1.f, 1.f, 0.f),
|
||||
zeus::CColor(0.f, 1.f, 0.5f, 0.f), 150.f);
|
||||
CBeamInfo beamInfo(3, x5dc_beamContactFxId, x5e0_beamPulseFxId, x5e4_beamTextureId, x5e8_beamGlowTextureId, 50, 0.05f,
|
||||
1.f, 2.f, 20.f, 1.f, 1.f, 2.f, zeus::CColor(1.f, 1.f, 1.f, 0.f), zeus::CColor(0.f, 1.f, 0.5f, 0.f),
|
||||
150.f);
|
||||
x5ec_projectileId = mgr.AllocateUniqueId();
|
||||
mgr.AddObject(new CPlasmaProjectile(x5b4_projectileInfo.Token(), "EyeBall_Beam"sv, EWeaponType::AI, beamInfo,
|
||||
zeus::CTransform::Identity(), EMaterialTypes::Immovable,
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
CEyeball(TUniqueId uid, std::string_view name, CPatterned::EFlavorType flavor, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, float attackDelay,
|
||||
float attackStartTime, CAssetId wpscId, const CDamageInfo& dInfo, CAssetId beamContactFxId,
|
||||
CAssetId beamPulseFxId, CAssetId beamTextureId, CAssetId beamGlowTextureId, u32 anim0, u32 anim1,
|
||||
u32 anim2, u32 anim3, u32 beamSfx, bool attackDisabled, const CActorParameters& actParms);
|
||||
CAssetId beamPulseFxId, CAssetId beamTextureId, CAssetId beamGlowTextureId, u32 anim0, u32 anim1, u32 anim2,
|
||||
u32 anim3, u32 beamSfx, bool attackDisabled, const CActorParameters& actParms);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||
|
|
|
@ -119,7 +119,7 @@ void CFireFlea::TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
}
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Arrival(*this, xd80_targetPos, 5.f), {}, 1.f));
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Arrival(*this, xd80_targetPos, 5.f), {}, 1.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,8 +145,7 @@ bool CFlickerBat::CanBeShot(CStateManager& mgr, int) {
|
|||
mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay);
|
||||
}
|
||||
|
||||
void CFlickerBat::Patrol(CStateManager& mgr, EStateMsg state, float dt)
|
||||
{
|
||||
void CFlickerBat::Patrol(CStateManager& mgr, EStateMsg state, float dt) {
|
||||
CPatterned::Patrol(mgr, state, dt);
|
||||
x450_bodyController->GetCommandMgr().DeliverFaceVector((x2e0_destPos - GetTranslation()).normalized());
|
||||
}
|
||||
|
@ -154,7 +153,7 @@ void CFlickerBat::Patrol(CStateManager& mgr, EStateMsg state, float dt)
|
|||
void CFlickerBat::Attack(CStateManager&, EStateMsg msg, float) {
|
||||
if (msg == EStateMsg::Update) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd((x2e0_destPos - GetTranslation()).normalized(), {}, 1.f));
|
||||
CBCLocomotionCmd((x2e0_destPos - GetTranslation()).normalized(), {}, 1.f));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ private:
|
|||
void NotifyNeighbors(CStateManager&);
|
||||
void ToggleVisible(CStateManager&);
|
||||
void SetHeardShot(bool heardShot) { x580_25_heardShot = heardShot; }
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(FlickerBat)
|
||||
CFlickerBat(TUniqueId, std::string_view name, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
|
|
|
@ -19,4 +19,24 @@ CMagdolite::CMagdolite(TUniqueId uid, std::string_view name, const CEntityInfo&
|
|||
const urde::MP1::CMagdolite::CMagdoliteData& magData, float f7, float f8, float f9)
|
||||
: CPatterned(ECharacter::Magdolite, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::Flyer, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Large) {}
|
||||
|
||||
void CMagdolite::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
|
||||
switch(msg) {
|
||||
case EScriptObjectMessage::Damage:
|
||||
case EScriptObjectMessage::InvulnDamage:
|
||||
/* TODO Implement */
|
||||
return;
|
||||
case EScriptObjectMessage::Registered:
|
||||
x450_bodyController->Activate(mgr);
|
||||
RemoveMaterial(EMaterialTypes::Solid, mgr);
|
||||
AddMaterial(EMaterialTypes::NonSolidDamageable, mgr);
|
||||
//x584_boneTracker.SetActive(false);
|
||||
CreateShadow(false);
|
||||
/* TODO Finish */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "World/CPatterned.hpp"
|
||||
#include "Character/CBoneTracking.hpp"
|
||||
|
||||
namespace urde::MP1 {
|
||||
class CMagdolite : public CPatterned {
|
||||
|
@ -19,11 +20,14 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
//CBoneTracking x584_boneTracker;
|
||||
public:
|
||||
DEFINE_PATTERNED(Magdolite)
|
||||
CMagdolite(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
const CPatternedInfo&, const CActorParameters&, float, float, const CDamageInfo&, const CDamageInfo&,
|
||||
const CDamageVulnerability&, const CDamageVulnerability&, CAssetId, CAssetId, float, float, float, float,
|
||||
const CMagdoliteData&, float, float, float);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
};
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -21,7 +21,7 @@ CMetroidData::CMetroidData(CInputStream& in)
|
|||
|
||||
CMetroid::CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
|
||||
const CActorParameters& aParms, const CMetroidData& metroidData)
|
||||
const CActorParameters& aParms, const CMetroidData& metroidData, TUniqueId)
|
||||
: CPatterned(ECharacter::Metroid, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Flyer,
|
||||
EColliderType::One, EBodyType::Flyer, aParms, EKnockBackVariant::Medium) {}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
namespace urde::MP1 {
|
||||
|
||||
class CMetroidData {
|
||||
static constexpr u32 skNumProperties = 20;
|
||||
CDamageVulnerability x0_dVuln1;
|
||||
CDamageVulnerability x68_dVuln2;
|
||||
float xd0_;
|
||||
|
@ -22,6 +23,7 @@ class CMetroidData {
|
|||
|
||||
public:
|
||||
CMetroidData(CInputStream& in);
|
||||
static u32 GetNumProperties() { return skNumProperties; }
|
||||
};
|
||||
|
||||
class CMetroid : public CPatterned {
|
||||
|
@ -31,11 +33,12 @@ class CMetroid : public CPatterned {
|
|||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(Metroid)
|
||||
CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& aParms,
|
||||
const CMetroidData& metroidData);
|
||||
const CMetroidData& metroidData, TUniqueId);
|
||||
bool GetX9BF_29() const { return x9bf_29_; }
|
||||
};
|
||||
|
||||
|
|
|
@ -14,8 +14,9 @@ namespace urde::MP1 {
|
|||
|
||||
CNewIntroBoss::CNewIntroBoss(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
||||
float minTurnAngle, CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId,
|
||||
CAssetId beamPulseFxId, CAssetId beamTextureId, CAssetId beamGlowTextureId)
|
||||
float minTurnAngle, CAssetId projectile, const CDamageInfo& dInfo,
|
||||
CAssetId beamContactFxId, CAssetId beamPulseFxId, CAssetId beamTextureId,
|
||||
CAssetId beamGlowTextureId)
|
||||
: CPatterned(ECharacter::NewIntroBoss, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::Flyer, EColliderType::One, EBodyType::Restricted, actParms, EKnockBackVariant::Medium)
|
||||
, x570_minTurnAngle(minTurnAngle)
|
||||
|
@ -225,7 +226,8 @@ void CNewIntroBoss::Think(float dt, CStateManager& mgr) {
|
|||
zeus::CTransform xf = GetLctrTransform(x5dc_damageLocator);
|
||||
|
||||
if (x400_25_alive) {
|
||||
zeus::CQuaternion clampedQuat = zeus::CQuaternion::clampedRotateTo(xf.frontVector(),
|
||||
zeus::CQuaternion clampedQuat = zeus::CQuaternion::clampedRotateTo(
|
||||
xf.frontVector(),
|
||||
(x610_lookPos + (zeus::min(x628_firingTime / 1.5f, 1.f) * (x61c_startPlayerPos - x610_lookPos))) - xf.origin,
|
||||
zeus::CRelAngle::FromDegrees(30.f));
|
||||
zeus::CTransform newXf = clampedQuat.toTransform() * xf.getRotation();
|
||||
|
@ -328,7 +330,7 @@ bool CNewIntroBoss::ShouldTurn(CStateManager& mgr, float dt) {
|
|||
zeus::CVector2f diffPos = (x604_predictedPlayerPos - GetTranslation()).toVec2f();
|
||||
|
||||
return zeus::CVector2f::getAngleDiff(GetTransform().frontVector().toVec2f(), diffPos) >
|
||||
zeus::degToRad(x570_minTurnAngle);
|
||||
zeus::degToRad(x570_minTurnAngle);
|
||||
}
|
||||
|
||||
bool CNewIntroBoss::ShouldAttack(CStateManager& mgr, float dt) {
|
||||
|
|
|
@ -48,9 +48,9 @@ class CNewIntroBoss : public CPatterned {
|
|||
public:
|
||||
DEFINE_PATTERNED(NewIntroBoss)
|
||||
CNewIntroBoss(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
||||
float minTurnAngle, CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId,
|
||||
CAssetId beamPulseFxId, CAssetId beamTextureId, CAssetId beamGlowTextureId);
|
||||
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, float minTurnAngle,
|
||||
CAssetId projectile, const CDamageInfo& dInfo, CAssetId beamContactFxId, CAssetId beamPulseFxId,
|
||||
CAssetId beamTextureId, CAssetId beamGlowTextureId);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager&);
|
||||
|
|
|
@ -12,22 +12,9 @@
|
|||
|
||||
namespace urde::MP1 {
|
||||
const std::string_view CPuddleSpore::kEyeLocators[16] = {
|
||||
"Glow_1_LCTR"sv,
|
||||
"Glow_2_LCTR"sv,
|
||||
"Glow_3_LCTR"sv,
|
||||
"Glow_4_LCTR"sv,
|
||||
"Glow_5_LCTR"sv,
|
||||
"Glow_6_LCTR"sv,
|
||||
"Glow_7_LCTR"sv,
|
||||
"Glow_8_LCTR"sv,
|
||||
"Glow_9_LCTR"sv,
|
||||
"Glow_10_LCTR"sv,
|
||||
"Glow_11_LCTR"sv,
|
||||
"Glow_12_LCTR"sv,
|
||||
"Glow_13_LCTR"sv,
|
||||
"Glow_14_LCTR"sv,
|
||||
"Glow_15_LCTR"sv,
|
||||
"Glow_16_LCTR"sv,
|
||||
"Glow_1_LCTR"sv, "Glow_2_LCTR"sv, "Glow_3_LCTR"sv, "Glow_4_LCTR"sv, "Glow_5_LCTR"sv, "Glow_6_LCTR"sv,
|
||||
"Glow_7_LCTR"sv, "Glow_8_LCTR"sv, "Glow_9_LCTR"sv, "Glow_10_LCTR"sv, "Glow_11_LCTR"sv, "Glow_12_LCTR"sv,
|
||||
"Glow_13_LCTR"sv, "Glow_14_LCTR"sv, "Glow_15_LCTR"sv, "Glow_16_LCTR"sv,
|
||||
};
|
||||
CPuddleSpore::CPuddleSpore(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
|
||||
|
@ -56,9 +43,10 @@ CPuddleSpore::CPuddleSpore(TUniqueId uid, std::string_view name, EFlavorType fla
|
|||
}
|
||||
|
||||
zeus::CAABox CPuddleSpore::CalculateBoundingBox() const {
|
||||
return {((zeus::CVector3f(-x590_halfExtent, -x590_halfExtent, x598_) + x584_bodyOrigin) * 0.5f) +
|
||||
return {
|
||||
((zeus::CVector3f(-x590_halfExtent, -x590_halfExtent, x598_) + x584_bodyOrigin) * 0.5f) +
|
||||
(GetBaseBoundingBox().min * 0.95f),
|
||||
((zeus::CVector3f(x590_halfExtent, x590_halfExtent, (x594_height * x59c_) + x598_) + x584_bodyOrigin) * 0.5f) +
|
||||
((zeus::CVector3f(x590_halfExtent, x590_halfExtent, (x594_height * x59c_) + x598_) + x584_bodyOrigin) * 0.5f) +
|
||||
(GetBaseBoundingBox().max * 0.95f)};
|
||||
}
|
||||
|
||||
|
@ -78,9 +66,7 @@ bool CPuddleSpore::HitShell(const zeus::CVector3f& point) const {
|
|||
return (distance <= -0.5f || distance >= 0.5f);
|
||||
}
|
||||
|
||||
void CPuddleSpore::KnockPlayer(CStateManager&, float) {
|
||||
|
||||
}
|
||||
void CPuddleSpore::KnockPlayer(CStateManager&, float) {}
|
||||
|
||||
void CPuddleSpore::UpdateBoundingState(const zeus::CAABox& box, CStateManager& mgr, float dt) {
|
||||
SetBoundingBox(box);
|
||||
|
@ -133,7 +119,7 @@ void CPuddleSpore::Think(float dt, CStateManager& mgr) {
|
|||
HealthInfo(mgr)->SetHP(1000000.0f);
|
||||
float t = (x56c_ / x570_) - 1.f >= -0.f ? 1.f : x56c_ / x570_;
|
||||
zeus::CColor modColor = zeus::CColor::lerp(zeus::CColor::skWhite, zeus::CColor(1.f, 1.f, 1.f, 0.f), t);
|
||||
for (u32 i = 0 ; i < kEyeCount ; ++i) {
|
||||
for (u32 i = 0; i < kEyeCount; ++i) {
|
||||
const auto& elemGen = x5dc_elemGens[i];
|
||||
elemGen->SetModulationColor(modColor);
|
||||
elemGen->SetTranslation(GetLctrTransform(kEyeLocators[i]).origin);
|
||||
|
@ -178,11 +164,10 @@ void CPuddleSpore::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node
|
|||
CProjectileInfo* projInfo = GetProjectileInfo();
|
||||
if (projInfo->Token() && projInfo->Token().IsLocked() &&
|
||||
mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 16)) {
|
||||
mgr.AddObject(new CEnergyProjectile(true, projInfo->Token(), EWeaponType::AI,
|
||||
GetLctrTransform(node.GetLocatorName()), EMaterialTypes::Character,
|
||||
projInfo->GetDamage(), mgr.AllocateUniqueId(), GetAreaIdAlways(),
|
||||
GetUniqueId(), kInvalidUniqueId, EProjectileAttrib::None, false,
|
||||
zeus::CVector3f::skOne, {}, 0xFFFF, false));
|
||||
mgr.AddObject(new CEnergyProjectile(
|
||||
true, projInfo->Token(), EWeaponType::AI, GetLctrTransform(node.GetLocatorName()), EMaterialTypes::Character,
|
||||
projInfo->GetDamage(), mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(), kInvalidUniqueId,
|
||||
EProjectileAttrib::None, false, zeus::CVector3f::skOne, {}, 0xFFFF, false));
|
||||
}
|
||||
} else
|
||||
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
||||
|
@ -192,11 +177,8 @@ bool CPuddleSpore::ShouldTurn(CStateManager& mgr, float) {
|
|||
zeus::CAABox plBox = mgr.GetPlayer().GetBoundingBox();
|
||||
zeus::CAABox selfBox = GetBoundingBox();
|
||||
|
||||
if (plBox.max.z() >= selfBox.min.z() + selfBox.max.z() * 0.5f ||
|
||||
plBox.max.x() < selfBox.min.x() ||
|
||||
plBox.max.y() < selfBox.min.y() ||
|
||||
selfBox.max.x() < plBox.min.y() ||
|
||||
selfBox.max.y() < plBox.min.y() ||
|
||||
if (plBox.max.z() >= selfBox.min.z() + selfBox.max.z() * 0.5f || plBox.max.x() < selfBox.min.x() ||
|
||||
plBox.max.y() < selfBox.min.y() || selfBox.max.x() < plBox.min.y() || selfBox.max.y() < plBox.min.y() ||
|
||||
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup)
|
||||
return x568_ >= x578_;
|
||||
|
||||
|
@ -270,7 +252,8 @@ void CPuddleSpore::TurnAround(CStateManager& mgr, EStateMsg msg, float) {
|
|||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockDownCmd({1.f, 0.f, 0.f}, pas::ESeverity::One));
|
||||
}
|
||||
} else if (x5cc_ == 1 && x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::LieOnGround) {
|
||||
} else if (x5cc_ == 1 &&
|
||||
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::LieOnGround) {
|
||||
x5cc_ = 2;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
@ -291,7 +274,8 @@ void CPuddleSpore::GetUp(CStateManager& mgr, EStateMsg msg, float) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGetupCmd(pas::EGetupType::Zero));
|
||||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Getup)
|
||||
x5cc_ = 1;
|
||||
} else if (x5cc_ == 1 && x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup) {
|
||||
} else if (x5cc_ == 1 &&
|
||||
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup) {
|
||||
x5cc_ = 1;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
@ -309,4 +293,4 @@ void CPuddleSpore::Attack(CStateManager& mgr, EStateMsg msg, float) {
|
|||
x32c_animState = EAnimState::NotReady;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace urde::MP1
|
|
@ -29,14 +29,15 @@ class CPuddleSpore : public CPatterned {
|
|||
bool x614_24 : 1;
|
||||
bool x614_25 : 1;
|
||||
|
||||
bool HitShell(const zeus::CVector3f& ) const;
|
||||
bool HitShell(const zeus::CVector3f&) const;
|
||||
void KnockPlayer(CStateManager&, float);
|
||||
void UpdateBoundingState(const zeus::CAABox&, CStateManager&, float);
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(PuddleSpore)
|
||||
|
||||
CPuddleSpore(TUniqueId, std::string_view, EFlavorType, const CEntityInfo&, const zeus::CTransform&,
|
||||
CModelData&&, const CPatternedInfo&, EColliderType, CAssetId, float, float, float, float, float,
|
||||
CPuddleSpore(TUniqueId, std::string_view, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
const CPatternedInfo&, EColliderType, CAssetId, float, float, float, float, float,
|
||||
const CActorParameters&, CAssetId, const CDamageInfo&);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr);
|
||||
|
@ -46,20 +47,17 @@ public:
|
|||
void Touch(CActor&, CStateManager&);
|
||||
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
|
||||
void KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& dInfo, EKnockBackType type,
|
||||
bool inDeferred, float dt)
|
||||
{
|
||||
bool inDeferred, float dt) {
|
||||
if (x5c8_ == 1)
|
||||
return;
|
||||
CPatterned::KnockBack(dir, mgr, dInfo, type, inDeferred, dt);
|
||||
}
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& point, const zeus::CVector3f&,
|
||||
const CWeaponMode&, EProjectileAttrib) const
|
||||
{
|
||||
const CWeaponMode&, EProjectileAttrib) const {
|
||||
return HitShell(point) ? EWeaponCollisionResponseTypes::Unknown84 : EWeaponCollisionResponseTypes::Unknown34;
|
||||
}
|
||||
void DoUserAnimEvent(CStateManager&, const CInt32POINode&, EUserEventType, float);
|
||||
void CollidedWith(TUniqueId uid, const CCollisionInfoList& colList, CStateManager& mgr)
|
||||
{
|
||||
void CollidedWith(TUniqueId uid, const CCollisionInfoList& colList, CStateManager& mgr) {
|
||||
if (x5c8_ == 2)
|
||||
return;
|
||||
CPatterned::CollidedWith(uid, colList, mgr);
|
||||
|
@ -80,4 +78,4 @@ public:
|
|||
void GetUp(CStateManager&, EStateMsg, float);
|
||||
void Attack(CStateManager&, EStateMsg, float);
|
||||
};
|
||||
}
|
||||
} // namespace urde::MP1
|
|
@ -219,4 +219,4 @@ void CSeedling::MassiveDeath(CStateManager& mgr) {
|
|||
CPatterned::MassiveDeath(mgr);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -41,4 +41,4 @@ public:
|
|||
bool ShouldAttack(CStateManager&, float);
|
||||
void MassiveDeath(CStateManager&);
|
||||
};
|
||||
} // namespace urde
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -530,10 +530,10 @@ bool CSpacePirate::FireProjectile(float dt, CStateManager& mgr) {
|
|||
zeus::CVector3f gunToPos = pos - gunXf.origin;
|
||||
float mag = gunToPos.magnitude();
|
||||
gunToPos = gunToPos / mag;
|
||||
float dot = (GetLctrTransform(x7b8_wristSeg).origin -
|
||||
GetLctrTransform(x7b7_elbowSeg).origin).normalized().dot(gunToPos);
|
||||
if ((dot > 0.707f || (mag < 6.f && dot > 0.5f)) && LineOfSightTest(mgr, gunXf.origin, pos,
|
||||
{EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough})) {
|
||||
float dot =
|
||||
(GetLctrTransform(x7b8_wristSeg).origin - GetLctrTransform(x7b7_elbowSeg).origin).normalized().dot(gunToPos);
|
||||
if ((dot > 0.707f || (mag < 6.f && dot > 0.5f)) &&
|
||||
LineOfSightTest(mgr, gunXf.origin, pos, {EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough})) {
|
||||
pos += GetTransform().rotate(x7c4_burstFire.GetDistanceCompensatedError(mag, 6.f));
|
||||
LaunchProjectile(zeus::lookAt(gunXf.origin, pos), mgr, 6, EProjectileAttrib::None, false, {}, 0xffff, false,
|
||||
zeus::CVector3f::skOne);
|
||||
|
@ -543,11 +543,11 @@ bool CSpacePirate::FireProjectile(float dt, CStateManager& mgr) {
|
|||
}
|
||||
if (ret) {
|
||||
auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation({24, CPASAnimParm::FromEnum(2)},
|
||||
*mgr.GetActiveRandom(), -1);
|
||||
*mgr.GetActiveRandom(), -1);
|
||||
if (bestAnim.first > 0.f)
|
||||
x64_modelData->AnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true);
|
||||
CSfxManager::AddEmitter(x568_pirateData.x48_Sound_Projectile, GetTranslation(), zeus::CVector3f::skZero,
|
||||
true, false, 0x7f, kInvalidAreaId);
|
||||
CSfxManager::AddEmitter(x568_pirateData.x48_Sound_Projectile, GetTranslation(), zeus::CVector3f::skZero, true,
|
||||
false, 0x7f, kInvalidAreaId);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -628,8 +628,8 @@ zeus::CVector3f CSpacePirate::GetTargetPos(CStateManager& mgr) {
|
|||
}
|
||||
|
||||
void CSpacePirate::UpdateAimBodyState(float dt, CStateManager& mgr) {
|
||||
if (x400_25_alive && x637_25_enableAim && !x637_29_inWallHang && !x450_bodyController->IsFrozen() &&
|
||||
!x634_27_melee && !x85c_ragDoll && (!x635_26_seated || x639_28_satUp) && x31c_faceVec.z() <= 0.f) {
|
||||
if (x400_25_alive && x637_25_enableAim && !x637_29_inWallHang && !x450_bodyController->IsFrozen() && !x634_27_melee &&
|
||||
!x85c_ragDoll && (!x635_26_seated || x639_28_satUp) && x31c_faceVec.z() <= 0.f) {
|
||||
x8c4_aimDelayTimer = std::max(0.f, x8c4_aimDelayTimer - dt);
|
||||
if (x8c4_aimDelayTimer == 0.f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCAdditiveAimCmd());
|
||||
|
@ -1071,19 +1071,18 @@ void CSpacePirate::Death(CStateManager& mgr, const zeus::CVector3f& direction, E
|
|||
if (x400_25_alive) {
|
||||
CPatterned::Death(mgr, direction, state);
|
||||
if (x7b4_attachedActor != kInvalidUniqueId) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCKnockDownCmd(GetTransform().basis[1], pas::ESeverity::Two));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockDownCmd(GetTransform().basis[1], pas::ESeverity::Two));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSpacePirate::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr,
|
||||
const CDamageInfo& info, EKnockBackType type, bool inDeferred, float magnitude) {
|
||||
void CSpacePirate::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, const CDamageInfo& info,
|
||||
EKnockBackType type, bool inDeferred, float magnitude) {
|
||||
if (!x634_25_ceilingAmbush || !x400_25_alive || inDeferred) {
|
||||
x460_knockBackController.SetAutoResetImpulse(!x634_31_noKnockbackImpulseReset);
|
||||
x460_knockBackController.SetAvailableState(EKnockBackAnimationState::KnockBack, IsOnGround());
|
||||
x460_knockBackController.SetEnableFreeze(!((x636_24_trooper || x635_27_shadowPirate) &&
|
||||
!info.GetWeaponMode().IsCharged() && !info.GetWeaponMode().IsComboed()));
|
||||
!info.GetWeaponMode().IsCharged() && !info.GetWeaponMode().IsComboed()));
|
||||
CPatterned::KnockBack(backVec, mgr, info, type, inDeferred, magnitude);
|
||||
if (x635_27_shadowPirate) {
|
||||
if (x400_25_alive) {
|
||||
|
@ -1107,15 +1106,15 @@ void CSpacePirate::KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr,
|
|||
if (x400_25_alive) {
|
||||
if (x460_knockBackController.GetActiveParms().x0_animState == EKnockBackAnimationState::Hurled) {
|
||||
x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "GetUpNow"sv);
|
||||
CSfxManager::AddEmitter(x568_pirateData.xc0_Sound_Hurled, GetTranslation(), zeus::CVector3f::skZero, 1.f,
|
||||
true, false, 0x7f, kInvalidAreaId);
|
||||
CSfxManager::AddEmitter(x568_pirateData.xc0_Sound_Hurled, GetTranslation(), zeus::CVector3f::skZero, 1.f, true,
|
||||
false, 0x7f, kInvalidAreaId);
|
||||
}
|
||||
} else {
|
||||
if (x460_knockBackController.GetActiveParms().x0_animState == EKnockBackAnimationState::Hurled &&
|
||||
x460_knockBackController.GetActiveParms().x4_animFollowup != EKnockBackAnimationFollowUp::LaggedBurnDeath &&
|
||||
x460_knockBackController.GetActiveParms().x4_animFollowup != EKnockBackAnimationFollowUp::BurnDeath) {
|
||||
CSfxManager::AddEmitter(x568_pirateData.xc2_Sound_Death, GetTranslation(), zeus::CVector3f::skZero, 1.f,
|
||||
true, false, 0x7f, kInvalidAreaId);
|
||||
CSfxManager::AddEmitter(x568_pirateData.xc2_Sound_Death, GetTranslation(), zeus::CVector3f::skZero, 1.f, true,
|
||||
false, 0x7f, kInvalidAreaId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1143,11 +1142,11 @@ zeus::CVector3f CSpacePirate::GetOrigin(const CStateManager& mgr, const CTeamAiR
|
|||
}
|
||||
|
||||
void CSpacePirate::AvoidActors(CStateManager& mgr) {
|
||||
for (CEntity* ent : mgr.GetListeningAiObjectList()) {
|
||||
for (CEntity* ent : mgr.GetListeningAiObjectList()) {
|
||||
if (TCastToPtr<CPatterned> ai = ent) {
|
||||
if (ai.GetPtr() != this && ai->GetAreaIdAlways() == GetAreaIdAlways()) {
|
||||
zeus::CVector3f deltaVec = x45c_steeringBehaviors.Separation(
|
||||
*this, ai->GetTranslation(), x568_pirateData.xc8_AvoidDistance);
|
||||
zeus::CVector3f deltaVec =
|
||||
x45c_steeringBehaviors.Separation(*this, ai->GetTranslation(), x568_pirateData.xc8_AvoidDistance);
|
||||
if (!deltaVec.isZero()) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(deltaVec, zeus::CVector3f::skZero, 1.f));
|
||||
if (x748_steeringDelayTimer == 0.f) {
|
||||
|
@ -1184,7 +1183,7 @@ void CSpacePirate::Patrol(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Activate:
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||
x644_steeringSpeed = x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Walk) /
|
||||
x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Run);
|
||||
x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Run);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
|
||||
|
@ -1287,13 +1286,12 @@ void CSpacePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
if (GetSearchPath()->Search(GetTranslation(), x2e0_destPos) == CPathFindSearch::EResult::Success) {
|
||||
x2ec_reflectedDestPos = GetTranslation();
|
||||
x2e0_destPos =
|
||||
(GetSearchPath()->GetCurrentWaypoint() + 1 < GetSearchPath()->GetWaypoints().size()) ?
|
||||
GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint() + 1] :
|
||||
GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint()];
|
||||
x2e0_destPos = (GetSearchPath()->GetCurrentWaypoint() + 1 < GetSearchPath()->GetWaypoints().size())
|
||||
? GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint() + 1]
|
||||
: GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint()];
|
||||
x328_24_inPosition = false;
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(x2e0_destPos - GetTranslation(), zeus::CVector3f::skZero, 1.f));
|
||||
CBCLocomotionCmd(x2e0_destPos - GetTranslation(), zeus::CVector3f::skZero, 1.f));
|
||||
} else {
|
||||
CScriptAiJumpPoint* bestJp = nullptr;
|
||||
float minDist = FLT_MAX;
|
||||
|
@ -1305,14 +1303,13 @@ void CSpacePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
float f30 = toJp.magSquared();
|
||||
if (f30 > 25.f && jp->GetTransform().basis[1].dot(toJp) > 0.f) {
|
||||
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(jp->GetJumpPoint())) {
|
||||
if ((wp->GetTranslation().z() - jp->GetTranslation().z()) *
|
||||
(x2e0_destPos.z() - GetTranslation().z()) > 0.f) {
|
||||
if ((wp->GetTranslation().z() - jp->GetTranslation().z()) * (x2e0_destPos.z() - GetTranslation().z()) >
|
||||
0.f) {
|
||||
zeus::CVector3f delta = x2e0_destPos - wp->GetTranslation();
|
||||
f30 += 4.f * toJp.z() * toJp.z();
|
||||
f30 += delta.magSquared() + delta.z() * delta.z() * 9.f;
|
||||
if (f30 < minDist &&
|
||||
GetSearchPath()->PathExists(GetTranslation(), jp->GetTranslation()) ==
|
||||
CPathFindSearch::EResult::Success) {
|
||||
if (f30 < minDist && GetSearchPath()->PathExists(GetTranslation(), jp->GetTranslation()) ==
|
||||
CPathFindSearch::EResult::Success) {
|
||||
bool r24 = false;
|
||||
auto res = GetSearchPath()->PathExists(wp->GetTranslation(), x2e0_destPos);
|
||||
if (res != CPathFindSearch::EResult::Success)
|
||||
|
@ -1336,17 +1333,16 @@ void CSpacePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x2e0_destPos = bestJp->GetTranslation();
|
||||
if (GetSearchPath()->Search(GetTranslation(), x2e0_destPos) == CPathFindSearch::EResult::Success) {
|
||||
x2ec_reflectedDestPos = GetTranslation();
|
||||
x2e0_destPos =
|
||||
(GetSearchPath()->GetCurrentWaypoint() + 1 < GetSearchPath()->GetWaypoints().size()) ?
|
||||
GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint() + 1] :
|
||||
GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint()];
|
||||
x2e0_destPos = (GetSearchPath()->GetCurrentWaypoint() + 1 < GetSearchPath()->GetWaypoints().size())
|
||||
? GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint() + 1]
|
||||
: GetSearchPath()->GetWaypoints()[GetSearchPath()->GetCurrentWaypoint()];
|
||||
x328_24_inPosition = false;
|
||||
x840_jumpPoint = bestJp->GetUniqueId();
|
||||
x824_jumpHeight = bestJp->GetJumpApex();
|
||||
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(bestJp->GetJumpPoint())) {
|
||||
x828_patrolDestPos = wp->GetTranslation();
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(x2e0_destPos, zeus::CVector3f::skZero, 1.f));
|
||||
CBCLocomotionCmd(x2e0_destPos, zeus::CVector3f::skZero, 1.f));
|
||||
x30c_behaviourOrient = EBehaviourOrient::MoveDir;
|
||||
}
|
||||
}
|
||||
|
@ -1362,8 +1358,9 @@ void CSpacePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
CPatterned::PathFind(mgr, msg, dt);
|
||||
if (x840_jumpPoint != kInvalidUniqueId) {
|
||||
if (TCastToPtr<CScriptAiJumpPoint> jp = mgr.ObjectById(x840_jumpPoint)) {
|
||||
float f0 = (1.5f * dt + 0.1f) * x64_modelData->GetScale().y() *
|
||||
x450_bodyController->GetBodyStateInfo().GetMaxSpeed() + x7a4_intoJumpDist;
|
||||
float f0 =
|
||||
(1.5f * dt + 0.1f) * x64_modelData->GetScale().y() * x450_bodyController->GetBodyStateInfo().GetMaxSpeed() +
|
||||
x7a4_intoJumpDist;
|
||||
if ((GetTranslation() - jp->GetTranslation()).magSquared() < f0 * f0) {
|
||||
x32c_animState = EAnimState::Ready;
|
||||
TryCommand(mgr, pas::EAnimationState::Jump, &CPatterned::TryJump, 0);
|
||||
|
@ -1373,8 +1370,8 @@ void CSpacePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
AvoidActors(mgr);
|
||||
if (!x639_27_inRange) {
|
||||
if (CScriptCoverPoint* cp = GetCoverPoint(mgr, x640_coverPoint)) {
|
||||
x754_fsmRange = (1.5f * dt + 0.1f) * x64_modelData->GetScale().y() *
|
||||
x450_bodyController->GetBodyStateInfo().GetMaxSpeed();
|
||||
x754_fsmRange =
|
||||
(1.5f * dt + 0.1f) * x64_modelData->GetScale().y() * x450_bodyController->GetBodyStateInfo().GetMaxSpeed();
|
||||
if (cp->ShouldWallHang())
|
||||
x754_fsmRange += x7a4_intoJumpDist;
|
||||
x639_27_inRange = (GetTranslation() - cp->GetTranslation()).magSquared() < x754_fsmRange * x754_fsmRange;
|
||||
|
@ -1404,8 +1401,9 @@ void CSpacePirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
if (TCastToPtr<CScriptWaypoint> wp = mgr.ObjectById(x2dc_destObj)) {
|
||||
if ((wp->GetBehaviourModifiers() & 0x2) != 0 || (wp->GetBehaviourModifiers() & 0x4)) {
|
||||
float f0 = (1.5f * dt + 0.1f) * x64_modelData->GetScale().y() *
|
||||
x450_bodyController->GetBodyStateInfo().GetMaxSpeed() + x7a4_intoJumpDist;
|
||||
float f0 =
|
||||
(1.5f * dt + 0.1f) * x64_modelData->GetScale().y() * x450_bodyController->GetBodyStateInfo().GetMaxSpeed() +
|
||||
x7a4_intoJumpDist;
|
||||
if ((GetTranslation() - wp->GetTranslation()).magSquared() < f0 * f0) {
|
||||
x328_24_inPosition = true;
|
||||
x824_jumpHeight = (wp->GetBehaviourModifiers() & 0x2) ? 3.f : 0.f;
|
||||
|
@ -1447,13 +1445,9 @@ void CSpacePirate::TargetCover(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
}
|
||||
|
||||
void CSpacePirate::Halt(CStateManager& mgr, EStateMsg msg, float dt) {
|
||||
x644_steeringSpeed = 0.f;
|
||||
}
|
||||
void CSpacePirate::Halt(CStateManager& mgr, EStateMsg msg, float dt) { x644_steeringSpeed = 0.f; }
|
||||
|
||||
void CSpacePirate::Run(CStateManager& mgr, EStateMsg msg, float dt) {
|
||||
x644_steeringSpeed = 1.f;
|
||||
}
|
||||
void CSpacePirate::Run(CStateManager& mgr, EStateMsg msg, float dt) { x644_steeringSpeed = 1.f; }
|
||||
|
||||
void CSpacePirate::Generate(CStateManager& mgr, EStateMsg msg, float dt) {
|
||||
switch (msg) {
|
||||
|
@ -1580,8 +1574,7 @@ void CSpacePirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
float backupChHeight = GetSearchPath()->GetCharacterHeight();
|
||||
x660_pathFindSearch.SetCharacterHeight(5.f + backupChHeight);
|
||||
zeus::CVector3f dest = GetTransform().basis[1] * 10.f + GetTranslation();
|
||||
if (GetSearchPath()->Search(GetTranslation(), dest) ==
|
||||
CPathFindSearch::EResult::Success &&
|
||||
if (GetSearchPath()->Search(GetTranslation(), dest) == CPathFindSearch::EResult::Success &&
|
||||
(GetSearchPath()->GetWaypoints().back() - dest).magSquared() < 3.f &&
|
||||
std::fabs(GetSearchPath()->RemainingPathDistance(GetTranslation()) - 10.f) < 4.f) {
|
||||
x828_patrolDestPos = GetSearchPath()->GetWaypoints().back();
|
||||
|
@ -1595,7 +1588,7 @@ void CSpacePirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
if (!x639_25_useJumpBackJump) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
} else {
|
||||
TryCommand(mgr, pas::EAnimationState::Jump, &CPatterned::TryJump, 0);
|
||||
|
@ -1666,18 +1659,19 @@ void CSpacePirate::Shuffle(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (msg == EStateMsg::Activate) {
|
||||
x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::Normal);
|
||||
if (!x634_28_noShuffleCloseCheck && TooClose(mgr, 0.f)) {
|
||||
SetDestPos(
|
||||
GetTranslation() + x2fc_minAttackRange * (GetTranslation() - mgr.GetPlayer().GetTranslation()).normalized() +
|
||||
mgr.Random2f(0.f, 5.f));
|
||||
SetDestPos(GetTranslation() +
|
||||
x2fc_minAttackRange * (GetTranslation() - mgr.GetPlayer().GetTranslation()).normalized() +
|
||||
mgr.Random2f(0.f, 5.f));
|
||||
x2dc_destObj = kInvalidUniqueId;
|
||||
x30c_behaviourOrient = EBehaviourOrient::Constant;
|
||||
x636_30_shuffleClose = true;
|
||||
} else {
|
||||
zeus::CVector3f fromPlayer = GetTranslation() - mgr.GetPlayer().GetTranslation();
|
||||
SetDestPos(
|
||||
mgr.GetPlayer().GetTranslation() + (x300_maxAttackRange * mgr.GetActiveRandom()->Float() + x300_maxAttackRange) *
|
||||
fromPlayer.normalized() + zeus::CVector3f::skUp.cross(fromPlayer).normalized() *
|
||||
(2.f * x300_maxAttackRange * (mgr.GetActiveRandom()->Float() - 0.5f)));
|
||||
SetDestPos(mgr.GetPlayer().GetTranslation() +
|
||||
(x300_maxAttackRange * mgr.GetActiveRandom()->Float() + x300_maxAttackRange) *
|
||||
fromPlayer.normalized() +
|
||||
zeus::CVector3f::skUp.cross(fromPlayer).normalized() *
|
||||
(2.f * x300_maxAttackRange * (mgr.GetActiveRandom()->Float() - 0.5f)));
|
||||
x2dc_destObj = kInvalidUniqueId;
|
||||
x30c_behaviourOrient = EBehaviourOrient::MoveDir;
|
||||
x636_30_shuffleClose = false;
|
||||
|
@ -1803,8 +1797,8 @@ void CSpacePirate::Taunt(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (!x635_27_shadowPirate) {
|
||||
bool withOtherPirate = true;
|
||||
if (x634_27_melee) {
|
||||
auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation(
|
||||
{16, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1);
|
||||
auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation({16, CPASAnimParm::FromEnum(2)},
|
||||
*mgr.GetActiveRandom(), -1);
|
||||
if (bestAnim.first > 0.f) {
|
||||
withOtherPirate = false;
|
||||
x760_taunt = pas::ETauntType::Two;
|
||||
|
@ -1829,8 +1823,8 @@ void CSpacePirate::Taunt(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
x32c_animState = EAnimState::Ready;
|
||||
}
|
||||
CSfxManager::AddEmitter(x568_pirateData.xa4_Sound_Alert, GetTranslation(), zeus::CVector3f::skZero, true, false, 0x7f,
|
||||
kInvalidAreaId);
|
||||
CSfxManager::AddEmitter(x568_pirateData.xa4_Sound_Alert, GetTranslation(), zeus::CVector3f::skZero, true, false,
|
||||
0x7f, kInvalidAreaId);
|
||||
break;
|
||||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::Taunt, &CPatterned::TryTaunt, int(x760_taunt));
|
||||
|
@ -1971,8 +1965,8 @@ void CSpacePirate::Dodge(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (mgr.GetActiveRandom()->Float() <
|
||||
((x750_initialHP - HealthInfo(mgr)->GetHP()) * 4.f / x750_initialHP + 1.f) * 0.15f)
|
||||
x639_29_enableBreakDodge = true;
|
||||
x8c0_dodgeDelayTimer = mgr.GetActiveRandom()->Range(x568_pirateData.xb8_dodgeDelayTimeMin,
|
||||
x568_pirateData.xbc_dodgeDelayTimeMax);
|
||||
x8c0_dodgeDelayTimer =
|
||||
mgr.GetActiveRandom()->Range(x568_pirateData.xb8_dodgeDelayTimeMin, x568_pirateData.xbc_dodgeDelayTimeMax);
|
||||
}
|
||||
x844_dodgeDir = GetStrafeDir(mgr, x639_29_enableBreakDodge ? x84c_breakDodgeDist : x848_dodgeDist);
|
||||
if (x844_dodgeDir != pas::EStepDirection::Invalid)
|
||||
|
@ -1988,8 +1982,7 @@ void CSpacePirate::Dodge(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryBreakDodge, int(x844_dodgeDir));
|
||||
if (GetMaterialList().HasMaterial(EMaterialTypes::Orbit) && x330_stateMachineState.GetTime() > 0.5f) {
|
||||
RemoveMaterial(EMaterialTypes::Orbit, mgr);
|
||||
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(),
|
||||
CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2115,7 +2108,7 @@ void CSpacePirate::Bounce(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (TCastToConstPtr<CScriptAiJumpPoint> jp = mgr.GetObjectById(x840_jumpPoint)) {
|
||||
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(jp->GetJumpTarget())) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCJumpCmd(x828_patrolDestPos, wp->GetTranslation(), pas::EJumpType::Normal));
|
||||
CBCJumpCmd(x828_patrolDestPos, wp->GetTranslation(), pas::EJumpType::Normal));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2140,8 +2133,9 @@ void CSpacePirate::PathFindEx(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
AvoidActors(mgr);
|
||||
if (!x639_27_inRange) {
|
||||
if (TCastToConstPtr<CScriptAiJumpPoint> jp = mgr.GetObjectById(x840_jumpPoint)) {
|
||||
x754_fsmRange = (1.5f * dt + 0.1f) * x64_modelData->GetScale().y() *
|
||||
x450_bodyController->GetBodyStateInfo().GetMaxSpeed() + x7a4_intoJumpDist;
|
||||
x754_fsmRange =
|
||||
(1.5f * dt + 0.1f) * x64_modelData->GetScale().y() * x450_bodyController->GetBodyStateInfo().GetMaxSpeed() +
|
||||
x7a4_intoJumpDist;
|
||||
x639_27_inRange = (GetTranslation() - jp->GetTranslation()).magSquared() < x754_fsmRange * x754_fsmRange;
|
||||
}
|
||||
}
|
||||
|
@ -2152,30 +2146,22 @@ void CSpacePirate::PathFindEx(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
}
|
||||
|
||||
bool CSpacePirate::Leash(CStateManager& mgr, float arg) {
|
||||
return x8dc_leashTimer > arg;
|
||||
}
|
||||
bool CSpacePirate::Leash(CStateManager& mgr, float arg) { return x8dc_leashTimer > arg; }
|
||||
|
||||
bool CSpacePirate::OffLine(CStateManager& mgr, float arg) {
|
||||
return !IsOnGround();
|
||||
}
|
||||
bool CSpacePirate::OffLine(CStateManager& mgr, float arg) { return !IsOnGround(); }
|
||||
|
||||
bool CSpacePirate::Attacked(CStateManager& mgr, float arg) {
|
||||
return x850_timeSinceHitByPlayer < (arg == 0.f ? 0.5f : arg);
|
||||
}
|
||||
|
||||
bool CSpacePirate::InRange(CStateManager& mgr, float arg) {
|
||||
return x639_27_inRange;
|
||||
}
|
||||
bool CSpacePirate::InRange(CStateManager& mgr, float arg) { return x639_27_inRange; }
|
||||
|
||||
bool CSpacePirate::SpotPlayer(CStateManager& mgr, float arg) {
|
||||
zeus::CVector3f toPlayer = mgr.GetPlayer().GetTranslation() - GetTranslation();
|
||||
return toPlayer.dot(GetTransform().basis[1]) > toPlayer.magnitude() * x3c4_detectionAngle;
|
||||
}
|
||||
|
||||
bool CSpacePirate::PatternOver(CStateManager& mgr, float arg) {
|
||||
return x2dc_destObj == kInvalidUniqueId;
|
||||
}
|
||||
bool CSpacePirate::PatternOver(CStateManager& mgr, float arg) { return x2dc_destObj == kInvalidUniqueId; }
|
||||
|
||||
bool CSpacePirate::PatternShagged(CStateManager& mgr, float arg) {
|
||||
return CPatterned::Stuck(mgr, arg) || CPatterned::PatternShagged(mgr, arg);
|
||||
|
@ -2219,9 +2205,7 @@ bool CSpacePirate::Stuck(CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CSpacePirate::Landed(CStateManager& mgr, float arg) {
|
||||
return IsOnGround();
|
||||
}
|
||||
bool CSpacePirate::Landed(CStateManager& mgr, float arg) { return IsOnGround(); }
|
||||
|
||||
bool CSpacePirate::HearShot(CStateManager& mgr, float arg) {
|
||||
bool ret = x636_25_hearNoise;
|
||||
|
@ -2232,13 +2216,11 @@ bool CSpacePirate::HearShot(CStateManager& mgr, float arg) {
|
|||
bool CSpacePirate::HearPlayer(CStateManager& mgr, float arg) {
|
||||
if (mgr.GetPlayer().GetVelocity().magSquared() > 0.1f)
|
||||
return (mgr.GetPlayer().GetTranslation() - GetTranslation()).magSquared() <
|
||||
x568_pirateData.x14_HearingRadius * x568_pirateData.x14_HearingRadius;
|
||||
x568_pirateData.x14_HearingRadius * x568_pirateData.x14_HearingRadius;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSpacePirate::CoverCheck(CStateManager& mgr, float arg) {
|
||||
return x638_27_coverCheck;
|
||||
}
|
||||
bool CSpacePirate::CoverCheck(CStateManager& mgr, float arg) { return x638_27_coverCheck; }
|
||||
|
||||
bool CSpacePirate::CoverFind(CStateManager& mgr, float arg) {
|
||||
bool ret = false;
|
||||
|
@ -2301,9 +2283,7 @@ bool CSpacePirate::CoveringFire(CStateManager& mgr, float arg) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool CSpacePirate::LineOfSight(CStateManager& mgr, float arg) {
|
||||
return !x637_28_noPlayerLos;
|
||||
}
|
||||
bool CSpacePirate::LineOfSight(CStateManager& mgr, float arg) { return !x637_28_noPlayerLos; }
|
||||
|
||||
bool CSpacePirate::AggressionCheck(CStateManager& mgr, float arg) {
|
||||
bool ret = false;
|
||||
|
@ -2423,9 +2403,7 @@ bool CSpacePirate::StartAttack(CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CSpacePirate::BreakAttack(CStateManager& mgr, float arg) {
|
||||
return x635_25_breakAttack;
|
||||
}
|
||||
bool CSpacePirate::BreakAttack(CStateManager& mgr, float arg) { return x635_25_breakAttack; }
|
||||
|
||||
bool CSpacePirate::ShouldStrafe(CStateManager& mgr, float arg) {
|
||||
bool ret = false;
|
||||
|
@ -2475,10 +2453,10 @@ bool CSpacePirate::BounceFind(CStateManager& mgr, float arg) {
|
|||
distSq += wpToDest.magSquared();
|
||||
if (distSq < minDistSq && wp->GetTransform().basis[1].dot(wpToDest) > 0.f &&
|
||||
GetSearchPath()->PathExists(GetTranslation(), jp->GetTranslation()) ==
|
||||
CPathFindSearch::EResult::Success) {
|
||||
CPathFindSearch::EResult::Success) {
|
||||
bool good = false;
|
||||
bool fail = GetSearchPath()->PathExists(wp->GetTranslation(), x2e0_destPos) !=
|
||||
CPathFindSearch::EResult::Success;
|
||||
bool fail =
|
||||
GetSearchPath()->PathExists(wp->GetTranslation(), x2e0_destPos) != CPathFindSearch::EResult::Success;
|
||||
if (fail)
|
||||
distSq += 1000.f;
|
||||
if (!fail)
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
|
||||
class CSpacePirate : public CPatterned {
|
||||
friend class CPirateRagDoll;
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(SpacePirate)
|
||||
private:
|
||||
|
@ -263,8 +264,7 @@ public:
|
|||
float magnitude);
|
||||
bool IsListening() const;
|
||||
bool Listen(const zeus::CVector3f&, EListenNoiseType);
|
||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
||||
const zeus::CVector3f& aimPos) const;
|
||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role, const zeus::CVector3f& aimPos) const;
|
||||
void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; }
|
||||
bool AttachActorToPirate(TUniqueId id);
|
||||
void SetAttackTarget(TUniqueId id);
|
||||
|
|
|
@ -47,9 +47,8 @@ CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo&
|
|||
x460_knockBackController.SetAutoResetImpulse(false);
|
||||
}
|
||||
|
||||
static const SSphereJointInfo kArmCollision[] = {{"Arm_4", 1.5f}, {"Arm_6", 1.f}, {"Arm_7", 1.f},
|
||||
{"Arm_8", 1.f}, {"Arm_9", 1.f}, {"Arm_11", 1.f},
|
||||
{"Swoosh_LCTR", 1.5f}};
|
||||
static const SSphereJointInfo kArmCollision[] = {{"Arm_4", 1.5f}, {"Arm_6", 1.f}, {"Arm_7", 1.f}, {"Arm_8", 1.f},
|
||||
{"Arm_9", 1.f}, {"Arm_11", 1.f}, {"Swoosh_LCTR", 1.5f}};
|
||||
|
||||
void CSpankWeed::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
bool oldActive = GetActive();
|
||||
|
@ -119,7 +118,7 @@ void CSpankWeed::Think(float dt, CStateManager& mgr) {
|
|||
|
||||
if (!x598_isHiding) {
|
||||
zeus::CVector3f eyeOrigin = GetLocatorTransform("Eye"sv).origin;
|
||||
MoveCollisionPrimitive(GetModelData()->GetScale() * eyeOrigin);
|
||||
MoveCollisionPrimitive(GetTransform().rotate(GetModelData()->GetScale() * eyeOrigin));
|
||||
x594_collisionMgr->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
||||
xe4_27_notInSortedLists = true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include "CTryclops.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "World/CWorld.hpp"
|
||||
#include "World/CGameArea.hpp"
|
||||
|
||||
namespace urde::MP1 {
|
||||
CTryclops::CTryclops(urde::TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
|
@ -6,4 +9,14 @@ CTryclops::CTryclops(urde::TUniqueId uid, std::string_view name, const CEntityIn
|
|||
const urde::CActorParameters& actParms, float, float, float, float)
|
||||
: CPatterned(ECharacter::Tryclops, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Small) {}
|
||||
|
||||
void CTryclops::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
if (msg == EScriptObjectMessage::Registered) {
|
||||
x450_bodyController->Activate(mgr);
|
||||
} else if (msg == EScriptObjectMessage::InitializedInArea) {
|
||||
//x568_pathFindSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
|
||||
}
|
||||
}
|
||||
} // namespace urde::MP1
|
|
@ -8,5 +8,7 @@ public:
|
|||
DEFINE_PATTERNED(Tryclops)
|
||||
CTryclops(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
const CPatternedInfo&, const CActorParameters&, float, float, float, float);
|
||||
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
};
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -62,9 +62,9 @@ void CWarWasp::SwarmRemove(CStateManager& mgr) {
|
|||
void CWarWasp::ApplyDamage(CStateManager& mgr) {
|
||||
if (x72e_25_canApplyDamage && x450_bodyController->GetCurrentStateId() == pas::EAnimationState::MeleeAttack) {
|
||||
if (mgr.GetPlayer().GetBoundingBox().pointInside(
|
||||
GetTransform() * (GetLocatorTransform("LCTR_WARTAIL"sv).origin * x64_modelData->GetScale()))) {
|
||||
GetTransform() * (GetLocatorTransform("LCTR_WARTAIL"sv).origin * x64_modelData->GetScale()))) {
|
||||
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), GetContactDamage(),
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::CVector3f::skZero);
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::CVector3f::skZero);
|
||||
x72e_25_canApplyDamage = false;
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,10 @@ void CWarWasp::Think(float dt, CStateManager& mgr) {
|
|||
if (x700_attackRemTime > 0.f) {
|
||||
float rate = 1.f;
|
||||
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed)
|
||||
rate = 1.f - zeus::CVector2f::getAngleDiff(mgr.GetPlayer().GetTransform().basis[1].toVec2f(),
|
||||
GetTranslation().toVec2f() - mgr.GetPlayer().GetTranslation().toVec2f()) / M_PIF * 0.666f;
|
||||
rate =
|
||||
1.f - zeus::CVector2f::getAngleDiff(mgr.GetPlayer().GetTransform().basis[1].toVec2f(),
|
||||
GetTranslation().toVec2f() - mgr.GetPlayer().GetTranslation().toVec2f()) /
|
||||
M_PIF * 0.666f;
|
||||
x700_attackRemTime -= rate * dt;
|
||||
}
|
||||
|
||||
|
@ -141,15 +143,15 @@ void CWarWasp::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EU
|
|||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||
TUniqueId bestId = kInvalidUniqueId;
|
||||
CRayCastResult res = mgr.RayWorldIntersection(bestId, xf.origin, delta.normalized(), delta.magnitude(),
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
|
||||
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), nearList);
|
||||
if (res.IsValid())
|
||||
aimPos = res.GetPoint();
|
||||
}
|
||||
}
|
||||
LaunchProjectile(
|
||||
zeus::lookAt(xf.origin, GetProjectileInfo()->PredictInterceptPos(xf.origin, aimPos, mgr.GetPlayer(), true, dt)),
|
||||
mgr, 4, EProjectileAttrib::None, false, {x71c_projectileVisorParticle}, x72c_projectileVisorSfx, true,
|
||||
zeus::CVector3f::skOne);
|
||||
zeus::lookAt(xf.origin, GetProjectileInfo()->PredictInterceptPos(xf.origin, aimPos, mgr.GetPlayer(), true, dt)),
|
||||
mgr, 4, EProjectileAttrib::None, false, {x71c_projectileVisorParticle}, x72c_projectileVisorSfx, true,
|
||||
zeus::CVector3f::skOne);
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
|
@ -175,9 +177,7 @@ void CWarWasp::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EU
|
|||
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
||||
}
|
||||
|
||||
const CCollisionPrimitive* CWarWasp::GetCollisionPrimitive() const {
|
||||
return &x570_cSphere;
|
||||
}
|
||||
const CCollisionPrimitive* CWarWasp::GetCollisionPrimitive() const { return &x570_cSphere; }
|
||||
|
||||
void CWarWasp::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) {
|
||||
CPatterned::Death(mgr, direction, state);
|
||||
|
@ -186,9 +186,7 @@ void CWarWasp::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScri
|
|||
SwarmRemove(mgr);
|
||||
}
|
||||
|
||||
bool CWarWasp::IsListening() const {
|
||||
return true;
|
||||
}
|
||||
bool CWarWasp::IsListening() const { return true; }
|
||||
|
||||
bool CWarWasp::Listen(const zeus::CVector3f& pos, EListenNoiseType type) {
|
||||
switch (type) {
|
||||
|
@ -247,7 +245,7 @@ void CWarWasp::Patrol(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (maxSpeed > 0.f) {
|
||||
x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::FullSpeed);
|
||||
float speedFactor =
|
||||
x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Walk) * 0.9f / maxSpeed;
|
||||
x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Walk) * 0.9f / maxSpeed;
|
||||
x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(speedFactor, speedFactor);
|
||||
}
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||
|
@ -279,8 +277,9 @@ void CWarWasp::SetUpPathFindBehavior(CStateManager& mgr) {
|
|||
zeus::CVector3f delta = x2e0_destPos - aimPos;
|
||||
if (delta.canBeNormalized()) {
|
||||
zeus::CVector3f dir = delta.normalized();
|
||||
CRayCastResult res = mgr.RayStaticIntersection(aimPos, dir, delta.magnitude(),
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player}));
|
||||
CRayCastResult res = mgr.RayStaticIntersection(
|
||||
aimPos, dir, delta.magnitude(),
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player}));
|
||||
if (res.IsValid()) {
|
||||
SetDestPos(dir * res.GetT() * 0.5f + aimPos);
|
||||
x72e_29_pathObstructed = true;
|
||||
|
@ -306,13 +305,12 @@ void CWarWasp::ApplyNormalSteering(CStateManager& mgr) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(stepDir, pas::EStepType::Normal));
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Arrival(*this, teamPos, 3.f), zeus::CVector3f::skZero, 1.f));
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Arrival(*this, teamPos, 3.f), zeus::CVector3f::skZero, 1.f));
|
||||
zeus::CVector3f target = GetTranslation();
|
||||
target.z() = float(teamPos.z());
|
||||
zeus::CVector3f moveVec = x45c_steeringBehaviors.Arrival(*this, target, 3.f);
|
||||
if (moveVec.magSquared() > 0.01f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 3.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 3.f));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -326,7 +324,7 @@ void CWarWasp::ApplyNormalSteering(CStateManager& mgr) {
|
|||
case 2:
|
||||
if (ShouldTurn(mgr, 30.f) && delta.canBeNormalized()) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(zeus::CVector3f::skZero, delta.normalized(), 1.f));
|
||||
CBCLocomotionCmd(zeus::CVector3f::skZero, delta.normalized(), 1.f));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -348,8 +346,7 @@ void CWarWasp::ApplySeparationBehavior(CStateManager& mgr, float sep) {
|
|||
}
|
||||
zeus::CVector3f separation = x45c_steeringBehaviors.Separation(*this, ai->GetTranslation(), useSep);
|
||||
if (!separation.isZero()) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(separation, zeus::CVector3f::skZero, 1.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(separation, zeus::CVector3f::skZero, 1.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -387,8 +384,8 @@ bool CWarWasp::SteerToDeactivatePos(CStateManager& mgr, EStateMsg msg, float dt)
|
|||
float maxSpeed = x450_bodyController->GetBodyStateInfo().GetMaxSpeed();
|
||||
float minMoveFactor;
|
||||
if (maxSpeed > 0.f)
|
||||
minMoveFactor = x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(
|
||||
pas::ELocomotionAnim::Walk) * 0.5f / maxSpeed;
|
||||
minMoveFactor =
|
||||
x450_bodyController->GetBodyStateInfo().GetLocomotionSpeed(pas::ELocomotionAnim::Walk) * 0.5f / maxSpeed;
|
||||
else
|
||||
minMoveFactor = 1.f;
|
||||
float moveFactor = zeus::clamp(minMoveFactor, arrival1.magnitude(), 1.f);
|
||||
|
@ -403,8 +400,7 @@ bool CWarWasp::SteerToDeactivatePos(CStateManager& mgr, EStateMsg msg, float dt)
|
|||
if (GetSearchPath() && !PathShagged(mgr, 0.f) && !GetSearchPath()->IsOver()) {
|
||||
CPatterned::PathFind(mgr, msg, dt);
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 1.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 1.f));
|
||||
}
|
||||
} else {
|
||||
RemoveMaterial(EMaterialTypes::Solid, mgr);
|
||||
|
@ -412,11 +408,9 @@ bool CWarWasp::SteerToDeactivatePos(CStateManager& mgr, EStateMsg msg, float dt)
|
|||
target.z() = float(x3a0_latestLeashPosition.z());
|
||||
zeus::CVector3f arrival2 = x45c_steeringBehaviors.Arrival(*this, target, 2.5f);
|
||||
if (arrival2.magSquared() > 0.01f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(arrival2, zeus::CVector3f::skZero, 3.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(arrival2, zeus::CVector3f::skZero, 3.f));
|
||||
}
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 1.f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 1.f));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -425,8 +419,9 @@ bool CWarWasp::SteerToDeactivatePos(CStateManager& mgr, EStateMsg msg, float dt)
|
|||
zeus::CQuaternion q;
|
||||
q.rotateZ(zeus::degToRad(180.f));
|
||||
SetTranslation(GetTranslation() * 0.9f + x3a0_latestLeashPosition * 0.1f);
|
||||
SetTransform(zeus::CQuaternion::slerpShort(zeus::CQuaternion(GetTransform().basis), x6a0_initialRot * q, 0.1f).
|
||||
normalized().toTransform(GetTranslation()));
|
||||
SetTransform(zeus::CQuaternion::slerpShort(zeus::CQuaternion(GetTransform().basis), x6a0_initialRot * q, 0.1f)
|
||||
.normalized()
|
||||
.toTransform(GetTranslation()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -637,7 +632,7 @@ void CWarWasp::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x568_stateProg = 2;
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -700,7 +695,7 @@ void CWarWasp::Shuffle(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(stepDir, pas::EStepType::Normal));
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Seek(*this, shuffleDest), zeus::CVector3f::skZero, 1.f));
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Seek(*this, shuffleDest), zeus::CVector3f::skZero, 1.f));
|
||||
ApplySeparationBehavior(mgr, 15.f);
|
||||
}
|
||||
} else {
|
||||
|
@ -738,7 +733,7 @@ void CWarWasp::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
} else {
|
||||
SetDestPos(GetProjectileAimPos(mgr, -0.07f));
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCProjectileAttackCmd(pas::ESeverity::One, x2e0_destPos, false));
|
||||
CBCProjectileAttackCmd(pas::ESeverity::One, x2e0_destPos, false));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -828,8 +823,8 @@ void CWarWasp::SetUpCircleTelegraphTeam(CStateManager& mgr) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!rejoinInitial && (x70c_initialCircleAttackTeam != -1 ||
|
||||
targetUnitSize >= aimgr->GetMaxMeleeAttackerCount()))
|
||||
if (!rejoinInitial &&
|
||||
(x70c_initialCircleAttackTeam != -1 || targetUnitSize >= aimgr->GetMaxMeleeAttackerCount()))
|
||||
++teamUnit;
|
||||
JoinCircleAttackTeam(teamUnit, mgr);
|
||||
x714_circleTelegraphSeekHeight = mgr.GetActiveRandom()->Float() * -0.5f;
|
||||
|
@ -881,9 +876,7 @@ float CWarWasp::GetTeamZStratum(s32 team) {
|
|||
return 0.f;
|
||||
}
|
||||
|
||||
static const float Table[] = {
|
||||
0.4f, 0.6f, 1.f
|
||||
};
|
||||
static const float Table[] = {0.4f, 0.6f, 1.f};
|
||||
|
||||
float CWarWasp::CalcSeekMagnitude(CStateManager& mgr) {
|
||||
float ret = ((x708_circleAttackTeam >= 0 && x708_circleAttackTeam < 3) ? Table[x708_circleAttackTeam] : 1.f) * 0.9f;
|
||||
|
@ -897,8 +890,8 @@ float CWarWasp::CalcSeekMagnitude(CStateManager& mgr) {
|
|||
if (const CWarWasp* other = CPatterned::CastTo<CWarWasp>(mgr.GetObjectById(role.GetOwnerId()))) {
|
||||
if (x708_circleAttackTeam == other->x708_circleAttackTeam &&
|
||||
GetTransform().basis[1].dot(other->GetTranslation() - GetTranslation()) > 0.f) {
|
||||
float angle = zeus::CVector3f::getAngleDiff(
|
||||
fromPlatformCenter, other->GetTranslation() - x6b0_circleBurstPos);
|
||||
float angle =
|
||||
zeus::CVector3f::getAngleDiff(fromPlatformCenter, other->GetTranslation() - x6b0_circleBurstPos);
|
||||
if (angle < minAngle)
|
||||
minAngle = angle;
|
||||
}
|
||||
|
@ -957,8 +950,9 @@ void CWarWasp::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
moveVec = moveVec * -1.f;
|
||||
float seekHeight = x714_circleTelegraphSeekHeight + GetTeamZStratum(x708_circleAttackTeam);
|
||||
float seekMag = CalcSeekMagnitude(mgr);
|
||||
moveVec = x45c_steeringBehaviors.Seek(*this,
|
||||
seekOrigin + moveVec * 5.f + zeus::CVector3f(0.f, 0.f, seekHeight)) * seekMag;
|
||||
moveVec =
|
||||
x45c_steeringBehaviors.Seek(*this, seekOrigin + moveVec * 5.f + zeus::CVector3f(0.f, 0.f, seekHeight)) *
|
||||
seekMag;
|
||||
}
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(moveVec, zeus::CVector3f::skZero, 1.f));
|
||||
UpdateTelegraphMoveSpeed(mgr);
|
||||
|
@ -999,8 +993,8 @@ void CWarWasp::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
break;
|
||||
case EStateMsg::Update:
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Flee2D(
|
||||
*this, mgr.GetPlayer().GetTranslation().toVec2f()), zeus::CVector3f::skZero, 1.f));
|
||||
CBCLocomotionCmd(x45c_steeringBehaviors.Flee2D(*this, mgr.GetPlayer().GetTranslation().toVec2f()),
|
||||
zeus::CVector3f::skZero, 1.f));
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
x400_24_hitByPlayerProjectile = false;
|
||||
|
@ -1054,8 +1048,10 @@ bool CWarWasp::InAttackPosition(CStateManager& mgr, float arg) {
|
|||
bool ret = magSq > negTest * negTest && magSq < posTest * posTest && !ShouldTurn(mgr, 45.f);
|
||||
if (ret && delta.canBeNormalized()) {
|
||||
float deltaMag = delta.magnitude();
|
||||
ret = mgr.RayStaticIntersection(GetTranslation(), delta / deltaMag, deltaMag,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player})).IsInvalid();
|
||||
ret = mgr.RayStaticIntersection(
|
||||
GetTranslation(), delta / deltaMag, deltaMag,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Player}))
|
||||
.IsInvalid();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1063,7 +1059,8 @@ bool CWarWasp::InAttackPosition(CStateManager& mgr, float arg) {
|
|||
bool CWarWasp::Leash(CStateManager& mgr, float arg) {
|
||||
if ((x3a0_latestLeashPosition - GetTranslation()).magSquared() > x3c8_leashRadius * x3c8_leashRadius) {
|
||||
if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magSquared() >
|
||||
x3cc_playerLeashRadius * x3cc_playerLeashRadius && x3d4_curPlayerLeashTime > x3d0_playerLeashTime) {
|
||||
x3cc_playerLeashRadius * x3cc_playerLeashRadius &&
|
||||
x3d4_curPlayerLeashTime > x3d0_playerLeashTime) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1076,9 +1073,7 @@ bool CWarWasp::PathShagged(CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CWarWasp::AnimOver(CStateManager& mgr, float arg) {
|
||||
return x568_stateProg == 3;
|
||||
}
|
||||
bool CWarWasp::AnimOver(CStateManager& mgr, float arg) { return x568_stateProg == 3; }
|
||||
|
||||
bool CWarWasp::ShouldAttack(CStateManager& mgr, float arg) {
|
||||
if (x700_attackRemTime <= 0.f) {
|
||||
|
@ -1108,7 +1103,8 @@ bool CWarWasp::InPosition(CStateManager& mgr, float arg) {
|
|||
|
||||
bool CWarWasp::ShouldTurn(CStateManager& mgr, float arg) {
|
||||
return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(),
|
||||
(mgr.GetPlayer().GetTranslation() - GetTranslation()).toVec2f()) > zeus::degToRad(arg);
|
||||
(mgr.GetPlayer().GetTranslation() - GetTranslation()).toVec2f()) >
|
||||
zeus::degToRad(arg);
|
||||
}
|
||||
|
||||
bool CWarWasp::HearShot(CStateManager& mgr, float arg) {
|
||||
|
@ -1149,8 +1145,8 @@ bool CWarWasp::ShouldDodge(CStateManager& mgr, float arg) {
|
|||
if (mgr.GetPlayer().GetUniqueId() == proj->GetOwnerId()) {
|
||||
zeus::CVector3f delta = proj->GetTranslation() - GetTranslation();
|
||||
if (zeus::CVector3f::getAngleDiff(GetTransform().basis[1], delta) < zeus::degToRad(45.f)) {
|
||||
x704_dodgeDir = GetTransform().basis[0].dot(delta) > 0.f ?
|
||||
pas::EStepDirection::Right : pas::EStepDirection::Left;
|
||||
x704_dodgeDir =
|
||||
GetTransform().basis[0].dot(delta) > 0.f ? pas::EStepDirection::Right : pas::EStepDirection::Left;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1175,8 +1171,8 @@ bool CWarWasp::CheckCircleAttackSpread(CStateManager& mgr, s32 team) {
|
|||
if (wasp2->x708_circleAttackTeam == team) {
|
||||
if (leaderWasp->GetTransform().basis[1].dot(wasp2->GetTranslation() - leaderWasp->GetTranslation()) > 0.f)
|
||||
return false;
|
||||
float angle = zeus::CVector3f::getAngleDiff(wasp2->GetTranslation() - x6b0_circleBurstPos,
|
||||
platformToLeaderWasp);
|
||||
float angle =
|
||||
zeus::CVector3f::getAngleDiff(wasp2->GetTranslation() - x6b0_circleBurstPos, platformToLeaderWasp);
|
||||
if (angle > maxAng)
|
||||
maxAng = angle;
|
||||
}
|
||||
|
@ -1199,8 +1195,8 @@ bool CWarWasp::ShouldSpecialAttack(CStateManager& mgr, float arg) {
|
|||
zeus::CVector3f fromPlatformCenter = GetTranslation() - x6b0_circleBurstPos;
|
||||
zeus::CVector3f thresholdVec = x6bc_circleBurstDir;
|
||||
if (x718_circleBurstOffTotemAngle <= zeus::degToRad(90.f)) {
|
||||
thresholdVec = zeus::CVector3f::slerp(x6c8_circleBurstRight, x6bc_circleBurstDir,
|
||||
x718_circleBurstOffTotemAngle);
|
||||
thresholdVec =
|
||||
zeus::CVector3f::slerp(x6c8_circleBurstRight, x6bc_circleBurstDir, x718_circleBurstOffTotemAngle);
|
||||
} else {
|
||||
thresholdVec = zeus::CVector3f::slerp(x6bc_circleBurstDir, -x6c8_circleBurstRight,
|
||||
x718_circleBurstOffTotemAngle - zeus::degToRad(90.f));
|
||||
|
@ -1221,11 +1217,7 @@ bool CWarWasp::ShouldSpecialAttack(CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
CPathFindSearch* CWarWasp::GetSearchPath() {
|
||||
return &x590_pfSearch;
|
||||
}
|
||||
CPathFindSearch* CWarWasp::GetSearchPath() { return &x590_pfSearch; }
|
||||
|
||||
CProjectileInfo* CWarWasp::GetProjectileInfo() {
|
||||
return &x6d4_projectileInfo;
|
||||
}
|
||||
CProjectileInfo* CWarWasp::GetProjectileInfo() { return &x6d4_projectileInfo; }
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -67,6 +67,7 @@ class CWarWasp : public CPatterned {
|
|||
bool PathToHiveIsClear(CStateManager& mgr);
|
||||
bool SteerToDeactivatePos(CStateManager& mgr, EStateMsg msg, float dt);
|
||||
zeus::CVector3f CalcShuffleDest(CStateManager& mgr);
|
||||
|
||||
public:
|
||||
DEFINE_PATTERNED(WarWasp)
|
||||
CWarWasp(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
|
@ -84,8 +85,7 @@ public:
|
|||
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state);
|
||||
bool IsListening() const;
|
||||
bool Listen(const zeus::CVector3f&, EListenNoiseType);
|
||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
||||
const zeus::CVector3f& aimPos) const;
|
||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role, const zeus::CVector3f& aimPos) const;
|
||||
void UpdateTouchBounds();
|
||||
bool IsRetreating() const { return x72e_30_isRetreating; }
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "CScriptCoverPoint.hpp"
|
||||
#include "CScriptSpiderBallWaypoint.hpp"
|
||||
#include "CScriptDamageableTrigger.hpp"
|
||||
#include "MP1/World/CMetroid.hpp"
|
||||
#include "CScriptDebris.hpp"
|
||||
#include "CScriptDistanceFog.hpp"
|
||||
#include "CScriptDock.hpp"
|
||||
|
@ -116,6 +117,9 @@
|
|||
namespace urde {
|
||||
static logvisor::Module Log("urde::ScriptLoader");
|
||||
|
||||
#define UNIMPLEMENTED(name) \
|
||||
Log.report(logvisor::Warning, "Attempted to load unimplemented object '%s'", name);
|
||||
|
||||
static SObjectTag MorphballDoorANCS = {};
|
||||
|
||||
static const SObjectTag& GetMorphballDoorACS() {
|
||||
|
@ -1916,6 +1920,7 @@ CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadRipper(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("Ripper");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1932,6 +1937,7 @@ CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in,
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("AIKeyframe");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1950,11 +1956,33 @@ CEntity* ScriptLoader::LoadPointOfInterest(CStateManager& mgr, CInputStream& in,
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("Drone");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadMetroidAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
return nullptr;
|
||||
CEntity* ScriptLoader::LoadMetroid(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
if (!EnsurePropertyCount(propCount, MP1::CMetroidData::GetNumProperties(), "Metroid"))
|
||||
return nullptr;
|
||||
|
||||
std::string name = mgr.HashInstanceName(in);
|
||||
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
|
||||
zeus::CTransform xf = LoadEditorTransform(in);
|
||||
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
|
||||
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (!pair.first)
|
||||
return nullptr;
|
||||
|
||||
CPatternedInfo pInfo(in, pair.second);
|
||||
CActorParameters actParms = LoadActorParameters(in);
|
||||
MP1::CMetroidData metData(in);
|
||||
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
||||
if (!animParms.GetACSFile().IsValid() || flavor == CPatterned::EFlavorType::One)
|
||||
return nullptr;
|
||||
|
||||
CModelData mData(
|
||||
CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
|
||||
return new MP1::CMetroid(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, actParms, metData,
|
||||
kInvalidUniqueId);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadDebrisExtended(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
|
@ -2109,6 +2137,7 @@ CEntity* ScriptLoader::LoadEMPulse(CStateManager& mgr, CInputStream& in, int pro
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadIceSheegoth(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("IceSheegoth");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2156,6 +2185,7 @@ CEntity* ScriptLoader::LoadPlayerActor(CStateManager& mgr, CInputStream& in, int
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadFlaahgra(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("Flaahgra");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2338,6 +2368,7 @@ CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int pr
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadJellyZap(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("JellyZap");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2390,6 +2421,7 @@ CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& i
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("Thardus");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2456,6 +2488,7 @@ CEntity* ScriptLoader::LoadAiJumpPoint(CStateManager& mgr, CInputStream& in, int
|
|||
|
||||
CEntity* ScriptLoader::LoadFlaahgraTentacle(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("FlaahgraTentacle");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2524,6 +2557,7 @@ CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, i
|
|||
|
||||
CEntity* ScriptLoader::LoadThardusRockProjectile(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("ThardusRockProjectile");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2862,6 +2896,7 @@ CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("Oculus");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -3077,6 +3112,7 @@ CEntity* ScriptLoader::LoadAtomicBeta(CStateManager& mgr, CInputStream& in, int
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadIceZoomer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("IceZoomer");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -3269,6 +3305,7 @@ CEntity* ScriptLoader::LoadWorldLightFader(CStateManager& mgr, CInputStream& in,
|
|||
|
||||
CEntity* ScriptLoader::LoadMetroidPrimeStage2(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("MetroidPrimeStage2");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -3321,15 +3358,18 @@ CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int pr
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("OmegaPirate");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadPhazonPool(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("PhazonPool");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadPhazonHealingNodule(CStateManager& mgr, CInputStream& in, int propCount,
|
||||
const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("PhazonHealingNodule");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -3373,6 +3413,7 @@ CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in,
|
|||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadEnergyBall(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||
UNIMPLEMENTED("EnergyBall");
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace urde
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
static CEntity* LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadPointOfInterest(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadDrone(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadMetroidAlpha(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadMetroid(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadDebrisExtended(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadSteam(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
static CEntity* LoadRipple(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
|
||||
|
|
|
@ -124,8 +124,8 @@ std::string_view ScriptObjectTypeToStr(EScriptObjectType type) {
|
|||
return "PointOfInterest"sv;
|
||||
case EScriptObjectType::Drone:
|
||||
return "Drone"sv;
|
||||
case EScriptObjectType::MetroidAlpha:
|
||||
return "MetroidAlpha"sv;
|
||||
case EScriptObjectType::Metroid:
|
||||
return "Metroid"sv;
|
||||
case EScriptObjectType::DebrisExtended:
|
||||
return "DebrisExtended"sv;
|
||||
case EScriptObjectType::Steam:
|
||||
|
|
|
@ -64,7 +64,7 @@ enum class EScriptObjectType {
|
|||
AIKeyframe = 0x41,
|
||||
PointOfInterest = 0x42,
|
||||
Drone = 0x43,
|
||||
MetroidAlpha = 0x44,
|
||||
Metroid = 0x44,
|
||||
DebrisExtended = 0x45,
|
||||
Steam = 0x46,
|
||||
Ripple = 0x47,
|
||||
|
|
Loading…
Reference in New Issue