From f93ce4ea4aab3a0b7879be86c8a31e552e437d33 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 12 Nov 2020 13:57:11 -0800 Subject: [PATCH] Fix Prize for the Reckless moving platform losing its block when... ...you die and the platform's x-coordinate is to the left of x=152. Which means if you die and the platform isn't completely clear of the space of its adjacent disappearing platform. The block needs to be updated accordingly with calls to obj.nocollisionat() and obj.moveblockto(), else the block will simply be left behind and the platform will no longer have any collision. This is in contrast to 2.2 behavior, where the platform would simply unconditionally create a new block, which would actually end up with a duplicate block since the previous block didn't get cleaned up, but this didn't cause any problems because the room was carefully designed so you would never be able to touch that previous block after you died and respawned at the checkpoint. But it's still there. I also added comments to document what this kludge code did, because otherwise it would be mysterious to readers who are unfamiliar with it. Fixes #543. --- desktop_version/src/Logic.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 7ca26a37..a82f90e3 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -465,8 +465,17 @@ void gamelogic() { if (obj.entities[i].xp < 152) { + //Move the platform to the right side of the disappearing platform, + //otherwise it will get stuck on the kludge 18,9 tile we placed + //(and if the tile wasn't there it would pass straight through again) + int prevx = obj.entities[i].xp; + int prevy = obj.entities[i].yp; + obj.nocollisionat(prevx, prevy); + obj.entities[i].xp = 152; obj.entities[i].newxp = 152; + + obj.moveblockto(prevx, prevy, obj.entities[i].xp, obj.entities[i].yp, obj.entities[i].w, obj.entities[i].h); } } }