CElitePirate/COmegaPirate: Cleanup & renaming

This commit is contained in:
Luke Street 2020-05-07 19:13:43 -04:00
parent 8aef93473e
commit 1c775a7ea7
9 changed files with 253 additions and 236 deletions

View File

@ -9,13 +9,13 @@
#include <zeus/CTransform.hpp> #include <zeus/CTransform.hpp>
namespace urde::MP1 { namespace urde::MP1 {
struct SGrenadeUnknownStruct { struct SGrenadeVelocityInfo {
private: private:
float x0_mass; float x0_mass;
float x4_speed; // wrong name probably float x4_speed;
public: 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 GetMass() const { return x0_mass; }
[[nodiscard]] float GetSpeed() const { return x4_speed; } [[nodiscard]] float GetSpeed() const { return x4_speed; }
@ -23,7 +23,7 @@ public:
struct SBouncyGrenadeData { struct SBouncyGrenadeData {
private: private:
SGrenadeUnknownStruct x0_; SGrenadeVelocityInfo x0_velocityInfo;
CDamageInfo x8_damageInfo; CDamageInfo x8_damageInfo;
CAssetId x24_elementGenId1; CAssetId x24_elementGenId1;
CAssetId x28_elementGenId2; CAssetId x28_elementGenId2;
@ -34,19 +34,20 @@ private:
u16 x3a_explodeSfx; u16 x3a_explodeSfx;
public: public:
SBouncyGrenadeData(const SGrenadeUnknownStruct& unkStruct, const CDamageInfo& damageInfo, CAssetId w1, CAssetId w2, SBouncyGrenadeData(const SGrenadeVelocityInfo& velocityInfo, const CDamageInfo& damageInfo, CAssetId elementGenId1,
CAssetId w3, CAssetId w4, u32 w5, u16 s1, u16 s2) CAssetId elementGenId2, CAssetId elementGenId3, CAssetId elementGenId4, u32 numBounces,
: x0_(unkStruct) u16 bounceSfxId, u16 explodeSfxId)
: x0_velocityInfo(velocityInfo)
, x8_damageInfo(damageInfo) , x8_damageInfo(damageInfo)
, x24_elementGenId1(w1) , x24_elementGenId1(elementGenId1)
, x28_elementGenId2(w2) , x28_elementGenId2(elementGenId2)
, x2c_elementGenId3(w3) , x2c_elementGenId3(elementGenId3)
, x30_elementGenId4(w4) , x30_elementGenId4(elementGenId4)
, x34_numBounces(w5) , x34_numBounces(numBounces)
, x38_bounceSfx(s1) , x38_bounceSfx(bounceSfxId)
, x3a_explodeSfx(s2){}; , 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]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; }
[[nodiscard]] CAssetId GetElementGenId1() const { return x24_elementGenId1; } [[nodiscard]] CAssetId GetElementGenId1() const { return x24_elementGenId1; }
[[nodiscard]] CAssetId GetElementGenId2() const { return x28_elementGenId2; } [[nodiscard]] CAssetId GetElementGenId2() const { return x28_elementGenId2; }

View File

@ -48,31 +48,31 @@ CElitePirateData::CElitePirateData(CInputStream& in, u32 propCount)
, x10_attackChance(in.readFloatBig()) , x10_attackChance(in.readFloatBig())
, x14_shotAtTime(in.readFloatBig()) , x14_shotAtTime(in.readFloatBig())
, x18_shotAtTimeVariance(in.readFloatBig()) , x18_shotAtTimeVariance(in.readFloatBig())
, x1c_(in.readFloatBig()) , x1c_projectileAttractionRadius(in.readFloatBig())
, x20_(in) , x20_energyAbsorbParticleDescId(in)
, x24_sfxAbsorb(CSfxManager::TranslateSFXID(in.readUint32Big())) , x24_energyAbsorbSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x28_launcherActParams(ScriptLoader::LoadActorParameters(in)) , x28_launcherActParams(ScriptLoader::LoadActorParameters(in))
, x90_launcherAnimParams(ScriptLoader::LoadAnimationParameters(in)) , x90_launcherAnimParams(ScriptLoader::LoadAnimationParameters(in))
, x9c_(in) , x9c_launcherParticleGenDescId(in)
, xa0_(CSfxManager::TranslateSFXID(in.readUint32Big())) , xa0_launcherSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
, xa4_(in) , xa4_grenadeModelId(in)
, xa8_(in) , xa8_grenadeDamageInfo(in)
, xc4_launcherHp(in.readFloatBig()) , xc4_launcherHp(in.readFloatBig())
, xc8_(in) , xc8_grenadeElementGenDescId1(in)
, xcc_(in) , xcc_grenadeElementGenDescId2(in)
, xd0_(in) , xd0_grenadeElementGenDescId3(in)
, xd4_(in) , xd4_grenadeElementGenDescId4(in)
, xd8_(in) , xd8_grenadeVelocityInfo(in)
, xe0_trajectoryInfo(in) , xe0_grenadeTrajectoryInfo(in)
, xf0_grenadeNumBounces(in.readUint32Big()) , xf0_grenadeNumBounces(in.readUint32Big())
, xf4_(CSfxManager::TranslateSFXID(in.readUint32Big())) , xf4_grenadeBounceSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
, xf6_(CSfxManager::TranslateSFXID(in.readUint32Big())) , xf6_grenadeExplodeSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
, xf8_(in) , xf8_shockwaveParticleDescId(in)
, xfc_(in) , xfc_shockwaveDamageInfo(in)
, x118_(in) , x118_shockwaveWeaponDescId(in)
, x11c_(CSfxManager::TranslateSFXID(in.readUint32Big())) , x11c_shockwaveElectrocuteSfxId(CSfxManager::TranslateSFXID(in.readUint32Big()))
, x11e_(in.readBool()) , x11e_canCallForBackup(in.readBool())
, x11f_(propCount < 42 ? true : in.readBool()) {} , x11f_fastWhenAttractingEnergy(propCount < 42 ? true : in.readBool()) {}
CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CElitePirate::CElitePirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, 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()) , x738_collisionAabb(GetBoundingBox(), GetMaterialList())
, x7a0_initialSpeed(x3b4_speed) , x7a0_initialSpeed(x3b4_speed)
, x7d0_pathFindSearch(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f) { , x7d0_pathFindSearch(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f) {
if (x5d8_data.GetX20().IsValid()) { if (x5d8_data.GetEnergyAbsorbParticleDescId().IsValid()) {
x760_energyAbsorbDesc = g_SimplePool->GetObj({SBIG('PART'), x5d8_data.GetX20()}); x760_energyAbsorbDesc = g_SimplePool->GetObj({SBIG('PART'), x5d8_data.GetEnergyAbsorbParticleDescId()});
} }
x460_knockBackController.SetEnableFreeze(false); x460_knockBackController.SetEnableFreeze(false);
@ -108,7 +108,7 @@ void CElitePirate::Think(float dt, CStateManager& mgr) {
x730_collisionActorMgrHead->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); x730_collisionActorMgrHead->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
} }
x5d4_collisionActorMgr->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; x3b4_speed = 2.f * x7a0_initialSpeed;
} else { } else {
x3b4_speed = x7a0_initialSpeed; x3b4_speed = x7a0_initialSpeed;
@ -218,7 +218,7 @@ void CElitePirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
KnockBack(projectile->GetTranslation() - projectile->GetPreviousPos(), mgr, damageInfo, KnockBack(projectile->GetTranslation() - projectile->GetPreviousPos(), mgr, damageInfo,
EKnockBackType::Radius, false, damageInfo.GetKnockBackPower()); EKnockBackType::Radius, false, damageInfo.GetKnockBackPower());
CPatterned::AcceptScriptMsg(msg, uid, mgr); CPatterned::AcceptScriptMsg(msg, uid, mgr);
} else if (uid == x79c_ && x760_energyAbsorbDesc->IsLoaded()) { } else if (uid == x79c_energyAttractorId && x760_energyAbsorbDesc->IsLoaded()) {
CreateEnergyAbsorb(mgr, projectile->GetTransform()); CreateEnergyAbsorb(mgr, projectile->GetTransform());
} }
SetShotAt(true, mgr); SetShotAt(true, mgr);
@ -284,7 +284,7 @@ zeus::CVector3f CElitePirate::GetAimPosition(const CStateManager& mgr, float) co
const std::shared_ptr<CPlayerState>& playerState = mgr.GetPlayerState(); const std::shared_ptr<CPlayerState>& playerState = mgr.GetPlayerState();
if (x5d4_collisionActorMgr->GetActive() && playerState->IsFiringComboBeam() && if (x5d4_collisionActorMgr->GetActive() && playerState->IsFiringComboBeam() &&
playerState->GetCurrentBeam() == CPlayerState::EBeamId::Wave) { 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(); 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)) { if (!TooClose(mgr, 0.f) && !PathShagged(mgr, 0.f)) {
CPatterned::PathFind(mgr, msg, dt); CPatterned::PathFind(mgr, msg, dt);
} else if (PathShagged(mgr, 0.f)) { } 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) { if (move != zeus::skZero3f) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f)); 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); CPatterned::PathFind(mgr, msg, dt);
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (PathShagged(mgr, 0.f)) { 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) { if (move != zeus::skZero3f) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f)); x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f));
} else if (ShouldTurn(mgr, 0.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)) { if (!TooClose(mgr, 0.f) && !PathShagged(mgr, 0.f)) {
CPatterned::PathFind(mgr, msg, dt); CPatterned::PathFind(mgr, msg, dt);
} else if (PathShagged(mgr, 0.f)) { } 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) { if (move != zeus::skZero3f) {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCLocomotionCmd(move, zeus::skZero3f, 1.f)); 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); const CJointCollisionDescription& description = x5d4_collisionActorMgr->GetCollisionDescFromIndex(0);
x79c_ = description.GetCollisionActorId(); x79c_energyAttractorId = description.GetCollisionActorId();
if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(x79c_)) { if (TCastToPtr<CCollisionActor> act = mgr.ObjectById(x79c_energyAttractorId)) {
act->SetWeaponCollisionResponseType(EWeaponCollisionResponseTypes::None); act->SetWeaponCollisionResponseType(EWeaponCollisionResponseTypes::None);
} }
x5d4_collisionActorMgr->AddMaterial(mgr, {EMaterialTypes::AIJoint, EMaterialTypes::CameraPassthrough}); 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, mgr.AddObject(new CExplosion(*x760_energyAbsorbDesc, mgr.AllocateUniqueId(), true,
{GetAreaIdAlways(), CEntity::NullConnectionList}, "Absorb energy Fx", xf, 0, {GetAreaIdAlways(), CEntity::NullConnectionList}, "Absorb energy Fx", xf, 0,
GetModelData()->GetScale(), zeus::skWhite)); 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()); GetAreaIdAlways());
x7ac_energyAbsorbCooldown = 0.25f; x7ac_energyAbsorbCooldown = 0.25f;
} }
@ -988,12 +988,12 @@ void CElitePirate::AttractProjectiles(CStateManager& mgr) {
if (!IsAlive()) { if (!IsAlive()) {
return; return;
} }
const TCastToConstPtr<CCollisionActor> actor = mgr.GetObjectById(x79c_); const TCastToConstPtr<CCollisionActor> actor = mgr.GetObjectById(x79c_energyAttractorId);
if (!actor) { if (!actor) {
return; return;
} }
float radius = x5d8_data.GetX1C(); float radius = x5d8_data.GetProjectileAttractionRadius();
const zeus::CVector3f actorPos = actor->GetTranslation(); const zeus::CVector3f actorPos = actor->GetTranslation();
const zeus::CVector3f pos = GetTranslation(); const zeus::CVector3f pos = GetTranslation();
rstl::reserved_vector<TUniqueId, 1024> projNearList; rstl::reserved_vector<TUniqueId, 1024> projNearList;
@ -1090,9 +1090,9 @@ void CElitePirate::UpdateTimers(float dt) {
void CElitePirate::UpdatePositionHistory() { void CElitePirate::UpdatePositionHistory() {
const zeus::CVector3f pos = GetTranslation(); const zeus::CVector3f pos = GetTranslation();
if (x7d0_pathFindSearch.OnPath(pos) == CPathFindSearch::EResult::Success) { 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) { 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)) { if (TCastToPtr<CCollisionActor> actor = mgr.ObjectById(x770_collisionHeadId)) {
const float headHp = actor->HealthInfo(mgr)->GetHP(); const float headHp = actor->HealthInfo(mgr)->GetHP();
HealthInfo(mgr)->SetHP(hp - (hp - headHp)); 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) { 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 { 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 false;
} }
return x7a8_pathShaggedTime >= 3.f; return x7a8_pathShaggedTime >= 3.f;
@ -1178,27 +1178,27 @@ bool CElitePirate::IsClosestEnergyAttractor(const CStateManager& mgr,
return true; return true;
} }
zeus::CVector3f CElitePirate::SUnknownStruct::GetValue(const zeus::CVector3f& v1, const zeus::CVector3f& v2) { zeus::CVector3f CElitePirate::SPositionHistory::GetValue(const zeus::CVector3f& pos, const zeus::CVector3f& face) {
while (!x4_.empty()) { while (!x4_values.empty()) {
const zeus::CVector3f v = x4_.back() - v1; const zeus::CVector3f v = x4_values.back() - pos;
if (v.dot(v2) > 0.f && v.isMagnitudeSafe()) { if (v.dot(face) > 0.f && v.isMagnitudeSafe()) {
return v.normalized(); return v.normalized();
} }
x4_.pop_back(); x4_values.pop_back();
} }
return zeus::skZero3f; return zeus::skZero3f;
} }
void CElitePirate::SUnknownStruct::AddValue(const zeus::CVector3f& vec) { void CElitePirate::SPositionHistory::AddValue(const zeus::CVector3f& pos) {
if (x4_.size() > 15) { if (x4_values.size() > 15) {
return; return;
} }
if (x4_.empty()) { if (x4_values.empty()) {
x4_.emplace_back(vec); x4_values.emplace_back(pos);
return; return;
} }
if (x4_.back().magSquared() > x0_) { if (x4_values.back().magSquared() > x0_magSquared) {
x4_.emplace_back(vec); x4_values.emplace_back(pos);
} }
} }
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -20,31 +20,31 @@ private:
float x10_attackChance; float x10_attackChance;
float x14_shotAtTime; float x14_shotAtTime;
float x18_shotAtTimeVariance; float x18_shotAtTimeVariance;
float x1c_; float x1c_projectileAttractionRadius;
CAssetId x20_; CAssetId x20_energyAbsorbParticleDescId;
u16 x24_sfxAbsorb; u16 x24_energyAbsorbSfxId;
CActorParameters x28_launcherActParams; CActorParameters x28_launcherActParams;
CAnimationParameters x90_launcherAnimParams; CAnimationParameters x90_launcherAnimParams;
CAssetId x9c_; CAssetId x9c_launcherParticleGenDescId;
u16 xa0_; u16 xa0_launcherSfxId;
CAssetId xa4_; CAssetId xa4_grenadeModelId;
CDamageInfo xa8_; CDamageInfo xa8_grenadeDamageInfo;
float xc4_launcherHp; float xc4_launcherHp;
CAssetId xc8_; CAssetId xc8_grenadeElementGenDescId1;
CAssetId xcc_; CAssetId xcc_grenadeElementGenDescId2;
CAssetId xd0_; CAssetId xd0_grenadeElementGenDescId3;
CAssetId xd4_; CAssetId xd4_grenadeElementGenDescId4;
SGrenadeUnknownStruct xd8_; SGrenadeVelocityInfo xd8_grenadeVelocityInfo;
SGrenadeTrajectoryInfo xe0_trajectoryInfo; SGrenadeTrajectoryInfo xe0_grenadeTrajectoryInfo;
u32 xf0_grenadeNumBounces; u32 xf0_grenadeNumBounces;
u16 xf4_; u16 xf4_grenadeBounceSfxId;
u16 xf6_; u16 xf6_grenadeExplodeSfxId;
CAssetId xf8_; CAssetId xf8_shockwaveParticleDescId;
CDamageInfo xfc_; CDamageInfo xfc_shockwaveDamageInfo;
CAssetId x118_; CAssetId x118_shockwaveWeaponDescId;
u16 x11c_; u16 x11c_shockwaveElectrocuteSfxId;
bool x11e_; bool x11e_canCallForBackup;
bool x11f_; bool x11f_fastWhenAttractingEnergy;
public: public:
CElitePirateData(CInputStream&, u32 propCount); CElitePirateData(CInputStream&, u32 propCount);
@ -54,25 +54,32 @@ public:
[[nodiscard]] float GetAttackChance() const { return x10_attackChance; } [[nodiscard]] float GetAttackChance() const { return x10_attackChance; }
[[nodiscard]] float GetShotAtTime() const { return x14_shotAtTime; } [[nodiscard]] float GetShotAtTime() const { return x14_shotAtTime; }
[[nodiscard]] float GetShotAtTimeVariance() const { return x18_shotAtTimeVariance; } [[nodiscard]] float GetShotAtTimeVariance() const { return x18_shotAtTimeVariance; }
[[nodiscard]] float GetX1C() const { return x1c_; } [[nodiscard]] float GetProjectileAttractionRadius() const { return x1c_projectileAttractionRadius; }
[[nodiscard]] CAssetId GetX20() const { return x20_; } [[nodiscard]] CAssetId GetEnergyAbsorbParticleDescId() const { return x20_energyAbsorbParticleDescId; }
[[nodiscard]] u16 GetSFXAbsorb() const { return x24_sfxAbsorb; } [[nodiscard]] u16 GetEnergyAbsorbSfxId() const { return x24_energyAbsorbSfxId; }
[[nodiscard]] const CActorParameters& GetLauncherActParams() const { return x28_launcherActParams; } [[nodiscard]] const CActorParameters& GetLauncherActParams() const { return x28_launcherActParams; }
[[nodiscard]] const CAnimationParameters& GetLauncherAnimParams() const { return x90_launcherAnimParams; } [[nodiscard]] const CAnimationParameters& GetLauncherAnimParams() const { return x90_launcherAnimParams; }
[[nodiscard]] float GetLauncherHP() const { return xc4_launcherHp; } [[nodiscard]] float GetLauncherHP() const { return xc4_launcherHp; }
[[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return xe0_trajectoryInfo; } [[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return xe0_grenadeTrajectoryInfo; }
[[nodiscard]] CAssetId GetXF8() const { return xf8_; } [[nodiscard]] CAssetId GetShockwaveParticleDescId() const { return xf8_shockwaveParticleDescId; }
[[nodiscard]] const CDamageInfo& GetXFC() const { return xfc_; } [[nodiscard]] const CDamageInfo& GetShockwaveDamageInfo() const { return xfc_shockwaveDamageInfo; }
[[nodiscard]] CAssetId GetX118() const { return x118_; } [[nodiscard]] CAssetId GetShockwaveWeaponDescId() const { return x118_shockwaveWeaponDescId; }
[[nodiscard]] u16 GetX11C() const { return x11c_; } [[nodiscard]] u16 GetShockwaveElectrocuteSfxId() const { return x11c_shockwaveElectrocuteSfxId; }
[[nodiscard]] bool GetX11E() const { return x11e_; } [[nodiscard]] bool CanCallForBackup() const { return x11e_canCallForBackup; }
[[nodiscard]] bool GetX11F() const { return x11f_; } [[nodiscard]] bool IsFastWhenAttractingEnergy() const { return x11f_fastWhenAttractingEnergy; }
[[nodiscard]] SBouncyGrenadeData GetBouncyGrenadeData() const { [[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 { [[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: private:
struct SUnknownStruct { struct SPositionHistory {
private: private:
float x0_; float x0_magSquared;
rstl::reserved_vector<zeus::CVector3f, 16> x4_; rstl::reserved_vector<zeus::CVector3f, 16> x4_values;
public: public:
explicit SUnknownStruct(float f) : x0_(f * f) {} explicit SPositionHistory(float mag) : x0_magSquared(mag * mag) {}
zeus::CVector3f GetValue(const zeus::CVector3f& v1, const zeus::CVector3f& v2); zeus::CVector3f GetValue(const zeus::CVector3f& pos, const zeus::CVector3f& face);
void AddValue(const zeus::CVector3f& vec); void AddValue(const zeus::CVector3f& pos);
void Clear() { x4_.clear(); } void Clear() { x4_values.clear(); }
}; };
EState x568_state = EState::Invalid; EState x568_state = EState::Invalid;
@ -112,7 +119,7 @@ private:
TUniqueId x772_launcherId = kInvalidUniqueId; TUniqueId x772_launcherId = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, 7> x774_collisionRJointIds; rstl::reserved_vector<TUniqueId, 7> x774_collisionRJointIds;
rstl::reserved_vector<TUniqueId, 7> x788_collisionLJointIds; rstl::reserved_vector<TUniqueId, 7> x788_collisionLJointIds;
TUniqueId x79c_ = kInvalidUniqueId; TUniqueId x79c_energyAttractorId = kInvalidUniqueId;
float x7a0_initialSpeed; float x7a0_initialSpeed;
float x7a4_steeringSpeed = 1.f; float x7a4_steeringSpeed = 1.f;
float x7a8_pathShaggedTime = 0.f; float x7a8_pathShaggedTime = 0.f;
@ -127,7 +134,7 @@ private:
u32 x7cc_activeMaterialSet = 0; u32 x7cc_activeMaterialSet = 0;
CPathFindSearch x7d0_pathFindSearch; CPathFindSearch x7d0_pathFindSearch;
zeus::CVector3f x8b4_targetDestPos; zeus::CVector3f x8b4_targetDestPos;
SUnknownStruct x8c0_{5.0f}; SPositionHistory x8c0_positionHistory{5.0f};
bool x988_24_damageOn : 1 = false; bool x988_24_damageOn : 1 = false;
bool x988_25_attackingRightClaw : 1 = false; bool x988_25_attackingRightClaw : 1 = false;
bool x988_26_attackingLeftClaw : 1 = false; bool x988_26_attackingLeftClaw : 1 = false;
@ -190,7 +197,8 @@ public:
virtual void SetupHealthInfo(CStateManager& mgr); virtual void SetupHealthInfo(CStateManager& mgr);
virtual void SetLaunchersActive(CStateManager& mgr, bool val); virtual void SetLaunchersActive(CStateManager& mgr, bool val);
virtual SShockWaveData GetShockWaveData() const { 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: protected:

View File

@ -26,8 +26,8 @@ CGrenadeLauncher::CGrenadeLauncher(TUniqueId uid, std::string_view name, const C
, x350_grenadeActorParams(actParams) , x350_grenadeActorParams(actParams)
, x3e8_thermalMag(actParams.GetThermalMag()) , x3e8_thermalMag(actParams.GetThermalMag())
, x3f8_explodePlayerDistance(f1) { , x3f8_explodePlayerDistance(f1) {
if (data.GetExplosionGenDescId().IsValid()) { if (data.GetShootParticleGenDescId().IsValid()) {
x3b8_particleGenDesc = g_SimplePool->GetObj({SBIG('PART'), data.GetExplosionGenDescId()}); x3b8_particleGenDesc = g_SimplePool->GetObj({SBIG('PART'), data.GetShootParticleGenDescId()});
} }
GetModelData()->EnableLooping(true); GetModelData()->EnableLooping(true);
const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
@ -92,13 +92,13 @@ void CGrenadeLauncher::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
case EScriptObjectMessage::Start: case EScriptObjectMessage::Start:
if (x2cc_parentId == uid && x258_started != 1) { if (x2cc_parentId == uid && x258_started != 1) {
x258_started = 1; x258_started = 1;
sub_80230438(); UpdateStartAnimation();
} }
break; break;
case EScriptObjectMessage::Stop: case EScriptObjectMessage::Stop:
if (x2cc_parentId == uid && x258_started != 0) { if (x2cc_parentId == uid && x258_started != 0) {
x258_started = 0; x258_started = 0;
sub_80230438(); UpdateStartAnimation();
} }
break; break;
case EScriptObjectMessage::Action: case EScriptObjectMessage::Action:
@ -107,7 +107,7 @@ void CGrenadeLauncher::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
} }
break; break;
case EScriptObjectMessage::Registered: case EScriptObjectMessage::Registered:
sub_80230438(); UpdateStartAnimation();
break; break;
case EScriptObjectMessage::Damage: case EScriptObjectMessage::Damage:
x3ec_damageTimer = 0.33f; x3ec_damageTimer = 0.33f;
@ -126,12 +126,12 @@ std::optional<zeus::CAABox> CGrenadeLauncher::GetTouchBounds() const {
} }
void CGrenadeLauncher::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { 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}; xb4_drawFlags = CModelFlags{2, 0, 3, zeus::skWhite};
// Original code redundantly sets a() = 1.f // Original code redundantly sets a() = 1.f
xb4_drawFlags.addColor = x3f4_color3; xb4_drawFlags.addColor = x3f4_damageAddColor;
} else { } else {
xb4_drawFlags = CModelFlags{5, 0, 3, x3f4_color3}; xb4_drawFlags = CModelFlags{5, 0, 3, x3f4_damageAddColor};
} }
CActor::PreRender(mgr, frustum); CActor::PreRender(mgr, frustum);
} }
@ -196,7 +196,8 @@ void CGrenadeLauncher::UpdateDamageTime(float arg) {
xd0_damageMag = x3e8_thermalMag; xd0_damageMag = x3e8_thermalMag;
} else { } else {
x3ec_damageTimer = std::max(0.f, x3ec_damageTimer - arg); 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; 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, mgr.AddObject(new CExplosion(*x3b8_particleGenDesc, mgr.AllocateUniqueId(), true,
{GetAreaIdAlways(), CEntity::NullConnectionList}, "Grenade Launcher Explode Fx"sv, {GetAreaIdAlways(), CEntity::NullConnectionList}, "Grenade Launcher Explode Fx"sv,
GetTransform(), 0, GetModelData()->GetScale(), zeus::skWhite)); 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) { 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(); CModelData* modelData = GetModelData();
CAnimData* animData; CAnimData* animData;
if (modelData == nullptr || (animData = modelData->GetAnimationData()) == nullptr || x258_started <= -1 || if (modelData == nullptr || (animData = modelData->GetAnimationData()) == nullptr || x258_started < 0 ||
x258_started >= 2) { x258_started > 1) {
return; return;
} }

View File

@ -43,25 +43,25 @@ public:
struct SGrenadeLauncherData { struct SGrenadeLauncherData {
private: private:
SBouncyGrenadeData x0_grenadeData; SBouncyGrenadeData x0_grenadeData;
CAssetId x3c_grenadeCmdl; CAssetId x3c_grenadeModelId;
CAssetId x40_launcherExplodeGenDesc; CAssetId x40_shootParticleGenDescId;
u16 x44_launcherExplodeSfx; u16 x44_shootSfxId;
SGrenadeTrajectoryInfo x48_trajectoryInfo; SGrenadeTrajectoryInfo x48_grenadeTrajectoryInfo;
public: public:
SGrenadeLauncherData(const SBouncyGrenadeData& data, CAssetId w1, CAssetId w2, u16 sfx, SGrenadeLauncherData(const SBouncyGrenadeData& data, CAssetId grenadeModelId, CAssetId shootParticleGenDescId,
const SGrenadeTrajectoryInfo& trajectoryInfo) u16 shootSfxId, const SGrenadeTrajectoryInfo& grenadeTrajectoryInfo)
: x0_grenadeData(data) : x0_grenadeData(data)
, x3c_grenadeCmdl(w1) , x3c_grenadeModelId(grenadeModelId)
, x40_launcherExplodeGenDesc(w2) , x40_shootParticleGenDescId(shootParticleGenDescId)
, x44_launcherExplodeSfx(sfx) , x44_shootSfxId(shootSfxId)
, x48_trajectoryInfo(trajectoryInfo){}; , x48_grenadeTrajectoryInfo(grenadeTrajectoryInfo){};
[[nodiscard]] const SBouncyGrenadeData& GetGrenadeData() const { return x0_grenadeData; } [[nodiscard]] const SBouncyGrenadeData& GetGrenadeData() const { return x0_grenadeData; }
[[nodiscard]] CAssetId GetGrenadeModelId() const { return x3c_grenadeCmdl; } [[nodiscard]] CAssetId GetGrenadeModelId() const { return x3c_grenadeModelId; }
[[nodiscard]] CAssetId GetExplosionGenDescId() const { return x40_launcherExplodeGenDesc; } [[nodiscard]] CAssetId GetShootParticleGenDescId() const { return x40_shootParticleGenDescId; }
[[nodiscard]] u16 GetExplosionSfx() const { return x44_launcherExplodeSfx; } [[nodiscard]] u16 GetShootSfxId() const { return x44_shootSfxId; }
[[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return x48_trajectoryInfo; } [[nodiscard]] const SGrenadeTrajectoryInfo& GetGrenadeTrajectoryInfo() const { return x48_grenadeTrajectoryInfo; }
}; };
class CGrenadeLauncher : public CPhysicsActor { class CGrenadeLauncher : public CPhysicsActor {
@ -84,7 +84,7 @@ private:
float x3e8_thermalMag; float x3e8_thermalMag;
float x3ec_damageTimer = 0.f; float x3ec_damageTimer = 0.f;
zeus::CColor x3f0_color2{0.5f, 0.f, 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; float x3f8_explodePlayerDistance;
bool x3fc_launchGrenade = false; bool x3fc_launchGrenade = false;
bool x3fd_visible = true; bool x3fd_visible = true;
@ -108,7 +108,7 @@ public:
void Think(float dt, CStateManager& mgr) override; void Think(float dt, CStateManager& mgr) override;
void Touch(CActor& act, 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 SetVisible(bool val) { x3fd_visible = val; }
void SetFollowPlayer(bool val) { x3fe_followPlayer = val; } void SetFollowPlayer(bool val) { x3fe_followPlayer = val; }
@ -122,7 +122,7 @@ private:
void UpdateDamageTime(float arg); void UpdateDamageTime(float arg);
void CreateExplosion(CStateManager& mgr); void CreateExplosion(CStateManager& mgr);
void UpdateFollowPlayer(CStateManager& mgr, float dt); void UpdateFollowPlayer(CStateManager& mgr, float dt);
void sub_80230438(); void UpdateStartAnimation();
void LaunchGrenade(CStateManager& mgr); void LaunchGrenade(CStateManager& mgr);
}; };
} // namespace urde::MP1 } // namespace urde::MP1

View File

@ -338,9 +338,9 @@ void COmegaPirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
} }
bool COmegaPirate::CoverBlown(CStateManager&, float) { bool COmegaPirate::CoverBlown(CStateManager&, float) {
if (x9b4_) { if (x9b4_lostAllHp) {
x9b4_ = false; x9b4_lostAllHp = false;
xb5c_ = 0.f; xb5c_hpLost = 0.f;
return true; return true;
} }
return false; return false;
@ -364,7 +364,7 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
xa44_targetable = false; xa44_targetable = false;
xa4a_heartVisible = false; xa4a_heartVisible = false;
xa88_xrayFadeInTrigger = false; xa88_xrayFadeInTrigger = false;
xa8c_ = 3.f; xa8c_xrayFadeOutTime = 3.f;
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->SetActive(true); platform->SetActive(true);
@ -374,7 +374,7 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
platform->SetXRayFog(true); platform->SetXRayFog(true);
} }
} }
xb64_ = 17.f; xb64_stateTime = 17.f;
AddMaterial(EMaterialTypes::Scannable, mgr); AddMaterial(EMaterialTypes::Scannable, mgr);
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (GetState() == CElitePirate::EState::Zero) { if (GetState() == CElitePirate::EState::Zero) {
@ -493,7 +493,7 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
xa44_targetable = true; xa44_targetable = true;
xa4a_heartVisible = true; xa4a_heartVisible = true;
if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) { if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
xa8c_ = 0.333f; xa8c_xrayFadeOutTime = 0.333f;
} }
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { 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) { } else if (msg == EStateMsg::Update) {
if (xb4c_armorPiecesHealed < 4 && x9c8_scaleState == EScaleState::None && xb58_ >= 2.5f) { if (xb4c_armorPiecesHealed < 4 && x9c8_scaleState == EScaleState::None && xb58_healTime >= 2.5f) {
float alpha = std::min(xb50_, 1.f); float alpha = std::min(xb50_armorPieceHealTime, 1.f);
float invAlpha = 1.f - alpha; float invAlpha = 1.f - alpha;
size_t idx = 0; size_t idx = 0;
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
if (xb4c_armorPiecesHealed > idx) { if (xb4c_armorPiecesHealed > idx) {
CModelFlags flags{5, 0, 3, zeus::skBlack}; constexpr CModelFlags flags{5, 0, 3, zeus::skBlack};
platform->SetDrawFlags(flags); platform->SetDrawFlags(flags);
} else if (xb4c_armorPiecesHealed == idx) { } else if (xb4c_armorPiecesHealed == idx) {
if (!xb6e_) { if (!xb6e_armorPieceActivated) {
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None); 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); platform->SetDrawFlags(flags);
} }
} else { } 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); platform->SetDrawFlags(flags);
} }
} }
++idx; ++idx;
} }
if (xb50_ > 1.f) { if (xb50_armorPieceHealTime > 1.f) {
++xb4c_armorPiecesHealed; ++xb4c_armorPiecesHealed;
xb50_ = 0.f; xb50_armorPieceHealTime = 0.f;
xb58_ = 0.f; xb58_healTime = 0.f;
xb6e_ = false; xb6e_armorPieceActivated = false;
} }
xb50_ += dt; xb50_armorPieceHealTime += dt;
} }
xb58_ += dt; xb58_healTime += dt;
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero)); GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero));
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::ExitState)); GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::ExitState));
if (xb58_ >= 2.5f) { if (xb58_healTime >= 2.5f) {
++xb4c_armorPiecesHealed; ++xb4c_armorPiecesHealed;
} }
} }
@ -549,23 +549,23 @@ void COmegaPirate::Growth(CStateManager& mgr, EStateMsg msg, float dt) {
x9c8_scaleState = EScaleState::ScaleDownY; x9c8_scaleState = EScaleState::ScaleDownY;
xad0_scaleUpTrigger = false; xad0_scaleUpTrigger = false;
RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr); RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr);
xb6c_ = false; xb6c_exit1Sent = false;
xb6d_ = false; xb6d_exit2Sent = false;
ProcessSoundEvent(SFXsfx0B27, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(), ProcessSoundEvent(SFXsfx0B27, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(),
mgr.GetNextAreaId(), mgr, false); mgr.GetNextAreaId(), mgr, false);
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (xb68_ == 0) { 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); 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); 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); SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
xb6c_ = true; xb6c_exit1Sent = true;
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
TeleportToFurthestPlatform(mgr); TeleportToFurthestPlatform(mgr);
@ -674,9 +674,9 @@ void COmegaPirate::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
xad0_scaleUpTrigger = false; xad0_scaleUpTrigger = false;
xa44_targetable = false; xa44_targetable = false;
xa4a_heartVisible = false; xa4a_heartVisible = false;
xb5c_ = 0.f; xb5c_hpLost = 0.f;
xb60_ = 0.f; xb60_hpLostInPhase = 0.f;
xb64_ = 5.f; xb64_stateTime = 5.f;
++xb68_; ++xb68_;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (GetState() == CElitePirate::EState::Zero) { if (GetState() == CElitePirate::EState::Zero) {
@ -725,7 +725,7 @@ bool COmegaPirate::ShouldFire(CStateManager& mgr, float arg) {
return false; 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) {} 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); platform->SetXRayFog(false);
} }
} }
xb50_ = 0.f; xb50_armorPieceHealTime = 0.f;
xb58_ = 2.5f; xb58_healTime = 2.5f;
xb4c_armorPiecesHealed = 0; xb4c_armorPiecesHealed = 0;
} }
} }
@ -827,7 +827,8 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
UpdateNormalAlpha(mgr, dt); UpdateNormalAlpha(mgr, dt);
UpdateSkeletonAlpha(mgr, dt); UpdateSkeletonAlpha(mgr, dt);
UpdateXRayAlpha(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); AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
if (x9c8_scaleState == EScaleState::WaitForTrigger) { if (x9c8_scaleState == EScaleState::WaitForTrigger) {
xa38_collisionActorMgr1->SetActive(mgr, false); xa38_collisionActorMgr1->SetActive(mgr, false);
@ -863,19 +864,19 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
float hp = GetHealthInfo(mgr)->GetHP(); float hp = GetHealthInfo(mgr)->GetHP();
*HealthInfo(mgr) = *entity->GetHealthInfo(mgr); *HealthInfo(mgr) = *entity->GetHealthInfo(mgr);
float hpChange = hp - GetHealthInfo(mgr)->GetHP(); float hpChange = hp - GetHealthInfo(mgr)->GetHP();
xb5c_ += hpChange; xb5c_hpLost += hpChange;
xb60_ += hpChange; xb60_hpLostInPhase += hpChange;
} }
if (GetHealthInfo(mgr)->GetHP() > 0.f) { if (GetHealthInfo(mgr)->GetHP() > 0.f) {
if (xb5c_ <= 100.f) { if (xb5c_hpLost > 100.f) {
if (xb60_ > 20.f) { x9b4_lostAllHp = true;
} else {
if (xb60_hpLostInPhase > 20.f) {
GetBodyController()->GetCommandMgr().DeliverCmd( GetBodyController()->GetCommandMgr().DeliverCmd(
CBCAdditiveReactionCmd(pas::EAdditiveReactionType::One, 1.f, false)); CBCAdditiveReactionCmd(pas::EAdditiveReactionType::One, 1.f, false));
xb60_ = 0.f; xb60_hpLostInPhase = 0.f;
} }
} else {
x9b4_ = true;
} }
} else { } else {
DeathDestroy(mgr); DeathDestroy(mgr);
@ -885,7 +886,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first)); 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); platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
} else { } else {
platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
@ -940,13 +941,13 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
xb68_ = 0; xb68_ = 0;
} }
if (xb8c_ > 0.f) { if (xb8c_avoidStaticCollisionTime > 0.f) {
const zeus::CAABox& box = GetBoundingBox(); const zeus::CAABox& box = GetBoundingBox();
CGameCollision::AvoidStaticCollisionWithinRadius(mgr, *this, 8, dt, 1.f, 1.5f * (box.max.x() - box.min.x()), CGameCollision::AvoidStaticCollisionWithinRadius(mgr, *this, 8, dt, 1.f, 1.5f * (box.max.x() - box.min.x()),
10000.f, 0.25f); 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) { 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) { } else if (msg == EStateMsg::Deactivate) {
mgr.SetBossParams(GetUniqueId(), xa98_maxEnergy, 89); 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 (alpha >= 1.f) {
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetVisible(true); 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))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetVisible(true); launcher->SetVisible(true);
launcher->SetColor(zeus::CColor{0.f}); launcher->SetAddColor(zeus::CColor{0.f});
} }
} else { } else {
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { 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); launcher->SetVisible(alpha != 0.f);
} }
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { 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); launcher->SetVisible(alpha != 0.f);
} }
} }
@ -1264,22 +1265,22 @@ void COmegaPirate::sub_8028c704(CStateManager& mgr, float dt) {
void COmegaPirate::UpdateXRayAlpha(CStateManager& mgr, float dt) { void COmegaPirate::UpdateXRayAlpha(CStateManager& mgr, float dt) {
if (xa7c_xrayAlphaState == EXRayFadeState::FadeIn) { if (xa7c_xrayAlphaState == EXRayFadeState::FadeIn) {
xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_) / xa90_; xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_xrayFadeInTime) / xa90_xrayFadeInTime;
if (xa90_ < xa84_xrayAlphaStateTime) { if (xa84_xrayAlphaStateTime > xa90_xrayFadeInTime) {
xa7c_xrayAlphaState = EXRayFadeState::None; xa7c_xrayAlphaState = EXRayFadeState::None;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_xrayAlphaStateTime += dt; xa84_xrayAlphaStateTime += dt;
} else if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) { } else if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
xa80_xrayAlpha = 0.f; xa80_xrayAlpha = 0.f;
if ((xa94_ < xa84_xrayAlphaStateTime) && !xa88_xrayFadeInTrigger) { if ((xa94_xrayFadeTriggerTime < xa84_xrayAlphaStateTime) && !xa88_xrayFadeInTrigger) {
xa7c_xrayAlphaState = EXRayFadeState::FadeIn; xa7c_xrayAlphaState = EXRayFadeState::FadeIn;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_xrayAlphaStateTime += dt; xa84_xrayAlphaStateTime += dt;
} else if (xa7c_xrayAlphaState == EXRayFadeState::FadeOut) { } else if (xa7c_xrayAlphaState == EXRayFadeState::FadeOut) {
xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_) / xa8c_; xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_xrayFadeOutTime) / xa8c_xrayFadeOutTime;
if (xa8c_ < xa84_xrayAlphaStateTime) { if (xa84_xrayAlphaStateTime > xa8c_xrayFadeOutTime) {
xa7c_xrayAlphaState = EXRayFadeState::WaitForTrigger; xa7c_xrayAlphaState = EXRayFadeState::WaitForTrigger;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }

View File

@ -39,7 +39,7 @@ private:
bool x9a0_visible = true; bool x9a0_visible = true;
bool x9a1_fadeIn = true; bool x9a1_fadeIn = true;
std::vector<std::pair<TUniqueId, std::vector<TUniqueId>>> x9a4_scriptWaypointPlatforms; 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; std::vector<std::pair<TUniqueId, std::string_view>> x9b8_scriptEffects;
enum class EScaleState { enum class EScaleState {
None, None,
@ -81,9 +81,9 @@ private:
float xa80_xrayAlpha = 1.f; float xa80_xrayAlpha = 1.f;
float xa84_xrayAlphaStateTime = 0.f; float xa84_xrayAlphaStateTime = 0.f;
bool xa88_xrayFadeInTrigger = false; bool xa88_xrayFadeInTrigger = false;
float xa8c_ = 3.f; float xa8c_xrayFadeOutTime = 3.f;
float xa90_ = 1.f; float xa90_xrayFadeInTime = 1.f;
float xa94_ = 1.f; float xa94_xrayFadeTriggerTime = 1.f;
float xa98_maxEnergy = 0.f; float xa98_maxEnergy = 0.f;
std::unique_ptr<CCollisionActorManager> xa9c_collisionActorMgr2; std::unique_ptr<CCollisionActorManager> xa9c_collisionActorMgr2;
std::vector<std::pair<TUniqueId, std::string_view>> xaa0_scriptSounds; std::vector<std::pair<TUniqueId, std::string_view>> xaa0_scriptSounds;
@ -96,28 +96,28 @@ private:
float xad4_cachedSpeed = 1.f; float xad4_cachedSpeed = 1.f;
bool xad8_cover = false; bool xad8_cover = false;
TUniqueId xada_lastWaypointId = kInvalidUniqueId; TUniqueId xada_lastWaypointId = kInvalidUniqueId;
bool xadc_ = false; // bool xadc_ = false;
bool xadd_ = false; // bool xadd_ = false;
u8 xade_armorPiecesDestroyed = 0; u8 xade_armorPiecesDestroyed = 0;
bool xadf_launcher1FollowPlayer = true; bool xadf_launcher1FollowPlayer = true;
bool xae0_launcher2FollowPlayer = true; bool xae0_launcher2FollowPlayer = true;
CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty(); CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty();
int xb4c_armorPiecesHealed = 0; int xb4c_armorPiecesHealed = 0;
float xb50_ = 0.f; float xb50_armorPieceHealTime = 0.f;
zeus::CColor xb54_platformColor = zeus::skWhite; zeus::CColor xb54_platformColor = zeus::skWhite;
float xb58_ = 2.5f; float xb58_healTime = 2.5f;
float xb5c_ = 0.f; float xb5c_hpLost = 0.f;
float xb60_ = 0.f; float xb60_hpLostInPhase = 0.f;
float xb64_ = 17.f; float xb64_stateTime = 17.f;
int xb68_ = 0; int xb68_ = 0;
bool xb6c_ = false; bool xb6c_exit1Sent = false;
bool xb6d_ = false; bool xb6d_exit2Sent = false;
bool xb6e_ = false; bool xb6e_armorPieceActivated = false;
TLockedToken<CTexture> xb70_thermalSpot; // was TToken<CTexture> TLockedToken<CTexture> xb70_thermalSpot; // was TToken<CTexture>
bool xb78_codeTrigger = false; bool xb78_codeTrigger = false;
bool xb79_ = false; bool xb79_bossPhaseActive = false;
std::vector<u8> xb7c_; std::vector<u8> xb7c_;
float xb8c_ = 0.f; // not initialized in ctr float xb8c_avoidStaticCollisionTime = 0.f; // not initialized in ctr
public: public:
COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, 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 SetupHealthInfo(CStateManager& mgr) override;
void SetLaunchersActive(CStateManager& mgr, bool val) override; void SetLaunchersActive(CStateManager& mgr, bool val) override;
SShockWaveData GetShockWaveData() const 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: private:

View File

@ -17,13 +17,13 @@ CShockWave::CShockWave(TUniqueId uid, std::string_view name, const CEntityInfo&
TUniqueId parent, const SShockWaveData& data, float minActiveTime, float knockback) TUniqueId parent, const SShockWaveData& data, float minActiveTime, float knockback)
: CActor(uid, true, name, info, xf, CModelData::CModelDataNull(), {EMaterialTypes::Projectile}, : CActor(uid, true, name, info, xf, CModelData::CModelDataNull(), {EMaterialTypes::Projectile},
CActorParameters::None(), kInvalidUniqueId) CActorParameters::None(), kInvalidUniqueId)
, xe8_id1(parent) , xe8_parentId(parent)
, xec_damageInfo(data.GetDamageInfo()) , xec_damageInfo(data.GetDamageInfo())
, x108_elementGenDesc(g_SimplePool->GetObj({SBIG('PART'), data.GetParticleDescId()})) , x108_elementGenDesc(g_SimplePool->GetObj({SBIG('PART'), data.GetParticleDescId()}))
, x110_elementGen(std::make_unique<CElementGen>(x108_elementGenDesc)) , x110_elementGen(std::make_unique<CElementGen>(x108_elementGenDesc))
, x114_data(data) , x114_data(data)
, x150_(data.GetX24()) , x150_radius(data.GetInitialRadius())
, x154_(data.GetX2C()) , x154_expansionSpeed(data.GetInitialExpansionSpeed())
, x15c_minActiveTime(minActiveTime) , x15c_minActiveTime(minActiveTime)
, x160_knockback(knockback) { , x160_knockback(knockback) {
if (data.GetWeaponDescId().IsValid()) { if (data.GetWeaponDescId().IsValid()) {
@ -59,10 +59,11 @@ void CShockWave::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr
} }
std::optional<zeus::CAABox> CShockWave::GetTouchBounds() const { std::optional<zeus::CAABox> CShockWave::GetTouchBounds() const {
if (x150_ <= 0.f) { if (x150_radius <= 0.f) {
return std::nullopt; 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) { void CShockWave::Render(CStateManager& mgr) {
@ -74,13 +75,13 @@ void CShockWave::Think(float dt, CStateManager& mgr) {
if (GetActive()) { if (GetActive()) {
x110_elementGen->Update(dt); x110_elementGen->Update(dt);
x158_activeTime += dt; x158_activeTime += dt;
x150_ += x154_ * dt; x150_radius += x154_expansionSpeed * dt;
x154_ += dt * x114_data.GetX30(); x154_expansionSpeed += dt * x114_data.GetSpeedIncrease();
x110_elementGen->SetExternalVar(0, x150_); x110_elementGen->SetExternalVar(0, x150_radius);
for (size_t i = 0; i < x110_elementGen->GetNumActiveChildParticles(); ++i) { for (size_t i = 0; i < x110_elementGen->GetNumActiveChildParticles(); ++i) {
auto& particle = static_cast<CElementGen&>(x110_elementGen->GetActiveChildParticle(i)); auto& particle = static_cast<CElementGen&>(x110_elementGen->GetActiveChildParticle(i));
if (particle.Get4CharId() == SBIG('PART')) { if (particle.Get4CharId() == SBIG('PART')) {
particle.SetExternalVar(0, x150_); particle.SetExternalVar(0, x150_radius);
} }
} }
if (x16c_hitPlayerInAir) { if (x16c_hitPlayerInAir) {
@ -108,16 +109,16 @@ void CShockWave::Touch(CActor& actor, CStateManager& mgr) {
return; return;
} }
bool isParent = xe8_id1 == actor.GetUniqueId(); bool isParent = xe8_parentId == actor.GetUniqueId();
if (TCastToConstPtr<CCollisionActor> cactor = mgr.GetObjectById(actor.GetUniqueId())) { if (TCastToConstPtr<CCollisionActor> cactor = mgr.GetObjectById(actor.GetUniqueId())) {
isParent = xe8_id1 == cactor->GetOwnerId(); isParent = xe8_parentId == cactor->GetOwnerId();
} }
if (isParent) { if (isParent) {
return; return;
} }
float mmax = x150_ * x150_; float mmax = x150_radius * x150_radius;
float mmin = mmax * x114_data.GetX28() * x114_data.GetX28(); float mmin = mmax * x114_data.GetWidthPercent() * x114_data.GetWidthPercent();
zeus::CVector3f dist = actor.GetTranslation() - GetTranslation(); zeus::CVector3f dist = actor.GetTranslation() - GetTranslation();
CDamageInfo damageInfo = xec_damageInfo; CDamageInfo damageInfo = xec_damageInfo;
float knockBackScale = std::max(0.f, 1.f - x160_knockback * x158_activeTime); float knockBackScale = std::max(0.f, 1.f - x160_knockback * x158_activeTime);

View File

@ -10,36 +10,40 @@ private:
u32 x0_ = 8; u32 x0_ = 8;
CAssetId x4_particleDesc; CAssetId x4_particleDesc;
CDamageInfo x8_damageInfo; CDamageInfo x8_damageInfo;
float x24_ = 0.f; float x24_initialRadius = 0.f;
float x28_ = 0.5f; float x28_widthPercent = 0.5f;
float x2c_; float x2c_initialExpansionSpeed;
float x30_ = 0.f; float x30_speedIncrease = 0.f;
CAssetId x34_weaponDesc; CAssetId x34_weaponDesc;
u16 x38_electrocuteSfx; u16 x38_electrocuteSfx;
public: public:
SShockWaveData(CAssetId part, const CDamageInfo& dInfo, float x2c, CAssetId weapon, u16 sfx) SShockWaveData(CAssetId part, const CDamageInfo& dInfo, float initialExpansionSpeed, CAssetId weapon, u16 sfx)
: x4_particleDesc(part), x8_damageInfo(dInfo), x2c_(x2c), x34_weaponDesc(weapon), x38_electrocuteSfx(sfx) {} : x4_particleDesc(part)
, x8_damageInfo(dInfo)
, x2c_initialExpansionSpeed(initialExpansionSpeed)
, x34_weaponDesc(weapon)
, x38_electrocuteSfx(sfx) {}
[[nodiscard]] CAssetId GetParticleDescId() const { return x4_particleDesc; } [[nodiscard]] CAssetId GetParticleDescId() const { return x4_particleDesc; }
[[nodiscard]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; } [[nodiscard]] const CDamageInfo& GetDamageInfo() const { return x8_damageInfo; }
[[nodiscard]] float GetX24() const { return x24_; } [[nodiscard]] float GetInitialRadius() const { return x24_initialRadius; }
[[nodiscard]] float GetX28() const { return x28_; } [[nodiscard]] float GetWidthPercent() const { return x28_widthPercent; }
[[nodiscard]] float GetX2C() const { return x2c_; } [[nodiscard]] float GetInitialExpansionSpeed() const { return x2c_initialExpansionSpeed; }
[[nodiscard]] float GetX30() const { return x30_; } [[nodiscard]] float GetSpeedIncrease() const { return x30_speedIncrease; }
[[nodiscard]] CAssetId GetWeaponDescId() const { return x34_weaponDesc; } [[nodiscard]] CAssetId GetWeaponDescId() const { return x34_weaponDesc; }
[[nodiscard]] u16 GetElectrocuteSfx() const { return x38_electrocuteSfx; } [[nodiscard]] u16 GetElectrocuteSfx() const { return x38_electrocuteSfx; }
}; };
class CShockWave : public CActor { class CShockWave : public CActor {
private: private:
TUniqueId xe8_id1; TUniqueId xe8_parentId;
CDamageInfo xec_damageInfo; CDamageInfo xec_damageInfo;
TToken<CGenDescription> x108_elementGenDesc; TToken<CGenDescription> x108_elementGenDesc;
std::unique_ptr<CElementGen> x110_elementGen; std::unique_ptr<CElementGen> x110_elementGen;
SShockWaveData x114_data; SShockWaveData x114_data;
float x150_; float x150_radius;
float x154_; float x154_expansionSpeed;
float x158_activeTime = 0.f; float x158_activeTime = 0.f;
float x15c_minActiveTime; float x15c_minActiveTime;
float x160_knockback; float x160_knockback;