mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Player: Implement PlayerJudgeWallPush (#598)
This commit is contained in:
parent
0f31e4ee00
commit
b0113da277
|
|
@ -28039,10 +28039,10 @@ Address,Quality,Size,Name
|
|||
0x000000710045cd50,U,000008,_ZN19PlayerJudgeWallKeep5resetEv
|
||||
0x000000710045cd58,U,001692,_ZN19PlayerJudgeWallKeep6updateEv
|
||||
0x000000710045d3f4,U,000008,_ZNK19PlayerJudgeWallKeep5judgeEv
|
||||
0x000000710045d3fc,U,000024,_ZN19PlayerJudgeWallPushC1EPKN2al9LiveActorEPK19IUsePlayerCollisionPK11PlayerInput
|
||||
0x000000710045d414,U,000412,_ZNK19PlayerJudgeWallPush5judgeEv
|
||||
0x000000710045d5b0,U,000004,_ZN19PlayerJudgeWallPush5resetEv
|
||||
0x000000710045d5b4,U,000004,_ZN19PlayerJudgeWallPush6updateEv
|
||||
0x000000710045d3fc,O,000024,_ZN19PlayerJudgeWallPushC1EPKN2al9LiveActorEPK19IUsePlayerCollisionPK11PlayerInput
|
||||
0x000000710045d414,O,000412,_ZNK19PlayerJudgeWallPush5judgeEv
|
||||
0x000000710045d5b0,O,000004,_ZN19PlayerJudgeWallPush5resetEv
|
||||
0x000000710045d5b4,O,000004,_ZN19PlayerJudgeWallPush6updateEv
|
||||
0x000000710045d5b8,O,000032,_ZN26PlayerJudgeWaterSurfaceRunC1EPKN2al9LiveActorEPK11PlayerConstPKNS0_18WaterSurfaceFinderEPK21PlayerCounterForceRun
|
||||
0x000000710045d5d8,O,000016,_ZNK26PlayerJudgeWaterSurfaceRun15getBorderSpeedHEv
|
||||
0x000000710045d5e8,O,000168,_ZN26PlayerJudgeWaterSurfaceRun6updateEv
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
bool isThrowTypeRolling(const sead::Vector2f&) const;
|
||||
|
||||
void calcMoveInput(sead::Vector3f*, const sead::Vector3f&) const;
|
||||
void calcMoveDirection(sead::Vector3f*, const sead::Vector3f&) const;
|
||||
|
||||
private:
|
||||
const al::LiveActor* mLiveActor;
|
||||
|
|
|
|||
44
src/Player/PlayerJudgeWallPush.cpp
Normal file
44
src/Player/PlayerJudgeWallPush.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "Player/PlayerJudgeWallPush.h"
|
||||
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
|
||||
#include "Player/PlayerInput.h"
|
||||
#include "Util/PlayerCollisionUtil.h"
|
||||
#include "Util/PlayerUtil.h"
|
||||
|
||||
PlayerJudgeWallPush::PlayerJudgeWallPush(const al::LiveActor* player,
|
||||
const IUsePlayerCollision* collider,
|
||||
const PlayerInput* input)
|
||||
: mPlayer(player), mCollider(collider), mInput(input) {}
|
||||
|
||||
void PlayerJudgeWallPush::reset() {}
|
||||
|
||||
void PlayerJudgeWallPush::update() {}
|
||||
|
||||
bool PlayerJudgeWallPush::judge() const {
|
||||
if (rs::isPlayerCarrySomething(mPlayer) || !rs::isCollidedGround(mCollider) ||
|
||||
!rs::isCollidedWall(mCollider) || rs::isActionCodeNoActionWall(mCollider))
|
||||
return false;
|
||||
|
||||
const sead::Vector3f& collidedGroundNormal = rs::getCollidedGroundNormal(mCollider);
|
||||
const sead::Vector3f& collidedWallNormal = rs::getCollidedWallNormal(mCollider);
|
||||
|
||||
if (sead::Mathf::abs(collidedGroundNormal.dot(collidedWallNormal)) > 0.17365f) // cos(80°)
|
||||
return false;
|
||||
|
||||
sead::Vector3f front = {0.0f, 0.0f, 0.0f};
|
||||
al::calcFrontDir(&front, mPlayer);
|
||||
al::verticalizeVec(&front, collidedGroundNormal, front);
|
||||
if (!al::tryNormalizeOrZero(&front))
|
||||
return false;
|
||||
|
||||
if (front.dot(-collidedWallNormal) < 0.70711f || !mInput->isMove()) // cos(45°)
|
||||
return false;
|
||||
|
||||
sead::Vector3f up = {0.0f, 0.0f, 0.0f};
|
||||
al::calcUpDir(&up, mPlayer);
|
||||
sead::Vector3f moveDirection = {0.0f, 0.0f, 0.0f};
|
||||
mInput->calcMoveDirection(&moveDirection, up);
|
||||
return !(moveDirection.dot(front) < 0.70711f); // cos(45°)
|
||||
}
|
||||
23
src/Player/PlayerJudgeWallPush.h
Normal file
23
src/Player/PlayerJudgeWallPush.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "Player/IJudge.h"
|
||||
|
||||
namespace al {
|
||||
class LiveActor;
|
||||
}
|
||||
class IUsePlayerCollision;
|
||||
class PlayerInput;
|
||||
|
||||
class PlayerJudgeWallPush : public IJudge {
|
||||
public:
|
||||
PlayerJudgeWallPush(const al::LiveActor* player, const IUsePlayerCollision* collider,
|
||||
const PlayerInput* input);
|
||||
void reset() override;
|
||||
void update() override;
|
||||
bool judge() const override;
|
||||
|
||||
private:
|
||||
const al::LiveActor* mPlayer;
|
||||
const IUsePlayerCollision* mCollider;
|
||||
const PlayerInput* mInput;
|
||||
};
|
||||
|
|
@ -45,6 +45,7 @@ bool isCollisionCodeSandSink(const IUsePlayerCollision*);
|
|||
bool isCollidedWall(const IUsePlayerCollision*);
|
||||
bool isCollidedCeiling(const IUsePlayerCollision*);
|
||||
bool isActionCodeNoWallGrab(const IUsePlayerCollision*);
|
||||
bool isActionCodeNoActionWall(const IUsePlayerCollision*);
|
||||
|
||||
bool isCollisionCodeGrabCeilAny(const IUsePlayerCollision*);
|
||||
bool isCollisionCodeGrabCeilWall(const IUsePlayerCollision*);
|
||||
|
|
|
|||
Loading…
Reference in a new issue