Finish CCompoundTargetReticle

This commit is contained in:
Jack Andersen 2017-10-29 17:37:20 -10:00
parent 6eff4f2e01
commit 3fcc50d82d
5 changed files with 682 additions and 147 deletions

View File

@ -7,6 +7,13 @@ namespace DataSpec
struct ITweakTargeting : public ITweak
{
virtual atUint32 GetTargetRadiusMode() const=0;
virtual float GetCurrLockOnExitDuration() const=0;
virtual float GetCurrLockOnEnterDuration() const=0;
virtual float GetCurrLockOnSwitchDuration() const=0;
virtual float GetLockConfirmScale() const=0;
virtual float GetNextLockOnExitDuration() const=0;
virtual float GetNextLockOnEnterDuration() const=0;
virtual float GetNextLockOnSwitchDuration() const=0;
virtual float GetSeekerScale() const=0;
virtual float GetSeekerAngleSpeed() const=0;
virtual float GetXRayRetAngleSpeed() const=0;
@ -14,11 +21,56 @@ struct ITweakTargeting : public ITweak
virtual float GetOrbitPointInTime() const=0;
virtual float GetOrbitPointOutTime() const=0;
virtual const zeus::CColor& GetThermalReticuleColor() const=0;
virtual float GetOvershootOffset() const=0;
virtual float GetXD0() const=0;
virtual float GetTargetFlowerScale() const=0;
virtual const zeus::CColor& GetTargetFlowerColor() const=0;
virtual float GetMissileBracketDuration() const=0;
virtual float GetMissileBracketScaleStart() const=0;
virtual float GetMissileBracketScaleEnd() const=0;
virtual float GetMissileBracketScaleDuration() const=0;
virtual const zeus::CColor& GetMissileBracketColor() const=0;
virtual float GetChargeGaugeOvershootOffset() const=0;
virtual float GetChargeGaugeOvershootDuration() const=0;
virtual float GetOuterBeamSquaresScale() const=0;
virtual const zeus::CColor& GetOuterBeamSquareColor() const=0;
virtual float GetLockonDuration() const=0;
virtual float GetInnerBeamScale() const=0;
virtual const zeus::CColor& GetInnerBeamColorPower() const=0;
virtual const zeus::CColor& GetInnerBeamColorIce() const=0;
virtual const zeus::CColor& GetInnerBeamColorWave() const=0;
virtual const zeus::CColor& GetInnerBeamColorPlasma() const=0;
virtual const float* GetOuterBeamSquareAngles(int i) const=0;
virtual float GetChargeGaugeAngle(int i) const=0;
virtual float GetChargeGaugeScale() const=0;
virtual const zeus::CColor& GetChargeGaugeNonFullColor() const=0;
virtual atUint32 GetChargeTickCount() const=0;
virtual float GetChargeTickAnglePitch() const=0;
virtual float GetLockFireScale() const=0;
virtual float GetLockFireDuration() const=0;
virtual const zeus::CColor& GetLockFireColor() const=0;
virtual float GetLockDaggerScaleStart() const=0;
virtual float GetLockDaggerScaleEnd() const=0;
virtual const zeus::CColor& GetLockDaggerColor() const=0;
virtual float GetLockDaggerAngle0() const=0;
virtual float GetLockDaggerAngle1() const=0;
virtual float GetLockDaggerAngle2() const=0;
virtual const zeus::CColor& GetLockConfirmColor() const=0;
virtual const zeus::CColor& GetSeekerColor() const=0;
virtual float GetLockConfirmClampMin() const=0;
virtual float GetLockConfirmClampMax() const=0;
virtual float GetTargetFlowerClampMin() const=0;
virtual float GetTargetFlowerClampMax() const=0;
virtual float GetSeekerClampMin() const=0;
virtual float GetSeekerClampMax() const=0;
virtual float GetMissileBracketClampMin() const=0;
virtual float GetMissileBracketClampMax() const=0;
virtual float GetInnerBeamClampMin() const=0;
virtual float GetInnerBeamClampMax() const=0;
virtual float GetChargeGaugeClampMin() const=0;
virtual float GetChargeGaugeClampMax() const=0;
virtual float GetLockFireClampMin() const=0;
virtual float GetLockFireClampMax() const=0;
virtual float GetLockDaggerClampMin() const=0;
virtual float GetLockDaggerClampMax() const=0;
virtual float GetGrappleSelectScale() const=0;
virtual float GetGrappleScale() const=0;
virtual float GetGrappleClampMin() const=0;
@ -26,15 +78,22 @@ struct ITweakTargeting : public ITweak
virtual const zeus::CColor& GetGrapplePointSelectColor() const=0;
virtual const zeus::CColor& GetGrapplePointColor() const=0;
virtual const zeus::CColor& GetLockedGrapplePointSelectColor() const=0;
virtual float GetGrappleMinClampScale() const=0;
virtual const zeus::CColor& GetChargeGaugePulseColorHigh() const=0;
virtual float GetFullChargeFadeDuration() const=0;
virtual const zeus::CColor& GetOrbitPointColor() const=0;
virtual const zeus::CColor& GetCrosshairsColor() const=0;
virtual float GetCrosshairsScaleDuration() const=0;
virtual bool DrawOrbitPoint() const=0;
virtual const zeus::CColor& GetChargeGaugePulseColorLow() const=0;
virtual float GetChargeGaugePulsePeriod() const=0;
virtual float GetReticuleClampMin() const=0;
virtual float GetReticuleClampMax() const=0;
virtual const zeus::CColor& GetXRayRetRingColor() const=0;
virtual float GetReticuleScale() const=0;
virtual float GetScanTargetClampMin() const=0;
virtual float GetScanTargetClampMax() const=0;
virtual float GetAngularLagSpeed() const=0;
};
}

View File

@ -10,15 +10,14 @@ namespace DNAMP1
struct CTweakTargeting final : public ITweakTargeting
{
DECL_YAML
Value<float> x0_;
Value<atUint32> x4_targetRadiusMode;
Value<float> x8_;
Value<float> xc_;
Value<float> x10_;
Value<float> x14_;
Value<float> x18_;
Value<float> x1c_;
Value<float> x20_;
Value<float> x8_currLockOnExitDuration;
Value<float> xc_currLockOnEnterDuration;
Value<float> x10_currLockOnSwitchDuration;
Value<float> x14_lockConfirmScale;
Value<float> x18_nextLockOnExitDuration;
Value<float> x1c_nextLockOnEnterDuration;
Value<float> x20_nextLockOnSwitchDuration;
Value<float> x24_seekerScale;
Value<float> x28_seekerAngleSpeed;
Value<float> x2c_xrayRetAngleSpeed;
@ -43,64 +42,64 @@ struct CTweakTargeting final : public ITweakTargeting
Value<float> xa8_;
Value<float> xac_;
DNAColor xb0_thermalReticuleColor;
Value<float> xb4_;
Value<atVec4f> xb8_;
Value<float> xbc_;
Value<float> xc0_;
Value<float> xc4_;
Value<float> xc8_;
Value<atVec4f> xcc_;
Value<float> xd0_;
Value<float> xd4_;
Value<atVec4f> xd8_;
Value<atVec4f> xdc_;
Value<atVec4f> xe0_;
Value<atVec4f> xe4_;
Value<float> xe8_overshootOffset;
Value<float> xec_;
Value<float> xf0_;
Value<atVec4f> xf4_;
Value<atUint32> xf8_entryCount;
Value<float> xb4_targetFlowerScale;
DNAColor xb8_targetFlowerColor;
Value<float> xbc_missileBracketDuration;
Value<float> xc0_missileBracketScaleStart;
Value<float> xc4_missileBracketScaleEnd;
Value<float> xc8_missileBracketScaleDuration;
DNAColor xcc_missileBracketColor;
Value<float> xd0_LockonDuration;
Value<float> xd4_innerBeamScale;
DNAColor xd8_innerBeamColorPower;
DNAColor xdc_innerBeamColorIce;
DNAColor xe0_innerBeamColorWave;
DNAColor xe4_innerBeamColorPlasma;
Value<float> xe8_chargeGaugeOvershootOffset;
Value<float> xec_chargeGaugeOvershootDuration;
Value<float> xf0_outerBeamSquaresScale;
DNAColor xf4_outerBeamSquareColor;
Value<atUint32> xf8_outerBeamSquareAngleCount;
struct UnkVec : BigYAML
{
DECL_YAML
Value<atUint32> count;
Vector<float, DNA_COUNT(count)> floats;
};
Vector<UnkVec, DNA_COUNT(xf8_entryCount)> xf8_;
Value<atUint32> x108_entryCount;
Vector<float, DNA_COUNT(x108_entryCount)> x108_;
Value<float> x118_;
Value<atVec4f> x11c_;
Value<atUint32> x120_;
Value<float> x124_;
Value<float> x128_;
Value<float> x12c_;
Value<atVec4f> x130_;
Value<float> x134_;
Value<float> x138_;
Value<atVec4f> x13c_;
Value<float> x140_;
Value<float> x144_;
Value<float> x148_;
Value<atVec4f> x14c_;
Vector<UnkVec, DNA_COUNT(xf8_outerBeamSquareAngleCount)> xf8_outerBeamSquareAngles;
Value<atUint32> x108_chargeGaugeAngleCount;
Vector<float, DNA_COUNT(x108_chargeGaugeAngleCount)> x108_chargeGaugeAngles;
Value<float> x118_chargeGaugeScale;
DNAColor x11c_chargeGaugeNonFullColor;
Value<atUint32> x120_chargeTickCount;
Value<float> x124_chargeTickAnglePitch;
Value<float> x128_lockFireScale;
Value<float> x12c_lockFireDuration;
DNAColor x130_lockFireColor;
Value<float> x134_lockDaggerScaleStart;
Value<float> x138_lockDaggerScaleEnd;
DNAColor x13c_lockDaggerColor;
Value<float> x140_lockDaggerAngle0;
Value<float> x144_lockDaggerAngle1;
Value<float> x148_lockDaggerAngle2;
DNAColor x14c_lockConfirmColor;
DNAColor x150_seekerColor;
Value<float> x154_;
Value<float> x158_;
Value<float> x15c_;
Value<float> x160_;
Value<float> x154_lockConfirmClampMin;
Value<float> x158_lockConfirmClampMax;
Value<float> x15c_targetFlowerClampMin;
Value<float> x160_targetFlowerClampMax;
Value<float> x164_seekerClampMin;
Value<float> x168_seekerClampMax;
Value<float> x16c_;
Value<float> x170_;
Value<float> x174_;
Value<float> x178_;
Value<float> x17c_;
Value<float> x180_;
Value<float> x184_;
Value<float> x188_;
Value<float> x18c_;
Value<float> x190_;
Value<float> x16c_missileBracketClampMin;
Value<float> x170_missileBracketClampMax;
Value<float> x174_innerBeamClampMin;
Value<float> x178_innerBeamClampMax;
Value<float> x17c_chargeGaugeClampMin;
Value<float> x180_chargeGaugeClampMax;
Value<float> x184_lockFireClampMin;
Value<float> x188_lockFireClampMax;
Value<float> x18c_lockDaggerClampMin;
Value<float> x190_lockDaggerClampMax;
Value<float> x194_grappleSelectScale;
Value<float> x198_grappleScale;
Value<float> x19c_grappleClampMin;
@ -108,18 +107,18 @@ struct CTweakTargeting final : public ITweakTargeting
DNAColor x1a4_grapplePointSelectColor;
DNAColor x1a8_grapplePointColor;
DNAColor x1ac_lockedGrapplePointSelectColor;
Value<float> x1b0_;
Value<atVec4f> x1b4_;
Value<float> x1b8_;
Value<float> x1b0_grappleMinClampScale;
DNAColor x1b4_chargeGaugePulseColorHigh;
Value<float> x1b8_fullChargeFadeDuration;
DNAColor x1bc_orbitPointColor;
DNAColor x1c0_crosshairsColor;
Value<float> x1c4_;
Value<float> x1c4_crosshairsScaleDur;
Value<bool> x1c8_drawOrbitPoint;
Value<atVec4f> x1cc_;
Value<float> x1d0_;
Value<atVec4f> x1d4_;
Value<atVec4f> x1d8_;
Value<atVec4f> x1dc_;
DNAColor x1cc_chargeGaugePulseColorLow;
Value<float> x1d0_chargeGaugePulsePeriod;
DNAColor x1d4_;
DNAColor x1d8_;
DNAColor x1dc_;
Value<float> x1e0_;
Value<float> x1e4_;
Value<float> x1e8_;
@ -137,19 +136,32 @@ struct CTweakTargeting final : public ITweakTargeting
Value<float> x218_reticuleScale;
Value<float> x21c_scanTargetClampMin;
Value<float> x220_scanTargetClampMax;
Value<float> x224_;
Value<float> x224_angularLagSpeed;
CTweakTargeting() = default;
CTweakTargeting(athena::io::IStreamReader& r)
{
this->read(r);
x124_ = -1.f * ((2 * M_PIF) * (0.003f * x124_));
x140_ = (2.f * M_PIF) * (0.003f * x140_);
x144_ = (2.f * M_PIF) * (0.003f * x144_);
x208_ = (2.f * M_PIF) * (0.003f * x208_);
x124_chargeTickAnglePitch = -zeus::degToRad(x124_chargeTickAnglePitch);
x140_lockDaggerAngle0 = zeus::degToRad(x140_lockDaggerAngle0);
x144_lockDaggerAngle1 = zeus::degToRad(x144_lockDaggerAngle1);
x148_lockDaggerAngle2 = zeus::degToRad(x148_lockDaggerAngle2);
x208_ = zeus::degToRad(x208_);
for (int i=0 ; i<4 ; ++i)
for (float& f : xf8_outerBeamSquareAngles[i].floats)
f = zeus::degToRad(f);
for (int i=0 ; i<4 ; ++i)
x108_chargeGaugeAngles[i] = zeus::degToRad(x108_chargeGaugeAngles[i]);
}
atUint32 GetTargetRadiusMode() const { return x4_targetRadiusMode; }
float GetCurrLockOnExitDuration() const { return x8_currLockOnExitDuration; }
float GetCurrLockOnEnterDuration() const { return xc_currLockOnEnterDuration; }
float GetCurrLockOnSwitchDuration() const { return x10_currLockOnSwitchDuration; }
float GetLockConfirmScale() const { return x14_lockConfirmScale; }
float GetNextLockOnExitDuration() const { return x18_nextLockOnExitDuration; }
float GetNextLockOnEnterDuration() const { return x1c_nextLockOnEnterDuration; }
float GetNextLockOnSwitchDuration() const { return x20_nextLockOnSwitchDuration; }
float GetSeekerScale() const { return x24_seekerScale; }
float GetSeekerAngleSpeed() const { return x28_seekerAngleSpeed; }
float GetXRayRetAngleSpeed() const { return x2c_xrayRetAngleSpeed; }
@ -157,11 +169,56 @@ struct CTweakTargeting final : public ITweakTargeting
float GetOrbitPointInTime() const { return x54_orbitPointInTime; }
float GetOrbitPointOutTime() const { return x58_orbitPointOutTime; }
const zeus::CColor& GetThermalReticuleColor() const { return xb0_thermalReticuleColor; }
float GetOvershootOffset() const { return xe8_overshootOffset; }
float GetXD0() const { return xd0_; }
float GetTargetFlowerScale() const { return xb4_targetFlowerScale; }
const zeus::CColor& GetTargetFlowerColor() const { return xb8_targetFlowerColor; }
float GetMissileBracketDuration() const { return xbc_missileBracketDuration; }
float GetMissileBracketScaleStart() const { return xc0_missileBracketScaleStart; }
float GetMissileBracketScaleEnd() const { return xc4_missileBracketScaleEnd; }
float GetMissileBracketScaleDuration() const { return xc8_missileBracketScaleDuration; }
const zeus::CColor& GetMissileBracketColor() const { return xcc_missileBracketColor; }
float GetChargeGaugeOvershootOffset() const { return xe8_chargeGaugeOvershootOffset; }
float GetChargeGaugeOvershootDuration() const { return xec_chargeGaugeOvershootDuration; }
float GetOuterBeamSquaresScale() const { return xf0_outerBeamSquaresScale; }
const zeus::CColor& GetOuterBeamSquareColor() const { return xf4_outerBeamSquareColor; }
float GetLockonDuration() const { return xd0_LockonDuration; }
float GetInnerBeamScale() const { return xd4_innerBeamScale; }
const zeus::CColor& GetInnerBeamColorPower() const { return xd8_innerBeamColorPower; }
const zeus::CColor& GetInnerBeamColorIce() const { return xdc_innerBeamColorIce; }
const zeus::CColor& GetInnerBeamColorWave() const { return xe0_innerBeamColorWave; }
const zeus::CColor& GetInnerBeamColorPlasma() const { return xe4_innerBeamColorPlasma; }
const float* GetOuterBeamSquareAngles(int i) const { return xf8_outerBeamSquareAngles[i].floats.data(); }
float GetChargeGaugeAngle(int i) const { return x108_chargeGaugeAngles[i]; }
float GetChargeGaugeScale() const { return x118_chargeGaugeScale; }
const zeus::CColor& GetChargeGaugeNonFullColor() const { return x11c_chargeGaugeNonFullColor; }
atUint32 GetChargeTickCount() const { return x120_chargeTickCount; }
float GetChargeTickAnglePitch() const { return x124_chargeTickAnglePitch; }
float GetLockFireScale() const { return x128_lockFireScale; }
float GetLockFireDuration() const { return x12c_lockFireDuration; }
const zeus::CColor& GetLockFireColor() const { return x130_lockFireColor; }
float GetLockDaggerScaleStart() const { return x134_lockDaggerScaleStart; }
float GetLockDaggerScaleEnd() const { return x138_lockDaggerScaleEnd; }
const zeus::CColor& GetLockDaggerColor() const { return x13c_lockDaggerColor; }
float GetLockDaggerAngle0() const { return x140_lockDaggerAngle0; }
float GetLockDaggerAngle1() const { return x144_lockDaggerAngle1; }
float GetLockDaggerAngle2() const { return x148_lockDaggerAngle2; }
const zeus::CColor& GetLockConfirmColor() const { return x14c_lockConfirmColor; }
const zeus::CColor& GetSeekerColor() const { return x150_seekerColor; }
float GetLockConfirmClampMin() const { return x154_lockConfirmClampMin; }
float GetLockConfirmClampMax() const { return x158_lockConfirmClampMax; }
float GetTargetFlowerClampMin() const { return x15c_targetFlowerClampMin; }
float GetTargetFlowerClampMax() const { return x160_targetFlowerClampMax; }
float GetSeekerClampMin() const { return x164_seekerClampMin; }
float GetSeekerClampMax() const { return x168_seekerClampMax; }
float GetMissileBracketClampMin() const { return x16c_missileBracketClampMin; }
float GetMissileBracketClampMax() const { return x170_missileBracketClampMax; }
float GetInnerBeamClampMin() const { return x174_innerBeamClampMin; }
float GetInnerBeamClampMax() const { return x178_innerBeamClampMax; }
float GetChargeGaugeClampMin() const { return x17c_chargeGaugeClampMin; }
float GetChargeGaugeClampMax() const { return x180_chargeGaugeClampMax; }
float GetLockFireClampMin() const { return x184_lockFireClampMin; }
float GetLockFireClampMax() const { return x188_lockFireClampMax; }
float GetLockDaggerClampMin() const { return x18c_lockDaggerClampMin; }
float GetLockDaggerClampMax() const { return x190_lockDaggerClampMax; }
float GetGrappleSelectScale() const { return x194_grappleSelectScale; }
float GetGrappleScale() const { return x198_grappleScale; }
float GetGrappleClampMin() const { return x19c_grappleClampMin; }
@ -169,15 +226,22 @@ struct CTweakTargeting final : public ITweakTargeting
const zeus::CColor& GetGrapplePointSelectColor() const { return x1a4_grapplePointSelectColor; }
const zeus::CColor& GetGrapplePointColor() const { return x1a8_grapplePointColor; }
const zeus::CColor& GetLockedGrapplePointSelectColor() const { return x1ac_lockedGrapplePointSelectColor; }
float GetGrappleMinClampScale() const { return x1b0_grappleMinClampScale; }
const zeus::CColor& GetChargeGaugePulseColorHigh() const { return x1b4_chargeGaugePulseColorHigh; }
float GetFullChargeFadeDuration() const { return x1b8_fullChargeFadeDuration; }
const zeus::CColor& GetOrbitPointColor() const { return x1bc_orbitPointColor; }
const zeus::CColor& GetCrosshairsColor() const { return x1c0_crosshairsColor; }
float GetCrosshairsScaleDuration() const { return x1c4_crosshairsScaleDur; }
bool DrawOrbitPoint() const { return x1c8_drawOrbitPoint; }
const zeus::CColor& GetChargeGaugePulseColorLow() const { return x1cc_chargeGaugePulseColorLow; }
float GetChargeGaugePulsePeriod() const { return x1d0_chargeGaugePulsePeriod; }
float GetReticuleClampMin() const { return x20c_reticuleClampMin; }
float GetReticuleClampMax() const { return x210_reticuleClampMax; }
const zeus::CColor& GetXRayRetRingColor() const { return x214_xrayRetRingColor; }
float GetReticuleScale() const { return x218_reticuleScale; }
float GetScanTargetClampMin() const { return x21c_scanTargetClampMin; }
float GetScanTargetClampMax() const { return x220_scanTargetClampMax; }
float GetAngularLagSpeed() const { return x224_angularLagSpeed; }
};
}
}

View File

@ -1,3 +1,4 @@
#include <stdlib.h>
#include "CCompoundTargetReticle.hpp"
#include "GameGlobalObjects.hpp"
#include "Camera/CGameCamera.hpp"
@ -22,8 +23,9 @@ CCompoundTargetReticle::SOuterItemInfo::SOuterItemInfo(const char* res) : x0_mod
CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
: x0_leadingOrientation(mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().buildMatrix3f())
, x10_laggingOrientation(mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().buildMatrix3f())
, x2c_overshootOffsetHalf(0.5f * g_tweakTargeting->GetOvershootOffset())
, x30_premultOvershootOffset(calculate_premultiplied_overshoot_offset(g_tweakTargeting->GetOvershootOffset()))
, x2c_overshootOffsetHalf(0.5f * g_tweakTargeting->GetChargeGaugeOvershootOffset())
, x30_premultOvershootOffset(
calculate_premultiplied_overshoot_offset(g_tweakTargeting->GetChargeGaugeOvershootOffset()))
, x34_crosshairs(g_SimplePool->GetObj(skCrosshairsReticleAssetName))
, x40_seeker(g_SimplePool->GetObj(skSeekerAssetName))
, x4c_lockConfirm(g_SimplePool->GetObj(skLockConfirmAssetName))
@ -39,7 +41,7 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
, xc4_chargeGauge(skChargeGaugeAssetName)
, xf4_targetPos(CalculateOrbitZoneReticlePosition(mgr, false))
, x100_laggingTargetPos(CalculateOrbitZoneReticlePosition(mgr, true))
, x208_(g_tweakTargeting->GetXD0())
, x208_lockonTimer(g_tweakTargeting->GetLockonDuration())
{
xe0_outerBeamIconSquares.reserve(9);
for (u32 i = 0; i < 9; ++i)
@ -88,7 +90,7 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr)
if (angle < 0.1f || angle > 45.f)
t = 1.f;
else
t = std::min(1.f, g_tweakTargeting->x224_ * dt / angle);
t = std::min(1.f, g_tweakTargeting->GetAngularLagSpeed() * dt / angle);
x10_laggingOrientation = t == 1.f ? x0_leadingOrientation :
zeus::CQuaternion::slerp(x10_laggingOrientation, x0_leadingOrientation, t);
xf4_targetPos = CalculateOrbitZoneReticlePosition(mgr, false);
@ -187,47 +189,52 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr)
if (fullyCharged != x21a_fullyCharged)
x21a_fullyCharged = fullyCharged;
if (x21a_fullyCharged)
x214_ = std::min(dt / g_tweakTargeting->x1b8_ + x214_, g_tweakTargeting->x0_);
x214_fullChargeFadeTimer =
std::min(dt / g_tweakTargeting->GetFullChargeFadeDuration() + x214_fullChargeFadeTimer,
g_tweakTargeting->GetFullChargeFadeDuration());
else
x214_ = std::max(x214_ - dt / g_tweakTargeting->x1b8_, 0.f);
x214_fullChargeFadeTimer =
std::max(x214_fullChargeFadeTimer - dt / g_tweakTargeting->GetFullChargeFadeDuration(), 0.f);
bool missileActive = gun->GetMissleMode() == CPlayerGun::EMissleMode::Active;
if (missileActive != x1f4_missileActive)
{
if (x1f8_ != 0.f)
x1f8_ = FLT_EPSILON - x1f8_;
if (x1f8_missileBracketTimer != 0.f)
x1f8_missileBracketTimer = FLT_EPSILON - x1f8_missileBracketTimer;
else
x1f8_ = FLT_EPSILON;
x1f8_missileBracketTimer = FLT_EPSILON;
x1f4_missileActive = missileActive;
}
CPlayerState::EBeamId beam = gun->GetCurrentBeam();
if (beam != x200_beam)
{
x204_ = g_tweakTargeting->xec_;
x204_chargeGaugeOvershootTimer = g_tweakTargeting->GetChargeGaugeOvershootDuration();
for (int i=0 ; i<9 ; ++i)
{
zeus::CRelAngle f1 = g_tweakTargeting->xf8_[int(beam)].floats[i];
zeus::CRelAngle baseAngle = g_tweakTargeting->GetOuterBeamSquareAngles(int(beam))[i];
SOuterItemInfo& icon = xe0_outerBeamIconSquares[i];
zeus::CRelAngle f7 = f1.asRadians() - icon.x10_;
zeus::CRelAngle offshootAngleDelta = baseAngle.asRadians() - icon.x10_rotAng;
if ((i & 0x1) == 1)
f7 = (f1 > 0.f) ? zeus::CRelAngle(-2.f * M_PIF - f1) : zeus::CRelAngle(2.f * M_PIF + f1);
icon.xc_ = icon.x10_;
icon.x18_ = f7;
icon.x14_ = f1;
offshootAngleDelta = (baseAngle > 0.f) ? zeus::CRelAngle(-2.f * M_PIF - baseAngle) :
zeus::CRelAngle(2.f * M_PIF + baseAngle);
icon.xc_offshootBaseAngle = icon.x10_rotAng;
icon.x18_offshootAngleDelta = offshootAngleDelta;
icon.x14_baseAngle = baseAngle;
}
zeus::CRelAngle f30 = g_tweakTargeting->x108_[int(beam)];
float f2 = f30.asRadians() - xc4_chargeGauge.x10_;
zeus::CRelAngle baseAngle = g_tweakTargeting->GetChargeGaugeAngle(int(beam));
float offshootAngleDelta = baseAngle.asRadians() - xc4_chargeGauge.x10_rotAng;
if ((rand() & 0x1) == 1)
f2 = (f2 > 0.f) ? -2.f * M_PIF - f2 : 2.f * M_PIF + f2;
xc4_chargeGauge.xc_ = xc4_chargeGauge.x10_;
xc4_chargeGauge.x18_ = f2;
xc4_chargeGauge.x14_ = f30;
offshootAngleDelta = (offshootAngleDelta > 0.f) ?
-2.f * M_PIF - offshootAngleDelta : 2.f * M_PIF + offshootAngleDelta;
xc4_chargeGauge.xc_offshootBaseAngle = xc4_chargeGauge.x10_rotAng;
xc4_chargeGauge.x18_offshootAngleDelta = offshootAngleDelta;
xc4_chargeGauge.x14_baseAngle = baseAngle;
x200_beam = beam;
x208_ = 0.f;
x208_lockonTimer = 0.f;
}
if (gun->GetLastFireButtonStates() & 0x1)
{
if (!x218_beamShot)
x210_ = g_tweakTargeting->x12c_;
x210_lockFireTimer = g_tweakTargeting->GetLockFireDuration();
x218_beamShot = true;
}
else
@ -237,14 +244,14 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr)
if (gun->GetLastFireButtonStates() & 0x2)
{
if (!x219_missileShot)
x1fc_ = g_tweakTargeting->xc8_;
x1fc_missileBracketScaleTimer = g_tweakTargeting->GetMissileBracketScaleDuration();
x219_missileShot = true;
}
else
{
x219_missileShot = false;
}
if (TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(xf2_))
if (TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(xf2_nextTargetId))
{
if (point->GetUniqueId() != x1dc_grapplePoint0)
{
@ -274,8 +281,10 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr)
if (x1e4_grapplePoint1T == 0.f)
x1de_grapplePoint1 = kInvalidUniqueId;
}
x1f0_xrayRetAngle = zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle);
x1ec_seekerAngle = zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle);
x1f0_xrayRetAngle =
zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle);
x1ec_seekerAngle =
zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle);
}
void CTargetReticleRenderState::InterpolateWithClamp(const CTargetReticleRenderState& a,
@ -297,19 +306,162 @@ void CTargetReticleRenderState::InterpolateWithClamp(const CTargetReticleRenderS
out.x0_target = kInvalidUniqueId;
}
static bool IsDamageOrbit(CPlayer::EPlayerOrbitRequest req)
{
switch (req)
{
case CPlayer::EPlayerOrbitRequest::Five:
case CPlayer::EPlayerOrbitRequest::ActivateOrbitSource:
case CPlayer::EPlayerOrbitRequest::ProjectileCollide:
case CPlayer::EPlayerOrbitRequest::Freeze:
case CPlayer::EPlayerOrbitRequest::DamageOnGrapple:
return true;
default:
return false;
}
}
void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager& mgr)
{
// TODO: Finish
TUniqueId targetId = mgr.GetPlayer().GetOrbitTargetId();
if (targetId != xf0_targetId)
{
if (targetId != kInvalidUniqueId)
{
if (TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(targetId))
CSfxManager::SfxStart(1393, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
else
CSfxManager::SfxStart(1377, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
}
if (targetId == kInvalidUniqueId)
{
x12c_currGroupA = x10c_currGroupInterp;
x14c_currGroupB.SetFactor(0.f);
x16c_currGroupDur = IsDamageOrbit(mgr.GetPlayer().GetOrbitRequest()) ? 0.65f :
g_tweakTargeting->GetCurrLockOnEnterDuration();
}
else
{
x12c_currGroupA = x10c_currGroupInterp;
if (xf0_targetId == kInvalidUniqueId)
x12c_currGroupA.SetTargetId(targetId);
x14c_currGroupB = CTargetReticleRenderState(targetId, 1.f, zeus::CVector3f::skZero, 1.f,
IsGrappleTarget(targetId, mgr) ? g_tweakTargeting->GetGrappleMinClampScale() : 1.f, false);
x16c_currGroupDur = xf0_targetId == kInvalidUniqueId ? g_tweakTargeting->GetCurrLockOnExitDuration() :
g_tweakTargeting->GetCurrLockOnSwitchDuration();
x170_currGroupTimer = x16c_currGroupDur;
xf0_targetId = targetId;
}
}
if (x170_currGroupTimer > 0.f)
{
UpdateTargetParameters(x12c_currGroupA, mgr);
UpdateTargetParameters(x14c_currGroupB, mgr);
x170_currGroupTimer = std::max(0.f, x170_currGroupTimer - dt);
CTargetReticleRenderState::InterpolateWithClamp(x12c_currGroupA, x10c_currGroupInterp, x14c_currGroupB,
1.f - x170_currGroupTimer / x16c_currGroupDur);
}
else
{
UpdateTargetParameters(x10c_currGroupInterp, mgr);
}
if (x1f8_missileBracketTimer != 0.f && x1f8_missileBracketTimer < g_tweakTargeting->GetMissileBracketDuration())
{
if (x1f8_missileBracketTimer < 0.f)
x1f8_missileBracketTimer =
std::min(0.f, x1f8_missileBracketTimer + dt);
else
x1f8_missileBracketTimer =
std::min(g_tweakTargeting->GetMissileBracketDuration(), x1f8_missileBracketTimer + dt);
}
if (x204_chargeGaugeOvershootTimer > 0.f)
{
x204_chargeGaugeOvershootTimer = std::max(0.f, x204_chargeGaugeOvershootTimer - dt);
if (x204_chargeGaugeOvershootTimer == 0.f)
{
for (int i=0 ; i<9 ; ++i)
xe0_outerBeamIconSquares[i].x10_rotAng = xe0_outerBeamIconSquares[i].x14_baseAngle;
xc4_chargeGauge.x10_rotAng = xc4_chargeGauge.x14_baseAngle;
x208_lockonTimer = FLT_EPSILON;
}
else
{
float offshoot = offshoot_func(x2c_overshootOffsetHalf, x30_premultOvershootOffset,
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);
}
xc4_chargeGauge.x10_rotAng = zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot +
xc4_chargeGauge.xc_offshootBaseAngle);
}
}
if (x208_lockonTimer > 0.f && x208_lockonTimer < g_tweakTargeting->GetLockonDuration())
x208_lockonTimer = std::min(g_tweakTargeting->GetLockonDuration(), x208_lockonTimer + dt);
if (x210_lockFireTimer > 0.f)
x210_lockFireTimer = std::max(0.f, x210_lockFireTimer - dt);
if (x1fc_missileBracketScaleTimer > 0.f)
x1fc_missileBracketScaleTimer = std::max(0.f, x1fc_missileBracketScaleTimer - dt);
}
void CCompoundTargetReticle::UpdateNextLockOnGroup(float dt, const CStateManager& mgr)
{
// TODO: Finish
TUniqueId nextTargetId = mgr.GetPlayer().GetOrbitNextTargetId();
if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan &&
mgr.GetPlayer().GetOrbitTargetId() != kInvalidUniqueId)
nextTargetId = mgr.GetPlayer().GetOrbitTargetId();
if (nextTargetId != xf2_nextTargetId)
{
if (xf2_nextTargetId == kInvalidUniqueId)
{
x194_nextGroupA = x174_nextGroupInterp;
x1b4_nextGroupB = CTargetReticleRenderState(kInvalidUniqueId, 1.f,
(x20_prevState == EReticleState::XRay || x20_prevState == EReticleState::Thermal) ?
x100_laggingTargetPos : xf4_targetPos, 0.f, 1.f, true);
x1d4_nextGroupDur = x1d8_nextGroupTimer = g_tweakTargeting->GetNextLockOnEnterDuration();
xf2_nextTargetId = nextTargetId;
}
else
{
x194_nextGroupA = x174_nextGroupInterp;
x1b4_nextGroupB = CTargetReticleRenderState(nextTargetId, 1.f, zeus::CVector3f::skZero, 1.f,
IsGrappleTarget(nextTargetId, mgr) ? g_tweakTargeting->GetGrappleMinClampScale() : 1.f, true);
x1d4_nextGroupDur = x1d8_nextGroupTimer = xf2_nextTargetId == kInvalidUniqueId ?
g_tweakTargeting->GetNextLockOnExitDuration() :
g_tweakTargeting->GetNextLockOnSwitchDuration();
xf2_nextTargetId = nextTargetId;
}
}
if (x1d8_nextGroupTimer > 0.f)
{
UpdateTargetParameters(x194_nextGroupA, mgr);
UpdateTargetParameters(x1b4_nextGroupB, mgr);
x1d8_nextGroupTimer = std::max(0.f, x1d8_nextGroupTimer - dt);
CTargetReticleRenderState::InterpolateWithClamp(x194_nextGroupA, x174_nextGroupInterp, x1b4_nextGroupB,
1.f - x1d8_nextGroupTimer / x1d4_nextGroupDur);
}
else
{
UpdateTargetParameters(x174_nextGroupInterp, mgr);
}
}
void CCompoundTargetReticle::UpdateOrbitZoneGroup(float dt, const CStateManager& mgr)
{
// TODO: Finish
if (xf0_targetId == kInvalidUniqueId && xf2_nextTargetId != kInvalidUniqueId)
x20c_ = std::min(1.f, 2.f * dt + x20c_);
else
x20c_ = std::max(0.f, x20c_ - 2.f * dt);
if (mgr.GetPlayer().IsShowingCrosshairs() &&
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan)
x1e8_crosshairsScale =
std::min(1.f, dt / g_tweakTargeting->GetCrosshairsScaleDuration() + x1e8_crosshairsScale);
else
x1e8_crosshairsScale =
std::max(0.f, x1e8_crosshairsScale - dt / g_tweakTargeting->GetCrosshairsScaleDuration());
}
void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) const
@ -407,8 +559,261 @@ void CCompoundTargetReticle::DrawCurrLockOnGroup(const zeus::CMatrix3f& rot, con
{
if (x28_noDrawTicks > 0)
return;
if (x1e0_grapplePoint0T + x1e4_grapplePoint1T > 0 || x10c_currGroupInterp.GetFactor() == 0.f)
return;
// TODO: Finish
float lockBreakAlpha = x10c_currGroupInterp.GetFactor();
float visorFactor = mgr.GetPlayerState()->GetVisorTransitionFactor();
bool lockConfirm = false;
bool lockReticule = false;
switch (x20_prevState)
{
case EReticleState::Combat:
lockConfirm = true;
lockReticule = true;
break;
case EReticleState::Scan:
lockConfirm = true;
break;
default:
break;
}
zeus::CMatrix3f lockBreakXf;
zeus::CColor lockBreakColor = zeus::CColor::skClear;
if (IsDamageOrbit(mgr.GetPlayer().GetOrbitRequest()) && x14c_currGroupB.GetFactor() == 0)
{
zeus::CMatrix3f lockBreakRM;
for (int i=0 ; i<4 ; ++i)
{
int a = rand() % 9;
auto b = std::div(a, 3);
lockBreakRM[b.rem][b.quot] += rand() / float(RAND_MAX) - 0.5f;
}
lockBreakXf = lockBreakRM.transposed();
if (x10c_currGroupInterp.GetFactor() > 0.8f)
lockBreakColor = zeus::CColor(1.f, (x10c_currGroupInterp.GetFactor() - 0.8f) * 0.3f / 0.2f);
lockBreakAlpha = x10c_currGroupInterp.GetFactor() > 0.75f ?
1.f : std::max(0.f, (x10c_currGroupInterp.GetFactor() - 0.55f) / 0.2f);
}
if (lockConfirm && x4c_lockConfirm.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetLockConfirmClampMin(),
g_tweakTargeting->GetLockConfirmClampMax(), mgr) *
g_tweakTargeting->GetLockConfirmScale() / x10c_currGroupInterp.GetFactor());
zeus::CTransform modelXf(lockBreakXf * (rot * zeus::CMatrix3f::RotateY(x1ec_seekerAngle) * scale),
x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetLockConfirmColor();
color.a *= lockBreakAlpha;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
x4c_lockConfirm->Draw(flags);
}
if (lockReticule)
{
if (x58_targetFlower.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetTargetFlowerClampMin(),
g_tweakTargeting->GetTargetFlowerClampMax(), mgr) *
g_tweakTargeting->GetTargetFlowerScale() / lockBreakAlpha);
zeus::CTransform modelXf(lockBreakXf * (rot * zeus::CMatrix3f::RotateY(x1f0_xrayRetAngle) * scale),
x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetTargetFlowerColor();
color.a *= lockBreakAlpha * visorFactor;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
x58_targetFlower->Draw(flags);
}
if (x1f8_missileBracketTimer != 0.f && x64_missileBracket.IsLoaded())
{
float t = std::fabs((x1fc_missileBracketScaleTimer - 0.5f *
g_tweakTargeting->GetMissileBracketScaleDuration())
/ 0.5f * g_tweakTargeting->GetMissileBracketScaleDuration());
float tscale = ((1.f - t) * g_tweakTargeting->GetMissileBracketScaleEnd() +
t * g_tweakTargeting->GetMissileBracketScaleStart());
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetMissileBracketClampMin(),
g_tweakTargeting->GetMissileBracketClampMax(), mgr) *
std::fabs(x1f8_missileBracketTimer) / g_tweakTargeting->GetMissileBracketDuration() *
tscale / x10c_currGroupInterp.GetFactor());
for (int i=0 ; i<4 ; ++i)
{
zeus::CTransform modelXf(
lockBreakXf * rot *
zeus::CMatrix3f(zeus::CVector3f{i < 2 ? 1.f : -1.f, 1.f, i & 0x1 ? 1.f : -1.f}) * scale,
x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetMissileBracketColor();
color.a *= lockBreakAlpha * visorFactor;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
x64_missileBracket->Draw(flags);
}
}
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetChargeGaugeClampMin(),
g_tweakTargeting->GetChargeGaugeClampMax(), mgr) *
1.f / x10c_currGroupInterp.GetFactor() * g_tweakTargeting->GetOuterBeamSquaresScale());
zeus::CMatrix3f outerBeamXf = rot * scale;
for (int i=0 ; i<9 ; ++i)
{
const SOuterItemInfo& info = xe0_outerBeamIconSquares[i];
if (info.x0_model.IsLoaded())
{
zeus::CTransform modelXf(lockBreakXf * outerBeamXf * zeus::CMatrix3f::RotateY(info.x10_rotAng),
x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetOuterBeamSquareColor();
color.a *= lockBreakAlpha * visorFactor;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
info.x0_model->Draw(flags);
}
}
if (xc4_chargeGauge.x0_model.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetChargeGaugeClampMin(),
g_tweakTargeting->GetChargeGaugeClampMax(), mgr) *
g_tweakTargeting->GetChargeGaugeScale() / x10c_currGroupInterp.GetFactor());
zeus::CMatrix3f chargeGaugeXf = rot * scale * zeus::CMatrix3f::RotateY(xc4_chargeGauge.x10_rotAng);
float pulseT = std::fabs(std::fmod(CGraphics::GetSecondsMod900(),
g_tweakTargeting->GetChargeGaugePulsePeriod()));
zeus::CColor gaugeColor = zeus::CColor::lerp(g_tweakTargeting->GetChargeGaugeNonFullColor(),
zeus::CColor::lerp(g_tweakTargeting->GetChargeGaugePulseColorHigh(),
g_tweakTargeting->GetChargeGaugePulseColorLow(),
pulseT < 0.5f * g_tweakTargeting->GetChargeGaugePulsePeriod() ?
pulseT / (0.5f * g_tweakTargeting->GetChargeGaugePulsePeriod()) :
(g_tweakTargeting->GetChargeGaugePulsePeriod() - pulseT) /
(0.5f * g_tweakTargeting->GetChargeGaugePulsePeriod())),
x214_fullChargeFadeTimer / g_tweakTargeting->GetFullChargeFadeDuration());
zeus::CTransform modelXf(lockBreakXf * chargeGaugeXf, x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = gaugeColor;
color.a *= lockBreakAlpha * visorFactor;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
xc4_chargeGauge.x0_model->Draw(flags);
if (xa0_chargeTickFirst.IsLoaded())
{
const CPlayerGun* gun = mgr.GetPlayer().GetPlayerGun();
int numTicks = int(g_tweakTargeting->GetChargeTickCount() *
(gun->IsCharging() ? gun->GetChargeBeamFactor() : 0.f));
for (int i=0 ; i<numTicks ; ++i)
{
CModelFlags flags(7, 0, 0, lockBreakColor + color);
xa0_chargeTickFirst->Draw(flags);
modelXf.rotateLocalY(g_tweakTargeting->GetChargeTickAnglePitch());
CGraphics::SetModelMatrix(modelXf);
}
}
}
if (x208_lockonTimer > 0.f && x70_innerBeamIcon.IsLoaded())
{
const zeus::CColor* iconColor;
switch (x200_beam)
{
case CPlayerState::EBeamId::Power:
iconColor = &g_tweakTargeting->GetInnerBeamColorPower();
break;
case CPlayerState::EBeamId::Ice:
iconColor = &g_tweakTargeting->GetInnerBeamColorIce();
break;
case CPlayerState::EBeamId::Wave:
iconColor = &g_tweakTargeting->GetInnerBeamColorWave();
break;
default:
iconColor = &g_tweakTargeting->GetInnerBeamColorPlasma();
break;
}
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetInnerBeamClampMin(),
g_tweakTargeting->GetInnerBeamClampMax(), mgr) *
g_tweakTargeting->GetInnerBeamScale() * (x208_lockonTimer / g_tweakTargeting->GetLockonDuration()) /
x10c_currGroupInterp.GetFactor());
zeus::CTransform modelXf(lockBreakXf * rot * scale, x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = *iconColor;
color.a *= lockBreakAlpha * visorFactor;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
x70_innerBeamIcon->Draw(flags);
}
if (x210_lockFireTimer > 0.f && x7c_lockFire.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetLockFireClampMin(),
g_tweakTargeting->GetLockFireClampMax(), mgr) *
g_tweakTargeting->GetLockFireScale() / x10c_currGroupInterp.GetFactor());
zeus::CTransform modelXf(lockBreakXf * rot * scale * zeus::CMatrix3f::RotateY(x1f0_xrayRetAngle),
x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetLockFireColor();
color.a *= visorFactor * lockBreakAlpha * (x210_lockFireTimer / g_tweakTargeting->GetLockFireDuration());
CModelFlags flags(7, 0, 0, lockBreakColor + color);
x7c_lockFire->Draw(flags);
}
if (x208_lockonTimer > 0.f && x88_lockDagger.IsLoaded())
{
float t = std::fabs((x210_lockFireTimer - 0.5f * g_tweakTargeting->GetLockFireDuration()) /
0.5f * g_tweakTargeting->GetLockFireDuration());
float tscale = ((1.f - t) * g_tweakTargeting->GetLockDaggerScaleEnd() +
t * g_tweakTargeting->GetLockDaggerScaleStart());
zeus::CMatrix3f scale(
CalculateClampedScale(x10c_currGroupInterp.GetTargetPositionWorld(),
x10c_currGroupInterp.GetRadiusWorld(),
x10c_currGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetLockDaggerClampMin(),
g_tweakTargeting->GetLockDaggerClampMax(), mgr) * tscale *
(x208_lockonTimer / g_tweakTargeting->GetLockonDuration()) / x10c_currGroupInterp.GetFactor());
zeus::CMatrix3f lockDaggerXf = rot * scale;
for (int i=0 ; i<3 ; ++i)
{
float ang;
switch (i)
{
case 0:
ang = g_tweakTargeting->GetLockDaggerAngle0();
break;
case 1:
ang = g_tweakTargeting->GetLockDaggerAngle1();
break;
default:
ang = g_tweakTargeting->GetLockDaggerAngle2();
break;
}
zeus::CTransform modelXf(lockBreakXf * lockDaggerXf * zeus::CMatrix3f::RotateY(ang),
x10c_currGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetLockDaggerColor();
color.a *= visorFactor * lockBreakAlpha;
CModelFlags flags(7, 0, 0, lockBreakColor + color);
x88_lockDagger->Draw(flags);
}
}
}
}
void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, const CStateManager& mgr) const
@ -416,7 +821,7 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
if (x28_noDrawTicks > 0)
return;
zeus::CVector3f x408 = x174_.GetTargetPositionWorld();
zeus::CVector3f position = x174_nextGroupInterp.GetTargetPositionWorld();
float visorFactor = mgr.GetPlayerState()->GetVisorTransitionFactor();
bool scanRet = false;
@ -437,17 +842,19 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
break;
}
if (!xrayRet && x174_.GetFactor() > 0.f && x40_seeker.IsLoaded())
if (!xrayRet && x174_nextGroupInterp.GetFactor() > 0.f && x40_seeker.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x408, x174_.GetRadiusWorld(),
x174_.GetMinViewportClampScale() * g_tweakTargeting->GetSeekerClampMin(),
g_tweakTargeting->GetSeekerClampMax(), mgr) * g_tweakTargeting->GetSeekerScale());
CalculateClampedScale(position, x174_nextGroupInterp.GetRadiusWorld(),
x174_nextGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetSeekerClampMin(),
g_tweakTargeting->GetSeekerClampMax(), mgr) *
g_tweakTargeting->GetSeekerScale());
zeus::CTransform modelXf(rot * zeus::CMatrix3f::RotateY(x1ec_seekerAngle) * scale,
x174_.GetTargetPositionWorld());
x174_nextGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetSeekerColor();
color.a *= x174_.GetFactor();
color.a *= x174_nextGroupInterp.GetFactor();
CModelFlags flags(7, 0, 0, color);
x40_seeker->Draw(flags);
}
@ -455,12 +862,13 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
if (xrayRet && xac_xrayRetRing.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x408, x174_.GetRadiusWorld(),
x174_.GetMinViewportClampScale() * g_tweakTargeting->GetReticuleClampMin(),
CalculateClampedScale(position, x174_nextGroupInterp.GetRadiusWorld(),
x174_nextGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetReticuleClampMin(),
g_tweakTargeting->GetReticuleClampMax(), mgr) *
g_tweakTargeting->GetReticuleScale());
zeus::CTransform modelXf(rot * scale * zeus::CMatrix3f::RotateY(x1f0_xrayRetAngle),
x174_.GetTargetPositionWorld());
x174_nextGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetXRayRetRingColor();
color.a *= visorFactor;
@ -471,11 +879,12 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
if (thermalRet && xb8_thermalReticle.IsLoaded())
{
zeus::CMatrix3f scale(
CalculateClampedScale(x408, x174_.GetRadiusWorld(),
x174_.GetMinViewportClampScale() * g_tweakTargeting->GetReticuleClampMin(),
CalculateClampedScale(position, x174_nextGroupInterp.GetRadiusWorld(),
x174_nextGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetReticuleClampMin(),
g_tweakTargeting->GetReticuleClampMax(), mgr) *
g_tweakTargeting->GetReticuleScale());
zeus::CTransform modelXf(rot * scale, x174_.GetTargetPositionWorld());
zeus::CTransform modelXf(rot * scale, x174_nextGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
zeus::CColor color = g_tweakTargeting->GetThermalReticuleColor();
color.a *= visorFactor;
@ -485,13 +894,14 @@ void CCompoundTargetReticle::DrawNextLockOnGroup(const zeus::CMatrix3f& rot, con
if (scanRet && visorFactor > 0.f)
{
float factor = visorFactor * x174_.GetFactor();
float factor = visorFactor * x174_nextGroupInterp.GetFactor();
zeus::CMatrix3f scale(
CalculateClampedScale(x408, x174_.GetRadiusWorld(),
x174_.GetMinViewportClampScale() * g_tweakTargeting->GetScanTargetClampMin(),
CalculateClampedScale(position, x174_nextGroupInterp.GetRadiusWorld(),
x174_nextGroupInterp.GetMinViewportClampScale() *
g_tweakTargeting->GetScanTargetClampMin(),
g_tweakTargeting->GetScanTargetClampMax(), mgr) *
(1.f / factor));
zeus::CTransform modelXf(rot * scale, x174_.GetTargetPositionWorld());
zeus::CTransform modelXf(rot * scale, x174_nextGroupInterp.GetTargetPositionWorld());
CGraphics::SetModelMatrix(modelXf);
// compare, GX_LESS, no update
float alpha = 0.5f * factor;

View File

@ -1,11 +1,11 @@
#ifndef __CCOMPOUNDTARGETRETICLE_HPP__
#define __CCOMPOUNDTARGETRETICLE_HPP__
#include <Runtime/CPlayerState.hpp>
#include "RetroTypes.hpp"
#include "zeus/CQuaternion.hpp"
#include "CToken.hpp"
#include "Graphics/CLineRenderer.hpp"
#include "CPlayerState.hpp"
namespace urde
{
@ -56,10 +56,10 @@ public:
struct SOuterItemInfo
{
TCachedToken<CModel> x0_model;
float xc_ = 0.f;
float x10_ = 0.f;
float x14_ = 0.f;
float x18_ = 0.f;
float xc_offshootBaseAngle = 0.f;
float x10_rotAng = 0.f;
float x14_baseAngle = 0.f;
float x18_offshootAngleDelta = 0.f;
SOuterItemInfo(const char*);
};
@ -112,20 +112,20 @@ private:
TCachedToken<CModel> xb8_thermalReticle;
SOuterItemInfo xc4_chargeGauge;
std::vector<SOuterItemInfo> xe0_outerBeamIconSquares;
TUniqueId xf0_;
TUniqueId xf2_;
TUniqueId xf0_targetId;
TUniqueId xf2_nextTargetId;
zeus::CVector3f xf4_targetPos;
zeus::CVector3f x100_laggingTargetPos;
CTargetReticleRenderState x10c_ = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x12c_ = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x14c_ = CTargetReticleRenderState::skZeroRenderState;
float x16c_ = 0.f;
float x170_ = 0.f;
CTargetReticleRenderState x174_ = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x194_ = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x1b4_ = CTargetReticleRenderState::skZeroRenderState;
float x1d4_ = 0.f;
float x1d8_ = 0.f;
CTargetReticleRenderState x10c_currGroupInterp = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x12c_currGroupA = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x14c_currGroupB = CTargetReticleRenderState::skZeroRenderState;
float x16c_currGroupDur = 0.f;
float x170_currGroupTimer = 0.f;
CTargetReticleRenderState x174_nextGroupInterp = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x194_nextGroupA = CTargetReticleRenderState::skZeroRenderState;
CTargetReticleRenderState x1b4_nextGroupB = CTargetReticleRenderState::skZeroRenderState;
float x1d4_nextGroupDur = 0.f;
float x1d8_nextGroupTimer = 0.f;
TUniqueId x1dc_grapplePoint0 = kInvalidUniqueId;
TUniqueId x1de_grapplePoint1 = kInvalidUniqueId;
float x1e0_grapplePoint0T = 0.f;
@ -134,14 +134,14 @@ private:
float x1ec_seekerAngle = 0.f;
float x1f0_xrayRetAngle = 0.f;
bool x1f4_missileActive = false;
float x1f8_ = 0.f;
float x1fc_ = 0.f;
float x1f8_missileBracketTimer = 0.f;
float x1fc_missileBracketScaleTimer = 0.f;
CPlayerState::EBeamId x200_beam = CPlayerState::EBeamId::Power;
float x204_ = 0.f;
float x208_;
float x204_chargeGaugeOvershootTimer = 0.f;
float x208_lockonTimer;
float x20c_ = 0.f;
float x210_ = 0.f;
float x214_ = 0.f;
float x210_lockFireTimer = 0.f;
float x214_fullChargeFadeTimer = 0.f;
bool x218_beamShot = false;
bool x219_missileShot = false;
bool x21a_fullyCharged = false;

View File

@ -685,6 +685,8 @@ public:
const zeus::CVector3f& GetLeaveMorphDir() const { return x518_leaveMorphDir; }
u32 GetBombJumpCount() const { return x9d0_bombJumpCount; }
float GetMoveSpeed() const { return x4f8_moveSpeed; }
EPlayerOrbitRequest GetOrbitRequest() const { return x30c_orbitRequest; }
bool IsShowingCrosshairs() const { return x9c4_25_showCrosshairs; }
};
}