CGrenadeLauncher: Fix UpdateFollowPlayer

This commit is contained in:
Luke Street 2020-04-07 19:26:22 -04:00
parent 1dc90f78d3
commit 1f55b5f92e
2 changed files with 4 additions and 4 deletions

View File

@ -152,7 +152,7 @@ void CGrenadeLauncher::Think(float dt, CStateManager& mgr) {
UpdateCollision();
UpdateColor(dt);
sub_8022f9e0(mgr, dt);
UpdateFollowPlayer(mgr, dt);
UpdateDamageTime(dt);
const SAdvancementDeltas& deltas = CActor::UpdateAnimation(dt, mgr, true);
@ -212,14 +212,14 @@ void CGrenadeLauncher::CreateExplosion(CStateManager& mgr) {
CSfxManager::SfxStart(x2d0_data.GetExplosionSfx(), 1.f, 1.f, false, 0x7f, false, kInvalidAreaId);
}
void CGrenadeLauncher::sub_8022f9e0(CStateManager& mgr, float dt) {
void CGrenadeLauncher::UpdateFollowPlayer(CStateManager& mgr, float dt) {
CModelData* modelData = GetModelData();
CAnimData* animData = nullptr;
if (modelData != nullptr && (animData = modelData->GetAnimationData()) != nullptr && x258_started == 1 &&
x3fe_followPlayer) {
const zeus::CVector3f target = mgr.GetPlayer().GetAimPosition(mgr, 0.f) - GetTranslation();
const zeus::CVector3f rot = GetTransform().rotate({target.x(), target.y(), 0.f}); // TODO double check
const zeus::CVector3f rot = GetTransform().transposeRotate({target.x(), target.y(), 0.f});
if (rot.canBeNormalized()) {
constexpr float p36d = zeus::degToRad(36.476f);

View File

@ -121,7 +121,7 @@ private:
void UpdateColor(float arg);
void UpdateDamageTime(float arg);
void CreateExplosion(CStateManager& mgr);
void sub_8022f9e0(CStateManager& mgr, float dt);
void UpdateFollowPlayer(CStateManager& mgr, float dt);
void sub_80230438();
void LaunchGrenade(CStateManager& mgr);
};