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

Fix crewmates facing wrong way or not being flipped for <1 frame

By "frame" here I'm referring to the fixed-timestep, not a visual
delta-timestep.

Anyway, the problem is because crewmates' drawframes wait for
entityclass::animateentities() to be called in gamelogic(). In the
old, 30-FPS-only system, this entityclass::animateentities() would be
called in gamerender(), before any actual rendering would take place.
However, I've had to move it out of gamerender() because otherwise
entities would animate too fast. As a result, since gamerender() could
be called in between the entity creation and gamelogic(), a
less-than-1-frame visual glitch could happen.

The solution is to set the entity's drawframe as well when fixing facing
the player in Map.cpp.
This commit is contained in:
Misa 2020-04-29 23:29:06 -07:00 committed by Ethan Lee
parent b4142976f2
commit 27fe7ff8f9

View file

@ -1909,6 +1909,7 @@ void mapclass::loadlevel(int rx, int ry)
} }
//Make sure our crewmates are facing the player if appliciable //Make sure our crewmates are facing the player if appliciable
//Also make sure they're flipped if they're flipped
for (size_t i = 0; i < obj.entities.size(); i++) for (size_t i = 0; i < obj.entities.size(); i++)
{ {
if (obj.entities[i].rule == 6 || obj.entities[i].rule == 7) if (obj.entities[i].rule == 6 || obj.entities[i].rule == 7)
@ -1924,8 +1925,13 @@ void mapclass::loadlevel(int rx, int ry)
else if (j > -1 && obj.entities[j].xp < obj.entities[i].xp - 5) else if (j > -1 && obj.entities[j].xp < obj.entities[i].xp - 5)
{ {
obj.entities[i].dir = 0; obj.entities[i].dir = 0;
obj.entities[i].drawframe += 3;
} }
} }
} }
if (obj.entities[i].rule == 7)
{
obj.entities[i].drawframe += 6;
}
} }
} }