STARK: Suspend script while FMVs is playing.

This commit is contained in:
Einar Johan Trøan Sømåen 2015-02-26 18:18:32 +01:00 committed by Bastien Bouclet
parent 0938ea7cb7
commit 0f6790ea38
3 changed files with 16 additions and 4 deletions

View File

@ -118,7 +118,7 @@ Command *Command::execute(uint32 callMode, Script *script) {
case kScrollSet:
return opScrollSet(_arguments[1].referenceValue);
case kPlayFullMotionVideo:
return opPlayFullMotionVideo(_arguments[1].referenceValue, _arguments[2].intValue);
return opPlayFullMotionVideo(script, _arguments[1].referenceValue, _arguments[2].intValue);
case kEnableDiaryEntry:
return opEnableDiaryEntry(_arguments[1].referenceValue);
case kChangeSound:
@ -467,11 +467,13 @@ Command *Command::opScrollSet(const ResourceReference &scrollRef) {
return nextCommand();
}
Command *Command::opPlayFullMotionVideo(const ResourceReference &movieRef, int32 unknown) {
Command *Command::opPlayFullMotionVideo(Script *script, const ResourceReference &movieRef, int32 unknown) {
FMV *movie = movieRef.resolve<FMV>();
warning("(TODO: Implement) opPlayFullMotionVideo(%s) : %s - %d", movie->getName().c_str(), movieRef.describe().c_str(), unknown);
StarkServices::instance().ui->notifyFMVRequest(movie->getFilename());
return nextCommand();
// TODO: Is this unconditional suspension?
script->suspend(movie);
return this; // Stay on the same command while suspended
}
Command *Command::opEnableDiaryEntry(const ResourceReference &knowledgeRef) {

View File

@ -196,7 +196,7 @@ protected:
Command *opStopPlayingSound(const ResourceReference &soundRef);
Command *opGoLayer(const ResourceReference &layerRef);
Command *opScrollSet(const ResourceReference &scrollRef);
Command *opPlayFullMotionVideo(const ResourceReference &movieRef, int32 unknown);
Command *opPlayFullMotionVideo(Script *script, const ResourceReference &movieRef, int32 unknown);
Command *opEnableDiaryEntry(const ResourceReference &knowledgeRef);
Command *opChangeSound(const ResourceReference &soundRef, int32 unknown1, int32 unknown2, int32 unknown3, int32 unknown4);
Command *opItem3DRunTo(const ResourceReference &itemRef, const ResourceReference &bookmarkRef, int32 unknown);

View File

@ -31,6 +31,8 @@
#include "engines/stark/services/global.h"
#include "engines/stark/services/services.h"
#include "engines/stark/ui.h" // For suspending through FMV
namespace Stark {
namespace Resources {
@ -190,6 +192,14 @@ void Script::updateSuspended() {
}
break;
}
case Type::kFMV: {
UI *ui = StarkServices::instance().ui;
if (!ui->isPlayingFMV()) {
// Resume the script execution if the dialog is complete
_suspendingResource = nullptr;
}
break;
}
case Type::kSoundItem: {
Sound *soundItem = Object::cast<Sound>(_suspendingResource);
if (!soundItem->isPlaying()) {