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

Set newxp/newyp when creating player

This fixes a bug where the player's y-position would be incorrect if
they loaded a save that was on a conveyor and it was their first time
loading in since the game was opened.

This is because on the first load, the game creates a new player entity,
but on subsequent loads, the game re-uses the player entity. Subsequent
loads use mapclass::resetplayer(), which already has the newxp/newyp
fix, but as for the first time, the game does not set newxp/newyp.

So just set newxp/newyp, like in mapclass::resetplayer().
This commit is contained in:
Misa 2021-05-23 21:57:59 -07:00 committed by Ethan Lee
parent 73c1c9a798
commit 417b7d656d

View file

@ -1273,6 +1273,10 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
entity.h = 21;
entity.dir = 1;
/* Fix wrong y-position if spawning in on conveyor */
entity.newxp = xp;
entity.newyp = yp;
if (meta1 == 1) entity.invis = true;
entity.gravity = true;