diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index 550f7dd97..1308f4301 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -150,28 +150,28 @@ struct CTweakTargeting final : public ITweakTargeting { zeus::CVector3f x23c_ = zeus::skZero3f; float x2c8_ = 0.25f; - float x2cc_ = 0.35f; - zeus::CColor x2d0_ = (zeus::Comp32) 0xb6e6ffff; + float x2cc_uiScale = 0.35f; + zeus::CColor x2d0_orbitLockArmColor = zeus::Comp32(0x0b6e6ffff); float x2d4_ = 0.39215687f; - zeus::CColor x2d8_ = (zeus::Comp32) 0xa82a00ff; + zeus::CColor x2d8_ = zeus::Comp32(0xa82a00ff); float x2dc_ = 0.78431374f; - zeus::CVector3f x2e0_ = zeus::CVector3f(0.f, 0.f, 0.46f); + zeus::CVector3f x2e0_uiPositionOffset = zeus::CVector3f(0.f, 0.f, 0.46f); float x2ec_ = 0.25f; float x2f0_ = 0.25f; - float x2f4_ = 120.f; + float x2f4_orbitLockArmRotSpeed = 120.f; float x2f8_ = 0.25f; float x2fc_ = 3.5f; float x300_ = 0.35f; - zeus::CColor x304_ = (zeus::Comp32) 0xa82a00ff; + zeus::CColor x304_ = zeus::Comp32(0xa82a00ff); float x308_ = 0.78431374f; - zeus::CColor x30c_ = (zeus::Comp32) 0x89d6ffff; + zeus::CColor x30c_ = zeus::Comp32(0x89d6ffff); float x310_ = 0.5019608f; float x314_ = 11.25f; float x318_ = 0.25f; float x31c_ = 0.125f; - zeus::CColor x320_ = (zeus::Comp32) 0xffca28ff; + zeus::CColor x320_ = zeus::Comp32(0xffca28ff); float x324_ = 0.78431374f; - zeus::CColor x328_ = (zeus::Comp32) 0x89d6ffff; + zeus::CColor x328_ = zeus::Comp32(0x89d6ffff); float x32c_ = 0.19607843f; float x330_ = 0.f; float x334_ = 0.25f; @@ -182,18 +182,18 @@ struct CTweakTargeting final : public ITweakTargeting { float x348_ = 0.25f; float x34c_ = 45.f; float x350_ = 0.5f; - float x354_ = 0.65f; + float x354_nextGrappleOrbitLockAlphaMax = 0.65f; float x358_ = 1.5f; float x35c_ = 0.18f; float x360_ = 0.15f; float x364_ = 0.25f; - zeus::CColor x368_ = (zeus::Comp32) 0x56c1fb9f; - zeus::CColor x36c_ = (zeus::Comp32) 0x49c3f6a0; - zeus::CColor x370_ = (zeus::Comp32) 0x49c3f631; - zeus::CColor x374_ = (zeus::Comp32) 0xff8930ff; - zeus::CColor x378_ = (zeus::Comp32) 0xff2f28ff; - zeus::CColor x37c_ = (zeus::Comp32) 0x93e9ffff; - zeus::CColor x380_ = (zeus::Comp32) 0xff6b60ff; + zeus::CColor x368_ = zeus::Comp32(0x56c1fb9f); + zeus::CColor x36c_ = zeus::Comp32(0x49c3f6a0); + zeus::CColor x370_ = zeus::Comp32(0x49c3f631); + zeus::CColor x374_ = zeus::Comp32(0xff8930ff); + zeus::CColor x378_ = zeus::Comp32(0xff2f28ff); + zeus::CColor x37c_ = zeus::Comp32(0x93e9ffff); + zeus::CColor x380_ = zeus::Comp32(0xff6b60ff); CTweakTargeting() = default; CTweakTargeting(athena::io::IStreamReader& r) { diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt index 5ce5f49ad..a0c8a93e5 100644 --- a/Runtime/CMakeLists.txt +++ b/Runtime/CMakeLists.txt @@ -118,6 +118,8 @@ set(RUNTIME_SOURCES_B TCastTo.hpp TCastTo.cpp GCNTypes.hpp CTextureCache.hpp CTextureCache.cpp + CUnknownPlayerState1.hpp CUnknownPlayerState1.cpp + CUnknownPlayerState2.hpp CUnknownPlayerState2.cpp ${PLAT_SRCS}) function(add_runtime_common_library name) diff --git a/Runtime/CUnknownPlayerState1.cpp b/Runtime/CUnknownPlayerState1.cpp new file mode 100644 index 000000000..b9902fcfc --- /dev/null +++ b/Runtime/CUnknownPlayerState1.cpp @@ -0,0 +1,10 @@ +#include "Runtime/CUnknownPlayerState1.hpp" + +namespace urde { +CUnknownPlayerState1::CUnknownPlayerState1(float f) : x194_(f) { + std::fill(std::begin(x4_), std::end(x4_), true); + std::fill(std::begin(x64_), std::end(x64_), false); + std::fill(std::begin(x19c_), std::end(x19c_), 0.f); + std::fill(std::begin(x30c_), std::end(x30c_), 0.f); +} +} // namespace urde diff --git a/Runtime/CUnknownPlayerState1.hpp b/Runtime/CUnknownPlayerState1.hpp new file mode 100644 index 000000000..8a8189eeb --- /dev/null +++ b/Runtime/CUnknownPlayerState1.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include + +namespace urde { + +class CUnknownPlayerState1 { +private: + +public: + std::array x4_; + std::array x64_; + std::array xc4_; + uint x184_ = 0; + float x188_ = 0.f; + int x18c_ = -1; + int x190_ = -1; + float x194_; + std::array x19c_; + std::array x30c_; + + CUnknownPlayerState1(float f); +}; +} // namespace urde diff --git a/Runtime/CUnknownPlayerState2.cpp b/Runtime/CUnknownPlayerState2.cpp new file mode 100644 index 000000000..0c84af4d5 --- /dev/null +++ b/Runtime/CUnknownPlayerState2.cpp @@ -0,0 +1,7 @@ +#include "Runtime/CUnknownPlayerState2.hpp" + +namespace urde { +CUnknownPlayerState2::CUnknownPlayerState2(int i1, int i2) : xa8_(i2) { + x98_ = ((u8)(i1 << 6) & 0x40) | (x98_ & 0x3f); +} +} // namespace urde diff --git a/Runtime/CUnknownPlayerState2.hpp b/Runtime/CUnknownPlayerState2.hpp new file mode 100644 index 000000000..354afd5e9 --- /dev/null +++ b/Runtime/CUnknownPlayerState2.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include +#include + +#include "RetroTypes.hpp" + +namespace urde { + +class CUnknownPlayerState2 { +private: + zeus::CVector3f x7c_ = zeus::skZero3f; + +public: + zeus::CVector2f x0_ = zeus::skZero2f; + zeus::CVector3f x8_ = zeus::skZero3f; + float x18_ = 0.f; + float x1c_ = 0.f; + float x20_ = 0.f; + float x24_ = 0.f; + zeus::CVector3f x28_ = zeus::skRight.normalized(); + float x34_ = 0.f; + bool x38_ = false; + int x40_ = 0; // unk type + int x44_ = 0; // unk type + zeus::CVector3f x48_ = zeus::skZero3f; + zeus::CVector3f x54_ = zeus::skZero3f; + zeus::CVector3f x60_ = zeus::skZero3f; + float x6c_ = 0.f; + zeus::CVector2f x70_ = zeus::skZero2f; + float x78_ = 0.f; + TUniqueId x88_ = kInvalidUniqueId; + int x8c_ = 0; // unk type + float x90_ = 0.f; + float x94_ = 1.f; + u8 x98_; + float x9c_ = 0.f; + float xa0_ = 0.f; + int xa4_ = 0; // unk type + int xa8_; // unk type + + CUnknownPlayerState2(int i1, int i2); + + const zeus::CVector3f& Getx7c() const { return x7c_; }; +}; +} // namespace urde diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index ff25ef640..cae943506 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -2,6 +2,7 @@ #include +#include "CTimeProvider.hpp" #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/CStateManager.hpp" @@ -9,7 +10,6 @@ #include "Runtime/World/CPlayer.hpp" #include "Runtime/World/CScriptGrapplePoint.hpp" #include "Runtime/World/CWorld.hpp" - #include "TCastTo.hpp" // Generated file, do not modify include path namespace urde { @@ -47,8 +47,8 @@ float offshoot_func(float f1, float f2, float f3) { return (f1 * 0.5f) + std::si float calculate_premultiplied_overshoot_offset(float f1) { return 2.f * (M_PIF - std::asin(1.f / f1)); } } // Anonymous namespace -const CTargetReticleRenderState CTargetReticleRenderState::skZeroRenderState(kInvalidUniqueId, 1.f, - zeus::skZero3f, 0.f, 1.f, true); +const CTargetReticleRenderState CTargetReticleRenderState::skZeroRenderState(kInvalidUniqueId, 1.f, zeus::skZero3f, 0.f, + 1.f, true); CCompoundTargetReticle::SOuterItemInfo::SOuterItemInfo(std::string_view res) : x0_model(g_SimplePool->GetObj(res)) {} @@ -88,6 +88,7 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr) for (u32 i = 0; i < 9; ++i) xe0_outerBeamIconSquares.emplace_back(fmt::format(fmt("{}{}"), skOuterBeamIconSquareNameBase, i)); x34_crosshairs.Lock(); + std::fill(std::begin(x444_), std::end(x444_), kInvalidUniqueId); } CCompoundTargetReticle::SScanReticuleRenderer::SScanReticuleRenderer() { @@ -126,10 +127,12 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr) { t == 1.f ? x0_leadingOrientation : zeus::CQuaternion::slerp(x10_laggingOrientation, x0_leadingOrientation, t); xf4_targetPos = CalculateOrbitZoneReticlePosition(mgr, false); x100_laggingTargetPos = CalculateOrbitZoneReticlePosition(mgr, true); - // TODO more - UpdateNewGroup1(dt, mgr); - UpdateNewGroup2(dt, mgr); - // TODO more + UpdateNewGroup4(dt, mgr); + UpdateNewGroup5(dt, mgr); + UpdateNewGroup6(dt, mgr); + UpdateNextLockOnGroupRS5(dt, mgr); + UpdateCurrLockOnGroupRS5(dt, mgr); + UpdateNewGroup3(dt, mgr); UpdateCurrLockOnGroup(dt, mgr); UpdateNextLockOnGroup(dt, mgr); UpdateOrbitZoneGroup(dt, mgr); @@ -300,9 +303,9 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr) { x1de_grapplePoint1 = kInvalidUniqueId; } x1f0_xrayRetAngle = - zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle).asRel(); - x1ec_seekerAngle = zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle). - asRel(); + zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle).asRel(); + x1ec_seekerAngle = + zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle).asRel(); } void CTargetReticleRenderState::InterpolateWithClamp(const CTargetReticleRenderState& a, CTargetReticleRenderState& out, @@ -335,125 +338,101 @@ static bool IsDamageOrbit(CPlayer::EPlayerOrbitRequest req) { } } -void CCompoundTargetReticle::UpdateNewGroup1(float dt, const class CStateManager& mgr) { +void CCompoundTargetReticle::UpdateNextLockOnGroupRS5(float dt, const class CStateManager& mgr) { CPlayer& player = mgr.GetPlayer(); TUniqueId nextTargetId = player.GetOrbitNextTargetId(); - x2a4_ = g_tweakTargeting->x2e0_; - x290_ = zeus::CVector3f(g_tweakTargeting->x2cc_); + x2a4_uiPositionOffset = g_tweakTargeting->x2e0_uiPositionOffset; + x290_uiScale = zeus::CVector3f(g_tweakTargeting->x2cc_uiScale); if (nextTargetId != kInvalidUniqueId) - x29c_ = g_tweakTargeting->x2d0_; + x29c_nextTargetOrbitLockColor = g_tweakTargeting->x2d0_orbitLockArmColor; if (auto act = TCastToConstPtr(mgr.GetObjectById(nextTargetId))) - x2b4_ = act->GetOrbitPosition(mgr); + x2b4_nextTargetOrbitPosition = act->GetOrbitPosition(mgr); else - x2b4_ = x2c0_; + x2b4_nextTargetOrbitPosition = x2c0_orbitLockArmNextOrigin; - const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); - const zeus::CTransform cameraTransform = camera->GetTransform(); - const zeus::CVector3f vec1 = cameraTransform.frontVector().normalized(); - const zeus::CVector3f cameraOrigin = vec1 - cameraTransform.origin; - const zeus::CVector3f normalizedCamOrigin = cameraOrigin.normalized(); - const float dot = 1.25f / vec1.dot(normalizedCamOrigin); - const zeus::CVector3f final = cameraTransform.origin + (normalizedCamOrigin * dot); - x2d8_ = final; + const zeus::CTransform cameraTransform = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform(); + const zeus::CVector3f cameraOrigin = cameraTransform.origin; + const zeus::CVector3f cameraFrontVector = cameraTransform.frontVector().normalized(); + const zeus::CVector3f nextTargetCameraOffset = (x2b4_nextTargetOrbitPosition - cameraOrigin).normalized(); + const float dot = 1.25f / cameraFrontVector.dot(nextTargetCameraOffset); + const zeus::CVector3f final = cameraOrigin + (nextTargetCameraOffset * dot); + x2d8_orbitLockArm1Origin = final; - if (nextTargetId != kInvalidUniqueId && x27c_ != nextTargetId) { - if (x2a0_ == 0.f) { - x2e4_ = final; + if (nextTargetId != kInvalidUniqueId && x27c_nextTargetId != nextTargetId) { + if (x2a0_nextTargetOrbitLockAlpha == 0.f) { + x2e4_orbitLockArmFadeOrigin = final; } else { - x2e4_ = x2c0_; - x2cc_ = true; - x2d0_ = g_tweakTargeting->x2f0_; - x2d4_ = 0.f; + x2e4_orbitLockArmFadeOrigin = x2c0_orbitLockArmNextOrigin; + x2cc_orbitLockArmFading = true; + x2d0_orbitLockArmFadeAmt = g_tweakTargeting->x2f0_; + x2d4_orbitLockArmFadeDt = 0.f; } } - float dVar19 = g_tweakTargeting->x2d4_; - float dVar18 = dt * (dVar19 / g_tweakTargeting->x2ec_); + float alphaMax = g_tweakTargeting->x2d4_; + float alphaChg = dt * (alphaMax / g_tweakTargeting->x2ec_); if (nextTargetId == kInvalidUniqueId) { - float dVar16 = x2a0_ - dVar18; - float check1 = 0.f; - if ((0.f - dVar16) <= 0.f) { - check1 = dVar16; - } - if (dVar19 <= 0.f) { - dVar19 = check1; - } - x2a0_ = dVar19; + x2a0_nextTargetOrbitLockAlpha = std::clamp(x2a0_nextTargetOrbitLockAlpha - alphaChg, 0.f, alphaMax); } else { - float dVar16 = x2a0_ + dVar18; - float check1 = 0.f; - if ((0.f - dVar16) <= 0.f) { - check1 = dVar16; - } - if (dVar19 <= 0.f) { - dVar19 = check1; - } - x2a0_ = dVar19; + x2a0_nextTargetOrbitLockAlpha = std::clamp(x2a0_nextTargetOrbitLockAlpha + alphaChg, 0.f, alphaMax); } - if (!x2cc_ || x2d0_ <= 0.f) { - x280_ = x2d8_; - x2c0_ = x2b4_; + if (!x2cc_orbitLockArmFading || x2d0_orbitLockArmFadeAmt <= 0.f) { + x280_nextTargetOrbitLockOrigin = x2d8_orbitLockArm1Origin; + x2c0_orbitLockArmNextOrigin = x2b4_nextTargetOrbitPosition; } else { - float f1 = x2d4_ + dt; - float result = 0.f; - if ((0.f - f1) <= 0.f) { - result = f1; - } - f1 = x2d0_; - if (f1 <= 0.f) { - f1 = result; - } - x2d4_ = f1; - if (x2d0_ <= f1) { - x2cc_ = false; - x280_ = x2d8_; - x2c0_ = x2b4_; + float f3 = x2d0_orbitLockArmFadeAmt; + float pt = std::max(0.f, x2d4_orbitLockArmFadeDt + dt); + float f0 = (pt - f3) >= 0.f ? f3 : pt; + x2d4_orbitLockArmFadeDt = f0; + if (x2d0_orbitLockArmFadeAmt <= f0) { + x2cc_orbitLockArmFading = false; + x280_nextTargetOrbitLockOrigin = x2d8_orbitLockArm1Origin; + x2c0_orbitLockArmNextOrigin = x2b4_nextTargetOrbitPosition; } else { - const zeus::CVector3f origin = (x2e4_ - cameraTransform.origin).normalized(); - float dot2 = 1.25f / origin.dot(vec1); - const zeus::CVector3f vec = (origin * dot2) + cameraOrigin; + const zeus::CVector3f origin = (x2e4_orbitLockArmFadeOrigin - cameraOrigin).normalized(); + float dot2 = 1.25f / origin.dot(cameraFrontVector); + const zeus::CVector3f vec = cameraOrigin + (origin * dot2); - float div = x2d4_ / x2d0_; + float div = x2d4_orbitLockArmFadeDt / x2d0_orbitLockArmFadeAmt; float oneMinusDiv = 1.f - div; - const zeus::CVector3f vec2 = (vec * oneMinusDiv) + (x2d8_ * div); - x280_ = vec2; + const zeus::CVector3f vec2 = (vec * oneMinusDiv) + (x2d8_orbitLockArm1Origin * div); + x280_nextTargetOrbitLockOrigin = vec2; const zeus::CVector3f vec3 = (vec2 - cameraOrigin).normalized(); - float mag = (x2b4_ - cameraOrigin).magnitude(); - x2c0_ = cameraOrigin + (vec3 * mag); + float mag = (x2b4_nextTargetOrbitPosition - cameraOrigin).magnitude(); + x2c0_orbitLockArmNextOrigin = cameraOrigin + (vec3 * mag); } } - x27c_ = nextTargetId; - x28c_ = x28c_ + zeus::degToRad(dt * g_tweakTargeting->x2f4_); + x27c_nextTargetId = nextTargetId; + x28c_orbitLockArmRotation += zeus::degToRad(dt * g_tweakTargeting->x2f4_orbitLockArmRotSpeed); } -void CCompoundTargetReticle::UpdateNewGroup2(float dt, const class CStateManager& mgr) { +void CCompoundTargetReticle::UpdateCurrLockOnGroupRS5(float dt, const class CStateManager& mgr) { CPlayer& player = mgr.GetPlayer(); TUniqueId targetId = player.GetOrbitTargetId(); bool bVar1 = false; if (targetId != kInvalidUniqueId) { - TCastToConstPtr prevPoint = mgr.GetObjectById(x27c_); + TCastToConstPtr prevPoint = mgr.GetObjectById(x27c_nextTargetId); TCastToConstPtr currPoint = mgr.GetObjectById(targetId); bVar1 = currPoint.operator bool(); if (!prevPoint) { - x27c_ = kInvalidUniqueId; - x2a0_ = 0.f; + x27c_nextTargetId = kInvalidUniqueId; + x2a0_nextTargetOrbitLockAlpha = 0.f; } } - const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); - zeus::CTransform cameraTransform = camera->GetTransform(); - zeus::CQuaternion quat_304 = cameraTransform.getRotation().buildMatrix3f(); - zeus::CVector3f vec3f_17c = quat_304.transform(zeus::CVector3f(0.f, 1.25f, 0.f)); - x2f2_ = cameraTransform.origin + vec3f_17c; + zeus::CTransform cameraTransform = mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform(); + zeus::CQuaternion cameraRotation = cameraTransform.getRotation().buildMatrix3f(); + zeus::CVector3f translate = cameraRotation.transform(zeus::CVector3f(0.f, 1.25f, 0.f)); + x2f2_orbitLockOrigin = cameraTransform.origin + translate; bool bVar11 = false; auto uVar14 = ((u32)kInvalidUniqueId.id) - ((u32)targetId.id) | ((u32)targetId.id) - ((u32)kInvalidUniqueId.id); - if (((s32) uVar14) > -1 && player.x1188_) { // < 0 + if (((s32)uVar14) > -1 && player.x1188_) { // < 0 bVar11 = true; } @@ -462,7 +441,7 @@ void CCompoundTargetReticle::UpdateNewGroup2(float dt, const class CStateManager if (bVar11) { TCastToConstPtr point = mgr.GetObjectById(x2f0_); if (x20_prevState == EReticleState::Combat && !point.operator bool()) { - x350_ = 1.f; + x350_nextGrappleOrbitLockAlpha = 1.f; } } } else { @@ -472,110 +451,75 @@ void CCompoundTargetReticle::UpdateNewGroup2(float dt, const class CStateManager x324_ += dt; } - x300_ = g_tweakTargeting->x2d8_; + x300_orbitLockArmColor = g_tweakTargeting->x2d8_; zeus::CColor _1d4 = g_tweakTargeting->x304_; if (IsGrappleTarget(targetId, mgr)) { - x300_ = g_tweakTargeting->x320_; + x300_orbitLockArmColor = g_tweakTargeting->x320_; _1d4 = g_tweakTargeting->x320_; } - if (((s32) uVar14) < 0) { + if (((s32)uVar14) < 0 || !bVar11) { x37c_ = std::max(0.f, g_tweakTargeting->x318_); x380_ = std::max(0.f, g_tweakTargeting->x31c_); } else { - if (bVar11) { - x380_ = std::max(0.f, g_tweakTargeting->x318_); - x37c_ = std::max(0.f, g_tweakTargeting->x31c_); - } else { - x37c_ = std::max(0.f, g_tweakTargeting->x318_); - x380_ = std::max(0.f, g_tweakTargeting->x31c_); - } + x380_ = std::max(0.f, g_tweakTargeting->x318_); + x37c_ = std::max(0.f, g_tweakTargeting->x31c_); } - float fVar2 = g_tweakTargeting->x354_; - float fVar3 = 0.f; - if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed) { - fVar3 = g_tweakTargeting->x358_; - } float fVar4 = 1.f; - if (fVar3 > 0.f) { - fVar4 = dt * (fVar2 / fVar3); + if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed) { + fVar4 = dt * (g_tweakTargeting->x354_nextGrappleOrbitLockAlphaMax / g_tweakTargeting->x358_); } - fVar4 = x350_ - fVar4; - fVar3 = 0.f; - if (0.f - fVar4 <= 0.f) { - fVar3 = fVar4; - } - if (fVar2 <= 0.f) { - fVar2 = fVar3; - } - x350_ = fVar2; + x350_nextGrappleOrbitLockAlpha = + std::clamp(x350_nextGrappleOrbitLockAlpha - fVar4, 0.f, g_tweakTargeting->x354_nextGrappleOrbitLockAlphaMax); float dVar31 = x37c_ / g_tweakTargeting->x318_; float dVar30 = x380_ / g_tweakTargeting->x31c_; x36c_lerped_color_ = zeus::CColor::lerp(g_tweakTargeting->x30c_, _1d4, dVar31); + x378_ = dVar30; - x370_ = ((1.f - dVar31) * g_tweakTargeting->x310_) + (dVar31 * g_tweakTargeting->x308_); - x374_ = ((1.f - dVar30) * 0.f) + (dVar30 * g_tweakTargeting->x314_); - - float local_140 = g_tweakTargeting->x338_; - x328_ = x290_ + local_140; + x374_ = /*((1.f - dVar30) * 0.f) +*/ (dVar30 * g_tweakTargeting->x314_); + float clamp = std::clamp((x324_ - g_tweakTargeting->x330_) / g_tweakTargeting->x334_, 0.f, 1.f); + float negativeClamp = g_tweakTargeting->x338_ * (1.f - clamp); + x328_orbitLockBaseScale = (x290_uiScale * clamp) + negativeClamp; x308_orbitLockBaseColor = g_tweakTargeting->x328_; x30c_orbitLockBaseAlpha = g_tweakTargeting->x32c_; - dVar30 = (x324_ - g_tweakTargeting->x33c_) / g_tweakTargeting->x340_; - float dVar27 = 0.f; - if ((float)(0.f - dVar30) <= 0.00000000) { - dVar27 = dVar30; - } - dVar30 = 1.f; - if ((float)(dVar27 - 1.f) <= 0.00000000) { - dVar30 = dVar27; - } - x334_ = ((1.f - dVar30) * 0.f) + (dVar30 * g_tweakTargeting->x32c_); + float f31 = std::clamp((x324_ - g_tweakTargeting->x33c_) / g_tweakTargeting->x340_, 0.f, 1.f); + x334_ = f31 * g_tweakTargeting->x32c_; - zeus::CVector3f _14c(player.GetTransform().basis.m[1][0], player.GetTransform().basis.m[1][1], 0.f); // params probably not right - _14c.normalize(); - float fVar27 = zeus::CVector3f::getAngleDiff(_14c, zeus::skForward); - float fVar2_ = 360.f * (0.15915494f /*1/(2*PI)*/ * fVar27); + const zeus::CVector3f& playerRotation = player.GetTransform().frontVector().normalized(); + float f = 1.f / (2.f * M_PI); + float degrees = 360.f * (f * zeus::CVector3f::getAngleDiff(playerRotation, zeus::skForward)); + float radians = zeus::degToRad(playerRotation.x() > 0.f ? 360.f - degrees : degrees); + float playerAngle = radians - std::trunc(radians * f) * M_2_PI; + if (playerAngle < 0.f) + playerAngle += M_2_PI; - float out; - if (0.f <= _14c.x()) { // local_1b0 = local_14c.x * local_158.y - local_158.x * local_14c.y; - float rad = zeus::degToRad(fVar2_); - float d = rad - (((int) (rad * M_PI_2)) * M_2_PI); - if (d < 0.f) - d += M_2_PI; - out = d; + if (f31 < 1.f) { + x338_orbitLockBracketsRotation = 0.f; } else { - float rad = zeus::degToRad(360.f - fVar2_); - float d = rad - (((int) (rad * M_PI_2)) * M_2_PI); - if (d < 0.f) - d += M_2_PI; - out = d; + x338_orbitLockBracketsRotation = x338_orbitLockBracketsRotation + (playerAngle - x33c_prevPlayerAngle); } + x33c_prevPlayerAngle = playerAngle; - if (dVar30 < 1.f) { - x338_ = 0.f; + float f32 = ((x324_ - 0.f) / g_tweakTargeting->x348_) * 0.5f; + x340_orbitLockTechScrollTime = std::clamp(f32, 0.f, 0.496f); + if (f32 < 1.f) { + x344_orbitLockTechRotation = 0.f; } else { - x338_ = x338_ + (out - x33c_angle_); + x344_orbitLockTechRotation += zeus::degToRad(g_tweakTargeting->x34c_ * dt); } - x33c_angle_ = out; - x340_ = 0.496f; - if ((x324_ - g_tweakTargeting->x344_) / g_tweakTargeting->x348_ < 1.f) { - x344_ = 0.f; - } else { - x344_ += zeus::degToRad(g_tweakTargeting->x34c_ * dt); - } - x348_inverse_angle_ = out; + x348_playerAngle = playerAngle; if (x20_prevState != EReticleState::Combat && x20_prevState != EReticleState::Unspecified) { bVar1 = true; x374_ = 0.f; } if (bVar1) { - x304_ = 0.f; + x304_orbitLockArmAlpha = 0.f; } else { float g = g_tweakTargeting->x2dc_; float f3 = 1.f; @@ -583,22 +527,130 @@ void CCompoundTargetReticle::UpdateNewGroup2(float dt, const class CStateManager f3 = (dt * (g / g_tweakTargeting->x2fc_)); } if (x324_ < g_tweakTargeting->x2f8_) { - x304_ = g; + x304_orbitLockArmAlpha = g; } else { float f4 = g_tweakTargeting->x300_; if (f4 <= 0.f) { - f4 = x304_ - f3; + f4 = x304_orbitLockArmAlpha - f3; } if (g <= 0.f) { g = f4; } - x304_ = g; + x304_orbitLockArmAlpha = g; } } x34c_ = bVar11; x2f0_ = targetId; } +void CCompoundTargetReticle::UpdateNewGroup3(float dt, const CStateManager& mgr) { + bool bVar5; + CPlayer& player = mgr.GetPlayer(); + std::shared_ptr playerState = mgr.GetPlayerState(); + if (playerState->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan) { + TUniqueId id = kInvalidUniqueId; + if (x440_ != 0) { + id = *x444_.begin(); + } + TCastToConstPtr checkActor = mgr.GetObjectById(id); + zeus::CVector3f vec = player.GetUnknownPlayerState2().Getx7c(); + zeus::CVector3f vec2 = zeus::skZero3f; + + if (checkActor.operator bool()) { + bool bVar10 = false; + zeus::CAABox total; + + auto iter = x444_.begin(); + // TODO x440_ tracks count? + while (iter != x444_.end()) { + TCastToConstPtr actor = mgr.GetObjectById(*iter); + if (actor.operator bool()) { + const CModelData* modelData = actor->GetModelData(); + bool bVar6 = false; + if (modelData != nullptr) { + bVar5 = false; + if (!modelData->HasAnimData() && !modelData->GetNormalModel().IsLocked()) { // Locked?? + bVar5 = true; + } + if (!bVar5) { + bVar6 = true; + } + } + if (bVar6) { + bVar6 = false; + if (!modelData->HasAnimData() && !modelData->GetNormalModel().IsLocked()) { + bVar6 = true; + } + if (!bVar6) { + if (!modelData->HasAnimData()) { + const zeus::CAABox box = modelData->GetBounds(); + const zeus::CVector3f center = box.center(); + const zeus::CVector3f mul = box.extents() * modelData->GetScale(); + total.accumulateBounds(zeus::CAABox(center - mul, center + mul)); + bVar10 = true; + } else { + const zeus::CAABox box = modelData->GetAnimationData()->GetBoundingBox(); + zeus::CTransform transform = player.GetTransform(); + const zeus::CVector3f min = transform * (box.min * modelData->GetScale()); + const zeus::CVector3f max = transform * (box.max * modelData->GetScale()); + total.accumulateBounds(zeus::CAABox(min, max)); + bVar10 = true; + } + } + } + } + } + if (bVar10) { + const zeus::CVector3f _1b8 = total.center(); + vec = _1b8; + const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); + const zeus::CAABox transformed = total.getTransformedAABox(camera->GetTransform()); + const zeus::CVector3f _1c4 = transformed.max - transformed.min; + vec2 = _1c4; + const zeus::CVector3f _320 = camera->ConvertToScreenSpace(_1b8); + if (_320.z() > 1.f) { + vec = player.GetUnknownPlayerState2().Getx7c(); + vec2 = zeus::skOne3f; + } + } + } + + x41c_ = vec; + x434_ = vec2; + } +} + +void CCompoundTargetReticle::UpdateNewGroup4(float dt, const CStateManager& mgr) { + CPlayer& player = mgr.GetPlayer(); + x228_ = player.GetUnknownPlayerState2().Getx7c(); + + TUniqueId targetId = mgr.GetPlayer().GetOrbitTargetId(); + TCastToConstPtr actor = mgr.GetObjectById(targetId); + float d = dt / 1.f; + if (actor.operator bool()) { + x21c_ = std::min(1.f, x21c_ + d); + x234_ = CalculatePositionWorld(*actor, mgr); + } else { + x21c_ = std::max(0.f, x21c_ - d); + } + + x224_ = std::max(0.f, x224_ - d); +} + +void CCompoundTargetReticle::UpdateNewGroup5(float dt, const CStateManager& mgr) { + const CPlayer& player = mgr.GetPlayer(); + x240_ = player.GetUnknownPlayerState2().Getx7c(); + x250_ = g_tweakTargeting->x220_scanTargetClampMax; + x268_ = g_tweakTargeting->x23c_; + + const zeus::CVector3f v1 = player.GetUnknownPlayerState2().Getx7c() - player.GetTransform().origin; + float mag = v1.magnitude(); +} + +void CCompoundTargetReticle::UpdateNewGroup6(float dt, const CStateManager& mgr) { + +} + void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager& mgr) { TUniqueId targetId = mgr.GetPlayer().GetOrbitTargetId(); if (targetId != xf0_targetId) { @@ -655,12 +707,11 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager 1.f - x204_chargeGaugeOvershootTimer / g_tweakTargeting->GetChargeGaugeOvershootDuration()); for (int i = 0; i < 9; ++i) { SOuterItemInfo& item = xe0_outerBeamIconSquares[i]; - item.x10_rotAng = zeus::CRelAngle(item.x18_offshootAngleDelta * offshoot + item.xc_offshootBaseAngle). - asRel(); + item.x10_rotAng = zeus::CRelAngle(item.x18_offshootAngleDelta * offshoot + item.xc_offshootBaseAngle).asRel(); } xc4_chargeGauge.x10_rotAng = - zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot + xc4_chargeGauge.xc_offshootBaseAngle). - asRel(); + zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot + xc4_chargeGauge.xc_offshootBaseAngle) + .asRel(); } } if (x208_lockonTimer > 0.f && x208_lockonTimer < g_tweakTargeting->GetLockonDuration()) @@ -670,13 +721,13 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager if (x1fc_missileBracketScaleTimer > 0.f) x1fc_missileBracketScaleTimer = std::max(0.f, x1fc_missileBracketScaleTimer - dt); if (x20_prevState == EReticleState::Scan && x456_ != kInvalidUniqueId) - x404_ = std::min(1.f, x404_ + (dt / g_tweakTargeting->x360_)); + x404_ = std::min(1.f, x404_ + dt / g_tweakTargeting->x360_); else - x404_ = std::max(0.f, x404_ - (dt / g_tweakTargeting->x360_)); + x404_ = std::max(0.f, x404_ - dt / g_tweakTargeting->x360_); if (mgr.GetPlayer().GetScanningObjectId() == kInvalidUniqueId) - x214_ = std::min(1.f, x214_ + (dt * 4.f)); + x214_ = std::min(1.f, x214_ + dt * 4.f); else - x214_ = std::max(0.f, x214_ - (dt * 4.f)); + x214_ = std::max(0.f, x214_ - dt * 4.f); } void CCompoundTargetReticle::UpdateNextLockOnGroup(float dt, const CStateManager& mgr) { @@ -734,101 +785,98 @@ void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) con SCOPED_GRAPHICS_DEBUG_GROUP("CCompoundTargetReticle::Draw", zeus::skCyan); zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); CGraphics::SetViewPointMatrix(camXf); + CGraphics::SetCullMode(ERglCullMode::None); if (!hideLockon) { - DrawNewGroup1(camXf.basis, mgr); - DrawNewGroup2(camXf.basis, mgr); -// DrawCurrLockOnGroup(camXf.basis, mgr); -// DrawNextLockOnGroup(camXf.basis, mgr); + DrawNextLockOnGroupRS5(camXf.basis, mgr); + DrawCurrLockOnGroupRS5(camXf.basis, mgr); + // DrawCurrLockOnGroup(camXf.basis, mgr); + // DrawNextLockOnGroup(camXf.basis, mgr); DrawOrbitZoneGroup(camXf.basis, mgr); } DrawGrappleGroup(camXf.basis, mgr, hideLockon); + CGraphics::SetCullMode(ERglCullMode::Front); } if (x28_noDrawTicks > 0) --x28_noDrawTicks; } -void CCompoundTargetReticle::DrawNewGroup1(const zeus::CMatrix3f& rot, const CStateManager& mgr) const { - if (x2a0_ > 0) { +void CCompoundTargetReticle::DrawNextLockOnGroupRS5(const zeus::CMatrix3f& rot, const CStateManager& mgr) const { + if (x2a0_nextTargetOrbitLockAlpha > 0) { for (int i = 0; i < 3; i++) { - zeus::CTransform transform_184(zeus::CMatrix3f(), x2a4_); - zeus::CMatrix3f mat3f_220 = zeus::CMatrix3f::RotateY(x28c_ + zeus::degToRad(120.f * i)); - zeus::CMatrix3f mat3f_704 = mat3f_220 * zeus::CMatrix3f(x290_); - zeus::CTransform transform_304(mat3f_704 /*, zeus::skZero3f*/); - zeus::CTransform transform_352(rot, x280_); - zeus::CTransform transform_752 = transform_352 * transform_304; - zeus::CTransform transform_400 = transform_752 * transform_184; - CGraphics::SetModelMatrix(transform_400); + const zeus::CTransform origin = zeus::CTransform(rot, x280_nextTargetOrbitLockOrigin); + const zeus::CTransform transform = + zeus::CMatrix3f::RotateY(x28c_orbitLockArmRotation + zeus::degToRad(120.f * i)) * + zeus::CMatrix3f(x290_uiScale); + CGraphics::SetModelMatrix(origin * transform * zeus::CTransform::Translate(x2a4_uiPositionOffset)); - zeus::CColor color = x29c_; - color.a() = x2a0_; + zeus::CColor color = x29c_nextTargetOrbitLockColor; + color.a() *= std::max(0.25f, x2a0_nextTargetOrbitLockAlpha); CModelFlags flags(5, 0, 0, color); x3a4_orbitLockArm->Draw(flags); } } - if (x350_ > 0) { + if (x350_nextGrappleOrbitLockAlpha > 0) { for (int i = 0; i < 3; i++) { - zeus::CTransform transform_184(zeus::CMatrix3f(), x2a4_); - zeus::CMatrix3f mat3f_220 = zeus::CMatrix3f::RotateY(x28c_ + zeus::degToRad(120.f * i)); - zeus::CMatrix3f mat3f_704 = mat3f_220 * zeus::CMatrix3f(x290_); - zeus::CTransform transform_304(mat3f_704 /*, zeus::skZero3f*/); - zeus::CTransform transform_352(rot, x2f2_); - zeus::CTransform transform_752 = transform_352 * transform_304; - zeus::CTransform transform_400 = transform_752 * transform_184; - CGraphics::SetModelMatrix(transform_400); + const zeus::CTransform origin = zeus::CTransform(rot, x2f2_orbitLockOrigin); + const zeus::CTransform transform = + zeus::CMatrix3f::RotateY(x28c_orbitLockArmRotation + zeus::degToRad(120.f * i)) * + zeus::CMatrix3f(x290_uiScale); + CGraphics::SetModelMatrix(origin * transform * zeus::CTransform::Translate(x2a4_uiPositionOffset)); - zeus::CColor color = g_tweakTargeting->x2d0_; - color.a() = x350_; + zeus::CColor color = g_tweakTargeting->x2d0_orbitLockArmColor; + color.a() *= std::max(0.25f, x350_nextGrappleOrbitLockAlpha); CModelFlags flags(5, 0, 0, color); x3a4_orbitLockArm->Draw(flags); } } } -void CCompoundTargetReticle::DrawNewGroup2(const zeus::CMatrix3f& rot, const CStateManager& mgr) const { - if (x2f0_ != kInvalidUniqueId && x304_ > 0) { +void CCompoundTargetReticle::DrawCurrLockOnGroupRS5(const zeus::CMatrix3f& rot, const CStateManager& mgr) const { + if (x2f0_ != kInvalidUniqueId && x304_orbitLockArmAlpha > 0) { for (int i = 0; i < 3; i++) { - zeus::CTransform transform_192(zeus::CMatrix3f(), x2a4_); - zeus::CMatrix3f mat3f_228 = zeus::CMatrix3f::RotateY(zeus::degToRad(120.f * i)); - zeus::CMatrix3f mat3f_1016 = mat3f_228 * zeus::CMatrix3f(x290_); - zeus::CTransform transform_360(rot, x2f2_); - zeus::CTransform transform_1064 = transform_360 * mat3f_1016; - zeus::CTransform transform_408 = transform_1064 * transform_192; - CGraphics::SetModelMatrix(transform_408); + const zeus::CTransform origin(rot, x2f2_orbitLockOrigin); + const zeus::CMatrix3f rotation = zeus::CMatrix3f::RotateY(zeus::degToRad(120.f * i)); + const zeus::CTransform transform(rotation * zeus::CMatrix3f(x290_uiScale)); + CGraphics::SetModelMatrix(origin * transform * zeus::CTransform::Translate(x2a4_uiPositionOffset)); - zeus::CColor color = x300_; - color.a() = x304_; + zeus::CColor color = x300_orbitLockArmColor; + color.a() *= x304_orbitLockArmAlpha; CModelFlags flags(5, 0, 0, color); x3a4_orbitLockArm->Draw(flags); - zeus::CTransform transform_496(mat3f_228 * zeus::CMatrix3f(x328_)); - zeus::CTransform transform_544 = transform_360 * transform_496; - CGraphics::SetModelMatrix(transform_544); + const zeus::CTransform baseTransform(rotation * zeus::CMatrix3f(x328_orbitLockBaseScale)); + CGraphics::SetModelMatrix(origin * baseTransform); zeus::CColor baseColor = x308_orbitLockBaseColor; - baseColor.a() = x30c_orbitLockBaseAlpha; + baseColor.a() *= std::max(0.25f, x30c_orbitLockBaseAlpha); CModelFlags baseFlags(5, 0, 0, baseColor); x3c8_orbitLockBase->Draw(baseFlags); } - zeus::CTransform transform_644(zeus::CMatrix3f::RotateY(x338_) * zeus::CMatrix3f(x290_)); - zeus::CTransform transform_712(rot, x2f2_); - CGraphics::SetModelMatrix(transform_712 * transform_644); - // thunk_FUN_802fe1e0(7,0,0,7,0); ?? + { + const zeus::CTransform origin(rot, x2f2_orbitLockOrigin); + const zeus::CTransform transform(zeus::CMatrix3f::RotateY(x338_orbitLockBracketsRotation) * + zeus::CMatrix3f(x290_uiScale)); + CGraphics::SetModelMatrix(origin * transform); + CGraphics::SetAlphaCompare(ERglAlphaFunc::Always, 0, ERglAlphaOp::And, ERglAlphaFunc::Always, 0); - zeus::CColor bracketsColor = x308_orbitLockBaseColor; - bracketsColor.a() = x334_; - CModelFlags bracketsFlags(5, 0, 0, bracketsColor); - x3bc_orbitLockBrackets->Draw(bracketsFlags); + zeus::CColor bracketsColor = x308_orbitLockBaseColor; + bracketsColor.a() *= std::max(0.25f, x334_); + CModelFlags bracketsFlags(5, 0, 0, bracketsColor); + x3bc_orbitLockBrackets->Draw(bracketsFlags); + } - if (x340_ > 0) { - zeus::CTransform transform_880(zeus::CMatrix3f::RotateY(x334_) * zeus::CMatrix3f(x290_)); - zeus::CTransform transform_928(rot, x2f2_); - CGraphics::SetModelMatrix(transform_928 * transform_880); - // thunk_FUN_802fe1e0(7,0,0,7,0); ?? + if (x340_orbitLockTechScrollTime > 0) { + const zeus::CTransform origin(rot, x2f2_orbitLockOrigin); + const zeus::CTransform transform(zeus::CMatrix3f::RotateY(x344_orbitLockTechRotation) * + zeus::CMatrix3f(x290_uiScale)); + CTimeProvider prov(x340_orbitLockTechScrollTime); + CGraphics::SetModelMatrix(origin * transform); + CGraphics::SetAlphaCompare(ERglAlphaFunc::Always, 0, ERglAlphaOp::And, ERglAlphaFunc::Always, 0); zeus::CColor techColor = x308_orbitLockBaseColor; - techColor.a() = x30c_orbitLockBaseAlpha; + techColor.a() *= std::max(0.25f, x30c_orbitLockBaseAlpha); CModelFlags techFlags(5, 0, 0, techColor); x3b0_orbitLockTech->Draw(techFlags); } @@ -1348,20 +1396,6 @@ void CCompoundTargetReticle::Touch() { xb8_thermalReticle->Touch(0); if (xc4_chargeGauge.x0_model.IsLoaded()) xc4_chargeGauge.x0_model->Touch(0); - if (x38c_combatAimingCenter.IsLoaded()) - x38c_combatAimingCenter->Touch(0); - if (x398_combatAimingArm.IsLoaded()) - x398_combatAimingArm->Touch(0); - if (x3a4_orbitLockArm.IsLoaded()) - x3a4_orbitLockArm->Touch(0); - if (x3b0_orbitLockTech.IsLoaded()) - x3b0_orbitLockTech->Touch(0); - if (x3bc_orbitLockBrackets.IsLoaded()) - x3bc_orbitLockBrackets->Touch(0); - if (x3c8_orbitLockBase.IsLoaded()) - x3c8_orbitLockBase->Touch(0); - if (x3d4_offScreen.IsLoaded()) - x3d4_offScreen->Touch(0); if (x3e0_scanReticleRing.IsLoaded()) x3e0_scanReticleRing->Touch(0); if (x3ec_scanReticleBracket.IsLoaded()) diff --git a/Runtime/GuiSys/CCompoundTargetReticle.hpp b/Runtime/GuiSys/CCompoundTargetReticle.hpp index 754cecc6e..4997075d5 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.hpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.hpp @@ -142,40 +142,40 @@ private: zeus::CVector3f x268_ = zeus::skZero3f; float x274_ = 1.f; float x278_ = 1.f; - TUniqueId x27c_ = kInvalidUniqueId; - zeus::CVector3f x280_ = zeus::skZero3f; - float x28c_ = 0.f; - zeus::CVector3f x290_ = zeus::skOne3f; - zeus::CColor x29c_ = zeus::skGreen; - float x2a0_ = 0.f; - zeus::CVector3f x2a4_ = zeus::skZero3f; + TUniqueId x27c_nextTargetId = kInvalidUniqueId; + zeus::CVector3f x280_nextTargetOrbitLockOrigin = zeus::skZero3f; + float x28c_orbitLockArmRotation = 0.f; + zeus::CVector3f x290_uiScale = zeus::skOne3f; + zeus::CColor x29c_nextTargetOrbitLockColor = zeus::skGreen; + float x2a0_nextTargetOrbitLockAlpha = 0.f; + zeus::CVector3f x2a4_uiPositionOffset = zeus::skZero3f; float x2b0_ = 0.f; - zeus::CVector3f x2b4_ = zeus::skZero3f; - zeus::CVector3f x2c0_ = zeus::skZero3f; - bool x2cc_ = false; - float x2d0_ = 0.f; - float x2d4_ = 0.f; - zeus::CVector3f x2d8_ = zeus::skZero3f; - zeus::CVector3f x2e4_ = zeus::skZero3f; + zeus::CVector3f x2b4_nextTargetOrbitPosition = zeus::skZero3f; + zeus::CVector3f x2c0_orbitLockArmNextOrigin = zeus::skZero3f; + bool x2cc_orbitLockArmFading = false; + float x2d0_orbitLockArmFadeAmt = 0.f; + float x2d4_orbitLockArmFadeDt = 0.f; + zeus::CVector3f x2d8_orbitLockArm1Origin = zeus::skZero3f; + zeus::CVector3f x2e4_orbitLockArmFadeOrigin = zeus::skZero3f; TUniqueId x2f0_ = kInvalidUniqueId; - zeus::CVector3f x2f2_ = zeus::skZero3f; - zeus::CColor x300_ = zeus::skGreen; - float x304_ = 1.f; + zeus::CVector3f x2f2_orbitLockOrigin = zeus::skZero3f; + zeus::CColor x300_orbitLockArmColor = zeus::skGreen; + float x304_orbitLockArmAlpha = 1.f; zeus::CColor x308_orbitLockBaseColor = zeus::skGreen; float x30c_orbitLockBaseAlpha = 1.f; float x310_ = 0.f; float x314_ = 0.f; zeus::CVector3f x318_ = zeus::skZero3f; float x324_ = 0.f; - zeus::CVector3f x328_ = zeus::skOne3f; + zeus::CVector3f x328_orbitLockBaseScale = zeus::skOne3f; float x334_ = 0.f; - float x338_ = 0.f; - float x33c_angle_ = 0.f; - float x340_ = 0.f; - float x344_ = 0.f; - float x348_inverse_angle_ = 0.f; + float x338_orbitLockBracketsRotation = 0.f; + float x33c_prevPlayerAngle = 0.f; + float x340_orbitLockTechScrollTime = 0.f; + float x344_orbitLockTechRotation = 0.f; + float x348_playerAngle = 0.f; bool x34c_ = false; - float x350_ = 0.f; + float x350_nextGrappleOrbitLockAlpha = 0.f; zeus::CVector3f x354_ = zeus::skZero3f; zeus::CVector3f x360_ = zeus::skOne3f; zeus::CColor x36c_lerped_color_ = zeus::skWhite; @@ -199,6 +199,12 @@ private: TCachedToken x3f8_scanReticleProgress; float x404_; + zeus::CVector3f x410_ = zeus::skZero3f; + zeus::CVector3f x41c_ = zeus::skZero3f; + zeus::CVector3f x428_ = zeus::skZero3f; + zeus::CVector3f x434_ = zeus::skZero3f; + int x440_ = 0; + std::array x444_; TUniqueId x456_ = kInvalidUniqueId; struct SScanReticuleRenderer { @@ -218,17 +224,18 @@ public: bool CheckLoadComplete() { return true; } EReticleState GetDesiredReticleState(const CStateManager&) const; void Update(float, const CStateManager&); - void UpdateNewGroup1(float, const CStateManager&); - void UpdateNewGroup2(float, const CStateManager&); + void UpdateNextLockOnGroupRS5(float dt, const CStateManager& mgr); + void UpdateCurrLockOnGroupRS5(float dt, const CStateManager& mgr); void UpdateNewGroup3(float, const CStateManager&); void UpdateNewGroup4(float, const CStateManager&); void UpdateNewGroup5(float, const CStateManager&); + void UpdateNewGroup6(float, const CStateManager&); void UpdateCurrLockOnGroup(float, const CStateManager&); void UpdateNextLockOnGroup(float, const CStateManager&); void UpdateOrbitZoneGroup(float, const CStateManager&); void Draw(const CStateManager&, bool hideLockon) const; - void DrawNewGroup1(const zeus::CMatrix3f& rot, const CStateManager&) const; - void DrawNewGroup2(const zeus::CMatrix3f& rot, const CStateManager&) const; + void DrawNextLockOnGroupRS5(const zeus::CMatrix3f& rot, const CStateManager& mgr) const; + void DrawCurrLockOnGroupRS5(const zeus::CMatrix3f& rot, const CStateManager& mgr) const; void DrawNewGroup3(const zeus::CMatrix3f& rot, const CStateManager&) const; void DrawNewGroup4(const zeus::CMatrix3f& rot, const CStateManager&) const; void DrawNewGroup5(const zeus::CMatrix3f& rot, const CStateManager&) const; diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index a49e1f56c..1ff9a79cd 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -352,7 +352,7 @@ void CMain::AddOverridePaks() { // Trilogy override pak // TODO check how it's actually loaded if (CDvdFile::FileExists("RS5.upak")) - loader->AddPakFileAsync("RS5", false, false, true); + loader->AddPakFile("RS5", false, false, true); /* Inversely load each pak starting at 999, to ensure proper priority order * the higher the number the higer the priority, e.g: Override0 has less priority than Override1 etc. diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index 7cff51a7f..7132df9a2 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -4,6 +4,8 @@ #include #include +#include "Runtime/CUnknownPlayerState1.hpp" +#include "Runtime/CUnknownPlayerState2.hpp" #include "Runtime/Weapon/CPlayerGun.hpp" #include "Runtime/Weapon/CWeaponMgr.hpp" #include "Runtime/World/CMorphBall.hpp" @@ -34,6 +36,8 @@ class CPlayer : public CPhysicsActor { friend class CMorphBall; friend class CPlayerCameraBob; friend class CStateManager; + friend class CUnknownPlayerState1; + friend class CUnknownPlayerState2; public: enum class EPlayerScanState { NotScanning, Scanning, ScanComplete }; @@ -352,10 +356,12 @@ private: float GetAcceleration() const; float CalculateOrbitMinDistance(EPlayerOrbitType type) const; + // RS5 + CUnknownPlayerState1 xa40_unkPlayerState1 = CUnknownPlayerState1(0.175f); + CUnknownPlayerState2 xeb8_unkPlayerState2 = CUnknownPlayerState2(0, 0); + public: // RS5 - // CUnknownPlayerState1 - // CUnknownPlayerState2 float x1180_ = 0.f; float x1184_ = 0.f; union { @@ -648,5 +654,7 @@ public: const zeus::CVector3f& GetOrbitPoint() const { return x314_orbitPoint; } float GetAverageSpeed() const; bool IsInWaterMovement() const { return x9c4_31_inWaterMovement; } + const CUnknownPlayerState1& GetUnknownPlayerState1() const { return xa40_unkPlayerState1; } + const CUnknownPlayerState2& GetUnknownPlayerState2() const { return xeb8_unkPlayerState2; } }; } // namespace urde