From edf2fdb12880b2b96beb3a753da4c1ad44b0bbf4 Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Mon, 20 May 2019 20:52:40 +0200 Subject: CRYOMNI3D: Add hook to video playing That will be used for countdown --- engines/cryomni3d/cryomni3d.cpp | 13 ++++++++++--- engines/cryomni3d/cryomni3d.h | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'engines/cryomni3d') diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp index 473fc7cce6..bd27ea715f 100644 --- a/engines/cryomni3d/cryomni3d.cpp +++ b/engines/cryomni3d/cryomni3d.cpp @@ -114,7 +114,8 @@ Common::String CryOmni3DEngine::prepareFileName(const Common::String &baseName, return baseName; } -void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::SoundType soundType) { +void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::SoundType soundType, + HNMCallback beforeDraw, HNMCallback afterDraw) { const char *const extensions[] = { "hns", "hnm", nullptr }; Common::String fname(prepareFileName(filename, extensions)); @@ -137,6 +138,7 @@ void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::Soun uint16 height = videoDecoder->getHeight(); bool skipVideo = false; + unsigned int frameNum = 0; while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); @@ -147,10 +149,15 @@ void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::Soun setPalette(palette, 0, 256); } - // TODO: beforeDraw + if (beforeDraw) { + (this->*beforeDraw)(frameNum); + } g_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, width, height); - // TODO: afterDraw + if (afterDraw) { + (this->*afterDraw)(frameNum); + } + frameNum++; } } g_system->updateScreen(); diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h index c06df5b69f..17e9cd39e3 100644 --- a/engines/cryomni3d/cryomni3d.h +++ b/engines/cryomni3d/cryomni3d.h @@ -108,8 +108,10 @@ public: void fillSurface(byte color); void setCursor(const Graphics::Cursor &cursor) const; void setCursor(unsigned int cursorId) const; + typedef void (CryOmni3DEngine::*HNMCallback)(unsigned int frameNum); void playHNM(const Common::String &filename, - Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType, + HNMCallback beforeDraw = nullptr, HNMCallback afterDraw = nullptr); void displayHLZ(const Common::String &filename); bool pollEvents(); -- cgit v1.2.3