mirror of https://github.com/AxioDL/metaforce.git
CElitePirate/COmegaPirate: Cleanup & renaming
This commit is contained in:
parent
8aef93473e
commit
1c775a7ea7
|
@ -9,13 +9,13 @@
|
|||
#include <zeus/CTransform.hpp>
|
||||
|
||||
namespace urde::MP1 {
|
||||
struct SGrenadeUnknownStruct {
|
||||
struct SGrenadeVelocityInfo {
|
||||
private:
|
||||
float x0_mass;
|
||||
float x4_speed; // wrong name probably
|
||||
float x4_speed;
|
||||
|
||||
public:
|
||||
explicit SGrenadeUnknownStruct(CInputStream& in) : x0_mass(in.readFloatBig()), x4_speed(in.readFloatBig()) {}
|
||||
explicit SGrenadeVelocityInfo(CInputStream& in) : x0_mass(in.readFloatBig()), x4_speed(in.readFloatBig()) {}
|
||||
|
||||
[[nodiscard]] float GetMass() const { return x0_mass; }
|
||||
[[nodiscard]] float GetSpeed() const { return x4_speed; }
|
||||
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
struct SBouncyGrenadeData {
|
||||
private:
|
||||
SGrenadeUnknownStruct x0_;
|
||||
SGrenadeVelocityInfo x0_velocityInfo;
|
||||
CDamageInfo x8_damageInfo;
|
||||
CAssetId x24_elementGenId1;
|
||||
CAssetId x28_elementGenId2;
|
||||
|
@ -34,19 +34,20 @@ private:
|
|||
u16 x3a_explodeSfx;
|
||||
|
||||
public:
|
||||
SBouncyGrenadeData(const SGrenadeUnknownStruct& unkStruct, const CDamageInfo& damageInfo, CAssetId w1, CAssetId w2,
|
||||
CAssetId w3, CAssetId w4, u32 w5, u16 s1, u16 s2)
|
||||
: x0_(unkStruct)
|
||||
SBouncyGrenadeData(const SGrenadeVelocityInfo& velocityInfo, const CDamageInfo& damageInfo, CAssetId elementGenId1,
|
||||
CAssetId elementGenId2, CAssetId elementGenId3, CAssetId elementGenId4, u32 numBounces,
|
||||
u16 bounceSfxId, u16 explodeSfxId)
|
||||
: x0_velocityInfo(velocityInfo)
|
||||
, x8_damageInfo(damageInfo)
|
||||
, x24_elementGenId1(w1)
|
||||
, x28_elementGenId2(w2)
|
||||
, x2c_elementGenId3(w3)
|
||||
, x30_elementGenId4(w4)
|
||||
, x34_numBounces(w5)
|
||||
, x38_bounceSfx(s1)
|
||||
, x3a_explodeSfx(s2){};
|
||||
, x24_elementGenId1(elementGenId1)
|
||||
, x28_elementGenId2(elementGenId2)
|
||||
, x2c_elementGenId3(elementGenId3)
|
||||
, x30_elementGenId4(elementGenId4)
|
||||
, x34_numBounces(numBounces)
|
||||
, x38_bounceSfx(bounceSfxId)
|
||||
, x3a_explodeSfx(explodeSfxId){};
|
||||
|
||||
[[nodiscard]] const SGrenadeUnknownStruct& GetUnkStruct() const { return x0_; }
|
||||
[[nodiscard]] const SGrenadeVelocityInfo& GetUnkStruct() const { return x0_velocityInfo; }
|
||||
[[nodiscard]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; }
|
||||
[[nodiscard]] CAssetId GetElementGenId1() const { return x24_elementGenId1; }
|
||||
[[nodiscard]] CAssetId GetElementGenId2() const { return x28_elementGenId2; }
|
||||
|
|
|
@ -48,31 +48,31 @@ CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount)
|
|||
, x10_attackChance(in.readFloatBig())
|
||||
, x14_shotAtTime(in.readFloatBig())
|
||||
, x18_shotAtTimeVariance(in.readFloatBig())
|
||||
, x1c_(in.readFloatBig())
|
||||
, x20_(in)
|
||||
, x24_sfxAbsorb(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, x1c_projectileAttractionRadius(in.readFloatBig())
|
||||
, x20_energyAbsorbParticleDescId(in)
|
||||
, x24_energyAbsorbSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, x28_launcherActParams(ScriptLoader::LoadActorParameters(in))
|
||||
, x90_launcherAnimParams(ScriptLoader::LoadAnimationParameters(in))
|
||||
, x9c_(in)
|
||||
, xa0_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, xa4_(in)
|
||||
, xa8_(in)
|
||||
, x9c_launcherParticleGenDescId(in)
|
||||
, xa0_launcherSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, xa4_grenadeModelId(in)
|
||||
, xa8_grenadeDamageInfo(in)
|
||||
, xc4_launcherHp(in.readFloatBig())
|
||||
, xc8_(in)
|
||||
, xcc_(in)
|
||||
, xd0_(in)
|
||||
, xd4_(in)
|
||||
, xd8_(in)
|
||||
, xe0_trajectoryInfo(in)
|
||||
, xc8_grenadeElementGenDescId1(in)
|
||||
, xcc_grenadeElementGenDescId2(in)
|
||||
, xd0_grenadeElementGenDescId3(in)
|
||||
, xd4_grenadeElementGenDescId4(in)
|
||||
, xd8_grenadeVelocityInfo(in)
|
||||
, xe0_grenadeTrajectoryInfo(in)
|
||||
, xf0_grenadeNumBounces(in.readUint32Big())
|
||||
, xf4_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, xf6_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, xf8_(in)
|
||||
, xfc_(in)
|
||||
, x118_(in)
|
||||
, x11c_(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, x11e_(in.readBool())
|
||||
, x11f_(propCount < 42 ? true : in.readBool()) {}
|
||||
, xf4_grenadeBounceSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, xf6_grenadeExplodeSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, xf8_shockwaveParticleDescId(in)
|
||||
, xfc_shockwaveDamageInfo(in)
|
||||
, x118_shockwaveWeaponDescId(in)
|
||||
, x11c_shockwaveElectrocuteSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
|
||||
, x11e_canCallForBackup(in.readBool())
|
||||
, x11f_fastWhenAttractingEnergy(propCount < 42 ? true : in.readBool()) {}
|
||||
|
||||
CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
|
||||
|
@ -86,8 +86,8 @@ CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityIn
|
|||
, x738_collisionAabb(GetBoundingBox(), GetMaterialList())
|
||||
, x7a0_initialSpeed(x3b4_speed)
|
||||
, x7d0_pathFindSearch(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f) {
|
||||
if (x5d8_data.GetX20().IsValid()) {
|
||||
x760_energyAbsorbDesc = g_SimplePool->GetObj({SBIG('PART'), x5d8_data.GetX20()});
|
||||
if (x5d8_data.GetEnergyAbsorbParticleDescId().IsValid()) {
|
||||
x760_energyAbsorbDesc = g_SimplePool->GetObj({SBIG('PART'), x5d8_data.GetEnergyAbsorbParticleDescId()});
|
||||
}
|
||||
|
||||
x460_knockBackController.SetEnableFreeze(false);
|
||||
|
@ -108,7 +108,7 @@ void CElitePirate::Think(float dt, CStateManager& mgr) {
|
|||
x730_collisionActorMgrHead->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
||||
}
|
||||
x5d4_collisionActorMgr->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
||||
if (IsAttractingEnergy() && x5d8_data.GetX11F()) {
|
||||
if (IsAttractingEnergy() && x5d8_data.IsFastWhenAttractingEnergy()) {
|
||||
x3b4_speed = 2.f * x7a0_initialSpeed;
|
||||
} else {
|
||||
x3b4_speed = x7a0_initialSpeed;
|
||||
|
@ -218,7 +218,7 @@ void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
|
|||
KnockBack(projectile->GetTranslation() - projectile->GetPreviousPos(), mgr, damageInfo,
|
||||
EKnockBackType::Radius, false, damageInfo.GetKnockBackPower());
|
||||
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
||||
} else if (uid == x79c_ && x760_energyAbsorbDesc->IsLoaded()) {
|
||||
} else if (uid == x79c_energyAttractorId && x760_energyAbsorbDesc->IsLoaded()) {
|
||||
CreateEnergyAbsorb(mgr, projectile->GetTransform());
|
||||
}
|
||||
SetShotAt(true, mgr);
|
||||
|
@ -284,7 +284,7 @@ zeus::CVector3f CElitePirate::GetAimPosition(const CStateManager& mgr, float) co
|
|||
const std::shared_ptr<CPlayerState>& playerState = mgr.GetPlayerState();
|
||||
if (x5d4_collisionActorMgr->GetActive() && playerState->IsFiringComboBeam() &&
|
||||
playerState->GetCurrentBeam() == CPlayerState::EBeamId::Wave) {
|
||||
if (const TCastToConstPtr<CCollisionActor> actor = mgr.GetObjectById(x79c_)) {
|
||||
if (const TCastToConstPtr<CCollisionActor> actor = mgr.GetObjectById(x79c_energyAttractorId)) {
|
||||
return actor->GetTranslation();
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ void CElitePirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (!TooClose(mgr, 0.f) && !PathShagged(mgr, 0.f)) {
|
||||
CPatterned::PathFind(mgr, msg, dt);
|
||||
} else if (PathShagged(mgr, 0.f)) {
|
||||
const zeus::CVector3f move = x8c0_.GetValue(GetTranslation(), GetTransform().frontVector());
|
||||
const auto move = x8c0_positionHistory.GetValue(GetTranslation(), GetTransform().frontVector());
|
||||
if (move != zeus::skZero3f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f));
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ void CElitePirate::Run(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
CPatterned::PathFind(mgr, msg, dt);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (PathShagged(mgr, 0.f)) {
|
||||
const auto move = x8c0_.GetValue(GetTranslation(), GetTransform().frontVector());
|
||||
const auto move = x8c0_positionHistory.GetValue(GetTranslation(), GetTransform().frontVector());
|
||||
if (move != zeus::skZero3f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f));
|
||||
} else if (ShouldTurn(mgr, 0.f)) {
|
||||
|
@ -661,7 +661,7 @@ void CElitePirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (!TooClose(mgr, 0.f) && !PathShagged(mgr, 0.f)) {
|
||||
CPatterned::PathFind(mgr, msg, dt);
|
||||
} else if (PathShagged(mgr, 0.f)) {
|
||||
const zeus::CVector3f move = x8c0_.GetValue(GetTranslation(), GetTransform().frontVector());
|
||||
const auto move = x8c0_positionHistory.GetValue(GetTranslation(), GetTransform().frontVector());
|
||||
if (move != zeus::skZero3f) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f));
|
||||
}
|
||||
|
@ -880,8 +880,8 @@ void CElitePirate::SetupCollisionActorInfo(CStateManager& mgr) {
|
|||
}
|
||||
|
||||
const CJointCollisionDescription& description = x5d4_collisionActorMgr->GetCollisionDescFromIndex(0);
|
||||
x79c_ = description.GetCollisionActorId();
|
||||
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(x79c_)) {
|
||||
x79c_energyAttractorId = description.GetCollisionActorId();
|
||||
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(x79c_energyAttractorId)) {
|
||||
act->SetWeaponCollisionResponseType(EWeaponCollisionResponseTypes::None);
|
||||
}
|
||||
x5d4_collisionActorMgr->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough});
|
||||
|
@ -933,7 +933,7 @@ void CElitePirate::CreateEnergyAbsorb(CStateManager& mgr, const zeus::CTransform
|
|||
mgr.AddObject(new CExplosion(*x760_energyAbsorbDesc, mgr.AllocateUniqueId(), true,
|
||||
{GetAreaIdAlways(), CEntity::NullConnectionList}, "Absorb energy Fx", xf, 0,
|
||||
GetModelData()->GetScale(), zeus::skWhite));
|
||||
CSfxManager::AddEmitter(x5d8_data.GetSFXAbsorb(), GetTranslation(), zeus::skUp, false, false, 0x7f,
|
||||
CSfxManager::AddEmitter(x5d8_data.GetEnergyAbsorbSfxId(), GetTranslation(), zeus::skUp, false, false, 0x7f,
|
||||
GetAreaIdAlways());
|
||||
x7ac_energyAbsorbCooldown = 0.25f;
|
||||
}
|
||||
|
@ -988,12 +988,12 @@ void CElitePirate::AttractProjectiles(CStateManager& mgr) {
|
|||
if (!IsAlive()) {
|
||||
return;
|
||||
}
|
||||
const TCastToConstPtr<CCollisionActor> actor = mgr.GetObjectById(x79c_);
|
||||
const TCastToConstPtr<CCollisionActor> actor = mgr.GetObjectById(x79c_energyAttractorId);
|
||||
if (!actor) {
|
||||
return;
|
||||
}
|
||||
|
||||
float radius = x5d8_data.GetX1C();
|
||||
float radius = x5d8_data.GetProjectileAttractionRadius();
|
||||
const zeus::CVector3f actorPos = actor->GetTranslation();
|
||||
const zeus::CVector3f pos = GetTranslation();
|
||||
rstl::reserved_vector<TUniqueId, 1024> projNearList;
|
||||
|
@ -1090,9 +1090,9 @@ void CElitePirate::UpdateTimers(float dt) {
|
|||
void CElitePirate::UpdatePositionHistory() {
|
||||
const zeus::CVector3f pos = GetTranslation();
|
||||
if (x7d0_pathFindSearch.OnPath(pos) == CPathFindSearch::EResult::Success) {
|
||||
x8c0_.Clear();
|
||||
x8c0_positionHistory.Clear();
|
||||
}
|
||||
x8c0_.AddValue(pos);
|
||||
x8c0_positionHistory.AddValue(pos);
|
||||
}
|
||||
|
||||
void CElitePirate::UpdateActorTransform(CStateManager& mgr, TUniqueId& uid, std::string_view name) {
|
||||
|
@ -1113,7 +1113,7 @@ void CElitePirate::UpdateHealthInfo(CStateManager& mgr) {
|
|||
if (TCastToPtr<CCollisionActor> actor = mgr.ObjectById(x770_collisionHeadId)) {
|
||||
const float headHp = actor->HealthInfo(mgr)->GetHP();
|
||||
HealthInfo(mgr)->SetHP(hp - (hp - headHp));
|
||||
*actor->HealthInfo(mgr) = *HealthInfo(mgr); // TODO does this work?
|
||||
*actor->HealthInfo(mgr) = *HealthInfo(mgr);
|
||||
}
|
||||
}
|
||||
if (HealthInfo(mgr)->GetHP() <= 0.f) {
|
||||
|
@ -1157,7 +1157,7 @@ bool CElitePirate::ShouldFireFromLauncher(CStateManager& mgr, TUniqueId launcher
|
|||
}
|
||||
|
||||
bool CElitePirate::ShouldCallForBackupFromLauncher(const CStateManager& mgr, TUniqueId uid) const {
|
||||
if (x988_30_calledForBackup || uid != kInvalidUniqueId || !x5d8_data.GetX11E()) {
|
||||
if (x988_30_calledForBackup || uid != kInvalidUniqueId || !x5d8_data.CanCallForBackup()) {
|
||||
return false;
|
||||
}
|
||||
return x7a8_pathShaggedTime >= 3.f;
|
||||
|
@ -1178,27 +1178,27 @@ bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr,
|
|||
return true;
|
||||
}
|
||||
|
||||
zeus::CVector3f CElitePirate::SUnknownStruct::GetValue(const zeus::CVector3f& v1, const zeus::CVector3f& v2) {
|
||||
while (!x4_.empty()) {
|
||||
const zeus::CVector3f v = x4_.back() - v1;
|
||||
if (v.dot(v2) > 0.f && v.isMagnitudeSafe()) {
|
||||
zeus::CVector3f CElitePirate::SPositionHistory::GetValue(const zeus::CVector3f& pos, const zeus::CVector3f& face) {
|
||||
while (!x4_values.empty()) {
|
||||
const zeus::CVector3f v = x4_values.back() - pos;
|
||||
if (v.dot(face) > 0.f && v.isMagnitudeSafe()) {
|
||||
return v.normalized();
|
||||
}
|
||||
x4_.pop_back();
|
||||
x4_values.pop_back();
|
||||
}
|
||||
return zeus::skZero3f;
|
||||
}
|
||||
|
||||
void CElitePirate::SUnknownStruct::AddValue(const zeus::CVector3f& vec) {
|
||||
if (x4_.size() > 15) {
|
||||
void CElitePirate::SPositionHistory::AddValue(const zeus::CVector3f& pos) {
|
||||
if (x4_values.size() > 15) {
|
||||
return;
|
||||
}
|
||||
if (x4_.empty()) {
|
||||
x4_.emplace_back(vec);
|
||||
if (x4_values.empty()) {
|
||||
x4_values.emplace_back(pos);
|
||||
return;
|
||||
}
|
||||
if (x4_.back().magSquared() > x0_) {
|
||||
x4_.emplace_back(vec);
|
||||
if (x4_values.back().magSquared() > x0_magSquared) {
|
||||
x4_values.emplace_back(pos);
|
||||
}
|
||||
}
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -20,31 +20,31 @@ private:
|
|||
float x10_attackChance;
|
||||
float x14_shotAtTime;
|
||||
float x18_shotAtTimeVariance;
|
||||
float x1c_;
|
||||
CAssetId x20_;
|
||||
u16 x24_sfxAbsorb;
|
||||
float x1c_projectileAttractionRadius;
|
||||
CAssetId x20_energyAbsorbParticleDescId;
|
||||
u16 x24_energyAbsorbSfxId;
|
||||
CActorParameters x28_launcherActParams;
|
||||
CAnimationParameters x90_launcherAnimParams;
|
||||
CAssetId x9c_;
|
||||
u16 xa0_;
|
||||
CAssetId xa4_;
|
||||
CDamageInfo xa8_;
|
||||
CAssetId x9c_launcherParticleGenDescId;
|
||||
u16 xa0_launcherSfxId;
|
||||
CAssetId xa4_grenadeModelId;
|
||||
CDamageInfo xa8_grenadeDamageInfo;
|
||||
float xc4_launcherHp;
|
||||
CAssetId xc8_;
|
||||
CAssetId xcc_;
|
||||
CAssetId xd0_;
|
||||
CAssetId xd4_;
|
||||
SGrenadeUnknownStruct xd8_;
|
||||
SGrenadeTrajectoryInfo xe0_trajectoryInfo;
|
||||
CAssetId xc8_grenadeElementGenDescId1;
|
||||
CAssetId xcc_grenadeElementGenDescId2;
|
||||
CAssetId xd0_grenadeElementGenDescId3;
|
||||
CAssetId xd4_grenadeElementGenDescId4;
|
||||
SGrenadeVelocityInfo xd8_grenadeVelocityInfo;
|
||||
SGrenadeTrajectoryInfo xe0_grenadeTrajectoryInfo;
|
||||
u32 xf0_grenadeNumBounces;
|
||||
u16 xf4_;
|
||||
u16 xf6_;
|
||||
CAssetId xf8_;
|
||||
CDamageInfo xfc_;
|
||||
CAssetId x118_;
|
||||
u16 x11c_;
|
||||
bool x11e_;
|
||||
bool x11f_;
|
||||
u16 xf4_grenadeBounceSfxId;
|
||||
u16 xf6_grenadeExplodeSfxId;
|
||||
CAssetId xf8_shockwaveParticleDescId;
|
||||
CDamageInfo xfc_shockwaveDamageInfo;
|
||||
CAssetId x118_shockwaveWeaponDescId;
|
||||
u16 x11c_shockwaveElectrocuteSfxId;
|
||||
bool x11e_canCallForBackup;
|
||||
bool x11f_fastWhenAttractingEnergy;
|
||||
|
||||
public:
|
||||
CElitePirateData(CInputStream&, u32 propCount);
|
||||
|
@ -54,25 +54,32 @@ public:
|
|||
[[nodiscard]] float GetAttackChance() const { return x10_attackChance; }
|
||||
[[nodiscard]] float GetShotAtTime() const { return x14_shotAtTime; }
|
||||
[[nodiscard]] float GetShotAtTimeVariance() const { return x18_shotAtTimeVariance; }
|
||||
[[nodiscard]] float GetX1C() const { return x1c_; }
|
||||
[[nodiscard]] CAssetId GetX20() const { return x20_; }
|
||||
[[nodiscard]] u16 GetSFXAbsorb() const { return x24_sfxAbsorb; }
|
||||
[[nodiscard]] float GetProjectileAttractionRadius() const { return x1c_projectileAttractionRadius; }
|
||||
[[nodiscard]] CAssetId GetEnergyAbsorbParticleDescId() const { return x20_energyAbsorbParticleDescId; }
|
||||
[[nodiscard]] u16 GetEnergyAbsorbSfxId() const { return x24_energyAbsorbSfxId; }
|
||||
[[nodiscard]] const CActorParameters& GetLauncherActParams() const { return x28_launcherActParams; }
|
||||
[[nodiscard]] const CAnimationParameters& GetLauncherAnimParams() const { return x90_launcherAnimParams; }
|
||||
[[nodiscard]] float GetLauncherHP() const { return xc4_launcherHp; }
|
||||
[[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return xe0_trajectoryInfo; }
|
||||
[[nodiscard]] CAssetId GetXF8() const { return xf8_; }
|
||||
[[nodiscard]] const CDamageInfo& GetXFC() const { return xfc_; }
|
||||
[[nodiscard]] CAssetId GetX118() const { return x118_; }
|
||||
[[nodiscard]] u16 GetX11C() const { return x11c_; }
|
||||
[[nodiscard]] bool GetX11E() const { return x11e_; }
|
||||
[[nodiscard]] bool GetX11F() const { return x11f_; }
|
||||
[[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return xe0_grenadeTrajectoryInfo; }
|
||||
[[nodiscard]] CAssetId GetShockwaveParticleDescId() const { return xf8_shockwaveParticleDescId; }
|
||||
[[nodiscard]] const CDamageInfo& GetShockwaveDamageInfo() const { return xfc_shockwaveDamageInfo; }
|
||||
[[nodiscard]] CAssetId GetShockwaveWeaponDescId() const { return x118_shockwaveWeaponDescId; }
|
||||
[[nodiscard]] u16 GetShockwaveElectrocuteSfxId() const { return x11c_shockwaveElectrocuteSfxId; }
|
||||
[[nodiscard]] bool CanCallForBackup() const { return x11e_canCallForBackup; }
|
||||
[[nodiscard]] bool IsFastWhenAttractingEnergy() const { return x11f_fastWhenAttractingEnergy; }
|
||||
|
||||
[[nodiscard]] SBouncyGrenadeData GetBouncyGrenadeData() const {
|
||||
return {xd8_, xa8_, xc8_, xcc_, xd0_, xd4_, xf0_grenadeNumBounces, xf4_, xf6_};
|
||||
return {
|
||||
xd8_grenadeVelocityInfo, xa8_grenadeDamageInfo, xc8_grenadeElementGenDescId1,
|
||||
xcc_grenadeElementGenDescId2, xd0_grenadeElementGenDescId3, xd4_grenadeElementGenDescId4,
|
||||
xf0_grenadeNumBounces, xf4_grenadeBounceSfxId, xf6_grenadeExplodeSfxId,
|
||||
};
|
||||
}
|
||||
[[nodiscard]] SGrenadeLauncherData GetGrenadeLauncherData() const {
|
||||
return {GetBouncyGrenadeData(), xa4_, x9c_, xa0_, xe0_trajectoryInfo};
|
||||
return {
|
||||
GetBouncyGrenadeData(), xa4_grenadeModelId, x9c_launcherParticleGenDescId,
|
||||
xa0_launcherSfxId, xe0_grenadeTrajectoryInfo,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -87,16 +94,16 @@ protected:
|
|||
};
|
||||
|
||||
private:
|
||||
struct SUnknownStruct {
|
||||
struct SPositionHistory {
|
||||
private:
|
||||
float x0_;
|
||||
rstl::reserved_vector<zeus::CVector3f, 16> x4_;
|
||||
float x0_magSquared;
|
||||
rstl::reserved_vector<zeus::CVector3f, 16> x4_values;
|
||||
|
||||
public:
|
||||
explicit SUnknownStruct(float f) : x0_(f * f) {}
|
||||
zeus::CVector3f GetValue(const zeus::CVector3f& v1, const zeus::CVector3f& v2);
|
||||
void AddValue(const zeus::CVector3f& vec);
|
||||
void Clear() { x4_.clear(); }
|
||||
explicit SPositionHistory(float mag) : x0_magSquared(mag * mag) {}
|
||||
zeus::CVector3f GetValue(const zeus::CVector3f& pos, const zeus::CVector3f& face);
|
||||
void AddValue(const zeus::CVector3f& pos);
|
||||
void Clear() { x4_values.clear(); }
|
||||
};
|
||||
|
||||
EState x568_state = EState::Invalid;
|
||||
|
@ -112,7 +119,7 @@ private:
|
|||
TUniqueId x772_launcherId = kInvalidUniqueId;
|
||||
rstl::reserved_vector<TUniqueId, 7> x774_collisionRJointIds;
|
||||
rstl::reserved_vector<TUniqueId, 7> x788_collisionLJointIds;
|
||||
TUniqueId x79c_ = kInvalidUniqueId;
|
||||
TUniqueId x79c_energyAttractorId = kInvalidUniqueId;
|
||||
float x7a0_initialSpeed;
|
||||
float x7a4_steeringSpeed = 1.f;
|
||||
float x7a8_pathShaggedTime = 0.f;
|
||||
|
@ -127,7 +134,7 @@ private:
|
|||
u32 x7cc_activeMaterialSet = 0;
|
||||
CPathFindSearch x7d0_pathFindSearch;
|
||||
zeus::CVector3f x8b4_targetDestPos;
|
||||
SUnknownStruct x8c0_{5.0f};
|
||||
SPositionHistory x8c0_positionHistory{5.0f};
|
||||
bool x988_24_damageOn : 1 = false;
|
||||
bool x988_25_attackingRightClaw : 1 = false;
|
||||
bool x988_26_attackingLeftClaw : 1 = false;
|
||||
|
@ -190,7 +197,8 @@ public:
|
|||
virtual void SetupHealthInfo(CStateManager& mgr);
|
||||
virtual void SetLaunchersActive(CStateManager& mgr, bool val);
|
||||
virtual SShockWaveData GetShockWaveData() const {
|
||||
return {x5d8_data.GetXF8(), x5d8_data.GetXFC(), 16.5217f, x5d8_data.GetX118(), x5d8_data.GetX11C()};
|
||||
return {x5d8_data.GetShockwaveParticleDescId(), x5d8_data.GetShockwaveDamageInfo(), 16.5217f,
|
||||
x5d8_data.GetShockwaveWeaponDescId(), x5d8_data.GetShockwaveElectrocuteSfxId()};
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -26,8 +26,8 @@ CGrenadeLauncher::CGrenadeLauncher(TUniqueId uid, std::string_view name, const C
|
|||
, x350_grenadeActorParams(actParams)
|
||||
, x3e8_thermalMag(actParams.GetThermalMag())
|
||||
, x3f8_explodePlayerDistance(f1) {
|
||||
if (data.GetExplosionGenDescId().IsValid()) {
|
||||
x3b8_particleGenDesc = g_SimplePool->GetObj({SBIG('PART'), data.GetExplosionGenDescId()});
|
||||
if (data.GetShootParticleGenDescId().IsValid()) {
|
||||
x3b8_particleGenDesc = g_SimplePool->GetObj({SBIG('PART'), data.GetShootParticleGenDescId()});
|
||||
}
|
||||
GetModelData()->EnableLooping(true);
|
||||
const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
|
||||
|
@ -92,13 +92,13 @@ void CGrenadeLauncher::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
|
|||
case EScriptObjectMessage::Start:
|
||||
if (x2cc_parentId == uid && x258_started != 1) {
|
||||
x258_started = 1;
|
||||
sub_80230438();
|
||||
UpdateStartAnimation();
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Stop:
|
||||
if (x2cc_parentId == uid && x258_started != 0) {
|
||||
x258_started = 0;
|
||||
sub_80230438();
|
||||
UpdateStartAnimation();
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Action:
|
||||
|
@ -107,7 +107,7 @@ void CGrenadeLauncher::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
|
|||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Registered:
|
||||
sub_80230438();
|
||||
UpdateStartAnimation();
|
||||
break;
|
||||
case EScriptObjectMessage::Damage:
|
||||
x3ec_damageTimer = 0.33f;
|
||||
|
@ -126,12 +126,12 @@ std::optional<zeus::CAABox> CGrenadeLauncher::GetTouchBounds() const {
|
|||
}
|
||||
|
||||
void CGrenadeLauncher::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
|
||||
if (x3f4_color3.a() == 1.f) {
|
||||
if (x3f4_damageAddColor.a() == 1.f) {
|
||||
xb4_drawFlags = CModelFlags{2, 0, 3, zeus::skWhite};
|
||||
// Original code redundantly sets a() = 1.f
|
||||
xb4_drawFlags.addColor = x3f4_color3;
|
||||
xb4_drawFlags.addColor = x3f4_damageAddColor;
|
||||
} else {
|
||||
xb4_drawFlags = CModelFlags{5, 0, 3, x3f4_color3};
|
||||
xb4_drawFlags = CModelFlags{5, 0, 3, x3f4_damageAddColor};
|
||||
}
|
||||
CActor::PreRender(mgr, frustum);
|
||||
}
|
||||
|
@ -196,7 +196,8 @@ void CGrenadeLauncher::UpdateDamageTime(float arg) {
|
|||
xd0_damageMag = x3e8_thermalMag;
|
||||
} else {
|
||||
x3ec_damageTimer = std::max(0.f, x3ec_damageTimer - arg);
|
||||
x3f4_color3 = zeus::CColor::lerp(zeus::skBlack, x3f0_color2, std::clamp(x3ec_damageTimer / 0.33f, 0.f, 1.f));
|
||||
x3f4_damageAddColor =
|
||||
zeus::CColor::lerp(zeus::skBlack, x3f0_color2, std::clamp(x3ec_damageTimer / 0.33f, 0.f, 1.f));
|
||||
xd0_damageMag = 5.f * x3ec_damageTimer + x3e8_thermalMag;
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +209,7 @@ void CGrenadeLauncher::CreateExplosion(CStateManager& mgr) {
|
|||
mgr.AddObject(new CExplosion(*x3b8_particleGenDesc, mgr.AllocateUniqueId(), true,
|
||||
{GetAreaIdAlways(), CEntity::NullConnectionList}, "Grenade Launcher Explode Fx"sv,
|
||||
GetTransform(), 0, GetModelData()->GetScale(), zeus::skWhite));
|
||||
CSfxManager::SfxStart(x2d0_data.GetExplosionSfx(), 1.f, 1.f, false, 0x7f, false, kInvalidAreaId);
|
||||
CSfxManager::SfxStart(x2d0_data.GetShootSfxId(), 1.f, 1.f, false, 0x7f, false, kInvalidAreaId);
|
||||
}
|
||||
|
||||
void CGrenadeLauncher::UpdateFollowPlayer(CStateManager& mgr, float dt) {
|
||||
|
@ -275,11 +276,11 @@ void CGrenadeLauncher::UpdateFollowPlayer(CStateManager& mgr, float dt) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGrenadeLauncher::sub_80230438() {
|
||||
void CGrenadeLauncher::UpdateStartAnimation() {
|
||||
CModelData* modelData = GetModelData();
|
||||
CAnimData* animData;
|
||||
if (modelData == nullptr || (animData = modelData->GetAnimationData()) == nullptr || x258_started <= -1 ||
|
||||
x258_started >= 2) {
|
||||
if (modelData == nullptr || (animData = modelData->GetAnimationData()) == nullptr || x258_started < 0 ||
|
||||
x258_started > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,25 +43,25 @@ public:
|
|||
struct SGrenadeLauncherData {
|
||||
private:
|
||||
SBouncyGrenadeData x0_grenadeData;
|
||||
CAssetId x3c_grenadeCmdl;
|
||||
CAssetId x40_launcherExplodeGenDesc;
|
||||
u16 x44_launcherExplodeSfx;
|
||||
SGrenadeTrajectoryInfo x48_trajectoryInfo;
|
||||
CAssetId x3c_grenadeModelId;
|
||||
CAssetId x40_shootParticleGenDescId;
|
||||
u16 x44_shootSfxId;
|
||||
SGrenadeTrajectoryInfo x48_grenadeTrajectoryInfo;
|
||||
|
||||
public:
|
||||
SGrenadeLauncherData(const SBouncyGrenadeData& data, CAssetId w1, CAssetId w2, u16 sfx,
|
||||
const SGrenadeTrajectoryInfo& trajectoryInfo)
|
||||
SGrenadeLauncherData(const SBouncyGrenadeData& data, CAssetId grenadeModelId, CAssetId shootParticleGenDescId,
|
||||
u16 shootSfxId, const SGrenadeTrajectoryInfo& grenadeTrajectoryInfo)
|
||||
: x0_grenadeData(data)
|
||||
, x3c_grenadeCmdl(w1)
|
||||
, x40_launcherExplodeGenDesc(w2)
|
||||
, x44_launcherExplodeSfx(sfx)
|
||||
, x48_trajectoryInfo(trajectoryInfo){};
|
||||
, x3c_grenadeModelId(grenadeModelId)
|
||||
, x40_shootParticleGenDescId(shootParticleGenDescId)
|
||||
, x44_shootSfxId(shootSfxId)
|
||||
, x48_grenadeTrajectoryInfo(grenadeTrajectoryInfo){};
|
||||
|
||||
[[nodiscard]] const SBouncyGrenadeData& GetGrenadeData() const { return x0_grenadeData; }
|
||||
[[nodiscard]] CAssetId GetGrenadeModelId() const { return x3c_grenadeCmdl; }
|
||||
[[nodiscard]] CAssetId GetExplosionGenDescId() const { return x40_launcherExplodeGenDesc; }
|
||||
[[nodiscard]] u16 GetExplosionSfx() const { return x44_launcherExplodeSfx; }
|
||||
[[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return x48_trajectoryInfo; }
|
||||
[[nodiscard]] CAssetId GetGrenadeModelId() const { return x3c_grenadeModelId; }
|
||||
[[nodiscard]] CAssetId GetShootParticleGenDescId() const { return x40_shootParticleGenDescId; }
|
||||
[[nodiscard]] u16 GetShootSfxId() const { return x44_shootSfxId; }
|
||||
[[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return x48_grenadeTrajectoryInfo; }
|
||||
};
|
||||
|
||||
class CGrenadeLauncher : public CPhysicsActor {
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
float x3e8_thermalMag;
|
||||
float x3ec_damageTimer = 0.f;
|
||||
zeus::CColor x3f0_color2{0.5f, 0.f, 0.f};
|
||||
zeus::CColor x3f4_color3{0.f};
|
||||
zeus::CColor x3f4_damageAddColor{0.f};
|
||||
float x3f8_explodePlayerDistance;
|
||||
bool x3fc_launchGrenade = false;
|
||||
bool x3fd_visible = true;
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
void Think(float dt, CStateManager& mgr) override;
|
||||
void Touch(CActor& act, CStateManager& mgr) override;
|
||||
|
||||
void SetColor(const zeus::CColor& color) { x3f4_color3 = color; }
|
||||
void SetAddColor(const zeus::CColor& color) { x3f4_damageAddColor = color; }
|
||||
void SetVisible(bool val) { x3fd_visible = val; }
|
||||
void SetFollowPlayer(bool val) { x3fe_followPlayer = val; }
|
||||
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
void UpdateDamageTime(float arg);
|
||||
void CreateExplosion(CStateManager& mgr);
|
||||
void UpdateFollowPlayer(CStateManager& mgr, float dt);
|
||||
void sub_80230438();
|
||||
void UpdateStartAnimation();
|
||||
void LaunchGrenade(CStateManager& mgr);
|
||||
};
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -338,9 +338,9 @@ void COmegaPirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
|
||||
bool COmegaPirate::CoverBlown(CStateManager&, float) {
|
||||
if (x9b4_) {
|
||||
x9b4_ = false;
|
||||
xb5c_ = 0.f;
|
||||
if (x9b4_lostAllHp) {
|
||||
x9b4_lostAllHp = false;
|
||||
xb5c_hpLost = 0.f;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -364,7 +364,7 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
xa44_targetable = false;
|
||||
xa4a_heartVisible = false;
|
||||
xa88_xrayFadeInTrigger = false;
|
||||
xa8c_ = 3.f;
|
||||
xa8c_xrayFadeOutTime = 3.f;
|
||||
for (auto& entry : x9dc_scriptPlatforms) {
|
||||
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
|
||||
platform->SetActive(true);
|
||||
|
@ -374,7 +374,7 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
platform->SetXRayFog(true);
|
||||
}
|
||||
}
|
||||
xb64_ = 17.f;
|
||||
xb64_stateTime = 17.f;
|
||||
AddMaterial(EMaterialTypes::Scannable, mgr);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (GetState() == CElitePirate::EState::Zero) {
|
||||
|
@ -493,7 +493,7 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
xa44_targetable = true;
|
||||
xa4a_heartVisible = true;
|
||||
if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
|
||||
xa8c_ = 0.333f;
|
||||
xa8c_xrayFadeOutTime = 0.333f;
|
||||
}
|
||||
for (const auto& entry : x9dc_scriptPlatforms) {
|
||||
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
|
||||
|
@ -501,44 +501,44 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
}
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (xb4c_armorPiecesHealed < 4 && x9c8_scaleState == EScaleState::None && xb58_ >= 2.5f) {
|
||||
float alpha = std::min(xb50_, 1.f);
|
||||
if (xb4c_armorPiecesHealed < 4 && x9c8_scaleState == EScaleState::None && xb58_healTime >= 2.5f) {
|
||||
float alpha = std::min(xb50_armorPieceHealTime, 1.f);
|
||||
float invAlpha = 1.f - alpha;
|
||||
size_t idx = 0;
|
||||
for (const auto& entry : x9dc_scriptPlatforms) {
|
||||
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
|
||||
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
|
||||
if (xb4c_armorPiecesHealed > idx) {
|
||||
CModelFlags flags{5, 0, 3, zeus::skBlack};
|
||||
constexpr CModelFlags flags{5, 0, 3, zeus::skBlack};
|
||||
platform->SetDrawFlags(flags);
|
||||
} else if (xb4c_armorPiecesHealed == idx) {
|
||||
if (!xb6e_) {
|
||||
if (!xb6e_armorPieceActivated) {
|
||||
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
|
||||
xb6e_ = true;
|
||||
xb6e_armorPieceActivated = true;
|
||||
}
|
||||
CModelFlags flags{5, 0, 3, zeus::CColor{invAlpha, alpha}};
|
||||
const CModelFlags flags{5, 0, 3, zeus::CColor{invAlpha, alpha}};
|
||||
platform->SetDrawFlags(flags);
|
||||
}
|
||||
} else {
|
||||
CModelFlags flags{5, 0, 3, zeus::CColor{1.f, 0.f}};
|
||||
constexpr CModelFlags flags{5, 0, 3, zeus::CColor{1.f, 0.f}};
|
||||
platform->SetDrawFlags(flags);
|
||||
}
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
if (xb50_ > 1.f) {
|
||||
if (xb50_armorPieceHealTime > 1.f) {
|
||||
++xb4c_armorPiecesHealed;
|
||||
xb50_ = 0.f;
|
||||
xb58_ = 0.f;
|
||||
xb6e_ = false;
|
||||
xb50_armorPieceHealTime = 0.f;
|
||||
xb58_healTime = 0.f;
|
||||
xb6e_armorPieceActivated = false;
|
||||
}
|
||||
xb50_ += dt;
|
||||
xb50_armorPieceHealTime += dt;
|
||||
}
|
||||
xb58_ += dt;
|
||||
xb58_healTime += dt;
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero));
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::ExitState));
|
||||
if (xb58_ >= 2.5f) {
|
||||
if (xb58_healTime >= 2.5f) {
|
||||
++xb4c_armorPiecesHealed;
|
||||
}
|
||||
}
|
||||
|
@ -549,23 +549,23 @@ void COmegaPirate::Growth(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x9c8_scaleState = EScaleState::ScaleDownY;
|
||||
xad0_scaleUpTrigger = false;
|
||||
RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr);
|
||||
xb6c_ = false;
|
||||
xb6d_ = false;
|
||||
xb6c_exit1Sent = false;
|
||||
xb6d_exit2Sent = false;
|
||||
ProcessSoundEvent(SFXsfx0B27, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(),
|
||||
mgr.GetNextAreaId(), mgr, false);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (xb68_ == 0) {
|
||||
if (x330_stateMachineState.GetTime() > 0.3f * xb64_ && !xb6c_) {
|
||||
if (x330_stateMachineState.GetTime() > 0.3f * xb64_stateTime && !xb6c_exit1Sent) {
|
||||
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
|
||||
xb6c_ = true;
|
||||
xb6c_exit1Sent = true;
|
||||
}
|
||||
if (x330_stateMachineState.GetTime() > 0.6f * xb64_ && !xb6d_) {
|
||||
if (x330_stateMachineState.GetTime() > 0.6f * xb64_stateTime && !xb6d_exit2Sent) {
|
||||
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
|
||||
xb6d_ = true;
|
||||
xb6d_exit2Sent = true;
|
||||
}
|
||||
} else if (x330_stateMachineState.GetTime() > 0.5f * xb64_ && !xb6c_) {
|
||||
} else if (x330_stateMachineState.GetTime() > 0.5f * xb64_stateTime && !xb6c_exit1Sent) {
|
||||
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
|
||||
xb6c_ = true;
|
||||
xb6c_exit1Sent = true;
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
TeleportToFurthestPlatform(mgr);
|
||||
|
@ -674,9 +674,9 @@ void COmegaPirate::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
xad0_scaleUpTrigger = false;
|
||||
xa44_targetable = false;
|
||||
xa4a_heartVisible = false;
|
||||
xb5c_ = 0.f;
|
||||
xb60_ = 0.f;
|
||||
xb64_ = 5.f;
|
||||
xb5c_hpLost = 0.f;
|
||||
xb60_hpLostInPhase = 0.f;
|
||||
xb64_stateTime = 5.f;
|
||||
++xb68_;
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
if (GetState() == CElitePirate::EState::Zero) {
|
||||
|
@ -725,7 +725,7 @@ bool COmegaPirate::ShouldFire(CStateManager& mgr, float arg) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool COmegaPirate::ShouldMove(CStateManager& mgr, float arg) { return xb64_ < x330_stateMachineState.GetTime(); }
|
||||
bool COmegaPirate::ShouldMove(CStateManager& mgr, float arg) { return xb64_stateTime < x330_stateMachineState.GetTime(); }
|
||||
|
||||
void COmegaPirate::Shuffle(CStateManager& mgr, EStateMsg msg, float dt) {}
|
||||
|
||||
|
@ -776,8 +776,8 @@ void COmegaPirate::Suck(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
platform->SetXRayFog(false);
|
||||
}
|
||||
}
|
||||
xb50_ = 0.f;
|
||||
xb58_ = 2.5f;
|
||||
xb50_armorPieceHealTime = 0.f;
|
||||
xb58_healTime = 2.5f;
|
||||
xb4c_armorPiecesHealed = 0;
|
||||
}
|
||||
}
|
||||
|
@ -827,7 +827,8 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
|
|||
UpdateNormalAlpha(mgr, dt);
|
||||
UpdateSkeletonAlpha(mgr, dt);
|
||||
UpdateXRayAlpha(mgr, dt);
|
||||
if ((!x9a1_fadeIn || xa4a_heartVisible) && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay && xa44_targetable) {
|
||||
if ((!x9a1_fadeIn || xa4a_heartVisible) &&
|
||||
mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay && xa44_targetable) {
|
||||
AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
if (x9c8_scaleState == EScaleState::WaitForTrigger) {
|
||||
xa38_collisionActorMgr1->SetActive(mgr, false);
|
||||
|
@ -863,19 +864,19 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
|
|||
float hp = GetHealthInfo(mgr)->GetHP();
|
||||
*HealthInfo(mgr) = *entity->GetHealthInfo(mgr);
|
||||
float hpChange = hp - GetHealthInfo(mgr)->GetHP();
|
||||
xb5c_ += hpChange;
|
||||
xb60_ += hpChange;
|
||||
xb5c_hpLost += hpChange;
|
||||
xb60_hpLostInPhase += hpChange;
|
||||
}
|
||||
|
||||
if (GetHealthInfo(mgr)->GetHP() > 0.f) {
|
||||
if (xb5c_ <= 100.f) {
|
||||
if (xb60_ > 20.f) {
|
||||
if (xb5c_hpLost > 100.f) {
|
||||
x9b4_lostAllHp = true;
|
||||
} else {
|
||||
if (xb60_hpLostInPhase > 20.f) {
|
||||
GetBodyController()->GetCommandMgr().DeliverCmd(
|
||||
CBCAdditiveReactionCmd(pas::EAdditiveReactionType::One, 1.f, false));
|
||||
xb60_ = 0.f;
|
||||
xb60_hpLostInPhase = 0.f;
|
||||
}
|
||||
} else {
|
||||
x9b4_ = true;
|
||||
}
|
||||
} else {
|
||||
DeathDestroy(mgr);
|
||||
|
@ -885,7 +886,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
|
|||
|
||||
for (auto& entry : x9dc_scriptPlatforms) {
|
||||
auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first));
|
||||
if ((!xb78_codeTrigger && !xb79_) || xa4a_heartVisible) {
|
||||
if ((!xb78_codeTrigger && !xb79_bossPhaseActive) || xa4a_heartVisible) {
|
||||
platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
} else {
|
||||
platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
|
||||
|
@ -940,13 +941,13 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
|
|||
xb68_ = 0;
|
||||
}
|
||||
|
||||
if (xb8c_ > 0.f) {
|
||||
if (xb8c_avoidStaticCollisionTime > 0.f) {
|
||||
const zeus::CAABox& box = GetBoundingBox();
|
||||
CGameCollision::AvoidStaticCollisionWithinRadius(mgr, *this, 8, dt, 1.f, 1.5f * (box.max.x() - box.min.x()),
|
||||
10000.f, 0.25f);
|
||||
xb8c_ = 0.f;
|
||||
xb8c_avoidStaticCollisionTime = 0.f;
|
||||
}
|
||||
xb8c_ += dt;
|
||||
xb8c_avoidStaticCollisionTime += dt;
|
||||
}
|
||||
|
||||
void COmegaPirate::WallDetach(CStateManager& mgr, EStateMsg msg, float dt) {
|
||||
|
@ -965,7 +966,7 @@ void COmegaPirate::WallDetach(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
mgr.SetBossParams(GetUniqueId(), xa98_maxEnergy, 89);
|
||||
xb79_ = true;
|
||||
xb79_bossPhaseActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1217,19 +1218,19 @@ void COmegaPirate::UpdateNormalAlpha(CStateManager& mgr, float dt) {
|
|||
if (alpha >= 1.f) {
|
||||
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
|
||||
launcher->SetVisible(true);
|
||||
launcher->SetColor(zeus::CColor{0.f});
|
||||
launcher->SetAddColor(zeus::CColor{0.f});
|
||||
}
|
||||
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
|
||||
launcher->SetVisible(true);
|
||||
launcher->SetColor(zeus::CColor{0.f});
|
||||
launcher->SetAddColor(zeus::CColor{0.f});
|
||||
}
|
||||
} else {
|
||||
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
|
||||
launcher->SetColor(zeus::CColor{1.f, alpha});
|
||||
launcher->SetAddColor(zeus::CColor{1.f, alpha});
|
||||
launcher->SetVisible(alpha != 0.f);
|
||||
}
|
||||
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
|
||||
launcher->SetColor(zeus::CColor{1.f, alpha});
|
||||
launcher->SetAddColor(zeus::CColor{1.f, alpha});
|
||||
launcher->SetVisible(alpha != 0.f);
|
||||
}
|
||||
}
|
||||
|
@ -1264,22 +1265,22 @@ void COmegaPirate::sub_8028c704(CStateManager& mgr, float dt) {
|
|||
|
||||
void COmegaPirate::UpdateXRayAlpha(CStateManager& mgr, float dt) {
|
||||
if (xa7c_xrayAlphaState == EXRayFadeState::FadeIn) {
|
||||
xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_) / xa90_;
|
||||
if (xa90_ < xa84_xrayAlphaStateTime) {
|
||||
xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_xrayFadeInTime) / xa90_xrayFadeInTime;
|
||||
if (xa84_xrayAlphaStateTime > xa90_xrayFadeInTime) {
|
||||
xa7c_xrayAlphaState = EXRayFadeState::None;
|
||||
xa84_xrayAlphaStateTime = 0.f;
|
||||
}
|
||||
xa84_xrayAlphaStateTime += dt;
|
||||
} else if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
|
||||
xa80_xrayAlpha = 0.f;
|
||||
if ((xa94_ < xa84_xrayAlphaStateTime) && !xa88_xrayFadeInTrigger) {
|
||||
if ((xa94_xrayFadeTriggerTime < xa84_xrayAlphaStateTime) && !xa88_xrayFadeInTrigger) {
|
||||
xa7c_xrayAlphaState = EXRayFadeState::FadeIn;
|
||||
xa84_xrayAlphaStateTime = 0.f;
|
||||
}
|
||||
xa84_xrayAlphaStateTime += dt;
|
||||
} else if (xa7c_xrayAlphaState == EXRayFadeState::FadeOut) {
|
||||
xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_) / xa8c_;
|
||||
if (xa8c_ < xa84_xrayAlphaStateTime) {
|
||||
xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_xrayFadeOutTime) / xa8c_xrayFadeOutTime;
|
||||
if (xa84_xrayAlphaStateTime > xa8c_xrayFadeOutTime) {
|
||||
xa7c_xrayAlphaState = EXRayFadeState::WaitForTrigger;
|
||||
xa84_xrayAlphaStateTime = 0.f;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
bool x9a0_visible = true;
|
||||
bool x9a1_fadeIn = true;
|
||||
std::vector<std::pair<TUniqueId, std::vector<TUniqueId>>> x9a4_scriptWaypointPlatforms;
|
||||
bool x9b4_ = false;
|
||||
bool x9b4_lostAllHp = false;
|
||||
std::vector<std::pair<TUniqueId, std::string_view>> x9b8_scriptEffects;
|
||||
enum class EScaleState {
|
||||
None,
|
||||
|
@ -81,9 +81,9 @@ private:
|
|||
float xa80_xrayAlpha = 1.f;
|
||||
float xa84_xrayAlphaStateTime = 0.f;
|
||||
bool xa88_xrayFadeInTrigger = false;
|
||||
float xa8c_ = 3.f;
|
||||
float xa90_ = 1.f;
|
||||
float xa94_ = 1.f;
|
||||
float xa8c_xrayFadeOutTime = 3.f;
|
||||
float xa90_xrayFadeInTime = 1.f;
|
||||
float xa94_xrayFadeTriggerTime = 1.f;
|
||||
float xa98_maxEnergy = 0.f;
|
||||
std::unique_ptr<CCollisionActorManager> xa9c_collisionActorMgr2;
|
||||
std::vector<std::pair<TUniqueId, std::string_view>> xaa0_scriptSounds;
|
||||
|
@ -96,28 +96,28 @@ private:
|
|||
float xad4_cachedSpeed = 1.f;
|
||||
bool xad8_cover = false;
|
||||
TUniqueId xada_lastWaypointId = kInvalidUniqueId;
|
||||
bool xadc_ = false;
|
||||
bool xadd_ = false;
|
||||
// bool xadc_ = false;
|
||||
// bool xadd_ = false;
|
||||
u8 xade_armorPiecesDestroyed = 0;
|
||||
bool xadf_launcher1FollowPlayer = true;
|
||||
bool xae0_launcher2FollowPlayer = true;
|
||||
CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty();
|
||||
int xb4c_armorPiecesHealed = 0;
|
||||
float xb50_ = 0.f;
|
||||
float xb50_armorPieceHealTime = 0.f;
|
||||
zeus::CColor xb54_platformColor = zeus::skWhite;
|
||||
float xb58_ = 2.5f;
|
||||
float xb5c_ = 0.f;
|
||||
float xb60_ = 0.f;
|
||||
float xb64_ = 17.f;
|
||||
float xb58_healTime = 2.5f;
|
||||
float xb5c_hpLost = 0.f;
|
||||
float xb60_hpLostInPhase = 0.f;
|
||||
float xb64_stateTime = 17.f;
|
||||
int xb68_ = 0;
|
||||
bool xb6c_ = false;
|
||||
bool xb6d_ = false;
|
||||
bool xb6e_ = false;
|
||||
bool xb6c_exit1Sent = false;
|
||||
bool xb6d_exit2Sent = false;
|
||||
bool xb6e_armorPieceActivated = false;
|
||||
TLockedToken<CTexture> xb70_thermalSpot; // was TToken<CTexture>
|
||||
bool xb78_codeTrigger = false;
|
||||
bool xb79_ = false;
|
||||
bool xb79_bossPhaseActive = false;
|
||||
std::vector<u8> xb7c_;
|
||||
float xb8c_ = 0.f; // not initialized in ctr
|
||||
float xb8c_avoidStaticCollisionTime = 0.f; // not initialized in ctr
|
||||
|
||||
public:
|
||||
COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
|
@ -163,7 +163,8 @@ public:
|
|||
void SetupHealthInfo(CStateManager& mgr) override;
|
||||
void SetLaunchersActive(CStateManager& mgr, bool val) override;
|
||||
SShockWaveData GetShockWaveData() const override {
|
||||
return {GetData().GetXF8(), GetData().GetXFC(), 24.78255f, GetData().GetX118(), GetData().GetX11C()};
|
||||
return {GetData().GetShockwaveParticleDescId(), GetData().GetShockwaveDamageInfo(), 24.78255f,
|
||||
GetData().GetShockwaveWeaponDescId(), GetData().GetShockwaveElectrocuteSfxId()};
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -17,13 +17,13 @@ CShockWave::CShockWave(TUniqueId uid, std::string_view name, const CEntityInfo&
|
|||
TUniqueId parent, const SShockWaveData& data, float minActiveTime, float knockback)
|
||||
: CActor(uid, true, name, info, xf, CModelData::CModelDataNull(), {EMaterialTypes::Projectile},
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xe8_id1(parent)
|
||||
, xe8_parentId(parent)
|
||||
, xec_damageInfo(data.GetDamageInfo())
|
||||
, x108_elementGenDesc(g_SimplePool->GetObj({SBIG('PART'), data.GetParticleDescId()}))
|
||||
, x110_elementGen(std::make_unique<CElementGen>(x108_elementGenDesc))
|
||||
, x114_data(data)
|
||||
, x150_(data.GetX24())
|
||||
, x154_(data.GetX2C())
|
||||
, x150_radius(data.GetInitialRadius())
|
||||
, x154_expansionSpeed(data.GetInitialExpansionSpeed())
|
||||
, x15c_minActiveTime(minActiveTime)
|
||||
, x160_knockback(knockback) {
|
||||
if (data.GetWeaponDescId().IsValid()) {
|
||||
|
@ -59,10 +59,11 @@ void CShockWave::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr
|
|||
}
|
||||
|
||||
std::optional<zeus::CAABox> CShockWave::GetTouchBounds() const {
|
||||
if (x150_ <= 0.f) {
|
||||
if (x150_radius <= 0.f) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return zeus::CAABox({-x150_, -x150_, 0.f}, {x150_, x150_, 1.f}).getTransformedAABox(GetTransform());
|
||||
return zeus::CAABox({-x150_radius, -x150_radius, 0.f}, {x150_radius, x150_radius, 1.f})
|
||||
.getTransformedAABox(GetTransform());
|
||||
}
|
||||
|
||||
void CShockWave::Render(CStateManager& mgr) {
|
||||
|
@ -74,13 +75,13 @@ void CShockWave::Think(float dt, CStateManager& mgr) {
|
|||
if (GetActive()) {
|
||||
x110_elementGen->Update(dt);
|
||||
x158_activeTime += dt;
|
||||
x150_ += x154_ * dt;
|
||||
x154_ += dt * x114_data.GetX30();
|
||||
x110_elementGen->SetExternalVar(0, x150_);
|
||||
x150_radius += x154_expansionSpeed * dt;
|
||||
x154_expansionSpeed += dt * x114_data.GetSpeedIncrease();
|
||||
x110_elementGen->SetExternalVar(0, x150_radius);
|
||||
for (size_t i = 0; i < x110_elementGen->GetNumActiveChildParticles(); ++i) {
|
||||
auto& particle = static_cast<CElementGen&>(x110_elementGen->GetActiveChildParticle(i));
|
||||
if (particle.Get4CharId() == SBIG('PART')) {
|
||||
particle.SetExternalVar(0, x150_);
|
||||
particle.SetExternalVar(0, x150_radius);
|
||||
}
|
||||
}
|
||||
if (x16c_hitPlayerInAir) {
|
||||
|
@ -108,16 +109,16 @@ void CShockWave::Touch(CActor& actor, CStateManager& mgr) {
|
|||
return;
|
||||
}
|
||||
|
||||
bool isParent = xe8_id1 == actor.GetUniqueId();
|
||||
bool isParent = xe8_parentId == actor.GetUniqueId();
|
||||
if (TCastToConstPtr<CCollisionActor> cactor = mgr.GetObjectById(actor.GetUniqueId())) {
|
||||
isParent = xe8_id1 == cactor->GetOwnerId();
|
||||
isParent = xe8_parentId == cactor->GetOwnerId();
|
||||
}
|
||||
if (isParent) {
|
||||
return;
|
||||
}
|
||||
|
||||
float mmax = x150_ * x150_;
|
||||
float mmin = mmax * x114_data.GetX28() * x114_data.GetX28();
|
||||
float mmax = x150_radius * x150_radius;
|
||||
float mmin = mmax * x114_data.GetWidthPercent() * x114_data.GetWidthPercent();
|
||||
zeus::CVector3f dist = actor.GetTranslation() - GetTranslation();
|
||||
CDamageInfo damageInfo = xec_damageInfo;
|
||||
float knockBackScale = std::max(0.f, 1.f - x160_knockback * x158_activeTime);
|
||||
|
|
|
@ -10,36 +10,40 @@ private:
|
|||
u32 x0_ = 8;
|
||||
CAssetId x4_particleDesc;
|
||||
CDamageInfo x8_damageInfo;
|
||||
float x24_ = 0.f;
|
||||
float x28_ = 0.5f;
|
||||
float x2c_;
|
||||
float x30_ = 0.f;
|
||||
float x24_initialRadius = 0.f;
|
||||
float x28_widthPercent = 0.5f;
|
||||
float x2c_initialExpansionSpeed;
|
||||
float x30_speedIncrease = 0.f;
|
||||
CAssetId x34_weaponDesc;
|
||||
u16 x38_electrocuteSfx;
|
||||
|
||||
public:
|
||||
SShockWaveData(CAssetId part, const CDamageInfo& dInfo, float x2c, CAssetId weapon, u16 sfx)
|
||||
: x4_particleDesc(part), x8_damageInfo(dInfo), x2c_(x2c), x34_weaponDesc(weapon), x38_electrocuteSfx(sfx) {}
|
||||
SShockWaveData(CAssetId part, const CDamageInfo& dInfo, float initialExpansionSpeed, CAssetId weapon, u16 sfx)
|
||||
: x4_particleDesc(part)
|
||||
, x8_damageInfo(dInfo)
|
||||
, x2c_initialExpansionSpeed(initialExpansionSpeed)
|
||||
, x34_weaponDesc(weapon)
|
||||
, x38_electrocuteSfx(sfx) {}
|
||||
|
||||
[[nodiscard]] CAssetId GetParticleDescId() const { return x4_particleDesc; }
|
||||
[[nodiscard]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; }
|
||||
[[nodiscard]] float GetX24() const { return x24_; }
|
||||
[[nodiscard]] float GetX28() const { return x28_; }
|
||||
[[nodiscard]] float GetX2C() const { return x2c_; }
|
||||
[[nodiscard]] float GetX30() const { return x30_; }
|
||||
[[nodiscard]] float GetInitialRadius() const { return x24_initialRadius; }
|
||||
[[nodiscard]] float GetWidthPercent() const { return x28_widthPercent; }
|
||||
[[nodiscard]] float GetInitialExpansionSpeed() const { return x2c_initialExpansionSpeed; }
|
||||
[[nodiscard]] float GetSpeedIncrease() const { return x30_speedIncrease; }
|
||||
[[nodiscard]] CAssetId GetWeaponDescId() const { return x34_weaponDesc; }
|
||||
[[nodiscard]] u16 GetElectrocuteSfx() const { return x38_electrocuteSfx; }
|
||||
};
|
||||
|
||||
class CShockWave : public CActor {
|
||||
private:
|
||||
TUniqueId xe8_id1;
|
||||
TUniqueId xe8_parentId;
|
||||
CDamageInfo xec_damageInfo;
|
||||
TToken<CGenDescription> x108_elementGenDesc;
|
||||
std::unique_ptr<CElementGen> x110_elementGen;
|
||||
SShockWaveData x114_data;
|
||||
float x150_;
|
||||
float x154_;
|
||||
float x150_radius;
|
||||
float x154_expansionSpeed;
|
||||
float x158_activeTime = 0.f;
|
||||
float x15c_minActiveTime;
|
||||
float x160_knockback;
|
||||
|
|
Loading…
Reference in New Issue