From 3f222d3f742fe344a1084bcf5c3aad0e7e11e7b8 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 30 Aug 2024 11:35:02 -0700 Subject: [PATCH] Glitchless: Fix warp token death warps The warp token death warp glitch is simple. It takes advantage of the fact that, in the main game, warp tokens (barring some exceptions) only change the room but do not change the player's position. So if the player dies while touching a warp token, the room will change but they will stay at the same position of their respawn point, which is used in speedrunning. To fix this, if the player dies, make sure that the warp tokens in the room don't warp them. Otherwise, this would still be possible to do even without pressing R. --- desktop_version/src/Map.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 747ebc38..8670f603 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -854,6 +854,20 @@ void mapclass::resetplayer(const bool player_died) game.scmprogress = game.roomx - 40; } } + + if (game.glitchlessmode) + { + /* Fix warp token death warps: + * Reset the state of all warp tokens to 0. */ + for (size_t i = 0; i < obj.entities.size(); i++) + { + entclass* entity = &obj.entities[i]; + if (entity->type == 11) + { + entity->state = 0; + } + } + } } void mapclass::warpto(int rx, int ry , int t, int tx, int ty)