From 6920ef8fc34009dfb9071fc2c1ae03a9e7c74dde Mon Sep 17 00:00:00 2001 From: NY00123 Date: Tue, 26 May 2020 22:09:31 +0300 Subject: [PATCH] SW - interpso.cpp: Imperfect hack for jittery coolies in level 1's train (with SO interpolation turned on). It would be nicer to have something better structured than the given hack, but this currently seems to work, while not breaking the sprites on the boat in the beginning of level 5. --- source/sw/src/interpso.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/sw/src/interpso.cpp b/source/sw/src/interpso.cpp index 0f47cfe2d..b587de082 100644 --- a/source/sw/src/interpso.cpp +++ b/source/sw/src/interpso.cpp @@ -289,6 +289,22 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++) { + // Hack for jittery coolies in level 1's train. + // Based in idea on code from draw.cpp:analyzesprites. + // TODO: It could be better. In particular, it could be better + // to conditionally disable the interpolation from analyzesprites + // instead, using TSPRITE info if possible. + if (((uintptr_t)(data->curipos) >= (uintptr_t)sprite) && + ((uintptr_t)(data->curipos) < (uintptr_t)(sprite + Numsprites))) + { + int32_t sprnum = ((char *)data->curipos - (char *)sprite) / sizeof(*sprite); + USERp u = User[sprnum]; + if (u && (sprite[sprnum].statnum != STAT_DEFAULT) && + ((TEST(u->Flags, SPR_SKIP4) && (sprite[sprnum].statnum <= STAT_SKIP4_INTERP_END)) || + (TEST(u->Flags, SPR_SKIP2) && (sprite[sprnum].statnum <= STAT_SKIP2_INTERP_END)))) + continue; + } + if (data->spriteofang >= 0) *(int16_t *)(data->curipos) = NORM_ANGLE(data->lastoldipos + mulscale16(data->lastangdiff, ratio)); else