| 1 | #include "Player/PlayerJudgePreInputJump.h" |
|---|---|
| 2 | |
| 3 | #include <math/seadMathCalcCommon.h> |
| 4 | |
| 5 | #include "Player/PlayerConst.h" |
| 6 | #include "Player/PlayerInput.h" |
| 7 | #include "Util/JudgeUtil.h" |
| 8 | |
| 9 | PlayerJudgePreInputJump::PlayerJudgePreInputJump(const PlayerConst* pConst, |
| 10 | const PlayerInput* input, |
| 11 | IJudge* judgeForceSlopeSlide) |
| 12 | : mConst(pConst), mInput(input), mJudgeForceSlopeSlide(judgeForceSlopeSlide) {} |
| 13 | |
| 14 | void PlayerJudgePreInputJump::reset() { |
| 15 | mRemainJumpFrame = 0; |
| 16 | } |
| 17 | |
| 18 | void PlayerJudgePreInputJump::update() { |
| 19 | mRemainJumpFrame = sead::Mathi::clampMin(val: mRemainJumpFrame - 1, min_: 0); |
| 20 | |
| 21 | if (mInput->isTriggerJump()) |
| 22 | mRemainJumpFrame = mConst->getContinuousJumpPreInputFrame(); |
| 23 | } |
| 24 | |
| 25 | bool PlayerJudgePreInputJump::judge() const { |
| 26 | if (rs::updateJudgeAndResult(judge: mJudgeForceSlopeSlide)) |
| 27 | return false; |
| 28 | if (mInput->isTriggerJump()) |
| 29 | return true; |
| 30 | return mRemainJumpFrame > 0; |
| 31 | } |
| 32 |