From 7e8ec89a68d2fc6608b067d8fac19c461a4d4103 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 14 Aug 2021 08:35:43 +1000 Subject: [PATCH] - Blood: Add interpolation repair for `kQAVSTAFDOWN` (res_id: 119). --- source/games/blood/src/qav.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 2993943d2..fb1dec22c 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -1354,6 +1354,16 @@ static void qavRepairTileData(QAV* pQAV) pQAV->frames[32].tiles[1].picnum = 3317; pQAV->frames[32].tiles[1].angle = 128; break; + case kQAVSTAFDOWN: + // STAFDOWN interpolates fine, but the starting frame in bringing the can down is lower than the can while idle. + // Do linear interpolation from 2nd last frame through to first frame, ending with coordinates of STAFIDLE. + lastframe = pQAV->nFrames - 1; + for (i = lastframe, j = 0; i >= 0; i--, j++) + { + pQAV->frames[j].tiles[0].x = xs_CRoundToInt(pQAV->frames[lastframe].tiles[0].x - (double(pQAV->frames[lastframe].tiles[0].x - -90) / lastframe) * i); + pQAV->frames[j].tiles[0].y = xs_CRoundToInt(pQAV->frames[lastframe].tiles[0].y - (double(pQAV->frames[lastframe].tiles[0].y - -50) / lastframe) * i); + } + break; default: return; }