CFlaahgra: Attack fixes

This commit is contained in:
Luke Street 2020-08-17 02:34:34 -04:00
parent 7644149340
commit 8904528d67
1 changed files with 8 additions and 7 deletions

View File

@ -868,6 +868,7 @@ void CFlaahgra::SetCollisionActorBounds(CStateManager& mgr, const std::unique_pt
} }
} }
} }
void CFlaahgra::UpdateScale(float t, float min, float max) { void CFlaahgra::UpdateScale(float t, float min, float max) {
float scale = (t * (max - min) + min); float scale = (t * (max - min) + min);
GetModelData()->SetScale(zeus::skOne3f * scale); GetModelData()->SetScale(zeus::skOne3f * scale);
@ -926,7 +927,7 @@ void CFlaahgra::RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec) {
mgr.GetCameraManager()->AddCameraShaker(CCameraShakeData(2.f, 0.75f), true); mgr.GetCameraManager()->AddCameraShaker(CCameraShakeData(2.f, 0.75f), true);
} else { } else {
player.ApplyImpulseWR((mgr.GetPlayer().GetMass() * 0.75f) * (25.f * zeus::skUp), {}); player.ApplyImpulseWR(mgr.GetPlayer().GetMass() * 0.75f * 25.f * zeus::skUp, {});
player.SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr); player.SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr);
} }
} }
@ -1005,8 +1006,7 @@ void CFlaahgra::Dead(CStateManager& mgr, EStateMsg msg, float) {
void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) { void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
static constexpr std::array kStates1{ static constexpr std::array kStates1{
pas::ESeverity::Invalid, pas::ESeverity::Invalid, pas::ESeverity::Invalid, -1, -1, -1, 2, -1,
pas::ESeverity::Two, pas::ESeverity::Invalid,
}; };
static constexpr std::array kSeverity{ static constexpr std::array kSeverity{
pas::ESeverity::Three, pas::ESeverity::Four, pas::ESeverity::One, pas::ESeverity::Zero, pas::ESeverity::Invalid, pas::ESeverity::Three, pas::ESeverity::Four, pas::ESeverity::One, pas::ESeverity::Zero, pas::ESeverity::Invalid,
@ -1019,15 +1019,15 @@ void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (x568_ == 0) { if (x568_ == 0) {
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::MeleeAttack) { if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::MeleeAttack) {
x568_ = kStates1[x7a8_] != pas::ESeverity::Invalid ? 1 : 2; x568_ = kStates1[x7a8_] != -1 ? 1 : 2;
if (sub801ae670()) { if (sub801ae670()) {
SetCollisionActorBounds(mgr, x79c_leftArmCollision, skUnkVec2); SetCollisionActorBounds(mgr, x79c_leftArmCollision, skUnkVec2);
SetCollisionActorBounds(mgr, x7a0_rightArmCollision, skUnkVec2); SetCollisionActorBounds(mgr, x7a0_rightArmCollision, skUnkVec2);
} }
x798_animState = x450_bodyController->GetBodyStateInfo().GetCurrentStateId();
x78c_ = sub801ae754(mgr); x78c_ = sub801ae754(mgr);
x798_animState = x450_bodyController->GetBodyStateInfo().GetCurrentStateId();
} else { } else {
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(kSeverity[x7a8_])); x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(kSeverity[x7a8_]));
} }
@ -1038,10 +1038,11 @@ void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
if (x798_animState != x450_bodyController->GetBodyStateInfo().GetCurrentStateId()) { if (x798_animState != x450_bodyController->GetBodyStateInfo().GetCurrentStateId()) {
x568_ = 2; x568_ = 2;
} else { } else {
x450_bodyController->GetCommandMgr().DeliverTargetVector(x78c_);
if (!ShouldAttack(mgr, 0.f)) if (!ShouldAttack(mgr, 0.f))
return; return;
x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(kStates1[x7a8_])); x450_bodyController->GetCommandMgr().DeliverCmd(CBCMeleeAttackCmd(kSeverity[kStates1[x7a8_]]));
} }
} }
} else if (x568_ == 2) { } else if (x568_ == 2) {
@ -1055,7 +1056,7 @@ void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
SetCollisionActorBounds(mgr, x7a0_rightArmCollision, {}); SetCollisionActorBounds(mgr, x7a0_rightArmCollision, {});
if (sub801ae670()) if (sub801ae670())
x7c0_ = (1.f + x788_) / (x308_attackTimeVariation * mgr.GetActiveRandom()->Float() + x304_averageAttackTime); x7c0_ = (x308_attackTimeVariation * mgr.GetActiveRandom()->Float() + x304_averageAttackTime) / (1.f + x788_);
x7a8_ = -1; x7a8_ = -1;