More CBabygoth fixes

This commit is contained in:
Jack Andersen 2019-07-06 22:22:35 -10:00
parent c899bf2d47
commit e38a3ece89
6 changed files with 33 additions and 20 deletions

View File

@ -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")

View File

@ -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();

View File

@ -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<CCollisionActor> 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<CCollisionActor> colAct = mgr.ObjectById(x9f6_mouthCollisionActor))
colAct->HealthInfo(mgr)->SetHP(x570_babyData.GetShellHitPoints());
for (const TUniqueId& uid : x9f8_shellIds) {
if (TCastToPtr<CCollisionActor> 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<CCollisionActor> 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<CCollisionActor> 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<CCollisionActor> 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<CCollisionActor> 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<CCollisionActor> 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;

View File

@ -88,7 +88,7 @@ private:
CDamageVulnerability x98c_dVuln;
CSegId x9f4_mouthLocator;
TUniqueId x9f6_mouthCollisionActor = kInvalidUniqueId;
rstl::reserved_vector<TUniqueId, 1> x9f8_shellIds;
rstl::reserved_vector<TUniqueId, 2> x9f8_shellIds;
float xa00_shellHitPoints;
u32 xa04_drawMaterialIdx = 0;
TLockedToken<CSkinnedModel> xa08_noShellModel;

View File

@ -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());

2
hecl

@ -1 +1 @@
Subproject commit a3986ebfe8002dc565b861dd1d0bec336e5382c8
Subproject commit 56912f290617b360125def83461104eeb703f661