From 93751972ac39e0c2414af2ff74dfe1779a9311e9 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 2 Apr 2020 17:24:59 -0400 Subject: [PATCH] COmegaPirate: Implement AcceptScriptMsg & collision setup --- Runtime/MP1/World/CElitePirate.hpp | 28 ++- Runtime/MP1/World/COmegaPirate.cpp | 344 ++++++++++++++++++++++++++++- Runtime/MP1/World/COmegaPirate.hpp | 27 ++- Runtime/World/CActor.hpp | 1 + Runtime/World/CPatterned.hpp | 1 + 5 files changed, 369 insertions(+), 32 deletions(-) diff --git a/Runtime/MP1/World/CElitePirate.hpp b/Runtime/MP1/World/CElitePirate.hpp index 45f11e14a..1b496f952 100644 --- a/Runtime/MP1/World/CElitePirate.hpp +++ b/Runtime/MP1/World/CElitePirate.hpp @@ -194,8 +194,23 @@ public: } protected: - void SetupPathFindSearch(); void SetShotAt(bool val, CStateManager& mgr); + void CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid); + zeus::CVector3f GetLockOnPosition(const CActor* actor) const; + bool ShouldFireFromLauncher(CStateManager& mgr, TUniqueId launcherId); + bool ShouldCallForBackupFromLauncher(const CStateManager& mgr, TUniqueId uid) const; + void SetupLauncherHealthInfo(CStateManager& mgr, TUniqueId uid); + void SetLauncherActive(CStateManager& mgr, bool val, TUniqueId uid); + void SetupPathFindSearch(); + void UpdateActorTransform(CStateManager& mgr, TUniqueId& uid, std::string_view name); + + const CElitePirateData& GetData() const { return x5d8_data; } + EState GetState() const { return x568_state; } + void SetState(EState state) { x568_state = state; } + TUniqueId GetLauncherId() const { return x772_launcherId; } + void SetAlert(bool val) { x988_28_alert = val; } + +private: bool IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector& vec) const; void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count, std::vector& outJoints) const; @@ -205,12 +220,8 @@ protected: void SetupCollisionActorInfo(CStateManager& mgr); bool IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info, size_t infoCount) const; - void CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid); void ApplyDamageToHead(CStateManager& mgr, TUniqueId uid); void CreateEnergyAbsorb(CStateManager& mgr, const zeus::CTransform& xf); - void SetupLauncherHealthInfo(CStateManager& mgr, TUniqueId uid); - void SetLauncherActive(CStateManager& mgr, bool val, TUniqueId uid); - zeus::CVector3f GetLockOnPosition(const CActor* actor) const; bool CanKnockBack(const CDamageInfo& info) const; void UpdateDestPos(CStateManager& mgr); void CheckAttackChance(CStateManager& mgr); @@ -219,17 +230,10 @@ protected: bool IsAttractingEnergy() const; void UpdateTimers(float dt); void UpdatePositionHistory(); - void UpdateActorTransform(CStateManager& mgr, TUniqueId& uid, std::string_view name); void UpdateHealthInfo(CStateManager& mgr); void ExtendTouchBounds(const CStateManager& mgr, const rstl::reserved_vector& uids, const zeus::CVector3f& vec) const; - bool ShouldFireFromLauncher(CStateManager& mgr, TUniqueId launcherId); - bool ShouldCallForBackupFromLauncher(const CStateManager& mgr, TUniqueId uid) const; bool IsClosestEnergyAttractor(const CStateManager& mgr, const rstl::reserved_vector& charNearList, const zeus::CVector3f& projectilePos) const; - - const CElitePirateData& GetData() const { return x5d8_data; } - EState GetState() const { return x568_state; } - void SetState(EState state) { x568_state = state; } }; } // namespace urde::MP1 diff --git a/Runtime/MP1/World/COmegaPirate.cpp b/Runtime/MP1/World/COmegaPirate.cpp index a310b673d..26bfdb7e4 100644 --- a/Runtime/MP1/World/COmegaPirate.cpp +++ b/Runtime/MP1/World/COmegaPirate.cpp @@ -4,12 +4,38 @@ #include "Runtime/Collision/CCollisionActorManager.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/Graphics/CBooRenderer.hpp" +#include "Runtime/Weapon/CGameProjectile.hpp" #include "Runtime/World/CPlayer.hpp" +#include "Runtime/World/CScriptEffect.hpp" +#include "Runtime/World/CScriptPlatform.hpp" +#include "Runtime/World/CScriptSound.hpp" +#include "Runtime/World/CScriptWaypoint.hpp" #include "Runtime/World/CWorld.hpp" #include "TCastTo.hpp" // Generated file, do not modify include path namespace urde::MP1 { +namespace { +constexpr std::array skSphereJoints{{ + {"lockon_target_LCTR", 1.f}, +}}; + +constexpr std::array skObbJoints{{ + {"Spine_2", "Collar", zeus::skOne3f}, + {"R_toe_1", "R_ankle", zeus::skOne3f}, + {"L_toe_1", "L_ankle", zeus::skOne3f}, + {"R_knee", "R_ankle", zeus::skOne3f}, + {"L_knee", "L_ankle", zeus::skOne3f}, + {"R_elbow", "R_wrist", zeus::skOne3f}, + {"L_elbow", "L_wrist", zeus::skOne3f}, + {"R_wrist", "R_index_1", zeus::skOne3f}, + {"L_wrist", "L_index_1", zeus::skOne3f}, + {"R_index_1", "R_index_3_SDK", zeus::CVector3f{2.f}}, + {"L_index_1", "L_index_3_SDK", zeus::CVector3f{2.f}}, +}}; +} // namespace + COmegaPirate::CFlash::CFlash(TUniqueId uid, const CEntityInfo& info, const zeus::CVector3f& pos, TToken& thermalSpot, float p5) : CActor(uid, true, "Omega Pirate Flash", info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), {}, @@ -26,10 +52,10 @@ COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityIn , x9d0_(GetModelData()->GetScale()) , x9f0_(*g_SimplePool, w1, w2, w3, 0, 0) , xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) { - x9a4_.reserve(3); - x9b8_.reserve(24); - x9dc_.reserve(4); - xaa0_.reserve(4); + x9a4_scriptWaypointPlatforms.reserve(3); + x9b8_scriptEffects.reserve(24); + x9dc_scriptPlatforms.reserve(4); + xaa0_scriptSounds.reserve(4); xab4_.reserve(3); xb7c_.resize(4, 0); @@ -44,8 +70,171 @@ COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityIn } void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) { - CElitePirate::AcceptScriptMsg(msg, uid, mgr); - // TODO + switch (msg) { + default: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + break; + case EScriptObjectMessage::Activate: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + xa38_collisionActorMgr1->SetActive(mgr, true); + xa9c_collisionActorMgr2->SetActive(mgr, true); + GetKnockBackController().SetAutoResetImpulse(false); + if (auto* entity = mgr.ObjectById(x990_launcherId2)) { + entity->SetActive(true); + } + break; + case EScriptObjectMessage::Deactivate: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + xa38_collisionActorMgr1->SetActive(mgr, false); + xa9c_collisionActorMgr2->SetActive(mgr, false); + if (auto* entity = mgr.ObjectById(x990_launcherId2)) { + entity->SetActive(false); + } + break; + case EScriptObjectMessage::Decrement: + x9ec_ = true; + break; + case EScriptObjectMessage::Increment: + SetShotAt(true, mgr); + break; + case EScriptObjectMessage::Open: + xb7c_[3] -= xb7c_[3] == 0 ? 0 : 1; + break; + case EScriptObjectMessage::Reset: + xb78_ = true; + break; + case EScriptObjectMessage::SetToMax: + xa3c_hearPlayer = true; + break; + case EScriptObjectMessage::SetToZero: + xb7c_[2] -= xb7c_[2] == 0 ? 0 : 1; + break; + case EScriptObjectMessage::Start: + x3b4_speed = 1.f; + ++xade_; + if (xade_ < 4) { + GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(zeus::skLeft, pas::ESeverity::One)); + } + break; + case EScriptObjectMessage::Stop: + SetupCollisionManager(mgr); + break; + case EScriptObjectMessage::StopAndReset: + xb7c_[1] -= xb7c_[1] == 0 ? 0 : 1; + break; + case EScriptObjectMessage::UNKM18: + xb7c_[0] -= xb7c_[0] == 0 ? 0 : 1; + break; + case EScriptObjectMessage::Action: + x3b4_speed = 1.f; + ++xade_; + if (xade_ < 4) { + GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(zeus::skRight, pas::ESeverity::One)); + } + break; + case EScriptObjectMessage::Alert: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + break; + case EScriptObjectMessage::Touched: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + if (uid == x990_launcherId2 && x990_launcherId2 != kInvalidUniqueId) { + SetShotAt(true, mgr); + } + if (TCastToPtr actor = mgr.ObjectById(uid)) { + if (TCastToPtr player = mgr.ObjectById(actor->GetLastTouchedObject())) { + if (x420_curDamageRemTime <= 0.f) { + mgr.ApplyDamage(GetUniqueId(), player->GetUniqueId(), GetUniqueId(), GetContactDamage(), + CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), zeus::skZero3f); + x420_curDamageRemTime = x424_damageWaitTime; + } + } + } + break; + case EScriptObjectMessage::Registered: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + x990_launcherId2 = mgr.AllocateUniqueId(); + CreateGrenadeLauncher(mgr, x990_launcherId2); + SetupCollisionManager(mgr); + GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal8); + x402_27_noXrayModel = false; + xa4c_initialXf = x34_transform; + xa98_maxEnergy = HealthInfo(mgr)->GetHP(); + if (auto* actor = static_cast(mgr.ObjectById(GetLauncherId()))) { + actor->RemoveMaterial(EMaterialTypes::Scannable, mgr); + } + if (auto* actor = static_cast(mgr.ObjectById(x990_launcherId2))) { + actor->RemoveMaterial(EMaterialTypes::Scannable, mgr); + } + GetKnockBackController().SetAutoResetImpulse(false); + SetupPathFindSearch(); + break; + case EScriptObjectMessage::Deleted: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + xa38_collisionActorMgr1->Destroy(mgr); + xa9c_collisionActorMgr2->Destroy(mgr); + mgr.FreeScriptObject(x990_launcherId2); + break; + case EScriptObjectMessage::InitializedInArea: + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + + for (const SConnection& conn : GetConnectionList()) { + TUniqueId connId = mgr.GetIdForScript(conn.x8_objId); + if (connId == kInvalidUniqueId || conn.x0_state != EScriptObjectState::Attack) { + continue; + } + + if (conn.x4_msg == EScriptObjectMessage::Activate) { + if (TCastToPtr effect = mgr.ObjectById(connId)) { + x9b8_scriptEffects.emplace_back(connId, effect->GetName()); + } else if (TCastToPtr platform = mgr.ObjectById(connId)) { + x9dc_scriptPlatforms.emplace_back(connId, platform->GetName()); + platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, EMaterialTypes::Character, mgr); + platform->RemoveMaterial(EMaterialTypes::Scannable, mgr); + CMaterialList excludes = platform->GetMaterialFilter().GetExcludeList(); + excludes.Add({EMaterialTypes::Player, EMaterialTypes::Character, EMaterialTypes::CollisionActor}); + CMaterialList includes = GetMaterialFilter().GetIncludeList(); + platform->SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(includes, excludes)); + xae4_platformVuln = *platform->GetDamageVulnerability(); + xb54_platformColor = platform->GetDrawFlags().x4_color; // TODO does this work? + } else if (TCastToPtr sound = mgr.ObjectById(connId)) { + xaa0_scriptSounds.emplace_back(connId, sound->GetName()); + } + } else if (conn.x4_msg == EScriptObjectMessage::Follow) { + if (TCastToPtr waypoint = mgr.ObjectById(connId)) { + std::vector waypointPlatformIds; + waypointPlatformIds.reserve(3); + for (const SConnection& waypointConn : waypoint->GetConnectionList()) { + auto waypointConnId = mgr.GetIdForScript(waypointConn.x8_objId); + if (TCastToPtr platform = mgr.ObjectById(waypointConnId)) { + platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); + waypointPlatformIds.push_back(waypointConnId); + } + } + x9a4_scriptWaypointPlatforms.emplace_back(connId, waypointPlatformIds); + } + } + } + break; + case EScriptObjectMessage::Damage: + if (uid == x990_launcherId2 && x990_launcherId2 != kInvalidUniqueId) { + GetBodyController()->GetCommandMgr().DeliverCmd( + CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Eight)); + } + CElitePirate::AcceptScriptMsg(msg, uid, mgr); + if (uid == xa46_ && xa7c_ == 2) { + xa7c_ = 3; + xa84_ = 0.f; + } + break; + case EScriptObjectMessage::InvulnDamage: + if (const TCastToConstPtr projectile = mgr.GetObjectById(uid)) { + if (xa4a_) { + mgr.ApplyDamage(uid, xa46_, projectile->GetOwnerId(), projectile->GetDamageInfo(), + CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), zeus::skZero3f); + } + } + SetShotAt(true, mgr); + } } bool COmegaPirate::AggressionCheck(CStateManager& mgr, float arg) { @@ -221,8 +410,29 @@ void COmegaPirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) } void COmegaPirate::Render(const CStateManager& mgr) const { - CPatterned::Render(mgr); - // TODO + const auto* mData = GetModelData(); + auto* animData = const_cast(mData->GetAnimationData()); + + CGraphics::SetModelMatrix(GetTransform() * zeus::CTransform::Scale(mData->GetScale())); + + if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay && xa2c_ > 0.f) { + auto& model = const_cast(x9f0_); + const CModelFlags flags{5, 0, 3, zeus::CColor{1.f, xa2c_}}; + animData->Render(model, flags, std::nullopt, nullptr); + } + if (x9a0_) { + bool isXRay = mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay; + if (isXRay) { + g_Renderer->SetWorldFog(ERglFogMode::None, 0.f, 1.f, zeus::skBlack); + const CModelFlags flags{5, 0, 1, zeus::CColor{1.f, 0.2f}}; + auto& model = const_cast(*animData->GetModelData().GetObj()); + animData->Render(model, flags, std::nullopt, nullptr); + } + CPatterned::Render(mgr); + if (isXRay) { + mgr.SetupFogForArea(GetAreaIdAlways()); + } + } } void COmegaPirate::Retreat(CStateManager& mgr, EStateMsg msg, float dt) { @@ -327,8 +537,28 @@ void COmegaPirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) { } void COmegaPirate::Think(float dt, CStateManager& mgr) { - CElitePirate::Think(dt, mgr); - // TODO + if (GetActive()) { + SetAlert(true); + CElitePirate::Think(dt, mgr); + + float maxHealth = xa98_maxEnergy; + CHealthInfo* healthInfo = HealthInfo(mgr); + if (healthInfo->GetHP() > 0.2f * maxHealth) { + if (healthInfo->GetHP() > 0.7f * maxHealth) { // ?? + if (xacc_ > 4) { + xac4_ = 1; + } + } else { + xac4_ = 2; + } + } else { + xac4_ = 3; + } + + UpdateActorTransform(mgr, x990_launcherId2, "grenadeLauncher2_LCTR"sv); + + // TODO + } } void COmegaPirate::WallDetach(CStateManager& mgr, EStateMsg msg, float dt) { @@ -367,4 +597,98 @@ void COmegaPirate::CreateFlash(CStateManager& mgr, float arg) { mgr.AddObject(new CFlash(mgr.AllocateUniqueId(), CEntityInfo{GetAreaIdAlways(), CEntity::NullConnectionList}, GetRenderBounds().center(), xb70_thermalSpot, arg)); } + +void COmegaPirate::SetupCollisionManager(CStateManager& mgr) { + std::vector sphereJoints; + sphereJoints.reserve(skSphereJoints.size()); + AddSphereCollisionList(skSphereJoints.data(), skSphereJoints.size(), sphereJoints); + xa38_collisionActorMgr1 = + std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), sphereJoints, true); + SetupCollisionActorInfo1(xa38_collisionActorMgr1, mgr); + xa46_ = xa38_collisionActorMgr1->GetCollisionDescFromIndex(0).GetCollisionActorId(); + if (auto* actor = static_cast(mgr.ObjectById(xa46_))) { + *actor->HealthInfo(mgr) = *HealthInfo(mgr); + } + + std::vector obbJoints; + obbJoints.reserve(skObbJoints.size()); + AddOBBAutoSizeCollisionList(skObbJoints.data(), skObbJoints.size(), obbJoints); + xa9c_collisionActorMgr2 = + std::make_unique(mgr, GetUniqueId(), GetAreaIdAlways(), obbJoints, true); + SetupCollisionActorInfo2(xa9c_collisionActorMgr2, mgr); + xa48_ = xa9c_collisionActorMgr2->GetCollisionDescFromIndex(0).GetCollisionActorId(); +} + +void COmegaPirate::AddSphereCollisionList(const SSphereJointInfo* joints, size_t count, + std::vector& outJoints) const { + const CAnimData* animData = GetModelData()->GetAnimationData(); + for (size_t i = 0; i < count; ++i) { + const auto& joint = joints[i]; + const CSegId seg = animData->GetLocatorSegId(joint.name); + if (seg.IsInvalid()) { + continue; + } + outJoints.emplace_back(CJointCollisionDescription::SphereCollision(seg, joint.radius, joint.name, 0.001f)); + } +} + +void COmegaPirate::AddOBBAutoSizeCollisionList(const SOBBJointInfo* joints, size_t count, + std::vector& outJoints) const { + const CAnimData* animData = GetModelData()->GetAnimationData(); + for (size_t i = 0; i < count; ++i) { + const auto& joint = joints[i]; + const CSegId from = animData->GetLocatorSegId(joint.from); + const CSegId to = animData->GetLocatorSegId(joint.to); + if (to.IsInvalid() || from.IsInvalid()) { + continue; + } + outJoints.emplace_back(CJointCollisionDescription::OBBAutoSizeCollision( + from, to, joint.bounds, CJointCollisionDescription::EOrientationType::One, + "Omega_Pirate_OBB_"s + std::to_string(i), 0.001f)); + } +} + +void COmegaPirate::SetupCollisionActorInfo1(const std::unique_ptr& actMgr, CStateManager& mgr) { + for (size_t i = 0; i < actMgr->GetNumCollisionActors(); ++i) { + const auto& colDesc = actMgr->GetCollisionDescFromIndex(i); + const TUniqueId uid = colDesc.GetCollisionActorId(); + if (TCastToPtr act = mgr.ObjectById(uid)) { + act->AddMaterial(EMaterialTypes::ScanPassthrough, EMaterialTypes::CameraPassthrough, EMaterialTypes::AIJoint, + EMaterialTypes::Immovable, mgr); + const CMaterialFilter& selfFilter = GetMaterialFilter(); + const CMaterialFilter& actFilter = act->GetMaterialFilter(); + CMaterialFilter filter = + CMaterialFilter::MakeIncludeExclude(selfFilter.GetIncludeList(), selfFilter.GetExcludeList()); + filter.IncludeList().Add(actFilter.GetIncludeList()); + filter.ExcludeList().Add(actFilter.GetExcludeList()); + filter.ExcludeList().Add(EMaterialTypes::Platform); // ? + act->SetMaterialFilter(filter); + act->RemoveMaterial(EMaterialTypes::ProjectilePassthrough, mgr); + } + } +} + +void COmegaPirate::SetupCollisionActorInfo2(const std::unique_ptr& actMgr, CStateManager& mgr) { + for (size_t i = 0; i < actMgr->GetNumCollisionActors(); ++i) { + const auto& colDesc = actMgr->GetCollisionDescFromIndex(i); + const TUniqueId uid = colDesc.GetCollisionActorId(); + if (TCastToPtr act = mgr.ObjectById(uid)) { + act->AddMaterial(EMaterialTypes::ScanPassthrough, EMaterialTypes::CameraPassthrough, EMaterialTypes::AIJoint, + EMaterialTypes::Immovable, mgr); + const CMaterialFilter& selfFilter = GetMaterialFilter(); + const CMaterialFilter& actFilter = act->GetMaterialFilter(); + CMaterialFilter filter = + CMaterialFilter::MakeIncludeExclude(selfFilter.GetIncludeList(), selfFilter.GetExcludeList()); + filter.IncludeList().Add(actFilter.GetIncludeList()); + filter.IncludeList().Add(EMaterialTypes::Player); // ? + filter.ExcludeList().Add(actFilter.GetExcludeList()); + filter.ExcludeList().Remove(EMaterialTypes::Player); // ? + filter.ExcludeList().Add(EMaterialTypes::Platform); // ? + act->SetMaterialFilter(filter); + act->RemoveMaterial(EMaterialTypes::ProjectilePassthrough, mgr); + act->SetDamageVulnerability(CDamageVulnerability::ReflectVulnerabilty()); + } + } +} + } // namespace urde::MP1 diff --git a/Runtime/MP1/World/COmegaPirate.hpp b/Runtime/MP1/World/COmegaPirate.hpp index 5b25ccafd..5c7a6d256 100644 --- a/Runtime/MP1/World/COmegaPirate.hpp +++ b/Runtime/MP1/World/COmegaPirate.hpp @@ -25,26 +25,26 @@ private: float x99c_ = 1.f; bool x9a0_ = true; bool x9a1_ = true; - std::vector x9a4_; // TODO type + std::vector>> x9a4_scriptWaypointPlatforms; bool x9b4_ = false; - std::vector> x9b8_; + std::vector> x9b8_scriptEffects; int x9c8_ = 0; float x9cc_ = 0.f; zeus::CVector3f x9d0_; - std::vector> x9dc_; + std::vector> x9dc_scriptPlatforms; bool x9ec_ = false; CSkinnedModel x9f0_; float xa2c_ = 0.f; int xa30_ = 0; float xa34_ = 0.f; - std::unique_ptr xa38_; + std::unique_ptr xa38_collisionActorMgr1; bool xa3c_hearPlayer = false; pas::ELocomotionType xa40_ = pas::ELocomotionType::Relaxed; bool xa44_ = false; TUniqueId xa46_ = kInvalidUniqueId; TUniqueId xa48_ = kInvalidUniqueId; bool xa4a_ = false; - zeus::CTransform xa4c_; + zeus::CTransform xa4c_initialXf; int xa7c_ = 0; float xa80_ = 1.f; float xa84_ = 0.f; @@ -53,8 +53,8 @@ private: float xa90_ = 1.f; float xa94_ = 1.f; float xa98_maxEnergy = 0.f; - std::unique_ptr xa9c_; - std::vector> xaa0_; + std::unique_ptr xa9c_collisionActorMgr2; + std::vector> xaa0_scriptSounds; float xab0_ = 0.f; std::vector xab4_; // TODO type int xac4_ = 0; @@ -66,13 +66,13 @@ private: TUniqueId xada_ = kInvalidUniqueId; bool xadc_ = false; bool xadd_ = false; - bool xade_ = false; + u8 xade_ = 0; bool xadf_ = true; bool xae0_ = true; - CDamageVulnerability xae4_ = CDamageVulnerability::NormalVulnerabilty(); + CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty(); int xb4c_ = 0; float xb50_ = 0.f; - zeus::CColor xb54_ = zeus::skWhite; + zeus::CColor xb54_platformColor = zeus::skWhite; float xb58_ = 2.5f; float xb5c_ = 0.f; float xb60_ = 0.f; @@ -136,5 +136,12 @@ public: private: void CreateFlash(CStateManager& mgr, float arg); + void SetupCollisionManager(CStateManager& mgr); + void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count, + std::vector& outJoints) const; + void AddOBBAutoSizeCollisionList(const SOBBJointInfo* joints, size_t count, + std::vector& outJoints) const; + void SetupCollisionActorInfo1(const std::unique_ptr& actMgr, CStateManager& mgr); + void SetupCollisionActorInfo2(const std::unique_ptr& actMgr, CStateManager& mgr); }; } // namespace urde::MP1 diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index d479d0597..48b6d3a33 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -189,6 +189,7 @@ public: float GetAverageAnimVelocity(int anim) const; u8 GetTargetableVisorFlags() const { return xe6_31_targetableVisorFlags; } bool GetIsTargetable() const { return xe7_31_targetable; } + const CModelFlags& GetDrawFlags() const { return xb4_drawFlags; } void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; } void SetModelData(std::unique_ptr&& mData); u8 GetFluidCounter() const { return xe6_24_fluidCounter; } diff --git a/Runtime/World/CPatterned.hpp b/Runtime/World/CPatterned.hpp index 2190af4e5..c1ac59538 100644 --- a/Runtime/World/CPatterned.hpp +++ b/Runtime/World/CPatterned.hpp @@ -374,6 +374,7 @@ public: const CBodyController* GetBodyController() const { return x450_bodyController.get(); } CBodyController* GetBodyController() { return x450_bodyController.get(); } const CKnockBackController& GetKnockBackController() const { return x460_knockBackController; } + CKnockBackController& GetKnockBackController() { return x460_knockBackController; } void SetupPlayerCollision(bool); CGameProjectile* LaunchProjectile(const zeus::CTransform& gunXf, CStateManager& mgr, int maxAllowed, EProjectileAttrib attrib, bool playerHoming,