diff --git a/Runtime/Audio/CSfxManager.cpp b/Runtime/Audio/CSfxManager.cpp index 27b24b6ef..ae5a77bca 100644 --- a/Runtime/Audio/CSfxManager.cpp +++ b/Runtime/Audio/CSfxManager.cpp @@ -1,5 +1,6 @@ -#include "CSfxManager.hpp" -#include "CSimplePool.hpp" +#include "Runtime/Audio/CSfxManager.hpp" + +#include "Runtime/CSimplePool.hpp" namespace urde { static TLockedToken> mpSfxTranslationTableTok; diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index ba4ff9a2f..3b6611727 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -1,64 +1,56 @@ -#include "CStateManager.hpp" -#include "Camera/CCameraShakeData.hpp" -#include "Camera/CGameCamera.hpp" -#include "Graphics/CBooRenderer.hpp" -#include "World/CGameLight.hpp" -#include "CSortedLists.hpp" -#include "Weapon/CWeaponMgr.hpp" -#include "World/CFluidPlaneManager.hpp" -#include "World/CEnvFxManager.hpp" -#include "World/CActorModelParticles.hpp" -#include "World/CTeamAiTypes.hpp" -#include "World/CScriptPlayerActor.hpp" -#include "Input/CRumbleManager.hpp" -#include "World/CWorld.hpp" -#include "Graphics/CLight.hpp" -#include "GameGlobalObjects.hpp" -#include "CSimplePool.hpp" -#include "CPlayerState.hpp" -#include "CGameState.hpp" -#include "World/CPlayer.hpp" -#include "Weapon/CPlayerGun.hpp" -#include "World/CMorphBall.hpp" -#include "World/CScriptSpawnPoint.hpp" -#include "AutoMapper/CMapWorldInfo.hpp" -#include "Particle/CGenDescription.hpp" -#include "CMemoryCardSys.hpp" -#include "TCastTo.hpp" // Generated file, do not modify include path -#include "World/CScriptSpecialFunction.hpp" -#include "CTimeProvider.hpp" -#include "Camera/CBallCamera.hpp" -#include "Collision/CMaterialFilter.hpp" -#include "World/CScriptDock.hpp" -#include "Particle/CDecalManager.hpp" -#include "Particle/CParticleElectric.hpp" -#include "World/CProjectedShadow.hpp" -#include "Weapon/CProjectileWeapon.hpp" -#include "World/CScriptEffect.hpp" -#include "MP1/CSamusHud.hpp" -#include "Collision/CGameCollision.hpp" -#include "World/CScriptPlatform.hpp" -#include "World/CScriptRoomAcoustics.hpp" -#include "Weapon/CWeapon.hpp" -#include "World/CWallCrawlerSwarm.hpp" -#include "World/CSnakeWeedSwarm.hpp" -#include "Collision/CCollidableSphere.hpp" -#include "zeus/CMRay.hpp" -#include "Collision/CollisionUtil.hpp" -#include "World/CScriptWater.hpp" -#include "World/CScriptDoor.hpp" -#include "Input/ControlMapper.hpp" -#include "MP1/MP1.hpp" -#include "GameGlobalObjects.hpp" -#include "World/CScriptDoor.hpp" -#include "World/CScriptDamageableTrigger.hpp" -#include "World/CScriptDebris.hpp" -#include "hecl/CVarManager.hpp" -#include "World/CPatterned.hpp" -#include "World/CDestroyableRock.hpp" -#include "World/CPathFindSearch.hpp" +#include "Runtime/CStateManager.hpp" + #include +#include "Runtime/AutoMapper/CMapWorldInfo.hpp" +#include "Runtime/Camera/CBallCamera.hpp" +#include "Runtime/Camera/CCameraShakeData.hpp" +#include "Runtime/Camera/CGameCamera.hpp" +#include "Runtime/CGameState.hpp" +#include "Runtime/CMemoryCardSys.hpp" +#include "Runtime/Collision/CCollidableSphere.hpp" +#include "Runtime/Collision/CGameCollision.hpp" +#include "Runtime/Collision/CMaterialFilter.hpp" +#include "Runtime/Collision/CollisionUtil.hpp" +#include "Runtime/CPlayerState.hpp" +#include "Runtime/CSortedLists.hpp" +#include "Runtime/CTimeProvider.hpp" +#include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/Graphics/CBooRenderer.hpp" +#include "Runtime/Graphics/CLight.hpp" +#include "Runtime/Input/ControlMapper.hpp" +#include "Runtime/Input/CRumbleManager.hpp" +#include "Runtime/MP1/CSamusHud.hpp" +#include "Runtime/MP1/MP1.hpp" +#include "Runtime/Particle/CDecalManager.hpp" +#include "Runtime/Particle/CParticleElectric.hpp" +#include "Runtime/Weapon/CProjectileWeapon.hpp" +#include "Runtime/Weapon/CWeapon.hpp" +#include "Runtime/Weapon/CWeaponMgr.hpp" +#include "Runtime/World/CDestroyableRock.hpp" +#include "Runtime/World/CGameLight.hpp" +#include "Runtime/World/CPathFindSearch.hpp" +#include "Runtime/World/CPatterned.hpp" +#include "Runtime/World/CPlayer.hpp" +#include "Runtime/World/CProjectedShadow.hpp" +#include "Runtime/World/CScriptDebris.hpp" +#include "Runtime/World/CScriptDock.hpp" +#include "Runtime/World/CScriptDoor.hpp" +#include "Runtime/World/CScriptEffect.hpp" +#include "Runtime/World/CScriptPlatform.hpp" +#include "Runtime/World/CScriptPlayerActor.hpp" +#include "Runtime/World/CScriptRoomAcoustics.hpp" +#include "Runtime/World/CScriptSpawnPoint.hpp" +#include "Runtime/World/CScriptSpecialFunction.hpp" +#include "Runtime/World/CScriptWater.hpp" +#include "Runtime/World/CSnakeWeedSwarm.hpp" +#include "Runtime/World/CWallCrawlerSwarm.hpp" +#include "Runtime/World/CWorld.hpp" +#include "TCastTo.hpp" // Generated file, do not modify include path + +#include +#include + namespace urde { hecl::CVar* sm_logScripting = nullptr; logvisor::Module LogModule("urde::CStateManager"); diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 7788d4f59..dba68ec77 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -49,7 +49,6 @@ class CProjectedShadow; class CRelayTracker; class CRumbleManager; class CSortedListManager; -class CTeamAiTypes; class CTexture; class CWorld; class CWorldLayerState; diff --git a/Runtime/Collision/CCollidableSphere.hpp b/Runtime/Collision/CCollidableSphere.hpp index 564aef075..c0ed240ce 100644 --- a/Runtime/Collision/CCollidableSphere.hpp +++ b/Runtime/Collision/CCollidableSphere.hpp @@ -23,6 +23,7 @@ public: const zeus::CSphere& GetSphere() const { return x10_sphere; } void SetSphereCenter(const zeus::CVector3f& center) { x10_sphere.position = center; } + void SetSphereRadius(float radius) { x10_sphere.radius = radius; } zeus::CSphere Transform(const zeus::CTransform& xf) const; u32 GetTableIndex() const override; diff --git a/Runtime/Collision/CCollisionActor.cpp b/Runtime/Collision/CCollisionActor.cpp index 1e7fe6740..f0559c7f4 100644 --- a/Runtime/Collision/CCollisionActor.cpp +++ b/Runtime/Collision/CCollisionActor.cpp @@ -169,4 +169,12 @@ void CCollisionActor::Touch(CActor& actor, CStateManager& mgr) { } zeus::CVector3f CCollisionActor::GetOrbitPosition(const CStateManager&) const { return GetTouchBounds()->center(); } + +void CCollisionActor::SetSphereRadius(float radius) { + if (x258_primitiveType != EPrimitiveType::Sphere) + return; + + x288_sphereRadius = radius; + x284_spherePrimitive->SetSphereRadius(radius); +} } // namespace urde diff --git a/Runtime/Collision/CCollisionActor.hpp b/Runtime/Collision/CCollisionActor.hpp index 03ba11c9c..4b356f02b 100644 --- a/Runtime/Collision/CCollisionActor.hpp +++ b/Runtime/Collision/CCollisionActor.hpp @@ -60,6 +60,7 @@ public: TUniqueId GetLastTouchedObject() const { return x2fc_lastTouched; } zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager&) const override; void SetExtendedTouchBounds(const zeus::CVector3f& boundExt) { x304_extendedTouchBounds = boundExt; } + void SetSphereRadius(float radius); float GetSphereRadius() const { return x288_sphereRadius; } }; } // namespace urde diff --git a/Runtime/MP1/World/CRidley.cpp b/Runtime/MP1/World/CRidley.cpp index 7bbde3db0..20c8e2974 100644 --- a/Runtime/MP1/World/CRidley.cpp +++ b/Runtime/MP1/World/CRidley.cpp @@ -1,23 +1,125 @@ #include "Runtime/MP1/World/CRidley.hpp" + #include "Runtime/Character/CPASAnimParmData.hpp" #include "Runtime/Collision/CCollisionActor.hpp" +#include "Runtime/CSimplePool.hpp" +#include "Runtime/CStateManager.hpp" +#include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Graphics/CBooRenderer.hpp" #include "Runtime/Particle/CElementGen.hpp" #include "Runtime/Particle/CParticleElectric.hpp" #include "Runtime/Particle/CParticleSwoosh.hpp" #include "Runtime/Weapon/CGameProjectile.hpp" +#include "Runtime/Weapon/CEnergyProjectile.hpp" +#include "Runtime/Weapon/CPlasmaProjectile.hpp" +#include "Runtime/World/CExplosion.hpp" #include "Runtime/World/CPlayer.hpp" #include "Runtime/World/CScriptPlatform.hpp" #include "Runtime/World/CScriptWaypoint.hpp" -#include "Runtime/CSimplePool.hpp" -#include "Runtime/CStateManager.hpp" -#include "Runtime/GameGlobalObjects.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace urde { namespace MP1 { namespace { +struct SSomeRidleyStruct { + u32 x0_; + u32 x4_; + float x8_; + float xc_; + float x10_; + float x14_; + float x18_; + u32 x1c_; + u8 x20_; + u8 x21_; + u8 x22_; + u8 x23_; +}; + +struct SSomeRidleyStruct2 { + s32 x0_; + float x4_; + s32 x8_; +}; + +std::array, 5> skSomeRidleyStruct{{ + {{ + {0, 100.f, -1}, + {3, 100.f, -1}, + {2, 100.f, -1}, + {3, 50.f, 4}, + {0, 100.f, -1}, + {3, 100.f, -1}, + {2, 100.f, -1}, + {3, 50.f, 4}, + {5, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + }}, + {{ + {5, 100.f, -1}, + {1, 100.f, -1}, + {1, 100.f, -1}, + {1, 50.f, -1}, + {1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 50.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + }}, + {{ + {5, 100.f, -1}, + {0, 100.f, -1}, + {0, 50.f, 4}, + {2, 100.f, -1}, + {3, 50.f, 5}, + {2, 100.f, -1}, + {3, 50.f, 4}, + {0, 100.f, -1}, + {2, 50.f, 3}, + {2, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + }}, + {{ + {5, 100.f, -1}, + {1, 100.f, -1}, + {1, 100.f, -1}, + {1, 100.f, -1}, + {1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + }}, + {{ + {5, 100.f, -1}, + {0, 100.f, -1}, + {0, 50.f, 3}, + {3, 100.f, -1}, + {0, 50.f, 3}, + {2, 100.f, -1}, + {2, 50.f, 4}, + {0, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + {-1, 100.f, -1}, + }}, +}}; +std::array skSomeStruct{{{4, 6, 50.f, 50.f, 0.f, 33.f, 0.f, 1, 0, 0, 0, 0}, + {4, 6, 20.f, 20.f, 60.f, 50.f, 0.f, 2, 0, 0, 0, 0}, + {4, 6, 40.f, 40.f, 20.f, 50.f, 50.f, 2, 1, 0, 0, 0}, + {3, 5, 10.f, 15.f, 75.f, 100.f, 25.f, 2, 0, 0, 0, 0}, + {3, 5, 30.f, 30.f, 40.f, 50.f, 50.f, 2, 1, 0, 0, 0}}}; std::array skWingBones{ "L_wingBone1_1"sv, "L_wingBone1_2"sv, "L_wingBone2_1"sv, "L_wingBone2_2"sv, "L_wingBone3_1"sv, "L_wingBone3_2"sv, "L_wingFlesh1_1"sv, "L_wingFlesh1_2"sv, "L_wingFlesh2_1"sv, "L_wingFlesh2_2"sv, @@ -135,7 +237,7 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info, , xa32_24_(false) , xa32_25_(false) , xa32_26_(false) -, xa32_28_(false) +, xa32_28_shotAt(false) , xa32_29_(false) , xa32_31_(true) , xa33_24_(false) @@ -143,7 +245,7 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info, , xa33_26_(false) , xa33_27_(true) , xa33_28_(false) -, xa33_29_(false) +, xa33_29_doStrafe(false) , xa33_30_(false) , xa33_31_(false) , xa34_24_(false) @@ -179,7 +281,7 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info, const auto& animData = GetModelData()->GetAnimationData(); for (size_t i = 0; i < skWingBones.size(); ++i) { - xce4_.push_back(animData->GetLocatorSegId(skWingBones[i])); + xce4_wingBoneIds.push_back(animData->GetLocatorSegId(skWingBones[i])); } xae4_ = GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(4), CPASAnimParm::FromEnum(3))); @@ -189,7 +291,6 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info, x460_knockBackController.SetEnableBurnDeath(false); x460_knockBackController.SetEnableLaggedBurnDeath(false); CreateShadow(false); - SetActive(true); } void CRidley::SetupCollisionActorManager(urde::CStateManager& mgr) { @@ -203,7 +304,7 @@ void CRidley::SetupCollisionActorManager(urde::CStateManager& mgr) { CJointCollisionDescription::EOrientationType::One, std::string(GetName()) + " - CollisionActor " + jInfo.from, 10.f)); } - x980_ = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false); + x980_tailCollision = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false); joints.clear(); joints.reserve(skSphereJoints.size()); for (const auto& jInfo : skSphereJoints) { @@ -211,21 +312,30 @@ void CRidley::SetupCollisionActorManager(urde::CStateManager& mgr) { CJointCollisionDescription::SphereCollision(animData->GetLocatorSegId(jInfo.name), jInfo.radius, std::string(GetName()) + " - CollisionActor " + jInfo.name, 10.f)); } - x984_ = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false); - x988_headId = x984_->GetCollisionDescFromIndex(3).GetCollisionActorId(); - x98a_breastPlateId = x984_->GetCollisionDescFromIndex(2).GetCollisionActorId(); + x984_bodyCollision = std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), joints, false); + x988_headId = x984_bodyCollision->GetCollisionDescFromIndex(3).GetCollisionActorId(); + x98a_breastPlateId = x984_bodyCollision->GetCollisionDescFromIndex(2).GetCollisionActorId(); SetupCollisionActors(mgr); - /* Something something material filter */ + CMaterialList exclude = GetMaterialFilter().GetExcludeList(); + CMaterialList include = GetMaterialFilter().GetIncludeList(); + exclude.Add(EMaterialTypes::Solid); + include.Remove(EMaterialTypes::Solid); + exclude.Add(EMaterialTypes::CollisionActor); + include.Remove(EMaterialTypes::CollisionActor); + exclude.Add(EMaterialTypes::AIPassthrough); + include.Remove(EMaterialTypes::AIPassthrough); + exclude.Add(EMaterialTypes::Player); + include.Remove(EMaterialTypes::Player); + exclude.Add(EMaterialTypes::Platform); + include.Remove(EMaterialTypes::Platform); + SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude)); AddMaterial(EMaterialTypes::ProjectilePassthrough); - /* Flip Ridley around for debugging */ - x34_transform.rotateLocalZ(zeus::degToRad(180.f)); - /* Move ridley to more convenient spot */ - x34_transform.origin = zeus::CVector3f(-356.635315, 30.963602, -38.032295); + // mgr.SendScriptMsg(this, GetUniqueId(), EScriptObjectMessage::Reset); } void CRidley::SetupCollisionActors(CStateManager& mgr) { - for (size_t i = 0; i < x980_->GetNumCollisionActors(); ++i) { - const auto& colDesc = x980_->GetCollisionDescFromIndex(i); + for (size_t i = 0; i < x980_tailCollision->GetNumCollisionActors(); ++i) { + const auto& colDesc = x980_tailCollision->GetCollisionDescFromIndex(i); if (TCastToPtr colAct = mgr.ObjectById(colDesc.GetCollisionActorId())) { colAct->SetDamageVulnerability(CDamageVulnerability::ImmuneVulnerabilty()); colAct->HealthInfo(mgr)->SetHP(1000.f); @@ -234,10 +344,10 @@ void CRidley::SetupCollisionActors(CStateManager& mgr) { } } - x980_->AddMaterial(mgr, {EMaterialTypes::AIJoint}); + x980_tailCollision->AddMaterial(mgr, {EMaterialTypes::AIJoint}); - for (size_t i = 0; i < x984_->GetNumCollisionActors(); ++i) { - const auto& colDesc = x984_->GetCollisionDescFromIndex(i); + for (size_t i = 0; i < x984_bodyCollision->GetNumCollisionActors(); ++i) { + const auto& colDesc = x984_bodyCollision->GetCollisionDescFromIndex(i); if (TCastToPtr colAct = mgr.ObjectById(colDesc.GetCollisionActorId())) { colAct->SetDamageVulnerability(CDamageVulnerability::NormalVulnerabilty()); colAct->HealthInfo(mgr)->SetHP(1000.f); @@ -245,7 +355,7 @@ void CRidley::SetupCollisionActors(CStateManager& mgr) { colAct->SetWeaponCollisionResponseType(EWeaponCollisionResponseTypes::EnemyNormal); } } - x984_->AddMaterial(mgr, {EMaterialTypes::AIJoint}); + x984_bodyCollision->AddMaterial(mgr, {EMaterialTypes::AIJoint}); } void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { @@ -276,17 +386,17 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan break; } case EScriptObjectMessage::Deactivate: { - x984_->SetActive(mgr, false); - x980_->SetActive(mgr, false); + x984_bodyCollision->SetActive(mgr, false); + x980_tailCollision->SetActive(mgr, false); mgr.GetPlayer().SetIsOverrideRadarRadius(false); break; } case EScriptObjectMessage::Deleted: { - x984_->Destroy(mgr); - x980_->Destroy(mgr); - if (xb64_ != kInvalidUniqueId) { - mgr.FreeScriptObject(xb64_); - xb64_ = kInvalidUniqueId; + x984_bodyCollision->Destroy(mgr); + x980_tailCollision->Destroy(mgr); + if (xb64_plasmaProjectile != kInvalidUniqueId) { + mgr.FreeScriptObject(xb64_plasmaProjectile); + xb64_plasmaProjectile = kInvalidUniqueId; } break; } @@ -301,7 +411,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan xab4_ = (wpNext->GetTranslation() - wp->GetTranslation()).toVec2f().magnitude(); xab8_ = wpNext->GetTranslation().z() - xa84_.origin.z(); if (TCastToConstPtr wpNextNext = mgr.GetObjectById(wp->NextWaypoint(mgr))) { - xabc_ = (wpNextNext->GetTranslation() - xa84_.origin).toVec2f().magnitude(); + xabc_ = (wpNextNext->GetTranslation().toVec2f() - xa84_.origin.toVec2f()).magnitude(); xac0_ = wpNextNext->GetTranslation().z() - xa84_.origin.z(); xac4_ = zeus::CAABox(xa84_.origin - zeus::CVector3f(xabc_, xabc_, 10.f), xa84_.origin + zeus::CVector3f(xabc_, xabc_, 100.f)); @@ -374,7 +484,7 @@ void CRidley::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan x430_damageColor = zeus::CColor(0.5f, 0.f, 0.f); if (xb10_ <= 0.f) { xa32_29_ = false; - xa32_28_ = true; + xa32_28_shotAt = true; xb14_ = x568_data.x38_; } } @@ -474,8 +584,8 @@ void CRidley::Think(float dt, CStateManager& mgr) { sub802560d0(dt); CPatterned::Think(dt, mgr); sub802563a8(dt); - x984_->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); - x980_->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); + x984_bodyCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); + x980_tailCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); xb20_ = std::max(0.f, xb20_ - dt); xb24_ = std::max(0.f, xb24_ - dt); xcc8_ = std::max(0.f, xcc8_ - dt); @@ -487,17 +597,28 @@ void CRidley::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { CPatterned::PreRender(mgr, frustum); xb2c_.PreRender(mgr, *GetModelData()->GetAnimationData(), x34_transform, GetModelData()->GetScale(), *x450_bodyController); - u32 r27 = xc74_; + u32 matSet = xc74_; if (xcc8_ > 0.f) { - r27 = (30.f * xcc8_) - GetModelData()->GetNumMaterialSets(); + u32 numMaterialSets = GetModelData()->GetNumMaterialSets(); + u32 tmp = (30.f * xcc8_); + matSet = tmp - (tmp / numMaterialSets) * numMaterialSets; } CPlayerState::EPlayerVisor r28 = mgr.GetPlayerState()->GetActiveVisor(mgr); - u32 r3 = GetModelData()->GetNumMaterialSets(); - u32 r0 = r27 + 1; - r0 = r3 - r0; - bool r31 = zeus::PopCount(r0) >> 5; + if (r28 == CPlayerState::EPlayerVisor::Thermal && GetModelData()->GetNumMaterialSets() == (matSet + 1)) + xb4_drawFlags.x2_flags |= 0x40; + else + xb4_drawFlags.x2_flags &= 0x40; + xb4_drawFlags.x1_matSetIdx = matSet; + + if (xa33_27_) { + float zDiff = std::max(0.f, GetTranslation().z() - xa84_.origin.z()); + // xccc_ = 1.f + zeus::Clamp() + } else { + xd10_->Unset_X80(); + } } + void CRidley::Render(const CStateManager& mgr) const { CPatterned::Render(mgr); } void CRidley::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const { CPatterned::AddToRenderer(frustum, mgr); @@ -505,9 +626,207 @@ void CRidley::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& g_Renderer->AddParticleGen(*xce0_); } } +void CRidley::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) { + switch (type) { + case EUserEventType::Projectile: { + if (xc64_aiStage != 2) + return; + + if (!xc14_.Token().IsLoaded()) { + xc14_.Token().GetObj(); + return; + } + + if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 9)) + return; + zeus::CTransform xf = GetLctrTransform(xa30_breastPlateSegId) * zeus::CTransform::RotateX(zeus::degToRad(-90.f)); + xf = xf * zeus::CTransform::RotateY( + std::atan2(mgr.GetActiveRandom()->Range(-1.f, 1.f), mgr.GetActiveRandom()->Range(-1.f, 1.f))); + xf.origin = xf * zeus::CVector3f(0.f, 1.f, 1.f); + CEnergyProjectile* proj = + new CEnergyProjectile(true, xc14_.Token(), EWeaponType::AI, xf, EMaterialTypes::Character, xc14_.GetDamage(), + mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(), mgr.GetPlayer().GetUniqueId(), + EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false); + mgr.AddObject(proj); + proj->SetCameraShake(x568_data.xcc_); + return; + } + case EUserEventType::EggLay: { + if (xa32_24_) { + + if (!xc3c_.Token().IsLoaded()) { + xc3c_.Token().GetObj(); + break; + } + + if (!mgr.CanCreateProjectile(GetUniqueId(), EWeaponType::AI, 6)) + break; + + zeus::CVector3f vec = + zeus::CVector3f(mgr.GetActiveRandom()->Range(-1.f, 1.f), 1.f, mgr.GetActiveRandom()->Range(-1.f, 1.f)); + vec = GetLctrTransform(xa30_breastPlateSegId) * vec; + + CEnergyProjectile* proj = new CEnergyProjectile( + true, xc3c_.Token(), EWeaponType::AI, zeus::lookAt(vec + mgr.GetPlayer().GetTranslation(), vec), + EMaterialTypes::Character, xc3c_.GetDamage(), mgr.AllocateUniqueId(), GetAreaIdAlways(), GetUniqueId(), + mgr.GetPlayer().GetUniqueId(), EProjectileAttrib::None, false, zeus::skOne3f, {}, -1, false); + + mgr.AddObject(proj); + proj->SetCameraShake(x568_data.xcc_); + } else if (xc64_aiStage == 3) { + xa31_27_ = false; + } + break; + } + case EUserEventType::DamageOn: { + if (xc64_aiStage == 3) { + sub8025784c(mgr); + } else if (xc64_aiStage == 2) + xa33_28_ = false; + + break; + } + case EUserEventType::DamageOff: { + if (xc64_aiStage == 3) { + sub80257650(mgr); + } else if (xc64_aiStage == 2 && !xa33_31_) + xa33_28_ = true; + + break; + } + case EUserEventType::Landing: { + SetVelocityWR(zeus::skDown); + xaec_.zeroOut(); + xaf8_.zeroOut(); + break; + } + case EUserEventType::FadeOut: { + xc74_ = std::min(GetModelData()->GetNumMaterialSets(), xc74_ + 1); + return; + } + case EUserEventType::ScreenShake: { + if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() >= x568_data.x388_) + break; + mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x568_data.x298_, + CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {}); + break; + } + case EUserEventType::BeginAction: { + if (xa32_25_ && !xa31_29_) + FirePlasma(mgr); + + if (!xa31_31_ || !xa32_26_) + break; + + xbf0_ = xa84_.basis[0]; + zeus::CVector3f ourPos = GetTranslation(); + if ((ourPos - xa84_.origin).dot(xbf0_) >= 30.f) { + xbf0_ *= zeus::CVector3f(-1.f); + } + xbfc_ = xbf0_; + xbe4_ = xa84_.origin - xabc_ * xbf0_; + xbe4_ *= zeus::CVector3f((mgr.GetPlayer().GetTranslation() - xa84_.origin).dot(xa84_.basis[1])); + break; + } + case EUserEventType::EndAction: { + if (xa31_29_) + ResetPlasmaProjectile(mgr, false); + break; + } + case EUserEventType::IkLock: { + xa32_26_ = true; + break; + } + case EUserEventType::IkRelease: { + xa32_26_ = false; + break; + } + case EUserEventType::BreakLockOn: { + if (x400_25_alive) { + RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); + mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr); + return; + } + break; + } + case EUserEventType::SoundPlay: { + if (xa32_25_) + break; + + xcac_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.x294_, 127, 63, false, 127}, true, + -1, false, kInvalidAreaId); + break; + } + default: + break; + } + + CPatterned::DoUserAnimEvent(mgr, node, type, dt); +} + +void CRidley::sub8025784c(CStateManager& mgr) { + for (size_t i = 0; i < x984_bodyCollision->GetNumCollisionActors(); ++i) { + const auto& colDesc = x984_bodyCollision->GetCollisionDescFromIndex(i); + if (TCastToPtr colAct = mgr.ObjectById(colDesc.GetCollisionActorId())) { + colAct->SetDamageVulnerability(CDamageVulnerability::ImmuneVulnerabilty()); + colAct->HealthInfo(mgr)->SetHP(1000.f); + colAct->CreateShadow(true); + } + } + + xa32_29_ = true; + xa31_27_ = false; +} + +void CRidley::sub80255d58(urde::CStateManager& mgr) { + const auto& someVal = skSomeRidleyStruct[xcb0_][xcb4_]; + xb04_ = someVal.x4_ < mgr.GetActiveRandom()->Range(0.f, 100.f) ? someVal.x8_ : someVal.x0_; + if (xb04_ == -1) { + xcb4_ = 0; + const auto& someVal2 = skSomeRidleyStruct[xcb0_][xcb4_]; + xb04_ = someVal.x4_ < mgr.GetActiveRandom()->Range(0.f, 100.f) ? someVal2.x8_ : someVal2.x0_; + } + + ++xcb4_; + xcc4_ = 1; +} + +void CRidley::sub80257744(urde::CStateManager& mgr) { + for (size_t i = 0; i < x984_bodyCollision->GetNumCollisionActors(); ++i) { + const auto& colDesc = x984_bodyCollision->GetCollisionDescFromIndex(i); + if (TCastToPtr colAct = mgr.ObjectById(colDesc.GetCollisionActorId())) { + colAct->SetDamageVulnerability(i == 2 ? CDamageVulnerability::ImmuneVulnerabilty() + : CDamageVulnerability::NormalVulnerabilty()); + colAct->HealthInfo(mgr)->SetHP(1000.f); + colAct->CreateShadow(true); + } + } + + xa32_29_ = false; + xa31_27_ = true; +} + +void CRidley::FirePlasma(urde::CStateManager& mgr) { + if (xb64_plasmaProjectile == kInvalidUniqueId) { + xb64_plasmaProjectile = mgr.AllocateUniqueId(); + mgr.AddObject(new CPlasmaProjectile(xb68_.Token(), ""sv, EWeaponType::AI, x568_data.x64_, {}, + EMaterialTypes::Character, xb68_.GetDamage(), xb64_plasmaProjectile, + GetAreaIdAlways(), GetUniqueId(), CPlasmaProjectile::PlayerEffectResoures(), + false, EProjectileAttrib::KeepInCinematic)); + } + + if (CPlasmaProjectile* proj = static_cast(mgr.ObjectById(xb64_plasmaProjectile))) { + proj->Fire(GetLctrTransform(xb91_mouthSegId), mgr, false); + if (!xca8_) { + xca8_ = CSfxManager::AddEmitter({GetTranslation(), {}, 1000.f, 0.1f, 1, x568_data.xa8_, 127, 63, false, 127}, + true, -1, true, -1); + } + } +} + void CRidley::sub80257650(CStateManager& mgr) { - for (size_t i = 0; i < x984_->GetNumCollisionActors(); ++i) { - const auto& colDesc = x984_->GetCollisionDescFromIndex(i); + for (size_t i = 0; i < x984_bodyCollision->GetNumCollisionActors(); ++i) { + const auto& colDesc = x984_bodyCollision->GetCollisionDescFromIndex(i); if (TCastToPtr colAct = mgr.ObjectById(colDesc.GetCollisionActorId())) { colAct->SetDamageVulnerability(CDamageVulnerability::ImmuneVulnerabilty()); colAct->HealthInfo(mgr)->SetHP(1000.f); @@ -525,6 +844,7 @@ void CRidley::sub80256914(float f31, bool r4) { } xd08_ = r4 ? 2.f * f31 : f31; + xa32_30_ = r4; if (!xd0c_) { xd0c_ = CSfxManager::AddEmitter( CAudioSys::C3DEmitterParmData{GetTranslation(), zeus::skZero3f, 500.f, 0.1f, 1, 0, 127, 63, false, 127}, true, @@ -559,12 +879,123 @@ void CRidley::sub802563a8(float dt) { MoveToInOneFrameWR(GetTranslation() - posDiff, dt); } } -void CRidley::sub80256b14(float dt, CStateManager& mgr) {} -void CRidley::sub80256624(float dt, CStateManager& mgr) {} -void CRidley::Patrol(CStateManager& mgr, EStateMsg msg, float arg) { CPatterned::Patrol(mgr, msg, arg); } -void CRidley::Dead(CStateManager& mgr, EStateMsg msg, float arg) { CPatterned::Dead(mgr, msg, arg); } -void CRidley::Generate(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Generate(mgr, msg, arg); } -void CRidley::Attack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Attack(mgr, msg, arg); } + +void CRidley::sub80256b14(float dt, CStateManager& mgr) { + if (CPlasmaProjectile* proj = static_cast(mgr.ObjectById(xb64_plasmaProjectile))) { + if (!proj->GetActive()) + return; + + zeus::CTransform mouthXf = GetLctrTransform(xb91_mouthSegId); + if (xc64_aiStage == 3) { + proj->UpdateFx(mouthXf, dt, mgr); + } else { + zeus::CTransform xf = zeus::lookAt(xf.origin, xbe4_); + float d; + if (xbf0_.cross(zeus::skUp).dot(mgr.GetPlayer().GetTranslation() + zeus::skUp) <= 0.f) + d = xc10_; + else + d = -xc10_; + + zeus::CQuaternion quat; + quat.rotateZ(zeus::degToRad(dt * d)); + zeus::CVector3f vec = quat.transform(xbf0_); + float dist = xbfc_.dot(vec); + if (dist > 0.5f || xbfc_.dot(xbfc_) < dist) { + xbf0_ = vec; + } + } + } + + if (xca8_) { + CSfxManager::UpdateEmitter(xca8_, GetTranslation(), {}, 1.f); + } +} + +void CRidley::sub80256624(float dt, CStateManager& mgr) { + if (xce0_) { + xce0_->SetGlobalOrientation(GetTransform().getRotation()); + xce0_->SetGlobalTranslation(GetTranslation()); + xce0_->SetGlobalScale(GetModelData()->GetScale()); + + if (xce0_->GetParticleEmission()) { + xd08_ -= dt; + + if (xd08_ <= 0.f) { + xce0_->SetParticleEmission(false); + if (xd0c_) { + CSfxManager::RemoveEmitter(xd0c_); + xd0c_.reset(); + } + } else { + xce0_->SetOverrideIPos( + GetModelData()->GetAnimationData()->GetLocatorTransform(xa30_breastPlateSegId, nullptr).origin); + s32 min = 0; + s32 max = xce4_wingBoneIds.size() - 1; + if (xa32_30_) + max = xce4_wingBoneIds.size() - 6; + else + min = xce4_wingBoneIds.size() - 12; + zeus::CTransform xf = GetModelData()->GetAnimationData()->GetLocatorTransform( + xce4_wingBoneIds[mgr.GetActiveRandom()->Range(min, max)], nullptr); + xce0_->SetOverrideFPos(xf.origin); + xce0_->ForceParticleCreation(1); + } + } + xce0_->Update(dt); + } else if (xd0c_) { + CSfxManager::RemoveEmitter(xd0c_); + xd0c_.reset(); + } + + if (xd0c_) + CSfxManager::UpdateEmitter(xd0c_, GetTranslation(), {}, 1.f); +} + +void CRidley::Patrol(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg != EStateMsg::Activate) + return; + sub80255d58(mgr); + xa32_27_ = false; + xa33_26_ = true; +} +void CRidley::Dead(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg != EStateMsg::Activate) + return; + mgr.SetBossParams(kInvalidUniqueId, 0.f, 0); +} +void CRidley::Generate(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg != EStateMsg::Activate) + return; + + xa34_26_ = false; + SetTranslation(xa84_ * zeus::CVector3f(0.f, xabc_, xac0_ - xadc_)); + x450_bodyController->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState)); +} + +void CRidley::Attack(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + xbe4_ = (GetTranslation() + zeus::skUp) - (8.f * GetTransform().basis[0]); + xbfc_ = xbf0_ = GetTransform().basis[0]; + xc08_ = xc0c_ = xc10_ = 0.f; + x32c_animState = EAnimState::Ready; + xa32_25_ = true; + --xcc4_; + } else if (msg == EStateMsg::Update) { + if (xa31_29_) { + FacePlayer(arg, mgr); + } else { + xc0c_ = std::min(0.5f, 0.5f * arg + xc0c_); + xc08_ = arg * xc0c_ + xc08_; + xbe4_ += xc08_ * xbf0_; + } + TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, 0); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + ResetPlasmaProjectile(mgr, true); + xa32_25_ = false; + } +} + void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) { if (msg == EStateMsg::Activate) { if (xa32_31_) { @@ -573,13 +1004,86 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) { xbd0_ = GetTransform().basis[1]; } else { xa33_24_ = (GetTranslation() - xa84_.origin).magSquared() < 0.f; - } - } else if (msg == EStateMsg::Update) { + for (const auto& conn : GetConnectionList()) { + if (conn.x0_state != EScriptObjectState::Attack || conn.x4_msg != EScriptObjectMessage::Follow) + continue; + + TUniqueId uid = mgr.GetIdForScript(conn.x8_objId); + if (uid == kInvalidUniqueId) + continue; + + if (TCastToConstPtr wp = mgr.GetObjectById(uid)) { + zeus::CVector3f wpPos = wp->GetTranslation(); + const float mag = xa84_.basis[0].dot(wpPos - xa84_.origin); + if ((xa33_24_ && mag >= 1.f) || (!xa33_24_ && mag <= 1.f)) { + xbc4_ = wp->GetTranslation(); + xbd0_ = wp->GetTransform().basis[0]; + x2ec_reflectedDestPos = GetTranslation(); + break; + } + } + } + } + + xbdc_ = 0.f; + xbe0_ = 0.f; + xa31_31_ = false; + xa31_31_ = true; + xc10_ = 120.f; + xa32_24_ = true; + xcc0_ = skSomeStruct[xcb0_].x1c_; + xc68_ = GetModelData()->GetScale(); + SetSphereCollisionRadius(2.f, mgr); + } else if (msg == EStateMsg::Update) { + zeus::CVector3f diffVec = GetTranslation() - xa84_.origin; + float fVar22 = zeus::clamp(0.f, diffVec.magnitude() - 100.f, 250.f) / 250.f; + float local_d0 = zeus::clamp(0.3f, 1.f - (0.7f * -(2.f * fVar22 - 3.f) * (fVar22 * fVar22)), 1.f); + GetModelData()->SetScale(local_d0 * xc68_); + x55c_moveScale = zeus::CVector3f((1.f / local_d0)); + x9e4_.SetScale(local_d0 * xc68_); + if (x330_stateMachineState.GetTime() > 1.f && skSomeStruct[xcb0_].x20_ != 0) { + xa32_25_ = true; + } + + if (xa32_25_ && xa31_29_) { + xbe4_ += (90.f * arg) * xbf0_; + } + + if (xa32_24_ && xcac_ != 0) { + CSfxManager::UpdateEmitter(xca8_, GetTranslation(), {}, 127); + } + if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step) + return; + + if (!xa31_30_) { + zeus::CVector3f local_54 = xbc4_ - GetTranslation(); + float mag = local_54.magnitude(); + if (mag <= 2.f || local_54.dot(xbc4_ - x2ec_reflectedDestPos) <= 0.f) { + pas::EStepDirection dir = pas::EStepDirection::Right; + if (xa32_31_) + dir = pas::EStepDirection::Left; + if (xcc0_ == 3) + dir = pas::EStepDirection::Up; + else if (xcc0_ == 2) + dir = pas::EStepDirection::Forward; + + pas::EStepType type = pas::EStepType::Normal; + x450_bodyController->GetCommandMgr().DeliverCmd(CBCStepCmd(dir, type)); + xa31_30_ = true; + } else { + local_54 *= zeus::CVector3f(1.f / mag); + xbdc_ += zeus::clamp(-100.f, xbe0_ - xbdc_, 100.f); + sub80255fe8(xbdc_, arg, local_54); + x450_bodyController->FaceDirection(xbd0_, arg * zeus::clamp(1.f, 10.f / mag, 10.f)); + } + } else { + x330_stateMachineState.SetCodeTrigger(); + } } else if (msg == EStateMsg::Deactivate) { x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed); if (xa32_25_) { - //sub80256a6c(mgr, 1); + ResetPlasmaProjectile(mgr, 1); } if (xa32_24_) { @@ -591,45 +1095,438 @@ void CRidley::LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) { xa31_31_ = false; x55c_moveScale.splat(1.f); SetupCollisionActors(mgr); - //sub802575ac(0.5f, mgr); + SetSphereCollisionRadius(0.5f, mgr); xa32_31_ = false; } } + +void CRidley::ResetPlasmaProjectile(CStateManager& mgr, bool b1) { + if (CPlasmaProjectile* ent = static_cast(mgr.ObjectById(xb64_plasmaProjectile))) { + ent->ResetBeam(mgr, b1); + xa31_29_ = false; + } + + if (xca8_) { + CSfxManager::RemoveEmitter(xca8_); + xca8_.reset(); + } +} + +void CRidley::SetSphereCollisionRadius(float f1, CStateManager& mgr) { + for (size_t i = 0; i < x984_bodyCollision->GetNumCollisionActors(); ++i) { + const auto& colDesc = x984_bodyCollision->GetCollisionDescFromIndex(i); + if (TCastToPtr colAct = mgr.ObjectById(colDesc.GetCollisionActorId())) { + colAct->SetSphereRadius(f1 * colAct->GetSphereRadius()); + } + } +} + void CRidley::JumpBack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::JumpBack(mgr, msg, arg); } -void CRidley::DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) { CAi::DoubleSnap(mgr, msg, arg); } -void CRidley::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::CoverAttack(mgr, msg, arg); } -void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) { CAi::FadeOut(mgr, msg, arg); } -void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Taunt(mgr, msg, arg); } -void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Flee(mgr, msg, arg); } -void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::ProjectileAttack(mgr, msg, arg); } -void CRidley::Flinch(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Flinch(mgr, msg, arg); } -void CRidley::Hurled(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Hurled(mgr, msg, arg); } -void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::TelegraphAttack(mgr, msg, arg); } -void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Jump(mgr, msg, arg); } -void CRidley::Explode(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Explode(mgr, msg, arg); } -void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Dodge(mgr, msg, arg); } -void CRidley::Retreat(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Retreat(mgr, msg, arg); } -void CRidley::Approach(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Approach(mgr, msg, arg); } -void CRidley::Enraged(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Enraged(mgr, msg, arg); } -void CRidley::SpecialAttack(CStateManager& mgr, EStateMsg msg, float arg) { CAi::SpecialAttack(mgr, msg, arg); } -void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) { CAi::Land(mgr, msg, arg); } -bool CRidley::Attacked(CStateManager& mgr, float arg) { return CPatterned::Attacked(mgr, arg); } -bool CRidley::TooClose(CStateManager& mgr, float arg) { return CPatterned::TooClose(mgr, arg); } -bool CRidley::InRange(CStateManager& mgr, float arg) { return CPatterned::InRange(mgr, arg); } -bool CRidley::ShouldAttack(CStateManager& mgr, float arg) { return CAi::ShouldAttack(mgr, arg); } -bool CRidley::ShouldDoubleSnap(CStateManager& mgr, float arg) { return CAi::ShouldDoubleSnap(mgr, arg); } -bool CRidley::ShouldTurn(CStateManager& mgr, float arg) { return CAi::ShouldTurn(mgr, arg); } -bool CRidley::HitSomething(CStateManager& mgr, float arg) { return CAi::HitSomething(mgr, arg); } -bool CRidley::AttackOver(CStateManager& mgr, float arg) { return CAi::AttackOver(mgr, arg); } -bool CRidley::ShouldTaunt(CStateManager& mgr, float arg) { return CAi::ShouldTaunt(mgr, arg); } -bool CRidley::ShouldFire(CStateManager& mgr, float arg) { return CAi::ShouldFire(mgr, arg); } -bool CRidley::ShouldDodge(CStateManager& mgr, float arg) { return CAi::ShouldDodge(mgr, arg); } -bool CRidley::ShouldRetreat(CStateManager& mgr, float arg) { return CAi::ShouldRetreat(mgr, arg); } -bool CRidley::ShouldCrouch(CStateManager& mgr, float arg) { return CAi::ShouldCrouch(mgr, arg); } -bool CRidley::ShotAt(CStateManager& mgr, float arg) { return CAi::ShotAt(mgr, arg); } -bool CRidley::SetAIStage(CStateManager& mgr, float arg) { return CAi::SetAIStage(mgr, arg); } -bool CRidley::AIStage(CStateManager& mgr, float arg) { return CAi::AIStage(mgr, arg); } -bool CRidley::ShouldStrafe(CStateManager& mgr, float arg) { return CAi::ShouldStrafe(mgr, arg); } -bool CRidley::IsDizzy(CStateManager& mgr, float arg) { return CAi::IsDizzy(mgr, arg); } +void CRidley::DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + x402_28_isMakingBigStrike = x568_data.x3cc_ > 0.f; + x504_damageDur = x568_data.x3cc_; + xc8c_ = x568_data.x3b0_; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 2); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + x402_28_isMakingBigStrike = false; + xc8c_ = GetContactDamage(); + } +} +void CRidley::CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + x402_28_isMakingBigStrike = x568_data.x3ec_ > 0.f; + x504_damageDur = x568_data.x3ec_; + xc8c_ = x568_data.x3d0_; + sub80256580(); + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 1); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + x402_28_isMakingBigStrike = false; + x504_damageDur = 0.f; + xc8c_ = GetContactDamage(); + } +} + +void CRidley::Crouch(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + SetMomentumWR(GetGravityConstant() * zeus::skDown); + if (xc64_aiStage == 3) { + // sub80253710(mgr); + } + } else if (msg == EStateMsg::Update) { + + } +} +void CRidley::FadeOut(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + for (const auto& effect : skWingEffects) { + GetModelData()->GetAnimationData()->SetParticleEffectState(effect, false, mgr); + } + if (!xa34_24_) + xa34_24_ = true; + + xb68_.SetDamage(x568_data.x3fc_); + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 5); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + xcbc_ = arg * x568_data.x3c_; + } +} +void CRidley::Taunt(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::Taunt, &CPatterned::TryTaunt, 3); + FacePlayer(arg, mgr); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + } +} +void CRidley::Flee(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + zeus::CVector3f destPos = + xa84_.origin.toVec2f() + (20.f + xabc_) * (GetTranslation().toVec2f() - xa84_.origin.toVec2f()).normalized(); + destPos.z() = xac0_ + xa84_.origin.z(); + SetDestPos(destPos); + } else if (msg == EStateMsg::Update) { + sub80255fe8(50.f, arg, (x2e0_destPos - GetTranslation()).normalized()); + } +} +void CRidley::Lurk(urde::CStateManager& mgr, urde::EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + if (!xa33_25_) { + zeus::CVector3f vec = GetTranslation() - xa84_.origin; + vec.z() = 0.f; + arg = zeus::CVector3f::getAngleDiff(xa84_.basis[1], vec); + if (vec.dot(xa84_.basis[0]) < 0.f) + arg = -arg; + + if (std::fabs(mgr.GetActiveRandom()->Range(-1.2566371f, 1.2566371f) - arg) >= 0.39269909f) { + /* CodeWarrior was drunk */ + } + } else { + x984_bodyCollision->SetActive(mgr, true); + x980_tailCollision->SetActive(mgr, true); + } + xa33_25_ = false; + float f30 = xac0_ - xadc_; + float f31 = xabc_ * std::cos(0.f); + float f0 = xabc_ * std::sin(0.f); + zeus::CVector3f destPos = xa84_ * zeus::CVector3f(f0, f31, f30); + fmt::print(fmt("Setting dest pos to {}\n"), destPos); + SetDestPos(destPos); + zeus::CVector3f vec = GetTransform().basis[1].toVec2f().normalized(); + zeus::CTransform xf(vec.cross(zeus::skUp), vec, zeus::skUp, GetTranslation()); + SetTransform(xf); + xa33_27_ = false; + xa34_26_ = false; + } else if (msg == EStateMsg::Update) { + sub80255fe8(50.f, arg, (x2e0_destPos - GetTranslation()).normalized()); + FacePlayer(10.f * arg, mgr); + } +} +void CRidley::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + --xcc4_; + xa33_31_ = true; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, 2); + FacePlayer(arg, mgr); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + xa33_28_ = false; + xa33_31_ = false; + } +} +void CRidley::Flinch(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + sub80257744(mgr); + x32c_animState = EAnimState::Ready; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 3); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + sub80257650(mgr); + xa32_28_shotAt = false; + } +} +void CRidley::Hurled(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg != EStateMsg::Activate) + return; + + sub80257650(mgr); + x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(GetTransform().basis[1], pas::ESeverity::Four)); +} + +void CRidley::TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + sub8025784c(mgr); + x32c_animState = EAnimState::Ready; + xa32_25_ = true; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, 0); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + ResetPlasmaProjectile(mgr, true); + sub80257650(mgr); + xa32_25_ = false; + } +} +void CRidley::Jump(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + xc88_ = (mgr.GetPlayer().GetTranslation() - GetTranslation()).magnitude() < xae4_ ? 4 : 5; + xc8c_ = x568_data.x390_; + sub80256580(); + } else if (msg == EStateMsg::Update) { + + } else if (msg == EStateMsg::Deactivate) { + AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr); + } +} +void CRidley::Explode(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + xa32_27_ = false; + x32c_animState = EAnimState::Ready; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 2); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + } +} +void CRidley::Dodge(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + xc84_ = 2; + float dist = zeus::clamp( + 0.f, zeus::CVector3f(GetTranslation().toVec2f() - xa84_.origin.toVec2f()).normalized().dot(xa84_.basis[0]), + 1.f); + if (dist < mgr.GetActiveRandom()->Float()) + xc84_ = 3; + x32c_animState = EAnimState::Ready; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, xc84_); + if (x32c_animState == EAnimState::Over) { + zeus::CVector3f vec = zeus::CVector3f(GetTranslation().toVec2f() - xa84_.origin.toVec2f()).normalized(); + zeus::CVector3f someVec(((xa84_.origin.x() + xabc_) * vec.x()) - GetTranslation().x(), + ((xa84_.origin.y() + xabc_) * vec.y()) - GetTranslation().y(), + ((xa84_.origin.z() + xac0_) - GetTranslation().z())); + if (someVec.magnitude() > 1.f) + someVec.normalize(); + + sub80255fe8(10.f, arg, someVec); + } else { + x450_bodyController->FaceDirection((xa84_.origin - GetTranslation()).normalized(), arg); + } + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + } +} +void CRidley::Retreat(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, 5); + } else { + x32c_animState = EAnimState::NotReady; + } +} +void CRidley::Approach(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + SetDestPos(xab4_ * (GetTranslation() - xa84_.origin).normalized()); + if (xc64_aiStage == 3 && !xa34_24_) { + xa34_24_ = true; + SendScriptMsgs(EScriptObjectState::CameraPath, mgr, EScriptObjectMessage::None); + } + } else if (msg == EStateMsg::Update) { + sub80255fe8(50.f, arg, (x2e0_destPos - GetTranslation()).normalized()); + FacePlayer(arg, mgr); + } +} + +void CRidley::Enraged(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + zeus::CVector3f vec = (mgr.GetPlayer().GetTranslation().toVec2f() - GetTranslation().toVec2f()).normalized(); + mgr.AddObject(new CExplosion( + x98c_, mgr.AllocateUniqueId(), true, CEntityInfo(GetAreaIdAlways(), NullConnectionList), ""sv, + zeus::CTransform(vec.cross(zeus::skUp), vec, zeus::skUp, mgr.GetPlayer().GetTranslation() - (20.f * vec)), 0, + zeus::skOne3f, zeus::skWhite)); + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryDodge, 4); + FacePlayer(arg, mgr); + } else { + x32c_animState = EAnimState::NotReady; + xa33_24_ = true; + } +} + +void CRidley::SpecialAttack(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + x32c_animState = EAnimState::Ready; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::Taunt, &CPatterned::TryTaunt, 0); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + } +} +void CRidley::Land(CStateManager& mgr, EStateMsg msg, float arg) { + if (msg == EStateMsg::Activate) { + zeus::CVector3f diff = zeus::CVector3f(mgr.GetPlayer().GetTranslation().x() - xa84_.origin.x(), + mgr.GetPlayer().GetTranslation().y() - xa84_.origin.y(), 0.f); + SetDestPos(xa84_.origin + std::min(5.f, diff.magnitude()) * diff.normalized()); + x32c_animState = EAnimState::Ready; + AddMaterial(EMaterialTypes::Solid, mgr); + CMaterialList exclude = GetMaterialFilter().GetExcludeList(); + exclude.Remove(EMaterialTypes::Solid); + CMaterialList include = GetMaterialFilter().GetIncludeList(); + include.Add(EMaterialTypes::Solid); + SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude)); + + if (xc64_aiStage == 3) + AddMaterial(EMaterialTypes::GroundCollider, EMaterialTypes::Solid, mgr); + + x402_28_isMakingBigStrike = x568_data.x38c_ > 0.f; + x504_damageDur = x568_data.x38c_; + } else if (msg == EStateMsg::Update) { + TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 8); + + if (x32c_animState == EAnimState::Repeat) { + x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat); + } + sub80255e5c(mgr); + } else if (msg == EStateMsg::Deactivate) { + x32c_animState = EAnimState::NotReady; + x402_28_isMakingBigStrike = false; + x504_damageDur = 0.f; + xa33_30_ = false; + xa33_29_doStrafe = false; + if (mgr.GetActiveRandom()->Range(0.f, 100.f) < 50.f) { + if ((mgr.GetPlayer().GetTranslation() - GetTranslation()).magSquared() <= 0.f) + xa33_29_doStrafe = true; + else + xa33_30_ = true; + } + } +} +bool CRidley::Attacked(CStateManager& mgr, float arg) { + fmt::print(fmt("Attacked\n")); + return xa31_24_ && xa31_26_; +} +bool CRidley::TooClose(CStateManager& mgr, float arg) { + fmt::print(fmt("TooClose\n")); + if (xb0c_ == 4) + return true; + + zeus::CVector3f diff = mgr.GetPlayer().GetTranslation() - GetTranslation(); + if (diff.magnitude() < x2fc_minAttackRange && 0.7f * diff.magnitude() < diff.dot(GetTransform().basis[1])) { + xb0c_ = 4; + return true; + } + + return false; +} +bool CRidley::InRange(CStateManager& mgr, float arg) { + float mag = (GetTranslation() - x2e0_destPos).magnitude() < 2.f; + fmt::print(fmt("InRange: distance to {}, curpos {}, destpos {}\n"), mag, GetTranslation(), x2e0_destPos); + return mag < 2.f; +} +bool CRidley::ShouldAttack(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldAttack\n")); + return (xc64_aiStage == 3 && xb0c_ == 2) || (xc64_aiStage == 2 && xb04_ == 0); +} +bool CRidley::ShouldDoubleSnap(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldDoubleSnap\n")); + return xa33_30_; +} +bool CRidley::ShouldTurn(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldTurn {}\n"), xb04_); + return xb04_ == 5; +} +bool CRidley::HitSomething(CStateManager& mgr, float arg) { + fmt::print(fmt("HitSomething\n")); + return xa32_27_ || xc64_aiStage == 3; +} +bool CRidley::AttackOver(CStateManager& mgr, float arg) { + fmt::print(fmt("AttackOver\n")); + return xcc4_ == 0; +} +bool CRidley::ShouldTaunt(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldTaunt\n")); + return (xc64_aiStage == 3 && xb0c_ == 1) || (xc64_aiStage == 2 && xb04_ == 4); +} +bool CRidley::ShouldFire(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldFire\n")); + return xc64_aiStage == 2 && xb04_ == 2; +} +bool CRidley::ShouldDodge(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldDodge\n")); + return xb04_ == 3; +} +bool CRidley::ShouldRetreat(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldRetreat\n")); + return xa34_26_; +} +bool CRidley::ShouldCrouch(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldCrouch\n")); + + return xb04_ == 1; +} +bool CRidley::ShotAt(CStateManager& mgr, float arg) { + fmt::print(fmt("ShotAt\n")); + return xa32_28_shotAt; +} +bool CRidley::SetAIStage(CStateManager& mgr, float arg) { + fmt::print(fmt("SetAIStage {}\n"), arg); + xc64_aiStage = arg; + return true; +} +bool CRidley::AIStage(CStateManager& mgr, float arg) { + fmt::print(fmt("AIStage {}\n"), arg); + return xc64_aiStage >= arg; +} +bool CRidley::ShouldStrafe(CStateManager& mgr, float arg) { + fmt::print(fmt("ShouldStrafe\n")); + return xa33_29_doStrafe; +} +bool CRidley::IsDizzy(CStateManager& mgr, float arg) { + fmt::print(fmt("IsDizzy\n")); + if (xb0c_ == 3) + return true; + + zeus::CVector3f diff = mgr.GetPlayer().GetTranslation() - GetTranslation(); + if (diff.magnitude() < x300_maxAttackRange && diff.dot(GetTransform().basis[1]) < 0.f) { + xb0c_ = 3; + return true; + } + + return false; +} +void CRidley::sub80255fe8(float f1, float f2, const zeus::CVector3f& vec) { + xaf8_ = (0.2f * (f1 * f1)) * vec; + xaec_ += f2 * xaf8_; + if (xaec_.magnitude() > f1) { + xaec_ = f1 * xaec_.normalized(); + } +} +void CRidley::sub80255e5c(CStateManager& mgr) { + zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation(); + if (posDiff.magnitude() < 8.f) { + float mag = mgr.GetPlayer().GetMass() * (8.f - posDiff.magnitude()); + zeus::CVector3f impulse = mag * posDiff.toVec2f().normalized(); + mgr.GetPlayer().ApplyImpulseWR(impulse, {}); + } +} +void CRidley::FacePlayer(float arg, CStateManager& mgr) { + x450_bodyController->FaceDirection((mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized(), arg); +} } // namespace MP1 } // namespace urde diff --git a/Runtime/MP1/World/CRidley.hpp b/Runtime/MP1/World/CRidley.hpp index f656b8701..1d5c09bab 100644 --- a/Runtime/MP1/World/CRidley.hpp +++ b/Runtime/MP1/World/CRidley.hpp @@ -65,11 +65,11 @@ public: class CRidley : public CPatterned { CRidleyData x568_data; - std::unique_ptr x980_; - std::unique_ptr x984_; + std::unique_ptr x980_tailCollision; + std::unique_ptr x984_bodyCollision; TUniqueId x988_headId = kInvalidUniqueId; TUniqueId x98a_breastPlateId = kInvalidUniqueId; - TToken x98c_; + TLockedToken x98c_; CModelData x998_; CModelData x9e4_; CSegId xa30_breastPlateSegId; @@ -85,7 +85,7 @@ class CRidley : public CPatterned { bool xa32_25_ : 1; bool xa32_26_ : 1; bool xa32_27_ : 1; - bool xa32_28_ : 1; + bool xa32_28_shotAt : 1; bool xa32_29_ : 1; bool xa32_30_ : 1; bool xa32_31_ : 1; @@ -94,7 +94,7 @@ class CRidley : public CPatterned { bool xa33_26_ : 1; bool xa33_27_ : 1; bool xa33_28_ : 1; - bool xa33_29_ : 1; + bool xa33_29_doStrafe : 1; bool xa33_30_ : 1; bool xa33_31_ : 1; bool xa34_24_ : 1; @@ -113,7 +113,7 @@ class CRidley : public CPatterned { float xae8_; zeus::CVector3f xaec_; zeus::CVector3f xaf8_; - u32 xb04_ = 2; + s32 xb04_ = 2; u32 xb08_; u32 xb0c_ = 0; float xb10_ = 0.f; @@ -124,7 +124,7 @@ class CRidley : public CPatterned { float xb24_ = 0.f; CSegId xb28_; CBoneTracking xb2c_; - TUniqueId xb64_ = kInvalidUniqueId; + TUniqueId xb64_plasmaProjectile = kInvalidUniqueId; CProjectileInfo xb68_; CSegId xb90_headSegId; CSegId xb91_mouthSegId; @@ -133,10 +133,11 @@ class CRidley : public CPatterned { zeus::CTransform xb94_; zeus::CVector3f xbc4_; zeus::CVector3f xbd0_; - u32 xbdc_; - u32 xbe0_; + float xbdc_; + float xbe0_; zeus::CVector3f xbe4_; zeus::CVector3f xbf0_ = zeus::skForward; + zeus::CVector3f xbfc_; float xc08_ = 0.f; float xc0c_ = 0.f; float xc10_ = 120.f; @@ -151,8 +152,8 @@ class CRidley : public CPatterned { u32 xc84_; u32 xc88_ = 4; CDamageInfo xc8c_; - u32 xca8_ = 0; - u32 xcac_ = 0; + CSfxHandle xca8_; + CSfxHandle xcac_ = 0; u32 xcb0_ = 0; u32 xcb4_ = 0; float xcb8_ = 0.f; @@ -160,10 +161,10 @@ class CRidley : public CPatterned { u32 xcc0_ = 1; u32 xcc4_ = 1; float xcc8_ = 0.f; + float xccc_; TLockedToken xcd0_; - bool xcdc_; std::unique_ptr xce0_; - std::vector xce4_; // was rstl::reserved_vector + std::vector xce4_wingBoneIds; // was rstl::reserved_vector float xd08_; CSfxHandle xd0c_; std::unique_ptr xd10_; @@ -178,6 +179,19 @@ class CRidley : public CPatterned { void sub802563a8(float dt); void sub80256b14(float dt, CStateManager& mgr); void sub80256624(float dt, CStateManager& mgr); + void ResetPlasmaProjectile(CStateManager& mgr, bool b1); + void sub80255fe8(float f1, float f2, const zeus::CVector3f& vec); + void sub80255e5c(CStateManager& mgr); + void sub8025784c(CStateManager& mgr); + void sub80255d58(CStateManager& mgr); + void sub80257744(CStateManager& mgr); + void FirePlasma(CStateManager& mgr); + void FacePlayer(float arg, CStateManager& mgr); + void SetSphereCollisionRadius(float f1, CStateManager& mgr); + void sub80256580() { + if (!xa31_24_) + x3b4_speed = 1.2f; + } public: DEFINE_PATTERNED(Ridley) @@ -194,7 +208,7 @@ public: } zeus::CVector3f GetAimPosition(const CStateManager& mgr, float dt) const override { - return GetLctrTransform((xc64_aiStage == 3 && !xa32_28_) ? xb90_headSegId : xa30_breastPlateSegId).origin; + return GetLctrTransform((xc64_aiStage == 3 && !xa32_28_shotAt) ? xb90_headSegId : xa30_breastPlateSegId).origin; } float GetGravityConstant() const override { return 50.f; } @@ -203,6 +217,7 @@ public: return EWeaponCollisionResponseTypes::EnemyNormal; } + void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override; void Patrol(CStateManager& mgr, EStateMsg msg, float arg) override; void Dead(CStateManager& mgr, EStateMsg msg, float arg) override; void Generate(CStateManager& mgr, EStateMsg msg, float arg) override; @@ -211,9 +226,11 @@ public: void JumpBack(CStateManager& mgr, EStateMsg msg, float arg) override; void DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) override; void CoverAttack(CStateManager& mgr, EStateMsg msg, float arg) override; + void Crouch(CStateManager& mgr, EStateMsg msg, float arg) override; void FadeOut(CStateManager& mgr, EStateMsg msg, float arg) override; void Taunt(CStateManager& mgr, EStateMsg msg, float arg) override; void Flee(CStateManager& mgr, EStateMsg msg, float arg) override; + void Lurk(CStateManager& mgr, EStateMsg msg, float arg) override; void ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) override; void Flinch(CStateManager& mgr, EStateMsg msg, float arg) override; void Hurled(CStateManager& mgr, EStateMsg msg, float arg) override; diff --git a/Runtime/Weapon/CProjectileInfo.hpp b/Runtime/Weapon/CProjectileInfo.hpp index 6800fff3e..14d28c20c 100644 --- a/Runtime/Weapon/CProjectileInfo.hpp +++ b/Runtime/Weapon/CProjectileInfo.hpp @@ -23,6 +23,7 @@ public: const CPlayer& player, bool gravity, float dt) const; const CDamageInfo& GetDamage() const { return xc_damageInfo; } + void SetDamage(const CDamageInfo& damageInfo) { xc_damageInfo = damageInfo; } TToken& Token() { return x0_weaponDescription; } }; } // namespace urde diff --git a/Runtime/World/CPatterned.hpp b/Runtime/World/CPatterned.hpp index fe8842fed..e8a6bb9a4 100644 --- a/Runtime/World/CPatterned.hpp +++ b/Runtime/World/CPatterned.hpp @@ -216,10 +216,10 @@ protected: zeus::CColor x430_damageColor = skDamageColor; zeus::CVector3f x434_posDelta; zeus::CQuaternion x440_rotDelta; - CSteeringBehaviors x45c_steeringBehaviors; std::unique_ptr x450_bodyController; u16 x454_deathSfx; u16 x458_iceShatterSfx; + CSteeringBehaviors x45c_steeringBehaviors; CKnockBackController x460_knockBackController; zeus::CVector3f x4e4_latestPredictedTranslation; diff --git a/Runtime/World/CProjectedShadow.hpp b/Runtime/World/CProjectedShadow.hpp index f80e130ba..97977bb76 100644 --- a/Runtime/World/CProjectedShadow.hpp +++ b/Runtime/World/CProjectedShadow.hpp @@ -26,5 +26,7 @@ public: void Render(const CStateManager& mgr); void RenderShadowBuffer(const CStateManager&, const CModelData&, const zeus::CTransform&, s32, const zeus::CVector3f&, float, float); + + void Unset_X80() { x80_ = false; } }; } // namespace urde