From 27fe7ff8f987ee3b946a650a51c853d8b681da32 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 29 Apr 2020 23:29:06 -0700 Subject: [PATCH] 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. --- desktop_version/src/Map.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 07474d47..199d22f6 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1909,6 +1909,7 @@ void mapclass::loadlevel(int rx, int ry) } //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++) { 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) { obj.entities[i].dir = 0; + obj.entities[i].drawframe += 3; } } } + if (obj.entities[i].rule == 7) + { + obj.entities[i].drawframe += 6; + } } }