From 5e2fc6f0fe380ea1d7893cc51c2c76f32f411e3e Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 7 Nov 2020 17:00:42 -0800 Subject: [PATCH] Move updating lerpoldxp/yp to start of gamelogic() The previous location of this loop was placed there because it happened just after the end of the render function. Now that the loop order is fixed, the first thing that happens after the render function is the start of gamelogic(), so this loop should go there now, else entity positions won't be interpolated. Also it now preincrements instead of postincrements because I like preincrements. --- desktop_version/src/Logic.cpp | 7 +++++++ desktop_version/src/main.cpp | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/desktop_version/src/Logic.cpp b/desktop_version/src/Logic.cpp index 71c5ac33..5f708556 100644 --- a/desktop_version/src/Logic.cpp +++ b/desktop_version/src/Logic.cpp @@ -122,6 +122,13 @@ void gamecompletelogic2(void) void gamelogic(void) { + /* Update old lerp positions of entities */ + {size_t i; for (i = 0; i < obj.entities.size(); ++i) + { + obj.entities[i].lerpoldxp = obj.entities[i].xp; + obj.entities[i].lerpoldyp = obj.entities[i].yp; + }} + //Misc if (map.towermode) { diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index feb87073..112ebc29 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -91,16 +91,6 @@ static void runscript(void) script.run(); } -static void gamemodefunc1(void) -{ - //Update old lerp positions of entities - has to be done BEFORE gameinput! - for (size_t i = 0; i < obj.entities.size(); i++) - { - obj.entities[i].lerpoldxp = obj.entities[i].xp; - obj.entities[i].lerpoldyp = obj.entities[i].yp; - } -} - static void teleportermodeinput(void) { if (game.useteleporter) @@ -147,7 +137,6 @@ static const inline struct ImplFunc* get_gamestate_funcs( FUNC_LIST_BEGIN(GAMEMODE) {Func_fixed, runscript}, - {Func_fixed, gamemodefunc1}, {Func_fixed, gameinput}, {Func_fixed, gamerenderfixed}, {Func_delta, gamerender},