- Blood: Revert "- Blood: Ensure looped QAVs interpolate using last frame in the array."

This commit is contained in:
Mitchell Richters 2021-08-23 09:32:00 +10:00
parent 916241dcdb
commit 5bfdd74844
5 changed files with 12 additions and 14 deletions

View file

@ -46,16 +46,14 @@ public:
int lastTick; int lastTick;
bool bWideScreen; bool bWideScreen;
bool bClearBackground; bool bClearBackground;
bool bLooped; CGameMenuItemQAV(int, int, const char*, bool widescreen = false, bool clearbackground = false);
CGameMenuItemQAV(int, int, const char*, bool widescreen = false, bool clearbackground = false, bool looped = false);
void Draw(void); void Draw(void);
}; };
CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widescreen, bool clearbackground, bool looped) CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widescreen, bool clearbackground)
{ {
bWideScreen = widescreen; bWideScreen = widescreen;
bClearBackground = clearbackground; bClearBackground = clearbackground;
bLooped = looped;
if (name) if (name)
{ {
@ -96,13 +94,13 @@ void CGameMenuItemQAV::Draw(void)
int backX = data->x; int backX = data->x;
for (int i = 0; i < nCount; i++) for (int i = 0; i < nCount; i++)
{ {
data->Draw(currentDuration, 10 + kQavOrientationLeft, 0, 0, false, smoothratio, bLooped); data->Draw(currentDuration, 10 + kQavOrientationLeft, 0, 0, false, smoothratio);
data->x += 320; data->x += 320;
} }
data->x = backX; data->x = backX;
} }
else else
data->Draw(currentDuration, 10, 0, 0, false, smoothratio, bLooped); data->Draw(currentDuration, 10, 0, 0, false, smoothratio);
} }
} }
@ -137,7 +135,7 @@ void UpdateNetworkMenus(void)
void GameInterface::MenuOpened() void GameInterface::MenuOpened()
{ {
itemBloodQAV.reset(new CGameMenuItemQAV(160, 100, "BDRIP.QAV", true, false, true)); itemBloodQAV.reset(new CGameMenuItemQAV(160, 100, "BDRIP.QAV", true));
} }
void GameInterface::MenuClosed() void GameInterface::MenuClosed()

View file

@ -6205,13 +6205,13 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5) {
if (!(pSprite->flags & kModernTypeFlag1)) { if (!(pSprite->flags & kModernTypeFlag1)) {
pQAV->x = int(a3); pQAV->y = int(a4); pQAV->x = int(a3); pQAV->y = int(a4);
pQAV->Draw(a3, a4, v4, flags, a2, a5, true, smoothratio, pPlayer->qavLoop); pQAV->Draw(a3, a4, v4, flags, a2, a5, true, smoothratio);
// draw fullscreen (currently 4:3 only) // draw fullscreen (currently 4:3 only)
} else { } else {
// What an awful hack. This throws proper ordering out of the window, but there is no way to reproduce this better with strict layering of elements. // What an awful hack. This throws proper ordering out of the window, but there is no way to reproduce this better with strict layering of elements.
// From the above commit it seems to be incomplete anyway... // From the above commit it seems to be incomplete anyway...
pQAV->Draw(v4, flags, a2, a5, false, smoothratio, pPlayer->qavLoop); pQAV->Draw(v4, flags, a2, a5, false, smoothratio);
} }
} }

View file

@ -139,7 +139,7 @@ void DrawFrame(double x, double y, double z, double a, TILE_FRAME *pTile, int st
} }
} }
void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio, bool const looped) void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio)
{ {
assert(ticksPerFrame > 0); assert(ticksPerFrame > 0);
@ -148,7 +148,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b
auto const nFrame = clamp(ticks / ticksPerFrame, 0, nFrames - 1); auto const nFrame = clamp(ticks / ticksPerFrame, 0, nFrames - 1);
FRAMEINFO* const thisFrame = &frames[nFrame]; FRAMEINFO* const thisFrame = &frames[nFrame];
auto const oFrame = clamp((nFrame == 0 && (looped || interpdata && (interpdata->flags & kQAVIsLoopable)) ? nFrames : nFrame) - 1, 0, nFrames - 1); auto const oFrame = clamp((nFrame == 0 && (interpdata && (interpdata->flags & kQAVIsLoopable)) ? nFrames : nFrame) - 1, 0, nFrames - 1);
FRAMEINFO* const prevFrame = &frames[oFrame]; FRAMEINFO* const prevFrame = &frames[oFrame];
bool const interpolate = interpdata && cl_hudinterpolation && cl_bloodqavinterp && (nFrames > 1) && (nFrame != oFrame) && (smoothratio != MaxSmoothRatio); bool const interpolate = interpdata && cl_hudinterpolation && cl_bloodqavinterp && (nFrames > 1) && (nFrame != oFrame) && (smoothratio != MaxSmoothRatio);

View file

@ -232,8 +232,8 @@ struct QAV
char pad3[2]; // 20 char pad3[2]; // 20
unsigned short res_id; unsigned short res_id;
FRAMEINFO frames[1]; // 24 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); void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536);
void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536, bool const looped = false) { Draw(x, y, ticks, stat, shade, palnum, to3dview, smoothratio, looped); } void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536) { Draw(x, y, ticks, stat, shade, palnum, to3dview, smoothratio); }
void Play(int, int, int, void *); void Play(int, int, int, void *);
void Precache(int palette = 0); void Precache(int palette = 0);
}; };

View file

@ -264,7 +264,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum
shade = -128; shade = -128;
flags |= 1; flags |= 1;
} }
pQAV->Draw(xpos, ypos, duration, flags, shade, palnum, true, smoothratio, pPlayer->qavLoop); pQAV->Draw(xpos, ypos, duration, flags, shade, palnum, true, smoothratio);
} }
void WeaponPlay(PLAYER *pPlayer) void WeaponPlay(PLAYER *pPlayer)