From 4a6a999f89f418d1a7e276b2905a74f98d84deb8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 7 Apr 2021 15:03:00 +0200 Subject: [PATCH] - SW: fixed interpolation for sector object sprites. When checking for an existing interpolation it needs to check the actual sprite, not just the interpolation type. --- source/games/sw/src/interpso.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index cb5ef9e1c..bcb2c9612 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -108,8 +108,10 @@ static void so_setpointinterpolation(so_interp *interp, int element) return; for (i = 0; i < interp->numinterpolations; i++) + { if (interp->data[i].curelement == element) return; + } so_interp::interp_data *data = &interp->data[interp->numinterpolations++]; @@ -127,7 +129,7 @@ static void so_setspriteanginterpolation(so_interp *interp, int32_t spritenum) return; for (i = 0; i < interp->numinterpolations; i++) - if (interp->data[i].curelement == -1) + if (interp->data[i].curelement == -1 && interp->data[i].spriteofang == spritenum) return; so_interp::interp_data *data = &interp->data[interp->numinterpolations++]; @@ -146,9 +148,16 @@ static void so_stopdatainterpolation(so_interp *interp, int element) int32_t i; for (i = 0; i < interp->numinterpolations; i++) - if (interp->data[i].curelement == element) + { + if (interp->data[i].curelement == -1) + { + if (interp->data[i].spriteofang == element) break; + } + else if (interp->data[i].curelement == element) break; + } + if (i == interp->numinterpolations) return; @@ -217,7 +226,7 @@ void so_setspriteinterpolation(SECTOR_OBJECTp sop, spritetype *sp) so_setpointinterpolation(interp, snum | soi_spry); if (!interp->hasvator) so_setpointinterpolation(interp, snum | soi_sprz); - so_setspriteanginterpolation(interp, int(sp - sprite)); + so_setspriteanginterpolation(interp, snum); } void so_stopspriteinterpolation(SECTOR_OBJECTp sop, spritetype *sp)