From b1a897d2468caca916e5b211c1c404d03696ca5f Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 20 Apr 2020 15:35:56 -0700 Subject: [PATCH] CIceSheegoth: Implement Think --- .idea/codeStyleSettings.xml | 54 --- .idea/codeStyles/Project.xml | 24 +- .idea/encodings.xml | 4 - .idea/inspectionProfiles/Project_Default.xml | 376 ------------------- .idea/urde.iml | 8 +- Runtime/Character/CharacterCommon.hpp | 2 +- Runtime/MP1/World/CIceSheegoth.cpp | 197 ++++++++-- Runtime/MP1/World/CIceSheegoth.hpp | 52 ++- Runtime/Weapon/CFlameInfo.hpp | 6 +- Runtime/World/CStateMachine.cpp | 2 +- 10 files changed, 216 insertions(+), 509 deletions(-) delete mode 100644 .idea/codeStyleSettings.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index f12e12c26..000000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index faa606c73..f0175108e 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,35 +1,13 @@ - - - - - + - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 15a15b218..000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 27069a7d1..000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,376 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/urde.iml b/.idea/urde.iml index 24b221981..f08604bb6 100644 --- a/.idea/urde.iml +++ b/.idea/urde.iml @@ -1,8 +1,2 @@ - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/Runtime/Character/CharacterCommon.hpp b/Runtime/Character/CharacterCommon.hpp index 51a3d710e..a577ef498 100644 --- a/Runtime/Character/CharacterCommon.hpp +++ b/Runtime/Character/CharacterCommon.hpp @@ -96,7 +96,7 @@ enum class ELoopState { Invalid = -1, Begin, Loop, End }; enum class ELoopAttackType { Invalid = -1 }; -enum class EGenerateType { Invalid = -1, Zero, One, Two, Three, Four, Five }; +enum class EGenerateType { Invalid = -1, Zero, One, Two, Three, Four, Five, Six, Seven, Eight }; enum class ESlideType { Invalid = -1, Zero = 0 }; diff --git a/Runtime/MP1/World/CIceSheegoth.cpp b/Runtime/MP1/World/CIceSheegoth.cpp index a7fd1b2b0..8b1ecb07f 100644 --- a/Runtime/MP1/World/CIceSheegoth.cpp +++ b/Runtime/MP1/World/CIceSheegoth.cpp @@ -9,6 +9,8 @@ #include "Runtime/Particle/CElementGen.hpp" #include "Runtime/Particle/CParticleElectric.hpp" #include "Runtime/Particle/CParticleSwoosh.hpp" +#include "Runtime/Weapon/CFlameInfo.hpp" +#include "Runtime/Weapon/CFlameThrower.hpp" #include "Runtime/World/CGameArea.hpp" #include "Runtime/World/CPatternedInfo.hpp" #include "Runtime/World/CPlayer.hpp" @@ -52,7 +54,7 @@ CIceSheegothData::CIceSheegothData(CInputStream& in, [[maybe_unused]] s32 proper , x170_(in.readFloatBig()) , x174_(in.readFloatBig()) , x178_(in) -, x17c_(in) +, x17c_fireBreathResId(in) , x180_(in) , x19c_(in) , x1a0_(in) @@ -77,7 +79,7 @@ CIceSheegoth::CIceSheegoth(TUniqueId uid, std::string_view name, const CEntityIn const CIceSheegothData& sheegothData) : CPatterned(ECharacter::IceSheeegoth, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo, EMovementType::Ground, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Large) -, x56c_(sheegothData) +, x56c_sheegothData(sheegothData) , x760_(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f) , x844_(nullptr, 1, pInfo.GetPathfindingIndex(), 1.f, 1.f) , x94c_(x3b4_speed) @@ -133,7 +135,39 @@ CIceSheegoth::CIceSheegoth(TUniqueId uid, std::string_view name, const CEntityIn CPatterned::SetActive(true); } void CIceSheegoth::Accept(IVisitor& visitor) { visitor.Visit(this); } -void CIceSheegoth::Think(float dt, CStateManager& mgr) { CPatterned::Think(dt, mgr); } +void CIceSheegoth::Think(float dt, CStateManager& mgr) { + if (!GetActive()) { + return; + } + + CPatterned::Think(dt, mgr); + AttractProjectiles(mgr); + sub_801a0b8c(dt); + sub_8019e6f0(mgr); + if (!IsAlive()) { + x974_ = std::max(0.f, x974_ - (dt * x56c_sheegothData.Get_x170())); + if (GetBodyController()->GetBodyStateInfo().GetCurrentState()->IsDying()) { + sub_8019eb50(mgr); + } + } + x96c_ -= dt; + if (x96c_ < 0.f) { + GetBodyController()->GetCommandMgr().DeliverCmd( + CBCAdditiveReactionCmd(pas::EAdditiveReactionType::Four, 1.f, false)); + x96c_ = 3.f * mgr.GetActiveRandom()->Float() + 2.f; + } + GetModelData()->GetAnimationData()->PreRender(); + x9f4_.Update(dt); + x9f4_.PreRender(mgr, *GetModelData()->GetAnimationData(), GetTransform(), GetModelData()->GetScale(), + *GetBodyController()); + xa2c_collisionManager->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); + PreventWorldCollisions(dt, mgr); + sub_8019f680(mgr); + sub_8019f5cc(dt, mgr); + UpdateParticleEffects(dt, mgr); + UpdateThermalFrozenState(x428_damageCooldownTimer > 0.f); +} + void CIceSheegoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) { switch (msg) { case EScriptObjectMessage::Activate: { @@ -176,9 +210,9 @@ void CIceSheegoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, C } case EScriptObjectMessage::Deleted: { xa2c_collisionManager->Destroy(mgr); - if (xa80_ != kInvalidUniqueId) { - mgr.FreeScriptObject(xa80_); - xa80_ = kInvalidUniqueId; + if (xa80_flameThrowerId != kInvalidUniqueId) { + mgr.FreeScriptObject(xa80_flameThrowerId); + xa80_flameThrowerId = kInvalidUniqueId; } if (xaf0_) { CSfxManager::RemoveEmitter(xaf0_); @@ -265,29 +299,116 @@ void CIceSheegoth::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node void CIceSheegoth::Patrol(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::TargetPlayer(CStateManager& mgr, EStateMsg msg, float dt) {} -void CIceSheegoth::Generate(CStateManager& mgr, EStateMsg msg, float dt) {} +void CIceSheegoth::Generate(CStateManager& mgr, EStateMsg msg, float dt) { + if (msg == EStateMsg::Activate) { + x568_ = 0; + x938_ = GetTransform().basis[1]; + } else if (msg == EStateMsg::Update) { + if (x568_ == 0 && GetBodyController()->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Generate) { + GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed); + x568_ = 3; + SendScriptMsgs(EScriptObjectState::Attack, mgr, EScriptObjectMessage::None); + } else if (x568_ == 3 && + GetBodyController()->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Generate) { + x568_ = 4; + } else if (x568_ == 4) { + GetBodyController()->GetCommandMgr().DeliverCmd( + CBCGenerateCmd(x56c_sheegothData.Get_x1f0_25() ? pas::EGenerateType::Eight : pas::EGenerateType::Zero)); + } + } +} void CIceSheegoth::Deactivate(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::Attack(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::TurnAround(CStateManager& mgr, EStateMsg msg, float dt) {} -void CIceSheegoth::Crouch(CStateManager& mgr, EStateMsg msg, float dt) {} +void CIceSheegoth::Crouch(CStateManager& mgr, EStateMsg msg, float dt) { + if (msg == EStateMsg::Activate) { + RemoveMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr); + mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr); + GetBodyController()->SetLocomotionType(pas::ELocomotionType::Crouch); + x968_ = x56c_sheegothData.Get_x1e0(); + x400_24_hitByPlayerProjectile = false; + } else if (msg == EStateMsg::Deactivate) { + AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr); + } +} void CIceSheegoth::Taunt(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::Flinch(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::Approach(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::Enraged(CStateManager& mgr, EStateMsg msg, float dt) {} void CIceSheegoth::SpecialAttack(CStateManager& mgr, EStateMsg msg, float dt) {} -bool CIceSheegoth::Leash(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::OffLine(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::TooClose(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::InMaxRange(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::InDetectionRange(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::SpotPlayer(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::AnimOver(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::AggressionCheck(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::ShouldFire(CStateManager& mgr, float arg) { return false; } +bool CIceSheegoth::Leash(CStateManager& mgr, float arg) { + const zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation(); + if ((x3a0_latestLeashPosition - posDiff).magSquared() <= x3c8_leashRadius * x3c8_leashRadius) { + return false; + } + + return posDiff.magSquared() > x3cc_playerLeashRadius && x3d4_curPlayerLeashTime > x3d0_playerLeashTime; +} + +bool CIceSheegoth::OffLine(CStateManager& mgr, float arg) { + sub_8019ee18(0); + return PathShagged(mgr, arg); +} + +bool CIceSheegoth::TooClose(CStateManager& mgr, float arg) { + if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) { + const zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation(); + if (posDiff.z() < 0.f && posDiff.magSquared() < x978_) { + return true; + } + } + return false; +} +bool CIceSheegoth::InMaxRange(CStateManager& mgr, float arg) { + if (x56c_sheegothData.Get_x1f0_24()) { + return true; + } + + return CPatterned::InMaxRange(mgr, arg); +} + +bool CIceSheegoth::InDetectionRange(CStateManager& mgr, float arg) { + if (xb28_24_shotAt) { + return true; + } + + zeus::CVector3f posDiff = mgr.GetPlayer().GetTranslation() - GetTranslation(); + float range = std::min(1.f, arg) * x3bc_detectionRange; + if (posDiff.magSquared() < range * range) { + if (x3c0_detectionHeightRange <= 0.f) { + return true; + } + return (posDiff.z() * posDiff.z()) < x3c0_detectionHeightRange * x3c0_detectionHeightRange; + } + return false; +} + +bool CIceSheegoth::SpotPlayer(CStateManager& mgr, float arg) { + if (!xb28_24_shotAt) { + return CPatterned::SpotPlayer(mgr, arg); + } + return true; +} +bool CIceSheegoth::AnimOver(CStateManager& mgr, float arg) { return x568_ == 4; } +bool CIceSheegoth::AggressionCheck(CStateManager& mgr, float arg) { + return !(!IsAlive() || xb28_30_ || !sub_801a1794(mgr)); +} +bool CIceSheegoth::ShouldFire(CStateManager& mgr, float arg) { + if (GetAreaIdAlways() != mgr.GetPlayer().GetAreaIdAlways()) { + return false; + } + zeus::CVector3f pos = mgr.GetPlayer().GetTranslation(); + zeus::CTransform lctrXf = GetLctrTransform(xaf4_mouthLocator); + if ((pos - lctrXf.origin).magSquared() <= x300_maxAttackRange * x300_maxAttackRange && + std::fabs(pos.z() - GetTranslation().z()) < (lctrXf.origin.z() - GetTranslation().z()) && !ShouldTurn(mgr, 0.2617994f)) { + return !IsPatternObstructed(mgr, lctrXf.origin, pos); + } + return false; +} bool CIceSheegoth::ShouldFlinch(CStateManager& mgr, float arg) { return false; } -bool CIceSheegoth::ShotAt(CStateManager& mgr, float arg) { return false; } +bool CIceSheegoth::ShotAt(CStateManager& mgr, float arg) { return x400_24_hitByPlayerProjectile; } bool CIceSheegoth::ShouldSpecialAttack(CStateManager& mgr, float arg) { return false; } bool CIceSheegoth::LostInterest(CStateManager& mgr, float arg) { return false; } void CIceSheegoth::UpdateTouchBounds() { @@ -304,13 +425,14 @@ void CIceSheegoth::UpdateTouchBounds() { } void CIceSheegoth::ApplyContactDamage(TUniqueId sender, CStateManager& mgr) { if (const TCastToConstPtr colAct = mgr.GetObjectById(sender)) { - if (colAct->GetHealthInfo(mgr)->GetHP() <= 0.f) + if (colAct->GetHealthInfo(mgr)->GetHP() <= 0.f) { return; + } bool bVar5 = (xb28_29_ && !xb28_25_ && xb28_28_) ? true : sub_8019fc84(sender); if (colAct->GetLastTouchedObject() == mgr.GetPlayer().GetUniqueId()) { if (bVar5) { - mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x56c_.Get_x1b8(), + mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), x56c_sheegothData.Get_x1b8(), CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); } else { mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), GetContactDamage(), @@ -372,7 +494,7 @@ void CIceSheegoth::SetupCollisionActorManager(CStateManager& mgr) { xafc_.emplace_back(desc.GetCollisionActorId()); } else { xb04_.emplace_back(desc.GetCollisionActorId()); - colAct->SetDamageVulnerability(x56c_.Get_x80()); + colAct->SetDamageVulnerability(x56c_sheegothData.Get_x80()); } } } @@ -403,8 +525,8 @@ void CIceSheegoth::SetupHealthInfo(CStateManager& mgr) { } } void CIceSheegoth::sub_8019ebf0(CStateManager& mgr, float damage) { - x974_ = zeus::clamp(0.f, x974_ + damage, x56c_.Get_x170()); - float fVar1 = (1.f/3.f) * x56c_.Get_x170(); + x974_ = zeus::clamp(0.f, x974_ + damage, x56c_sheegothData.Get_x170()); + float fVar1 = (1.f / 3.f) * x56c_sheegothData.Get_x170(); if (fVar1 <= 0.f) { xb29_26_ = true; } else { @@ -418,5 +540,32 @@ void CIceSheegoth::ApplyWeaponDamage(CStateManager& mgr, TUniqueId sender) { CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f); } } -void CIceSheegoth::CreateFlameThrower(CStateManager& mgr) {} +void CIceSheegoth::CreateFlameThrower(CStateManager& mgr) { + if (xa80_flameThrowerId != kInvalidUniqueId) { + return; + } + + xa80_flameThrowerId = mgr.AllocateUniqueId(); + mgr.AddObject(new CFlameThrower(xa84_, "IceSheegoth_Flame"sv, EWeaponType::Plasma, + CFlameInfo{6, 4, x56c_sheegothData.GetFireBreathResId(), 15, 0.0625f, 20.f, 1.f}, {}, + EMaterialTypes::CollisionActor, x56c_sheegothData.GetFireBreathDamage(), + xa80_flameThrowerId, GetAreaIdAlways(), GetUniqueId(), EProjectileAttrib::None, + x56c_sheegothData.Get_x1e4(), x56c_sheegothData.Get_x1e8(), + x56c_sheegothData.Get_x1ec())); +} +void CIceSheegoth::AttractProjectiles(CStateManager& mgr) {} +void CIceSheegoth::sub_801a0b8c(float dt) {} +void CIceSheegoth::sub_8019e6f0(CStateManager& mgr) {} +void CIceSheegoth::sub_8019eb50(CStateManager& mgr) { + for (size_t i = 0; i < xa2c_collisionManager->GetNumCollisionActors(); ++i) { + const auto& jInfo = xa2c_collisionManager->GetCollisionDescFromIndex(i); + if (TCastToPtr colAct = mgr.ObjectById(jInfo.GetCollisionActorId())) { + colAct->AddMaterial(EMaterialTypes::ProjectilePassthrough); + } + } +} +void CIceSheegoth::PreventWorldCollisions(float dt, CStateManager& mgr) {} +void CIceSheegoth::sub_8019f680(CStateManager& mgr) {} +void CIceSheegoth::sub_8019f5cc(float dt, CStateManager& mgr) {} +void CIceSheegoth::UpdateParticleEffects(float dt, CStateManager& mgr) {} } // namespace urde::MP1 \ No newline at end of file diff --git a/Runtime/MP1/World/CIceSheegoth.hpp b/Runtime/MP1/World/CIceSheegoth.hpp index 5b5eeffaa..b61eaf3ee 100644 --- a/Runtime/MP1/World/CIceSheegoth.hpp +++ b/Runtime/MP1/World/CIceSheegoth.hpp @@ -24,7 +24,7 @@ class CIceSheegothData { float x170_; float x174_; CAssetId x178_; - CAssetId x17c_; + CAssetId x17c_fireBreathResId; CDamageInfo x180_; CAssetId x19c_; CAssetId x1a0_; @@ -47,23 +47,31 @@ class CIceSheegothData { public: CIceSheegothData(CInputStream& in, s32 propertyCount); - CDamageVulnerability Get_x80() const { return x80_; } - CAssetId Get_x150() const { return x150_; } - CDamageInfo Get_x154() const { return x154_; } - float Get_x170() const { return x170_; } - float Get_x174() const { return x174_; } - CAssetId Get_x178() const { return x178_; } - CAssetId Get_x1a0() const { return x1a0_; } - CAssetId Get_x1a4() const { return x1a4_; } - CAssetId Get_x1a8() const { return x1a8_; } - CAssetId Get_x1ac() const { return x1ac_; } - float Get_x1b0() const { return x1b0_; } - CDamageInfo Get_x1b8() const { return x1b8_; } + [[nodiscard]] CDamageVulnerability Get_x80() const { return x80_; } + [[nodiscard]] CAssetId Get_x150() const { return x150_; } + [[nodiscard]] CDamageInfo Get_x154() const { return x154_; } + [[nodiscard]] float Get_x170() const { return x170_; } + [[nodiscard]] float Get_x174() const { return x174_; } + [[nodiscard]] CAssetId Get_x178() const { return x178_; } + [[nodiscard]] CAssetId GetFireBreathResId() const { return x17c_fireBreathResId;} + [[nodiscard]] CDamageInfo GetFireBreathDamage() const { return x180_; } + [[nodiscard]] CAssetId Get_x1a0() const { return x1a0_; } + [[nodiscard]] CAssetId Get_x1a4() const { return x1a4_; } + [[nodiscard]] CAssetId Get_x1a8() const { return x1a8_; } + [[nodiscard]] CAssetId Get_x1ac() const { return x1ac_; } + [[nodiscard]] float Get_x1b0() const { return x1b0_; } + [[nodiscard]] CDamageInfo Get_x1b8() const { return x1b8_; } + [[nodiscard]] float Get_x1e0() const { return x1e0_; } + [[nodiscard]] CAssetId Get_x1e4() const { return x1e4_; } + [[nodiscard]] s16 Get_x1e8() const { return x1e8_; } + [[nodiscard]] CAssetId Get_x1ec() const { return x1ec_; } + [[nodiscard]] bool Get_x1f0_24() const { return x1f0_24_; } + [[nodiscard]] bool Get_x1f0_25() const { return x1f0_25_; } }; class CIceSheegoth : public CPatterned { s32 x568_ = -1; - CIceSheegothData x56c_; + CIceSheegothData x56c_sheegothData; CPathFindSearch x760_; CPathFindSearch x844_; s32 x928_ = 0; @@ -90,7 +98,7 @@ class CIceSheegoth : public CPatterned { std::unique_ptr xa2c_collisionManager; CCollidableAABox xa30_; CProjectileInfo xa58_; - TUniqueId xa80_ = kInvalidUniqueId; + TUniqueId xa80_flameThrowerId = kInvalidUniqueId; TToken xa84_; TCachedToken xa8c_; //bool xa98_; @@ -143,7 +151,19 @@ class CIceSheegoth : public CPatterned { void AddCollisionList(const SJointInfo* info, size_t count, std::vector& vecOut); void SetupCollisionActorManager(CStateManager& mgr); void SetupHealthInfo(CStateManager& mgr); - + void AttractProjectiles(CStateManager& mgr); + void sub_801a0b8c(float dt); + void sub_8019e6f0(CStateManager& mgr); + void sub_8019eb50(CStateManager& mgr); + void PreventWorldCollisions(float dt, CStateManager& mgr); + void sub_8019f680(CStateManager& mgr); + void sub_8019f5cc(float dt, CStateManager& mgr); + void sub_8019ee18(u32 i) { x928_ = i; } + void UpdateParticleEffects(float dt, CStateManager& mgr); + bool sub_801a1794(CStateManager& mgr) const { + const CHealthInfo* hInfo = GetHealthInfo(mgr); + return hInfo != nullptr && hInfo->GetHP() < 0.3f * x970_; + } public: DEFINE_PATTERNED(IceSheeegoth); CIceSheegoth(TUniqueId uid, std::string_view name, const CEntityInfo& info, zeus::CTransform& xf, CModelData&& mData, diff --git a/Runtime/Weapon/CFlameInfo.hpp b/Runtime/Weapon/CFlameInfo.hpp index 36002c7f3..134da9143 100644 --- a/Runtime/Weapon/CFlameInfo.hpp +++ b/Runtime/Weapon/CFlameInfo.hpp @@ -19,8 +19,8 @@ public: CFlameInfo(s32, s32, CAssetId, s32, float, float, float); CFlameInfo(CInputStream& in); - s32 GetAttributes() const { return x4_attributes; } - s32 GetLength() const { return xc_length; } - CAssetId GetFlameFxId() const { return x8_flameFxId; } + [[nodiscard]] s32 GetAttributes() const { return x4_attributes; } + [[nodiscard]] s32 GetLength() const { return xc_length; } + [[nodiscard]] CAssetId GetFlameFxId() const { return x8_flameFxId; } }; } // namespace urde diff --git a/Runtime/World/CStateMachine.cpp b/Runtime/World/CStateMachine.cpp index 1208afb7b..852172251 100644 --- a/Runtime/World/CStateMachine.cpp +++ b/Runtime/World/CStateMachine.cpp @@ -77,7 +77,7 @@ void CStateMachineState::Update(CStateManager& mgr, CAi& ai, float delta) { trig = trig->GetAnd(); } } - if (andPassed && state) { + if (andPassed && state != nullptr) { x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f); x4_state = state; Log.report(logvisor::Info, FMT_STRING("{} {} {} - {} {}"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(),