| 1 | #include "Player/PlayerCapActionHistory.h" |
| 2 | |
| 3 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 4 | |
| 5 | #include "Player/PlayerConst.h" |
| 6 | #include "Player/PlayerCounterAfterCapCatch.h" |
| 7 | #include "Util/PlayerCollisionUtil.h" |
| 8 | |
| 9 | PlayerCapActionHistory::PlayerCapActionHistory(const al::LiveActor* player, |
| 10 | const PlayerConst* pConst, |
| 11 | const PlayerTrigger* trigger, |
| 12 | const IUsePlayerCollision* collider) |
| 13 | : mPlayer(player), mConst(pConst), mTrigger(trigger), mCollision(collider), |
| 14 | mCounterAfterCapCatch(new PlayerCounterAfterCapCatch(pConst, trigger)) {} |
| 15 | |
| 16 | void PlayerCapActionHistory::update() { |
| 17 | mCounterAfterCapCatch->update(trigger: mTrigger); |
| 18 | } |
| 19 | |
| 20 | void PlayerCapActionHistory::clearLandLimit() { |
| 21 | clearLimitHeight(); |
| 22 | clearCapJump(); |
| 23 | _39 = true; |
| 24 | } |
| 25 | |
| 26 | void PlayerCapActionHistory::clearLimitHeight() { |
| 27 | mIsLimitHeight = false; |
| 28 | } |
| 29 | |
| 30 | void PlayerCapActionHistory::clearCapJump() { |
| 31 | mIsCapJumpPossible = true; |
| 32 | } |
| 33 | |
| 34 | void PlayerCapActionHistory::clearLandLimitStandAngle() { |
| 35 | clearLimitHeight(); |
| 36 | _39 = true; |
| 37 | if (rs::isOnGroundLessAngle(mPlayer, mCollision, mConst->getStandAngleMin())) |
| 38 | clearCapJump(); |
| 39 | } |
| 40 | |
| 41 | void PlayerCapActionHistory::clearWallAirLimit() { |
| 42 | clearLimitHeight(); |
| 43 | _39 = true; |
| 44 | } |
| 45 | |
| 46 | void PlayerCapActionHistory::recordLimitHeight() { |
| 47 | if (rs::isCollidedGround(mCollision)) |
| 48 | return; |
| 49 | mIsLimitHeight = true; |
| 50 | mHeightLimit = al::getTrans(actor: mPlayer); |
| 51 | } |
| 52 | |
| 53 | bool PlayerCapActionHistory::isOverLimitHeight() const { |
| 54 | if (!mIsLimitHeight || rs::isCollidedGround(mCollision)) |
| 55 | return false; |
| 56 | |
| 57 | return (al::getTrans(actor: mPlayer) - mHeightLimit).dot(t: al::getGravity(actor: mPlayer)) < 0.0f; |
| 58 | } |
| 59 | |