diff --git a/changelog.md b/changelog.md index ce08ab3..80ac064 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # v1.1.5 -* Improve input precision again +* Future proof for physics bypass +* Fix buffer clicks for the final time....... # v1.1.4 diff --git a/src/main.cpp b/src/main.cpp index ecb5fbc..e811234 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -402,29 +402,42 @@ class $modify(PlayerObject) { if (this == pl->m_player2) return; - step step = updateDeltaFactorAndInput(); + + bool p1StartedOnGround = this->m_isOnGround; // this gets set to false if you run PlayerObject::update without doing a collision check, so we need to save its state + bool p2StartedOnGround = pl->m_player2->m_isOnGround; + bool p1IsFlying = (this->m_isDart || this->m_isBird || this->m_isShip || this->m_isSwing); + bool p2IsFlying = (pl->m_player2->m_isDart || pl->m_player2->m_isBird || pl->m_player2->m_isShip || pl->m_player2->m_isSwing); + bool isDual = pl->m_gameState.m_isDualMode; - bool p1OnGround; - bool p2OnGround; + bool firstLoop = true; + + step step = updateDeltaFactorAndInput(); while (true) { const float newTimeFactor = timeFactor * step.deltaFactor; - p1OnGround = this->m_isOnGround; // this gets set to false if you run PlayerObject::update without doing a collision check, so we need to save its state - if (isDual) p2OnGround = pl->m_player2->m_isOnGround; + if (p1StartedOnGround || p1IsFlying) PlayerObject::update(newTimeFactor); + else if (step.endStep) PlayerObject::update(timeFactor); - PlayerObject::update(newTimeFactor); if (isDual) { skipUpdate = true; // re-enable PlayerObject::update() for player 2 - pl->m_player2->update(newTimeFactor); + if (p2StartedOnGround || p2IsFlying) pl->m_player2->update(newTimeFactor); + else if (step.endStep) pl->m_player2->update(timeFactor); skipUpdate = false; } if (step.endStep) break; - this->m_isOnGround = p1OnGround; - if (isDual) pl->m_player2->m_isOnGround = p2OnGround; + if (firstLoop) { + this->m_isOnGround = p1StartedOnGround; + if (isDual) pl->m_player2->m_isOnGround = p2StartedOnGround; + } + else { + this->m_isOnGround = false; + if (isDual) pl->m_player2->m_isOnGround = false; + } + firstLoop = false; step = updateDeltaFactorAndInput(); } }