Player: Implement PlayerJudgeSandSink (#100)

This commit is contained in:
MonsterDruide1 2024-06-20 00:59:54 +02:00 committed by GitHub
parent 1c0c21f1de
commit 7d9e5840aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 80 additions and 4 deletions

View File

@ -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

Can't render this file because it is too large.

View File

@ -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));
}

View File

@ -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);

View File

@ -0,0 +1,35 @@
#pragma once
#include <math/seadVector.h>
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);

View File

@ -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