[Scummvm-git-logs] scummvm master -> 84d00f364a74293ebc1edca7237eee8bc4a95aed

bluegr bluegr at gmail.com
Sat Jun 19 09:19:32 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:
84d00f364a TRECISION: Fix playing videos without choices - bug #12622


Commit: 84d00f364a74293ebc1edca7237eee8bc4a95aed
    https://github.com/scummvm/scummvm/commit/84d00f364a74293ebc1edca7237eee8bc4a95aed
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-06-19T12:18:42+03:00

Commit Message:
TRECISION: Fix playing videos without choices - bug #12622

Changed paths:
    engines/trecision/dialog.cpp
    engines/trecision/dialog.h
    engines/trecision/video.cpp
    engines/trecision/video.h


diff --git a/engines/trecision/dialog.cpp b/engines/trecision/dialog.cpp
index 15a0a4edc0..b5c3246f8e 100644
--- a/engines/trecision/dialog.cpp
+++ b/engines/trecision/dialog.cpp
@@ -153,7 +153,7 @@ void DialogManager::selectChoice(int16 dmx, int16 dmy) {
 
 	if (_curPos != -1) {
 		_vm->_flagDialogMenuActive = false;
-		playChoice(_dispChoice[_curPos]);
+		playChoice(_dispChoice[_curPos], false);
 	}
 }
 
@@ -584,7 +584,8 @@ void DialogManager::afterChoice() {
 	// Immediately starts the fraud choice
 	for (int c = dialog->_firstChoice; c < dialog->_firstChoice + dialog->_choiceNumb; ++c) {
 		if ((_choice[c]._flag & DLGCHOICE_FRAUD) && isChoiceVisible(c)) {
-			playChoice(c);
+			const bool singleChoice = dialog->_choiceNumb == 1;
+			playChoice(c, singleChoice);
 			return;
 		}
 	}
@@ -607,7 +608,8 @@ void DialogManager::afterChoice() {
 		}
 	}
 	if (res != 0) {
-		playChoice(res);
+		const bool singleChoice = dialog->_choiceNumb == 1;
+		playChoice(res, singleChoice);
 		return;
 	}
 
@@ -642,7 +644,7 @@ void DialogManager::dialogHandler(int numFrame) {
 	}
 }
 
-void DialogManager::playChoice(uint16 i) {
+void DialogManager::playChoice(uint16 i, bool singleChoice) {
 	assert(i < MAXCHOICE);
 
 	DialogChoice *choice = &_choice[i];
@@ -673,7 +675,7 @@ void DialogManager::playChoice(uint16 i) {
 		totalLength += _subTitles[c]._length - 1;
 
 	_vm->_graphicsMgr->hideCursor();
-	_vm->_animMgr->playMovie(_dialog[_curDialog]._startAnim, startFrame, startFrame + totalLength - 1);
+	_vm->_animMgr->playMovie(_dialog[_curDialog]._startAnim, startFrame, startFrame + totalLength - 1, singleChoice);
 }
 
 void DialogManager::doDialog() {
diff --git a/engines/trecision/dialog.h b/engines/trecision/dialog.h
index 06ccfc9b4c..2e27c6ffbc 100644
--- a/engines/trecision/dialog.h
+++ b/engines/trecision/dialog.h
@@ -71,7 +71,7 @@ class DialogManager {
 	TrecisionEngine *_vm;
 
 	void showChoices(uint16 i);
-	void playChoice(uint16 i);
+	void playChoice(uint16 i, bool singleChoice);
 
 	Dialog _dialog[MAXDIALOG];
 	DialogChoice _choice[MAXCHOICE];
diff --git a/engines/trecision/video.cpp b/engines/trecision/video.cpp
index 51125a3d82..df77c739ec 100644
--- a/engines/trecision/video.cpp
+++ b/engines/trecision/video.cpp
@@ -141,7 +141,7 @@ AnimManager::~AnimManager() {
 	}
 }
 
-void AnimManager::playMovie(const Common::String &filename, int startFrame, int endFrame) {
+void AnimManager::playMovie(const Common::String &filename, int startFrame, int endFrame, bool singleChoice) {
 	NightlongSmackerDecoder *smkDecoder = new NightlongSmackerDecoder;
 
 	if (!smkDecoder->loadFile(filename)) {
@@ -159,6 +159,11 @@ void AnimManager::playMovie(const Common::String &filename, int startFrame, int
 
 	smkDecoder->start();
 
+	// If the video has a single choice, and it starts from the beginning,
+	// ignore the calculated end frame and play all of it
+	if (singleChoice && startFrame < 10 && endFrame < smkDecoder->getFrameCount() - 1)
+		endFrame = smkDecoder->getFrameCount() - 1;
+
 	setVideoRange(smkDecoder, startFrame, endFrame);
 
 	while (!_vm->shouldQuit() && startFrame != endFrame && !smkDecoder->endOfVideo() && !skipVideo) {
diff --git a/engines/trecision/video.h b/engines/trecision/video.h
index 5efcdd3b66..1e0925b38c 100644
--- a/engines/trecision/video.h
+++ b/engines/trecision/video.h
@@ -103,7 +103,7 @@ public:
 	void smkStop(uint16 slot);
 	void refreshActionAnimation() { refreshSmkAnim(_playingAnims[kSmackerAction]); }
 	bool isActionActive() const { return _playingAnims[kSmackerAction] != 0; }
-	void playMovie(const Common::String &filename, int startFrame = 0, int endFrame = -1);
+	void playMovie(const Common::String &filename, int startFrame = 0, int endFrame = -1, bool singleChoice = false);
 	void startFullMotion();
 	void stopFullMotion();
 




More information about the Scummvm-git-logs mailing list