[Scummvm-git-logs] scummvm master -> 46eb7acb0006861769563abd5f33e673ca19f595

SupSuper supsuper at gmail.com
Mon Jun 7 03:26:39 UTC 2021


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
30a97ad094 TRECISION: Reset mouse on room transition
8f8666b6cd VIDEO: Allow decoder subclasses to use internal functions
46eb7acb00 TRECISION: More accurate video seeking


Commit: 30a97ad094e7cbb6620c749ecd9ad64fcbae1fe9
    https://github.com/scummvm/scummvm/commit/30a97ad094e7cbb6620c749ecd9ad64fcbae1fe9
Author: SupSuper (supsuper at gmail.com)
Date: 2021-06-07T02:34:01+01:00

Commit Message:
TRECISION: Reset mouse on room transition

Changed paths:
    engines/trecision/logic.cpp


diff --git a/engines/trecision/logic.cpp b/engines/trecision/logic.cpp
index e7e17bcd58..b71d17e958 100644
--- a/engines/trecision/logic.cpp
+++ b/engines/trecision/logic.cpp
@@ -3860,6 +3860,7 @@ void LogicManager::doSystemChangeRoom(uint16 room) {
 
 	_vm->clearUseWith();
 	_vm->closeInventoryImmediately();
+	_vm->_mouseLeftBtn = _vm->_mouseRightBtn = false;
 
 	_vm->_flagShowCharacter = true;
 	_vm->_flagCharacterSpeak = false;


Commit: 8f8666b6cd115768d6d1d60df205332464e1b084
    https://github.com/scummvm/scummvm/commit/8f8666b6cd115768d6d1d60df205332464e1b084
Author: SupSuper (supsuper at gmail.com)
Date: 2021-06-07T04:22:44+01:00

Commit Message:
VIDEO: Allow decoder subclasses to use internal functions

Changed paths:
    video/video_decoder.h


diff --git a/video/video_decoder.h b/video/video_decoder.h
index b7e2bb2297..8ba23f57d2 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -959,6 +959,7 @@ private:
 	// Default PixelFormat settings
 	Graphics::PixelFormat _defaultHighColorFormat;
 
+protected:
 	// Internal helper functions
 	void stopAudio();
 	void startAudio();
@@ -966,7 +967,6 @@ private:
 	bool hasFramesLeft() const;
 	bool hasAudio() const;
 
-protected:
 	Audio::Timestamp _lastTimeChange;
 	int32 _startTime;
 


Commit: 46eb7acb0006861769563abd5f33e673ca19f595
    https://github.com/scummvm/scummvm/commit/46eb7acb0006861769563abd5f33e673ca19f595
Author: SupSuper (supsuper at gmail.com)
Date: 2021-06-07T04:26:15+01:00

Commit Message:
TRECISION: More accurate video seeking

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


diff --git a/engines/trecision/dialog.cpp b/engines/trecision/dialog.cpp
index 164f320dc0..5e9be3b82f 100644
--- a/engines/trecision/dialog.cpp
+++ b/engines/trecision/dialog.cpp
@@ -125,23 +125,21 @@ void DialogManager::playDialog(uint16 i) {
 	
 	_vm->_animMgr->startFullMotion();
 
-	int skip = 0;
+	bool skip = false;
 	int curChoice = 0;
 	for (int c = _dialog[_curDialog]._firstChoice; c < _dialog[_curDialog]._firstChoice + _dialog[_curDialog]._choiceNumb; ++c) {
 		if (isChoiceVisible(c))
 			++curChoice;
 	}
 
-	if (_curDialog == dC581 && isChoiceVisible(262))
-		++skip;
-	if (_curDialog == dC581 && curChoice == 1)
-		++skip;
-	if (_curDialog == dSHOPKEEPER1A && curChoice == 1)
-		++skip;
+	if ((_curDialog == dC581 && isChoiceVisible(262)) ||
+		(_curDialog == dC581 && curChoice == 1) ||
+		(_curDialog == dSHOPKEEPER1A && curChoice == 1))
+		skip = true;
 	// if there's a pre-dialog
-	if (_dialog[i]._startLen > 0 && !skip)
-		_vm->_animMgr->playMovie(_dialog[i]._startAnim, 0, _dialog[i]._startLen - 1);
-	else {
+	if (_dialog[i]._startLen > 0 && !skip) {
+		_vm->_animMgr->playMovie(_dialog[i]._startAnim, 1, _dialog[i]._startLen);
+	} else {
 		_vm->_animMgr->smkToggleAudio(1, false);
 		afterChoice();
 	}
@@ -534,7 +532,7 @@ void DialogManager::afterChoice() {
 
 		// If there is a pre-dialog
 		if (_dialog[_curDialog]._startLen > 0) {
-			_vm->_animMgr->playMovie(_dialog[_curDialog]._startAnim, 0, _dialog[_curDialog]._startLen - 1);
+			_vm->_animMgr->playMovie(_dialog[_curDialog]._startAnim, 1, _dialog[_curDialog]._startLen);
 			return;
 		}
 	}
@@ -604,7 +602,7 @@ void DialogManager::playChoice(uint16 i) {
 	assert(i < MAXCHOICE);
 
 	DialogChoice *choice = &_choice[i];
-	const int startFrame = choice->_startFrame - 1;
+	const int startFrame = choice->_startFrame;
 	const int endSubTitle = choice->_firstSubTitle + choice->_subTitleNumb;
 	int totalLength = 0;
 
@@ -628,7 +626,7 @@ void DialogManager::playChoice(uint16 i) {
 	}
 
 	for (int c = _curSubTitle; c < endSubTitle; ++c)
-		totalLength += _subTitles[c]._length;
+		totalLength += _subTitles[c]._length - 1;
 
 	_vm->_graphicsMgr->hideCursor();
 	_vm->_animMgr->playMovie(_dialog[_curDialog]._startAnim, startFrame, startFrame + totalLength - 1);
diff --git a/engines/trecision/video.cpp b/engines/trecision/video.cpp
index 4b2b57d20d..47de1642ec 100644
--- a/engines/trecision/video.cpp
+++ b/engines/trecision/video.cpp
@@ -80,6 +80,7 @@ bool NightlongSmackerDecoder::forceSeekToFrame(uint frame) {
 	if (!rewind())
 		return false;
 
+	stopAudio();
 	SmackerVideoTrack *videoTrack = (SmackerVideoTrack *)getTrack(0);
 	uint32 start = _fileStream->pos();
 	uint32 offset = 0;
@@ -104,6 +105,7 @@ bool NightlongSmackerDecoder::forceSeekToFrame(uint frame) {
 
 	_lastTimeChange = videoTrack->getFrameTime(frame);
 	_startTime = g_system->getMillis() - (_lastTimeChange.msecs() / getRate()).toInt();
+	startAudio();
 
 	return true;
 }
@@ -153,7 +155,7 @@ void AnimManager::playMovie(const Common::String &filename, int startFrame, int
 
 	setVideoRange(smkDecoder, startFrame, endFrame);
 
-	while (!_vm->shouldQuit() && !smkDecoder->endOfVideo() && smkDecoder->getCurFrame() < endFrame && !skipVideo) {
+	while (!_vm->shouldQuit() && startFrame != endFrame && !smkDecoder->endOfVideo() && !skipVideo) {
 		if (smkDecoder->needsUpdate()) {
 			drawFrame(smkDecoder, x, y, true);
 		}
@@ -174,13 +176,15 @@ void AnimManager::playMovie(const Common::String &filename, int startFrame, int
 }
 
 void AnimManager::setVideoRange(NightlongSmackerDecoder *smkDecoder, int &startFrame, int &endFrame) {
-	startFrame = CLIP<int32>(startFrame, 0, smkDecoder->getFrameCount() - 1);
-	endFrame = CLIP<int32>(endFrame, 0, smkDecoder->getFrameCount() - 1);
+	// Trecision starts at 1 but ScummVM starts at 0
+	startFrame = CLIP<int32>(startFrame - 1, 0, smkDecoder->getFrameCount() - 1);
+	endFrame = CLIP<int32>(endFrame - 1, 0, smkDecoder->getFrameCount() - 1);
 
 	// If choices are attached
 	if (startFrame > 0 && startFrame > smkDecoder->getCurFrame()) {
-		smkDecoder->forceSeekToFrame(startFrame);
+		smkDecoder->forceSeekToFrame(startFrame - 1);
 	}
+	smkDecoder->setEndFrame(endFrame);
 }
 
 void AnimManager::drawFrame(NightlongSmackerDecoder *smkDecoder, uint16 x, uint16 y, bool updateScreen) {
diff --git a/engines/trecision/video.h b/engines/trecision/video.h
index 983fe571da..02f4cd73d4 100644
--- a/engines/trecision/video.h
+++ b/engines/trecision/video.h
@@ -59,6 +59,7 @@ public:
 	void muteTrack(uint track, bool mute);
 	void setMute(bool mute);
 	bool forceSeekToFrame(uint frame);
+	bool endOfVideo() const override { return !hasFramesLeft(); }
 };
 
 class AnimManager {




More information about the Scummvm-git-logs mailing list