diff --git a/source/games/blood/src/d_menu.cpp b/source/games/blood/src/d_menu.cpp index b747adeaf..bb553e68b 100644 --- a/source/games/blood/src/d_menu.cpp +++ b/source/games/blood/src/d_menu.cpp @@ -46,16 +46,16 @@ public: int lastTick; bool bWideScreen; bool bClearBackground; - const char* filename; - CGameMenuItemQAV(int, int, const char*, bool widescreen = false, bool clearbackground = false); + bool bLooped; + CGameMenuItemQAV(int, int, const char*, bool widescreen = false, bool clearbackground = false, bool looped = false); void Draw(void); }; -CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widescreen, bool clearbackground) +CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widescreen, bool clearbackground, bool looped) { bWideScreen = widescreen; bClearBackground = clearbackground; - filename = name; + bLooped = looped; if (name) { @@ -96,13 +96,13 @@ void CGameMenuItemQAV::Draw(void) int backX = data->x; for (int i = 0; i < nCount; i++) { - data->Draw(currentDuration, 10 + kQavOrientationLeft, 0, 0, false, smoothratio, filename == "BDRIP.QAV"); + data->Draw(currentDuration, 10 + kQavOrientationLeft, 0, 0, false, smoothratio, bLooped); data->x += 320; } data->x = backX; } else - data->Draw(currentDuration, 10, 0, 0, false, smoothratio, filename == "BDRIP.QAV"); + data->Draw(currentDuration, 10, 0, 0, false, smoothratio, bLooped); } } @@ -137,7 +137,7 @@ void UpdateNetworkMenus(void) void GameInterface::MenuOpened() { - itemBloodQAV.reset(new CGameMenuItemQAV(160, 100, "BDRIP.QAV", true)); + itemBloodQAV.reset(new CGameMenuItemQAV(160, 100, "BDRIP.QAV", true, false, true)); } void GameInterface::MenuClosed() diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 87efb285e..151f46a91 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -6200,13 +6200,13 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, d if (!(pSprite->flags & kModernTypeFlag1)) { pQAV->x = int(a3); pQAV->y = int(a4); - pQAV->Draw(a3, a4, v4, flags, a2, a5, true, smoothratio); + pQAV->Draw(a3, a4, v4, flags, a2, a5, true, smoothratio, pPlayer->qavLoop); // draw fullscreen (currently 4:3 only) } 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. // From the above commit it seems to be incomplete anyway... - pQAV->Draw(v4, flags, a2, a5, false, smoothratio); + pQAV->Draw(v4, flags, a2, a5, false, smoothratio, pPlayer->qavLoop); } } diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index ef985fc9e..084848be4 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -72,7 +72,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 menudrip) +void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio, bool const looped) { assert(ticksPerFrame > 0); @@ -89,7 +89,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b lastframetic = 0; } - int oFrame = nFrame == 0 || (lastframetic && ticks > lastframetic) ? nFrame : nFrame - 1; + int oFrame = nFrame == 0 || (lastframetic && ticks > lastframetic) ? !looped ? nFrame : nFrames - 1 : nFrame - 1; assert(oFrame >= 0 && oFrame < nFrames); FRAMEINFO *prevFrame = &frames[oFrame]; @@ -126,7 +126,7 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, b if (thisTile->picnum > 0) { // Menu's blood drip requires special treatment. - if (menudrip) + if (res_id == 256) { if (i != 0) { @@ -295,6 +295,7 @@ QAV* getQAV(int res_id) } // Write out additions. + qavdata->res_id = res_id; qavdata->ticrate = 120. / qavdata->ticksPerFrame; qavcache.Insert(res_id, qavdata); diff --git a/source/games/blood/src/qav.h b/source/games/blood/src/qav.h index 805fd3582..e12bce495 100644 --- a/source/games/blood/src/qav.h +++ b/source/games/blood/src/qav.h @@ -75,11 +75,12 @@ struct QAV int y; // 18 int nSprite; // 1c //SPRITE *pSprite; // 1c - char pad3[3]; // 20 + char pad3[1]; // 20 char lastframetic; + 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 menudrip = false); - void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536, bool const menudrip = false) { Draw(x, y, ticks, stat, shade, palnum, to3dview, smoothratio, menudrip); } + 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(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 Play(int, int, int, void *); void Precache(int palette = 0); }; diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 51f690220..731c2849c 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -281,7 +281,7 @@ void WeaponDraw(PLAYER *pPlayer, int shade, double xpos, double ypos, int palnum shade = -128; flags |= 1; } - pQAV->Draw(xpos, ypos, duration, flags, shade, palnum, true, smoothratio); + pQAV->Draw(xpos, ypos, duration, flags, shade, palnum, true, smoothratio, pPlayer->qavLoop); } void WeaponPlay(PLAYER *pPlayer)