diff --git a/source/core/binaryangle.h b/source/core/binaryangle.h index 545b940ab..4b033c31a 100644 --- a/source/core/binaryangle.h +++ b/source/core/binaryangle.h @@ -387,11 +387,6 @@ inline constexpr int32_t interpolatedangle(int32_t oang, int32_t ang, int const return oang + MulScale(((ang + 1024 - oang) & 2047) - 1024, smoothratio, scale); } -inline double interpolatedanglef(double oang, double ang, double const smoothratio, int const scale = 16) -{ - return oang + MulScaleF(fmod((ang + 1024. - oang), 2048.) - 1024., smoothratio, scale); -} - inline constexpr binangle interpolatedangle(binangle oang, binangle ang, double const smoothratio, int const scale = 16) { return bamang(oang.asbam() + MulScale(((ang.asbam() + 0x80000000 - oang.asbam()) & 0xFFFFFFFF) - 0x80000000, int(smoothratio), scale)); diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 8d2bf7e63..55d013cbf 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -96,21 +96,32 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b for (int i = 0; i < 8; i++) { auto* thisTile = &thisFrame->tiles[i]; - auto* prevTile = &prevFrame->tiles[i]; if (thisTile->picnum > 0) { + TILE_FRAME *prevTile = nullptr; + + if (thisTile->picnum == prevFrame->tiles[i].picnum) + { + prevTile = &prevFrame->tiles[i]; + } + else for (int j = 0; j < 8; j++) if (thisTile->picnum == prevFrame->tiles[j].picnum) + { + prevTile = &prevFrame->tiles[j]; + break; + } + double tileX = x; double tileY = y; double tileZ; double tileA; - if ((nFrames > 1) && (nFrame != oFrame) && (thisTile->picnum == prevTile->picnum) && (smoothratio != MaxSmoothRatio)) + if ((nFrames > 1) && (nFrame != oFrame) && (prevTile && (thisTile->picnum == prevTile->picnum)) && (smoothratio != MaxSmoothRatio)) { tileX += interpolatedvaluef(prevTile->x, thisTile->x, smoothratio); tileY += interpolatedvaluef(prevTile->y, thisTile->y, smoothratio); tileZ = interpolatedvaluef(prevTile->z, thisTile->z, smoothratio); - tileA = interpolatedanglef(prevTile->angle, thisTile->angle, smoothratio); + tileA = interpolatedangle(buildang(prevTile->angle), buildang(thisTile->angle), smoothratio).asbuildf(); } else {