From b01cef7f1529934eb32649a51dae273b5adc076e Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 6 Aug 2021 09:57:01 +1000 Subject: [PATCH] - Blood: Remove `lastframetic` hack from `QAV::Draw()` added in 99508e6f1530fb5da2ec4b21a081a275b4c79242 since we now use proper timing code. --- source/games/blood/src/qav.cpp | 15 ++------------- source/games/blood/src/qav.h | 3 +-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 5d7adf60f..2709deea5 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -76,21 +76,10 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b { assert(ticksPerFrame > 0); - int nFrame = ticks / ticksPerFrame; - assert(nFrame >= 0 && nFrame < nFrames); + auto const nFrame = clamp(ticks / ticksPerFrame, 0, nFrames - 1); FRAMEINFO *thisFrame = &frames[nFrame]; - if ((nFrame == (nFrames - 1)) && !lastframetic) - { - lastframetic = ticks; - } - else if (lastframetic > ticks) - { - lastframetic = 0; - } - - int oFrame = nFrame == 0 || (lastframetic && ticks > lastframetic) ? !looped ? nFrame : nFrames - 1 : nFrame - 1; - assert(oFrame >= 0 && oFrame < nFrames); + auto const oFrame = clamp((nFrame == 0 && looped ? nFrames : nFrame) - 1, 0, nFrames - 1); FRAMEINFO *prevFrame = &frames[oFrame]; auto drawTile = [&](TILE_FRAME *thisTile, TILE_FRAME *prevTile, bool const interpolate = true) diff --git a/source/games/blood/src/qav.h b/source/games/blood/src/qav.h index 0571056d6..71f987524 100644 --- a/source/games/blood/src/qav.h +++ b/source/games/blood/src/qav.h @@ -75,8 +75,7 @@ struct QAV int y; // 18 int nSprite; // 1c //SPRITE *pSprite; // 1c - char pad3[1]; // 20 - char lastframetic; + char pad3[2]; // 20 unsigned short res_id; FRAMEINFO frames[1]; // 24 void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536, bool const looped = false);