aboutsummaryrefslogtreecommitdiff
path: root/engines/cryomni3d
diff options
context:
space:
mode:
authorLe Philousophe2019-05-20 20:52:40 +0200
committerEugene Sandulenko2019-06-01 22:43:48 +0200
commitedf2fdb12880b2b96beb3a753da4c1ad44b0bbf4 (patch)
tree6ee3c66463aa3cf2c0c90b8bf8393925aa6b7ebf /engines/cryomni3d
parent1c4d0d87ecde1fdea1cf1473da3665605d956657 (diff)
downloadscummvm-rg350-edf2fdb12880b2b96beb3a753da4c1ad44b0bbf4.tar.gz
scummvm-rg350-edf2fdb12880b2b96beb3a753da4c1ad44b0bbf4.tar.bz2
scummvm-rg350-edf2fdb12880b2b96beb3a753da4c1ad44b0bbf4.zip
CRYOMNI3D: Add hook to video playing
That will be used for countdown
Diffstat (limited to 'engines/cryomni3d')
-rw-r--r--engines/cryomni3d/cryomni3d.cpp13
-rw-r--r--engines/cryomni3d/cryomni3d.h4
2 files changed, 13 insertions, 4 deletions
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();