From 925aa3fe1a6e08f102a94969af2e90adfd3e8033 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 30 Jul 2017 19:19:05 -1000 Subject: [PATCH] More CPlayer imps --- .gitignore | 2 + DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp | 9 +- DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp | 1 + DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp | 134 ++-- DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp | 25 +- DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp | 3 +- Runtime/CGameOptions.cpp | 4 +- Runtime/CGameOptions.hpp | 6 +- Runtime/CGameState.cpp | 2 +- Runtime/CMemoryCardSys.hpp | 7 + Runtime/CPlayerState.cpp | 10 +- Runtime/CPlayerState.hpp | 8 +- Runtime/Camera/CCameraManager.cpp | 5 + Runtime/Camera/CCameraManager.hpp | 1 + Runtime/Camera/CFirstPersonCamera.cpp | 2 +- Runtime/Character/CModelData.cpp | 2 +- Runtime/Character/CModelData.hpp | 2 +- Runtime/MP1/CSlideShow.cpp | 4 +- Runtime/RetroTypes.hpp | 7 + Runtime/Weapon/CGrappleArm.cpp | 5 + Runtime/Weapon/CGrappleArm.hpp | 5 + Runtime/Weapon/CPlayerGun.cpp | 17 +- Runtime/Weapon/CPlayerGun.hpp | 5 +- Runtime/World/CMorphBall.cpp | 15 + Runtime/World/CMorphBall.hpp | 22 +- Runtime/World/CPlayer.cpp | 618 +++++++++++++++++- Runtime/World/CPlayer.hpp | 23 +- Runtime/World/CScriptCounter.cpp | 2 + nod | 2 +- specter | 2 +- 30 files changed, 816 insertions(+), 134 deletions(-) diff --git a/.gitignore b/.gitignore index 2907a1935..535ad007f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ version.h .DS_Store *.autosave docs/* +.idea/dictionaries +.idea/workspace.xml diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp index 0d2c13e53..9c58af6c2 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp @@ -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 diff --git a/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp b/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp index b90e9bf72..4446efd4a 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakSlideShow.hpp @@ -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; }; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp index 29a17b275..ba801703f 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.cpp @@ -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_); diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp index b8ce3f568..e7af7cb32 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp @@ -44,13 +44,13 @@ struct CTweakPlayer : ITweakPlayer Value x124_eyeOffset; Value x128_; Value x12c_; - Value x130_; - Value x134_; + Value x130_horizontalFreeLookAngleVel; + Value x134_verticalFreeLookAngleVel; Value x138_hudLagAmount; Value x13c_; Value x140_; - Value x144_; - Value x148_; + Value x144_freeLookCenteredThresholdAngle; + Value x148_freeLookCenteredTime; Value x14c_; Value x150_leftDiv; Value x154_rightDiv; @@ -92,7 +92,7 @@ struct CTweakPlayer : ITweakPlayer Value x210_; Value x214_; Value x218_scanningRange; - Value x21c_24_ : 1; + Value x21c_24_scanRetention : 1; Value x21c_25_scanFreezesGame : 1; Value x21c_26_orbitWhileScanning : 1; Value x220_; @@ -101,13 +101,13 @@ struct CTweakPlayer : ITweakPlayer Value x228_25_ : 1; Value x228_26_ : 1; Value x228_27_ : 1; - Value x228_28_ : 1; - Value x228_29_ : 1; + Value x228_28_enableFreeLook : 1; + Value x228_29_twoButtonsForFreeLook : 1; Value x228_30_ : 1; Value x228_31_ : 1; Value x229_24_ : 1; Value x229_25_aimWhenOrbitingPoint : 1; - Value x229_26_ : 1; + Value x229_26_stayInFreeLookWhileFiring : 1; Value x229_27_ : 1; Value x229_28_ : 1; Value 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_; } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp b/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp index 118c0e01e..ef5443949 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp @@ -17,7 +17,7 @@ struct CTweakSlideShow : ITweakSlideShow String<-1> x14_fontAssetName; DNAColor x24_fontColor; DNAColor x28_outlineColor; - Value x2c_; + Value x2c_scanPercentInterval; Value x30_; Value x34_; Value 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_; } }; diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp index 0e8a7661e..1ae94bf1f 100644 --- a/Runtime/CGameOptions.cpp +++ b/Runtime/CGameOptions.cpp @@ -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); diff --git a/Runtime/CGameOptions.hpp b/Runtime/CGameOptions.hpp index 28836386e..18c464dcc 100644 --- a/Runtime/CGameOptions.hpp +++ b/Runtime/CGameOptions.hpp @@ -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); } diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index f5559591c..4c1ec6ed6 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -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()); diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp index 6ce055a65..a016b1bc0 100644 --- a/Runtime/CMemoryCardSys.hpp +++ b/Runtime/CMemoryCardSys.hpp @@ -94,6 +94,13 @@ public: const std::vector>& GetScanStates() const { return x20_scanStates; } u32 GetScanCategoryCount(CSaveWorld::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; } + std::vector>::const_iterator LookupScanState(ResId id) const + { + return + rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id, + [](const std::pair& p) { return p.first; }); + } + bool HasSaveWorldMemory(ResId wldId) const; const CSaveWorldMemory& GetSaveWorldMemory(ResId wldId) const; diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index eb47d9341..994a9de86 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -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[] diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index 0f984e91b..61b93822e 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -124,8 +124,7 @@ private: EPlayerSuit x20_currentSuit = EPlayerSuit::Power; rstl::reserved_vector x24_powerups; rstl::reserved_vector, 846> x170_scanTimes; - u32 x180_logScans = 0; - u32 x184_totalLogScans = 0; + std::pair 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& p) { x180_scanCompletionRate = p; } bool IsPlayerAlive() const { return x0_24_alive; } void SetPlayerAlive(bool alive) { x0_24_alive = alive; } void InitializeScanTimes(); diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index dac3f08b4..120100b25 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -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 camera(GetCurrentCamera(stateMgr)); diff --git a/Runtime/Camera/CCameraManager.hpp b/Runtime/Camera/CCameraManager.hpp index 6b133004e..e5069acf7 100644 --- a/Runtime/Camera/CCameraManager.hpp +++ b/Runtime/Camera/CCameraManager.hpp @@ -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); diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index ba8b988a7..878b3d1ee 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -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); diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp index d6297510d..9901db65c 100644 --- a/Runtime/Character/CModelData.cpp +++ b/Runtime/Character/CModelData.cpp @@ -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)) { diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index 6f69afd0f..bb645f2e4 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -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& PickStaticModel(EWhichModel which) const; void SetXRayModel(const std::pair& modelSkin); diff --git a/Runtime/MP1/CSlideShow.cpp b/Runtime/MP1/CSlideShow.cpp index 1ff402100..962f9d1ef 100644 --- a/Runtime/MP1/CSlideShow.cpp +++ b/Runtime/MP1/CSlideShow.cpp @@ -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; diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index a8a490689..7eda0982c 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -119,6 +119,13 @@ public: return {::GetAverage(this->data(), this->size())}; } + rstl::optional_object GetEntry(int i) const + { + if (i >= this->size()) + return {}; + return this->operator[](i); + } + void Clear() { this->clear(); } }; diff --git a/Runtime/Weapon/CGrappleArm.cpp b/Runtime/Weapon/CGrappleArm.cpp index 267330250..bf57431c1 100644 --- a/Runtime/Weapon/CGrappleArm.cpp +++ b/Runtime/Weapon/CGrappleArm.cpp @@ -31,4 +31,9 @@ void CGrappleArm::GrappleBeamConnected() } +void CGrappleArm::RenderGrappleBeam(const CStateManager& mgr, const zeus::CVector3f& pos) +{ + +} + } diff --git a/Runtime/Weapon/CGrappleArm.hpp b/Runtime/Weapon/CGrappleArm.hpp index 88a0e6163..6c7e7f1e1 100644 --- a/Runtime/Weapon/CGrappleArm.hpp +++ b/Runtime/Weapon/CGrappleArm.hpp @@ -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); }; } diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 8e998a834..4badeaf2c 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -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 +{ + +} + } diff --git a/Runtime/Weapon/CPlayerGun.hpp b/Runtime/Weapon/CPlayerGun.hpp index 57ca48bf9..f1527289b 100644 --- a/Runtime/Weapon/CPlayerGun.hpp +++ b/Runtime/Weapon/CPlayerGun.hpp @@ -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; }; } diff --git a/Runtime/World/CMorphBall.cpp b/Runtime/World/CMorphBall.cpp index c730d328e..b8923b72f 100644 --- a/Runtime/World/CMorphBall.cpp +++ b/Runtime/World/CMorphBall.cpp @@ -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) +{ + +} + } diff --git a/Runtime/World/CMorphBall.hpp b/Runtime/World/CMorphBall.hpp index c26189d4e..6c2f2f398 100644 --- a/Runtime/World/CMorphBall.hpp +++ b/Runtime/World/CMorphBall.hpp @@ -31,6 +31,14 @@ public: }; private: CPlayer& x0_player; + std::unique_ptr x58_ballModel; + u32 x5c_ballModelShader = 0; + std::unique_ptr x60_spiderBallGlassModel; + u32 x64_spiderBallGlassModelShader = 0; + std::unique_ptr x68_lowPolyBallModel; + u32 x6c_lowPolyBallModelShader = 0; + std::unique_ptr 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; } }; } diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 6e566cd2c..f4c4d00ea 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -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(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 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 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 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 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 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 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 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 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 ; iRender(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; diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index 411fba049..164658fa9 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -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 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> x730_; + TReservedAverage x594_transisionBeamXfs; + TReservedAverage x658_transitionModelXfs; + TReservedAverage x71c_transitionModelAlphas; + std::vector> 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); diff --git a/Runtime/World/CScriptCounter.cpp b/Runtime/World/CScriptCounter.cpp index e2a726ade..6668ade05 100644 --- a/Runtime/World/CScriptCounter.cpp +++ b/Runtime/World/CScriptCounter.cpp @@ -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); diff --git a/nod b/nod index 42ef3a795..db1a6f13a 160000 --- a/nod +++ b/nod @@ -1 +1 @@ -Subproject commit 42ef3a7958b616eb606c43fbe0fc5fa443373358 +Subproject commit db1a6f13a2f0169b935a829e0b6efb021b2daaff diff --git a/specter b/specter index cd448ae32..7301c5de9 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit cd448ae32819248448d04fa3ff050c2a82e1d190 +Subproject commit 7301c5de9fff2a924c0bc2cb949bab4505ff042e