From f3f607db944493fb11223dae2b129858f294ea0f Mon Sep 17 00:00:00 2001 From: MonsterDruide1 <5958456@gmail.com> Date: Sun, 9 Jun 2024 18:00:36 +0200 Subject: [PATCH] Player: Implement PlayerJudgeForceSlopeSlide --- data/odyssey_functions.csv | 8 +++---- src/Player/PlayerJudgeForceSlopeSlide.cpp | 21 ++++++++++++++++++ src/Player/PlayerJudgeForceSlopeSlide.h | 26 +++++++++++++++++++++++ src/Util/PlayerCollisionUtil.h | 1 + src/Util/PlayerUtil.h | 11 ++++++++++ 5 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 src/Player/PlayerJudgeForceSlopeSlide.cpp create mode 100644 src/Player/PlayerJudgeForceSlopeSlide.h create mode 100644 src/Util/PlayerUtil.h diff --git a/data/odyssey_functions.csv b/data/odyssey_functions.csv index 0722651a7..7490afd90 100644 --- a/data/odyssey_functions.csv +++ b/data/odyssey_functions.csv @@ -27846,10 +27846,10 @@ Address,Quality,Size,Name 0x000000710045963c,U,000012,_ZNK23PlayerJudgeForceRolling5judgeEv 0x0000007100459648,U,000004,_ZN23PlayerJudgeForceRolling5resetEv 0x000000710045964c,U,000004,_ZN23PlayerJudgeForceRolling6updateEv -0x0000007100459650,U,000028,_ZN26PlayerJudgeForceSlopeSlideC1EPKN2al9LiveActorEPK11PlayerConstPK19IUsePlayerCollision -0x000000710045966c,U,000008,_ZN26PlayerJudgeForceSlopeSlide5resetEv -0x0000007100459674,U,000048,_ZN26PlayerJudgeForceSlopeSlide6updateEv -0x00000071004596a4,U,000060,_ZNK26PlayerJudgeForceSlopeSlide5judgeEv +0x0000007100459650,O,000028,_ZN26PlayerJudgeForceSlopeSlideC1EPKN2al9LiveActorEPK11PlayerConstPK19IUsePlayerCollision +0x000000710045966c,O,000008,_ZN26PlayerJudgeForceSlopeSlide5resetEv +0x0000007100459674,O,000048,_ZN26PlayerJudgeForceSlopeSlide6updateEv +0x00000071004596a4,O,000060,_ZNK26PlayerJudgeForceSlopeSlide5judgeEv 0x00000071004596e0,U,000052,_ZN19PlayerJudgeGrabCeilC1EPKN2al9LiveActorEPK11PlayerConstPK19IUsePlayerCollisionPK19IPlayerModelChangerPK17PlayerCarryKeeperPK22PlayerExternalVelocity 0x0000007100459714,U,000020,_ZN19PlayerJudgeGrabCeil5resetEv 0x0000007100459728,U,001216,_ZN19PlayerJudgeGrabCeil6updateEv diff --git a/src/Player/PlayerJudgeForceSlopeSlide.cpp b/src/Player/PlayerJudgeForceSlopeSlide.cpp new file mode 100644 index 000000000..e71c85267 --- /dev/null +++ b/src/Player/PlayerJudgeForceSlopeSlide.cpp @@ -0,0 +1,21 @@ +#include "Player/PlayerJudgeForceSlopeSlide.h" + +#include "Util/PlayerCollisionUtil.h" +#include "Util/PlayerUtil.h" + +PlayerJudgeForceSlopeSlide::PlayerJudgeForceSlopeSlide(const al::LiveActor* player, + const PlayerConst* pConst, + const IUsePlayerCollision* collider) + : mPlayer(player), mConst(pConst), mCollider(collider) {} + +void PlayerJudgeForceSlopeSlide::reset() { + mIsJudge = false; +} + +void PlayerJudgeForceSlopeSlide::update() { + mIsJudge = rs::isOnGroundForceSlideCode(mPlayer, mCollider, mConst); +} + +bool PlayerJudgeForceSlopeSlide::judge() const { + return !rs::isPlayerHack(mPlayer) && mIsJudge; +} diff --git a/src/Player/PlayerJudgeForceSlopeSlide.h b/src/Player/PlayerJudgeForceSlopeSlide.h new file mode 100644 index 000000000..edcbd4ea3 --- /dev/null +++ b/src/Player/PlayerJudgeForceSlopeSlide.h @@ -0,0 +1,26 @@ +#pragma once + +#include "Library/HostIO/HioNode.h" + +#include "Player/IJudge.h" + +namespace al { +class LiveActor; +} +class IUsePlayerCollision; +class PlayerConst; + +class PlayerJudgeForceSlopeSlide : public al::HioNode, IJudge { +public: + PlayerJudgeForceSlopeSlide(const al::LiveActor* player, const PlayerConst* pConst, + const IUsePlayerCollision* collider); + void reset() override; + void update() override; + bool judge() const override; + +private: + const al::LiveActor* mPlayer; + const PlayerConst* mConst; + const IUsePlayerCollision* mCollider; + bool mIsJudge = false; +}; diff --git a/src/Util/PlayerCollisionUtil.h b/src/Util/PlayerCollisionUtil.h index daffb7e2b..8baefde87 100644 --- a/src/Util/PlayerCollisionUtil.h +++ b/src/Util/PlayerCollisionUtil.h @@ -15,5 +15,6 @@ f32 getGroundHeight(const IUsePlayerHeightCheck*); const sead::Vector3f& getCollidedWallNormal(const IUsePlayerCollision*); bool isCollidedGround(const IUsePlayerCollision*); bool isCollidedGroundRunAngle(const al::LiveActor*, const IUsePlayerCollision*, const PlayerConst*); +bool isOnGroundForceSlideCode(const al::LiveActor*, const IUsePlayerCollision*, const PlayerConst*); } // namespace rs diff --git a/src/Util/PlayerUtil.h b/src/Util/PlayerUtil.h new file mode 100644 index 000000000..2ba4a3eda --- /dev/null +++ b/src/Util/PlayerUtil.h @@ -0,0 +1,11 @@ +#pragma once + +namespace al { +class LiveActor; +} + +namespace rs { + +bool isPlayerHack(const al::LiveActor*); + +}