More CPlayer imps

This commit is contained in:
Jack Andersen 2017-07-30 19:19:05 -10:00
parent c06c1e464b
commit 925aa3fe1a
30 changed files with 816 additions and 134 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ version.h
.DS_Store
*.autosave
docs/*
.idea/dictionaries
.idea/workspace.xml

View File

@ -17,6 +17,8 @@ struct ITweakPlayer : ITweak
virtual float GetFluidGravAccel() const=0;
virtual float GetEyeOffset() const=0;
virtual float GetHudLagAmount() const=0;
virtual float GetFreeLookCenteredThresholdAngle() const=0;
virtual float GetFreeLookCenteredTime() const=0;
virtual float GetOrbitNormalDistance() const=0;
virtual float GetMaxUpwardOrbitLookAngle() const=0;
virtual float GetMaxDownwardOrbitLookAngle() const=0;
@ -32,6 +34,7 @@ struct ITweakPlayer : ITweak
virtual float GetOrbitNearZ() const=0;
virtual float GetOrbitZRange() const=0;
virtual float GetScanningRange() const=0; // x218
virtual bool GetScanRetention() const=0;
virtual bool GetScanFreezesGame() const=0; // x21c_25
virtual bool GetOrbitWhileScanning() const=0;
virtual bool GetFiringCancelsCameraPitch() const=0;
@ -45,7 +48,10 @@ struct ITweakPlayer : ITweak
virtual float GetAimAssistHorizontalAngle() const=0;
virtual float GetAimAssistVerticalAngle() const=0;
virtual float GetScanningFrameSenseRange() const=0;
virtual bool GetEnableFreeLook() const=0;
virtual bool GetTwoButtonsForFreeLook() const=0;
virtual bool GetAimWhenOrbitingPoint() const=0;
virtual bool GetStayInFreeLookWhileFiring() const=0;
virtual bool GetGunButtonTogglesHolster() const=0;
virtual bool GetGunNotFiringHolstersGun() const=0;
virtual float GetPlayerHeight() const=0; // x26c
@ -67,7 +73,8 @@ struct ITweakPlayer : ITweak
virtual float GetGrappleReleaseTime() const=0;
virtual uint32_t GetGrappleJumpMode() const=0;
virtual bool InvertGrappleTurn() const=0;
virtual float GetX124() const=0; // x134
virtual float GetHorizontalFreeLookAngleVel() const=0;
virtual float GetVerticalFreeLookAngleVel() const=0; // x134
virtual float GetX184() const=0; // x184
virtual float GetX1fc() const=0;
virtual float GetX288() const=0; // x288

View File

@ -11,6 +11,7 @@ struct ITweakSlideShow : ITweak
virtual const std::string& GetFont() const=0;
virtual const zeus::CColor& GetFontColor() const=0;
virtual const zeus::CColor& GetOutlineColor() const=0;
virtual float GetScanPercentInterval() const=0;
virtual float GetX54() const=0;
};

View File

@ -157,20 +157,20 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x128_ = __dna_reader.readFloatBig();
/* x12c_ */
x12c_ = __dna_reader.readFloatBig();
/* x130_ */
x130_ = __dna_reader.readFloatBig();
/* x134_ */
x134_ = __dna_reader.readFloatBig();
/* x130_horizontalFreeLookAngleVel */
x130_horizontalFreeLookAngleVel = __dna_reader.readFloatBig();
/* x134_verticalFreeLookAngleVel */
x134_verticalFreeLookAngleVel = __dna_reader.readFloatBig();
/* x138_hudLagAmount */
x138_hudLagAmount = __dna_reader.readFloatBig();
/* x13c_ */
x13c_ = __dna_reader.readFloatBig();
/* x140_ */
x140_ = __dna_reader.readFloatBig();
/* x144_ */
x144_ = __dna_reader.readFloatBig();
/* x148_ */
x148_ = __dna_reader.readFloatBig();
/* x144_freeLookCenteredThresholdAngle */
x144_freeLookCenteredThresholdAngle = __dna_reader.readFloatBig();
/* x148_freeLookCenteredTime */
x148_freeLookCenteredTime = __dna_reader.readFloatBig();
/* x14c_ */
x14c_ = __dna_reader.readFloatBig();
/* x150_leftDiv */
@ -185,10 +185,10 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x228_26_ = __dna_reader.readBool();
/* x228_27_ */
x228_27_ = __dna_reader.readBool();
/* x228_28_ */
x228_28_ = __dna_reader.readBool();
/* x228_29_ */
x228_29_ = __dna_reader.readBool();
/* x228_28_enableFreeLook */
x228_28_enableFreeLook = __dna_reader.readBool();
/* x228_29_twoButtonsForFreeLook */
x228_29_twoButtonsForFreeLook = __dna_reader.readBool();
/* x228_30_ */
x228_30_ = __dna_reader.readBool();
/* x228_31_ */
@ -197,8 +197,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x229_24_ = __dna_reader.readBool();
/* x229_25_aimWhenOrbitingPoint */
x229_25_aimWhenOrbitingPoint = __dna_reader.readBool();
/* x229_26_ */
x229_26_ = __dna_reader.readBool();
/* x229_26_stayInFreeLookWhileFiring */
x229_26_stayInFreeLookWhileFiring = __dna_reader.readBool();
/* x229_27_ */
x229_27_ = __dna_reader.readBool();
/* x229_28_ */
@ -351,8 +351,8 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x214_ = __dna_reader.readFloatBig();
/* x218_scanningRange */
x218_scanningRange = __dna_reader.readFloatBig();
/* x21c_24_ */
x21c_24_ = __dna_reader.readBool();
/* x21c_24_scanRetention */
x21c_24_scanRetention = __dna_reader.readBool();
/* x21c_25_scanFreezesGame */
x21c_25_scanFreezesGame = __dna_reader.readBool();
/* x21c_26_orbitWhileScanning */
@ -597,20 +597,20 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x128_);
/* x12c_ */
__dna_writer.writeFloatBig(x12c_);
/* x130_ */
__dna_writer.writeFloatBig(x130_);
/* x134_ */
__dna_writer.writeFloatBig(x134_);
/* x130_horizontalFreeLookAngleVel */
__dna_writer.writeFloatBig(x130_horizontalFreeLookAngleVel);
/* x134_verticalFreeLookAngleVel */
__dna_writer.writeFloatBig(x134_verticalFreeLookAngleVel);
/* x138_ */
__dna_writer.writeFloatBig(x138_hudLagAmount);
/* x13c_ */
__dna_writer.writeFloatBig(x13c_);
/* x140_ */
__dna_writer.writeFloatBig(x140_);
/* x144_ */
__dna_writer.writeFloatBig(x144_);
/* x148_ */
__dna_writer.writeFloatBig(x148_);
/* x144_freeLookCenteredThresholdAngle */
__dna_writer.writeFloatBig(x144_freeLookCenteredThresholdAngle);
/* x148_freeLookCenteredTime */
__dna_writer.writeFloatBig(x148_freeLookCenteredTime);
/* x14c_ */
__dna_writer.writeFloatBig(x14c_);
/* x150_leftDiv */
@ -625,10 +625,10 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeBool(x228_26_);
/* x228_27_ */
__dna_writer.writeBool(x228_27_);
/* x228_28_ */
__dna_writer.writeBool(x228_28_);
/* x228_29_ */
__dna_writer.writeBool(x228_29_);
/* x228_28_enableFreeLook */
__dna_writer.writeBool(x228_28_enableFreeLook);
/* x228_29_twoButtonsForFreeLook */
__dna_writer.writeBool(x228_29_twoButtonsForFreeLook);
/* x228_30_ */
__dna_writer.writeBool(x228_30_);
/* x228_31_ */
@ -637,8 +637,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeBool(x229_24_);
/* x229_25_aimWhenOrbitingPoint */
__dna_writer.writeBool(x229_25_aimWhenOrbitingPoint);
/* x229_26_ */
__dna_writer.writeBool(x229_26_);
/* x229_26_stayInFreeLookWhileFiring */
__dna_writer.writeBool(x229_26_stayInFreeLookWhileFiring);
/* x229_27_ */
__dna_writer.writeBool(x229_27_);
/* x229_28_ */
@ -791,8 +791,8 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x214_);
/* x218_scanningRange */
__dna_writer.writeFloatBig(x218_scanningRange);
/* x21c_24_ */
__dna_writer.writeBool(x21c_24_);
/* x21c_24_scanRetention */
__dna_writer.writeBool(x21c_24_scanRetention);
/* x21c_25_scanFreezesGame */
__dna_writer.writeBool(x21c_25_scanFreezesGame);
/* x21c_26_orbitWhileScanning */
@ -1067,20 +1067,20 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x128_ = __dna_docin.readFloat("x128_");
/* x12c_ */
x12c_ = __dna_docin.readFloat("x12c_");
/* x130_ */
x130_ = __dna_docin.readFloat("x130_");
/* x134_ */
x134_ = __dna_docin.readFloat("x134_");
/* x130_horizontalFreeLookAngleVel */
x130_horizontalFreeLookAngleVel = __dna_docin.readFloat("x130_horizontalFreeLookAngleVel");
/* x134_verticalFreeLookAngleVel */
x134_verticalFreeLookAngleVel = __dna_docin.readFloat("x134_verticalFreeLookAngleVel");
/* x138_hudLagAmount */
x138_hudLagAmount = __dna_docin.readFloat("x138_hudLagAmount");
/* x13c_ */
x13c_ = __dna_docin.readFloat("x13c_");
/* x140_ */
x140_ = __dna_docin.readFloat("x140_");
/* x144_ */
x144_ = __dna_docin.readFloat("x144_");
/* x148_ */
x148_ = __dna_docin.readFloat("x148_");
/* x144_freeLookCenteredThresholdAngle */
x144_freeLookCenteredThresholdAngle = __dna_docin.readFloat("x144_freeLookCenteredThresholdAngle");
/* x148_freeLookCenteredTime */
x148_freeLookCenteredTime = __dna_docin.readFloat("x148_freeLookCenteredTime");
/* x14c_ */
x14c_ = __dna_docin.readFloat("x14c_");
/* x150_leftDiv */
@ -1095,10 +1095,10 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x228_26_ = __dna_docin.readBool("x228_26_");
/* x228_27_ */
x228_27_ = __dna_docin.readBool("x228_27_");
/* x228_28_ */
x228_28_ = __dna_docin.readBool("x228_28_");
/* x228_29_ */
x228_29_ = __dna_docin.readBool("x228_29_");
/* x228_28_enableFreeLook */
x228_28_enableFreeLook = __dna_docin.readBool("x228_28_enableFreeLook");
/* x228_29_twoButtonsForFreeLook */
x228_29_twoButtonsForFreeLook = __dna_docin.readBool("x228_29_twoButtonsForFreeLook");
/* x228_30_ */
x228_30_ = __dna_docin.readBool("x228_30_");
/* x228_31_ */
@ -1107,8 +1107,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x229_24_ = __dna_docin.readBool("x229_24_");
/* x229_25_aimWhenOrbitingPoint */
x229_25_aimWhenOrbitingPoint = __dna_docin.readBool("x229_25_aimWhenOrbitingPoint");
/* x229_26_ */
x229_26_ = __dna_docin.readBool("x229_26_");
/* x229_26_stayInFreeLookWhileFiring */
x229_26_stayInFreeLookWhileFiring = __dna_docin.readBool("x229_26_stayInFreeLookWhileFiring");
/* x229_27_ */
x229_27_ = __dna_docin.readBool("x229_27_");
/* x229_28_ */
@ -1306,8 +1306,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x214_ = __dna_docin.readFloat("x214_");
/* x218_scanningRange */
x218_scanningRange = __dna_docin.readFloat("x218_scanningRange");
/* x21c_24_ */
x21c_24_ = __dna_docin.readBool("x21c_24_");
/* x21c_24_scanRetention */
x21c_24_scanRetention = __dna_docin.readBool("x21c_24_scanRetention");
/* x21c_25_scanFreezesGame */
x21c_25_scanFreezesGame = __dna_docin.readBool("x21c_25_scanFreezesGame");
/* x21c_26_orbitWhileScanning */
@ -1576,20 +1576,20 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x128_", x128_);
/* x12c_ */
__dna_docout.writeFloat("x12c_", x12c_);
/* x130_ */
__dna_docout.writeFloat("x130_", x130_);
/* x134_ */
__dna_docout.writeFloat("x134_", x134_);
/* x130_horizontalFreeLookAngleVel */
__dna_docout.writeFloat("x130_horizontalFreeLookAngleVel", x130_horizontalFreeLookAngleVel);
/* x134_verticalFreeLookAngleVel */
__dna_docout.writeFloat("x134_verticalFreeLookAngleVel", x134_verticalFreeLookAngleVel);
/* x138_hudLagAmount */
__dna_docout.writeFloat("x138_hudLagAmount", x138_hudLagAmount);
/* x13c_ */
__dna_docout.writeFloat("x13c_", x13c_);
/* x140_ */
__dna_docout.writeFloat("x140_", x140_);
/* x144_ */
__dna_docout.writeFloat("x144_", x144_);
/* x148_ */
__dna_docout.writeFloat("x148_", x148_);
/* x144_freeLookCenteredThresholdAngle */
__dna_docout.writeFloat("x144_freeLookCenteredThresholdAngle", x144_freeLookCenteredThresholdAngle);
/* x148_freeLookCenteredTime */
__dna_docout.writeFloat("x148_freeLookCenteredTime", x148_freeLookCenteredTime);
/* x14c_ */
__dna_docout.writeFloat("x14c_", x14c_);
/* x150_leftDiv */
@ -1604,10 +1604,10 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeBool("x228_26_", x228_26_);
/* x228_27_ */
__dna_docout.writeBool("x228_27_", x228_27_);
/* x228_28_ */
__dna_docout.writeBool("x228_28_", x228_28_);
/* x228_29_ */
__dna_docout.writeBool("x228_29_", x228_29_);
/* x228_28_enableFreeLook */
__dna_docout.writeBool("x228_28_enableFreeLook", x228_28_enableFreeLook);
/* x228_29_twoButtonsForFreeLook */
__dna_docout.writeBool("x228_29_twoButtonsForFreeLook", x228_29_twoButtonsForFreeLook);
/* x228_30_ */
__dna_docout.writeBool("x228_30_", x228_30_);
/* x228_31_ */
@ -1616,8 +1616,8 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeBool("x229_24_", x229_24_);
/* x229_25_aimWhenOrbitingPoint */
__dna_docout.writeBool("x229_25_aimWhenOrbitingPoint", x229_25_aimWhenOrbitingPoint);
/* x229_26_ */
__dna_docout.writeBool("x229_26_", x229_26_);
/* x229_26_stayInFreeLookWhileFiring */
__dna_docout.writeBool("x229_26_stayInFreeLookWhileFiring", x229_26_stayInFreeLookWhileFiring);
/* x229_27_ */
__dna_docout.writeBool("x229_27_", x229_27_);
/* x229_28_ */
@ -1806,8 +1806,8 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x214_", x214_);
/* x218_scanningRange */
__dna_docout.writeFloat("x218_scanningRange", x218_scanningRange);
/* x21c_24_ */
__dna_docout.writeBool("x21c_24_", x21c_24_);
/* x21c_24_scanRetention */
__dna_docout.writeBool("x21c_24_scanRetention", x21c_24_scanRetention);
/* x21c_25_scanFreezesGame */
__dna_docout.writeBool("x21c_25_scanFreezesGame", x21c_25_scanFreezesGame);
/* x21c_26_orbitWhileScanning */
@ -1902,12 +1902,12 @@ void CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
void CTweakPlayer::FixupValues()
{
x130_ = zeus::degToRad(x130_);
x134_ = zeus::degToRad(x134_);
x130_horizontalFreeLookAngleVel = zeus::degToRad(x130_horizontalFreeLookAngleVel);
x134_verticalFreeLookAngleVel = zeus::degToRad(x134_verticalFreeLookAngleVel);
x138_hudLagAmount = zeus::degToRad(x138_hudLagAmount);
x13c_ = zeus::degToRad(x13c_);
x140_ = zeus::degToRad(x140_);
x144_ = zeus::degToRad(x144_);
x144_freeLookCenteredThresholdAngle = zeus::degToRad(x144_freeLookCenteredThresholdAngle);
x23c_ = zeus::degToRad(x23c_);
x240_ = zeus::degToRad(x240_);
x244_ = zeus::degToRad(x244_);

View File

@ -44,13 +44,13 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x124_eyeOffset;
Value<float> x128_;
Value<float> x12c_;
Value<float> x130_;
Value<float> x134_;
Value<float> x130_horizontalFreeLookAngleVel;
Value<float> x134_verticalFreeLookAngleVel;
Value<float> x138_hudLagAmount;
Value<float> x13c_;
Value<float> x140_;
Value<float> x144_;
Value<float> x148_;
Value<float> x144_freeLookCenteredThresholdAngle;
Value<float> x148_freeLookCenteredTime;
Value<float> x14c_;
Value<float> x150_leftDiv;
Value<float> x154_rightDiv;
@ -92,7 +92,7 @@ struct CTweakPlayer : ITweakPlayer
Value<float> x210_;
Value<float> x214_;
Value<float> x218_scanningRange;
Value<bool> x21c_24_ : 1;
Value<bool> x21c_24_scanRetention : 1;
Value<bool> x21c_25_scanFreezesGame : 1;
Value<bool> x21c_26_orbitWhileScanning : 1;
Value<float> x220_;
@ -101,13 +101,13 @@ struct CTweakPlayer : ITweakPlayer
Value<bool> x228_25_ : 1;
Value<bool> x228_26_ : 1;
Value<bool> x228_27_ : 1;
Value<bool> x228_28_ : 1;
Value<bool> x228_29_ : 1;
Value<bool> x228_28_enableFreeLook : 1;
Value<bool> x228_29_twoButtonsForFreeLook : 1;
Value<bool> x228_30_ : 1;
Value<bool> x228_31_ : 1;
Value<bool> x229_24_ : 1;
Value<bool> x229_25_aimWhenOrbitingPoint : 1;
Value<bool> x229_26_ : 1;
Value<bool> x229_26_stayInFreeLookWhileFiring : 1;
Value<bool> x229_27_ : 1;
Value<bool> x229_28_ : 1;
Value<bool> x229_29_ : 1;
@ -183,6 +183,8 @@ struct CTweakPlayer : ITweakPlayer
float GetFluidGravAccel() const { return xc8_fluidGravAccel; }
float GetEyeOffset() const { return x124_eyeOffset; }
float GetHudLagAmount() const { return x138_hudLagAmount; }
float GetFreeLookCenteredThresholdAngle() const { return x144_freeLookCenteredThresholdAngle; }
float GetFreeLookCenteredTime() const { return x148_freeLookCenteredTime; }
float GetOrbitNormalDistance() const { return x180_orbitNormalDistance; }
float GetMaxUpwardOrbitLookAngle() const { return x188_maxUpwardOrbitLookAngle; }
float GetMaxDownwardOrbitLookAngle() const { return x18c_maxDownwardOrbitLookAngle; }
@ -198,10 +200,14 @@ struct CTweakPlayer : ITweakPlayer
float GetOrbitNearZ() const { return x1dc_orbitNearZ; }
float GetOrbitZRange() const { return x1ec_orbitZRange; }
float GetScanningRange() const { return x218_scanningRange; }
bool GetScanRetention() const { return x21c_24_scanRetention; }
bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; }
bool GetOrbitWhileScanning() const { return x21c_26_orbitWhileScanning; }
float GetScanningFrameSenseRange() const { return x224_scanningFrameSenseRange; }
bool GetEnableFreeLook() const { return x228_28_enableFreeLook; }
bool GetTwoButtonsForFreeLook() const { return x228_29_twoButtonsForFreeLook; }
bool GetAimWhenOrbitingPoint() const { return x229_25_aimWhenOrbitingPoint; }
bool GetStayInFreeLookWhileFiring() const { return x229_26_stayInFreeLookWhileFiring; }
bool GetGunButtonTogglesHolster() const { return x229_30_gunButtonTogglesHolster; }
bool GetGunNotFiringHolstersGun() const { return x229_31_gunNotFiringHolstersGun; }
bool GetFiringCancelsCameraPitch() const { return x22a_26_firingCancelsCameraPitch; }
@ -232,7 +238,8 @@ struct CTweakPlayer : ITweakPlayer
float GetGrappleReleaseTime() const { return x2cc_grappleReleaseTime; }
uint32_t GetGrappleJumpMode() const { return x2d0_grappleJumpMode; }
bool InvertGrappleTurn() const { return x2d5_invertGrappleTurn; }
float GetX124() const { return x134_; }
float GetHorizontalFreeLookAngleVel() const { return x130_horizontalFreeLookAngleVel; }
float GetVerticalFreeLookAngleVel() const { return x134_verticalFreeLookAngleVel; }
float GetX184() const { return x184_; }
float GetX1fc() const { return x1fc_; }
bool GetX228_24() const { return x228_24_; }

View File

@ -17,7 +17,7 @@ struct CTweakSlideShow : ITweakSlideShow
String<-1> x14_fontAssetName;
DNAColor x24_fontColor;
DNAColor x28_outlineColor;
Value<float> x2c_;
Value<float> x2c_scanPercentInterval;
Value<float> x30_;
Value<float> x34_;
Value<float> x38_;
@ -36,6 +36,7 @@ struct CTweakSlideShow : ITweakSlideShow
const std::string& GetFont() const { return x14_fontAssetName; }
const zeus::CColor& GetFontColor() const { return x24_fontColor; }
const zeus::CColor& GetOutlineColor() const { return x28_outlineColor; }
float GetScanPercentInterval() const { return x2c_scanPercentInterval; }
float GetX54() const { return x54_; }
};

View File

@ -68,7 +68,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream)
xc0_frozenFpsCount = stream.ReadEncoded(2);
xc4_frozenBallCount = stream.ReadEncoded(2);
xc8_ = stream.ReadEncoded(1);
xcc_logScanCount = stream.ReadEncoded(7);
xcc_logScanPercent = stream.ReadEncoded(7);
xd0_24_fusionLinked = stream.ReadEncoded(1);
xd0_25_normalModeBeat = stream.ReadEncoded(1);
xd0_26_hardModeBeat = stream.ReadEncoded(1);
@ -114,7 +114,7 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const
w.WriteEncoded(xc0_frozenFpsCount, 2);
w.WriteEncoded(xc4_frozenBallCount, 2);
w.WriteEncoded(xc8_, 1);
w.WriteEncoded(xcc_logScanCount, 7);
w.WriteEncoded(xcc_logScanPercent, 7);
w.WriteEncoded(xd0_24_fusionLinked, 1);
w.WriteEncoded(xd0_25_normalModeBeat, 1);
w.WriteEncoded(xd0_26_hardModeBeat, 1);

View File

@ -62,7 +62,7 @@ class CPersistentOptions
u32 xc0_frozenFpsCount = 0;
u32 xc4_frozenBallCount = 0;
u32 xc8_ = 0;
u32 xcc_logScanCount = 0;
u32 xcc_logScanPercent = 0;
union
{
@ -98,8 +98,8 @@ public:
void SetPlayerFusionSuitActive(bool v) { xd0_28_fusionSuitActive = v; }
bool GetAllItemsCollected() const { return xd0_29_allItemsCollected; }
void SetAllItemsCollected(bool v) { xd0_29_allItemsCollected = v; }
u32 GetLogScanCount() const { return xcc_logScanCount; }
void SetLogScanCount(u32 v) { xcc_logScanCount = v; }
u32 GetLogScanPercent() const { return xcc_logScanPercent; }
void SetLogScanPercent(u32 v) { xcc_logScanPercent = v; }
void IncrementFrozenFpsCount() { xc0_frozenFpsCount = std::min(int(xc0_frozenFpsCount + 1), 3); }
bool GetShowFrozenFpsMessage() const { return xc0_frozenFpsCount != 3; }
void IncrementFrozenBallCount() { xc4_frozenBallCount = std::min(int(xc4_frozenBallCount + 1), 3); }

View File

@ -204,7 +204,7 @@ void CGameState::ImportPersistentOptions(const CPersistentOptions& opts)
xa8_systemOptions.xd0_27_fusionBeat = true;
if (&opts != &xa8_systemOptions)
memcpy(xa8_systemOptions.x0_, opts.x0_, 98);
xa8_systemOptions.SetLogScanCount(opts.GetLogScanCount());
xa8_systemOptions.SetLogScanPercent(opts.GetLogScanPercent());
xa8_systemOptions.SetAllItemsCollected(opts.GetAllItemsCollected());
xa8_systemOptions.SetPlayerBeatNormalMode(opts.GetPlayerBeatNormalMode());
xa8_systemOptions.SetPlayerBeatHardMode(opts.GetPlayerBeatHardMode());

View File

@ -94,6 +94,13 @@ public:
const std::vector<std::pair<ResId, CSaveWorld::EScanCategory>>& GetScanStates() const { return x20_scanStates; }
u32 GetScanCategoryCount(CSaveWorld::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; }
std::vector<std::pair<ResId, CSaveWorld::EScanCategory>>::const_iterator LookupScanState(ResId id) const
{
return
rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id,
[](const std::pair<ResId, CSaveWorld::EScanCategory>& p) { return p.first; });
}
bool HasSaveWorldMemory(ResId wldId) const;
const CSaveWorldMemory& GetSaveWorldMemory(ResId wldId) const;

View File

@ -93,11 +93,11 @@ CPlayerState::CPlayerState(CBitStreamReader& stream)
x170_scanTimes.emplace_back(state.first, time);
}
x180_logScans = stream.ReadEncoded(CBitStreamReader::GetBitCount(0x100));
x184_totalLogScans = stream.ReadEncoded(CBitStreamReader::GetBitCount(0x100));
x180_scanCompletionRate.first = stream.ReadEncoded(CBitStreamReader::GetBitCount(0x100));
x180_scanCompletionRate.second = stream.ReadEncoded(CBitStreamReader::GetBitCount(0x100));
}
void CPlayerState::PutTo(CBitStreamWriter &stream)
void CPlayerState::PutTo(CBitStreamWriter& stream)
{
stream.WriteEncoded(x4_, 32);
float hp = xc_health.GetHP();
@ -119,8 +119,8 @@ void CPlayerState::PutTo(CBitStreamWriter &stream)
stream.WriteEncoded(false, 1);
}
stream.WriteEncoded(x180_logScans, CBitStreamWriter::GetBitCount(0x100));
stream.WriteEncoded(x184_totalLogScans, CBitStreamWriter::GetBitCount(0x100));
stream.WriteEncoded(x180_scanCompletionRate.first, CBitStreamWriter::GetBitCount(0x100));
stream.WriteEncoded(x180_scanCompletionRate.second, CBitStreamWriter::GetBitCount(0x100));
}
static const float unk[]

View File

@ -124,8 +124,7 @@ private:
EPlayerSuit x20_currentSuit = EPlayerSuit::Power;
rstl::reserved_vector<CPowerUp, 41> x24_powerups;
rstl::reserved_vector<std::pair<ResId, float>, 846> x170_scanTimes;
u32 x180_logScans = 0;
u32 x184_totalLogScans = 0;
std::pair<u32, u32> x180_scanCompletionRate = {};
CStaticInterference x188_staticIntf;
public:
@ -169,8 +168,9 @@ public:
float CalculateHealth(u32 health);
void ReInitalizePowerUp(EItemType type, u32 capacity);
void InitializePowerUp(EItemType type, u32 capacity);
u32 GetLogScans() const { return x180_logScans; }
u32 GetTotalLogScans() const { return x184_totalLogScans; }
u32 GetLogScans() const { return x180_scanCompletionRate.first; }
u32 GetTotalLogScans() const { return x180_scanCompletionRate.second; }
void SetScanCompletionRate(const std::pair<u32, u32>& p) { x180_scanCompletionRate = p; }
bool IsPlayerAlive() const { return x0_24_alive; }
void SetPlayerAlive(bool alive) { x0_24_alive = alive; }
void InitializeScanTimes();

View File

@ -34,6 +34,11 @@ CCameraManager::CCameraManager(TUniqueId curCameraId) : x0_curCameraId(curCamera
sFirstPersonFOV = g_tweakGame->GetFirstPersonFOV();
}
bool CCameraManager::IsInFirstPersonCamera() const
{
return x7c_fpCamera->GetUniqueId() == x0_curCameraId;
}
zeus::CVector3f CCameraManager::GetGlobalCameraTranslation(const CStateManager& stateMgr) const
{
TCastToConstPtr<CGameCamera> camera(GetCurrentCamera(stateMgr));

View File

@ -80,6 +80,7 @@ public:
void ResetCameras(CStateManager& mgr);
void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball);
bool IsInCinematicCamera() const {return x4_cineCameras.size() != 0;}
bool IsInFirstPersonCamera() const;
zeus::CVector3f GetGlobalCameraTranslation(const CStateManager& stateMgr) const;
zeus::CTransform GetCurrentCameraTransform(const CStateManager& stateMgr) const;
void RemoveCameraShaker(int id);

View File

@ -87,7 +87,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
if (player->x3dc_inFreeLook)
{
float angle = player->x3ec_freeLookPitchAngle;
if (std::fabs(player->x3ec_freeLookPitchAngle) > (g_tweakPlayer->GetX124() - std::fabs(x1c0_)))
if (std::fabs(player->x3ec_freeLookPitchAngle) > (g_tweakPlayer->GetVerticalFreeLookAngleVel() - std::fabs(x1c0_)))
angle = (player->x3ec_freeLookPitchAngle > -0.f ? -1.f : 1.f);
zeus::CVector3f vec;
vec.z = std::sin(angle);

View File

@ -54,7 +54,7 @@ void CModelData::Render(const CStateManager& stateMgr, const zeus::CTransform& x
Render(GetRenderingModel(stateMgr), xf, lights, drawFlags);
}
CModelData::EWhichModel CModelData::GetRenderingModel(const CStateManager& stateMgr) const
CModelData::EWhichModel CModelData::GetRenderingModel(const CStateManager& stateMgr)
{
switch (stateMgr.GetPlayerState()->GetActiveVisor(stateMgr))
{

View File

@ -110,7 +110,7 @@ public:
SAdvancementDeltas GetAdvancementDeltas(const CCharAnimTime& a, const CCharAnimTime& b) const;
void Render(const CStateManager& stateMgr, const zeus::CTransform& xf,
const CActorLights* lights, const CModelFlags& drawFlags);
EWhichModel GetRenderingModel(const CStateManager& stateMgr) const;
static EWhichModel GetRenderingModel(const CStateManager& stateMgr);
CSkinnedModel& PickAnimatedModel(EWhichModel which) const;
const std::unique_ptr<CBooModel>& PickStaticModel(EWhichModel which) const;
void SetXRayModel(const std::pair<ResId, ResId>& modelSkin);

View File

@ -172,9 +172,9 @@ u32 CSlideShow::SlideShowGalleryFlags()
u32 ret = 0;
if (!g_GameState)
return ret;
if (g_GameState->SystemOptions().GetLogScanCount() >= 50)
if (g_GameState->SystemOptions().GetLogScanPercent() >= 50)
ret |= 1;
if (g_GameState->SystemOptions().GetLogScanCount() == 100)
if (g_GameState->SystemOptions().GetLogScanPercent() == 100)
ret |= 2;
if (g_GameState->SystemOptions().GetPlayerBeatHardMode())
ret |= 4;

View File

@ -119,6 +119,13 @@ public:
return {::GetAverage<T>(this->data(), this->size())};
}
rstl::optional_object<T> GetEntry(int i) const
{
if (i >= this->size())
return {};
return this->operator[](i);
}
void Clear() { this->clear(); }
};

View File

@ -31,4 +31,9 @@ void CGrappleArm::GrappleBeamConnected()
}
void CGrappleArm::RenderGrappleBeam(const CStateManager& mgr, const zeus::CVector3f& pos)
{
}
}

View File

@ -22,6 +22,8 @@ public:
Six,
Seven,
Eight,
Nine,
Ten
};
private:
CModelData x0_modelData;
@ -31,6 +33,7 @@ private:
{
struct
{
bool x3b2_24_inGrappleCycle : 1;
bool x3b2_25_beamActive : 1;
bool x3b2_27_armMoving : 1;
};
@ -44,11 +47,13 @@ public:
const zeus::CTransform& GetTransform() const { return x220_xf; }
void SetAnimState(EArmState state);
EArmState GetAnimState() const { return x334_animState; }
bool InGrappleCycle() const { return x3b2_24_inGrappleCycle; }
bool BeamActive() const { return x3b2_25_beamActive; }
bool IsArmMoving() const { return x3b2_27_armMoving; }
void Activate(bool);
void GrappleBeamDisconnected();
void GrappleBeamConnected();
void RenderGrappleBeam(const CStateManager& mgr, const zeus::CVector3f& pos);
};
}

View File

@ -35,7 +35,7 @@ void CPlayerGun::AsyncLoadSuit(CStateManager& mgr)
x740_grappleArm->AsyncLoadSuit(mgr);
}
void CPlayerGun::TouchModel(CStateManager& stateMgr)
void CPlayerGun::TouchModel(const CStateManager& stateMgr)
{
}
@ -68,4 +68,19 @@ float CPlayerGun::GetBeamVelocity() const
return 10.f;
}
void CPlayerGun::PreRender(const CStateManager& mgr, const zeus::CFrustum& frustum, const zeus::CVector3f& camPos)
{
}
void CPlayerGun::Render(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags) const
{
}
void CPlayerGun::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const
{
}
}

View File

@ -210,7 +210,7 @@ public:
void AcceptScriptMessage(EScriptObjectMessage, TUniqueId, CStateManager&);
void AsyncLoadSuit(CStateManager& mgr);
void TouchModel(CStateManager& stateMgr);
void TouchModel(const CStateManager& stateMgr);
EMissleMode GetMissleMode() const { return x31c_missileMode; }
bool IsFidgeting() const { return x833_24_isFidgeting; }
bool IsCharging() const { return x834_24_charging; }
@ -229,6 +229,9 @@ public:
void ResetIdle(CStateManager& mgr);
void CancelFiring(CStateManager& mgr);
float GetBeamVelocity() const;
void PreRender(const CStateManager& mgr, const zeus::CFrustum& frustum, const zeus::CVector3f& camPos);
void Render(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags) const;
void AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const;
};
}

View File

@ -40,4 +40,19 @@ void CMorphBall::DrawBallShadow(const CStateManager& mgr)
x1e50_shadow->Render(mgr, alpha);
}
void CMorphBall::DeleteBallShadow()
{
}
void CMorphBall::CreateBallShadow()
{
}
void CMorphBall::RenderToShadowTex(CStateManager& mgr)
{
}
}

View File

@ -31,6 +31,14 @@ public:
};
private:
CPlayer& x0_player;
std::unique_ptr<CModelData> x58_ballModel;
u32 x5c_ballModelShader = 0;
std::unique_ptr<CModelData> x60_spiderBallGlassModel;
u32 x64_spiderBallGlassModelShader = 0;
std::unique_ptr<CModelData> x68_lowPolyBallModel;
u32 x6c_lowPolyBallModelShader = 0;
std::unique_ptr<CModelData> x70_frozenBallModel;
u32 x74_frozenBallModelShader = 0;
u32 x187c_ = 0;
float x191c_damageTimer = 0.f;
float x1DE8_boostTime = 0.f;
@ -72,7 +80,7 @@ public:
void ComputeMarioMovement(const CFinalInput&, CStateManager&, float) {}
void SetSpiderBallState(ESpiderBallState) {}
void GetSwooshToWorld() const {}
void GetBallToWorld() const {}
zeus::CTransform GetBallToWorld() const { return {}; }
void CalculateSurfaceToWorld(const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CVector3f&) const {}
void CalculateBallContactInfo(zeus::CVector3f&, zeus::CVector3f&) const {}
void BallTurnInput(const CFinalInput&) const {}
@ -96,7 +104,7 @@ public:
zeus::CTransform GetPrimitiveTransform() const { return {}; }
void DrawCollisionPrimitive() const {}
void GetMinimumAlignmentSpeed() const {}
void PreRender(CStateManager&, const zeus::CFrustum&);
void PreRender(CStateManager&, const zeus::CFrustum&) {}
void Render(const CStateManager&, const CActorLights*) const {}
void ResetMorphBallTransitionFlash() {}
void UpdateMorphBallTransitionFlash(float) {}
@ -113,14 +121,14 @@ public:
void DisableHalfPipeStatus() {}
void BallCloseToCollision(const CStateManager&, float) const {}
void CollidedWith(const TUniqueId&, const CCollisionInfoList&, CStateManager&) {}
void IsInFrustum(const zeus::CFrustum&) const {}
bool IsInFrustum(const zeus::CFrustum&) const { return false; }
void ComputeLiftForces(const zeus::CVector3f&, const zeus::CVector3f&, const CStateManager&) {}
void CalculateSurfaceFriction() const {}
void ApplyGravity(CStateManager&) {}
void SpinToSpeed(float, zeus::CVector3f, float) {}
void ComputeMaxSpeed() const {}
void Touch(CActor&, CStateManager&) {}
bool IsClimable(const CCollisionInfo&) const { return false; }
bool IsClimbable(const CCollisionInfo&) const { return false; }
void FluidFXThink(CActor::EFluidState, CScriptWater&, CStateManager&) {}
void GetMorphBallModel(const std::string&, float) {}
void AddSpiderBallElectricalEffect() {}
@ -135,10 +143,16 @@ public:
void LoadAnimationTokens(const std::string&) {}
void TakeDamage(float) {}
void DrawBallShadow(const CStateManager& mgr);
void DeleteBallShadow();
void CreateBallShadow();
void RenderToShadowTex(CStateManager& mgr);
void StartLandingSfx() {}
bool GetX187c() const { return x187c_; }
void SetDamageTimer(float t) { x191c_damageTimer = t; }
void Stop() {}
CModelData& GetMorphballModelData() const { return *x58_ballModel; }
u32 GetMorphballModelShader() const { return x5c_ballModelShader; }
};
}

View File

@ -66,7 +66,7 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
x9c5_31_ = true;
ResId beamId = g_tweakPlayerRes->GetBeamBallTransitionModel(x7ec_beam);
x7f0_ballTransitionBeamModel = std::make_unique<CModelData>(CStaticRes(beamId, playerScale));
x730_.reserve(3);
x730_transitionModels.reserve(3);
x768_morphball.reset(new CMorphBall(*this, f4));
SetInertiaTensorScalar(xe8_mass);
@ -414,10 +414,7 @@ rstl::optional_object<zeus::CAABox> CPlayer::GetTouchBounds() const
GetTranslation() + zeus::CVector3f(0.f, 0.f, x768_morphball->GetBallRadius());
return zeus::CAABox(ballCenter - ballTouchRad, ballCenter + ballTouchRad);
}
else
{
return GetBoundingBox();
}
return GetBoundingBox();
}
void CPlayer::DoPreThink(float dt, CStateManager& mgr)
@ -434,11 +431,202 @@ void CPlayer::DoThink(float dt, CStateManager& mgr)
ent->Think(dt, mgr);
}
void CPlayer::UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float) {}
void CPlayer::UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float dt)
{
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan)
{
SetScanningState(EPlayerScanState::NotScanning, mgr);
return;
}
void CPlayer::ValidateScanning(const CFinalInput& input, CStateManager& mgr) {}
if (x3a8_scanState != EPlayerScanState::NotScanning && x3b4_scanningObject != x310_orbitTargetId &&
x310_orbitTargetId != kInvalidUniqueId)
SetScanningState(EPlayerScanState::NotScanning, mgr);
void CPlayer::SetScanningState(EPlayerScanState, CStateManager& mgr) {}
switch (x3a8_scanState)
{
case EPlayerScanState::NotScanning:
if (ValidateScanning(input, mgr))
{
if (TCastToPtr<CActor> act = mgr.ObjectById(x310_orbitTargetId))
{
const CScannableObjectInfo* scanInfo = act->GetScannableObjectInfo();
float scanTime = mgr.GetPlayerState()->GetScanTime(scanInfo->GetScannableObjectId());
if (scanTime >= 1.f)
{
x9c6_30_newScanScanning = false;
scanTime = 0.f;
}
else
{
x9c6_30_newScanScanning = true;
}
SetScanningState(EPlayerScanState::Scanning, mgr);
x3ac_scanningTime = scanTime * scanInfo->GetTotalDownloadTime();
x3b0_curScanTime = 0.f;
}
}
break;
case EPlayerScanState::Scanning:
if (ValidateScanning(input, mgr))
{
if (TCastToPtr<CActor> act = mgr.ObjectById(x310_orbitTargetId))
{
if (const CScannableObjectInfo* scanInfo = act->GetScannableObjectInfo())
{
x3ac_scanningTime = std::min(scanInfo->GetTotalDownloadTime(), x3ac_scanningTime + dt);
x3b0_curScanTime += dt;
mgr.GetPlayerState()->SetScanTime(scanInfo->GetScannableObjectId(),
x3ac_scanningTime / scanInfo->GetTotalDownloadTime());
if (x3ac_scanningTime >= scanInfo->GetTotalDownloadTime() &&
x3b0_curScanTime >= g_tweakGui->GetScanSidesStartTime())
SetScanningState(EPlayerScanState::ScanComplete, mgr);
}
}
else
{
SetScanningState(EPlayerScanState::NotScanning, mgr);
}
}
else
{
SetScanningState(EPlayerScanState::NotScanning, mgr);
}
break;
case EPlayerScanState::ScanComplete:
if (!ValidateScanning(input, mgr))
SetScanningState(EPlayerScanState::NotScanning, mgr);
break;
}
}
bool CPlayer::ValidateScanning(const CFinalInput& input, CStateManager& mgr)
{
if (ControlMapper::GetDigitalInput(ControlMapper::ECommands::ScanItem, input))
{
if (x304_orbitState == EPlayerOrbitState::One)
{
if (TCastToPtr<CActor> act = mgr.ObjectById(x310_orbitTargetId))
{
if (act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
{
zeus::CVector3f targetToPlayer = GetTranslation() - act->GetTranslation();
if (targetToPlayer.canBeNormalized() &&
targetToPlayer.magnitude() < g_tweakPlayer->GetScanningRange())
return true;
}
}
}
}
return false;
}
static bool IsDataLoreResearchScan(ResId id)
{
auto it = g_MemoryCardSys->LookupScanState(id);
if (it == g_MemoryCardSys->GetScanStates().cend())
return false;
switch (it->second)
{
case CSaveWorld::EScanCategory::Data:
case CSaveWorld::EScanCategory::Lore:
case CSaveWorld::EScanCategory::Research:
return true;
default:
return false;
}
}
static const char* UnlockMessageResBases[] =
{
"STRG_SlideShow_Unlock1_",
"STRG_SlideShow_Unlock2_"
};
static ResId UpdatePersistentScanPercent(u32 prevLogScans, u32 logScans, u32 totalLogScans)
{
if (prevLogScans == logScans)
return -1;
float scanPercent = logScans / float(totalLogScans) * 100.f;
float prevScanPercent = prevLogScans / float(totalLogScans) * 100.f;
float scanMessageInterval = g_tweakSlideShow->GetScanPercentInterval();
auto scanPercentProgStep = int(scanPercent / scanMessageInterval);
auto prevScanPercentProgStep = int(prevScanPercent / scanMessageInterval);
bool firstTime = scanPercent > g_GameState->SystemOptions().GetLogScanPercent();
if (firstTime)
g_GameState->SystemOptions().SetLogScanPercent(u32(scanPercent));
if (scanPercentProgStep > prevScanPercentProgStep)
{
auto message =
std::string(UnlockMessageResBases[zeus::clamp(0, scanPercentProgStep - 1, 1)]) + (firstTime ? '1' : '2');
auto id = g_ResFactory->GetResourceIdByName(message.c_str());
if (id)
return id->id;
}
return -1;
}
void CPlayer::FinishNewScan(CStateManager& mgr)
{
if (TCastToPtr<CActor> act = mgr.ObjectById(x310_orbitTargetId))
if (act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
if (auto scanInfo = act->GetScannableObjectInfo())
if (mgr.GetPlayerState()->GetScanTime(scanInfo->GetScannableObjectId()) >= 1.f)
if (IsDataLoreResearchScan(scanInfo->GetScannableObjectId()))
{
auto scanCompletion = mgr.CalculateScanCompletionRate();
ResId message = UpdatePersistentScanPercent(mgr.GetPlayerState()->GetLogScans(),
scanCompletion.first, scanCompletion.second);
if (message != -1)
mgr.ShowPausedHUDMemo(message, 0.f);
mgr.GetPlayerState()->SetScanCompletionRate(scanCompletion);
}
}
void CPlayer::SetScanningState(EPlayerScanState state, CStateManager& mgr)
{
if (x3a8_scanState == state)
return;
mgr.SetGameState(CStateManager::EGameState::Running);
if (x3a8_scanState == EPlayerScanState::ScanComplete)
if (TCastToPtr<CActor> act = mgr.ObjectById(x3b4_scanningObject))
act->OnScanStateChanged(EScanState::Done, mgr);
switch (state)
{
case EPlayerScanState::NotScanning:
if (x3a8_scanState == EPlayerScanState::Scanning || x3a8_scanState == EPlayerScanState::ScanComplete)
if (x9c6_30_newScanScanning)
FinishNewScan(mgr);
x3ac_scanningTime = 0.f;
x3b0_curScanTime = 0.f;
if (!g_tweakPlayer->GetScanRetention())
if (TCastToPtr<CActor> act = mgr.ObjectById(x310_orbitTargetId))
if (act->GetMaterialList().HasMaterial(EMaterialTypes::Scannable))
if (auto scanInfo = act->GetScannableObjectInfo())
if (mgr.GetPlayerState()->GetScanTime(scanInfo->GetScannableObjectId()) < 1.f)
mgr.GetPlayerState()->SetScanTime(scanInfo->GetScannableObjectId(), 0.f);
x3b4_scanningObject = kInvalidUniqueId;
break;
case EPlayerScanState::Scanning:
x3b4_scanningObject = x310_orbitTargetId;
break;
case EPlayerScanState::ScanComplete:
if (g_tweakPlayer->GetScanFreezesGame())
mgr.SetGameState(CStateManager::EGameState::SoftPaused);
x3b4_scanningObject = x310_orbitTargetId;
break;
}
x3a8_scanState = state;
}
bool CPlayer::GetExplorationMode() const
{
@ -464,21 +652,394 @@ bool CPlayer::GetCombatMode() const
}
}
void CPlayer::RenderGun(const CStateManager& mgr, const zeus::CVector3f&) const {}
void CPlayer::RenderGun(const CStateManager& mgr, const zeus::CVector3f& pos) const
{
if (mgr.GetCameraManager()->IsInCinematicCamera())
return;
void CPlayer::Render(const CStateManager& mgr) const {}
if (x490_gun->GetGrappleArm().InGrappleCycle() &&
x490_gun->GetGrappleArm().GetAnimState() != CGrappleArm::EArmState::Ten)
x490_gun->GetGrappleArm().RenderGrappleBeam(mgr, pos);
void CPlayer::RenderReflectedPlayer(CStateManager& mgr) const {}
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::Scan &&
mgr.GetPlayerState()->GetVisorTransitionFactor() >= 1.f)
return;
void CPlayer::PreRender(CStateManager& mgr, const zeus::CFrustum&) {}
if ((mgr.GetCameraManager()->IsInFirstPersonCamera() && x2f4_cameraState == EPlayerCameraState::Zero) ||
(x2f8_morphTransState == EPlayerMorphBallState::Morphing &&
x498_gunHolsterState == EGunHolsterState::Holstering))
{
CModelFlags flags(5, 0, 3, zeus::CColor(1.f, x494_mapAlpha));
x490_gun->Render(mgr, pos, flags);
}
}
void CPlayer::CalculateRenderBounds() {}
void CPlayer::Render(const CStateManager& mgr) const
{
bool doRender = x2f4_cameraState != EPlayerCameraState::Four;
if (!doRender)
if (TCastToConstPtr<CCinematicCamera> cam = mgr.GetCameraManager()->GetCurrentCamera(mgr))
doRender = (x2f8_morphTransState == EPlayerMorphBallState::Morphed && cam->GetW1() & 0x40);
if (x2f4_cameraState != EPlayerCameraState::Zero && doRender)
{
bool doTransitionRender = false;
bool doBallRender = false;
switch (x2f8_morphTransState)
{
case EPlayerMorphBallState::Unmorphed:
x64_modelData->Touch(mgr, 0);
CPhysicsActor::Render(mgr);
if (HasTransitionBeamModel())
{
x7f0_ballTransitionBeamModel->Touch(mgr, 0);
CModelFlags flags(0, 0, 3, zeus::CColor::skWhite);
x7f0_ballTransitionBeamModel->Render(mgr, x7f4_, x90_actorLights.get(), flags);
}
break;
case EPlayerMorphBallState::Morphing:
x768_morphball->TouchModel(mgr);
doTransitionRender = true;
doBallRender = true;
break;
case EPlayerMorphBallState::Unmorphing:
x490_gun->TouchModel(mgr);
doTransitionRender = true;
doBallRender = true;
break;
case EPlayerMorphBallState::Morphed:
x64_modelData->Touch(mgr, 0);
x768_morphball->Render(mgr, x90_actorLights.get());
break;
}
void CPlayer::AddToRenderer(const zeus::CFrustum&, const CStateManager&) {}
if (doTransitionRender)
{
CPhysicsActor::Render(mgr);
if (HasTransitionBeamModel())
{
CModelFlags flags(5, 0, 3, zeus::CColor(1.f, x588_alpha));
x7f0_ballTransitionBeamModel->Render(CModelData::EWhichModel::Normal,
x7f4_, x90_actorLights.get(), flags);
}
void CPlayer::ComputeFreeLook(const CFinalInput& input) {}
float morphFactor = x574_morphTime / x578_morphDuration;
float transitionAlpha;
if (morphFactor < 0.05f)
transitionAlpha = 0.f;
else if (morphFactor < 0.1f)
transitionAlpha = (morphFactor - 0.05f) / 0.05f;
else if (morphFactor < 0.8f)
transitionAlpha = 1.f;
else
transitionAlpha = 1.f - (morphFactor - 0.8f) / 0.2f;
void CPlayer::UpdateFreeLookState(const CFinalInput&, float dt, CStateManager&) {}
auto mdsp1 = int(x730_transitionModels.size() + 1);
for (int i=0 ; i<x730_transitionModels.size() ; ++i)
{
int ni = i + 1;
float alpha = transitionAlpha * (1.f - (ni + 1) / float(mdsp1)) *
*x71c_transitionModelAlphas.GetEntry(ni);
if (alpha != 0.f)
{
CModelData& data = *x730_transitionModels[i];
CModelFlags flags(5, 0, 3, zeus::CColor(1.f, alpha));
data.Render(CModelData::GetRenderingModel(mgr), *x658_transitionModelXfs.GetEntry(ni),
x90_actorLights.get(), flags);
if (HasTransitionBeamModel())
{
CModelFlags flags(5, 0, 3, zeus::CColor(1.f, alpha));
x7f0_ballTransitionBeamModel->Render(CModelData::EWhichModel::Normal,
*x594_transisionBeamXfs.GetEntry(ni),
x90_actorLights.get(), flags);
}
}
}
if (doBallRender)
{
float morphFactor = x574_morphTime / x578_morphDuration;
float ballAlphaStart = 0.75f;
float ballAlphaMag = 4.f;
if (x2f8_morphTransState == EPlayerMorphBallState::Unmorphing)
{
ballAlphaStart = 0.875f;
morphFactor = 1.f - morphFactor;
ballAlphaMag = 8.f;
}
if (morphFactor > ballAlphaStart)
{
CModelFlags flags(5, u8(x768_morphball->GetMorphballModelShader()), 3,
zeus::CColor(1.f, ballAlphaMag * (morphFactor - ballAlphaStart)));
x768_morphball->GetMorphballModelData().Render(mgr, x768_morphball->GetBallToWorld(),
x90_actorLights.get(), flags);
}
if (x2f8_morphTransState == EPlayerMorphBallState::Morphing)
{
if (morphFactor > 0.5f)
{
float tmp = (morphFactor - 0.5f) / 0.5f;
float rotate = 1.f - tmp;
float scale = 0.75f * rotate + 1.f;
float ballAlpha;
if (tmp < 0.1f)
ballAlpha = 0.f;
else if (tmp < 0.2f)
ballAlpha = (tmp - 0.1f) / 0.1f;
else if (tmp < 0.9f)
ballAlpha = 1.f;
else
ballAlpha = 1.f - (morphFactor - 0.9f) / 0.1f;
float theta = zeus::degToRad(360.f * rotate);
ballAlpha *= 0.5f;
if (ballAlpha > 0.f)
{
CModelFlags flags(7, 0, 3, zeus::CColor(1.f, ballAlpha));
x768_morphball->GetMorphballModelData().Render(mgr, x768_morphball->GetBallToWorld() *
zeus::CTransform::RotateZ(theta) * zeus::CTransform::Scale(scale),
x90_actorLights.get(), flags);
}
}
x768_morphball->RenderMorphBallTransitionFlash(mgr);
}
}
}
}
}
void CPlayer::RenderReflectedPlayer(CStateManager& mgr)
{
zeus::CFrustum frustum;
switch (x2f8_morphTransState)
{
case EPlayerMorphBallState::Unmorphed:
case EPlayerMorphBallState::Morphing:
case EPlayerMorphBallState::Unmorphing:
SetCalculateLighting(true);
if (x2f4_cameraState == EPlayerCameraState::Zero)
CActor::PreRender(mgr, frustum);
CPhysicsActor::Render(mgr);
if (HasTransitionBeamModel())
{
CModelFlags flags(0, 0, 3, zeus::CColor::skWhite);
x7f0_ballTransitionBeamModel->Render(mgr, x7f4_, nullptr, flags);
}
break;
case EPlayerMorphBallState::Morphed:
x768_morphball->Render(mgr, x90_actorLights.get());
break;
}
}
void CPlayer::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
{
if (x2f8_morphTransState == EPlayerMorphBallState::Morphed)
{
SetCalculateLighting(false);
x768_morphball->PreRender(mgr, frustum);
}
else
{
SetCalculateLighting(true);
if (x2f8_morphTransState == EPlayerMorphBallState::Unmorphed)
{
x490_gun->PreRender(mgr, frustum,
mgr.GetCameraManager()->GetGlobalCameraTranslation(mgr));
}
}
if (x2f8_morphTransState == EPlayerMorphBallState::Unmorphed ||
mgr.GetCameraManager()->IsInCinematicCamera())
{
x768_morphball->DeleteBallShadow();
}
else
{
x768_morphball->CreateBallShadow();
x768_morphball->RenderToShadowTex(mgr);
}
for (auto& model : x730_transitionModels)
model->AnimationData()->PreRender();
if (x2f4_cameraState != EPlayerCameraState::Zero)
CActor::PreRender(mgr, frustum);
}
void CPlayer::CalculateRenderBounds()
{
if (x2f8_morphTransState == EPlayerMorphBallState::Morphed)
{
float rad = x768_morphball->GetBallRadius();
x9c_aabox = zeus::CAABox(GetTranslation() - zeus::CVector3f(rad, rad, 0.f),
GetTranslation() + zeus::CVector3f(rad, rad, rad * 2.f));
}
else
{
CActor::CalculateRenderBounds();
}
}
void CPlayer::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const
{
if (x2f4_cameraState != EPlayerCameraState::Zero &&
x2f8_morphTransState == EPlayerMorphBallState::Morphed)
{
if (x768_morphball->IsInFrustum(frustum))
CActor::AddToRenderer(frustum, mgr);
else
x768_morphball->TouchModel(mgr);
}
else
{
x490_gun->AddToRenderer(frustum, mgr);
CActor::AddToRenderer(frustum, mgr);
}
}
void CPlayer::ComputeFreeLook(const CFinalInput& input)
{
float lookLeft = ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookLeft, input);
float lookRight = ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookRight, input);
float lookUp = ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookUp, input);
float lookDown = ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookDown, input);
if (g_GameState->GameOptions().GetInvertYAxis())
{
lookUp = ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookDown, input);
lookDown = ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookUp, input);
}
if (!g_tweakPlayer->GetStayInFreeLookWhileFiring() &&
(ControlMapper::GetDigitalInput(ControlMapper::ECommands::FireOrBomb, input) ||
x304_orbitState != EPlayerOrbitState::Zero))
{
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
}
else
{
if (x3dc_inFreeLook)
{
x3e8_horizFreeLookAngleVel = (lookLeft - lookRight) * g_tweakPlayer->GetHorizontalFreeLookAngleVel();
x3f0_vertFreeLookAngleVel = (lookUp - lookDown) * g_tweakPlayer->GetVerticalFreeLookAngleVel();
}
if (!x3de_lookControlHeld || !x3dd_freeLookPitchAngleCalculated)
{
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
}
}
if (g_tweakPlayer->GetEnableFreeLook())
{
if ((g_tweakPlayer->GetTwoButtonsForFreeLook() &&
(!ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold1, input) ||
!ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold2, input))) ||
(!ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold1, input) &&
!ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold2, input)))
{
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
}
}
if (IsMorphBallTransitioning())
{
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
}
}
void CPlayer::UpdateFreeLookState(const CFinalInput& input, float dt, CStateManager& mgr)
{
if (x304_orbitState == EPlayerOrbitState::Four || IsMorphBallTransitioning() ||
x2f8_morphTransState != EPlayerMorphBallState::Unmorphed ||
(x3b8_grappleState != EGrappleState::None && x3b8_grappleState != EGrappleState::Firing))
{
x3dc_inFreeLook = false;
x3dd_freeLookPitchAngleCalculated = false;
x3de_lookControlHeld = false;
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
x9c4_25_showCrosshairs = false;
return;
}
if (g_tweakPlayer->GetEnableFreeLook())
{
if ((g_tweakPlayer->GetTwoButtonsForFreeLook() &&
(ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold1, input) &&
ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold2, input))) ||
(!g_tweakPlayer->GetTwoButtonsForFreeLook() &&
(ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold1, input) ||
ControlMapper::GetDigitalInput(ControlMapper::ECommands::LookHold2, input))))
{
if (!x3dd_freeLookPitchAngleCalculated)
{
zeus::CVector3f lookDir = mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().basis[1];
zeus::CVector3f lookDirFlat = lookDir;
lookDirFlat.z = 0.f;
x3e4_ = 0.f;
if (lookDirFlat.canBeNormalized())
{
lookDirFlat.normalize();
x3ec_freeLookPitchAngle = std::acos(zeus::clamp(-1.f, lookDirFlat.dot(lookDir), 1.f));
if (lookDir.z < 0.f)
x3ec_freeLookPitchAngle = -x3ec_freeLookPitchAngle;
}
}
x3dc_inFreeLook = true;
x3dd_freeLookPitchAngleCalculated = true;
x3de_lookControlHeld =
(ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookLeft, input) >= 0.1f ||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookRight, input) >= 0.1f ||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookDown, input) >= 0.1f ||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookUp, input) >= 0.1f);
}
else
{
x3dc_inFreeLook = false;
x3dd_freeLookPitchAngleCalculated = false;
x3de_lookControlHeld = false;
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
}
}
else
{
x3de_lookControlHeld =
(ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookLeft, input) >= 0.1f ||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookRight, input) >= 0.1f ||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookDown, input) >= 0.1f ||
ControlMapper::GetAnalogInput(ControlMapper::ECommands::LookUp, input) >= 0.1f);
x3dd_freeLookPitchAngleCalculated = false;
if (std::fabs(x3e4_) < g_tweakPlayer->GetFreeLookCenteredThresholdAngle() &&
std::fabs(x3ec_freeLookPitchAngle) < g_tweakPlayer->GetFreeLookCenteredThresholdAngle())
{
if (x3e0_curFreeLookCenteredTime > g_tweakPlayer->GetFreeLookCenteredTime())
{
x3dc_inFreeLook = false;
x3e8_horizFreeLookAngleVel = 0.f;
x3f0_vertFreeLookAngleVel = 0.f;
}
else
{
x3e0_curFreeLookCenteredTime += dt;
}
}
else
{
x3dc_inFreeLook = true;
x3e0_curFreeLookCenteredTime = 0.f;
}
}
UpdateCrosshairsState(input);
}
void CPlayer::UpdateFreeLook(float dt) {}
@ -1161,7 +1722,7 @@ void CPlayer::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CState
break;
case EScriptObjectMessage::Deleted:
mgr.GetPlayerState()->ResetVisor();
x730_.clear();
x730_transitionModels.clear();
break;
default: break;
}
@ -1732,6 +2293,18 @@ void CPlayer::HolsterGun(CStateManager& mgr)
ResetAimTargetPrediction(kInvalidUniqueId);
}
bool CPlayer::IsMorphBallTransitioning() const
{
switch (x2f8_morphTransState)
{
case EPlayerMorphBallState::Morphing:
case EPlayerMorphBallState::Unmorphing:
return true;
default:
return false;
}
}
void CPlayer::UpdateGrappleArmTransform(const zeus::CVector3f& offset, CStateManager& mgr, float dt)
{
zeus::CTransform armXf = x34_transform;
@ -2083,6 +2656,9 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
break;
case CGrappleArm::EArmState::Six:
BeginGrapple(playerToPoint, mgr);
break;
default:
break;
}
break;
case 1:
@ -2095,6 +2671,9 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
break;
case CGrappleArm::EArmState::Six:
BeginGrapple(playerToPoint, mgr);
break;
default:
break;
}
break;
}
@ -2107,6 +2686,9 @@ void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr)
break;
case CGrappleArm::EArmState::Six:
BeginGrapple(playerToPoint, mgr);
break;
default:
break;
}
break;
}
@ -3095,7 +3677,7 @@ CPlayer::EOrbitValidationResult CPlayer::ValidateOrbitTargetId(TUniqueId uid, CS
return EOrbitValidationResult::InvalidTarget;
if (x740_ != 0.f)
EOrbitValidationResult::PlayerNotReadyToTarget;
return EOrbitValidationResult::PlayerNotReadyToTarget;
zeus::CVector3f eyePos = GetEyePosition();
zeus::CVector3f eyeToOrbit = act->GetOrbitPosition(mgr) - eyePos;

View File

@ -258,7 +258,7 @@ private:
float x3a4_ = 0.449f;
EPlayerScanState x3a8_scanState = EPlayerScanState::NotScanning;
float x3ac_scanningTime = 0.f;
float x3b0_ = 0.f;
float x3b0_curScanTime = 0.f;
TUniqueId x3b4_scanningObject = kInvalidUniqueId;
EGrappleState x3b8_grappleState = EGrappleState::None;
float x3bc_grappleSwingTimer = 0.f;
@ -270,10 +270,11 @@ private:
bool x3dc_inFreeLook = false;
bool x3dd_freeLookPitchAngleCalculated = false;
bool x3de_lookControlHeld = false;
float x3e0_curFreeLookCenteredTime = 0.f;
float x3e4_ = 0.f;
float x3e8_ = 0.f;
float x3e8_horizFreeLookAngleVel = 0.f;
float x3ec_freeLookPitchAngle = 0.f;
float x3f0_ = 0.f;
float x3f0_vertFreeLookAngleVel = 0.f;
TUniqueId x3f4_aimTarget = kInvalidUniqueId;
zeus::CVector3f x3f8_targetAimPosition = zeus::CVector3f::skZero;
TReservedAverage<zeus::CVector3f, 20> x404_aimTargetAverage;
@ -305,10 +306,10 @@ private:
u32 x57c_ = 0;
u32 x580_ = 0;
float x588_alpha = 1.f;
u32 x594_ = 0;
u32 x658_ = 0;
u32 x71c_ = 0;
std::vector<std::unique_ptr<CModelData>> x730_;
TReservedAverage<zeus::CTransform, 4> x594_transisionBeamXfs;
TReservedAverage<zeus::CTransform, 4> x658_transitionModelXfs;
TReservedAverage<float, 4> x71c_transitionModelAlphas;
std::vector<std::unique_ptr<CModelData>> x730_transitionModels;
float x740_ = 0.f;
float x744_ = 0.f;
float x748_ = 0.f;
@ -443,17 +444,18 @@ public:
void DoPreThink(float dt, CStateManager& mgr);
void DoThink(float dt, CStateManager& mgr);
void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float);
void ValidateScanning(const CFinalInput& input, CStateManager& mgr);
bool ValidateScanning(const CFinalInput& input, CStateManager& mgr);
void FinishNewScan(CStateManager& mgr);
void SetScanningState(EPlayerScanState, CStateManager& mgr);
void SetSpawnedMorphBallState(EPlayerMorphBallState, CStateManager&);
bool GetExplorationMode() const;
bool GetCombatMode() const;
void RenderGun(const CStateManager& mgr, const zeus::CVector3f&) const;
void Render(const CStateManager& mgr) const;
void RenderReflectedPlayer(CStateManager& mgr) const;
void RenderReflectedPlayer(CStateManager& mgr);
void PreRender(CStateManager& mgr, const zeus::CFrustum&);
void CalculateRenderBounds();
void AddToRenderer(const zeus::CFrustum&, const CStateManager&);
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
void ComputeFreeLook(const CFinalInput& input);
void UpdateFreeLookState(const CFinalInput&, float dt, CStateManager&);
void UpdateFreeLook(float dt);
@ -494,6 +496,7 @@ public:
void HolsterGun(CStateManager& mgr);
EPlayerCameraState GetCameraState() const { return x2f4_cameraState; }
EPlayerMorphBallState GetMorphballTransitionState() const { return x2f8_morphTransState; }
bool IsMorphBallTransitioning() const;
void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float);
float GetGravity() const;
void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float);

View File

@ -72,6 +72,8 @@ void CScriptCounter::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId,
if (GetActive())
x38_current = x34_initial;
break;
default:
break;
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);

2
nod

@ -1 +1 @@
Subproject commit 42ef3a7958b616eb606c43fbe0fc5fa443373358
Subproject commit db1a6f13a2f0169b935a829e0b6efb021b2daaff

@ -1 +1 @@
Subproject commit cd448ae32819248448d04fa3ff050c2a82e1d190
Subproject commit 7301c5de9fff2a924c0bc2cb949bab4505ff042e