[Scummvm-git-logs] scummvm master -> 04edc22635f18178263b52bfcde91127f3d41a4a

bgK bastien.bouclet at gmail.com
Sat Feb 2 13:31:51 CET 2019


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:
27a7a67778 MOHAWK: RIVEN: Prevent the card leave script from recursing
f72f71a6cc VIDEO: Keep track of the duration of ignored edits
04edc22635 MOHAWK: RIVEN: Add a console to quickly test all the cards


Commit: 27a7a67778a1cd59e24ffe756b68cdd8888e19d4
    https://github.com/scummvm/scummvm/commit/27a7a67778a1cd59e24ffe756b68cdd8888e19d4
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-02-02T13:30:44+01:00

Commit Message:
MOHAWK: RIVEN: Prevent the card leave script from recursing

Recursion would happen when multiple events are received in the same
frame. This could happen when mashing both the mouse and the keyboard to
move around faster, as noticed by a speedrunner.

Changed paths:
    engines/mohawk/riven_card.cpp


diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 555688c..9026f2e 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -917,10 +917,12 @@ void RivenCard::leave() {
 
 	if (_pressedHotspot) {
 		script += _pressedHotspot->getScript(kMouseUpScript);
+		_pressedHotspot = nullptr;
 	}
 
 	if (_hoveredHotspot) {
 		script += _hoveredHotspot->getScript(kMouseLeaveScript);
+		_hoveredHotspot = nullptr;
 	}
 
 	script += getScript(kCardLeaveScript);


Commit: f72f71a6cc1a6bcd1b92199457165e35a6362cee
    https://github.com/scummvm/scummvm/commit/f72f71a6cc1a6bcd1b92199457165e35a6362cee
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-02-02T13:30:44+01:00

Commit Message:
VIDEO: Keep track of the duration of ignored edits

Fixes inconsistent videos playing in Caldoria in the DVD version of JMP
Pegasus Prime.

Changed paths:
    video/qt_decoder.cpp


diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index bb9a922..4a47c6a 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -313,6 +313,7 @@ void QuickTimeDecoder::VideoTrackHandler::checkEditListBounds() {
 		EditListEntry &edit = _parent->editList[i];
 
 		if (edit.mediaTime < 0) {
+			offset += edit.trackDuration;
 			continue; // Ignore empty edits
 		}
 


Commit: 04edc22635f18178263b52bfcde91127f3d41a4a
    https://github.com/scummvm/scummvm/commit/04edc22635f18178263b52bfcde91127f3d41a4a
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2019-02-02T13:30:44+01:00

Commit Message:
MOHAWK: RIVEN: Add a console to quickly test all the cards

Goes through all the cards clicking on hotspots at random.

Changed paths:
    engines/mohawk/console.cpp
    engines/mohawk/console.h
    engines/mohawk/riven.cpp
    engines/mohawk/riven.h
    engines/mohawk/riven_stack.h
    engines/mohawk/riven_stacks/gspit.cpp


diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index bd0e5c7..1cb6c8d 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -374,23 +374,24 @@ bool MystConsole::Cmd_QuickTest(int argc, const char **argv) {
 #ifdef ENABLE_RIVEN
 
 RivenConsole::RivenConsole(MohawkEngine_Riven *vm) : GUI::Debugger(), _vm(vm) {
-	registerCmd("changeCard",		WRAP_METHOD(RivenConsole, Cmd_ChangeCard));
-	registerCmd("curCard",		WRAP_METHOD(RivenConsole, Cmd_CurCard));
-	registerCmd("dumpCard",		WRAP_METHOD(RivenConsole, Cmd_DumpCard));
-	registerCmd("var",			WRAP_METHOD(RivenConsole, Cmd_Var));
-	registerCmd("playSound",		WRAP_METHOD(RivenConsole, Cmd_PlaySound));
+	registerCmd("changeCard",     WRAP_METHOD(RivenConsole, Cmd_ChangeCard));
+	registerCmd("curCard",        WRAP_METHOD(RivenConsole, Cmd_CurCard));
+	registerCmd("dumpCard",       WRAP_METHOD(RivenConsole, Cmd_DumpCard));
+	registerCmd("var",            WRAP_METHOD(RivenConsole, Cmd_Var));
+	registerCmd("playSound",      WRAP_METHOD(RivenConsole, Cmd_PlaySound));
 	registerCmd("playSLST",       WRAP_METHOD(RivenConsole, Cmd_PlaySLST));
-	registerCmd("stopSound",		WRAP_METHOD(RivenConsole, Cmd_StopSound));
-	registerCmd("curStack",		WRAP_METHOD(RivenConsole, Cmd_CurStack));
-	registerCmd("dumpStack",		WRAP_METHOD(RivenConsole, Cmd_DumpStack));
-	registerCmd("changeStack",	WRAP_METHOD(RivenConsole, Cmd_ChangeStack));
-	registerCmd("hotspots",		WRAP_METHOD(RivenConsole, Cmd_Hotspots));
-	registerCmd("zipMode",		WRAP_METHOD(RivenConsole, Cmd_ZipMode));
+	registerCmd("stopSound",      WRAP_METHOD(RivenConsole, Cmd_StopSound));
+	registerCmd("curStack",       WRAP_METHOD(RivenConsole, Cmd_CurStack));
+	registerCmd("dumpStack",      WRAP_METHOD(RivenConsole, Cmd_DumpStack));
+	registerCmd("changeStack",    WRAP_METHOD(RivenConsole, Cmd_ChangeStack));
+	registerCmd("hotspots",       WRAP_METHOD(RivenConsole, Cmd_Hotspots));
+	registerCmd("zipMode",        WRAP_METHOD(RivenConsole, Cmd_ZipMode));
 	registerCmd("dumpScript",     WRAP_METHOD(RivenConsole, Cmd_DumpScript));
 	registerCmd("listZipCards",   WRAP_METHOD(RivenConsole, Cmd_ListZipCards));
-	registerCmd("getRMAP",		WRAP_METHOD(RivenConsole, Cmd_GetRMAP));
+	registerCmd("getRMAP",        WRAP_METHOD(RivenConsole, Cmd_GetRMAP));
 	registerCmd("combos",         WRAP_METHOD(RivenConsole, Cmd_Combos));
 	registerCmd("sliderState",    WRAP_METHOD(RivenConsole, Cmd_SliderState));
+	registerCmd("quickTest",      WRAP_METHOD(RivenConsole, Cmd_QuickTest));
 	registerVar("show_hotspots",  &_vm->_showHotspots);
 }
 
@@ -687,6 +688,65 @@ bool RivenConsole::Cmd_SliderState(int argc, const char **argv) {
 	return true;
 }
 
+bool RivenConsole::Cmd_QuickTest(int argc, const char **argv) {
+	_vm->pauseEngine(false);
+
+	// Go through all the stacks, all the cards and click random stuff
+	for (uint16 stackId = kStackFirst; stackId <= kStackLast; stackId++) {
+
+		debug("Loading stack %s", RivenStacks::getName(stackId));
+		_vm->changeToStack(stackId);
+
+		Common::Array<uint16> cardIds = _vm->getResourceIDList(ID_CARD);
+		for (uint16 i = 0; i < cardIds.size(); i++) {
+			if (_vm->shouldQuit()) break;
+
+			uint16 cardId = cardIds[i];
+			if (stackId == kStackTspit && cardId == 366) continue; // Cut card with invalid links
+			if (stackId == kStackTspit && cardId == 412) continue; // Cut card with invalid links
+			if (stackId == kStackTspit && cardId == 486) continue; // Cut card with invalid links
+			if (stackId == kStackBspit && cardId == 465) continue; // Cut card with invalid links
+			if (stackId == kStackJspit && cardId == 737) continue; // Cut card with invalid links
+
+			debug("Loading card %d", cardId);
+			RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(1,
+			                            kRivenCommandChangeCard, 1, cardId);
+			_vm->_scriptMan->runScript(script, true);
+
+			_vm->_gfx->setTransitionMode(kRivenTransitionModeDisabled);
+
+			while (_vm->_scriptMan->hasQueuedScripts()) {
+				_vm->doFrame();
+			}
+
+			// Click on a random hotspot
+			Common::Array<RivenHotspot *> hotspots = _vm->getCard()->getHotspots();
+			if (!hotspots.empty() && _vm->getStack()->getId() != kStackAspit) {
+				uint hotspotIndex = _vm->_rnd->getRandomNumberRng(0, hotspots.size() - 1);
+				RivenHotspot *hotspot = hotspots[hotspotIndex];
+				if (hotspot->isEnabled()) {
+					Common::Rect hotspotRect = hotspot->getRect();
+					Common::Point hotspotPoint((hotspotRect.left + hotspotRect.right) / 2, (hotspotRect.top + hotspotRect.bottom) / 2);
+					_vm->getStack()->onMouseDown(hotspotPoint);
+					_vm->getStack()->onMouseUp(hotspotPoint);
+				}
+
+				while (_vm->_scriptMan->hasQueuedScripts()) {
+					_vm->doFrame();
+				}
+			}
+
+			if (_vm->getStack()->getId() != stackId) {
+				// Clicking may have linked us to another age
+				_vm->changeToStack(stackId);
+			}
+		}
+	}
+
+	_vm->pauseEngine(true);
+	return true;
+}
+
 #endif // ENABLE_RIVEN
 
 LivingBooksConsole::LivingBooksConsole(MohawkEngine_LivingBooks *vm) : GUI::Debugger(), _vm(vm) {
diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h
index 7d94bf5..88db580 100644
--- a/engines/mohawk/console.h
+++ b/engines/mohawk/console.h
@@ -89,6 +89,7 @@ private:
 	bool Cmd_GetRMAP(int argc, const char **argv);
 	bool Cmd_Combos(int argc, const char **argv);
 	bool Cmd_SliderState(int argc, const char **argv);
+	bool Cmd_QuickTest(int argc, const char **argv);
 };
 
 #endif
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index b299769..2545c68 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -636,6 +636,17 @@ Common::SeekableReadStream *MohawkEngine_Riven::getExtrasResource(uint32 tag, ui
 	return _extrasFile->getResource(tag, id);
 }
 
+Common::Array<uint16> MohawkEngine_Riven::getResourceIDList(uint32 type) const {
+	Common::Array<uint16> ids;
+
+	for (uint i = 0; i < _mhk.size(); i++) {
+		ids.push_back(_mhk[i]->getResourceIDList(type));
+	}
+
+	return ids;
+}
+
+
 void MohawkEngine_Riven::delay(uint32 ms) {
 	uint32 startTime = _system->getMillis();
 
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index b4084ca..7a0d8b5 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -153,6 +153,7 @@ public:
 	uint32 &getStackVar(uint32 index);
 
 	// Miscellaneous
+	Common::Array<uint16> getResourceIDList(uint32 type) const;
 	Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id);
 	bool _activatedPLST;
 	bool _activatedSLST;
diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h
index 671f4f9..aba6cc9 100644
--- a/engines/mohawk/riven_stack.h
+++ b/engines/mohawk/riven_stack.h
@@ -30,7 +30,6 @@
 #include "common/str-array.h"
 
 #include "mohawk/riven_graphics.h"
-#include "mohawk/riven_stack.h"
 
 namespace Mohawk {
 
diff --git a/engines/mohawk/riven_stacks/gspit.cpp b/engines/mohawk/riven_stacks/gspit.cpp
index 05f46c6..d2440ec 100644
--- a/engines/mohawk/riven_stacks/gspit.cpp
+++ b/engines/mohawk/riven_stacks/gspit.cpp
@@ -157,7 +157,13 @@ void GSpit::xgpincontrols(const ArgumentArray &args) {
 	}
 
 	// Now check to see if this section of the island exists
-	uint32 islandIndex = _vm->_vars["glkbtns"] - 1;
+	uint32 islandIndex = _vm->_vars["glkbtns"];
+	if (islandIndex == 0) {
+		// No island selected. Probably we jumped to the card.
+		warning("xgpincontrols called without an island selected.");
+		return;
+	}
+
 	uint16 imagePos = mousePos.x + mousePos.y;
 
 	static const uint16 islandImages[5][11] = {
@@ -172,7 +178,7 @@ void GSpit::xgpincontrols(const ArgumentArray &args) {
 	uint32 imageCount = _vm->_vars["gimagemax"];
 	uint32 image = 0;
 	for (; image < imageCount; image++)
-		if (islandImages[islandIndex][image] == imagePos)
+		if (islandImages[islandIndex - 1][image] == imagePos)
 			break;
 
 	// If we past it, we don't have a valid map coordinate





More information about the Scummvm-git-logs mailing list