From 3bc3b59378255fabd1feff51714e45708c0b9d38 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 1 Feb 2021 16:16:04 -0800 Subject: [PATCH] Re-fix glitchy y-position when spawning onto a conveyor This is a re-do of 942217f871bf1182ded3a915b8c26b90c04d561a (#509), but with a more conservative fix that only resets the player's newxp and newyp when they respawn from a checkpoint or spawn in to the map. Unlike the previous patch, if the player were to suddenly collide with a conveyor or horizontally-moving platform during gameplay, their y-position would revert back to the intended next y-position of the previous frame. But this is the same behavior as before, I haven't ever seen such a contrived situation come up, and this behavior is probably more preferable for gameplay than actually going to the conveyor, so it's fine. I also decided to reset newxp here, and not just newyp, because while resetting newyp seems to be enough, it's safer to also reset newxp (and so future readers won't question why only newyp is reset but not newxp). I tested this and it once again fixes the death loop issue from earlier, while also still allowing for that Trench Warfare trick to be possible (I tested it with the libTAS movie I mentioned in #606; it syncs fine). There are no other known regressions resulting from this fix (hopefully). --- desktop_version/src/Map.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index c7bcdd10..55d58e0e 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -775,6 +775,11 @@ void mapclass::resetplayer(const bool player_died) obj.entities[i].ay = 0; obj.entities[i].xp = game.savex; obj.entities[i].yp = game.savey; + + //Fix conveyor death loop glitch + obj.entities[i].newxp = obj.entities[i].xp; + obj.entities[i].newyp = obj.entities[i].yp; + obj.entities[i].dir = game.savedir; obj.entities[i].colour = 0; if (player_died)