Work on CPlayerVisor

This commit is contained in:
Jack Andersen 2017-05-29 17:45:31 -10:00
parent 58d8d4fcd2
commit 0c5e4efc46
19 changed files with 636 additions and 150 deletions

View File

@ -62,6 +62,9 @@ struct ITweakGuiColors : BigYAML
virtual const zeus::CColor& GetThreatWarningOutline() const=0;
virtual const zeus::CColor& GetMissileWarningOutline() const=0;
virtual const zeus::CColor& GetDamageAmbientColor() const=0;
virtual const zeus::CColor& GetScanFrameInactiveColor() const=0;
virtual const zeus::CColor& GetScanFrameActiveColor() const=0;
virtual const zeus::CColor& GetScanFrameImpulseColor() const=0;
virtual const zeus::CColor& GetScanVisorHudLightMultiply() const=0;
virtual const zeus::CColor& GetScanVisorScreenDimColor() const=0;
virtual const zeus::CColor& GetThermalVisorHudLightMultiply() const=0;
@ -84,6 +87,10 @@ struct ITweakGuiColors : BigYAML
virtual const zeus::CColor& GetThreatIconWarningColor() const=0;
virtual const zeus::CColor& GetHudCounterFill() const=0;
virtual const zeus::CColor& GetHudCounterOutline() const=0;
virtual const zeus::CColor& GetScanIconCriticalColor() const=0;
virtual const zeus::CColor& GetScanIconCriticalDimColor() const=0;
virtual const zeus::CColor& GetScanIconNoncriticalColor() const=0;
virtual const zeus::CColor& GetScanIconNoncriticalDimColor() const=0;
virtual const zeus::CColor& GetThreatDigitsFont() const=0;
virtual const zeus::CColor& GetThreatDigitsOutline() const=0;
virtual const zeus::CColor& GetMissileDigitsFont() const=0;

View File

@ -14,8 +14,17 @@ struct ITweakPlayer : ITweak
virtual float GetX58() const=0;
virtual float GetX5C() const=0;
virtual float GetHudLagAmount() const=0;
virtual uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const=0;
virtual uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const=0;
virtual uint32_t GetOrbitScreenBoxCenterX(int zone) const=0;
virtual uint32_t GetOrbitScreenBoxCenterY(int zone) const=0;
virtual uint32_t GetEnemyScreenBoxCenterX(int zone) const=0;
virtual uint32_t GetEnemyScreenBoxCenterY(int zone) const=0;
virtual float GetOrbitNearX() const=0;
virtual float GetOrbitNearZ() const=0;
virtual float GetScanningRange() const=0; // x218
virtual bool GetScanFreezesGame() const=0; // x21c_25
virtual float GetScanningFrameSenseRange() const=0;
virtual float GetPlayerHeight() const=0; // x26c
virtual float GetPlayerXYHalfExtent() const=0; // x270
virtual bool GetX228_24() const=0; // x228_24

View File

@ -8,6 +8,8 @@ struct ITweakTargeting : public ITweak
{
virtual float GetOvershootOffset() const =0;
virtual float GetXD0() const = 0;
virtual float GetScanTargetClampMin() const=0;
virtual float GetScanTargetClampMax() const=0;
};
}

View File

@ -59,9 +59,9 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor xbc_missileWarningOutline;
DNAColor xc0_;
DNAColor xc4_damageAmbientColor;
DNAColor xc8_;
DNAColor xcc_;
DNAColor xd0_;
DNAColor xc8_scanFrameInactiveColor;
DNAColor xcc_scanFrameActiveColor;
DNAColor xd0_scanFrameImpulseColor;
DNAColor xd4_scanVisorHudLightMultiply;
DNAColor xd8_scanVisorScreenDimColor;
DNAColor xdc_thermalVisorHudLightMultiply;
@ -107,10 +107,10 @@ struct CTweakGuiColors : public ITweakGuiColors
DNAColor x17c_threatIconWarningColor;
DNAColor x180_hudCounterFill;
DNAColor x184_hudCounterOutline;
DNAColor x188_;
DNAColor x18c_;
DNAColor x190_;
DNAColor x194_;
DNAColor x188_scanIconCriticalColor;
DNAColor x18c_scanIconCriticalDimColor;
DNAColor x190_scanIconNoncriticalColor;
DNAColor x194_scanIconNoncriticalDimColor;
DNAColor x198_;
DNAColor x19c_threatDigitsFont;
DNAColor x1a0_threatDigitsOutline;
@ -180,6 +180,9 @@ struct CTweakGuiColors : public ITweakGuiColors
const zeus::CColor& GetThreatWarningOutline() const { return xb8_threatWarningOutline; }
const zeus::CColor& GetMissileWarningOutline() const { return xbc_missileWarningOutline; }
const zeus::CColor& GetDamageAmbientColor() const { return xc4_damageAmbientColor; }
const zeus::CColor& GetScanFrameInactiveColor() const { return xc8_scanFrameInactiveColor; }
const zeus::CColor& GetScanFrameActiveColor() const { return xcc_scanFrameActiveColor; }
const zeus::CColor& GetScanFrameImpulseColor() const { return xd0_scanFrameImpulseColor; }
const zeus::CColor& GetScanVisorHudLightMultiply() const { return xd4_scanVisorHudLightMultiply; }
const zeus::CColor& GetScanVisorScreenDimColor() const { return xd8_scanVisorScreenDimColor; }
const zeus::CColor& GetThermalVisorHudLightMultiply() const { return xdc_thermalVisorHudLightMultiply; }
@ -202,6 +205,10 @@ struct CTweakGuiColors : public ITweakGuiColors
const zeus::CColor& GetThreatIconWarningColor() const { return x17c_threatIconWarningColor; }
const zeus::CColor& GetHudCounterFill() const { return x180_hudCounterFill; }
const zeus::CColor& GetHudCounterOutline() const { return x184_hudCounterOutline; }
const zeus::CColor& GetScanIconCriticalColor() const { return x188_scanIconCriticalColor; }
const zeus::CColor& GetScanIconCriticalDimColor() const { return x18c_scanIconCriticalDimColor; }
const zeus::CColor& GetScanIconNoncriticalColor() const { return x190_scanIconNoncriticalColor; }
const zeus::CColor& GetScanIconNoncriticalDimColor() const { return x194_scanIconNoncriticalDimColor; }
const zeus::CColor& GetThreatDigitsFont() const { return x19c_threatDigitsFont; }
const zeus::CColor& GetThreatDigitsOutline() const { return x1a0_threatDigitsOutline; }
const zeus::CColor& GetMissileDigitsFont() const { return x1a4_missileDigitsFont; }

View File

@ -292,33 +292,33 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
/* x1a4_ */
x1a4_ = __dna_reader.readFloatBig();
/* x1a8_[0] */
x1a8_[0] = __dna_reader.readUint32Big();
x1a8_orbitScreenBoxHalfExtentX[0] = __dna_reader.readUint32Big();
/* x1b0_[0] */
x1b0_[0] = __dna_reader.readUint32Big();
x1b0_orbitScreenBoxHalfExtentY[0] = __dna_reader.readUint32Big();
/* x1b8_[0] */
x1b8_[0] = __dna_reader.readUint32Big();
x1b8_orbitScreenBoxCenterX[0] = __dna_reader.readUint32Big();
/* x1c0_[0] */
x1c0_[0] = __dna_reader.readUint32Big();
x1c0_orbitScreenBoxCenterY[0] = __dna_reader.readUint32Big();
/* x1c8_[0] */
x1c8_[0] = __dna_reader.readUint32Big();
x1c8_enemyScreenBoxCenterX[0] = __dna_reader.readUint32Big();
/* x1d0_[0] */
x1d0_[0] = __dna_reader.readUint32Big();
x1d0_enemyScreenBoxCenterY[0] = __dna_reader.readUint32Big();
/* x1a8_[1] */
x1a8_[1] = __dna_reader.readUint32Big();
x1a8_orbitScreenBoxHalfExtentX[1] = __dna_reader.readUint32Big();
/* x1b0_[1] */
x1b0_[1] = __dna_reader.readUint32Big();
x1b0_orbitScreenBoxHalfExtentY[1] = __dna_reader.readUint32Big();
/* x1b8_[1] */
x1b8_[1] = __dna_reader.readUint32Big();
x1b8_orbitScreenBoxCenterX[1] = __dna_reader.readUint32Big();
/* x1c0_[1] */
x1c0_[1] = __dna_reader.readUint32Big();
x1c0_orbitScreenBoxCenterY[1] = __dna_reader.readUint32Big();
/* x1c8_[1] */
x1c8_[1] = __dna_reader.readUint32Big();
x1c8_enemyScreenBoxCenterX[1] = __dna_reader.readUint32Big();
/* x1d0_[1] */
x1d0_[1] = __dna_reader.readUint32Big();
x1d0_enemyScreenBoxCenterY[1] = __dna_reader.readUint32Big();
/* x1d8_ */
x1d8_ = __dna_reader.readFloatBig();
x1d8_orbitNearX = __dna_reader.readFloatBig();
/* x1dc_ */
x1dc_ = __dna_reader.readFloatBig();
x1dc_orbitNearZ = __dna_reader.readFloatBig();
/* x1e0_ */
x1e0_ = __dna_reader.readFloatBig();
/* x1e4_ */
@ -360,7 +360,7 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
/* x220_ */
x220_ = __dna_reader.readFloatBig();
/* x224_ */
x224_ = __dna_reader.readFloatBig();
x224_scanningFrameSenseRange = __dna_reader.readFloatBig();
/* x2a0_ */
x2a0_ = __dna_reader.readFloatBig();
/* x2a4_ */
@ -732,33 +732,33 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
/* x1a4_ */
__dna_writer.writeFloatBig(x1a4_);
/* x1a8_[0] */
__dna_writer.writeUint32Big(x1a8_[0]);
__dna_writer.writeUint32Big(x1a8_orbitScreenBoxHalfExtentX[0]);
/* x1b0_[0] */
__dna_writer.writeUint32Big(x1b0_[0]);
__dna_writer.writeUint32Big(x1b0_orbitScreenBoxHalfExtentY[0]);
/* x1b8_[0] */
__dna_writer.writeUint32Big(x1b8_[0]);
__dna_writer.writeUint32Big(x1b8_orbitScreenBoxCenterX[0]);
/* x1c0_[0] */
__dna_writer.writeUint32Big(x1c0_[0]);
__dna_writer.writeUint32Big(x1c0_orbitScreenBoxCenterY[0]);
/* x1c8_[0] */
__dna_writer.writeUint32Big(x1c8_[0]);
__dna_writer.writeUint32Big(x1c8_enemyScreenBoxCenterX[0]);
/* x1d0_[0] */
__dna_writer.writeUint32Big(x1d0_[0]);
__dna_writer.writeUint32Big(x1d0_enemyScreenBoxCenterY[0]);
/* x1a8_[1] */
__dna_writer.writeUint32Big(x1a8_[1]);
__dna_writer.writeUint32Big(x1a8_orbitScreenBoxHalfExtentX[1]);
/* x1b0_[1] */
__dna_writer.writeUint32Big(x1b0_[1]);
__dna_writer.writeUint32Big(x1b0_orbitScreenBoxHalfExtentY[1]);
/* x1b8_[1] */
__dna_writer.writeUint32Big(x1b8_[1]);
__dna_writer.writeUint32Big(x1b8_orbitScreenBoxCenterX[1]);
/* x1c0_[1] */
__dna_writer.writeUint32Big(x1c0_[1]);
__dna_writer.writeUint32Big(x1c0_orbitScreenBoxCenterY[1]);
/* x1c8_[1] */
__dna_writer.writeUint32Big(x1c8_[1]);
__dna_writer.writeUint32Big(x1c8_enemyScreenBoxCenterX[1]);
/* x1d0_[1] */
__dna_writer.writeUint32Big(x1d0_[1]);
__dna_writer.writeUint32Big(x1d0_enemyScreenBoxCenterY[1]);
/* x1d8_ */
__dna_writer.writeFloatBig(x1d8_);
__dna_writer.writeFloatBig(x1d8_orbitNearX);
/* x1dc_ */
__dna_writer.writeFloatBig(x1dc_);
__dna_writer.writeFloatBig(x1dc_orbitNearZ);
/* x1e0_ */
__dna_writer.writeFloatBig(x1e0_);
/* x1e4_ */
@ -800,7 +800,7 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
/* x220_ */
__dna_writer.writeFloatBig(x220_);
/* x224_ */
__dna_writer.writeFloatBig(x224_);
__dna_writer.writeFloatBig(x224_scanningFrameSenseRange);
/* x2a0_ */
__dna_writer.writeFloatBig(x2a0_);
/* x2a4_ */
@ -1221,59 +1221,59 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
if (auto v = __dna_docin.enterSubVector("x1a8_", __x1a8_Count))
{
/* x1a8_[0] */
x1a8_[0] = __dna_docin.readUint32("x1a8_");
x1a8_orbitScreenBoxHalfExtentX[0] = __dna_docin.readUint32("x1a8_");
/* x1a8_[1] */
x1a8_[1] = __dna_docin.readUint32("x1a8_");
x1a8_orbitScreenBoxHalfExtentX[1] = __dna_docin.readUint32("x1a8_");
}
/* x1b0_ */
size_t __x1b0_Count;
if (auto v = __dna_docin.enterSubVector("x1b0_", __x1b0_Count))
{
/* x1b0_[0] */
x1b0_[0] = __dna_docin.readUint32("x1b0_");
x1b0_orbitScreenBoxHalfExtentY[0] = __dna_docin.readUint32("x1b0_");
/* x1b0_[1] */
x1b0_[1] = __dna_docin.readUint32("x1b0_");
x1b0_orbitScreenBoxHalfExtentY[1] = __dna_docin.readUint32("x1b0_");
}
/* x1b8_ */
size_t __x1b8_Count;
if (auto v = __dna_docin.enterSubVector("x1b8_", __x1b8_Count))
{
/* x1b8_[0] */
x1b8_[0] = __dna_docin.readUint32("x1b8_");
x1b8_orbitScreenBoxCenterX[0] = __dna_docin.readUint32("x1b8_");
/* x1b8_[1] */
x1b8_[1] = __dna_docin.readUint32("x1b8_");
x1b8_orbitScreenBoxCenterX[1] = __dna_docin.readUint32("x1b8_");
}
/* x1c0_ */
size_t __x1c0_Count;
if (auto v = __dna_docin.enterSubVector("x1c0_", __x1c0_Count))
{
/* x1c0_[0] */
x1c0_[0] = __dna_docin.readUint32("x1c0_");
x1c0_orbitScreenBoxCenterY[0] = __dna_docin.readUint32("x1c0_");
/* x1c0_[1] */
x1c0_[1] = __dna_docin.readUint32("x1c0_");
x1c0_orbitScreenBoxCenterY[1] = __dna_docin.readUint32("x1c0_");
}
/* x1c8_ */
size_t __x1c8_Count;
if (auto v = __dna_docin.enterSubVector("x1c8_", __x1c8_Count))
{
/* x1c8_[0] */
x1c8_[0] = __dna_docin.readUint32("x1c8_");
x1c8_enemyScreenBoxCenterX[0] = __dna_docin.readUint32("x1c8_");
/* x1c8_[1] */
x1c8_[1] = __dna_docin.readUint32("x1c8_");
x1c8_enemyScreenBoxCenterX[1] = __dna_docin.readUint32("x1c8_");
}
/* x1d0_ */
size_t __x1d0_Count;
if (auto v = __dna_docin.enterSubVector("x1d0_", __x1d0_Count))
{
/* x1d0_[0] */
x1d0_[0] = __dna_docin.readUint32("x1d0_");
x1d0_enemyScreenBoxCenterY[0] = __dna_docin.readUint32("x1d0_");
/* x1d0_[1] */
x1d0_[1] = __dna_docin.readUint32("x1d0_");
x1d0_enemyScreenBoxCenterY[1] = __dna_docin.readUint32("x1d0_");
}
/* x1d8_ */
x1d8_ = __dna_docin.readFloat("x1d8_");
x1d8_orbitNearX = __dna_docin.readFloat("x1d8_");
/* x1dc_ */
x1dc_ = __dna_docin.readFloat("x1dc_");
x1dc_orbitNearZ = __dna_docin.readFloat("x1dc_");
/* x1e0_ */
x1e0_ = __dna_docin.readFloat("x1e0_");
/* x1e4_ */
@ -1315,7 +1315,7 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
/* x220_ */
x220_ = __dna_docin.readFloat("x220_");
/* x224_ */
x224_ = __dna_docin.readFloat("x224_");
x224_scanningFrameSenseRange = __dna_docin.readFloat("x224_");
/* x2a0_ */
x2a0_ = __dna_docin.readFloat("x2a0_");
/* x2a4_ */
@ -1726,54 +1726,54 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
if (auto v = __dna_docout.enterSubVector("x1a8_"))
{
/* x1a8_[0] */
__dna_docout.writeUint32("x1a8_", x1a8_[0]);
__dna_docout.writeUint32("x1a8_", x1a8_orbitScreenBoxHalfExtentX[0]);
/* x1a8_[1] */
__dna_docout.writeUint32("x1a8_", x1a8_[1]);
__dna_docout.writeUint32("x1a8_", x1a8_orbitScreenBoxHalfExtentX[1]);
}
/* x1b0_ */
if (auto v = __dna_docout.enterSubVector("x1b0_"))
{
/* x1b0_[0] */
__dna_docout.writeUint32("x1b0_", x1b0_[0]);
__dna_docout.writeUint32("x1b0_", x1b0_orbitScreenBoxHalfExtentY[0]);
/* x1b0_[1] */
__dna_docout.writeUint32("x1b0_", x1b0_[1]);
__dna_docout.writeUint32("x1b0_", x1b0_orbitScreenBoxHalfExtentY[1]);
}
/* x1b8_ */
if (auto v = __dna_docout.enterSubVector("x1b8_"))
{
/* x1b8_[0] */
__dna_docout.writeUint32("x1b8_", x1b8_[0]);
__dna_docout.writeUint32("x1b8_", x1b8_orbitScreenBoxCenterX[0]);
/* x1b8_[1] */
__dna_docout.writeUint32("x1b8_", x1b8_[1]);
__dna_docout.writeUint32("x1b8_", x1b8_orbitScreenBoxCenterX[1]);
}
/* x1c0_ */
if (auto v = __dna_docout.enterSubVector("x1c0_"))
{
/* x1c0_[0] */
__dna_docout.writeUint32("x1c0_", x1c0_[0]);
__dna_docout.writeUint32("x1c0_", x1c0_orbitScreenBoxCenterY[0]);
/* x1c0_[1] */
__dna_docout.writeUint32("x1c0_", x1c0_[1]);
__dna_docout.writeUint32("x1c0_", x1c0_orbitScreenBoxCenterY[1]);
}
/* x1c8_ */
if (auto v = __dna_docout.enterSubVector("x1c8_"))
{
/* x1c8_[0] */
__dna_docout.writeUint32("x1c8_", x1c8_[0]);
__dna_docout.writeUint32("x1c8_", x1c8_enemyScreenBoxCenterX[0]);
/* x1c8_[1] */
__dna_docout.writeUint32("x1c8_", x1c8_[1]);
__dna_docout.writeUint32("x1c8_", x1c8_enemyScreenBoxCenterX[1]);
}
/* x1d0_ */
if (auto v = __dna_docout.enterSubVector("x1d0_"))
{
/* x1d0_[0] */
__dna_docout.writeUint32("x1d0_", x1d0_[0]);
__dna_docout.writeUint32("x1d0_", x1d0_enemyScreenBoxCenterY[0]);
/* x1d0_[1] */
__dna_docout.writeUint32("x1d0_", x1d0_[1]);
__dna_docout.writeUint32("x1d0_", x1d0_enemyScreenBoxCenterY[1]);
}
/* x1d8_ */
__dna_docout.writeFloat("x1d8_", x1d8_);
__dna_docout.writeFloat("x1d8_", x1d8_orbitNearX);
/* x1dc_ */
__dna_docout.writeFloat("x1dc_", x1dc_);
__dna_docout.writeFloat("x1dc_", x1dc_orbitNearZ);
/* x1e0_ */
__dna_docout.writeFloat("x1e0_", x1e0_);
/* x1e4_ */
@ -1815,7 +1815,7 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
/* x220_ */
__dna_docout.writeFloat("x220_", x220_);
/* x224_ */
__dna_docout.writeFloat("x224_", x224_);
__dna_docout.writeFloat("x224_", x224_scanningFrameSenseRange);
/* x2a0_ */
__dna_docout.writeFloat("x2a0_", x2a0_);
/* x2a4_ */

View File

@ -68,14 +68,14 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x19c_;
Value<float> x1a0_;
Value<float> x1a4_;
Value<atUint32> x1a8_[2];
Value<atUint32> x1b0_[2];
Value<atUint32> x1b8_[2];
Value<atUint32> x1c0_[2];
Value<atUint32> x1c8_[2];
Value<atUint32> x1d0_[2];
Value<float> x1d8_;
Value<float> x1dc_;
Value<atUint32> x1a8_orbitScreenBoxHalfExtentX[2];
Value<atUint32> x1b0_orbitScreenBoxHalfExtentY[2];
Value<atUint32> x1b8_orbitScreenBoxCenterX[2];
Value<atUint32> x1c0_orbitScreenBoxCenterY[2];
Value<atUint32> x1c8_enemyScreenBoxCenterX[2];
Value<atUint32> x1d0_enemyScreenBoxCenterY[2];
Value<float> x1d8_orbitNearX;
Value<float> x1dc_orbitNearZ;
Value<float> x1e0_;
Value<float> x1e4_;
Value<float> x1e8_;
@ -96,7 +96,7 @@ struct CTweakPlayer : ITweakPlayer
Value<bool> x21c_25_scanFreezesGame : 1;
Value<bool> x21c_26_ : 1;
Value<float> x220_;
Value<float> x224_;
Value<float> x224_scanningFrameSenseRange;
Value<bool> x228_24_ : 1;
Value<bool> x228_25_ : 1;
Value<bool> x228_26_ : 1;
@ -180,8 +180,17 @@ struct CTweakPlayer : ITweakPlayer
float GetX58() const { return x44_[5]; }
float GetX5C() const { return x44_[6]; }
float GetHudLagAmount() const { return x138_hudLagAmount; }
uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const { return x1a8_orbitScreenBoxHalfExtentX[zone]; }
uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const { return x1b0_orbitScreenBoxHalfExtentY[zone]; }
uint32_t GetOrbitScreenBoxCenterX(int zone) const { return x1b8_orbitScreenBoxCenterX[zone]; }
uint32_t GetOrbitScreenBoxCenterY(int zone) const { return x1c0_orbitScreenBoxCenterY[zone]; }
uint32_t GetEnemyScreenBoxCenterX(int zone) const { return x1c8_enemyScreenBoxCenterX[zone]; }
uint32_t GetEnemyScreenBoxCenterY(int zone) const { return x1d0_enemyScreenBoxCenterY[zone]; }
float GetOrbitNearX() const { return x1d8_orbitNearX; }
float GetOrbitNearZ() const { return x1dc_orbitNearZ; }
float GetScanningRange() const { return x218_scanningRange; }
bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; }
float GetScanningFrameSenseRange() const { return x224_scanningFrameSenseRange; }
float GetPlayerHeight() const { return x26c_playerHeight; }
float GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; }
float GetX274() const { return x274_; }

View File

@ -134,8 +134,8 @@ struct CTweakTargeting : public ITweakTargeting
Value<float> x210_;
Value<atVec4f> x214_;
Value<float> x218_;
Value<float> x21c_;
Value<float> x220_;
Value<float> x21c_scanTargetClampMin;
Value<float> x220_scanTargetClampMax;
Value<float> x224_;
CTweakTargeting() = default;
@ -150,6 +150,8 @@ struct CTweakTargeting : public ITweakTargeting
float GetOvershootOffset() const { return xe8_overshootOffset; }
float GetXD0() const { return xd0_; }
float GetScanTargetClampMin() const { return x21c_scanTargetClampMin; }
float GetScanTargetClampMax() const { return x220_scanTargetClampMax; }
};
}
}

View File

@ -41,8 +41,6 @@ void CFirstPersonCamera::SkipCinematic()
x1d4_ = 0.f;
}
zeus::CTransform CFirstPersonCamera::GetGunFollowTransform() { return x190_gunFollowXf; }
void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransform& gunXf, zeus::CQuaternion& gunQ,
float dt, zeus::CVector3f& rVec)
{

View File

@ -35,7 +35,7 @@ public:
void Reset(const zeus::CTransform&, CStateManager& mgr);
void SkipCinematic();
zeus::CTransform GetGunFollowTransform();
const zeus::CTransform& GetGunFollowTransform() const { return x190_gunFollowXf; }
void UpdateTransform(CStateManager&, float dt);
void UpdateElevation(CStateManager&);
void CalculateGunFollowOrientationAndTransform(zeus::CTransform&, zeus::CQuaternion&, float, zeus::CVector3f&);

View File

@ -33,7 +33,15 @@ struct CModelFlags
CModelFlags() = default;
CModelFlags(u8 blendMode, u8 shadIdx, u16 flags, const zeus::CColor& col)
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col) {}
: x0_blendMode(blendMode), x1_matSetIdx(shadIdx), x2_flags(flags), x4_color(col)
{
if (blendMode > 6)
m_extendedShader = EExtendedShader::ForcedAdditive;
else if (blendMode > 4)
m_extendedShader = EExtendedShader::ForcedAlpha;
else
m_extendedShader = EExtendedShader::Lighting;
}
/* Flags
0x1: depth equal

View File

@ -56,4 +56,17 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
}
zeus::CVector3f CCompoundTargetReticle::CalculateOrbitZoneReticlePosition(const CStateManager&) const { return {}; }
float CCompoundTargetReticle::CalculateClampedScale(const zeus::CVector3f& pos, float scale,
float clampMin, float clampMax,
const CStateManager& mgr)
{
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
zeus::CVector3f viewPos = cam->GetTransform().transposeRotate(pos - cam->GetTransform().origin);
float unclampedX = (cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x -
cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x) * 640.f;
return zeus::clamp(clampMin, unclampedX, clampMax) / unclampedX * scale;
}
}

View File

@ -148,7 +148,7 @@ public:
zeus::CVector3f CalculatePositionWorld(const CActor&, const CStateManager&) const;
zeus::CVector3f CalculateOrbitZoneReticlePosition(const CStateManager&) const;
bool IsGrappleTarget(TUniqueId, const CStateManager&) const;
void CalculateClampedScale(const zeus::CVector3f&, float, float, float, const CStateManager&);
static float CalculateClampedScale(const zeus::CVector3f&, float, float, float, const CStateManager&);
void Touch() const;
};
}

View File

@ -4,11 +4,11 @@
#include "CInGameGuiManagerCommon.hpp"
#include "CToken.hpp"
#include "Camera/CCameraFilter.hpp"
#include "Graphics/CTexture.hpp"
namespace urde
{
class CStateManager;
class CTexture;
namespace MP1
{

View File

@ -4,6 +4,10 @@
#include "Graphics/CModel.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
#include "TCastTo.hpp"
#include "Camera/CGameCamera.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "GuiSys/CCompoundTargetReticle.hpp"
namespace urde
{
@ -33,7 +37,7 @@ CPlayerVisor::CPlayerVisor(CStateManager&)
CPlayerVisor::~CPlayerVisor()
{
CSfxManager::SfxStop(x5c_visorLoopSfx);
CSfxManager::SfxStop(x60_);
CSfxManager::SfxStop(x60_scanningLoopSfx);
}
int CPlayerVisor::FindEmptyInactiveScanTarget() const
@ -41,7 +45,7 @@ int CPlayerVisor::FindEmptyInactiveScanTarget() const
for (int i=0 ; i<x13c_scanTargets.size() ; ++i)
{
const SScanTarget& tgt = x13c_scanTargets[i];
if (tgt.x4_ == 0.f)
if (tgt.x4_timer == 0.f)
return i;
}
return -1;
@ -52,25 +56,253 @@ int CPlayerVisor::FindCachedInactiveScanTarget(TUniqueId uid) const
for (int i=0 ; i<x13c_scanTargets.size() ; ++i)
{
const SScanTarget& tgt = x13c_scanTargets[i];
if (tgt.x0_objId == uid && tgt.x4_ > 0.f)
if (tgt.x0_objId == uid && tgt.x4_timer > 0.f)
return i;
}
return -1;
}
void CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const
bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const
{
if (!x124_scanIconNoncritical.IsLoaded() || !x130_scanIconCritical.IsLoaded())
return false;
if (!x114_scanShield.IsLoaded())
return false;
CGraphics::SetDepthRange(0.125f, 1.f);
g_Renderer->SetViewportOrtho(true, 0.f, 4096.f);
CGraphics::SetModelMatrix(
zeus::CTransform::Scale(x48_interpWindowDims.x * 17.f, 1.f, x48_interpWindowDims.y * 17.f));
x114_scanShield->Draw(CModelFlags(5, 0, 3, zeus::CColor::skClear));
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
zeus::CTransform camMtx = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
CGraphics::SetViewPointMatrix(camMtx);
zeus::CFrustum frustum;
frustum.updatePlanes(camMtx, zeus::CProjection(zeus::SProjPersp(cam->GetFov(), cam->GetAspectRatio(), 1.f, 100.f)));
g_Renderer->SetClippingPlanes(frustum);
g_Renderer->SetPerspective(cam->GetFov(), g_Viewport.x8_width, g_Viewport.xc_height,
cam->GetNearClipDistance(), cam->GetFarClipDistance());
for (const SScanTarget& tgt : x13c_scanTargets)
{
if (tgt.x4_timer == 0.f)
continue;
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(tgt.x0_objId))
{
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
continue;
const CScannableObjectInfo* scanInfo = act->GetScannableObjectInfo();
const CModel* useModel;
const zeus::CColor* useColor;
const zeus::CColor* useDimColor;
if (scanInfo->IsImportant())
{
useModel = x130_scanIconCritical.GetObj();
useColor = &g_tweakGuiColors->GetScanIconCriticalColor();
useDimColor = &g_tweakGuiColors->GetScanIconCriticalDimColor();
}
else
{
useModel = x124_scanIconNoncritical.GetObj();
useColor = &g_tweakGuiColors->GetScanIconNoncriticalColor();
useDimColor = &g_tweakGuiColors->GetScanIconNoncriticalDimColor();
}
zeus::CVector3f scanPos = act->GetScanObjectIndicatorPosition(mgr);
float scale = CCompoundTargetReticle::CalculateClampedScale(scanPos, 1.f,
g_tweakTargeting->GetScanTargetClampMin(),
g_tweakTargeting->GetScanTargetClampMax(), mgr);
zeus::CTransform xf(zeus::CMatrix3f(scale), scanPos);
float scanRange = g_tweakPlayer->GetScanningRange();
float farRange = g_tweakPlayer->GetScanningFrameSenseRange() - scanRange;
float farT;
if (farRange <= 0.f)
farT = 1.f;
else
farT = zeus::clamp(0.f, 1.f - ((scanPos - camMtx.origin).magnitude() - scanRange) / farRange, 1.f);
zeus::CColor iconColor = zeus::CColor::lerp(*useColor, *useDimColor, tgt.x8_inRangeTimer);
float iconAlpha;
if (mgr.GetPlayerState()->GetScanTime(scanInfo->GetScannableObjectId()) == 1.f)
{
iconAlpha = tgt.x4_timer * 0.25f;
}
else
{
float tmp = 1.f;
if (mgr.GetPlayer().GetLockonObjectId() == tgt.x0_objId)
tmp = 0.75f * x2c_scanDimInterp + 0.25f;
iconAlpha = tgt.x4_timer * tmp;
}
CGraphics::SetModelMatrix(xf);
iconColor.a *= iconAlpha * farT;
useModel->Draw(CModelFlags(7, 0, 1, iconColor));
}
}
CGraphics::SetDepthRange(0.015625f, 0.03125f);
return true;
}
void CPlayerVisor::UpdateScanObjectIndicators(const CStateManager& mgr)
void CPlayerVisor::UpdateScanObjectIndicators(const CStateManager& mgr, float dt)
{
bool inBoxExists = false;
float dt2 = dt * 2.f;
for (SScanTarget& tgt : x13c_scanTargets)
{
tgt.x4_timer = std::max(0.f, tgt.x4_timer - dt);
if (mgr.GetPlayer().ObjectInScanningRange(tgt.x0_objId, mgr))
tgt.x8_inRangeTimer = std::max(0.f, tgt.x8_inRangeTimer - dt2);
else
tgt.x8_inRangeTimer = std::min(1.f, tgt.x8_inRangeTimer + dt2);
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(tgt.x0_objId))
{
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
zeus::CVector3f orbitPos = act->GetOrbitPosition(mgr);
orbitPos = cam->ConvertToScreenSpace(orbitPos);
orbitPos.x = orbitPos.x * g_Viewport.x8_width / 2.f + g_Viewport.x8_width / 2.f;
orbitPos.y = orbitPos.y * g_Viewport.xc_height / 2.f + g_Viewport.xc_height / 2.f;
bool inBox = mgr.GetPlayer().WithinOrbitScreenBox(orbitPos,
mgr.GetPlayer().GetOrbitZone(),
mgr.GetPlayer().GetOrbitType());
if (inBox != tgt.xc_inBox)
{
tgt.xc_inBox = inBox;
if (inBox)
x550_frameColorImpulseInterp = 1.f;
}
inBoxExists |= inBox;
}
}
if (inBoxExists)
x54c_frameColorInterp = std::min(x54c_frameColorInterp + dt2, 1.f);
else
x54c_frameColorInterp = std::max(0.f, x54c_frameColorInterp - dt2);
x550_frameColorImpulseInterp = std::max(0.f, x550_frameColorImpulseInterp - dt);
dt += FLT_EPSILON;
TAreaId playerArea = mgr.GetPlayer().GetAreaIdAlways();
for (TUniqueId id : mgr.GetPlayer().GetNearbyOrbitObjects())
{
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(id))
{
if (act->GetAreaIdAlways() != playerArea)
continue;
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
continue;
int target = FindCachedInactiveScanTarget(id);
if (target != -1)
{
SScanTarget& sTarget = x13c_scanTargets[target];
sTarget.x4_timer = std::min(sTarget.x4_timer + dt2, 1.f);
continue;
}
target = FindEmptyInactiveScanTarget();
if (target != -1)
{
SScanTarget& sTarget = x13c_scanTargets[target];
sTarget.x0_objId = id;
sTarget.x4_timer = dt;
sTarget.x8_inRangeTimer = 1.f;
sTarget.xc_inBox = false;
}
}
}
}
void CPlayerVisor::UpdateScanWindow(float dt, const CStateManager& mgr)
{
UpdateScanObjectIndicators(mgr, dt);
if (mgr.GetPlayer().GetScanningState() == CPlayer::EPlayerScanState::Scanning)
{
if (!x60_scanningLoopSfx)
x60_scanningLoopSfx = CSfxManager::SfxStart(1407, x24_visorSfxVol, 0.f,
false, 0x7f, true, kInvalidAreaId);
}
else
{
CSfxManager::SfxStop(x60_scanningLoopSfx);
x60_scanningLoopSfx.reset();
}
EScanWindowState desiredState = GetDesiredScanWindowState(mgr);
switch (x34_nextState)
{
case EScanWindowState::NotInScanVisor:
if (desiredState != EScanWindowState::NotInScanVisor)
{
if (x30_prevState == EScanWindowState::NotInScanVisor)
x48_interpWindowDims = x0_scanWindowSizes[int(desiredState)];
x50_nextWindowDims = x0_scanWindowSizes[int(desiredState)];
x40_prevWindowDims = x48_interpWindowDims;
x30_prevState = x34_nextState;
x34_nextState = desiredState;
x38_windowInterpDuration =
(desiredState == EScanWindowState::Scan) ? g_tweakGui->GetScanSidesEndTime() - x3c_windowInterpTimer : 0.f;
x3c_windowInterpTimer = x38_windowInterpDuration;
}
break;
case EScanWindowState::Idle:
if (desiredState != EScanWindowState::Idle)
{
x50_nextWindowDims = (desiredState == EScanWindowState::NotInScanVisor) ? x48_interpWindowDims :
x0_scanWindowSizes[int(desiredState)];
x40_prevWindowDims = x48_interpWindowDims;
x30_prevState = x34_nextState;
x34_nextState = desiredState;
x38_windowInterpDuration =
(desiredState == EScanWindowState::Scan) ? g_tweakGui->GetScanSidesEndTime() - x3c_windowInterpTimer : 0.f;
x3c_windowInterpTimer = x38_windowInterpDuration;
if (desiredState == EScanWindowState::Scan)
CSfxManager::SfxStart(1411, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
}
break;
case EScanWindowState::Scan:
if (desiredState != EScanWindowState::Scan)
{
x50_nextWindowDims = (desiredState == EScanWindowState::NotInScanVisor) ? x48_interpWindowDims :
x0_scanWindowSizes[int(desiredState)];
x40_prevWindowDims = x48_interpWindowDims;
x30_prevState = x34_nextState;
x34_nextState = desiredState;
x38_windowInterpDuration =
(desiredState == EScanWindowState::Scan) ? g_tweakGui->GetScanSidesEndTime() - x3c_windowInterpTimer : 0.f;
x3c_windowInterpTimer = x38_windowInterpDuration;
if (mgr.GetPlayerState()->GetVisorTransitionFactor() == 1.f)
CSfxManager::SfxStart(1409, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
}
break;
default: break;
}
if (x30_prevState != x34_nextState)
{
x3c_windowInterpTimer = std::max(0.f, x3c_windowInterpTimer - dt);
if (x3c_windowInterpTimer == 0.f)
x30_prevState = x34_nextState;
float t = 0.f;
if (x38_windowInterpDuration > 0.f)
{
float scanSidesDuration = g_tweakGui->GetScanSidesDuration();
float scanSidesStart = g_tweakGui->GetScanSidesStartTime();
if (x34_nextState == EScanWindowState::Scan)
t = (x3c_windowInterpTimer < scanSidesDuration) ? 0.f : (x3c_windowInterpTimer - scanSidesDuration) / scanSidesStart;
else
t = (x3c_windowInterpTimer > scanSidesStart) ? 1.f : x3c_windowInterpTimer / scanSidesStart;
}
x48_interpWindowDims = x50_nextWindowDims * (1.f - t) + x40_prevWindowDims * t;
}
}
CPlayerVisor::EScanWindowState
@ -92,12 +324,41 @@ CPlayerVisor::GetDesiredScanWindowState(const CStateManager& mgr) const
void CPlayerVisor::LockUnlockAssets()
{
if (x1c_curVisor == CPlayerState::EPlayerVisor::Scan)
x120_assetLockCountdown = 2;
else if (x120_assetLockCountdown > 0)
--x120_assetLockCountdown;
if (x120_assetLockCountdown > 0)
{
xcc_scanFrameCorner.Lock();
xd8_scanFrameCenterSide.Lock();
xe4_scanFrameCenterTop.Lock();
xf0_scanFrameStretchSide.Lock();
xfc_scanFrameStretchTop.Lock();
x108_newScanPane.Lock();
x114_scanShield.Lock();
x124_scanIconNoncritical.Lock();
x130_scanIconCritical.Lock();
}
else
{
xcc_scanFrameCorner.Unlock();
xd8_scanFrameCenterSide.Unlock();
xe4_scanFrameCenterTop.Unlock();
xf0_scanFrameStretchSide.Unlock();
xfc_scanFrameStretchTop.Unlock();
x108_newScanPane.Unlock();
x114_scanShield.Unlock();
x124_scanIconNoncritical.Unlock();
x130_scanIconCritical.Unlock();
}
}
void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingManager* tgtMgr) const
{
DrawScanObjectIndicators(mgr);
/* TODO: Finish */
}
void CPlayerVisor::DrawXRayEffect(const CStateManager&) const
@ -196,8 +457,8 @@ void CPlayerVisor::FinishTransitionOut(const CStateManager&)
break;
case CPlayerState::EPlayerVisor::Scan:
x64_scanDim.DisableFilter(0.f);
x34_ = 0;
x30_ = 0;
x34_nextState = EScanWindowState::NotInScanVisor;
x30_prevState = EScanWindowState::NotInScanVisor;
break;
case CPlayerState::EPlayerVisor::Thermal:
x90_xrayBlur.DisableBlur(0.f);
@ -220,10 +481,10 @@ void CPlayerVisor::BeginTransitionOut()
CSfxManager::SfxStart(1382, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
case CPlayerState::EPlayerVisor::Scan:
if (x60_)
if (x60_scanningLoopSfx)
{
CSfxManager::SfxStop(x60_);
x60_.reset();
CSfxManager::SfxStop(x60_scanningLoopSfx);
x60_scanningLoopSfx.reset();
}
CSfxManager::SfxStart(1382, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
@ -293,7 +554,7 @@ void CPlayerVisor::Update(float dt, const CStateManager& mgr)
{
x24_visorSfxVol = 0.f;
CSfxManager::SfxVolume(x5c_visorLoopSfx, x24_visorSfxVol);
CSfxManager::SfxVolume(x60_, x24_visorSfxVol);
CSfxManager::SfxVolume(x60_scanningLoopSfx, x24_visorSfxVol);
}
}
else
@ -302,7 +563,7 @@ void CPlayerVisor::Update(float dt, const CStateManager& mgr)
{
x24_visorSfxVol = 1.f;
CSfxManager::SfxVolume(x5c_visorLoopSfx, x24_visorSfxVol);
CSfxManager::SfxVolume(x60_, x24_visorSfxVol);
CSfxManager::SfxVolume(x60_scanningLoopSfx, x24_visorSfxVol);
}
}

View File

@ -21,9 +21,9 @@ class CPlayerVisor
struct SScanTarget
{
TUniqueId x0_objId = kInvalidUniqueId;
float x4_ = 0.f;
float x8_ = 0.f;
bool xc_ = false;
float x4_timer = 0.f;
float x8_inRangeTimer = 0.f;
bool xc_inBox = false;
};
enum class EScanWindowState
@ -41,38 +41,39 @@ class CPlayerVisor
bool x25_25_ : 1;
float x28_ = 0.f;
float x2c_scanDimInterp = 1.f;
u32 x30_ = 0;
u32 x34_ = 0;
float x38_ = 0.f;
float x3c_ = 0.f;
zeus::CVector2f x40_;
zeus::CVector2f x48_;
zeus::CVector2f x50_;
EScanWindowState x30_prevState = EScanWindowState::NotInScanVisor;
EScanWindowState x34_nextState = EScanWindowState::NotInScanVisor;
float x38_windowInterpDuration = 0.f;
float x3c_windowInterpTimer = 0.f;
zeus::CVector2f x40_prevWindowDims;
zeus::CVector2f x48_interpWindowDims;
zeus::CVector2f x50_nextWindowDims;
float x58_scanMagInterp = 1.f;
CSfxHandle x5c_visorLoopSfx;
CSfxHandle x60_;
CSfxHandle x60_scanningLoopSfx;
CCameraFilterPass x64_scanDim;
CCameraBlurPass x90_xrayBlur;
float xc4_vpScaleX = 1.f;
float xc8_vpScaleY = 1.f;
TLockedToken<CModel> xcc_scanFrameCorner;
TLockedToken<CModel> xd8_scanFrameCenterSide;
TLockedToken<CModel> xe4_scanFrameCenterTop;
TLockedToken<CModel> xf0_scanFrameStretchSide;
TLockedToken<CModel> xfc_scanFrameStretchTop;
TLockedToken<CModel> x108_newScanPane;
TLockedToken<CModel> x114_scanShield;
TLockedToken<CModel> x124_scanIconNoncritical;
TLockedToken<CModel> x130_scanIconCritical;
TCachedToken<CModel> xcc_scanFrameCorner;
TCachedToken<CModel> xd8_scanFrameCenterSide;
TCachedToken<CModel> xe4_scanFrameCenterTop;
TCachedToken<CModel> xf0_scanFrameStretchSide;
TCachedToken<CModel> xfc_scanFrameStretchTop;
TCachedToken<CModel> x108_newScanPane;
TCachedToken<CModel> x114_scanShield;
int x120_assetLockCountdown = 0;
TCachedToken<CModel> x124_scanIconNoncritical;
TCachedToken<CModel> x130_scanIconCritical;
rstl::reserved_vector<SScanTarget, 64> x13c_scanTargets;
TLockedToken<CTexture> x540_xrayPalette;
float x54c_ = 0.f;
float x550_ = 0.f;
float x54c_frameColorInterp = 0.f;
float x550_frameColorImpulseInterp = 0.f;
int FindEmptyInactiveScanTarget() const;
int FindCachedInactiveScanTarget(TUniqueId uid) const;
void DrawScanObjectIndicators(const CStateManager& mgr) const;
void UpdateScanObjectIndicators(const CStateManager& mgr);
bool DrawScanObjectIndicators(const CStateManager& mgr) const;
void UpdateScanObjectIndicators(const CStateManager& mgr, float dt);
void UpdateScanWindow(float dt, const CStateManager& mgr);
EScanWindowState GetDesiredScanWindowState(const CStateManager& mgr) const;
void LockUnlockAssets();

View File

@ -119,7 +119,7 @@ zeus::CVector3f CActor::GetAimPosition(const CStateManager&, float) const { retu
zeus::CVector3f CActor::GetHomingPosition(const CStateManager& mgr, float f) const { return GetAimPosition(mgr, f); }
zeus::CVector3f CActor::GetScanObjectIndicatorPosition(const CStateManager&) { return {}; }
zeus::CVector3f CActor::GetScanObjectIndicatorPosition(const CStateManager&) const { return {}; }
void CActor::RemoveEmitter()
{

View File

@ -66,7 +66,7 @@ protected:
u8 xe6_27_ : 3;
bool xe6_30_enablePitchBend : 1;
bool xe7_29_ : 1;
bool xe7_30_ : 1;
bool xe7_30_doTargetDistanceTest : 1;
bool xe7_31_ : 1;
};
u32 dummy = 0;
@ -111,7 +111,7 @@ public:
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
virtual zeus::CVector3f GetAimPosition(const CStateManager&, float) const;
virtual zeus::CVector3f GetHomingPosition(const CStateManager&, float) const;
virtual zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager&);
virtual zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager&) const;
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
CWeaponMode&, int);
virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
@ -163,6 +163,7 @@ public:
bool GetE7_29() const { return xe7_29_; }
const CScannableObjectInfo* GetScannableObjectInfo() const;
const CHealthInfo* GetHealthInfo() const { return const_cast<CActor*>(this)->HealthInfo(); }
bool GetDoTargetDistanceTest() const { return xe7_30_doTargetDistanceTest; }
};
}

View File

@ -10,6 +10,7 @@
#include "Camera/CBallCamera.hpp"
#include "Camera/CCinematicCamera.hpp"
#include "TCastTo.hpp"
#include "CScriptGrapplePoint.hpp"
namespace urde
{
@ -195,6 +196,23 @@ CFirstPersonCamera& CPlayer::GetFirstPersonCamera(CStateManager& mgr)
void CPlayer::UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool) {}
void CPlayer::UpdateAssistedAiming(const zeus::CTransform& xf, const CStateManager& mgr)
{
}
void CPlayer::UpdateAimTargetPrediction(const zeus::CTransform& xf, const CStateManager& mgr)
{
}
void CPlayer::ResetAimTargetPrediction(TUniqueId target)
{
if (target == kInvalidUniqueId || x3f4_aimTarget != target)
x404_aimTargetAverage.Clear();
x3f4_aimTarget = target;
}
void CPlayer::DrawGun(CStateManager& mgr) {}
void CPlayer::HolsterGun(CStateManager& mgr) {}
@ -223,7 +241,7 @@ zeus::CVector3f CPlayer::GetHUDOrbitTargetPosition() const { return {}; }
void CPlayer::SetOrbitState(EPlayerOrbitState, CStateManager& mgr) {}
void CPlayer::SetOrbitTargetId(TUniqueId) {}
void CPlayer::SetOrbitTargetId(TUniqueId, CStateManager& mgr) {}
void CPlayer::UpdateOrbitPosition(float, CStateManager& mgr) {}
@ -243,6 +261,11 @@ bool CPlayer::ValidateObjectForMode(TUniqueId, CStateManager& mgr) const { retur
TUniqueId CPlayer::FindAimTargetId(CStateManager& mgr) { return {}; }
const zeus::CTransform& CPlayer::GetFirstPersonCameraTransform(const CStateManager& mgr) const
{
return mgr.GetCameraManager()->GetFirstPersonCamera()->GetGunFollowTransform();
}
TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const std::vector<TUniqueId>&, EPlayerZoneInfo, EPlayerZoneType,
CStateManager& mgr) const
{
@ -251,29 +274,160 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const std::vector<TUniqueId>&, E
TUniqueId CPlayer::FindOrbitTargetId(CStateManager& mgr) { return {}; }
void CPlayer::UpdateOrbitableObjects(CStateManager& mgr) {}
static zeus::CAABox BuildNearListBox(bool cropBottom, const zeus::CTransform& xf, float x, float z, float y)
{
zeus::CAABox aabb(-x, cropBottom ? 0.f : -y, -z, x, y, z);
return aabb.getTransformedAABox(xf);
}
void CPlayer::UpdateOrbitableObjects(CStateManager& mgr)
{
x354_onScreenOrbitObjects.clear();
x344_nearbyOrbitObjects.clear();
x354_onScreenOrbitObjects.clear();
if (CheckOrbitDisableSourceList(mgr))
return;
float dist = GetOrbitMaxTargetDistance(mgr);
if (x9c6_24_)
dist *= 5.f;
zeus::CAABox nearAABB =
BuildNearListBox(true, GetFirstPersonCameraTransform(mgr),
g_tweakPlayer->GetOrbitNearX(), g_tweakPlayer->GetOrbitNearZ(), dist);
CMaterialFilter filter = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan ?
CMaterialFilter::MakeInclude({EMaterialTypes::Scannable}) : CMaterialFilter::MakeInclude({EMaterialTypes::Orbit});
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildNearList(nearList, nearAABB, filter, nullptr);
FindOrbitableObjects(nearList, x344_nearbyOrbitObjects, x330_orbitZone, EPlayerZoneType::Always, mgr, true);
FindOrbitableObjects(nearList, x354_onScreenOrbitObjects, x330_orbitZone, x334_orbitType, mgr, true);
FindOrbitableObjects(nearList, x364_offScreenOrbitObjects, x330_orbitZone, x334_orbitType, mgr, false);
}
TUniqueId CPlayer::FindBestOrbitableObject(const std::vector<TUniqueId>&, EPlayerZoneInfo, CStateManager& mgr) const
{
zeus::CVector3f eyePos = GetEyePosition();
zeus::CVector3f lookDir = x34_transform.basis[1].normalized();
/* TODO: Finish */
return {};
}
void CPlayer::FindOrbitableObjects(const std::vector<TUniqueId>&, std::vector<TUniqueId>&, EPlayerZoneInfo,
EPlayerZoneType, CStateManager& mgr, bool) const
void CPlayer::FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, 1024>& nearObjects,
std::vector<TUniqueId>& listOut, EPlayerZoneInfo zone,
EPlayerZoneType type, CStateManager& mgr, bool onScreenTest) const
{
CFirstPersonCamera* fpCam = mgr.GetCameraManager()->GetFirstPersonCamera();
zeus::CVector3f eyePos = GetEyePosition();
for (TUniqueId id : nearObjects)
{
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(id))
{
if (GetUniqueId() == act->GetUniqueId())
continue;
if (ValidateOrbitTargetId(act->GetUniqueId(), mgr))
continue;
zeus::CVector3f orbitPos = act->GetOrbitPosition(mgr);
zeus::CVector3f screenPos = fpCam->ConvertToScreenSpace(orbitPos);
screenPos.x = g_Viewport.x8_width * screenPos.x / 2.f + g_Viewport.x8_width / 2.f;
screenPos.y = g_Viewport.xc_height * screenPos.y / 2.f + g_Viewport.xc_height / 2.f;
bool pass = false;
if (onScreenTest)
{
if (WithinOrbitScreenBox(screenPos, zone, type))
pass = true;
}
else
{
if (!WithinOrbitScreenBox(screenPos, zone, type))
pass = true;
}
if (pass && (!act->GetDoTargetDistanceTest() || (orbitPos - eyePos).magnitude() <= GetOrbitMaxTargetDistance(mgr)))
listOut.push_back(id);
}
}
}
bool CPlayer::WithinOrbitScreenBox(const zeus::CVector3f&, EPlayerZoneInfo, EPlayerZoneType) const { return false; }
bool CPlayer::WithinOrbitScreenBox(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone, EPlayerZoneType type) const
{
if (screenCoords.z >= 1.f)
return false;
bool CPlayer::WithinOrbitScreenEllipse(const zeus::CVector3f&, EPlayerZoneInfo) const { return false; }
switch (type)
{
case EPlayerZoneType::Box:
return std::fabs(screenCoords.x - g_tweakPlayer->GetOrbitScreenBoxCenterX(int(zone))) <
g_tweakPlayer->GetOrbitScreenBoxHalfExtentX(int(zone)) &&
std::fabs(screenCoords.y - g_tweakPlayer->GetOrbitScreenBoxCenterY(int(zone))) <
g_tweakPlayer->GetOrbitScreenBoxHalfExtentY(int(zone)) &&
screenCoords.z < 1.f;
break;
case EPlayerZoneType::Ellipse:
return WithinOrbitScreenEllipse(screenCoords, zone);
default:
return true;
}
void CPlayer::CheckOrbitDisableSourceList(CStateManager& mgr) {}
return false;
}
void CPlayer::CheckOrbitDisableSourceList() const {}
bool CPlayer::WithinOrbitScreenEllipse(const zeus::CVector3f& screenCoords, EPlayerZoneInfo zone) const
{
if (screenCoords.z >= 1.f)
return false;
void CPlayer::RemoveOrbitDisableSource(TUniqueId) {}
float heYSq = g_tweakPlayer->GetOrbitScreenBoxHalfExtentY(int(zone));
heYSq *= heYSq;
float heXSq = g_tweakPlayer->GetOrbitScreenBoxHalfExtentX(int(zone));
heXSq *= heXSq;
float tmpY = std::fabs(screenCoords.y - g_tweakPlayer->GetOrbitScreenBoxCenterY(int(zone)));
float tmpX = std::fabs(screenCoords.x - g_tweakPlayer->GetOrbitScreenBoxCenterX(int(zone)));
return tmpX * tmpX <= (1.f - tmpY * tmpY / heYSq) * heXSq;
}
void CPlayer::AddOrbitDisableSource(CStateManager& mgr, TUniqueId) {}
bool CPlayer::CheckOrbitDisableSourceList(CStateManager& mgr)
{
for (auto it = x9e4_orbitDisableList.begin() ; it != x9e4_orbitDisableList.end() ;)
{
if (!mgr.GetObjectById(*it))
{
it = x9e4_orbitDisableList.erase(it);
continue;
}
++it;
}
return x9e4_orbitDisableList.size() != 0;
}
void CPlayer::RemoveOrbitDisableSource(TUniqueId uid)
{
for (auto it = x9e4_orbitDisableList.begin() ; it != x9e4_orbitDisableList.end() ;)
{
if (*it == uid)
{
it = x9e4_orbitDisableList.erase(it);
return;
}
++it;
}
}
void CPlayer::AddOrbitDisableSource(CStateManager& mgr, TUniqueId addId)
{
if (x9e4_orbitDisableList.size() >= 5)
return;
for (TUniqueId uid : x9e4_orbitDisableList)
if (uid == addId)
return;
x9e4_orbitDisableList.push_back(addId);
ResetAimTargetPrediction(kInvalidUniqueId);
if (!TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(x310_lockonObjectId)))
SetOrbitTargetId(kInvalidUniqueId, mgr);
}
void CPlayer::UpdateOrbitPreventionTimer(float) {}

View File

@ -49,9 +49,14 @@ public:
};
enum class EPlayerZoneInfo
{
Zero,
One
};
enum class EPlayerZoneType
{
Always = -1,
Box = 0,
Ellipse
};
enum class EPlayerMovementState
{
@ -133,14 +138,14 @@ private:
float x324_ = 0.f;
float x328_ = 0.f;
float x32c_ = 0.f;
u32 x330_ = 0;
u32 x334_ = 1;
EPlayerZoneInfo x330_orbitZone = EPlayerZoneInfo::Zero;
EPlayerZoneType x334_orbitType = EPlayerZoneType::Ellipse;
u32 x338_ = 1;
TUniqueId x33c_ = kInvalidUniqueId;
float x340_ = 0.f;
// std::vector<> x344_;
// std::vector<> x354_;
// std::vector<> x364_;
std::vector<TUniqueId> x344_nearbyOrbitObjects;
std::vector<TUniqueId> x354_onScreenOrbitObjects;
std::vector<TUniqueId> x364_offScreenOrbitObjects;
bool x374_ = false;
float x378_ = 0.f;
u8 x37c_ = 0;
@ -174,10 +179,10 @@ private:
float x3e8_ = 0.f;
float x3ec_ = 0.f;
float x3f0_ = 0.f;
TUniqueId x3f4_ = kInvalidUniqueId;
zeus::CVector3f x3f8_ = zeus::CVector3f::skZero;
TReservedAverage<zeus::CVector3f, 20> x404_;
zeus::CVector3f x480_ = zeus::CVector3f::skZero;
TUniqueId x3f4_aimTarget = kInvalidUniqueId;
zeus::CVector3f x3f8_targetAimPosition = zeus::CVector3f::skZero;
TReservedAverage<zeus::CVector3f, 20> x404_aimTargetAverage;
zeus::CVector3f x480_assistedTargetAim = zeus::CVector3f::skZero;
float x48c_ = 0.f;
std::unique_ptr<CPlayerGun> x490_gun;
float x494_mapAlpha = 1.f;
@ -264,7 +269,7 @@ private:
bool x9c6_24_ : 1;
bool x9c6_25_ : 1;
bool x9c6_26_ : 1;
bool x9c6_27_ : 1;
bool x9c6_27_aimingAtProjectile : 1;
bool x9c6_28_ : 1;
bool x9c6_29_disableInput : 1;
bool x9c6_30_newScanScanning : 1;
@ -282,7 +287,7 @@ private:
float x9d8_ = 0.f;
float x9dc_ = 1.f;
float x9e0_ = 0.f;
u32 x9e4_ = 0;
rstl::reserved_vector<TUniqueId, 5> x9e4_orbitDisableList;
float x9f4_deathTime = 0.f;
float x9f8_ = 0.f;
@ -361,6 +366,9 @@ public:
void UpdateDebugCamera(CStateManager& mgr);
CFirstPersonCamera& GetFirstPersonCamera(CStateManager& mgr);
void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool);
void UpdateAssistedAiming(const zeus::CTransform& xf, const CStateManager& mgr);
void UpdateAimTargetPrediction(const zeus::CTransform& xf, const CStateManager& mgr);
void ResetAimTargetPrediction(TUniqueId target);
void DrawGun(CStateManager& mgr);
void HolsterGun(CStateManager& mgr);
EPlayerCameraState GetCameraState() const { return x2f4_cameraState; }
@ -377,7 +385,7 @@ public:
void OrbitPoint(EPlayerOrbitType, CStateManager& mgr);
zeus::CVector3f GetHUDOrbitTargetPosition() const;
void SetOrbitState(EPlayerOrbitState, CStateManager& mgr);
void SetOrbitTargetId(TUniqueId);
void SetOrbitTargetId(TUniqueId, CStateManager& mgr);
void UpdateOrbitPosition(float, CStateManager& mgr);
void UpdateOrbitZPosition();
void UpdateOrbitFixedPosition();
@ -392,12 +400,12 @@ public:
TUniqueId FindOrbitTargetId(CStateManager& mgr);
void UpdateOrbitableObjects(CStateManager& mgr);
TUniqueId FindBestOrbitableObject(const std::vector<TUniqueId>&, EPlayerZoneInfo, CStateManager& mgr) const;
void FindOrbitableObjects(const std::vector<TUniqueId>&, std::vector<TUniqueId>&, EPlayerZoneInfo, EPlayerZoneType,
CStateManager& mgr, bool) const;
void FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, 1024>&, std::vector<TUniqueId>&,
EPlayerZoneInfo, EPlayerZoneType, CStateManager& mgr, bool) const;
bool WithinOrbitScreenBox(const zeus::CVector3f&, EPlayerZoneInfo, EPlayerZoneType) const;
bool WithinOrbitScreenEllipse(const zeus::CVector3f&, EPlayerZoneInfo) const;
void CheckOrbitDisableSourceList(CStateManager& mgr);
void CheckOrbitDisableSourceList() const;
bool CheckOrbitDisableSourceList(CStateManager& mgr);
bool CheckOrbitDisableSourceList() const { return x9e4_orbitDisableList.size() != 0; }
void RemoveOrbitDisableSource(TUniqueId);
void AddOrbitDisableSource(CStateManager& mgr, TUniqueId);
void UpdateOrbitPreventionTimer(float);
@ -458,6 +466,12 @@ public:
CPlayerCameraBob* GetCameraBob() const { return x76c_cameraBob.get(); }
float GetDeathTime() const { return x9f4_deathTime; }
const CPlayerEnergyDrain& GetEnergyDrain() const { return x274_energyDrain; }
EPlayerZoneInfo GetOrbitZone() const { return x330_orbitZone; }
EPlayerZoneType GetOrbitType() const { return x334_orbitType; }
const zeus::CTransform& GetFirstPersonCameraTransform(const CStateManager& mgr) const;
const std::vector<TUniqueId>& GetNearbyOrbitObjects() const { return x344_nearbyOrbitObjects; }
const std::vector<TUniqueId>& GetOnScreenOrbitObjects() const { return x354_onScreenOrbitObjects; }
const std::vector<TUniqueId>& GetOffScreenOrbitObjects() const { return x364_offScreenOrbitObjects; }
void Touch();