[Scummvm-git-logs] scummvm master -> 2591106d38160f1e8cabf9febccc4172b0e0e1ce
bluegr
noreply at scummvm.org
Tue Dec 28 16:58:04 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2591106d38 BURIED: Pass the currently playing video to yield()
Commit: 2591106d38160f1e8cabf9febccc4172b0e0e1ce
https://github.com/scummvm/scummvm/commit/2591106d38160f1e8cabf9febccc4172b0e0e1ce
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-28T18:57:40+02:00
Commit Message:
BURIED: Pass the currently playing video to yield()
This allows sending the event to the specific video, not to all the
currently playing videos. Also, this allows to distinguish video from
audio loops and only process video skipping events when playing videos
Changed paths:
engines/buried/biochip_right.cpp
engines/buried/buried.cpp
engines/buried/buried.h
engines/buried/demo/demo_menu.cpp
engines/buried/environ/agent3_lair.cpp
engines/buried/environ/ai_lab.cpp
engines/buried/environ/scene_common.cpp
engines/buried/frame_window.cpp
engines/buried/gameui.cpp
engines/buried/inventory_info.cpp
engines/buried/main_menu.cpp
engines/buried/scene_view.cpp
engines/buried/sound.cpp
diff --git a/engines/buried/biochip_right.cpp b/engines/buried/biochip_right.cpp
index 0790c160673..a3fcf75e91a 100644
--- a/engines/buried/biochip_right.cpp
+++ b/engines/buried/biochip_right.cpp
@@ -260,7 +260,7 @@ void BioChipRightWindow::onLButtonUp(const Common::Point &point, uint flags) {
video->playToFrame(23);
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(video);
_vm->_sound->timerCallback();
}
@@ -297,7 +297,7 @@ void BioChipRightWindow::onLButtonUp(const Common::Point &point, uint flags) {
video->playToFrame(47);
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(video);
_vm->_sound->timerCallback();
}
diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp
index 0464301b4d6..06432fdafae 100644
--- a/engines/buried/buried.cpp
+++ b/engines/buried/buried.cpp
@@ -314,7 +314,9 @@ void BuriedEngine::postMessageToWindow(Window *dest, Message *message) {
_messageQueue.push_back(msg);
}
-void BuriedEngine::processVideoSkipMessages() {
+void BuriedEngine::processVideoSkipMessages(VideoWindow *video) {
+ assert(video);
+
for (MessageQueue::iterator it = _messageQueue.begin(); it != _messageQueue.end();) {
MessageType messageType = it->message->getMessageType();
@@ -323,9 +325,7 @@ void BuriedEngine::processVideoSkipMessages() {
// Send any skip video keyup events to the video player
if (keyState.keycode == Common::KEYCODE_ESCAPE) {
- for (VideoList::iterator it2 = _videos.begin(); it2 != _videos.end(); ++it2) {
- (*it2)->onKeyUp(keyState, ((KeyUpMessage *)it->message)->getFlags());
- }
+ video->onKeyUp(keyState, ((KeyUpMessage *)it->message)->getFlags());
delete it->message;
it = _messageQueue.erase(it);
}
@@ -420,7 +420,7 @@ bool BuriedEngine::hasMessage(Window *window, int messageBegin, int messageEnd)
return false;
}
-void BuriedEngine::yield() {
+void BuriedEngine::yield(VideoWindow *video) {
// A cut down version of the Win16 yield function. Win32 handles this
// asynchronously, which we don't want. Only needed for internal event loops.
@@ -433,8 +433,8 @@ void BuriedEngine::yield() {
// We only send video skipping messages from here. Otherwise, this is the same
// as our main loop.
- if (_allowVideoSkip)
- processVideoSkipMessages();
+ if (video && _allowVideoSkip)
+ processVideoSkipMessages(video);
_gfx->updateScreen();
_system->delayMillis(10);
diff --git a/engines/buried/buried.h b/engines/buried/buried.h
index 616dd553977..f1d66f76a5b 100644
--- a/engines/buried/buried.h
+++ b/engines/buried/buried.h
@@ -124,7 +124,7 @@ public:
// Messaging
void postMessageToWindow(Window *dest, Message *message);
void sendAllMessages();
- void processVideoSkipMessages();
+ void processVideoSkipMessages(VideoWindow *video);
void removeKeyboardMessages(Window *window);
void removeMouseMessages(Window *window);
void removeAllMessages(Window *window);
@@ -132,7 +132,7 @@ public:
bool hasMessage(Window *window, int messageBegin, int messageEnd) const;
// Miscellaneous
- void yield();
+ void yield(VideoWindow *video);
int getTransitionSpeed();
void setTransitionSpeed(int newSpeed);
void releaseCapture() { _captureWindow = 0; }
diff --git a/engines/buried/demo/demo_menu.cpp b/engines/buried/demo/demo_menu.cpp
index 2cca0f2d5c0..43eb210464b 100644
--- a/engines/buried/demo/demo_menu.cpp
+++ b/engines/buried/demo/demo_menu.cpp
@@ -87,7 +87,7 @@ void DemoMainMenuWindow::showWithSplash() {
uint32 startTime = g_system->getMillis();
while (g_system->getMillis() < (startTime + 6000) && !_vm->hasMessage(this, kMessageTypeLButtonUp, kMessageTypeLButtonUp) && !_vm->shouldQuit())
- _vm->yield();
+ _vm->yield(nullptr);
_background->free();
delete _background;
diff --git a/engines/buried/environ/agent3_lair.cpp b/engines/buried/environ/agent3_lair.cpp
index f5496f8512e..84bb329be78 100644
--- a/engines/buried/environ/agent3_lair.cpp
+++ b/engines/buried/environ/agent3_lair.cpp
@@ -133,7 +133,7 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
}
_vm->_sound->timerCallback();
- _vm->yield();
+ _vm->yield(nullptr);
}
_vm->_sound->stopSoundEffect(_currentSoundID);
@@ -162,7 +162,7 @@ int LairEntry::postEnterRoom(Window *viewWindow, const Location &priorLocation)
}
_vm->_sound->timerCallback();
- _vm->yield();
+ _vm->yield(nullptr);
}
_vm->_sound->stopSoundEffect(_currentSoundID);
@@ -336,7 +336,7 @@ int LairEntry::onCharacter(Window *viewWindow, const Common::KeyState &character
timerCallback(viewWindow);
_vm->_sound->timerCallback();
- _vm->yield();
+ _vm->yield(nullptr);
}
_vm->_sound->stopSoundEffect(_currentSoundID);
@@ -577,7 +577,7 @@ int TransporterControls::onCharacter(Window *viewWindow, const Common::KeyState
// Wait two seconds
uint32 startTime = g_system->getMillis();
while (!_vm->shouldQuit() && startTime + 2000 > g_system->getMillis())
- _vm->yield();
+ _vm->yield(nullptr);
// Move to a different depth to enter the transporter
DestinationScene newScene;
@@ -629,7 +629,7 @@ int TransporterControls::onCharacter(Window *viewWindow, const Common::KeyState
// Wait two seconds
uint32 startTime = g_system->getMillis();
while (!_vm->shouldQuit() && startTime + 2000 > g_system->getMillis())
- _vm->yield();
+ _vm->yield(nullptr);
// Move to a different depth to enter the transporter
DestinationScene newScene;
diff --git a/engines/buried/environ/ai_lab.cpp b/engines/buried/environ/ai_lab.cpp
index 9b979b6b373..f78ddfbe52e 100644
--- a/engines/buried/environ/ai_lab.cpp
+++ b/engines/buried/environ/ai_lab.cpp
@@ -1850,7 +1850,7 @@ int CapacitanceToHabitatDoorClosed::mouseUp(Window *viewWindow, const Common::Po
uint32 startTime = g_system->getMillis();
while (!_vm->shouldQuit() && g_system->getMillis() < startTime + 1000) {
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->timerCallback();
}
@@ -1874,7 +1874,7 @@ int CapacitanceToHabitatDoorClosed::mouseUp(Window *viewWindow, const Common::Po
uint32 startTime = g_system->getMillis();
while (!_vm->shouldQuit() && g_system->getMillis() < startTime + 1000) {
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->timerCallback();
}
@@ -2455,7 +2455,7 @@ int CapacitanceDockingBayDoor::mouseUp(Window *viewWindow, const Common::Point &
// Wait a second?
uint32 startTime = g_system->getMillis();
while (!_vm->shouldQuit() && g_system->getMillis() < startTime + 1000) {
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->timerCallback();
}
diff --git a/engines/buried/environ/scene_common.cpp b/engines/buried/environ/scene_common.cpp
index 76a1cc77d85..6953adf162b 100644
--- a/engines/buried/environ/scene_common.cpp
+++ b/engines/buried/environ/scene_common.cpp
@@ -1307,7 +1307,7 @@ int TrialRecallScene::postEnterRoom(Window *viewWindow, const Location &priorLoc
Cursor oldCursor = _vm->_gfx->setCursor(kCursorWait);
uint32 start = g_system->getMillis();
while (g_system->getMillis() - start < 10000)
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_gfx->setCursor(oldCursor);
// Force a recall
diff --git a/engines/buried/frame_window.cpp b/engines/buried/frame_window.cpp
index 2a68201faf8..37ba620e41f 100644
--- a/engines/buried/frame_window.cpp
+++ b/engines/buried/frame_window.cpp
@@ -95,7 +95,7 @@ bool FrameWindow::showTitleSequence() {
uint32 startTime = g_system->getMillis();
while (g_system->getMillis() < (startTime + 7000) && !_vm->hasMessage(this, kMessageTypeLButtonDown, kMessageTypeLButtonDown) && !_vm->shouldQuit())
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->stopInterfaceSound();
invalidateWindow();
@@ -117,7 +117,7 @@ bool FrameWindow::showTitleSequence() {
_vm->removeMouseMessages(video);
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped && !_vm->hasMessage(this, kMessageTypeLButtonDown, kMessageTypeLButtonDown))
- _vm->yield();
+ _vm->yield(video);
delete video;
diff --git a/engines/buried/gameui.cpp b/engines/buried/gameui.cpp
index b64050fb20f..601fdae0206 100644
--- a/engines/buried/gameui.cpp
+++ b/engines/buried/gameui.cpp
@@ -95,7 +95,7 @@ bool GameUIWindow::startNewGameIntro(bool walkthrough) {
video->playVideo();
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped)
- _vm->yield();
+ _vm->yield(video);
delete video;
@@ -173,7 +173,7 @@ bool GameUIWindow::flashWarningLight() {
uint32 startTime = g_system->getMillis();
while (!_vm->shouldQuit() && (startTime + 200) > g_system->getMillis()) {
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->timerCallback();
}
@@ -188,7 +188,7 @@ bool GameUIWindow::flashWarningLight() {
startTime = g_system->getMillis();
while (!_vm->shouldQuit() && (startTime + 250) > g_system->getMillis()) {
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->timerCallback();
}
@@ -201,7 +201,7 @@ bool GameUIWindow::flashWarningLight() {
startTime = g_system->getMillis();
while (!_vm->shouldQuit() && (startTime + 250) > g_system->getMillis()) {
- _vm->yield();
+ _vm->yield(nullptr);
_vm->_sound->timerCallback();
}
diff --git a/engines/buried/inventory_info.cpp b/engines/buried/inventory_info.cpp
index 85b53ee7113..016a87d6356 100644
--- a/engines/buried/inventory_info.cpp
+++ b/engines/buried/inventory_info.cpp
@@ -210,7 +210,7 @@ void BurnedLetterViewWindow::onLButtonUp(const Common::Point &point, uint flags)
memcpy(_preBuffer->getBasePtr(0, j), newFrame->getBasePtr(0, _preBuffer->h - (i + offset) + j), newFrame->w * newFrame->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
newFrame->free();
@@ -240,7 +240,7 @@ void BurnedLetterViewWindow::onLButtonUp(const Common::Point &point, uint flags)
memcpy(_preBuffer->getBasePtr(0, newFrame->h - offset + j), newFrame->getBasePtr(0, i + j), newFrame->w * newFrame->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
newFrame->free();
diff --git a/engines/buried/main_menu.cpp b/engines/buried/main_menu.cpp
index 6c1828a48a7..d79512cb30e 100644
--- a/engines/buried/main_menu.cpp
+++ b/engines/buried/main_menu.cpp
@@ -213,7 +213,7 @@ void MainMenuWindow::onLButtonUp(const Common::Point &point, uint flags) {
video->playVideo();
while (!_vm->shouldQuit() && video->getMode() != VideoWindow::kModeStopped)
- _vm->yield();
+ _vm->yield(video);
_vm->_sound->restart();
}
diff --git a/engines/buried/scene_view.cpp b/engines/buried/scene_view.cpp
index 4f0ba902910..6de6c6db1ea 100644
--- a/engines/buried/scene_view.cpp
+++ b/engines/buried/scene_view.cpp
@@ -748,7 +748,7 @@ bool SceneViewWindow::timeSuitJump(int destination) {
jumpMovie->playToFrame(24);
while (!_vm->shouldQuit() && jumpMovie->getMode() != VideoWindow::kModeStopped && _vm->_sound->isInterfaceSoundPlaying()) {
- _vm->yield();
+ _vm->yield(jumpMovie.get());
_vm->_sound->timerCallback();
}
@@ -795,7 +795,7 @@ bool SceneViewWindow::timeSuitJump(int destination) {
jumpMovie->playVideo();
while (!_vm->shouldQuit() && jumpMovie->getMode() != VideoWindow::kModeStopped)
- _vm->yield();
+ _vm->yield(jumpMovie.get());
if (_vm->shouldQuit())
return true;
@@ -881,7 +881,7 @@ bool SceneViewWindow::timeSuitJump(int destination) {
jumpMovie->playToFrame(48);
while (!_vm->shouldQuit() && jumpMovie->getMode() != VideoWindow::kModeStopped && _vm->_sound->isInterfaceSoundPlaying()) {
- _vm->yield();
+ _vm->yield(jumpMovie.get());
_vm->_sound->timerCallback();
}
@@ -1078,7 +1078,7 @@ bool SceneViewWindow::videoTransition(const Location &location, DestinationScene
animationMovie->playToFrame(destinationData.transitionStartFrame + destinationData.transitionLength - 1);
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(animationMovie.get());
_vm->_sound->timerCallback();
}
@@ -1145,7 +1145,7 @@ bool SceneViewWindow::walkTransition(const Location &location, const Destination
_walkMovie->playToFrame(destinationData.transitionStartFrame + destinationData.transitionLength - 1);
while (!_vm->shouldQuit() && _walkMovie->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(_walkMovie);
_vm->_sound->timerCallback();
}
@@ -1186,7 +1186,7 @@ bool SceneViewWindow::pushTransition(Graphics::Surface *curBackground, Graphics:
memcpy(curBackground->getBasePtr(0, j), newBackground->getBasePtr(0, curBackground->h - (i + stripSize) + j), newBackground->w * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 1: // Push right
@@ -1197,7 +1197,7 @@ bool SceneViewWindow::pushTransition(Graphics::Surface *curBackground, Graphics:
memcpy(curBackground->getBasePtr(0, j), newBackground->getBasePtr(newBackground->w - (i + stripSize), j), stripSize * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 2: // Push left
@@ -1208,7 +1208,7 @@ bool SceneViewWindow::pushTransition(Graphics::Surface *curBackground, Graphics:
memcpy(curBackground->getBasePtr(curBackground->w - (int)stripSize, j), newBackground->getBasePtr(i, j), stripSize * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 3: // Push up
@@ -1219,7 +1219,7 @@ bool SceneViewWindow::pushTransition(Graphics::Surface *curBackground, Graphics:
memcpy(curBackground->getBasePtr(0, curBackground->h - stripSize + j), newBackground->getBasePtr(0, i + j), newBackground->w * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
}
@@ -1255,7 +1255,7 @@ bool SceneViewWindow::slideInTransition(Graphics::Surface *newBackground, int di
memcpy(_preBuffer->getBasePtr(0, j), newBackground->getBasePtr(0, DIB_FRAME_HEIGHT - j), newBackground->w * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 1: // Push right
@@ -1264,7 +1264,7 @@ bool SceneViewWindow::slideInTransition(Graphics::Surface *newBackground, int di
memcpy(_preBuffer->getBasePtr(0, j), newBackground->getBasePtr(DIB_FRAME_WIDTH - i, j), i * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 2: // Push left
@@ -1273,7 +1273,7 @@ bool SceneViewWindow::slideInTransition(Graphics::Surface *newBackground, int di
memcpy(_preBuffer->getBasePtr(0, DIB_FRAME_WIDTH - i), newBackground->getBasePtr(0, j), i * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 3: // Push up
@@ -1282,7 +1282,7 @@ bool SceneViewWindow::slideInTransition(Graphics::Surface *newBackground, int di
memcpy(_preBuffer->getBasePtr(0, DIB_FRAME_HEIGHT - j), newBackground->getBasePtr(0, j), newBackground->w * newBackground->format.bytesPerPixel);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
}
@@ -1308,7 +1308,7 @@ bool SceneViewWindow::slideOutTransition(Graphics::Surface *newBackground, int d
_vm->_gfx->crossBlit(_preBuffer, 0, 0, 432, 189, newBackground, 0, 0);
_vm->_gfx->crossBlit(_preBuffer, 0, i, 432, 189 - i, &curBackground, 0, 0);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 1: // Push right
@@ -1317,7 +1317,7 @@ bool SceneViewWindow::slideOutTransition(Graphics::Surface *newBackground, int d
_vm->_gfx->crossBlit(_preBuffer, i, 0, DIB_FRAME_WIDTH - i, 189, newBackground, i, 0);
_vm->_gfx->crossBlit(_preBuffer, 0, 0, i, 189, &curBackground, DIB_FRAME_WIDTH - i, 0);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 2: // Push left
@@ -1325,7 +1325,7 @@ bool SceneViewWindow::slideOutTransition(Graphics::Surface *newBackground, int d
_vm->_gfx->crossBlit(_preBuffer, 0, 0, i, 189, newBackground, 0, 0);
_vm->_gfx->crossBlit(_preBuffer, i, 0, 432 - i, 189, &curBackground, 0, 0);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
case 3: // Push up
@@ -1333,7 +1333,7 @@ bool SceneViewWindow::slideOutTransition(Graphics::Surface *newBackground, int d
_vm->_gfx->crossBlit(_preBuffer, 0, 0, 432, 189, newBackground, 0, 0);
_vm->_gfx->crossBlit(_preBuffer, 0, 189 - i, 432, i, &curBackground, 0, 0);
invalidateWindow(false);
- _vm->yield();
+ _vm->yield(nullptr);
}
break;
}
@@ -1572,7 +1572,7 @@ bool SceneViewWindow::playSynchronousAnimation(int animationID) {
animationMovie->playToFrame(animDatabase[i].startFrame + animDatabase[i].frameCount - 1);
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(animationMovie.get());
_vm->_sound->timerCallback();
}
@@ -1615,7 +1615,7 @@ bool SceneViewWindow::playSynchronousAnimationExtern(int animationID) {
animationMovie->playVideo();
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(animationMovie.get());
_vm->_sound->timerCallback();
}
@@ -1679,7 +1679,7 @@ bool SceneViewWindow::playPlacedSynchronousAnimation(int animationID, int left,
animationMovie->playToFrame(animDatabase[i].startFrame + animDatabase[i].frameCount - 1);
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(animationMovie.get());
_vm->_sound->timerCallback();
}
@@ -1749,7 +1749,7 @@ bool SceneViewWindow::playClippedSynchronousAnimation(int animationID, int left,
animationMovie->playToFrame(animDatabase[i].startFrame + animDatabase[i].frameCount - 1);
while (!_vm->shouldQuit() && animationMovie->getMode() != VideoWindow::kModeStopped) {
- _vm->yield();
+ _vm->yield(animationMovie.get());
_vm->_sound->timerCallback();
}
diff --git a/engines/buried/sound.cpp b/engines/buried/sound.cpp
index 8873e0c4542..2bdd85cb04f 100644
--- a/engines/buried/sound.cpp
+++ b/engines/buried/sound.cpp
@@ -352,7 +352,7 @@ bool SoundManager::playSynchronousAIComment(const Common::String &fileName) {
while (retVal && !_vm->shouldQuit() && _soundData[kAIVoiceIndex]->isPlaying()) {
timerCallback();
- _vm->yield();
+ _vm->yield(nullptr);
}
// Now that is has been played, kill it here and now
@@ -441,7 +441,7 @@ bool SoundManager::playSynchronousSoundEffect(const Common::String &fileName, in
// the sound finishes playing
do {
timerCallback();
- _vm->yield();
+ _vm->yield(nullptr);
} while (!_vm->shouldQuit() && isSoundEffectPlaying(soundChannel));
// One last callback check
More information about the Scummvm-git-logs
mailing list