From 67d350de05850067e7bc976a9a370dcff28df62b Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 5 Aug 2022 07:38:35 -0700 Subject: [PATCH] Only process `tapleft`/`tapright` if `has_control` This fixes a regression where the game ignored the amount of frames you held down a direction if you released the direction during death. Previously, the game only checked the amount of frames you held down a direction if you were able to control the player. If you weren't able to control the player (e.g. during the death animation), then the number of frames it counted didn't change. This also meant that if you were holding a direction before you died, but released it during death, the game wouldn't zero out the number of frames you held it. This behavior was useful because it meant you could keep the deceleration momentum that you normally get by holding a direction for 5 frames just by holding a direction for less than 5 frames after dying, if you had the rest of the hold frames before you died. This behavior is what's used in https://tasvideos.org/7575S at around frame 7200. Unfortunately, #609 made it so that the direction hold processing happened even if the player didn't have control, meaning that it would zero the hold frames during the death animation in the TAS, thus desyncing it when it performed the maneuver it relied on the extra momentum for after Viridian respawns. The solution here is to just add the check back in again. Fixes #887. --- desktop_version/src/Input.cpp | 86 +++++++++++++++++------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 602abdc7..b1842ccd 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -2240,51 +2240,51 @@ void gameinput(void) } } - if (game.press_left) - { - game.tapleft++; - } - else - { - if (game.tapleft <= 4 && game.tapleft > 0) - { - for (size_t ie = 0; ie < obj.entities.size(); ++ie) - { - if (obj.entities[ie].rule == 0) - { - if (obj.entities[ie].vx < 0.0f) - { - obj.entities[ie].vx = 0.0f; - } - } - } - } - game.tapleft = 0; - } - if (game.press_right) - { - game.tapright++; - } - else - { - if (game.tapright <= 4 && game.tapright > 0) - { - for (size_t ie = 0; ie < obj.entities.size(); ++ie) - { - if (obj.entities[ie].rule == 0) - { - if (obj.entities[ie].vx > 0.0f) - { - obj.entities[ie].vx = 0.0f; - } - } - } - } - game.tapright = 0; - } - if (has_control) { + if (game.press_left) + { + game.tapleft++; + } + else + { + if (game.tapleft <= 4 && game.tapleft > 0) + { + for (size_t ie = 0; ie < obj.entities.size(); ++ie) + { + if (obj.entities[ie].rule == 0) + { + if (obj.entities[ie].vx < 0.0f) + { + obj.entities[ie].vx = 0.0f; + } + } + } + } + game.tapleft = 0; + } + if (game.press_right) + { + game.tapright++; + } + else + { + if (game.tapright <= 4 && game.tapright > 0) + { + for (size_t ie = 0; ie < obj.entities.size(); ++ie) + { + if (obj.entities[ie].rule == 0) + { + if (obj.entities[ie].vx > 0.0f) + { + obj.entities[ie].vx = 0.0f; + } + } + } + } + game.tapright = 0; + } + if (!game.press_action) { game.jumppressed = 0;