Skip to content

Commit

Permalink
Player: Implement PlayerJudgeForceSlopeSlide
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsterDruide1 committed Jun 9, 2024
1 parent 318b65c commit 82b20ba
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
8 changes: 4 additions & 4 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions src/Player/PlayerJudgeForceSlopeSlide.cpp
Original file line number Diff line number Diff line change
@@ -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() {
mIsForceSlide = false;
}

void PlayerJudgeForceSlopeSlide::update() {
mIsForceSlide = rs::isOnGroundForceSlideCode(mPlayer, mCollider, mConst);
}

bool PlayerJudgeForceSlopeSlide::judge() const {
return !rs::isPlayerHack(mPlayer) && mIsForceSlide;
}
26 changes: 26 additions & 0 deletions src/Player/PlayerJudgeForceSlopeSlide.h
Original file line number Diff line number Diff line change
@@ -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, public 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 mIsForceSlide = false;
};
1 change: 1 addition & 0 deletions src/Util/PlayerCollisionUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 11 additions & 0 deletions src/Util/PlayerUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

namespace al {
class LiveActor;
}

namespace rs {

bool isPlayerHack(const al::LiveActor*);

}

0 comments on commit 82b20ba

Please sign in to comment.