1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

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.
This commit is contained in:
Misa 2020-05-02 11:03:02 -07:00 committed by Ethan Lee
parent 9256b4da56
commit df2d8e881e

View file

@ -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++)