From eaf9eec3dc1d902c06db9434d6ca28dd4994fd94 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 4 May 2020 11:13:41 -0700 Subject: [PATCH] Fix animating entities' drawframes not being updated for 1 frame What happens here is that the entity gets created and then gets immediately updated on the next frame, but there's no time for their walkingframe of 0 to be rendered, so it'll look like they have just started with walkingframe 1. However in the delta-timestep rendering it'll render with walkingframe 0. So we need to fix their drawframe and increment it when creating them. --- desktop_version/src/Entity.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 06d6ba96..9c47e408 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -2012,6 +2012,32 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo { entity.updatecolour(); } + if (entity.type == 1) + { + switch (entity.animate) + { + case 0: // Simple Loop + case 1: // Simple Loop + case 2: // Simpler Loop (just two frames) + case 3: // Simpler Loop (just two frames, but double sized) + case 4: // Simpler Loop (just two frames, but double sized) (as above, but slower) + case 5: // Simpler Loop (just two frames) (slower) + case 6: // Normal Loop (four frames, double sized) + case 7: // Simpler Loop (just two frames) (slower) (with directions!) + case 11: // Conveyor right + entity.drawframe++; + break; + case 10: // Conveyor left + entity.drawframe += 3; + break; + default: + break; + } + } + else if (entity.type == 2 && entity.animate == 2) + { + entity.drawframe++; + } entities.push_back(entity); }