From 01d256b4081afc8780314c02e33f5e94d01fa987 Mon Sep 17 00:00:00 2001 From: Misa <infoteddy@infoteddy.info> Date: Fri, 30 Aug 2024 11:47:41 -0700 Subject: [PATCH] Glitchless: Fix line clipping The reason that line clipping works is because when the gravity line unflips the player, they are still eligible to flip (with onground/onroof) so by doing it frame-perfectly they can flip again. To fix this, just zero out their onground/onroof. This glitch mainly applies to horizontal gravity lines but it is also possible, but less severe (in most cases), with vertical gravity lines, so this fixes it for vertical lines too. --- desktop_version/src/Entity.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index f82dcc14..846d9aa3 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -2783,6 +2783,14 @@ bool entityclass::updateentities( int i ) { if (INBOUNDS_VEC(temp, entities) && entities[temp].vy > -3) entities[temp].vy = -3; } + + if (game.glitchlessmode && INBOUNDS_VEC(temp, entities)) + { + /* Fix line clipping: Invalidate flipping eligibility so + * a second flip is impossible. */ + entities[temp].onground = 0; + entities[temp].onroof = 0; + } } else if (entities[i].state == 2) { @@ -4876,6 +4884,14 @@ void entityclass::collisioncheck(int i, int j, bool scm /*= false*/) entities[j].state = entities[j].onentity; entities[j].life = 6; + + if (game.glitchlessmode) + { + /* Fix line clipping: Invalidate flipping eligibility so + * a second flip is impossible. */ + entities[i].onground = 0; + entities[i].onroof = 0; + } break; } case 5: //Person vs vertical gravity/warp line!