From df2d8e881ec54b9099d3e1cc2238f98bc7b310ee Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 2 May 2020 11:03:02 -0700 Subject: [PATCH] Make player not suddenly stop when screen transitioning This was especially noticeable in slowmode, where after going to an adjacent room, it would look like they stopped for a split second. This commit makes it so they smoothly continue their journey after switching rooms. The integer cast is to round off any fractional part of the velocity so that they don't make a difference and result in the oldxp/oldyp being one pixel off. Especially since the player's y-velocity fluctuates while standing unflipped on the floor. Incidentally enough, this seems to only have been a problem with screen transitions for some reason. No other uses of gotoroom() (such as the one where gotoroom() is called every other frame, or every frame) seem to have resulted in this "pausing" behavior, or at least a reversion back to 30 FPS movement. I don't know why. --- desktop_version/src/Map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index d026ea05..2c393b6f 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1040,8 +1040,8 @@ void mapclass::gotoroom(int rx, int ry) temp = obj.getplayer(); if(temp>-1) { - obj.entities[temp].oldxp = obj.entities[temp].xp; - obj.entities[temp].oldyp = obj.entities[temp].yp; + obj.entities[temp].oldxp = obj.entities[temp].xp - int(obj.entities[temp].vx); + obj.entities[temp].oldyp = obj.entities[temp].yp - int(obj.entities[temp].vy); } for (size_t i = 0; i < obj.entities.size(); i++)