Skip to content

Commit

Permalink
clang-format and some PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
LynxDev2 committed Jun 9, 2024
1 parent 9d26563 commit 7e40ec9
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Player/PlayerCarryKeeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <basis/seadTypes.h>

class PlayerCarryKeeper{
class PlayerCarryKeeper {
public:
bool isThrowHold() const;

Expand Down
14 changes: 9 additions & 5 deletions src/Player/PlayerHackKeeper.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#pragma once

#include "Library/LiveActor/LiveActor.h"
#include "Project/HitSensor/HitSensor.h"
#include <math/seadMatrix.h>

namespace al {
class LiveActor;
class HitSensor;
} // namespace al

class PlayerRecoverySafetyPoint;
class HackCap;
class PlayerInput;
class PlayerDamageKeeper;
class IPlayerModelChanger;
class IPlayerMoelChanger;
class IUsePlayerHeightCheck;

class PlayerHackKeeper {
Expand All @@ -17,8 +21,8 @@ class PlayerHackKeeper {
PlayerDamageKeeper* damageKeeper, const IPlayerModelChanger* modelChanger,
const IUsePlayerHeightCheck* heightCheck);

inline al::LiveActor* getCurrentHackActor() const { return mCurrentHackActor; }
inline al::HitSensor* getUnkHitSensor() const { return mUnkHitSensor; }
al::LiveActor* getCurrentHackActor() const { return mCurrentHackActor; }
al::HitSensor* getUnkHitSensor() const { return mUnkHitSensor; }

private:
char padding[0x68];
Expand Down
52 changes: 36 additions & 16 deletions src/Player/PlayerJudgeTalkGround.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Player/PlayerJudgeTalkGround.h"

#include <math/seadVectorFwd.h>
#include <math/seadVector.h>

#include "Library/LiveActor/ActorMovementFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
Expand All @@ -12,23 +12,16 @@
#include "Player/PlayerHackKeeper.h"
#include "Player/PlayerInput.h"
#include "Player/PlayerStateWait.h"

// TODO: Put these in the correct headers
namespace rs {
bool isPlayerOnGround(const al::LiveActor*);
bool isOnGround(const al::LiveActor*, const IUsePlayerCollision*);
bool isJustLand(const IUsePlayerCollision*);
const sead::Vector3f& getCollidedGroundNormal(const IUsePlayerCollision*);
} // namespace rs
#include "Util/PlayerCollisionUtil.h"

PlayerJudgeTalkGround::PlayerJudgeTalkGround(
const al::LiveActor* playerActor, const IPlayerModelChanger* playerModelChanger,
const PlayerHackKeeper* playerHackKeeper, const PlayerCarryKeeper* playerCarryKeeper,
const IUsePlayerCollision* playerCollision, const PlayerInput* playerInput,
const IUsePlayerCollision* playerCollider, const PlayerInput* playerInput,
const PlayerConst* playerConst, const PlayerStateWait* playerStateWait)
: mPlayerActor(playerActor), mPlayerModelChanger(playerModelChanger),
mPlayerHackKeeper(playerHackKeeper), mPlayerCarryKeeper(playerCarryKeeper),
mPlayerCollision(playerCollision), mPlayerInput(playerInput), mPlayerConst(playerConst),
mCollider(playerCollider), mPlayerInput(playerInput), mPlayerConst(playerConst),
mPlayerStateWait(playerStateWait) {}

void PlayerJudgeTalkGround::reset() {}
Expand All @@ -43,18 +36,45 @@ bool PlayerJudgeTalkGround::judge() const {
f32 speedH = al::calcSpeedH(currentHackActor);
return !(maxSpeed < speedH);
}
} else if (!mPlayerModelChanger->is2DModel() &&
rs::isOnGround(mPlayerActor, mPlayerCollision) &&
!rs::isJustLand(mPlayerCollision)) {
} else if (!mPlayerModelChanger->is2DModel() && rs::isOnGround(mPlayerActor, mCollider) &&
!rs::isJustLand(mCollider)) {
if ((mPlayerStateWait->isDead() || mPlayerStateWait->isEnableCancelAction()) &&
!mPlayerInput->isMove() && !mPlayerCarryKeeper->isThrowHold()) {
const sead::Vector3f& gravity = rs::isJustLand(mCollider) ?
al::getGravity(mPlayerActor) :
rs::getCollidedGroundNormal(mCollider);
sead::Vector3f velocity = al::getVelocity(mPlayerActor);
al::verticalizeVec(&velocity, gravity, velocity);
return !(mPlayerConst->getNormalMaxSpeed() * 0.65f < velocity.length());
}
}
return false;
}

/*
bool PlayerJudgeTalkGround::judge() const {
auto* currentHackActor = mPlayerHackKeeper->getCurrentHackActor();
if (!mPlayerHackKeeper->getUnkHitSensor()) {
if (!mPlayerModelChanger->is2DModel() &&
rs::isOnGround(mPlayerActor, mCollider) &&
!rs::isJustLand(mCollider)) {
if ((mPlayerStateWait->isDead() || mPlayerStateWait->isEnableCancelAction()) &&
!mPlayerInput->isMove() && !mPlayerCarryKeeper->isThrowHold()) {
const sead::Vector3f& gravity = rs::isJustLand(mPlayerCollision) ?
const sead::Vector3f& gravity = rs::isJustLand(mCollider) ?
al::getGravity(mPlayerActor) :
rs::getCollidedGroundNormal(mPlayerCollision);
rs::getCollidedGroundNormal(mCollider);
sead::Vector3f velocity = al::getVelocity(mPlayerActor);
al::verticalizeVec(&velocity, gravity, velocity);
return !(mPlayerConst->getNormalMaxSpeed() * 0.65f < velocity.length());
}
}
}
if (rs::isPlayerOnGround(currentHackActor) && !mPlayerInput->isMove()) {
f32 maxSpeed = mPlayerConst->getNormalMaxSpeed() * 0.65f;
f32 speedH = al::calcSpeedH(currentHackActor);
return !(maxSpeed < speedH);
}
return false;
}
*/
10 changes: 5 additions & 5 deletions src/Player/PlayerJudgeTalkGround.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "Library/HostIO/HioNode.h"
#include "Player/IJudge.h"

namespace al {
Expand All @@ -14,15 +15,14 @@ class PlayerInput;
class PlayerConst;
class PlayerStateWait;

class PlayerJudgeTalkGround : public IJudge {
class PlayerJudgeTalkGround : public IJudge, public al::HioNode {
public:
PlayerJudgeTalkGround(const al::LiveActor* playerActor,
const IPlayerModelChanger* playerModelChanger,
const PlayerHackKeeper* playerHackKeeper,
const PlayerCarryKeeper* playerCarryKeeper,
const IUsePlayerCollision* mPlayerCollision,
const PlayerInput* playerInput, const PlayerConst* playerConst,
const PlayerStateWait* playerStateWait);
const IUsePlayerCollision* playerCollider, const PlayerInput* playerInput,
const PlayerConst* playerConst, const PlayerStateWait* playerStateWait);

void reset() override;
void update() override;
Expand All @@ -33,7 +33,7 @@ class PlayerJudgeTalkGround : public IJudge {
const IPlayerModelChanger* mPlayerModelChanger;
const PlayerHackKeeper* mPlayerHackKeeper;
const PlayerCarryKeeper* mPlayerCarryKeeper;
const IUsePlayerCollision* mPlayerCollision;
const IUsePlayerCollision* mCollider;
const PlayerInput* mPlayerInput;
const PlayerConst* mPlayerConst;
const PlayerStateWait* mPlayerStateWait;
Expand Down
4 changes: 2 additions & 2 deletions src/Player/PlayerStateWait.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include "Library/Nerve/NerveStateBase.h"

class PlayerStateWait : public al::ActorStateBase{
class PlayerStateWait : public al::ActorStateBase {
public:
bool isEnableCancelAction() const;

private:
u8 padding[0xE8 - sizeof(al::ActorStateBase)];
u8 padding[0xE8 - sizeof(al::ActorStateBase)];
};
4 changes: 4 additions & 0 deletions src/Util/PlayerCollisionUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ namespace rs {

f32 getGroundHeight(const IUsePlayerHeightCheck*);
const sead::Vector3f& getCollidedWallNormal(const IUsePlayerCollision*);
const sead::Vector3f& getCollidedGroundNormal(const IUsePlayerCollision*);
bool isCollidedGround(const IUsePlayerCollision*);
bool isCollidedGroundRunAngle(const al::LiveActor*, const IUsePlayerCollision*, const PlayerConst*);
bool isPlayerOnGround(const al::LiveActor*);
bool isOnGround(const al::LiveActor*, const IUsePlayerCollision*);
bool isJustLand(const IUsePlayerCollision*);

} // namespace rs

0 comments on commit 7e40ec9

Please sign in to comment.