Work on CPlayer

This commit is contained in:
Jack Andersen 2017-07-29 15:06:06 -10:00
parent 48ba71a6c8
commit c06c1e464b
10 changed files with 568 additions and 165 deletions

View File

@ -15,8 +15,12 @@ struct ITweakPlayer : ITweak
virtual float GetX5C() const=0;
virtual float GetNormalGravAccel() const=0;
virtual float GetFluidGravAccel() const=0;
virtual float GetEyeOffset() const=0;
virtual float GetHudLagAmount() const=0;
virtual float GetOrbitNormalDistance() const=0;
virtual float GetMaxUpwardOrbitLookAngle() const=0;
virtual float GetMaxDownwardOrbitLookAngle() const=0;
virtual float GetOrbitHorizAngle() const=0;
virtual float GetOrbitDistanceThreshold() const=0;
virtual uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const=0;
virtual uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const=0;
@ -29,6 +33,7 @@ struct ITweakPlayer : ITweak
virtual float GetOrbitZRange() const=0;
virtual float GetScanningRange() const=0; // x218
virtual bool GetScanFreezesGame() const=0; // x21c_25
virtual bool GetOrbitWhileScanning() const=0;
virtual bool GetFiringCancelsCameraPitch() const=0;
virtual bool GetAssistedAimingIgnoreHorizontal() const=0;
virtual bool GetAssistedAimingIgnoreVertical() const=0;
@ -36,9 +41,11 @@ struct ITweakPlayer : ITweak
virtual float GetAimThresholdDistance() const=0;
virtual float GetAimBoxWidth() const=0;
virtual float GetAimBoxHeight() const=0;
virtual float GetAimTargetTimer() const=0;
virtual float GetAimAssistHorizontalAngle() const=0;
virtual float GetAimAssistVerticalAngle() const=0;
virtual float GetScanningFrameSenseRange() const=0;
virtual bool GetAimWhenOrbitingPoint() const=0;
virtual bool GetGunButtonTogglesHolster() const=0;
virtual bool GetGunNotFiringHolstersGun() const=0;
virtual float GetPlayerHeight() const=0; // x26c

View File

@ -151,8 +151,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x11c_ = __dna_reader.readFloatBig();
/* x120_ */
x120_ = __dna_reader.readFloatBig();
/* x124_ */
x124_ = __dna_reader.readFloatBig();
/* x124_eyeOffset */
x124_eyeOffset = __dna_reader.readFloatBig();
/* x128_ */
x128_ = __dna_reader.readFloatBig();
/* x12c_ */
@ -195,8 +195,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x228_31_ = __dna_reader.readBool();
/* x229_24_ */
x229_24_ = __dna_reader.readBool();
/* x229_25_ */
x229_25_ = __dna_reader.readBool();
/* x229_25_aimWhenOrbitingPoint */
x229_25_aimWhenOrbitingPoint = __dna_reader.readBool();
/* x229_26_ */
x229_26_ = __dna_reader.readBool();
/* x229_27_ */
@ -245,8 +245,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x258_aimBoxWidth = __dna_reader.readFloatBig();
/* x25c_aimBoxHeight */
x25c_aimBoxHeight = __dna_reader.readFloatBig();
/* x260_ */
x260_ = __dna_reader.readFloatBig();
/* x260_aimTargetTimer */
x260_aimTargetTimer = __dna_reader.readFloatBig();
/* x264_aimAssistHorizontalAngle */
x264_aimAssistHorizontalAngle = __dna_reader.readFloatBig();
/* x268_aimAssistVerticalAngle */
@ -275,12 +275,12 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x180_orbitNormalDistance = __dna_reader.readFloatBig();
/* x184_ */
x184_ = __dna_reader.readFloatBig();
/* x188_ */
x188_ = __dna_reader.readFloatBig();
/* x18c_ */
x18c_ = __dna_reader.readFloatBig();
/* x190_ */
x190_ = __dna_reader.readFloatBig();
/* x188_maxUpwardOrbitLookAngle */
x188_maxUpwardOrbitLookAngle = __dna_reader.readFloatBig();
/* x18c_maxDownwardOrbitLookAngle */
x18c_maxDownwardOrbitLookAngle = __dna_reader.readFloatBig();
/* x190_orbitHorizAngle */
x190_orbitHorizAngle = __dna_reader.readFloatBig();
/* x194_ */
x194_ = __dna_reader.readFloatBig();
/* x198_ */
@ -355,8 +355,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x21c_24_ = __dna_reader.readBool();
/* x21c_25_scanFreezesGame */
x21c_25_scanFreezesGame = __dna_reader.readBool();
/* x21c_26_ */
x21c_26_ = __dna_reader.readBool();
/* x21c_26_orbitWhileScanning */
x21c_26_orbitWhileScanning = __dna_reader.readBool();
/* x220_ */
x220_ = __dna_reader.readFloatBig();
/* x224_scanningFrameSenseRange */
@ -591,8 +591,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x11c_);
/* x120_ */
__dna_writer.writeFloatBig(x120_);
/* x124_ */
__dna_writer.writeFloatBig(x124_);
/* x124_eyeOffset */
__dna_writer.writeFloatBig(x124_eyeOffset);
/* x128_ */
__dna_writer.writeFloatBig(x128_);
/* x12c_ */
@ -635,8 +635,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeBool(x228_31_);
/* x229_24_ */
__dna_writer.writeBool(x229_24_);
/* x229_25_ */
__dna_writer.writeBool(x229_25_);
/* x229_25_aimWhenOrbitingPoint */
__dna_writer.writeBool(x229_25_aimWhenOrbitingPoint);
/* x229_26_ */
__dna_writer.writeBool(x229_26_);
/* x229_27_ */
@ -685,8 +685,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x258_aimBoxWidth);
/* x25c_aimBoxHeight */
__dna_writer.writeFloatBig(x25c_aimBoxHeight);
/* x260_ */
__dna_writer.writeFloatBig(x260_);
/* x260_aimTargetTimer */
__dna_writer.writeFloatBig(x260_aimTargetTimer);
/* x264_aimAssistHorizontalAngle */
__dna_writer.writeFloatBig(x264_aimAssistHorizontalAngle);
/* x268_aimAssistVerticalAngle */
@ -715,12 +715,12 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x180_orbitNormalDistance);
/* x184_ */
__dna_writer.writeFloatBig(x184_);
/* x188_ */
__dna_writer.writeFloatBig(x188_);
/* x18c_ */
__dna_writer.writeFloatBig(x18c_);
/* x190_ */
__dna_writer.writeFloatBig(x190_);
/* x188_maxUpwardOrbitLookAngle */
__dna_writer.writeFloatBig(x188_maxUpwardOrbitLookAngle);
/* x18c_maxDownwardOrbitLookAngle */
__dna_writer.writeFloatBig(x18c_maxDownwardOrbitLookAngle);
/* x190_orbitHorizAngle */
__dna_writer.writeFloatBig(x190_orbitHorizAngle);
/* x194_ */
__dna_writer.writeFloatBig(x194_);
/* x198_ */
@ -795,8 +795,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeBool(x21c_24_);
/* x21c_25_scanFreezesGame */
__dna_writer.writeBool(x21c_25_scanFreezesGame);
/* x21c_26_ */
__dna_writer.writeBool(x21c_26_);
/* x21c_26_orbitWhileScanning */
__dna_writer.writeBool(x21c_26_orbitWhileScanning);
/* x220_ */
__dna_writer.writeFloatBig(x220_);
/* x224_scanningFrameSenseRange */
@ -1061,8 +1061,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x11c_ = __dna_docin.readFloat("x11c_");
/* x120_ */
x120_ = __dna_docin.readFloat("x120_");
/* x124_ */
x124_ = __dna_docin.readFloat("x124_");
/* x124_eyeOffset */
x124_eyeOffset = __dna_docin.readFloat("x124_eyeOffset");
/* x128_ */
x128_ = __dna_docin.readFloat("x128_");
/* x12c_ */
@ -1105,8 +1105,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x228_31_ = __dna_docin.readBool("x228_31_");
/* x229_24_ */
x229_24_ = __dna_docin.readBool("x229_24_");
/* x229_25_ */
x229_25_ = __dna_docin.readBool("x229_25_");
/* x229_25_aimWhenOrbitingPoint */
x229_25_aimWhenOrbitingPoint = __dna_docin.readBool("x229_25_aimWhenOrbitingPoint");
/* x229_26_ */
x229_26_ = __dna_docin.readBool("x229_26_");
/* x229_27_ */
@ -1155,8 +1155,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x258_aimBoxWidth = __dna_docin.readFloat("x258_aimBoxWidth");
/* x25c_aimBoxHeight */
x25c_aimBoxHeight = __dna_docin.readFloat("x25c_aimBoxHeight");
/* x260_ */
x260_ = __dna_docin.readFloat("x260_");
/* x260_aimTargetTimer */
x260_aimTargetTimer = __dna_docin.readFloat("x260_aimTargetTimer");
/* x264_aimAssistHorizontalAngle */
x264_aimAssistHorizontalAngle = __dna_docin.readFloat("x264_aimAssistHorizontalAngle");
/* x268_aimAssistVerticalAngle */
@ -1200,12 +1200,12 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x180_orbitNormalDistance = __dna_docin.readFloat("x180_orbitNormalDistance");
/* x184_ */
x184_ = __dna_docin.readFloat("x184_");
/* x188_ */
x188_ = __dna_docin.readFloat("x188_");
/* x18c_ */
x18c_ = __dna_docin.readFloat("x18c_");
/* x190_ */
x190_ = __dna_docin.readFloat("x190_");
/* x188_maxUpwardOrbitLookAngle */
x188_maxUpwardOrbitLookAngle = __dna_docin.readFloat("x188_maxUpwardOrbitLookAngle");
/* x18c_maxDownwardOrbitLookAngle */
x18c_maxDownwardOrbitLookAngle = __dna_docin.readFloat("x18c_maxDownwardOrbitLookAngle");
/* x190_orbitHorizAngle */
x190_orbitHorizAngle = __dna_docin.readFloat("x190_orbitHorizAngle");
/* x194_ */
x194_ = __dna_docin.readFloat("x194_");
/* x198_ */
@ -1310,8 +1310,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x21c_24_ = __dna_docin.readBool("x21c_24_");
/* x21c_25_scanFreezesGame */
x21c_25_scanFreezesGame = __dna_docin.readBool("x21c_25_scanFreezesGame");
/* x21c_26_ */
x21c_26_ = __dna_docin.readBool("x21c_26_");
/* x21c_26_orbitWhileScanning */
x21c_26_orbitWhileScanning = __dna_docin.readBool("x21c_26_orbitWhileScanning");
/* x220_ */
x220_ = __dna_docin.readFloat("x220_");
/* x224_scanningFrameSenseRange */
@ -1570,8 +1570,8 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x11c_", x11c_);
/* x120_ */
__dna_docout.writeFloat("x120_", x120_);
/* x124_ */
__dna_docout.writeFloat("x124_", x124_);
/* x124_eyeOffset */
__dna_docout.writeFloat("x124_eyeOffset", x124_eyeOffset);
/* x128_ */
__dna_docout.writeFloat("x128_", x128_);
/* x12c_ */
@ -1614,8 +1614,8 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeBool("x228_31_", x228_31_);
/* x229_24_ */
__dna_docout.writeBool("x229_24_", x229_24_);
/* x229_25_ */
__dna_docout.writeBool("x229_25_", x229_25_);
/* x229_25_aimWhenOrbitingPoint */
__dna_docout.writeBool("x229_25_aimWhenOrbitingPoint", x229_25_aimWhenOrbitingPoint);
/* x229_26_ */
__dna_docout.writeBool("x229_26_", x229_26_);
/* x229_27_ */
@ -1664,8 +1664,8 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x258_aimBoxWidth", x258_aimBoxWidth);
/* x25c_aimBoxHeight */
__dna_docout.writeFloat("x25c_aimBoxHeight", x25c_aimBoxHeight);
/* x260_ */
__dna_docout.writeFloat("x260_", x260_);
/* x260_aimTargetTimer */
__dna_docout.writeFloat("x260_aimTargetTimer", x260_aimTargetTimer);
/* x264_aimAssistHorizontalAngle */
__dna_docout.writeFloat("x264_aimAssistHorizontalAngle", x264_aimAssistHorizontalAngle);
/* x268_aimAssistVerticalAngle */
@ -1706,12 +1706,12 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x180_orbitNormalDistance", x180_orbitNormalDistance);
/* x184_ */
__dna_docout.writeFloat("x184_", x184_);
/* x188_ */
__dna_docout.writeFloat("x188_", x188_);
/* x18c_ */
__dna_docout.writeFloat("x18c_", x18c_);
/* x190_ */
__dna_docout.writeFloat("x190_", x190_);
/* x188_maxUpwardOrbitLookAngle */
__dna_docout.writeFloat("x188_maxUpwardOrbitLookAngle", x188_maxUpwardOrbitLookAngle);
/* x18c_maxDownwardOrbitLookAngle */
__dna_docout.writeFloat("x18c_maxDownwardOrbitLookAngle", x18c_maxDownwardOrbitLookAngle);
/* x190_orbitHorizAngle */
__dna_docout.writeFloat("x190_orbitHorizAngle", x190_orbitHorizAngle);
/* x194_ */
__dna_docout.writeFloat("x194_", x194_);
/* x198_ */
@ -1810,8 +1810,8 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeBool("x21c_24_", x21c_24_);
/* x21c_25_scanFreezesGame */
__dna_docout.writeBool("x21c_25_scanFreezesGame", x21c_25_scanFreezesGame);
/* x21c_26_ */
__dna_docout.writeBool("x21c_26_", x21c_26_);
/* x21c_26_orbitWhileScanning */
__dna_docout.writeBool("x21c_26_orbitWhileScanning", x21c_26_orbitWhileScanning);
/* x220_ */
__dna_docout.writeFloat("x220_", x220_);
/* x224_scanningFrameSenseRange */
@ -1917,9 +1917,9 @@ void CTweakPlayer::FixupValues()
x268_aimAssistVerticalAngle = zeus::degToRad(x268_aimAssistVerticalAngle);
x17c_ = zeus::degToRad(x17c_);
x184_ = zeus::degToRad(x184_);
x188_ = zeus::degToRad(x188_);
x18c_ = zeus::degToRad(x18c_);
x190_ = zeus::degToRad(x190_);
x188_maxUpwardOrbitLookAngle = zeus::degToRad(x188_maxUpwardOrbitLookAngle);
x18c_maxDownwardOrbitLookAngle = zeus::degToRad(x18c_maxDownwardOrbitLookAngle);
x190_orbitHorizAngle = zeus::degToRad(x190_orbitHorizAngle);
x194_ = zeus::degToRad(x194_);
x198_ = zeus::degToRad(x198_);
x1f0_ = zeus::degToRad(x1f0_);

View File

@ -41,7 +41,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x118_;
Value<float> x11c_;
Value<float> x120_;
Value<float> x124_;
Value<float> x124_eyeOffset;
Value<float> x128_;
Value<float> x12c_;
Value<float> x130_;
@ -60,9 +60,9 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x17c_;
Value<float> x180_orbitNormalDistance;
Value<float> x184_;
Value<float> x188_;
Value<float> x18c_;
Value<float> x190_;
Value<float> x188_maxUpwardOrbitLookAngle;
Value<float> x18c_maxDownwardOrbitLookAngle;
Value<float> x190_orbitHorizAngle;
Value<float> x194_;
Value<float> x198_;
Value<float> x19c_;
@ -94,7 +94,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x218_scanningRange;
Value<bool> x21c_24_ : 1;
Value<bool> x21c_25_scanFreezesGame : 1;
Value<bool> x21c_26_ : 1;
Value<bool> x21c_26_orbitWhileScanning : 1;
Value<float> x220_;
Value<float> x224_scanningFrameSenseRange;
Value<bool> x228_24_ : 1;
@ -106,7 +106,7 @@ struct CTweakPlayer : ITweakPlayer
Value<bool> x228_30_ : 1;
Value<bool> x228_31_ : 1;
Value<bool> x229_24_ : 1;
Value<bool> x229_25_ : 1;
Value<bool> x229_25_aimWhenOrbitingPoint : 1;
Value<bool> x229_26_ : 1;
Value<bool> x229_27_ : 1;
Value<bool> x229_28_ : 1;
@ -131,7 +131,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x254_;
Value<float> x258_aimBoxWidth;
Value<float> x25c_aimBoxHeight;
Value<float> x260_;
Value<float> x260_aimTargetTimer;
Value<float> x264_aimAssistHorizontalAngle;
Value<float> x268_aimAssistVerticalAngle;
Value<float> x26c_playerHeight;
@ -181,8 +181,12 @@ struct CTweakPlayer : ITweakPlayer
float GetX5C() const { return x44_[6]; }
float GetNormalGravAccel() const { return xc4_normalGravAccel; }
float GetFluidGravAccel() const { return xc8_fluidGravAccel; }
float GetEyeOffset() const { return x124_eyeOffset; }
float GetHudLagAmount() const { return x138_hudLagAmount; }
float GetOrbitNormalDistance() const { return x180_orbitNormalDistance; }
float GetMaxUpwardOrbitLookAngle() const { return x188_maxUpwardOrbitLookAngle; }
float GetMaxDownwardOrbitLookAngle() const { return x18c_maxDownwardOrbitLookAngle; }
float GetOrbitHorizAngle() const { return x190_orbitHorizAngle; }
float GetOrbitDistanceThreshold() const { return x1a4_orbitDistanceThreshold; }
uint32_t GetOrbitScreenBoxHalfExtentX(int zone) const { return x1a8_orbitScreenBoxHalfExtentX[zone]; }
uint32_t GetOrbitScreenBoxHalfExtentY(int zone) const { return x1b0_orbitScreenBoxHalfExtentY[zone]; }
@ -195,7 +199,9 @@ struct CTweakPlayer : ITweakPlayer
float GetOrbitZRange() const { return x1ec_orbitZRange; }
float GetScanningRange() const { return x218_scanningRange; }
bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; }
bool GetOrbitWhileScanning() const { return x21c_26_orbitWhileScanning; }
float GetScanningFrameSenseRange() const { return x224_scanningFrameSenseRange; }
bool GetAimWhenOrbitingPoint() const { return x229_25_aimWhenOrbitingPoint; }
bool GetGunButtonTogglesHolster() const { return x229_30_gunButtonTogglesHolster; }
bool GetGunNotFiringHolstersGun() const { return x229_31_gunNotFiringHolstersGun; }
bool GetFiringCancelsCameraPitch() const { return x22a_26_firingCancelsCameraPitch; }
@ -205,6 +211,7 @@ struct CTweakPlayer : ITweakPlayer
float GetAimThresholdDistance() const { return x24c_aimThresholdDistance; }
float GetAimBoxWidth() const { return x258_aimBoxWidth; }
float GetAimBoxHeight() const { return x25c_aimBoxHeight; }
float GetAimTargetTimer() const { return x260_aimTargetTimer; }
float GetAimAssistHorizontalAngle() const { return x264_aimAssistHorizontalAngle; }
float GetAimAssistVerticalAngle() const { return x268_aimAssistVerticalAngle; }
float GetPlayerHeight() const { return x26c_playerHeight; }

View File

@ -23,39 +23,52 @@ CCameraShakerComponent CCameraShakerComponent::LoadNewCameraShakerComponent(CInp
return {flags, sp1, sp2};
}
CCameraShakeData::CCameraShakeData(float f1, float f2, u32 w1, const zeus::CVector3f& v1,
CCameraShakeData::CCameraShakeData(float duration, float f2, u32 w1, const zeus::CVector3f& sfxPos,
const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2,
const CCameraShakerComponent& shaker3)
: x0_duration(f1), x8_shaker1(shaker1), x44_shaker2(shaker2), x80_shaker3(shaker3), xc0_flags(w1), xc4_sfxPos(v1), xd0_f2(f2)
: x0_duration(duration), x8_shaker1(shaker1), x44_shaker2(shaker2), x80_shaker3(shaker3),
xc0_flags(w1), xc4_sfxPos(sfxPos), xd0_f2(f2)
{}
CCameraShakeData::CCameraShakeData(float f1, float f2)
: CCameraShakeData(f1, 100.f, 0, zeus::CVector3f::skZero, CCameraShakerComponent{}, CCameraShakerComponent{},
CCameraShakeData::CCameraShakeData(float duration, float magnitude)
: CCameraShakeData(duration, 100.f, 0, zeus::CVector3f::skZero, CCameraShakerComponent{}, CCameraShakerComponent{},
CCameraShakerComponent{1,
SCameraShakePoint{0, 0.25f * f1, 0.f, 0.75f * f1, f2},
SCameraShakePoint{1, 0.f, 0.f, 0.5f * f1, 2.f}})
SCameraShakePoint{0, 0.25f * duration, 0.f, 0.75f * duration, magnitude},
SCameraShakePoint{1, 0.f, 0.f, 0.5f * duration, 2.f}})
{}
CCameraShakeData CCameraShakeData::BuildLandingCameraShakeData(float f1, float f2)
CCameraShakeData CCameraShakeData::BuildLandingCameraShakeData(float duration, float magnitude)
{
return CCameraShakeData(f1, 100.f, 0, zeus::CVector3f::skZero,
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.15f * f1, 0.f, 0.85f * f1, f2),
SCameraShakePoint(1, 0.f, 0.f, 0.4f * f1, 1.5f)),
CCameraShakerComponent(),
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.25f * f1, 0.f, 0.75f * f1, f2),
SCameraShakePoint(1, 0.f, 0.f, 0.5f * f1, 2.f)));
return {duration, 100.f, 0, zeus::CVector3f::skZero,
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.15f * duration, 0.f, 0.85f * duration, magnitude),
SCameraShakePoint(1, 0.f, 0.f, 0.4f * duration, 1.5f)),
CCameraShakerComponent(),
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.25f * duration, 0.f, 0.75f * duration, magnitude),
SCameraShakePoint(1, 0.f, 0.f, 0.5f * duration, 2.f))};
}
CCameraShakeData CCameraShakeData::BuildProjectileCameraShake(float f1, float f2)
CCameraShakeData CCameraShakeData::BuildProjectileCameraShake(float duration, float magnitude)
{
return CCameraShakeData(f1, 100.f, 0, zeus::CVector3f::skZero,
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.f, 0.f, f1, f2),
SCameraShakePoint(1, 0.f, 0.f, 0.5f * f1, 3.f)),
CCameraShakerComponent(),
CCameraShakerComponent());
return {duration, 100.f, 0, zeus::CVector3f::skZero,
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.f, 0.f, duration, magnitude),
SCameraShakePoint(1, 0.f, 0.f, 0.5f * duration, 3.f)),
CCameraShakerComponent(),
CCameraShakerComponent()};
}
CCameraShakeData CCameraShakeData::BuildPhazonCameraShakeData(float duration, float magnitude)
{
return {duration, 100.f, 0, zeus::CVector3f::skZero,
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.15f * duration, 0.f, 0.25f * duration, magnitude),
SCameraShakePoint(1, 0.f, 0.f, 0.4f * duration, 0.3f)),
CCameraShakerComponent(),
CCameraShakerComponent(1,
SCameraShakePoint(0, 0.25f * duration, 0.f, 0.25f * duration, magnitude),
SCameraShakePoint(1, 0.f, 0.f, 0.5f * duration, 0.5f))};
}
float CCameraShakeData::GetSomething() const

View File

@ -13,14 +13,14 @@ struct SCameraShakePoint
friend class CCameraShakeData;
u32 x0_w1 = 0;
float x4_ = 0.f;
float x8_f4 = 0.f;
float x8_magnitude = 0.f;
float xc_f1 = 0.f;
float x10_f2 = 0.f;
float x14_f3 = 0.f;
float x14_duration = 0.f;
SCameraShakePoint() = default;
SCameraShakePoint(u32 w1, float f1, float f2, float f3, float f4)
: x0_w1(w1), x8_f4(f4), xc_f1(f1), x10_f2(f2), x14_f3(f3) {}
float GetSomething() const { return x0_w1 ? x8_f4 : x4_; }
SCameraShakePoint(u32 w1, float f1, float f2, float duration, float magnitude)
: x0_w1(w1), x8_magnitude(magnitude), xc_f1(f1), x10_f2(f2), x14_duration(duration) {}
float GetSomething() const { return x0_w1 ? x8_magnitude : x4_; }
static SCameraShakePoint LoadCameraShakePoint(CInputStream& in);
};
@ -51,12 +51,13 @@ class CCameraShakeData
float xd0_f2;
public:
CCameraShakeData(float duration, float f2, u32 w1, const zeus::CVector3f& v1,
CCameraShakeData(float duration, float f2, u32 w1, const zeus::CVector3f& sfxPos,
const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2,
const CCameraShakerComponent& shaker3);
CCameraShakeData(float f1, float f2);
static CCameraShakeData BuildLandingCameraShakeData(float f1, float f2);
static CCameraShakeData BuildProjectileCameraShake(float f1, float f2);
CCameraShakeData(float duration, float magnitude);
static CCameraShakeData BuildLandingCameraShakeData(float duration, float magnitude);
static CCameraShakeData BuildProjectileCameraShake(float duration, float magnitude);
static CCameraShakeData BuildPhazonCameraShakeData(float duration, float magnitude);
//zeus::CVector3f GeneratePoint(float dt, CRandom16& r);
float GetSomething() const;
float GetSomething2() const;

View File

@ -168,7 +168,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
if (std::fabs(angle) > 1.f)
angle = (angle > -0.f ? -1.f : 1.f);
float clampedAngle = zeus::clamp(0.f, std::acos(angle) / scaledDt, 1.f);
if (angle > 0.999f && x18c_ && !player->x374_)
if (angle > 0.999f && x18c_ && !player->x374_orbitLockEstablished)
qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f));
else
qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, scaledDt * clampedAngle);

View File

@ -66,9 +66,10 @@ protected:
u8 xe6_24_fluidCounter : 3;
u8 xe6_27_ : 3;
bool xe6_30_enablePitchBend : 1;
u8 xe6_31_targetableVisorFlags : 4;
bool xe7_29_ : 1;
bool xe7_30_doTargetDistanceTest : 1;
bool xe7_31_ : 1;
bool xe7_31_targetable : 1;
};
u32 dummy = 0;
};
@ -176,6 +177,8 @@ public:
bool GetDoTargetDistanceTest() const { return xe7_30_doTargetDistanceTest; }
void SetCalculateLighting(bool c);
float GetAverageAnimVelocity(int anim) const;
u8 GetTargetableVisorFlags() const { return xe6_31_targetableVisorFlags; }
bool GetIsTargetable() const { return xe7_31_targetable; }
};
}

View File

@ -81,9 +81,9 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
SetCalculateLighting(true);
x90_actorLights->SetCastShadows(true);
x50c_.z = 0.f;
if (x50c_.canBeNormalized())
x50c_.normalize();
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
x2b4_.push_back(20.f);
x2b4_.push_back(80.f);
x2b4_.push_back(80.f);
@ -226,7 +226,7 @@ void CPlayer::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager
{
if (mgr.GetFluidPlaneManager()->GetLastSplashDeltaTime(x8_uid) >= 0.2f)
{
zeus::CVector3f posOffset = x50c_;
zeus::CVector3f posOffset = x50c_moveDir;
if (posOffset.canBeNormalized())
posOffset = posOffset.normalized() * zeus::CVector3f(1.2f, 1.2f, 0.f);
switch (state)
@ -440,9 +440,29 @@ void CPlayer::ValidateScanning(const CFinalInput& input, CStateManager& mgr) {}
void CPlayer::SetScanningState(EPlayerScanState, CStateManager& mgr) {}
bool CPlayer::GetExplorationMode() const { return false; }
bool CPlayer::GetExplorationMode() const
{
switch (x498_gunHolsterState)
{
case EGunHolsterState::Holstering:
case EGunHolsterState::Holstered:
return true;
default:
return false;
}
}
bool CPlayer::GetCombatMode() const { return false; }
bool CPlayer::GetCombatMode() const
{
switch (x498_gunHolsterState)
{
case EGunHolsterState::Drawing:
case EGunHolsterState::Drawn:
return true;
default:
return false;
}
}
void CPlayer::RenderGun(const CStateManager& mgr, const zeus::CVector3f&) const {}
@ -658,7 +678,7 @@ void CPlayer::CalculateLeaveMorphBallDirection(const CFinalInput& input)
{
if (x2f8_morphTransState != EPlayerMorphBallState::Morphed)
{
x518_leaveMorphDir = x50c_;
x518_leaveMorphDir = x50c_moveDir;
}
else
{
@ -668,7 +688,7 @@ void CPlayer::CalculateLeaveMorphBallDirection(const CFinalInput& input)
ControlMapper::GetAnalogInput(ControlMapper::ECommands::TurnRight, input) > 0.3f)
{
if (x138_velocity.magnitude() > 0.5f)
x518_leaveMorphDir = x50c_;
x518_leaveMorphDir = x50c_moveDir;
}
}
}
@ -773,17 +793,17 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
{
case EPlayerMorphBallState::Morphed:
if (x4fc_ > 0.25f)
x50c_ = flatDelta;
x530_ = x50c_;
x50c_moveDir = flatDelta;
x530_ = x50c_moveDir;
x524_ = GetTranslation();
break;
default:
x500_ = GetTransform().basis[1];
x50c_ = x500_;
x50c_.z = 0.f;
if (x50c_.canBeNormalized())
x50c_.normalize();
x530_ = x50c_;
x50c_moveDir = x500_;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
x530_ = x50c_moveDir;
x524_ = GetTranslation();
break;
}
@ -793,11 +813,11 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
if (x2f8_morphTransState != EPlayerMorphBallState::Morphed)
{
x500_ = GetTransform().basis[1];
x50c_ = x500_;
x50c_.z = 0.f;
if (x50c_.canBeNormalized())
x50c_.normalize();
x530_ = x50c_;
x50c_moveDir = x500_;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
x530_ = x50c_moveDir;
x524_ = GetTranslation();
}
x4fc_ = 0.f;
@ -811,15 +831,15 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
case EPlayerMorphBallState::Morphed:
case EPlayerMorphBallState::Morphing:
case EPlayerMorphBallState::Unmorphing:
x500_ = x50c_;
x500_ = x50c_moveDir;
break;
default:
x500_ = GetTransform().basis[1];
x50c_ = x500_;
x50c_.z = 0.f;
if (x50c_.canBeNormalized())
x50c_.normalize();
x530_ = x50c_;
x50c_moveDir = x500_;
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x50c_moveDir.normalize();
x530_ = x50c_moveDir;
x524_ = GetTranslation();
break;
}
@ -827,8 +847,8 @@ void CPlayer::CalculatePlayerMovementDirection(float dt)
x4fc_ = 0.f;
}
x50c_.z = 0.f;
if (x50c_.canBeNormalized())
x50c_moveDir.z = 0.f;
if (x50c_moveDir.canBeNormalized())
x500_.normalize();
}
@ -947,7 +967,10 @@ void CPlayer::UpdateFrozenState(const CFinalInput& input, CStateManager& mgr)
}
}
void CPlayer::Think(float, CStateManager&) {}
void CPlayer::Think(float dt, CStateManager& mgr)
{
}
void CPlayer::PreThink(float dt, CStateManager& mgr)
{
@ -1965,7 +1988,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f
bool CPlayer::ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr)
{
CMaterialFilter solidFilter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid});
zeus::CAABox aabb(x2d8_.min - 1.f + pos, x2d8_.max + 1.f + pos);
zeus::CAABox aabb(x2d8_fpBounds.min - 1.f + pos, x2d8_fpBounds.max + 1.f + pos);
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildColliderList(nearList, *this, aabb);
CCollidableAABox colAABB({GetBaseBoundingBox().min + pos, GetBaseBoundingBox().max + pos}, {});
@ -2339,7 +2362,7 @@ void CPlayer::SetOrbitTargetId(TUniqueId id, CStateManager& mgr)
x310_orbitTargetId = id;
if (x310_orbitTargetId == kInvalidUniqueId)
x374_ = false;
x374_orbitLockEstablished = false;
}
void CPlayer::UpdateOrbitPosition(float pos, CStateManager& mgr)
@ -2388,13 +2411,201 @@ void CPlayer::SetOrbitPosition(float pos, CStateManager& mgr)
x320_orbitVector = zeus::CVector3f(0.f, pos, x314_orbitPoint.z - camXf.origin.z);
}
void CPlayer::UpdateAimTarget(CStateManager& mgr) {}
void CPlayer::UpdateAimTarget(CStateManager& mgr)
{
if (!ValidateAimTargetId(x3f4_aimTarget, mgr))
ResetAimTargetPrediction(kInvalidUniqueId);
void CPlayer::UpdateAimTargetTimer(float) {}
if (!GetCombatMode())
{
ResetAimTargetPrediction(kInvalidUniqueId);
x48c_aimTargetTimer = 0.f;
return;
}
bool CPlayer::ValidateAimTargetId(TUniqueId, CStateManager& mgr) { return false; }
#if 0
if (!0 && 0)
{
ResetAimTargetPrediction(kInvalidUniqueId);
x48c_aimTargetTimer = 0.f;
if (x304_orbitState == EPlayerOrbitState::One ||
x304_orbitState == EPlayerOrbitState::Four)
if (!ValidateOrbitTargetId(x310_orbitTargetId, mgr))
ResetAimTargetPrediction(x310_orbitTargetId);
return;
}
#endif
bool CPlayer::ValidateObjectForMode(TUniqueId, CStateManager& mgr) const { return false; }
bool needsReset = false;
TCastToPtr<CActor> act = mgr.ObjectById(x3f4_aimTarget);
CActor* actp = act.GetPtr();
if (act)
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Target))
actp = nullptr;
if (g_tweakPlayer->GetAimWhenOrbitingPoint())
{
if (x304_orbitState == EPlayerOrbitState::One ||
x304_orbitState == EPlayerOrbitState::Four)
{
if (ValidateOrbitTargetId(x310_orbitTargetId, mgr) == EOrbitValidationResult::OK)
ResetAimTargetPrediction(x310_orbitTargetId);
else
needsReset = true;
}
else
{
needsReset = true;
}
}
else
{
if (x304_orbitState == EPlayerOrbitState::Zero)
needsReset = true;
}
if (needsReset)
{
if (actp && ValidateObjectForMode(x3f4_aimTarget, mgr))
ResetAimTargetPrediction(kInvalidUniqueId);
else
ResetAimTargetPrediction(FindAimTargetId(mgr));
}
}
void CPlayer::UpdateAimTargetTimer(float dt)
{
if (x3f4_aimTarget == kInvalidUniqueId)
return;
if (x48c_aimTargetTimer <= 0.f)
return;
x48c_aimTargetTimer -= dt;
}
bool CPlayer::ValidateAimTargetId(TUniqueId uid, CStateManager& mgr)
{
if (uid == kInvalidUniqueId)
{
x404_aimTargetAverage.Clear();
x48c_aimTargetTimer = 0.f;
return false;
}
TCastToPtr<CActor> act = mgr.ObjectById(uid);
if (!act || !act->GetMaterialList().HasMaterial(EMaterialTypes::Target) || !act->GetIsTargetable())
return false;
if (x304_orbitState == EPlayerOrbitState::One ||
x304_orbitState == EPlayerOrbitState::Four)
{
if (ValidateOrbitTargetId(x310_orbitTargetId, mgr) != EOrbitValidationResult::OK)
{
ResetAimTargetPrediction(kInvalidUniqueId);
x48c_aimTargetTimer = 0.f;
return false;
}
return true;
}
if (act->GetMaterialList().HasMaterial(EMaterialTypes::Target) && uid != kInvalidUniqueId &&
ValidateObjectForMode(uid, mgr))
{
float vpWHalf = g_Viewport.x8_width / 2;
float vpHHalf = g_Viewport.xc_height / 2;
zeus::CVector3f aimPos = act->GetAimPosition(mgr, 0.f);
zeus::CVector3f eyePos = GetEyePosition();
zeus::CVector3f eyeToAim = aimPos - eyePos;
zeus::CVector3f screenPos = mgr.GetCameraManager()->GetFirstPersonCamera()->ConvertToScreenSpace(aimPos);
zeus::CVector3f posInBox(vpWHalf + screenPos.x * vpWHalf,
vpHHalf + screenPos.y * vpHHalf,
screenPos.z);
if (WithinOrbitScreenBox(posInBox, x330_orbitZone, x334_orbitType) ||
(x330_orbitZone != EPlayerZoneInfo::Zero &&
WithinOrbitScreenBox(posInBox, EPlayerZoneInfo::Zero, x334_orbitType)))
{
float eyeToAimMag = eyeToAim.magnitude();
if (eyeToAimMag <= g_tweakPlayer->GetAimMaxDistance())
{
rstl::reserved_vector<TUniqueId, 1024> nearList;
TUniqueId intersectId = kInvalidUniqueId;
eyeToAim.normalize();
mgr.BuildNearList(nearList, eyePos, eyeToAim, eyeToAimMag,
OccluderFilter, act);
eyeToAim.normalize();
CRayCastResult result =
mgr.RayWorldIntersection(intersectId, eyePos, eyeToAim, eyeToAimMag,
LineOfSightFilter, nearList);
if (result.IsInvalid())
{
x48c_aimTargetTimer = g_tweakPlayer->GetAimTargetTimer();
return true;
}
}
}
if (x48c_aimTargetTimer > 0.f)
return true;
}
ResetAimTargetPrediction(kInvalidUniqueId);
x48c_aimTargetTimer = 0.f;
return false;
}
bool CPlayer::ValidateObjectForMode(TUniqueId uid, CStateManager& mgr) const
{
TCastToPtr<CActor> act = mgr.ObjectById(uid);
if (!act || uid == kInvalidUniqueId)
return false;
if (TCastToPtr<CScriptDoor>(mgr.ObjectById(uid)))
return true;
if (GetCombatMode())
{
if (CHealthInfo* hInfo = act->HealthInfo())
{
if (hInfo->GetHP() > 0.f)
return true;
}
else
{
if (act->GetMaterialList().HasMaterial(EMaterialTypes::Projectile) ||
act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
return true;
if (TCastToPtr<CScriptGrapplePoint> point = mgr.ObjectById(uid))
{
zeus::CVector3f playerToPoint = point->GetTranslation() - GetTranslation();
if (playerToPoint.canBeNormalized() && playerToPoint.magnitude() < g_tweakPlayer->GetOrbitDistanceMax())
return true;
}
}
}
if (GetExplorationMode())
{
if (!act->HealthInfo())
{
if (TCastToPtr<CScriptGrapplePoint> point = mgr.ObjectById(uid))
{
zeus::CVector3f playerToPoint = point->GetTranslation() - GetTranslation();
if (playerToPoint.canBeNormalized() && playerToPoint.magnitude() < g_tweakPlayer->GetOrbitDistanceMax())
return true;
}
else
{
return true;
}
}
else
{
return true;
}
}
return false;
}
static zeus::CAABox BuildNearListBox(bool cropBottom, const zeus::CTransform& xf, float x, float z, float y)
{
@ -2733,7 +2944,7 @@ void CPlayer::FindOrbitableObjects(const rstl::reserved_vector<TUniqueId, 1024>&
{
if (GetUniqueId() == act->GetUniqueId())
continue;
if (ValidateOrbitTargetId(act->GetUniqueId(), mgr) != EOrbitObjectType::Zero)
if (ValidateOrbitTargetId(act->GetUniqueId(), mgr) != EOrbitValidationResult::OK)
continue;
zeus::CVector3f orbitPos = act->GetOrbitPosition(mgr);
zeus::CVector3f screenPos = fpCam->ConvertToScreenSpace(orbitPos);
@ -2874,33 +3085,194 @@ float CPlayer::GetOrbitMaxLockDistance(CStateManager& mgr) const { return 0.f; }
float CPlayer::GetOrbitMaxTargetDistance(CStateManager& mgr) const { return 0.f; }
CPlayer::EOrbitObjectType CPlayer::ValidateOrbitTargetId(TUniqueId, CStateManager& mgr) const
CPlayer::EOrbitValidationResult CPlayer::ValidateOrbitTargetId(TUniqueId uid, CStateManager& mgr) const
{
return EOrbitObjectType::Zero;
if (uid == kInvalidUniqueId)
return EOrbitValidationResult::InvalidTarget;
TCastToConstPtr<CActor> act = mgr.GetObjectById(x310_orbitTargetId);
if (!act || !act->GetIsTargetable() || !act->GetActive())
return EOrbitValidationResult::InvalidTarget;
if (x740_ != 0.f)
EOrbitValidationResult::PlayerNotReadyToTarget;
zeus::CVector3f eyePos = GetEyePosition();
zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos;
zeus::CVector3f eyeToOrbitFlat = eyeToOrbit;
eyeToOrbitFlat.z = 0.f;
if (eyeToOrbitFlat.canBeNormalized() && eyeToOrbitFlat.magnitude() > 1.f)
{
float angleFromHorizon =
std::asin(zeus::clamp(-1.f, std::fabs(eyeToOrbit.z) / eyeToOrbit.magnitude(), 1.f));
if ((eyeToOrbit.z >= 0.f && angleFromHorizon >= g_tweakPlayer->GetMaxUpwardOrbitLookAngle()) ||
(eyeToOrbit.z < 0.f && angleFromHorizon >= g_tweakPlayer->GetMaxDownwardOrbitLookAngle()))
return EOrbitValidationResult::ExtremeHorizonAngle;
}
else
{
return EOrbitValidationResult::ExtremeHorizonAngle;
}
CPlayerState::EPlayerVisor visor = mgr.GetPlayerState()->GetCurrentVisor();
u8 flags = act->GetTargetableVisorFlags();
if (visor == CPlayerState::EPlayerVisor::Combat && (flags & 1) == 0)
return EOrbitValidationResult::PlayerNotReadyToTarget;
if (visor == CPlayerState::EPlayerVisor::Scan && (flags & 2) == 0)
return EOrbitValidationResult::PlayerNotReadyToTarget;
if (visor == CPlayerState::EPlayerVisor::Thermal && (flags & 4) == 0)
return EOrbitValidationResult::PlayerNotReadyToTarget;
if (visor == CPlayerState::EPlayerVisor::XRay && (flags & 8) == 0)
return EOrbitValidationResult::PlayerNotReadyToTarget;
if (visor == CPlayerState::EPlayerVisor::Scan && act->GetAreaIdAlways() != GetAreaIdAlways())
return EOrbitValidationResult::TargetingThroughDoor;
return EOrbitValidationResult::OK;
}
CPlayer::EOrbitObjectType CPlayer::ValidateCurrentOrbitTargetId(CStateManager& mgr)
CPlayer::EOrbitValidationResult CPlayer::ValidateCurrentOrbitTargetId(CStateManager& mgr)
{
return EOrbitObjectType::Zero;
TCastToConstPtr<CActor> act = mgr.GetObjectById(x310_orbitTargetId);
if (!act || !act->GetIsTargetable() || !act->GetActive())
return EOrbitValidationResult::InvalidTarget;
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Orbit))
{
if (!act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
return EOrbitValidationResult::NonTargetableTarget;
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan)
return EOrbitValidationResult::NonTargetableTarget;
}
EOrbitValidationResult type = ValidateOrbitTargetId(x310_orbitTargetId, mgr);
if (type != EOrbitValidationResult::OK)
return type;
if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan &&
act->GetAreaIdAlways() != GetAreaIdAlways())
return EOrbitValidationResult::TargetingThroughDoor;
TCastToConstPtr<CScriptGrapplePoint> point = mgr.GetObjectById(x310_orbitTargetId);
if ((mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan &&
g_tweakPlayer->GetOrbitWhileScanning()) || point || act->GetAreaIdAlways() != GetAreaIdAlways())
{
zeus::CVector3f eyePos = GetEyePosition();
TUniqueId bestId = kInvalidUniqueId;
zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos;
if (eyeToOrbit.canBeNormalized())
{
rstl::reserved_vector<TUniqueId, 1024> nearList;
mgr.BuildNearList(nearList, eyePos, eyeToOrbit.normalized(), eyeToOrbit.magnitude(), OccluderFilter,
act.GetPtr());
for (auto it = nearList.begin() ; it != nearList.end() ;)
{
if (const CEntity* ent = mgr.GetObjectById(*it))
{
if (ent->GetAreaIdAlways() != mgr.GetNextAreaId())
{
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(ent->GetAreaIdAlways());
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
if (area->IsPostConstructed())
occState = area->GetOcclusionState();
if (occState == CGameArea::EOcclusionState::Occluded)
{
it = nearList.erase(it);
continue;
}
}
}
++it;
}
CRayCastResult result =
mgr.RayWorldIntersection(bestId, eyePos, eyeToOrbit.normalized(), eyeToOrbit.magnitude(),
LineOfSightFilter, nearList);
if (result.IsValid())
if (TCastToPtr<CScriptDoor>(mgr.ObjectById(bestId)) || point)
return EOrbitValidationResult::TargetingThroughDoor;
}
zeus::CVector3f eyeToOrbitFlat = eyeToOrbit;
eyeToOrbitFlat.z = 0.f;
if (eyeToOrbitFlat.canBeNormalized())
{
float lookToOrbitAngle =
std::acos(zeus::clamp(-1.f, eyeToOrbitFlat.normalized().dot(GetTransform().basis[1]), 1.f));
if (x374_orbitLockEstablished)
{
if (lookToOrbitAngle >= g_tweakPlayer->GetOrbitHorizAngle())
return EOrbitValidationResult::BrokenLookAngle;
}
else
{
if (lookToOrbitAngle <= M_PIF / 180.f)
x374_orbitLockEstablished = true;
}
}
else
{
return EOrbitValidationResult::BrokenLookAngle;
}
}
return EOrbitValidationResult::OK;
}
bool CPlayer::ValidateOrbitTargetIdAndPointer(TUniqueId, CStateManager& mgr) const { return false; }
bool CPlayer::ValidateOrbitTargetIdAndPointer(TUniqueId uid, CStateManager& mgr) const
{
if (uid == kInvalidUniqueId)
return false;
return TCastToConstPtr<CActor>(mgr.GetObjectById(uid));
}
zeus::CVector3f CPlayer::GetBallPosition() const { return {}; }
zeus::CVector3f CPlayer::GetBallPosition() const
{
return GetTranslation() + zeus::CVector3f(0.f, 0.f, g_tweakPlayer->GetPlayerBallHalfExtent());
}
zeus::CVector3f CPlayer::GetEyePosition() const { return {}; }
zeus::CVector3f CPlayer::GetEyePosition() const
{
return GetTranslation() + zeus::CVector3f(0.f, 0.f, GetEyeHeight());
}
float CPlayer::GetEyeHeight() const { return 0.f; }
float CPlayer::GetEyeHeight() const
{
return x9c8_eyeZBias + (x2d8_fpBounds.max.z - g_tweakPlayer->GetEyeOffset());
}
float CPlayer::GetStepUpHeight() const { return 0.f; }
float CPlayer::GetStepUpHeight() const
{
if (x258_movementState == EPlayerMovementState::Jump ||
x258_movementState == EPlayerMovementState::StartingJump)
return 0.3f;
return CPhysicsActor::GetStepUpHeight();
}
float CPlayer::GetStepDownHeight() const { return 0.f; }
float CPlayer::GetStepDownHeight() const
{
if (x258_movementState == EPlayerMovementState::Jump)
return -1.f;
if (x258_movementState == EPlayerMovementState::StartingJump)
return 0.1f;
return CPhysicsActor::GetStepDownHeight();
}
void CPlayer::Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool) {}
void CPlayer::BombJump(const zeus::CVector3f& pos, CStateManager& mgr) {}
zeus::CTransform CPlayer::CreateTransformFromMovementDirection() const { return {}; }
zeus::CTransform CPlayer::CreateTransformFromMovementDirection() const
{
zeus::CVector3f moveDir = x50c_moveDir;
if (moveDir.canBeNormalized())
moveDir.normalize();
else
moveDir = zeus::CVector3f::skForward;
return {zeus::CVector3f(moveDir.y, -moveDir.x, 0.f), moveDir, zeus::CVector3f::skUp, GetTranslation()};
}
const CCollisionPrimitive* CPlayer::GetCollisionPrimitive() const
{
@ -3160,7 +3532,7 @@ void CPlayer::IncrementPhazon()
if (xa10_phazonCounter != 0)
xa10_phazonCounter++;
else
xa14_ = 0.f;
xa14_phazonCameraShakeTimer = 0.f;
}
bool CPlayer::CheckSubmerged() const

View File

@ -72,15 +72,15 @@ public:
Twelve
};
enum class EOrbitObjectType
enum class EOrbitValidationResult
{
Zero,
One,
Two,
Three,
Four,
Five,
Six
OK,
InvalidTarget,
PlayerNotReadyToTarget,
NonTargetableTarget,
ExtremeHorizonAngle,
BrokenLookAngle,
TargetingThroughDoor
};
enum class EPlayerZoneInfo
@ -222,7 +222,7 @@ private:
rstl::reserved_vector<float, 6> x2b4_;
u32 x2d0_ = 3;
float x2d4_ = 0.f;
zeus::CAABox x2d8_;
zeus::CAABox x2d8_fpBounds;
float x2f0_ballTransHeight = 0.f;
EPlayerCameraState x2f4_cameraState = EPlayerCameraState::Zero;
EPlayerMorphBallState x2f8_morphTransState = EPlayerMorphBallState::Unmorphed;
@ -243,7 +243,7 @@ private:
std::vector<TUniqueId> x344_nearbyOrbitObjects;
std::vector<TUniqueId> x354_onScreenOrbitObjects;
std::vector<TUniqueId> x364_offScreenOrbitObjects;
bool x374_ = false;
bool x374_orbitLockEstablished = false;
float x378_ = 0.f;
bool x37c_sidewaysDashing = false;
float x380_ = 0.f;
@ -278,7 +278,7 @@ private:
zeus::CVector3f x3f8_targetAimPosition = zeus::CVector3f::skZero;
TReservedAverage<zeus::CVector3f, 20> x404_aimTargetAverage;
zeus::CVector3f x480_assistedTargetAim = zeus::CVector3f::skZero;
float x48c_ = 0.f;
float x48c_aimTargetTimer = 0.f;
std::unique_ptr<CPlayerGun> x490_gun;
float x494_mapAlpha = 1.f;
EGunHolsterState x498_gunHolsterState = EGunHolsterState::Drawn;
@ -288,7 +288,7 @@ private:
float x4f8_ = 0.f;
float x4fc_ = 0.f;
zeus::CVector3f x500_ = x34_transform.basis[1];
zeus::CVector3f x50c_ = x34_transform.basis[1];
zeus::CVector3f x50c_moveDir = x34_transform.basis[1];
zeus::CVector3f x518_leaveMorphDir = x34_transform.basis[1];
zeus::CVector3f x524_ = x34_transform.basis[1];
zeus::CVector3f x530_ = x34_transform.basis[1];
@ -381,7 +381,7 @@ private:
u32 _dummy = 0;
};
float x9c8_ = 0.f;
float x9c8_eyeZBias = 0.f;
float x9cc_ = 0.f;
u32 x9d0_ = 0;
u32 x9d4_ = 0;
@ -396,8 +396,8 @@ private:
ResId xa08_steamTextureId = kInvalidResId;
ResId xa0c_iceTextureId;
u32 xa10_phazonCounter = 0;
float xa14_ = 0.f;
float xa18_ = 0.f;
float xa14_phazonCameraShakeTimer = 0.f;
float xa18_phazonDamageLag = 0.f;
float xa1c_threatOverride = 0.f;
float xa20_radarXYRadiusOverride = 1.f;
float xa24_radarZRadiusOverride = 1.f;
@ -542,8 +542,8 @@ public:
void UpdateOrbitTarget(CStateManager& mgr);
float GetOrbitMaxLockDistance(CStateManager& mgr) const;
float GetOrbitMaxTargetDistance(CStateManager& mgr) const;
EOrbitObjectType ValidateOrbitTargetId(TUniqueId uid, CStateManager& mgr) const;
EOrbitObjectType ValidateCurrentOrbitTargetId(CStateManager& mgr);
EOrbitValidationResult ValidateOrbitTargetId(TUniqueId uid, CStateManager& mgr) const;
EOrbitValidationResult ValidateCurrentOrbitTargetId(CStateManager& mgr);
bool ValidateOrbitTargetIdAndPointer(TUniqueId, CStateManager& mgr) const;
zeus::CVector3f GetBallPosition() const;
zeus::CVector3f GetEyePosition() const;

View File

@ -23,7 +23,7 @@ void CScriptPointOfInterest::Accept(IVisitor& visitor)
void CScriptPointOfInterest::Think(float dt, CStateManager& mgr)
{
xe7_31_ = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
CEntity::Think(dt, mgr);
}