From e38a3ece8945490071405547f2e521ad86df9b72 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 6 Jul 2019 22:22:35 -1000 Subject: [PATCH] More CBabygoth fixes --- CMakeLists.txt | 5 +++++ Runtime/MP1/CSamusHud.cpp | 3 ++- Runtime/MP1/World/CBabygoth.cpp | 29 +++++++++++++++++------------ Runtime/MP1/World/CBabygoth.hpp | 2 +- Runtime/World/CPlayer.cpp | 12 +++++++----- hecl | 2 +- 6 files changed, 33 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0591aab3a..7315d8b9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,11 @@ if(MSVC) endif() else() + if(${CMAKE_BUILD_TYPE} STREQUAL Debug) + # For libstdc++ shipped with GCC 9.1, this is required to summarize std::string + add_compile_definitions(_GLIBCXX_DEBUG=1) + endif() + if(${URDE_VECTOR_ISA} STREQUAL "avx2") add_compile_options(-mavx2) message(STATUS "Building with AVX2 Vector ISA") diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index dabcaac90..f118fd7e1 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -906,7 +906,7 @@ void CSamusHud::UpdateHudDamage(float dt, const CStateManager& mgr, DataSpec::IT if (color2.a()) { if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Unmorphed) color2.a() *= 0.75f; - x3a8_camFilter.SetFilter(EFilterType::Add, EFilterShape::Fullscreen, 0.f, color2, -1); + x3a8_camFilter.SetFilter(EFilterType::Add, EFilterShape::Fullscreen, 0.f, color2, {}); } else { x3a8_camFilter.DisableFilter(0.f); } @@ -1382,6 +1382,7 @@ void CSamusHud::Draw(const CStateManager& mgr, float alpha, CInGameGuiManager::E bool targetingManager) const { if (x2bc_nextState == EHudState::None) return; + x3a8_camFilter.Draw(); if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed) { DrawAttachedEnemyEffect(mgr); x51c_camFilter2.Draw(); diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index b2aa6a040..b924becfa 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -302,12 +302,13 @@ void CBabygoth::SetupCollisionManager(CStateManager& mgr) { x928_colActMgr->SetActive(mgr, GetActive()); for (u32 i = 0; i < x928_colActMgr->GetNumCollisionActors(); ++i) { - TUniqueId id = x928_colActMgr->GetCollisionDescFromIndex(i).GetCollisionActorId(); + const CJointCollisionDescription& desc = x928_colActMgr->GetCollisionDescFromIndex(i); + TUniqueId id = desc.GetCollisionActorId(); if (TCastToPtr colAct = mgr.ObjectById(id)) { colAct->SetDamageVulnerability(x570_babyData.x68_mouthVulnerabilities); - if (colAct->GetName().find(skpMouthDamageJoint)) + if (desc.GetName().find(skpMouthDamageJoint) == 0) x9f6_mouthCollisionActor = id; - else if (colAct->GetName().find("Pelvis"sv)) { + else if (desc.GetName().find("Pelvis"sv) == 0 || desc.GetName().find("butt_LCTR"sv) == 0) { x9f8_shellIds.push_back(id); x300_maxAttackRange = 66; } @@ -325,6 +326,10 @@ void CBabygoth::SetupCollisionManager(CStateManager& mgr) { void CBabygoth::SetupHealthInfo(CStateManager& mgr) { CHealthInfo* thisHealth = HealthInfo(mgr); x8ec_bodyHP = thisHealth->GetHP(); + + if (TCastToPtr colAct = mgr.ObjectById(x9f6_mouthCollisionActor)) + colAct->HealthInfo(mgr)->SetHP(x570_babyData.GetShellHitPoints()); + for (const TUniqueId& uid : x9f8_shellIds) { if (TCastToPtr colAct = mgr.ObjectById(uid)) { CHealthInfo* colHealth = colAct->HealthInfo(mgr); @@ -474,17 +479,17 @@ void CBabygoth::UpdateShellHealth(CStateManager& mgr) { if (xa00_shellHitPoints <= 0.f) return; - float hp = 0.f; + float dam = 0.f; if (TCastToPtr colAct = mgr.ObjectById(x9f6_mouthCollisionActor)) - hp = zeus::max(hp, colAct->GetHealthInfo(mgr)->GetHP() - x570_babyData.GetShellHitPoints()); + dam = zeus::max(dam, x570_babyData.GetShellHitPoints() - colAct->GetHealthInfo(mgr)->GetHP()); for (TUniqueId uid : x9f8_shellIds) { if (TCastToPtr colAct = mgr.ObjectById(uid)) { - hp = zeus::max(hp, colAct->GetHealthInfo(mgr)->GetHP() - x570_babyData.GetShellHitPoints()); + dam = zeus::max(dam, x570_babyData.GetShellHitPoints() - colAct->GetHealthInfo(mgr)->GetHP()); } } - xa00_shellHitPoints -= hp; + xa00_shellHitPoints -= dam; if (xa00_shellHitPoints <= 0.f) { x56c_shellState = EShellState::Destroyed; DestroyShell(mgr); @@ -506,7 +511,7 @@ void CBabygoth::UpdateShellHealth(CStateManager& mgr) { } } - hp = (x56c_shellState == EShellState::Destroyed ? x8ec_bodyHP : x570_babyData.GetShellHitPoints()); + float hp = (x56c_shellState == EShellState::Destroyed ? x8ec_bodyHP : x570_babyData.GetShellHitPoints()); if (TCastToPtr colAct = mgr.ObjectById(x9f6_mouthCollisionActor)) { colAct->HealthInfo(mgr)->SetHP(hp); @@ -568,18 +573,18 @@ void CBabygoth::UpdateHealth(CStateManager& mgr) { return; if (x56c_shellState == EShellState::Destroyed) { - float hp = 0.f; + float dam = 0.f; if (TCastToPtr colAct = mgr.ObjectById(x9f6_mouthCollisionActor)) { - hp = zeus::max(hp, colAct->GetHealthInfo(mgr)->GetHP() - x8ec_bodyHP); + dam = zeus::max(dam, x8ec_bodyHP - colAct->GetHealthInfo(mgr)->GetHP()); } for (TUniqueId uid : x9f8_shellIds) { if (TCastToPtr colAct = mgr.ObjectById(uid)) { - hp = zeus::max(hp, colAct->GetHealthInfo(mgr)->GetHP() - x8ec_bodyHP); + dam = zeus::max(dam, x8ec_bodyHP - colAct->GetHealthInfo(mgr)->GetHP()); } } - HealthInfo(mgr)->SetHP(hp - HealthInfo(mgr)->GetHP()); + HealthInfo(mgr)->SetHP(HealthInfo(mgr)->GetHP() - dam); if (HealthInfo(mgr)->GetHP() <= 0.f) { Death(mgr, {}, EScriptObjectState::DeathRattle); xa48_26_inProjectileAttack = true; diff --git a/Runtime/MP1/World/CBabygoth.hpp b/Runtime/MP1/World/CBabygoth.hpp index b95f3e580..0b40bb835 100644 --- a/Runtime/MP1/World/CBabygoth.hpp +++ b/Runtime/MP1/World/CBabygoth.hpp @@ -88,7 +88,7 @@ private: CDamageVulnerability x98c_dVuln; CSegId x9f4_mouthLocator; TUniqueId x9f6_mouthCollisionActor = kInvalidUniqueId; - rstl::reserved_vector x9f8_shellIds; + rstl::reserved_vector x9f8_shellIds; float xa00_shellHitPoints; u32 xa04_drawMaterialIdx = 0; TLockedToken xa08_noShellModel; diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 9797418c7..ba0bd5dd5 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -1804,7 +1804,7 @@ void CPlayer::UnFreeze(CStateManager& stateMgr) { ApplySubmergedPitchBend(hnd); } x768_morphball->Stop(); - SetVisorSteam(0.f, 0.42857146f, 0.071428575f, xa08_steamTextureId, false); + SetVisorSteam(0.f, 6.f / 14.f, 1.f / 14.f, xa08_steamTextureId, false); } } @@ -1846,13 +1846,15 @@ bool CPlayer::GetFrozenState() const { return x750_frozenTimeout > 0.f; } void CPlayer::UpdateFrozenState(const CFinalInput& input, CStateManager& mgr) { x750_frozenTimeout -= input.DeltaTime(); - if (x750_frozenTimeout > 0.f) - SetVisorSteam(0.7f, 0.42857146f, 0.071428575f, xa08_steamTextureId, false); - else + if (x750_frozenTimeout > 0.f) { + SetVisorSteam(0.7f, 6.f / 14.f, 1.f / 14.f, xa08_steamTextureId, false); + } else { UnFreeze(mgr); + return; + } if (x258_movementState == EPlayerMovementState::OnGround || x258_movementState == EPlayerMovementState::FallingMorphed) { - UnFreeze(mgr); + Stop(); ClearForcesAndTorques(); } x7a0_visorSteam.Update(input.DeltaTime()); diff --git a/hecl b/hecl index a3986ebfe..56912f290 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit a3986ebfe8002dc565b861dd1d0bec336e5382c8 +Subproject commit 56912f290617b360125def83461104eeb703f661