mirror of https://github.com/AxioDL/metaforce.git
COmegaPirate: Implement AcceptScriptMsg & collision setup
This commit is contained in:
parent
fb9765656c
commit
93751972ac
|
@ -194,8 +194,23 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetupPathFindSearch();
|
|
||||||
void SetShotAt(bool val, CStateManager& mgr);
|
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<TUniqueId, 7>& vec) const;
|
bool IsArmClawCollider(TUniqueId uid, const rstl::reserved_vector<TUniqueId, 7>& vec) const;
|
||||||
void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count,
|
void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count,
|
||||||
std::vector<CJointCollisionDescription>& outJoints) const;
|
std::vector<CJointCollisionDescription>& outJoints) const;
|
||||||
|
@ -205,12 +220,8 @@ protected:
|
||||||
void SetupCollisionActorInfo(CStateManager& mgr);
|
void SetupCollisionActorInfo(CStateManager& mgr);
|
||||||
bool IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info,
|
bool IsArmClawCollider(std::string_view name, std::string_view locator, const SJointInfo* info,
|
||||||
size_t infoCount) const;
|
size_t infoCount) const;
|
||||||
void CreateGrenadeLauncher(CStateManager& mgr, TUniqueId uid);
|
|
||||||
void ApplyDamageToHead(CStateManager& mgr, TUniqueId uid);
|
void ApplyDamageToHead(CStateManager& mgr, TUniqueId uid);
|
||||||
void CreateEnergyAbsorb(CStateManager& mgr, const zeus::CTransform& xf);
|
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;
|
bool CanKnockBack(const CDamageInfo& info) const;
|
||||||
void UpdateDestPos(CStateManager& mgr);
|
void UpdateDestPos(CStateManager& mgr);
|
||||||
void CheckAttackChance(CStateManager& mgr);
|
void CheckAttackChance(CStateManager& mgr);
|
||||||
|
@ -219,17 +230,10 @@ protected:
|
||||||
bool IsAttractingEnergy() const;
|
bool IsAttractingEnergy() const;
|
||||||
void UpdateTimers(float dt);
|
void UpdateTimers(float dt);
|
||||||
void UpdatePositionHistory();
|
void UpdatePositionHistory();
|
||||||
void UpdateActorTransform(CStateManager& mgr, TUniqueId& uid, std::string_view name);
|
|
||||||
void UpdateHealthInfo(CStateManager& mgr);
|
void UpdateHealthInfo(CStateManager& mgr);
|
||||||
void ExtendTouchBounds(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 7>& uids,
|
void ExtendTouchBounds(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 7>& uids,
|
||||||
const zeus::CVector3f& vec) const;
|
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<TUniqueId, 1024>& charNearList,
|
bool IsClosestEnergyAttractor(const CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& charNearList,
|
||||||
const zeus::CVector3f& projectilePos) const;
|
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
|
} // namespace urde::MP1
|
||||||
|
|
|
@ -4,12 +4,38 @@
|
||||||
#include "Runtime/Collision/CCollisionActorManager.hpp"
|
#include "Runtime/Collision/CCollisionActorManager.hpp"
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
|
#include "Runtime/Graphics/CBooRenderer.hpp"
|
||||||
|
#include "Runtime/Weapon/CGameProjectile.hpp"
|
||||||
#include "Runtime/World/CPlayer.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 "Runtime/World/CWorld.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace urde::MP1 {
|
namespace urde::MP1 {
|
||||||
|
namespace {
|
||||||
|
constexpr std::array<SSphereJointInfo, 1> skSphereJoints{{
|
||||||
|
{"lockon_target_LCTR", 1.f},
|
||||||
|
}};
|
||||||
|
|
||||||
|
constexpr std::array<SOBBJointInfo, 11> 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,
|
COmegaPirate::CFlash::CFlash(TUniqueId uid, const CEntityInfo& info, const zeus::CVector3f& pos,
|
||||||
TToken<CTexture>& thermalSpot, float p5)
|
TToken<CTexture>& thermalSpot, float p5)
|
||||||
: CActor(uid, true, "Omega Pirate Flash", info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), {},
|
: 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())
|
, x9d0_(GetModelData()->GetScale())
|
||||||
, x9f0_(*g_SimplePool, w1, w2, w3, 0, 0)
|
, x9f0_(*g_SimplePool, w1, w2, w3, 0, 0)
|
||||||
, xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) {
|
, xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) {
|
||||||
x9a4_.reserve(3);
|
x9a4_scriptWaypointPlatforms.reserve(3);
|
||||||
x9b8_.reserve(24);
|
x9b8_scriptEffects.reserve(24);
|
||||||
x9dc_.reserve(4);
|
x9dc_scriptPlatforms.reserve(4);
|
||||||
xaa0_.reserve(4);
|
xaa0_scriptSounds.reserve(4);
|
||||||
xab4_.reserve(3);
|
xab4_.reserve(3);
|
||||||
xb7c_.resize(4, 0);
|
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) {
|
void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||||
CElitePirate::AcceptScriptMsg(msg, uid, mgr);
|
switch (msg) {
|
||||||
// TODO
|
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<CCollisionActor> actor = mgr.ObjectById(uid)) {
|
||||||
|
if (TCastToPtr<CPlayer> 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<CActor*>(mgr.ObjectById(GetLauncherId()))) {
|
||||||
|
actor->RemoveMaterial(EMaterialTypes::Scannable, mgr);
|
||||||
|
}
|
||||||
|
if (auto* actor = static_cast<CActor*>(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<CScriptEffect> effect = mgr.ObjectById(connId)) {
|
||||||
|
x9b8_scriptEffects.emplace_back(connId, effect->GetName());
|
||||||
|
} else if (TCastToPtr<CScriptPlatform> 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<CScriptSound> sound = mgr.ObjectById(connId)) {
|
||||||
|
xaa0_scriptSounds.emplace_back(connId, sound->GetName());
|
||||||
|
}
|
||||||
|
} else if (conn.x4_msg == EScriptObjectMessage::Follow) {
|
||||||
|
if (TCastToPtr<CScriptWaypoint> waypoint = mgr.ObjectById(connId)) {
|
||||||
|
std::vector<TUniqueId> waypointPlatformIds;
|
||||||
|
waypointPlatformIds.reserve(3);
|
||||||
|
for (const SConnection& waypointConn : waypoint->GetConnectionList()) {
|
||||||
|
auto waypointConnId = mgr.GetIdForScript(waypointConn.x8_objId);
|
||||||
|
if (TCastToPtr<CScriptPlatform> 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<CGameProjectile> 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) {
|
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 {
|
void COmegaPirate::Render(const CStateManager& mgr) const {
|
||||||
CPatterned::Render(mgr);
|
const auto* mData = GetModelData();
|
||||||
// TODO
|
auto* animData = const_cast<CAnimData*>(mData->GetAnimationData());
|
||||||
|
|
||||||
|
CGraphics::SetModelMatrix(GetTransform() * zeus::CTransform::Scale(mData->GetScale()));
|
||||||
|
|
||||||
|
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay && xa2c_ > 0.f) {
|
||||||
|
auto& model = const_cast<CSkinnedModel&>(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<CSkinnedModel&>(*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) {
|
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) {
|
void COmegaPirate::Think(float dt, CStateManager& mgr) {
|
||||||
CElitePirate::Think(dt, mgr);
|
if (GetActive()) {
|
||||||
// TODO
|
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) {
|
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},
|
mgr.AddObject(new CFlash(mgr.AllocateUniqueId(), CEntityInfo{GetAreaIdAlways(), CEntity::NullConnectionList},
|
||||||
GetRenderBounds().center(), xb70_thermalSpot, arg));
|
GetRenderBounds().center(), xb70_thermalSpot, arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COmegaPirate::SetupCollisionManager(CStateManager& mgr) {
|
||||||
|
std::vector<CJointCollisionDescription> sphereJoints;
|
||||||
|
sphereJoints.reserve(skSphereJoints.size());
|
||||||
|
AddSphereCollisionList(skSphereJoints.data(), skSphereJoints.size(), sphereJoints);
|
||||||
|
xa38_collisionActorMgr1 =
|
||||||
|
std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), sphereJoints, true);
|
||||||
|
SetupCollisionActorInfo1(xa38_collisionActorMgr1, mgr);
|
||||||
|
xa46_ = xa38_collisionActorMgr1->GetCollisionDescFromIndex(0).GetCollisionActorId();
|
||||||
|
if (auto* actor = static_cast<CActor*>(mgr.ObjectById(xa46_))) {
|
||||||
|
*actor->HealthInfo(mgr) = *HealthInfo(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CJointCollisionDescription> obbJoints;
|
||||||
|
obbJoints.reserve(skObbJoints.size());
|
||||||
|
AddOBBAutoSizeCollisionList(skObbJoints.data(), skObbJoints.size(), obbJoints);
|
||||||
|
xa9c_collisionActorMgr2 =
|
||||||
|
std::make_unique<CCollisionActorManager>(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<CJointCollisionDescription>& 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<CJointCollisionDescription>& 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<CCollisionActorManager>& 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<CCollisionActor> 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<CCollisionActorManager>& 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<CCollisionActor> 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
|
} // namespace urde::MP1
|
||||||
|
|
|
@ -25,26 +25,26 @@ private:
|
||||||
float x99c_ = 1.f;
|
float x99c_ = 1.f;
|
||||||
bool x9a0_ = true;
|
bool x9a0_ = true;
|
||||||
bool x9a1_ = true;
|
bool x9a1_ = true;
|
||||||
std::vector<int> x9a4_; // TODO type
|
std::vector<std::pair<TUniqueId, std::vector<TUniqueId>>> x9a4_scriptWaypointPlatforms;
|
||||||
bool x9b4_ = false;
|
bool x9b4_ = false;
|
||||||
std::vector<std::pair<TUniqueId, std::string_view>> x9b8_;
|
std::vector<std::pair<TUniqueId, std::string_view>> x9b8_scriptEffects;
|
||||||
int x9c8_ = 0;
|
int x9c8_ = 0;
|
||||||
float x9cc_ = 0.f;
|
float x9cc_ = 0.f;
|
||||||
zeus::CVector3f x9d0_;
|
zeus::CVector3f x9d0_;
|
||||||
std::vector<std::pair<TUniqueId, std::string_view>> x9dc_;
|
std::vector<std::pair<TUniqueId, std::string_view>> x9dc_scriptPlatforms;
|
||||||
bool x9ec_ = false;
|
bool x9ec_ = false;
|
||||||
CSkinnedModel x9f0_;
|
CSkinnedModel x9f0_;
|
||||||
float xa2c_ = 0.f;
|
float xa2c_ = 0.f;
|
||||||
int xa30_ = 0;
|
int xa30_ = 0;
|
||||||
float xa34_ = 0.f;
|
float xa34_ = 0.f;
|
||||||
std::unique_ptr<CCollisionActorManager> xa38_;
|
std::unique_ptr<CCollisionActorManager> xa38_collisionActorMgr1;
|
||||||
bool xa3c_hearPlayer = false;
|
bool xa3c_hearPlayer = false;
|
||||||
pas::ELocomotionType xa40_ = pas::ELocomotionType::Relaxed;
|
pas::ELocomotionType xa40_ = pas::ELocomotionType::Relaxed;
|
||||||
bool xa44_ = false;
|
bool xa44_ = false;
|
||||||
TUniqueId xa46_ = kInvalidUniqueId;
|
TUniqueId xa46_ = kInvalidUniqueId;
|
||||||
TUniqueId xa48_ = kInvalidUniqueId;
|
TUniqueId xa48_ = kInvalidUniqueId;
|
||||||
bool xa4a_ = false;
|
bool xa4a_ = false;
|
||||||
zeus::CTransform xa4c_;
|
zeus::CTransform xa4c_initialXf;
|
||||||
int xa7c_ = 0;
|
int xa7c_ = 0;
|
||||||
float xa80_ = 1.f;
|
float xa80_ = 1.f;
|
||||||
float xa84_ = 0.f;
|
float xa84_ = 0.f;
|
||||||
|
@ -53,8 +53,8 @@ private:
|
||||||
float xa90_ = 1.f;
|
float xa90_ = 1.f;
|
||||||
float xa94_ = 1.f;
|
float xa94_ = 1.f;
|
||||||
float xa98_maxEnergy = 0.f;
|
float xa98_maxEnergy = 0.f;
|
||||||
std::unique_ptr<CCollisionActorManager> xa9c_;
|
std::unique_ptr<CCollisionActorManager> xa9c_collisionActorMgr2;
|
||||||
std::vector<std::pair<TUniqueId, std::string_view>> xaa0_;
|
std::vector<std::pair<TUniqueId, std::string_view>> xaa0_scriptSounds;
|
||||||
float xab0_ = 0.f;
|
float xab0_ = 0.f;
|
||||||
std::vector<int> xab4_; // TODO type
|
std::vector<int> xab4_; // TODO type
|
||||||
int xac4_ = 0;
|
int xac4_ = 0;
|
||||||
|
@ -66,13 +66,13 @@ private:
|
||||||
TUniqueId xada_ = kInvalidUniqueId;
|
TUniqueId xada_ = kInvalidUniqueId;
|
||||||
bool xadc_ = false;
|
bool xadc_ = false;
|
||||||
bool xadd_ = false;
|
bool xadd_ = false;
|
||||||
bool xade_ = false;
|
u8 xade_ = 0;
|
||||||
bool xadf_ = true;
|
bool xadf_ = true;
|
||||||
bool xae0_ = true;
|
bool xae0_ = true;
|
||||||
CDamageVulnerability xae4_ = CDamageVulnerability::NormalVulnerabilty();
|
CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty();
|
||||||
int xb4c_ = 0;
|
int xb4c_ = 0;
|
||||||
float xb50_ = 0.f;
|
float xb50_ = 0.f;
|
||||||
zeus::CColor xb54_ = zeus::skWhite;
|
zeus::CColor xb54_platformColor = zeus::skWhite;
|
||||||
float xb58_ = 2.5f;
|
float xb58_ = 2.5f;
|
||||||
float xb5c_ = 0.f;
|
float xb5c_ = 0.f;
|
||||||
float xb60_ = 0.f;
|
float xb60_ = 0.f;
|
||||||
|
@ -136,5 +136,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateFlash(CStateManager& mgr, float arg);
|
void CreateFlash(CStateManager& mgr, float arg);
|
||||||
|
void SetupCollisionManager(CStateManager& mgr);
|
||||||
|
void AddSphereCollisionList(const SSphereJointInfo* joints, size_t count,
|
||||||
|
std::vector<CJointCollisionDescription>& outJoints) const;
|
||||||
|
void AddOBBAutoSizeCollisionList(const SOBBJointInfo* joints, size_t count,
|
||||||
|
std::vector<CJointCollisionDescription>& outJoints) const;
|
||||||
|
void SetupCollisionActorInfo1(const std::unique_ptr<CCollisionActorManager>& actMgr, CStateManager& mgr);
|
||||||
|
void SetupCollisionActorInfo2(const std::unique_ptr<CCollisionActorManager>& actMgr, CStateManager& mgr);
|
||||||
};
|
};
|
||||||
} // namespace urde::MP1
|
} // namespace urde::MP1
|
||||||
|
|
|
@ -189,6 +189,7 @@ public:
|
||||||
float GetAverageAnimVelocity(int anim) const;
|
float GetAverageAnimVelocity(int anim) const;
|
||||||
u8 GetTargetableVisorFlags() const { return xe6_31_targetableVisorFlags; }
|
u8 GetTargetableVisorFlags() const { return xe6_31_targetableVisorFlags; }
|
||||||
bool GetIsTargetable() const { return xe7_31_targetable; }
|
bool GetIsTargetable() const { return xe7_31_targetable; }
|
||||||
|
const CModelFlags& GetDrawFlags() const { return xb4_drawFlags; }
|
||||||
void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; }
|
void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; }
|
||||||
void SetModelData(std::unique_ptr<CModelData>&& mData);
|
void SetModelData(std::unique_ptr<CModelData>&& mData);
|
||||||
u8 GetFluidCounter() const { return xe6_24_fluidCounter; }
|
u8 GetFluidCounter() const { return xe6_24_fluidCounter; }
|
||||||
|
|
|
@ -374,6 +374,7 @@ public:
|
||||||
const CBodyController* GetBodyController() const { return x450_bodyController.get(); }
|
const CBodyController* GetBodyController() const { return x450_bodyController.get(); }
|
||||||
CBodyController* GetBodyController() { return x450_bodyController.get(); }
|
CBodyController* GetBodyController() { return x450_bodyController.get(); }
|
||||||
const CKnockBackController& GetKnockBackController() const { return x460_knockBackController; }
|
const CKnockBackController& GetKnockBackController() const { return x460_knockBackController; }
|
||||||
|
CKnockBackController& GetKnockBackController() { return x460_knockBackController; }
|
||||||
void SetupPlayerCollision(bool);
|
void SetupPlayerCollision(bool);
|
||||||
CGameProjectile* LaunchProjectile(const zeus::CTransform& gunXf, CStateManager& mgr, int maxAllowed,
|
CGameProjectile* LaunchProjectile(const zeus::CTransform& gunXf, CStateManager& mgr, int maxAllowed,
|
||||||
EProjectileAttrib attrib, bool playerHoming,
|
EProjectileAttrib attrib, bool playerHoming,
|
||||||
|
|
Loading…
Reference in New Issue