diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp index abe22c3c9..1e67b2c73 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp @@ -87,80 +87,80 @@ struct ITweakPlayerRes : ITweak void ResolveResources(const urde::IFactory& factory) { - x4_saveStationIcon = factory.GetResourceIdByName(GetSaveStationIcon().c_str())->id; - x8_missileStationIcon = factory.GetResourceIdByName(GetMissileStationIcon().c_str())->id; - xc_elevatorIcon = factory.GetResourceIdByName(GetElevatorIcon().c_str())->id; + x4_saveStationIcon = factory.GetResourceIdByName(_GetSaveStationIcon().c_str())->id; + x8_missileStationIcon = factory.GetResourceIdByName(_GetMissileStationIcon().c_str())->id; + xc_elevatorIcon = factory.GetResourceIdByName(_GetElevatorIcon().c_str())->id; - x10_minesBreakFirstTopIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id; - x14_minesBreakFirstBottomIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id; - x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id; - x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(GetMinesBreakFirstTopIcon().c_str())->id; + x10_minesBreakFirstTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; + x14_minesBreakFirstBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; + x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; + x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; for (int i=0 ; i<9 ; ++i) - x24_lStick[i] = factory.GetResourceIdByName(GetLStick(i).c_str())->id; + x24_lStick[i] = factory.GetResourceIdByName(_GetLStick(i).c_str())->id; for (int i=0 ; i<9 ; ++i) - x4c_cStick[i] = factory.GetResourceIdByName(GetCStick(i).c_str())->id; + x4c_cStick[i] = factory.GetResourceIdByName(_GetCStick(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - x74_lTrigger[i] = factory.GetResourceIdByName(GetLTrigger(i).c_str())->id; + x74_lTrigger[i] = factory.GetResourceIdByName(_GetLTrigger(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - x80_rTrigger[i] = factory.GetResourceIdByName(GetRTrigger(i).c_str())->id; + x80_rTrigger[i] = factory.GetResourceIdByName(_GetRTrigger(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - x8c_startButton[i] = factory.GetResourceIdByName(GetStartButton(i).c_str())->id; + x8c_startButton[i] = factory.GetResourceIdByName(_GetStartButton(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - x98_aButton[i] = factory.GetResourceIdByName(GetAButton(i).c_str())->id; + x98_aButton[i] = factory.GetResourceIdByName(_GetAButton(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - xa4_bButton[i] = factory.GetResourceIdByName(GetBButton(i).c_str())->id; + xa4_bButton[i] = factory.GetResourceIdByName(_GetBButton(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - xb0_xButton[i] = factory.GetResourceIdByName(GetXButton(i).c_str())->id; + xb0_xButton[i] = factory.GetResourceIdByName(_GetXButton(i).c_str())->id; for (int i=0 ; i<2 ; ++i) - xbc_yButton[i] = factory.GetResourceIdByName(GetYButton(i).c_str())->id; + xbc_yButton[i] = factory.GetResourceIdByName(_GetYButton(i).c_str())->id; - xc4_ballTransitionsANCS = factory.GetResourceIdByName(GetBallTransitionsANCS().c_str())->id; + xc4_ballTransitionsANCS = factory.GetResourceIdByName(_GetBallTransitionsANCS().c_str())->id; for (int i=0 ; i<5 ; ++i) - xc8_ballTransitions[i] = factory.GetResourceIdByName(GetBallTransitionBeamRes(i).c_str())->id; + xc8_ballTransitions[i] = factory.GetResourceIdByName(_GetBallTransitionBeamRes(i).c_str())->id; for (int i=0 ; i<5 ; ++i) - xc8_cineGun[i] = factory.GetResourceIdByName(GetBeamCineModel(i).c_str())->id; + xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i).c_str())->id; - xf0_unkFloat = GetUnkFloat(); + xf0_unkFloat = _GetUnkFloat(); } protected: - virtual const std::string& GetSaveStationIcon() const=0; - virtual const std::string& GetMissileStationIcon() const=0; - virtual const std::string& GetElevatorIcon() const=0; + virtual const std::string& _GetSaveStationIcon() const=0; + virtual const std::string& _GetMissileStationIcon() const=0; + virtual const std::string& _GetElevatorIcon() const=0; - virtual const std::string& GetMinesBreakFirstTopIcon() const=0; - virtual const std::string& GetMinesBreakFirstBottomIcon() const=0; - virtual const std::string& GetMinesBreakSecondTopIcon() const=0; - virtual const std::string& GetMinesBreakSecondBottomIcon() const=0; + virtual const std::string& _GetMinesBreakFirstTopIcon() const=0; + virtual const std::string& _GetMinesBreakFirstBottomIcon() const=0; + virtual const std::string& _GetMinesBreakSecondTopIcon() const=0; + virtual const std::string& _GetMinesBreakSecondBottomIcon() const=0; - virtual const std::string& GetLStick(size_t idx) const=0; - virtual const std::string& GetCStick(size_t idx) const=0; + virtual const std::string& _GetLStick(size_t idx) const=0; + virtual const std::string& _GetCStick(size_t idx) const=0; - virtual const std::string& GetLTrigger(size_t idx) const=0; - virtual const std::string& GetRTrigger(size_t idx) const=0; - virtual const std::string& GetStartButton(size_t idx) const=0; - virtual const std::string& GetAButton(size_t idx) const=0; - virtual const std::string& GetBButton(size_t idx) const=0; - virtual const std::string& GetXButton(size_t idx) const=0; - virtual const std::string& GetYButton(size_t idx) const=0; + virtual const std::string& _GetLTrigger(size_t idx) const=0; + virtual const std::string& _GetRTrigger(size_t idx) const=0; + virtual const std::string& _GetStartButton(size_t idx) const=0; + virtual const std::string& _GetAButton(size_t idx) const=0; + virtual const std::string& _GetBButton(size_t idx) const=0; + virtual const std::string& _GetXButton(size_t idx) const=0; + virtual const std::string& _GetYButton(size_t idx) const=0; - virtual const std::string& GetBallTransitionsANCS() const=0; + virtual const std::string& _GetBallTransitionsANCS() const=0; - virtual const std::string& GetBallTransitionBeamRes(size_t idx) const=0; - virtual const std::string& GetBeamCineModel(size_t idx) const=0; + virtual const std::string& _GetBallTransitionBeamRes(size_t idx) const=0; + virtual const std::string& _GetBeamCineModel(size_t idx) const=0; - virtual float GetUnkFloat() const=0; + virtual float _GetUnkFloat() const=0; }; } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp index 97b961226..5fedf45fb 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp @@ -8,7 +8,7 @@ namespace DataSpec { namespace DNAMP1 { -struct CTweakAutoMapper : public ITweakAutoMapper +struct CTweakAutoMapper final : public ITweakAutoMapper { DECL_YAML Value x4_24_showOneMiniMapArea : 1; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakBall.hpp b/DataSpec/DNAMP1/Tweaks/CTweakBall.hpp index c2e020a12..f42e35b1a 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakBall.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakBall.hpp @@ -8,7 +8,7 @@ namespace DataSpec { namespace DNAMP1 { -struct CTweakBall : public ITweakBall +struct CTweakBall final : public ITweakBall { DECL_YAML Delete __d; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp index 1b6bc9b9f..42cedc354 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGame.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakGame : ITweakGame +struct CTweakGame final : ITweakGame { DECL_YAML String<-1> x4_worldPrefix; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp index 03ebc89a0..68f7c0ae1 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp @@ -7,7 +7,7 @@ namespace DataSpec { namespace DNAMP1 { -struct CTweakGui : ITweakGui +struct CTweakGui final : ITweakGui { DECL_YAML Value x4_; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp index f5417ea55..9cb59204a 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp @@ -7,7 +7,7 @@ namespace DataSpec { namespace DNAMP1 { -struct CTweakGuiColors : public ITweakGuiColors +struct CTweakGuiColors final : public ITweakGuiColors { DECL_YAML DNAColor x4_pauseBlurFilterColor; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp index e20178c6f..e357dab8f 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakGunRes : ITweakGunRes +struct CTweakGunRes final : ITweakGunRes { DECL_YAML diff --git a/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp b/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp index ea93b613c..faf809f79 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakParticle : ITweakParticle +struct CTweakParticle final : ITweakParticle { DECL_YAML String<-1> m_particle; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp index 4356488f1..016efb60c 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakPlayer : ITweakPlayer +struct CTweakPlayer final : ITweakPlayer { Delete _d; Value x4_maxTranslationalAcceleration[8]; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp index bb439e9fb..6edd6f045 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakPlayerControl : ITweakPlayerControl +struct CTweakPlayerControl final : ITweakPlayerControl { DECL_YAML Vector m_mappings; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp index a4e30e810..ab4ef5dec 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakPlayerGun : ITweakPlayerGun +struct CTweakPlayerGun final : ITweakPlayerGun { DECL_YAML Value x4_upLookAngle; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp index 2626d9faf..75ff5d02c 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp @@ -8,7 +8,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakPlayerRes : ITweakPlayerRes +struct CTweakPlayerRes final : ITweakPlayerRes { DECL_YAML @@ -72,32 +72,32 @@ struct CTweakPlayerRes : ITweakPlayerRes Value m_unkFloat; - const std::string& GetSaveStationIcon() const { return m_saveStationIcon; } - const std::string& GetMissileStationIcon() const { return m_missileStationIcon; } - const std::string& GetElevatorIcon() const { return m_elevatorIcon; } + const std::string& _GetSaveStationIcon() const { return m_saveStationIcon; } + const std::string& _GetMissileStationIcon() const { return m_missileStationIcon; } + const std::string& _GetElevatorIcon() const { return m_elevatorIcon; } - const std::string& GetMinesBreakFirstTopIcon() const { return m_minesBreakFirstTopIcon; } - const std::string& GetMinesBreakFirstBottomIcon() const { return m_minesBreakFirstBottomIcon; } - const std::string& GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; } - const std::string& GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; } + const std::string& _GetMinesBreakFirstTopIcon() const { return m_minesBreakFirstTopIcon; } + const std::string& _GetMinesBreakFirstBottomIcon() const { return m_minesBreakFirstBottomIcon; } + const std::string& _GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; } + const std::string& _GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; } - const std::string& GetLStick(size_t idx) const { return (&m_lStickN)[idx]; } - const std::string& GetCStick(size_t idx) const { return (&m_cStickN)[idx]; } + const std::string& _GetLStick(size_t idx) const { return (&m_lStickN)[idx]; } + const std::string& _GetCStick(size_t idx) const { return (&m_cStickN)[idx]; } - const std::string& GetLTrigger(size_t idx) const { return (&m_lTriggerOut)[idx]; } - const std::string& GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; } - const std::string& GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; } - const std::string& GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; } - const std::string& GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; } - const std::string& GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; } - const std::string& GetYButton(size_t idx) const { return (&m_yButtonOut)[idx]; } + const std::string& _GetLTrigger(size_t idx) const { return (&m_lTriggerOut)[idx]; } + const std::string& _GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; } + const std::string& _GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; } + const std::string& _GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; } + const std::string& _GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; } + const std::string& _GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; } + const std::string& _GetYButton(size_t idx) const { return (&m_yButtonOut)[idx]; } - const std::string& GetBallTransitionsANCS() const { return m_ballTransitionsANCS; } + const std::string& _GetBallTransitionsANCS() const { return m_ballTransitionsANCS; } - const std::string& GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; } - const std::string& GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; } + const std::string& _GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; } + const std::string& _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; } - float GetUnkFloat() const { return m_unkFloat; } + float _GetUnkFloat() const { return m_unkFloat; } CTweakPlayerRes() = default; CTweakPlayerRes(athena::io::IStreamReader& in) { read(in); } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp b/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp index ef5443949..1feefc73d 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp @@ -9,7 +9,7 @@ namespace DataSpec namespace DNAMP1 { -struct CTweakSlideShow : ITweakSlideShow +struct CTweakSlideShow final : ITweakSlideShow { DECL_YAML diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index aff126e25..1a06aedf6 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -7,7 +7,7 @@ namespace DataSpec { namespace DNAMP1 { -struct CTweakTargeting : public ITweakTargeting +struct CTweakTargeting final : public ITweakTargeting { DECL_YAML Value x4_; diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index 431a32012..9351ca994 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -95,10 +95,6 @@ public: Phazon = 27 }; - enum class EChargeState : u32 - { - }; - private: static const u32 PowerUpMaxValues[41]; diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index c6b9a569d..3995b0594 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -1,5 +1,24 @@ #ifndef __URDE_GAMEGLOBALOBJECTS_HPP__ #define __URDE_GAMEGLOBALOBJECTS_HPP__ + +#define USE_DOWNCAST_TWEAKS 1 + +#if USE_DOWNCAST_TWEAKS +#include "../DataSpec/DNAMP1/Tweaks/CTweakGame.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakPlayerRes.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakGui.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakSlideShow.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakGui.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakParticle.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakBall.hpp" +#include "../DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp" +#else #include "../DataSpec/DNACommon/Tweaks/ITweakGame.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp" @@ -14,6 +33,7 @@ #include "../DataSpec/DNACommon/Tweaks/ITweakParticle.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakBall.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakGuiColors.hpp" +#endif namespace urde { @@ -33,6 +53,21 @@ extern class CBooRenderer* g_Renderer; extern class CStringTable* g_MainStringTable; extern class CInputGenerator* g_InputGenerator; +#if USE_DOWNCAST_TWEAKS +using ITweakGame = DataSpec::DNAMP1::CTweakGame; +using ITweakPlayer = DataSpec::DNAMP1::CTweakPlayer; +using ITweakPlayerRes = DataSpec::DNAMP1::CTweakPlayerRes; +using ITweakPlayerControl = DataSpec::DNAMP1::CTweakPlayerControl; +using ITweakPlayerGun = DataSpec::DNAMP1::CTweakPlayerGun; +using ITweakGunRes = DataSpec::DNAMP1::CTweakGunRes; +using ITweakTargeting = DataSpec::DNAMP1::CTweakTargeting; +using ITweakAutoMapper = DataSpec::DNAMP1::CTweakAutoMapper; +using ITweakGui = DataSpec::DNAMP1::CTweakGui; +using ITweakSlideShow = DataSpec::DNAMP1::CTweakSlideShow; +using ITweakParticle = DataSpec::DNAMP1::CTweakParticle; +using ITweakBall = DataSpec::DNAMP1::CTweakBall; +using ITweakGuiColors = DataSpec::DNAMP1::CTweakGuiColors; +#else using ITweakGame = DataSpec::ITweakGame; using ITweakPlayer = DataSpec::ITweakPlayer; using ITweakPlayerRes = DataSpec::ITweakPlayerRes; @@ -46,6 +81,7 @@ using ITweakSlideShow = DataSpec::ITweakSlideShow; using ITweakParticle = DataSpec::ITweakParticle; using ITweakBall = DataSpec::ITweakBall; using ITweakGuiColors = DataSpec::ITweakGuiColors; +#endif extern ITweakGame* g_tweakGame; extern ITweakPlayer* g_tweakPlayer; diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index f8fdb9cb4..54ae2c317 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -431,7 +431,7 @@ void CSamusHud::UpdateFreeLook(float dt, const CStateManager& mgr) TCastToConstPtr fpCam = mgr.GetCameraManager()->GetCurrentCamera(mgr); CPlayer& player = mgr.GetPlayer(); bool inFreeLook = player.IsInFreeLook() && fpCam; - bool lookControlHeld = player.IsLookControlHeld(); + bool lookControlHeld = player.GetFreeLookStickState(); if (x2e0_24_inFreeLook != inFreeLook) { if (inFreeLook) @@ -1527,7 +1527,7 @@ void CSamusHud::DrawAttachedEnemyEffect(const CStateManager& mgr) const } else { - float halfModPeriod = 0.5 * modPeriod; + float halfModPeriod = 0.5f * modPeriod; float tmp = std::fabs(std::fmod(drainTime, modPeriod)); if (tmp < halfModPeriod) alpha = tmp / halfModPeriod; diff --git a/Runtime/Weapon/CBomb.cpp b/Runtime/Weapon/CBomb.cpp index e69de29bb..274d5c01b 100644 --- a/Runtime/Weapon/CBomb.cpp +++ b/Runtime/Weapon/CBomb.cpp @@ -0,0 +1,19 @@ +#include "CBomb.hpp" + +namespace urde +{ + +CBomb::CBomb(const TToken& particle1, const TToken& particle2, + TUniqueId uid, TAreaId aid, TUniqueId playerId, float f1, + const zeus::CTransform& xf, const CDamageInfo& dInfo) +: CWeapon(uid, aid, true, playerId, EWeaponType::Bomb, "Bomb", xf, + CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid, EMaterialTypes::Trigger, + EMaterialTypes::NonSolidDamageable}, + {EMaterialTypes::Projectile, EMaterialTypes::Bomb}), + {EMaterialTypes::Projectile, EMaterialTypes::Bomb}, dInfo, EProjectileAttrib::Bombs, + CModelData::CModelDataNull()) +{ + +} + +} diff --git a/Runtime/Weapon/CBomb.hpp b/Runtime/Weapon/CBomb.hpp index e69de29bb..8e84cce45 100644 --- a/Runtime/Weapon/CBomb.hpp +++ b/Runtime/Weapon/CBomb.hpp @@ -0,0 +1,20 @@ +#ifndef __URDE_CBOMB_HPP__ +#define __URDE_CBOMB_HPP__ + +#include "CWeapon.hpp" +#include "CToken.hpp" + +namespace urde +{ + +class CBomb : public CWeapon +{ +public: + CBomb(const TToken& particle1, const TToken& particle2, + TUniqueId uid, TAreaId aid, TUniqueId playerId, float f1, + const zeus::CTransform& xf, const CDamageInfo& dInfo); +}; + +} + +#endif // __URDE_CBOMB_HPP__ diff --git a/Runtime/Weapon/CFidget.cpp b/Runtime/Weapon/CFidget.cpp index 53583850f..cce23f652 100644 --- a/Runtime/Weapon/CFidget.cpp +++ b/Runtime/Weapon/CFidget.cpp @@ -3,10 +3,20 @@ namespace urde { +CFidget::EState CFidget::Update(int fire, bool bobbing, bool b1, float dt, CStateManager& mgr) +{ + return EState::Zero; +} + +void CFidget::ResetMinor() +{ + +} + void CFidget::ResetAll() { x0_state = EState::Zero; - x4_ = -1; + x4_type = SamusGun::EFidgetType::Invalid; x18_ = 0.f; x1c_ = 0.f; x14_ = 0.f; @@ -14,9 +24,9 @@ void CFidget::ResetAll() x28_ = 0.f; x2c_ = 0.f; x8_ = 0; - xc_ = -1; + xc_parm2 = -1; x10_ = 3; - x34_24_ = false; + x34_24_loading = false; } -} \ No newline at end of file +} diff --git a/Runtime/Weapon/CFidget.hpp b/Runtime/Weapon/CFidget.hpp index 2266030db..5d543dca9 100644 --- a/Runtime/Weapon/CFidget.hpp +++ b/Runtime/Weapon/CFidget.hpp @@ -2,9 +2,11 @@ #define __URDE_CFIDGET_HPP__ #include "RetroTypes.hpp" +#include "CGunMotion.hpp" namespace urde { +class CStateManager; class CFidget { @@ -22,9 +24,9 @@ public: }; private: EState x0_state = EState::Zero; - s32 x4_ = -1; + SamusGun::EFidgetType x4_type = SamusGun::EFidgetType::Invalid; u32 x8_ = 0; - s32 xc_ = -1; + s32 xc_parm2 = -1; u32 x10_ = 3; float x14_ = 0.f; float x18_ = 0.f; @@ -34,10 +36,15 @@ private: float x28_ = 0.f; float x2c_ = 0.f; float x30_ = 105.f; - bool x34_24_ = false; + bool x34_24_loading = false; public: EState GetState() const { return x0_state; } + SamusGun::EFidgetType GetType() const { return x4_type; } + s32 GetParm2() const { return xc_parm2; } + EState Update(int fire, bool bobbing, bool b1, float dt, CStateManager& mgr); + void ResetMinor(); void ResetAll(); + void DoneLoading() { x34_24_loading = false; } }; } diff --git a/Runtime/Weapon/CGSFidget.cpp b/Runtime/Weapon/CGSFidget.cpp index 13b5cd2ca..5bd8652b0 100644 --- a/Runtime/Weapon/CGSFidget.cpp +++ b/Runtime/Weapon/CGSFidget.cpp @@ -11,14 +11,14 @@ bool CGSFidget::Update(CAnimData& data, float dt, CStateManager& mgr) return !data.IsAnimTimeRemaining(0.001f, "Whole Body"); } -s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 parm1, s32 parm2, CStateManager& mgr) +s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 gunId, s32 parm2, CStateManager& mgr) { const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase(); - CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(parm1), - CPASAnimParm::FromEnum(parm2)); + CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId), + CPASAnimParm::FromInt32(parm2)); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); bool loop = pas.GetAnimState(1)->GetAnimParmData(anim.second, 3).GetBoolValue(); - x14_parm1 = parm1; + x14_gunId = gunId; x18_parm2 = parm2; if (anim.second != -1) { @@ -30,10 +30,10 @@ s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 parm1, s32 parm2, CStateMa return anim.second; } -void CGSFidget::LoadAnimAsync(CAnimData& data, s32 type, s32 parm1, s32 parm2, CStateManager& mgr) +void CGSFidget::LoadAnimAsync(CAnimData& data, s32 type, s32 gunId, s32 parm2, CStateManager& mgr) { - CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(parm1), - CPASAnimParm::FromEnum(parm2)); + CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId), + CPASAnimParm::FromInt32(parm2)); auto anim = data.GetCharacterInfo().GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); if (anim.second != -1) NWeaponTypes::get_token_vector(data, anim.second, x0_anims, true); diff --git a/Runtime/Weapon/CGSFidget.hpp b/Runtime/Weapon/CGSFidget.hpp index bee091fde..407eb1a9e 100644 --- a/Runtime/Weapon/CGSFidget.hpp +++ b/Runtime/Weapon/CGSFidget.hpp @@ -12,12 +12,12 @@ class CGSFidget { std::vector x0_anims; s32 x10_ = -1; - s32 x14_parm1 = -1; + s32 x14_gunId = -1; s32 x18_parm2 = -1; public: bool Update(CAnimData& data, float dt, CStateManager& mgr); - s32 SetAnim(CAnimData& data, s32 type, s32 parm1, s32 parm2, CStateManager& mgr); - void LoadAnimAsync(CAnimData& data, s32 type, s32 parm1, s32 parm2, CStateManager& mgr); + s32 SetAnim(CAnimData& data, s32 type, s32 gunId, s32 parm2, CStateManager& mgr); + void LoadAnimAsync(CAnimData& data, s32 type, s32 gunId, s32 parm2, CStateManager& mgr); void UnLoadAnim(); bool IsAnimLoaded() const; }; diff --git a/Runtime/Weapon/CGrappleArm.cpp b/Runtime/Weapon/CGrappleArm.cpp index 7e9883ec7..43fa34170 100644 --- a/Runtime/Weapon/CGrappleArm.cpp +++ b/Runtime/Weapon/CGrappleArm.cpp @@ -61,6 +61,16 @@ void CGrappleArm::EnterIdle(CStateManager& mgr) } +void CGrappleArm::EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 gunId, s32 parm2) +{ + +} + +void CGrappleArm::EnterFreeLook(s32 gunId, s32 setId, CStateManager& mgr) +{ + +} + void CGrappleArm::ReturnToDefault(CStateManager& mgr, float f1, bool b1) { diff --git a/Runtime/Weapon/CGrappleArm.hpp b/Runtime/Weapon/CGrappleArm.hpp index 504e0dd6b..6896893ef 100644 --- a/Runtime/Weapon/CGrappleArm.hpp +++ b/Runtime/Weapon/CGrappleArm.hpp @@ -6,6 +6,7 @@ #include "Character/CModelData.hpp" #include "CStateManager.hpp" #include "CGunController.hpp" +#include "CGunMotion.hpp" namespace urde { @@ -66,6 +67,8 @@ public: void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); void EnterStruck(CStateManager& mgr, float angle, bool attack, bool b2); void EnterIdle(CStateManager& mgr); + void EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 gunId, s32 parm2); + void EnterFreeLook(s32 gunId, s32 setId, CStateManager& mgr); void ReturnToDefault(CStateManager& mgr, float f1, bool b1); CGunController* GunController() { return x328_gunController.get(); } }; diff --git a/Runtime/Weapon/CGunController.cpp b/Runtime/Weapon/CGunController.cpp index 198665318..7eaa9278c 100644 --- a/Runtime/Weapon/CGunController.cpp +++ b/Runtime/Weapon/CGunController.cpp @@ -6,14 +6,14 @@ namespace urde { -void CGunController::LoadFidgetAnimAsync(CStateManager& mgr, s32 type, s32 parm1, s32 parm2) +void CGunController::LoadFidgetAnimAsync(CStateManager& mgr, s32 type, s32 gunId, s32 parm2) { - x30_fidget.LoadAnimAsync(*x0_modelData.AnimationData(), type, parm1, parm2, mgr); + x30_fidget.LoadAnimAsync(*x0_modelData.AnimationData(), type, gunId, parm2, mgr); } -void CGunController::EnterFidget(CStateManager& mgr, s32 type, s32 parm1, s32 parm2) +void CGunController::EnterFidget(CStateManager& mgr, s32 type, s32 gunId, s32 parm2) { - x54_curAnimId = x30_fidget.SetAnim(*x0_modelData.AnimationData(), type, parm1, parm2, mgr); + x54_curAnimId = x30_fidget.SetAnim(*x0_modelData.AnimationData(), type, gunId, parm2, mgr); x50_gunState = EGunState::Fidget; } diff --git a/Runtime/Weapon/CGunController.hpp b/Runtime/Weapon/CGunController.hpp index e77d4e6cd..07856f7d0 100644 --- a/Runtime/Weapon/CGunController.hpp +++ b/Runtime/Weapon/CGunController.hpp @@ -40,8 +40,8 @@ public: } void UnLoadFidget() { x30_fidget.UnLoadAnim(); } - void LoadFidgetAnimAsync(CStateManager& mgr, s32 type, s32 parm1, s32 parm2); - void EnterFidget(CStateManager& mgr, s32 type, s32 parm1, s32 parm2); + void LoadFidgetAnimAsync(CStateManager& mgr, s32 type, s32 gunId, s32 parm2); + void EnterFidget(CStateManager& mgr, s32 type, s32 gunId, s32 parm2); bool IsFidgetLoaded() const { return x30_fidget.IsAnimLoaded(); } s32 GetFreeLookSetId() const { return x4_freeLook.GetSetId(); } bool IsComboOver() const { return x1c_comboFire.IsComboOver(); } diff --git a/Runtime/Weapon/CGunMotion.cpp b/Runtime/Weapon/CGunMotion.cpp index 77beb6b48..2d7c71201 100644 --- a/Runtime/Weapon/CGunMotion.cpp +++ b/Runtime/Weapon/CGunMotion.cpp @@ -10,7 +10,7 @@ CGunMotion::CGunMotion(CAssetId ancsId, const zeus::CVector3f& scale) : x0_modelData(CAnimRes(ancsId, 0, scale, 0, false), 1), x4c_gunController(x0_modelData) { - xb8_24_inFidget = false; + xb8_24_animPlaying = false; LoadAnimations(); } @@ -84,7 +84,7 @@ void CGunMotion::BasePosition(bool bigStrikeReset) void CGunMotion::EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 parm2) { - xb8_24_inFidget = true; + xb8_24_animPlaying = true; x4c_gunController.EnterFidget(mgr, s32(type), 0, parm2); } @@ -92,7 +92,7 @@ void CGunMotion::Update(float dt, CStateManager& mgr) { x0_modelData.AdvanceAnimation(dt, mgr, kInvalidAreaId, true); if (x4c_gunController.Update(dt, mgr)) - xb8_24_inFidget = false; + xb8_24_animPlaying = false; } void CGunMotion::Draw(const CStateManager& mgr, const zeus::CTransform& xf) const diff --git a/Runtime/Weapon/CGunMotion.hpp b/Runtime/Weapon/CGunMotion.hpp index 932832d5f..3485edf87 100644 --- a/Runtime/Weapon/CGunMotion.hpp +++ b/Runtime/Weapon/CGunMotion.hpp @@ -23,7 +23,9 @@ enum class EAnimationState }; enum class EFidgetType { - Zero + Invalid = -1, + Zero, + One }; } @@ -32,7 +34,7 @@ class CGunMotion CModelData x0_modelData; CGunController x4c_gunController; std::vector xa8_anims; - bool xb8_24_inFidget : 1; + bool xb8_24_animPlaying : 1; void LoadAnimations(); @@ -47,6 +49,7 @@ public: void Draw(const CStateManager& mgr, const zeus::CTransform& xf) const; s32 GetFreeLookSetId() const { return x4c_gunController.GetFreeLookSetId(); } CGunController& GunController() { return x4c_gunController; } + bool IsAnimPlaying() const { return xb8_24_animPlaying; } }; } diff --git a/Runtime/Weapon/CGunWeapon.hpp b/Runtime/Weapon/CGunWeapon.hpp index 6be5b5281..6ad0730bb 100644 --- a/Runtime/Weapon/CGunWeapon.hpp +++ b/Runtime/Weapon/CGunWeapon.hpp @@ -12,6 +12,7 @@ #include "CStateManager.hpp" #include "CGunController.hpp" #include "WeaponCommon.hpp" +#include "CGunMotion.hpp" namespace urde { @@ -20,16 +21,23 @@ class CActorLights; struct CModelFlags; class CWeaponDescription; +enum class EChargeState +{ + Normal, + Charged +}; + using SWeaponInfo = DataSpec::SWeaponInfo; class CVelocityInfo { friend class CGunWeapon; rstl::reserved_vector x0_vel; - rstl::reserved_vector x1c_; + rstl::reserved_vector x1c_targetHoming; rstl::reserved_vector x24_; public: const zeus::CVector3f& GetVelocity(int i) const { return x0_vel[i]; } + bool GetTargetHoming(int i) const { return x1c_targetHoming[i]; } }; class CGunWeapon @@ -95,7 +103,8 @@ public: virtual void PreRenderGunFx(const CStateManager&, const zeus::CTransform&) {} virtual void PostRenderGunFx(const CStateManager&, const zeus::CTransform&) {} virtual void UpdateGunFx(bool, float, const CStateManager&, const zeus::CTransform&) {} - virtual void Fire(bool, float, CPlayerState::EChargeState, const zeus::CTransform&, CStateManager&, TUniqueId) {} + virtual void Fire(bool underwater, float dt, EChargeState chargeState, const zeus::CTransform& xf, + CStateManager& mgr, TUniqueId homingTarget) {} virtual void EnableFx(bool) {} virtual void EnableSecondaryFx(ESecondaryFxType) {} void BuildSecondaryEffect(ESecondaryFxType type); @@ -115,6 +124,11 @@ public: CElementGen* GetChargeMuzzleFx() const { return x1a4_muzzleGenerators[1].get(); } void ReturnToDefault(CStateManager& mgr) {} void UnLoadFidget() {} + bool IsFidgetLoaded() const { return x100_gunController->IsFidgetLoaded(); } + void AsyncLoadFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 parm2) + { x100_gunController->LoadFidgetAnimAsync(mgr, s32(type), s32(x200_beamId), parm2); } + void EnterFidget(CStateManager& mgr, SamusGun::EFidgetType type, s32 parm2) + { x100_gunController->EnterFidget(mgr, s32(type), s32(x200_beamId), parm2); } CModelData& GetSolidModelData() { return *x10_solidModelData; } const SWeaponInfo& GetWeaponInfo() const; zeus::CAABox GetBounds() const; diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index dd00a6727..28789dddd 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -9,6 +9,8 @@ #include "World/CScriptWater.hpp" #include "World/CGameLight.hpp" #include "Input/ControlMapper.hpp" +#include "CBomb.hpp" +#include "CPowerBomb.hpp" namespace urde { @@ -319,8 +321,8 @@ void CPlayerGun::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CSt case EScriptObjectMessage::OnFloor: if (player.GetControlsFrozen() && !x834_30_inBigStrike) { - x2f4_ = 0; - x2ec_firing = 0; + x2f4_fireButtonStates = 0; + x2ec_lastFireButtonStates = 0; CancelFiring(mgr); TakeDamage(true, false, mgr); x394_damageTimer = 0.75f; @@ -409,7 +411,7 @@ void CPlayerGun::ResetCharge(CStateManager& mgr, bool b1) PlayAnim(NWeaponTypes::EGunAnimType::Zero, false); if (r30) x72c_currentBeam->EnableSecondaryFx(CGunWeapon::ESecondaryFxType::Zero); - if ((x2f8_ & 0x2) != 0x2 || x330_chargeWeaponIdx != 0) + if ((x2f8_ & 0x2) != 0x2 || x330_chargeState != EChargeState::Normal) { if ((x2f8_ & 0x8) != 0x8) { @@ -422,7 +424,7 @@ void CPlayerGun::ResetCharge(CStateManager& mgr, bool b1) } x32c_ = 0; - x330_chargeWeaponIdx = 0; + x330_chargeState = EChargeState::Normal; x320_ = x310_selectedBeam; x833_30_ = true; x832_27_ = false; @@ -449,6 +451,14 @@ static const CPlayerState::EItemType skBeamArr[] = CPlayerState::EItemType::PlasmaBeam }; +static const CPlayerState::EItemType skBeamComboArr[] = +{ + CPlayerState::EItemType::SuperMissile, + CPlayerState::EItemType::IceSpreader, + CPlayerState::EItemType::Wavebuster, + CPlayerState::EItemType::Flamethrower +}; + static const ControlMapper::ECommands mBeamCtrlCmd[] = { ControlMapper::ECommands::PowerBeam, @@ -555,7 +565,7 @@ void CPlayerGun::ResetBeamParams(CStateManager& mgr, const CPlayerState& playerS Reset(mgr, false); if (playSelectionSfx) CSfxManager::SfxStart(1774, 1.f, 0.f, true, 0x7f, false, kInvalidAreaId); - x2ec_firing &= ~0x1; + x2ec_lastFireButtonStates &= ~0x1; x320_ = x310_selectedBeam; x833_30_ = true; } @@ -696,28 +706,28 @@ void CPlayerGun::ProcessInput(const CFinalInput& input, CStateManager& mgr) switch (mgr.GetPlayer().GetMorphballTransitionState()) { default: - x2f4_ = 0; + x2f4_fireButtonStates = 0; break; case CPlayer::EPlayerMorphBallState::Unmorphed: if ((x2f8_ & 0x10) != 0x10) HandleWeaponChange(input, mgr); case CPlayer::EPlayerMorphBallState::Morphed: - x2f4_ = ControlMapper::GetDigitalInput(ControlMapper::ECommands::FireOrBomb, input) ? 1 : 0; - x2f4_ |= ControlMapper::GetDigitalInput(ControlMapper::ECommands::MissileOrPowerBomb, input) ? 2 : 0; + x2f4_fireButtonStates = ControlMapper::GetDigitalInput(ControlMapper::ECommands::FireOrBomb, input) ? 1 : 0; + x2f4_fireButtonStates |= ControlMapper::GetDigitalInput(ControlMapper::ECommands::MissileOrPowerBomb, input) ? 2 : 0; break; } } void CPlayerGun::UnLoadFidget() { - if ((x2fc_ & 0x1) == 0x1) + if ((x2fc_fidgetAnimBits & 0x1) == 0x1) x73c_gunMotion->GunController().UnLoadFidget(); - if ((x2fc_ & 0x2) == 0x2) + if ((x2fc_fidgetAnimBits & 0x2) == 0x2) x72c_currentBeam->UnLoadFidget(); - if ((x2fc_ & 0x4) == 0x4) + if ((x2fc_fidgetAnimBits & 0x4) == 0x4) if (CGunController* gc = x740_grappleArm->GunController()) gc->UnLoadFidget(); - x2fc_ = 0; + x2fc_fidgetAnimBits = 0; } void CPlayerGun::ReturnArmAndGunToDefault(CStateManager& mgr, bool b1) @@ -787,7 +797,7 @@ void CPlayerGun::CancelFiring(CStateManager& mgr) float CPlayerGun::GetBeamVelocity() const { if (x72c_currentBeam->IsLoaded()) - return x72c_currentBeam->GetVelocityInfo().GetVelocity(x330_chargeWeaponIdx).y; + return x72c_currentBeam->GetVelocityInfo().GetVelocity(int(x330_chargeState)).y; return 10.f; } @@ -881,16 +891,464 @@ void CPlayerGun::CancelLockOn() } -void CPlayerGun::UpdateWeaponFire(float dt, const CPlayerState& playerState, CStateManager& mgr) +void CPlayerGun::FireSecondary(float dt, CStateManager& mgr) { } -void CPlayerGun::UpdateGunIdle(bool b1, float camBobT, float dt, CStateManager& mgr) +void CPlayerGun::ResetCharged(float dt, CStateManager& mgr) +{ + if (x832_26_) + return; + if (x32c_ >= 3) + { + x833_30_ = false; + UpdateNormalShotCycle(dt, mgr); + x832_24_ = true; + CancelCharge(mgr, true); + } + else if (x32c_ != 0) + { + x320_ = x310_selectedBeam; + x833_30_ = true; + x32c_ = 10; + } + StopChargeSound(mgr); +} + +void CPlayerGun::ActivateCombo(CStateManager& mgr) { } +void CPlayerGun::ProcessChargeState(u32 releasedStates, u32 pressedStates, CStateManager& mgr, float dt) +{ + if ((releasedStates & 0x1) != 0) + ResetCharged(dt, mgr); + if ((pressedStates & 0x1) != 0) + { + if (x32c_ == 0 && (pressedStates & 0x1) != 0 && x348_ == 0.f && x832_28_) + { + UpdateNormalShotCycle(dt, mgr); + x32c_ = 1; + } + } + else if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::Missiles) && (pressedStates & 0x2) != 0) + { + if (x32c_ >= 4) + { + if (mgr.GetPlayerState()->HasPowerUp(skBeamComboArr[x310_selectedBeam])) + ActivateCombo(mgr); + } + else if (x32c_ == 0) + { + FireSecondary(dt, mgr); + } + } +} + +void CPlayerGun::ResetNormal(CStateManager& mgr) +{ + Reset(mgr, false); + x832_28_ = false; +} + +void CPlayerGun::UpdateNormalShotCycle(float dt, CStateManager& mgr) +{ + if (!ExitMissile()) + return; + if (mgr.GetCameraManager()->IsInCinematicCamera()) + return; + x832_25_ = x833_28_phazonBeamActive || x310_selectedBeam != 3 || x32c_ != 0; + x30c_ += 1; + zeus::CTransform xf = x833_29_pointBlankWorldSurface ? x448_elbowWorldXf : x4a8_gunWorldXf * x418_beamLocalXf; + if (!x833_29_pointBlankWorldSurface && x364_ <= 0.f) + { + zeus::CVector3f oldOrigin = xf.origin; + xf = x478_assistAimXf; + xf.origin = oldOrigin; + } + xf.origin += mgr.GetCameraManager()->GetGlobalCameraTranslation(mgr); + x38c_ = 0.0625f; + TUniqueId homingTarget; + if (x72c_currentBeam->GetVelocityInfo().GetTargetHoming(int(x330_chargeState))) + homingTarget = GetTargetId(mgr); + else + homingTarget = kInvalidUniqueId; + x72c_currentBeam->Fire(x834_27_underwater, dt, x330_chargeState, xf, mgr, homingTarget); + mgr.InformListeners(x4a8_gunWorldXf.origin, EListenNoiseType::Zero); +} + +void CPlayerGun::ProcessNormalState(u32 releasedStates, u32 pressedStates, CStateManager& mgr, float dt) +{ + if ((releasedStates & 0x1) != 0) + ResetNormal(mgr); + if ((pressedStates & 0x1) != 0 && x348_ == 0.f && x832_28_) + UpdateNormalShotCycle(dt, mgr); + else if ((pressedStates & 0x2) != 0) + FireSecondary(dt, mgr); +} + +void CPlayerGun::UpdateWeaponFire(float dt, const CPlayerState& playerState, CStateManager& mgr) +{ + u32 oldFiring = x2ec_lastFireButtonStates; + x2ec_lastFireButtonStates = x2f4_fireButtonStates; + u32 pressedStates = x2f4_fireButtonStates & (oldFiring ^ x2f4_fireButtonStates); + x2f0_pressedFireButtonStates = pressedStates; + u32 releasedStates = oldFiring & (oldFiring ^ x2f4_fireButtonStates); + x832_28_ = false; + + CPlayer& player = mgr.GetPlayer(); + if (!x832_24_ && !x834_30_inBigStrike) + { + float coolDown = x72c_currentBeam->GetWeaponInfo().x0_coolDown; + if ((pressedStates & 0x1) == 0) + { + if (x390_cooldown >= coolDown) + { + x390_cooldown = coolDown; + if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed && + mgr.GetPlayerState()->ItemEnabled(CPlayerState::EItemType::ChargeBeam) && + player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn && + player.GetGrappleState() == CPlayer::EGrappleState::None && + mgr.GetPlayerState()->GetTransitioningVisor() != CPlayerState::EPlayerVisor::Scan && + mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan && + (x2ec_lastFireButtonStates & 0x1) != 0 && x32c_ == 0) + { + x832_28_ = true; + pressedStates |= 0x1; + x390_cooldown = 0.f; + } + } + } + else if (x390_cooldown >= coolDown) + { + x832_28_ = true; + x390_cooldown = 0.f; + } + x390_cooldown += dt; + } + + if (x834_28_) + x834_28_ = (x2ec_lastFireButtonStates & 0x1) != 0; + + if (player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) + { + x835_28_bombReady = false; + x835_29_powerBombReady = false; + if (!x835_31_actorAttached) + { + x835_28_bombReady = false; + if (x53a_powerBomb != kInvalidUniqueId && + !mgr.CanCreateProjectile(x538_playerId, EWeaponType::PowerBomb, 1)) + { + auto* pb = static_cast(mgr.GetObjectById(x53a_powerBomb)); + if (pb && pb->GetCurTime() <= 4.25f) + x835_28_bombReady = false; + else + x53a_powerBomb = kInvalidUniqueId; + } + if (((pressedStates & 0x1) != 0 || x32c_ != 0) && + mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::MorphBallBombs)) + { + if (x835_28_bombReady) + DropBomb(EBWeapon::Zero, mgr); + } + else if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::PowerBombs) && + mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::PowerBombs) > 0) + { + x835_29_powerBombReady = mgr.CanCreateProjectile(x538_playerId, EWeaponType::PowerBomb, 1) && + mgr.CanCreateProjectile(x538_playerId, EWeaponType::Bomb, 1); + if ((pressedStates & 0x2) != 0 && x835_29_powerBombReady) + DropBomb(EBWeapon::One, mgr); + } + } + } + else if ((x2f8_ & 0x8) != 0x8 && + player.GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed) + { + if ((pressedStates & 0x2) != 0 && !x318_ && (x2f8_ & 0x2) != 0x2 && !x32c_) + { + u32 missileCount = mgr.GetPlayerState()->GetItemAmount(CPlayerState::EItemType::Missiles); + if (x338_ != 1 && x338_ != 2) + { + if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::Missiles) && missileCount > 0) + { + x300_ = missileCount; + if (x300_ > 5) + x300_ = 5; + if (!x835_25_inPhazonBeam) + { + x2f8_ &= ~0x1; + x2f8_ |= 0x6; + x318_ = 1; + x31c_missileMode = EMissleMode::Active; + } + FireSecondary(dt, mgr); + } + else + { + if (!CSfxManager::IsPlaying(x2e4_invalidSfx)) + x2e4_invalidSfx = PlaySfx(1781, x834_27_underwater, false, 0.165f); + else + x2e4_invalidSfx.reset(); + } + } + } + else + { + if (x3a4_fidget.GetState() == CFidget::EState::Zero) + { + if ((x2f8_ & 0x10) == 0x10 && x744_auxWeapon->IsComboFxActive(mgr)) + { + if (x2ec_lastFireButtonStates == 0 || (x310_selectedBeam == 2 && x833_29_pointBlankWorldSurface)) + { + StopContinuousBeam(mgr, (x2f8_ & 0x8) == 0x8); + } + } + else + { + if (mgr.GetPlayerState()->ItemEnabled(CPlayerState::EItemType::ChargeBeam) && + x33c_gunOverrideMode == EGunOverrideMode::Normal) + ProcessChargeState(releasedStates, pressedStates, mgr, dt); + else + ProcessNormalState(releasedStates, pressedStates, mgr, dt); + } + } + } + } +} + +void CPlayerGun::EnterFreeLook(CStateManager& mgr) +{ + if (!x832_30_) + x73c_gunMotion->PlayPasAnim(SamusGun::EAnimationState::FreeLook, mgr, 0.f, false); + x740_grappleArm->EnterFreeLook(x835_25_inPhazonBeam ? 1 : x310_selectedBeam, + x73c_gunMotion->GetFreeLookSetId(), mgr); +} + +void CPlayerGun::SetFidgetAnimBits(int parm2, bool beamOnly) +{ + x2fc_fidgetAnimBits = 0; + if (beamOnly) + { + x2fc_fidgetAnimBits = 2; + return; + } + + switch (x3a4_fidget.GetType()) + { + case SamusGun::EFidgetType::Zero: + x2fc_fidgetAnimBits = 1; + if (parm2 != 1) + return; + x2fc_fidgetAnimBits |= 4; + break; + case SamusGun::EFidgetType::One: + if (parm2 >= 6 || parm2 < 4) + x2fc_fidgetAnimBits = 2; + else + x2fc_fidgetAnimBits = 1; + x2fc_fidgetAnimBits |= 4; + break; + default: + break; + } +} + +void CPlayerGun::AsyncLoadFidget(CStateManager& mgr) +{ + SetFidgetAnimBits(x3a4_fidget.GetParm2(), x3a4_fidget.GetState() == CFidget::EState::Three); + if ((x2fc_fidgetAnimBits & 0x1) == 0x1) + x73c_gunMotion->GunController().LoadFidgetAnimAsync(mgr, s32(x3a4_fidget.GetType()), + x310_selectedBeam, x3a4_fidget.GetParm2()); + if ((x2fc_fidgetAnimBits & 0x2) == 0x2) + { + x72c_currentBeam->AsyncLoadFidget(mgr, (x3a4_fidget.GetState() == CFidget::EState::Three ? + SamusGun::EFidgetType::Zero : x3a4_fidget.GetType()), x3a4_fidget.GetParm2()); + x832_31_ = false; + } + if ((x2fc_fidgetAnimBits & 0x4) == 0x4) + if (CGunController* gc = x740_grappleArm->GunController()) + gc->LoadFidgetAnimAsync(mgr, s32(x3a4_fidget.GetType()), + x3a4_fidget.GetType() != SamusGun::EFidgetType::Zero ? x310_selectedBeam : 0, + x3a4_fidget.GetParm2()); +} + +bool CPlayerGun::IsFidgetLoaded() const +{ + int loadFlags = 0; + if ((x2fc_fidgetAnimBits & 0x1) == 0x1 && x73c_gunMotion->GunController().IsFidgetLoaded()) + loadFlags |= 0x1; + if ((x2fc_fidgetAnimBits & 0x2) == 0x2 && x72c_currentBeam->IsFidgetLoaded()) + loadFlags |= 0x2; + if ((x2fc_fidgetAnimBits & 0x4) == 0x4) + if (CGunController* gc = x740_grappleArm->GunController()) + if (gc->IsFidgetLoaded()) + loadFlags |= 0x4; + return x2fc_fidgetAnimBits == loadFlags; +} + +void CPlayerGun::EnterFidget(CStateManager& mgr) +{ + if ((x2fc_fidgetAnimBits & 0x1) == 0x1) + { + x73c_gunMotion->EnterFidget(mgr, x3a4_fidget.GetType(), x3a4_fidget.GetParm2()); + x834_25_ = true; + } + else + { + x834_25_ = false; + } + + if ((x2fc_fidgetAnimBits & 0x2) == 0x2) + x72c_currentBeam->EnterFidget(mgr, x3a4_fidget.GetType(), x3a4_fidget.GetParm2()); + + if ((x2fc_fidgetAnimBits & 0x4) == 0x4) + x740_grappleArm->EnterFidget(mgr, x3a4_fidget.GetType(), + x3a4_fidget.GetType() != SamusGun::EFidgetType::Zero ? x310_selectedBeam : 0, + x3a4_fidget.GetParm2()); + + UnLoadFidget(); + x3a4_fidget.DoneLoading(); +} + +void CPlayerGun::UpdateGunIdle(bool b1, float camBobT, float dt, CStateManager& mgr) +{ + CPlayer& player = mgr.GetPlayer(); + if (player.IsInFreeLook() && !x832_29_ && !x740_grappleArm->IsGrappling() && + x3a4_fidget.GetState() != CFidget::EState::Three && + player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn && !x834_30_inBigStrike) + { + if ((x2f8_ & 0x8) != 0x8) + { + if (!x833_31_ && !x834_26_) + { + if (x388_ < 0.25f) + x388_ += dt; + if (x388_ >= 0.25f && !x740_grappleArm->IsSuitLoading()) + { + EnterFreeLook(mgr); + x833_31_ = true; + } + } + else + { + x388_ = 0.f; + if (x834_26_) + ResetIdle(mgr); + } + } + } + else + { + if (x833_31_) + { + if ((x2f8_ & 0x10) != 0x10) + { + x73c_gunMotion->ReturnToDefault(mgr, x834_30_inBigStrike); + x740_grappleArm->ReturnToDefault(mgr, 0.f, false); + } + x833_31_ = false; + } + x388_ = 0.f; + if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) + { + x833_24_isFidgeting = (player.GetSurfaceRestraint() != CPlayer::ESurfaceRestraints::Water && + mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::Scan && + (x2f4_fireButtonStates & 0x3) == 0 && x32c_ == 0 && !x832_29_ && (x2f8_ & 0x8) != 0x8 && + x364_ <= 0.f && player.GetPlayerMovementState() == CPlayer::EPlayerMovementState::OnGround && + !player.IsInFreeLook() && !player.GetFreeLookStickState() && x304_ == 0 && + std::fabs(player.GetAngularVelocityOR().angle()) <= 0.1f && camBobT <= 0.01f && + !mgr.GetCameraManager()->IsInCinematicCamera() && + player.GetGunHolsterState() == CPlayer::EGunHolsterState::Drawn && + player.GetGrappleState() == CPlayer::EGrappleState::None && !x834_30_inBigStrike && + !x835_25_inPhazonBeam); + if (x833_24_isFidgeting) + { + if (!x834_30_inBigStrike) + { + bool r19 = camBobT > 0.01f && (x2f4_fireButtonStates & 0x3) == 0; + if (r19) + { + x370_gunMotionSpeedMult = 1.f; + x374_ = 0.f; + if (x364_ <= 0.f && x368_ <= 0.f) + { + x368_ = 8.f; + x73c_gunMotion->PlayPasAnim(SamusGun::EAnimationState::Wander, mgr, 0.f, false); + x324_ = 1; + x550_camBob.SetState(CPlayerCameraBob::ECameraBobState::Walk, mgr); + } + x368_ -= dt; + x360_ -= dt; + } + if (!r19 || x834_26_) + ResetIdle(mgr); + } + if (x394_damageTimer > 0.f) + { + x394_damageTimer -= dt; + } + else if (!x834_31_) + { + x394_damageTimer = 0.f; + x834_31_ = true; + x73c_gunMotion->BasePosition(true); + } + else if (!x73c_gunMotion->GetModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, "Whole Body")) + { + x834_30_inBigStrike = false; + x834_31_ = false; + } + } + else + { + switch (x3a4_fidget.Update(x2ec_lastFireButtonStates, camBobT > 0.01f, b1, dt, mgr)) + { + case CFidget::EState::Zero: + if (x324_ != 2) + { + x73c_gunMotion->PlayPasAnim(SamusGun::EAnimationState::Idle, mgr, 0.f, false); + x324_ = 2; + } + x550_camBob.SetState(CPlayerCameraBob::ECameraBobState::WalkNoBob, mgr); + break; + case CFidget::EState::One: + case CFidget::EState::Two: + case CFidget::EState::Three: + if (x324_ != 0) + { + x73c_gunMotion->BasePosition(false); + x324_ = 0; + } + AsyncLoadFidget(mgr); + break; + case CFidget::EState::Seven: + if (IsFidgetLoaded()) + EnterFidget(mgr); + break; + case CFidget::EState::Four: + case CFidget::EState::Five: + x550_camBob.SetState(CPlayerCameraBob::ECameraBobState::Walk, mgr); + x833_24_isFidgeting = false; + x834_26_ = x834_25_ ? x73c_gunMotion->IsAnimPlaying() : + x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, "Whole Body"); + if (!x834_26_) + { + x3a4_fidget.ResetMinor(); + ReturnToRestPose(); + } + break; + default: + break; + } + } + x550_camBob.Update(dt, mgr); + } + } +} + static const float chargeShakeTbl[] = { -0.001f, 0.f, 0.001f }; static const CMaterialFilter sAimFilter = CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::ProjectilePassthrough}); @@ -943,8 +1401,8 @@ void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateM if (becameFrozen || becameThawed) { - x2f4_ = 0; - x2ec_firing = 0; + x2f4_fireButtonStates = 0; + x2ec_lastFireButtonStates = 0; CancelFiring(mgr); } @@ -1057,7 +1515,8 @@ void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateM if (x740_grappleArm->GetActive() && !x740_grappleArm->IsGrappling()) UpdateLeftArmTransform(x72c_currentBeam->GetSolidModelData(), mgr); - x6a0_motionState.Update(x2f0_ != 0 && x832_28_ && x32c_ < 2 && !player.IsInFreeLook(), advDt, x4a8_gunWorldXf, mgr); + x6a0_motionState.Update(x2f0_pressedFireButtonStates != 0 && x832_28_ && x32c_ < 2 && + !player.IsInFreeLook(), advDt, x4a8_gunWorldXf, mgr); x72c_currentBeam->GetSolidModelData().AdvanceParticles(x4a8_gunWorldXf, advDt, mgr); x72c_currentBeam->UpdateGunFx(x380_ > 2.f && x378_ > 0.15f, dt, mgr, x508_elbowLocalXf); @@ -1159,7 +1618,7 @@ void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateM UpdateWeaponFire(advDt, playerState, mgr); UpdateGunIdle(x364_ > 0.f, cameraBobT, advDt, mgr); - if ((x2ec_firing & 0x1) == 0x1) + if ((x2ec_lastFireButtonStates & 0x1) == 0x1) { x378_ = 0.f; } @@ -1184,7 +1643,7 @@ void CPlayerGun::Update(float grappleSwingT, float cameraBobT, float dt, CStateM if (x364_ > 0.f) { - x2f4_ = 0; + x2f4_fireButtonStates = 0; x364_ -= advDt; } @@ -1214,6 +1673,11 @@ void CPlayerGun::AddToRenderer(const zeus::CFrustum& frustum, const CStateManage } +void CPlayerGun::DropBomb(EBWeapon weapon, CStateManager& mgr) +{ + +} + TUniqueId CPlayerGun::DropPowerBomb(CStateManager& mgr) { return {}; diff --git a/Runtime/Weapon/CPlayerGun.hpp b/Runtime/Weapon/CPlayerGun.hpp index 075f5c455..41e868897 100644 --- a/Runtime/Weapon/CPlayerGun.hpp +++ b/Runtime/Weapon/CPlayerGun.hpp @@ -35,7 +35,8 @@ public: }; enum class EBWeapon { - + Zero, + One }; enum class EGunOverrideMode { @@ -113,11 +114,12 @@ private: CSfxHandle x2e0_chargeSfx; CSfxHandle x2e4_invalidSfx; u32 x2e8_ = 0; - u32 x2ec_firing = 0; - u32 x2f0_ = 0; - u32 x2f4_ = 0; + // 0x1: FireOrBomb, 0x2: MissileOrPowerBomb + u32 x2ec_lastFireButtonStates = 0; + u32 x2f0_pressedFireButtonStates = 0; + u32 x2f4_fireButtonStates = 0; u32 x2f8_ = 1; - u32 x2fc_ = 0; + u32 x2fc_fidgetAnimBits = 0; u32 x300_ = 0; u32 x304_ = 0; u32 x308_bombCount = 3; @@ -130,7 +132,7 @@ private: u32 x324_ = 4; u32 x328_ = 0x2000; u32 x32c_ = 0; - u32 x330_chargeWeaponIdx = 0; + EChargeState x330_chargeState = EChargeState::Normal; u32 x334_ = 0; u32 x338_ = 0; EGunOverrideMode x33c_gunOverrideMode = EGunOverrideMode::Normal; @@ -169,7 +171,7 @@ private: zeus::CTransform x4d8_gunLocalXf; zeus::CTransform x508_elbowLocalXf; TUniqueId x538_playerId; - TUniqueId x53a_ = kInvalidUniqueId; + TUniqueId x53a_powerBomb = kInvalidUniqueId; TUniqueId x53c_lightId = kInvalidUniqueId; std::vector x540_handAnimTokens; CPlayerCameraBob x550_camBob; @@ -281,7 +283,19 @@ private: void DoUserAnimEvents(float dt, CStateManager& mgr); TUniqueId GetTargetId(CStateManager& mgr) const; void CancelLockOn(); + void FireSecondary(float dt, CStateManager& mgr); + void ResetCharged(float dt, CStateManager& mgr); + void ActivateCombo(CStateManager& mgr); + void ProcessChargeState(u32 releasedStates, u32 pressedStates, CStateManager& mgr, float dt); + void ResetNormal(CStateManager& mgr); + void UpdateNormalShotCycle(float dt, CStateManager& mgr); + void ProcessNormalState(u32 releasedStates, u32 pressedStates, CStateManager& mgr, float dt); void UpdateWeaponFire(float dt, const CPlayerState& playerState, CStateManager& mgr); + void EnterFreeLook(CStateManager& mgr); + void SetFidgetAnimBits(int parm2, bool beamOnly); + void AsyncLoadFidget(CStateManager& mgr); + bool IsFidgetLoaded() const; + void EnterFidget(CStateManager& mgr); void UpdateGunIdle(bool b1, float camBobT, float dt, CStateManager& mgr); public: @@ -318,7 +332,8 @@ public: 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; - bool GetFiring() const { return x2ec_firing != 0; } + u32 GetLastFireButtonStates() const { return x2ec_lastFireButtonStates; } + void DropBomb(EBWeapon weapon, CStateManager& mgr); TUniqueId DropPowerBomb(CStateManager& mgr); void SetActorAttached(bool b) { x835_31_actorAttached = b; } }; diff --git a/Runtime/Weapon/CPowerBomb.cpp b/Runtime/Weapon/CPowerBomb.cpp index e69de29bb..dae662c6c 100644 --- a/Runtime/Weapon/CPowerBomb.cpp +++ b/Runtime/Weapon/CPowerBomb.cpp @@ -0,0 +1,18 @@ +#include "CPowerBomb.hpp" + +namespace urde +{ + +CPowerBomb::CPowerBomb(const TToken& particle, TUniqueId uid, TAreaId aid, + TUniqueId playerId, const zeus::CTransform& xf, const CDamageInfo& dInfo) +: CWeapon(uid, aid, true, playerId, EWeaponType::PowerBomb, "PowerBomb", xf, + CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid, EMaterialTypes::Immovable, + EMaterialTypes::Trigger}, + {EMaterialTypes::Projectile, EMaterialTypes::PowerBomb}), + {EMaterialTypes::Projectile, EMaterialTypes::PowerBomb}, dInfo, EProjectileAttrib::PowerBombs, + CModelData::CModelDataNull()) +{ + +} + +} diff --git a/Runtime/Weapon/CPowerBomb.hpp b/Runtime/Weapon/CPowerBomb.hpp index e69de29bb..b2db7e59d 100644 --- a/Runtime/Weapon/CPowerBomb.hpp +++ b/Runtime/Weapon/CPowerBomb.hpp @@ -0,0 +1,22 @@ +#ifndef __URDE_CPOWERBOMB_HPP__ +#define __URDE_CPOWERBOMB_HPP__ + +#include "CWeapon.hpp" +#include "CToken.hpp" + +namespace urde +{ + +class CPowerBomb : public CWeapon +{ + float x15c_curTime = 0.f; + float x160_ = 0.f; +public: + CPowerBomb(const TToken& particle, TUniqueId uid, TAreaId aid, + TUniqueId playerId, const zeus::CTransform& xf, const CDamageInfo& dInfo); + float GetCurTime() const { return x15c_curTime; } +}; + +} + +#endif // __URDE_CPOWERBOMB_HPP__ diff --git a/Runtime/World/CAi.hpp b/Runtime/World/CAi.hpp index 0a9183ca2..782f54602 100644 --- a/Runtime/World/CAi.hpp +++ b/Runtime/World/CAi.hpp @@ -17,6 +17,7 @@ namespace urde enum class EListenNoiseType { + Zero }; enum class EKnockBackType diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 486e03bf1..de649cdbd 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -666,7 +666,7 @@ float CPlayer::UpdateCameraBob(float dt, CStateManager& mgr) } else if (bobMag < 0.01f) { - if (x490_gun->GetFiring()) + if (x490_gun->GetLastFireButtonStates() != 0) { bobMag = 0.f; state = CPlayerCameraBob::ECameraBobState::GunFireNoBob; diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index c24e71059..e4bbfb9e5 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -532,6 +532,8 @@ public: void HolsterGun(CStateManager& mgr); EPlayerCameraState GetCameraState() const { return x2f4_cameraState; } EPlayerMorphBallState GetMorphballTransitionState() const { return x2f8_morphBallState; } + EGunHolsterState GetGunHolsterState() const { return x498_gunHolsterState; } + EPlayerMovementState GetPlayerMovementState() const { return x258_movementState; } bool IsMorphBallTransitioning() const; void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float); float GetGravity() const; @@ -643,7 +645,7 @@ public: float GetMorphTime() const { return x574_morphTime; } float GetMorphDuration() const { return x578_morphDuration; } bool IsInFreeLook() const { return x3dc_inFreeLook; } - bool IsLookControlHeld() const { return x3de_lookAnalogHeld; } + bool GetFreeLookStickState() const { return x3de_lookAnalogHeld; } CPlayerGun* GetPlayerGun() const { return x490_gun.get(); } CMorphBall* GetMorphBall() const { return x768_morphball.get(); } CPlayerCameraBob* GetCameraBob() const { return x76c_cameraBob.get(); } diff --git a/Runtime/World/CWorldTransManager.cpp b/Runtime/World/CWorldTransManager.cpp index 7e0e2fc5e..2370fc3cb 100644 --- a/Runtime/World/CWorldTransManager.cpp +++ b/Runtime/World/CWorldTransManager.cpp @@ -394,8 +394,7 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes, x8_textData.reset(); x20_random.SetSeed(99); - CAssetId beamModelId = g_tweakPlayerRes->GetBeamCineModel( - DataSpec::ITweakPlayerRes::EBeamId(g_GameState->GetPlayerState()->GetCurrentBeam())); + CAssetId beamModelId = g_tweakPlayerRes->GetBeamCineModel(g_GameState->GetPlayerState()->GetCurrentBeam()); x4_modelData->x14c_beamModel = g_SimplePool->GetObj(SObjectTag{FOURCC('CMDL'), beamModelId});