diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp index 85a9a8636..fbc902d3d 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp @@ -21,6 +21,9 @@ struct ITweakPlayerRes : ITweak { ResId x18_minesBreakSecondTopIcon; ResId x1c_minesBreakSecondBottomIcon; + ResId rs5_mapArrowUp; + ResId rs5_mapArrowDown; + /* N, U, UL, L, DL, D, DR, R, UR */ std::array x24_lStick; std::array x4c_cStick; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp index bf0370606..199d494b6 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp @@ -16,6 +16,9 @@ struct CTweakPlayerRes final : ITweakPlayerRes { String<-1> m_minesBreakSecondTopIcon; String<-1> m_minesBreakSecondBottomIcon; + String<-1> m_mapArrowUp; + String<-1> m_mapArrowDown; + String<-1> m_lStickN; String<-1> m_lStickU; String<-1> m_lStickUL; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index 8c4c68db1..550f7dd97 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -132,6 +132,69 @@ struct CTweakTargeting final : public ITweakTargeting { Value x220_scanTargetClampMax; Value x224_angularLagSpeed; + // RS5 + Value x218_; + Value x21c_; + bool x224_ = true; + bool x225_ = false; + bool x226_ = true; + bool x227_ = true; + bool x22c_ = true; + bool x22d_ = false; + bool x22e_ = true; + bool x22f_ = true; + bool x234_ = true; + bool x235_ = false; + bool x236_ = true; + bool x237_ = true; + zeus::CVector3f x23c_ = zeus::skZero3f; + + float x2c8_ = 0.25f; + float x2cc_ = 0.35f; + zeus::CColor x2d0_ = (zeus::Comp32) 0xb6e6ffff; + float x2d4_ = 0.39215687f; + zeus::CColor x2d8_ = (zeus::Comp32) 0xa82a00ff; + float x2dc_ = 0.78431374f; + zeus::CVector3f x2e0_ = zeus::CVector3f(0.f, 0.f, 0.46f); + float x2ec_ = 0.25f; + float x2f0_ = 0.25f; + float x2f4_ = 120.f; + float x2f8_ = 0.25f; + float x2fc_ = 3.5f; + float x300_ = 0.35f; + zeus::CColor x304_ = (zeus::Comp32) 0xa82a00ff; + float x308_ = 0.78431374f; + 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; + float x324_ = 0.78431374f; + zeus::CColor x328_ = (zeus::Comp32) 0x89d6ffff; + float x32c_ = 0.19607843f; + float x330_ = 0.f; + float x334_ = 0.25f; + float x338_ = 3.f; + float x33c_ = 0.25f; + float x340_ = 0.25f; + float x344_ = 0.25f; + float x348_ = 0.25f; + float x34c_ = 45.f; + float x350_ = 0.5f; + float x354_ = 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; + CTweakTargeting() = default; CTweakTargeting(athena::io::IStreamReader& r) { this->read(r); diff --git a/Runtime/CResLoader.cpp b/Runtime/CResLoader.cpp index 075e8288b..802b305d9 100644 --- a/Runtime/CResLoader.cpp +++ b/Runtime/CResLoader.cpp @@ -25,8 +25,8 @@ void CResLoader::AddPakFileAsync(std::string_view name, bool buildDepList, bool } } -void CResLoader::AddPakFile(std::string_view name, bool samusPak, bool worldPak, bool override) { - AddPakFileAsync(name, samusPak, worldPak, override); +void CResLoader::AddPakFile(std::string_view name, bool buildDepList, bool worldPak, bool override) { + AddPakFileAsync(name, buildDepList, worldPak, override); WaitForPakFileLoadingComplete(); } diff --git a/Runtime/GuiSys/CCompoundTargetReticle.cpp b/Runtime/GuiSys/CCompoundTargetReticle.cpp index 956a653fd..ff25ef640 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.cpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.cpp @@ -30,6 +30,17 @@ constexpr char skGrappleReticleAssetName[] = "CMDL_Grapple"; constexpr char skXRayRingModelName[] = "CMDL_XRayRetRing"; constexpr char skThermalReticleAssetName[] = "CMDL_ThermalRet"; [[maybe_unused]] constexpr char skOrbitPointAssetName[] = "CMDL_OrbitPoint"; +// RS5 +constexpr char skCombatAimingCenter[] = "CMDL_CombatAimingCenter"; +constexpr char skCombatAimingArm[] = "CMDL_CombatAimingArm"; +constexpr char skOrbitLockArm[] = "CMDL_OrbitLockArm"; +constexpr char skOrbitLockTech[] = "CMDL_OrbitLockTech"; +constexpr char skOrbitLockBrackets[] = "CMDL_OrbitLockBrackets"; +constexpr char skOrbitLockBase[] = "CMDL_OrbitLockBase"; +constexpr char skOffScreen[] = "CMDL_OffScreen"; +constexpr char skScanReticleRing[] = "CMDL_ScanReticleRing"; +constexpr char skScanReticleBracket[] = "CMDL_ScanReticleBracket"; +constexpr char skScanReticleProgress[] = "CMDL_ScanReticleProgress"; float offshoot_func(float f1, float f2, float f3) { return (f1 * 0.5f) + std::sin((f3 - 0.5f) * f2); } @@ -62,7 +73,17 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr) , xc4_chargeGauge(skChargeGaugeAssetName) , xf4_targetPos(CalculateOrbitZoneReticlePosition(mgr, false)) , x100_laggingTargetPos(CalculateOrbitZoneReticlePosition(mgr, true)) -, x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) { +, x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) +, x38c_combatAimingCenter(g_SimplePool->GetObj(skCombatAimingCenter)) +, x398_combatAimingArm(g_SimplePool->GetObj(skCombatAimingArm)) +, x3a4_orbitLockArm(g_SimplePool->GetObj(skOrbitLockArm)) +, x3b0_orbitLockTech(g_SimplePool->GetObj(skOrbitLockTech)) +, x3bc_orbitLockBrackets(g_SimplePool->GetObj(skOrbitLockBrackets)) +, x3c8_orbitLockBase(g_SimplePool->GetObj(skOrbitLockBase)) +, x3d4_offScreen(g_SimplePool->GetObj(skOffScreen)) +, x3e0_scanReticleRing(g_SimplePool->GetObj(skScanReticleRing)) +, x3ec_scanReticleBracket(g_SimplePool->GetObj(skScanReticleBracket)) +, x3f8_scanReticleProgress(g_SimplePool->GetObj(skScanReticleProgress)) { xe0_outerBeamIconSquares.reserve(9); for (u32 i = 0; i < 9; ++i) xe0_outerBeamIconSquares.emplace_back(fmt::format(fmt("{}{}"), skOuterBeamIconSquareNameBase, i)); @@ -105,6 +126,10 @@ 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 UpdateCurrLockOnGroup(dt, mgr); UpdateNextLockOnGroup(dt, mgr); UpdateOrbitZoneGroup(dt, mgr); @@ -310,6 +335,270 @@ static bool IsDamageOrbit(CPlayer::EPlayerOrbitRequest req) { } } +void CCompoundTargetReticle::UpdateNewGroup1(float dt, const class CStateManager& mgr) { + CPlayer& player = mgr.GetPlayer(); + TUniqueId nextTargetId = player.GetOrbitNextTargetId(); + + x2a4_ = g_tweakTargeting->x2e0_; + x290_ = zeus::CVector3f(g_tweakTargeting->x2cc_); + if (nextTargetId != kInvalidUniqueId) + x29c_ = g_tweakTargeting->x2d0_; + + if (auto act = TCastToConstPtr(mgr.GetObjectById(nextTargetId))) + x2b4_ = act->GetOrbitPosition(mgr); + else + x2b4_ = x2c0_; + + 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; + + if (nextTargetId != kInvalidUniqueId && x27c_ != nextTargetId) { + if (x2a0_ == 0.f) { + x2e4_ = final; + } else { + x2e4_ = x2c0_; + x2cc_ = true; + x2d0_ = g_tweakTargeting->x2f0_; + x2d4_ = 0.f; + } + } + + float dVar19 = g_tweakTargeting->x2d4_; + float dVar18 = dt * (dVar19 / 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; + } 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; + } + + if (!x2cc_ || x2d0_ <= 0.f) { + x280_ = x2d8_; + x2c0_ = x2b4_; + } 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_; + } else { + const zeus::CVector3f origin = (x2e4_ - cameraTransform.origin).normalized(); + float dot2 = 1.25f / origin.dot(vec1); + const zeus::CVector3f vec = (origin * dot2) + cameraOrigin; + + float div = x2d4_ / x2d0_; + float oneMinusDiv = 1.f - div; + const zeus::CVector3f vec2 = (vec * oneMinusDiv) + (x2d8_ * div); + x280_ = vec2; + + const zeus::CVector3f vec3 = (vec2 - cameraOrigin).normalized(); + float mag = (x2b4_ - cameraOrigin).magnitude(); + x2c0_ = cameraOrigin + (vec3 * mag); + } + } + + x27c_ = nextTargetId; + x28c_ = x28c_ + zeus::degToRad(dt * g_tweakTargeting->x2f4_); +} + +void CCompoundTargetReticle::UpdateNewGroup2(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 currPoint = mgr.GetObjectById(targetId); + bVar1 = currPoint.operator bool(); + if (!prevPoint) { + x27c_ = kInvalidUniqueId; + x2a0_ = 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; + + bool bVar11 = false; + auto uVar14 = ((u32)kInvalidUniqueId.id) - ((u32)targetId.id) | ((u32)targetId.id) - ((u32)kInvalidUniqueId.id); + if (((s32) uVar14) > -1 && player.x1188_) { // < 0 + bVar11 = true; + } + + if (targetId == kInvalidUniqueId || targetId != x2f0_) { + if (targetId == kInvalidUniqueId && x2f0_ != kInvalidUniqueId) { + if (bVar11) { + TCastToConstPtr point = mgr.GetObjectById(x2f0_); + if (x20_prevState == EReticleState::Combat && !point.operator bool()) { + x350_ = 1.f; + } + } + } else { + x324_ = 0.f; + } + } else { + x324_ += dt; + } + + x300_ = g_tweakTargeting->x2d8_; + zeus::CColor _1d4 = g_tweakTargeting->x304_; + if (IsGrappleTarget(targetId, mgr)) { + x300_ = g_tweakTargeting->x320_; + _1d4 = g_tweakTargeting->x320_; + } + + if (((s32) uVar14) < 0) { + 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_); + } + } + + 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); + } + fVar4 = x350_ - fVar4; + fVar3 = 0.f; + if (0.f - fVar4 <= 0.f) { + fVar3 = fVar4; + } + if (fVar2 <= 0.f) { + fVar2 = fVar3; + } + x350_ = fVar2; + + 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; + + 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_); + + 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); + + 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; + } 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; + } + + if (dVar30 < 1.f) { + x338_ = 0.f; + } else { + x338_ = x338_ + (out - x33c_angle_); + } + 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; + + if (x20_prevState != EReticleState::Combat && x20_prevState != EReticleState::Unspecified) { + bVar1 = true; + x374_ = 0.f; + } + if (bVar1) { + x304_ = 0.f; + } else { + float g = g_tweakTargeting->x2dc_; + float f3 = 1.f; + if (0.f < g_tweakTargeting->x2fc_) { + f3 = (dt * (g / g_tweakTargeting->x2fc_)); + } + if (x324_ < g_tweakTargeting->x2f8_) { + x304_ = g; + } else { + float f4 = g_tweakTargeting->x300_; + if (f4 <= 0.f) { + f4 = x304_ - f3; + } + if (g <= 0.f) { + g = f4; + } + x304_ = g; + } + } + x34c_ = bVar11; + x2f0_ = targetId; +} + void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager& mgr) { TUniqueId targetId = mgr.GetPlayer().GetOrbitTargetId(); if (targetId != xf0_targetId) { @@ -380,6 +669,14 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager x210_lockFireTimer = std::max(0.f, x210_lockFireTimer - dt); 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_)); + else + x404_ = std::max(0.f, x404_ - (dt / g_tweakTargeting->x360_)); + if (mgr.GetPlayer().GetScanningObjectId() == kInvalidUniqueId) + x214_ = std::min(1.f, x214_ + (dt * 4.f)); + else + x214_ = std::max(0.f, x214_ - (dt * 4.f)); } void CCompoundTargetReticle::UpdateNextLockOnGroup(float dt, const CStateManager& mgr) { @@ -438,8 +735,10 @@ void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) con zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr); CGraphics::SetViewPointMatrix(camXf); if (!hideLockon) { - DrawCurrLockOnGroup(camXf.basis, mgr); - DrawNextLockOnGroup(camXf.basis, mgr); + DrawNewGroup1(camXf.basis, mgr); + DrawNewGroup2(camXf.basis, mgr); +// DrawCurrLockOnGroup(camXf.basis, mgr); +// DrawNextLockOnGroup(camXf.basis, mgr); DrawOrbitZoneGroup(camXf.basis, mgr); } DrawGrappleGroup(camXf.basis, mgr, hideLockon); @@ -448,6 +747,94 @@ void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) con --x28_noDrawTicks; } +void CCompoundTargetReticle::DrawNewGroup1(const zeus::CMatrix3f& rot, const CStateManager& mgr) const { + if (x2a0_ > 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); + + zeus::CColor color = x29c_; + color.a() = x2a0_; + CModelFlags flags(5, 0, 0, color); + x3a4_orbitLockArm->Draw(flags); + } + } + + if (x350_ > 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); + + zeus::CColor color = g_tweakTargeting->x2d0_; + color.a() = x350_; + 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) { + 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); + + zeus::CColor color = x300_; + color.a() = x304_; + 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); + + zeus::CColor baseColor = x308_orbitLockBaseColor; + baseColor.a() = 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); ?? + + zeus::CColor bracketsColor = x308_orbitLockBaseColor; + bracketsColor.a() = 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); ?? + + zeus::CColor techColor = x308_orbitLockBaseColor; + techColor.a() = x30c_orbitLockBaseAlpha; + CModelFlags techFlags(5, 0, 0, techColor); + x3b0_orbitLockTech->Draw(techFlags); + } + } +} + void CCompoundTargetReticle::DrawGrapplePoint(const CScriptGrapplePoint& point, float t, const CStateManager& mgr, const zeus::CMatrix3f& rot, bool zEqual) const { zeus::CVector3f orbitPos = point.GetOrbitPosition(mgr); @@ -918,7 +1305,8 @@ zeus::CVector3f CCompoundTargetReticle::CalculateOrbitZoneReticlePosition(const } bool CCompoundTargetReticle::IsGrappleTarget(TUniqueId uid, const CStateManager& mgr) const { - return TCastToConstPtr(mgr.GetAllObjectList().GetObjectById(uid)).operator bool(); + const TCastToConstPtr& ptr = TCastToConstPtr(mgr.GetObjectById(uid)); + return ptr.operator bool() && ptr->GetActive(); } float CCompoundTargetReticle::CalculateClampedScale(const zeus::CVector3f& pos, float scale, float clampMin, @@ -960,6 +1348,26 @@ 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()) + x3ec_scanReticleBracket->Touch(0); + if (x3f8_scanReticleProgress.IsLoaded()) + x3f8_scanReticleProgress->Touch(0); for (SOuterItemInfo& info : xe0_outerBeamIconSquares) if (info.x0_model.IsLoaded()) info.x0_model->Touch(0); diff --git a/Runtime/GuiSys/CCompoundTargetReticle.hpp b/Runtime/GuiSys/CCompoundTargetReticle.hpp index 06a6987a5..754cecc6e 100644 --- a/Runtime/GuiSys/CCompoundTargetReticle.hpp +++ b/Runtime/GuiSys/CCompoundTargetReticle.hpp @@ -119,10 +119,87 @@ private: bool x218_beamShot = false; bool x219_missileShot = false; bool x21a_fullyCharged = false; - u8 x21b_ = 0; - u32 x21c_; - u32 x220_; - u32 x228_; + // u8 x21b_ = 0; + // u32 x21c_; + // u32 x220_; + // u32 x228_; + + // RS5 + float x214_ = 0.f; + float x21c_ = 0.f; + float x220_ = 0.f; + float x224_ = 0.f; + zeus::CVector3f x228_ = zeus::skZero3f; + zeus::CVector3f x234_ = zeus::skZero3f; + zeus::CVector3f x240_ = zeus::skZero3f; + float x24c_ = 0.f; + float x250_ = 1.f; + zeus::CColor x254_ = zeus::skPurple; + float x258_ = 1.f; + zeus::CColor x25c_ = zeus::skPurple; + float x260_ = 1.f; + float x264_ = 0.f; + 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; + 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; + TUniqueId x2f0_ = kInvalidUniqueId; + zeus::CVector3f x2f2_ = zeus::skZero3f; + zeus::CColor x300_ = zeus::skGreen; + float x304_ = 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; + 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; + bool x34c_ = false; + float x350_ = 0.f; + zeus::CVector3f x354_ = zeus::skZero3f; + zeus::CVector3f x360_ = zeus::skOne3f; + zeus::CColor x36c_lerped_color_ = zeus::skWhite; + float x370_ = 1.f; + float x374_ = 0.f; + float x378_ = 0.f; + float x37c_ = 0.f; + float x380_ = 0.f; + float x384_ = 0.f; + u32 x388_ = 0; + + TCachedToken x38c_combatAimingCenter; + TCachedToken x398_combatAimingArm; + TCachedToken x3a4_orbitLockArm; + TCachedToken x3b0_orbitLockTech; + TCachedToken x3bc_orbitLockBrackets; + TCachedToken x3c8_orbitLockBase; + TCachedToken x3d4_offScreen; + TCachedToken x3e0_scanReticleRing; + TCachedToken x3ec_scanReticleBracket; + TCachedToken x3f8_scanReticleProgress; + + float x404_; + TUniqueId x456_ = kInvalidUniqueId; struct SScanReticuleRenderer { std::optional m_lineRenderers[2]; @@ -141,14 +218,24 @@ 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 UpdateNewGroup3(float, const CStateManager&); + void UpdateNewGroup4(float, const CStateManager&); + void UpdateNewGroup5(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 DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager&, bool) const; + void DrawNewGroup1(const zeus::CMatrix3f& rot, const CStateManager&) const; + void DrawNewGroup2(const zeus::CMatrix3f& rot, const CStateManager&) 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; void DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&) const; void DrawNextLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager&) const; void DrawOrbitZoneGroup(const zeus::CMatrix3f& rot, const CStateManager&) const; + void DrawGrappleGroup(const zeus::CMatrix3f& rot, const CStateManager&, bool) const; void UpdateTargetParameters(CTargetReticleRenderState&, const CStateManager&); float CalculateRadiusWorld(const CActor&, const CStateManager&) const; zeus::CVector3f CalculatePositionWorld(const CActor&, const CStateManager&) const; diff --git a/Runtime/MP1/CInGameGuiManager.cpp b/Runtime/MP1/CInGameGuiManager.cpp index 561c98e72..628b068bc 100644 --- a/Runtime/MP1/CInGameGuiManager.cpp +++ b/Runtime/MP1/CInGameGuiManager.cpp @@ -423,8 +423,7 @@ bool CInGameGuiManager::IsInPausedStateNotTransitioning() const { x1c0_nextState >= EInGameGuiState::MapScreen && x1c0_nextState <= EInGameGuiState::PauseHUDMessage); } -void CInGameGuiManager::ProcessControllerInput(CStateManager& stateMgr, const CFinalInput& input, - CArchitectureQueue& archQueue) { +void CInGameGuiManager::ProcessControllerInput(CStateManager& stateMgr, const CFinalInput& input) { if (input.ControllerIdx() == 0) { if (!IsInGameStateNotTransitioning()) { if (IsInPausedStateNotTransitioning()) { diff --git a/Runtime/MP1/CInGameGuiManager.hpp b/Runtime/MP1/CInGameGuiManager.hpp index 367c0e8e4..dcd6944a2 100644 --- a/Runtime/MP1/CInGameGuiManager.hpp +++ b/Runtime/MP1/CInGameGuiManager.hpp @@ -129,7 +129,7 @@ public: CInGameGuiManager(CStateManager& stateMgr, CArchitectureQueue& archQueue); bool CheckLoadComplete(CStateManager& stateMgr); void Update(CStateManager& stateMgr, float dt, CArchitectureQueue& archQueue, bool useHud); - void ProcessControllerInput(CStateManager& stateMgr, const CFinalInput& input, CArchitectureQueue& archQueue); + void ProcessControllerInput(CStateManager& stateMgr, const CFinalInput& input); void PreDraw(CStateManager& stateMgr, bool cameraActive); void Draw(CStateManager& stateMgr); void ShowPauseGameHudMessage(CStateManager& stateMgr, CAssetId pauseMsg, float time); diff --git a/Runtime/MP1/CMFGame.cpp b/Runtime/MP1/CMFGame.cpp index 5bfa54a36..7bccf0f0a 100644 --- a/Runtime/MP1/CMFGame.cpp +++ b/Runtime/MP1/CMFGame.cpp @@ -142,7 +142,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch x14_stateManager->ProcessInput(input); x14_stateManager->ClearActiveRandom(); } - x18_guiManager->ProcessControllerInput(*x14_stateManager, input, queue); + x18_guiManager->ProcessControllerInput(*x14_stateManager, input); break; } case EArchMsgType::FrameEnd: { diff --git a/Runtime/MP1/CSaveGameScreen.cpp b/Runtime/MP1/CSaveGameScreen.cpp index 95fe4acda..74656bf54 100644 --- a/Runtime/MP1/CSaveGameScreen.cpp +++ b/Runtime/MP1/CSaveGameScreen.cpp @@ -577,7 +577,7 @@ CSaveGameScreen::CSaveGameScreen(ESaveContext saveCtx, u64 serial) x6c_cardDriver = ConstructCardDriver(x0_saveCtx == ESaveContext::FrontEnd); - if (saveCtx == ESaveContext::InGame) { + if (saveCtx != ESaveContext::FrontEnd) { x84_navConfirmSfx = SFXui_advance; x88_navMoveSfx = SFXui_table_selection_change; x8c_navBackSfx = SFXui_table_change_mode; diff --git a/Runtime/MP1/CSaveGameScreen.hpp b/Runtime/MP1/CSaveGameScreen.hpp index b37fab7e0..a14740770 100644 --- a/Runtime/MP1/CSaveGameScreen.hpp +++ b/Runtime/MP1/CSaveGameScreen.hpp @@ -20,7 +20,7 @@ struct CFinalInput; namespace MP1 { -enum class ESaveContext { FrontEnd, InGame }; +enum class ESaveContext { FrontEnd, InGame, AutoSave }; class CSaveGameScreen { public: diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index 44e360e05..a49e1f56c 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -349,6 +349,11 @@ void CMain::AddOverridePaks() { if (!loader) return; + // Trilogy override pak + // TODO check how it's actually loaded + if (CDvdFile::FileExists("RS5.upak")) + loader->AddPakFileAsync("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/Particle/CProjectileWeaponDataFactory.cpp b/Runtime/Particle/CProjectileWeaponDataFactory.cpp index 135d903d4..923cec423 100644 --- a/Runtime/Particle/CProjectileWeaponDataFactory.cpp +++ b/Runtime/Particle/CProjectileWeaponDataFactory.cpp @@ -146,6 +146,16 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt case SBIG('FOFF'): desc->xb0_FOFF = CPF::GetRealElement(in); break; + // PAL/RS5 + case SBIG('SPS1'): + desc->x28_SPS1 = CPF::GetBool(in); + break; + case SBIG('SPS2'): + desc->x29_SPS2 = CPF::GetBool(in); + break; + case SBIG('FC60'): + desc->x29_FC60 = CPF::GetBool(in); + break; default: { Log.report(logvisor::Fatal, fmt("Unknown WPSM class {} @{}"), clsId, in.position()); return false; diff --git a/Runtime/Particle/CWeaponDescription.hpp b/Runtime/Particle/CWeaponDescription.hpp index b6a1c2852..c25546258 100644 --- a/Runtime/Particle/CWeaponDescription.hpp +++ b/Runtime/Particle/CWeaponDescription.hpp @@ -54,5 +54,9 @@ public: s32 xa8_PJFX = -1; std::unique_ptr xac_RNGE; std::unique_ptr xb0_FOFF; + // PAL/RS5 + bool x28_SPS1 = false; + bool x29_SPS2 = false; + bool x29_FC60 = false; }; } // namespace urde diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index 033f7951f..7cff51a7f 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -151,7 +151,7 @@ private: ESurfaceRestraints x2ac_surfaceRestraint = ESurfaceRestraints::Normal; u32 x2b0_outOfWaterTicks = 2; rstl::reserved_vector x2b4_accelerationTable; - u32 x2d0_curAcceleration = 3; + u32 x2d0_curAcceleration = 1; float x2d4_accelerationChangeTimer = 0.f; zeus::CAABox x2d8_fpBounds; float x2f0_ballTransHeight = 0.f; @@ -353,6 +353,29 @@ private: float CalculateOrbitMinDistance(EPlayerOrbitType type) const; public: + // RS5 + // CUnknownPlayerState1 + // CUnknownPlayerState2 + float x1180_ = 0.f; + float x1184_ = 0.f; + union { + struct { + bool x1188_ : 1; + }; + u32 _dummy2 = 0; + }; + float x118c_ = 2.f; + float x1190_ = 2.f; + u8 x1194_ = 0; + TUniqueId x1196_ = kInvalidUniqueId; + // * x1198_ + float x119c_ = 0.f; + float x11a4_ = 0.f; + u32 x11ac_ = 0; + u32 x11b0_ = 0; + u32 x11b4_ = 0; + u32 x11b8_ = 0; + CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& aabb, CAssetId resId, const zeus::CVector3f& playerScale, float mass, float stepUp, float stepDown, float ballRadius, const CMaterialList& ml); diff --git a/Runtime/World/CScriptSpecialFunction.cpp b/Runtime/World/CScriptSpecialFunction.cpp index e15b55b52..52765168c 100644 --- a/Runtime/World/CScriptSpecialFunction.cpp +++ b/Runtime/World/CScriptSpecialFunction.cpp @@ -411,6 +411,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId mgr.SetPendingOnScreenTex(assetId, {int(x104_float3), int(x108_float4)}, {int(xfc_float1), int(x100_float2)}); if (objectTag) { + //const SObjectTag* deface = g_ResFactory->GetResourceIdByName("FONT_Deface18O"); x1e8_ = g_SimplePool->GetObj(*objectTag); x1e5_26_displayBillboard = true; } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 6f1495681..d8f861426 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -1411,14 +1411,14 @@ CEntity* ScriptLoader::LoadMetroidBeta(CStateManager& mgr, CInputStream& in, int #if 0 std::string name = mgr.HashInstanceName(in); - zeus::CTransform xf = LoadEditorTransform(in); + //zeus::CTransform xf = LoadEditorTransform(in); zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; CPatternedInfo pInfo(in, pair.second); - CActorParameters actParms = LoadActorParameters(in); + //CActorParameters actParms = LoadActorParameters(in); MP1::CMetroidBetaData metData(in); if (!pInfo.GetAnimationParameters().GetACSFile().IsValid()) return nullptr; @@ -1997,14 +1997,14 @@ CEntity* ScriptLoader::LoadMetroid(CStateManager& mgr, CInputStream& in, int pro #if 0 std::string name = mgr.HashInstanceName(in); CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); - zeus::CTransform xf = LoadEditorTransform(in); + //zeus::CTransform xf = LoadEditorTransform(in); zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); auto pair = CPatternedInfo::HasCorrectParameterCount(in); if (!pair.first) return nullptr; CPatternedInfo pInfo(in, pair.second); - CActorParameters actParms = LoadActorParameters(in); + //CActorParameters actParms = LoadActorParameters(in); MP1::CMetroidData metData(in); const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); if (!animParms.GetACSFile().IsValid() || flavor == CPatterned::EFlavorType::One)