diff --git a/data/odyssey_functions.csv b/data/odyssey_functions.csv index 03398ee..24f99af 100644 --- a/data/odyssey_functions.csv +++ b/data/odyssey_functions.csv @@ -27927,10 +27927,10 @@ Address,Quality,Size,Name 0x000000710045b03c,O,000012,_ZNK20PlayerJudgeSameNerve5judgeEv 0x000000710045b048,O,000004,_ZN20PlayerJudgeSameNerve5resetEv 0x000000710045b04c,O,000004,_ZN20PlayerJudgeSameNerve6updateEv -0x000000710045b050,U,000024,_ZN19PlayerJudgeSandSinkC1EPK19IUsePlayerCollisionPK20PlayerSandSinkAffect -0x000000710045b068,U,000080,_ZNK19PlayerJudgeSandSink5judgeEv -0x000000710045b0b8,U,000004,_ZN19PlayerJudgeSandSink5resetEv -0x000000710045b0bc,U,000004,_ZN19PlayerJudgeSandSink6updateEv +0x000000710045b050,O,000024,_ZN19PlayerJudgeSandSinkC1EPK19IUsePlayerCollisionPK20PlayerSandSinkAffect +0x000000710045b068,O,000080,_ZNK19PlayerJudgeSandSink5judgeEv +0x000000710045b0b8,O,000004,_ZN19PlayerJudgeSandSink5resetEv +0x000000710045b0bc,O,000004,_ZN19PlayerJudgeSandSink6updateEv 0x000000710045b0c0,U,000024,_ZN16PlayerJudgeSleepC1EPK15PlayerStateWait 0x000000710045b0d8,U,000008,_ZNK16PlayerJudgeSleep5judgeEv 0x000000710045b0e0,U,000004,_ZN16PlayerJudgeSleep5resetEv diff --git a/src/Player/PlayerJudgeSandSink.cpp b/src/Player/PlayerJudgeSandSink.cpp new file mode 100644 index 0000000..2928cd1 --- /dev/null +++ b/src/Player/PlayerJudgeSandSink.cpp @@ -0,0 +1,17 @@ +#include "Player/PlayerJudgeSandSink.h" + +#include "Player/PlayerSandSinkAffect.h" +#include "Util/PlayerCollisionUtil.h" + +PlayerJudgeSandSink::PlayerJudgeSandSink(const IUsePlayerCollision* collider, + const PlayerSandSinkAffect* sandSinkAffect) + : mCollider(collider), mSandSinkAffect(sandSinkAffect) {} + +void PlayerJudgeSandSink::reset() {} + +void PlayerJudgeSandSink::update() {} + +bool PlayerJudgeSandSink::judge() const { + return mSandSinkAffect->isSink() || + (rs::isCollidedGround(mCollider) && rs::isCollisionCodeSandSink(mCollider)); +} diff --git a/src/Player/PlayerJudgeSandSink.h b/src/Player/PlayerJudgeSandSink.h new file mode 100644 index 0000000..e91cbc5 --- /dev/null +++ b/src/Player/PlayerJudgeSandSink.h @@ -0,0 +1,23 @@ +#pragma once + +#include "Library/HostIO/HioNode.h" + +#include "Player/IJudge.h" + +class IUsePlayerCollision; +class PlayerSandSinkAffect; + +class PlayerJudgeSandSink : public al::HioNode, public IJudge { +public: + PlayerJudgeSandSink(const IUsePlayerCollision* collider, + const PlayerSandSinkAffect* sandSinkAffect); + + void reset() override; + void update() override; + bool judge() const override; + +private: + const IUsePlayerCollision* mCollider; + const PlayerSandSinkAffect* mSandSinkAffect; +}; +static_assert(sizeof(PlayerJudgeSandSink) == 0x18); diff --git a/src/Player/PlayerSandSinkAffect.h b/src/Player/PlayerSandSinkAffect.h new file mode 100644 index 0000000..7b6ecc3 --- /dev/null +++ b/src/Player/PlayerSandSinkAffect.h @@ -0,0 +1,35 @@ +#pragma once + +#include + +namespace al { +class LiveActor; +} +class PlayerConst; +class PlayerInput; +class IUsePlayerCollision; +class PlayerEffect; + +class PlayerSandSinkAffect { +public: + PlayerSandSinkAffect(const al::LiveActor*, const PlayerConst*, const PlayerInput*, + IUsePlayerCollision*, PlayerEffect*); + void clear(); + bool isSink() const; + void update(bool); + bool isSinkDeathHeight() const; + void reduceVelocity(sead::Vector3f*); + bool isEnableCapThrow() const; + f32 calcSandSinkDeathRate() const; + +private: + const al::LiveActor* mPlayer; + const PlayerConst* mConst; + const PlayerInput* mInput; + IUsePlayerCollision* mCollider; + PlayerEffect* mEffect; + f32 mSinkVelocity; + f32 mSinkAmount; + bool mIsSafe; +}; +static_assert(sizeof(PlayerSandSinkAffect) == 0x38); diff --git a/src/Util/PlayerCollisionUtil.h b/src/Util/PlayerCollisionUtil.h index f155d1f..d777992 100644 --- a/src/Util/PlayerCollisionUtil.h +++ b/src/Util/PlayerCollisionUtil.h @@ -23,5 +23,6 @@ bool isOnGround(const al::LiveActor*, const IUsePlayerCollision*); bool isJustLand(const IUsePlayerCollision*); void calcGroundNormalOrGravityDir(sead::Vector3f*, const al::LiveActor*, const IUsePlayerCollision*); +bool isCollisionCodeSandSink(const IUsePlayerCollision*); } // namespace rs