1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Fix 1-frame flicker entering room with warp lines and entity on edge

Custom levels can have warp lines. If you have a warp line and a warping
background in the same room, the warp line takes precedence over the
warp background.

However, whenever you enter a room with a warp line and warp background,
any entities on the warping edges will be drawn with screenwrapping for
one frame, even though they never wrapped at all.

This is due to frame ordering: when the warp line gets created,
obj.customwarpmode gets set to true. Then when the screen edges and
warping logic gets ran, the very first thing that gets checked is this
exact variable, and map.warpx/map.warpy get set appropriately - so
there's no way the entity could legitimately screenwrap.

However, that happens in gamelogic(). gamelogic() is also the one
responsible for creating entities upon room load, but that happens after
the obj.customwarpmode check - so when the game gets around to rendering
in gamerender(), it sees that map.warpx or map.warpy is on, and draws
the screenwrapping, even though map.warpx/map.warpy aren't really on at
all. Only when gamelogic() is called in the frame later do map.warpx and
map.warpy finally get set to false.

To fix this, just set map.warpx and map.warpy to false when creating
warp lines.
This commit is contained in:
Misa 2021-03-25 19:00:31 -07:00 committed by Ethan Lee
parent 8fd7210d37
commit 6a6c09f69d

View File

@ -1983,6 +1983,8 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo
if (map.custommode)
{
customwarpmode = true;
map.warpx = false;
map.warpy = false;
}
break;
case 55: // Crew Member (custom, collectable)