[Scummvm-cvs-logs] scummvm master -> bb3b1a2b759d702dcfd4731fed58387bda7e23d3

clone2727 clone2727 at gmail.com
Thu Aug 11 19:17:13 CEST 2011


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

Summary:
1737190a71 MOHAWK: Implement the rest of the sunners code
bb3b1a2b75 MOHAWK: Error out on any unknown Riven stack variables


Commit: 1737190a7161ec77f1f3f0d6a72dfc1920850ee4
    https://github.com/scummvm/scummvm/commit/1737190a7161ec77f1f3f0d6a72dfc1920850ee4
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-11T10:14:03-07:00

Commit Message:
MOHAWK: Implement the rest of the sunners code

Changed paths:
    engines/mohawk/riven.cpp
    engines/mohawk/riven.h
    engines/mohawk/riven_external.cpp



diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 612b8b3..ffd9621 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -209,8 +209,10 @@ void MohawkEngine_Riven::handleEvents() {
 			needsUpdate = true;
 			break;
 		case Common::EVENT_LBUTTONDOWN:
-			if (_curHotspot >= 0)
+			if (_curHotspot >= 0) {
+				checkSunnerAlertClick();
 				runHotspotScript(_curHotspot, kMouseDownScript);
+			}
 			break;
 		case Common::EVENT_LBUTTONUP:
 			// See RivenScript::switchCard() for more information on why we sometimes
@@ -812,6 +814,138 @@ static void catherineIdleTimer(MohawkEngine_Riven *vm) {
 	vm->installTimer(&catherineIdleTimer, timeUntilNextMovie);
 }
 
+static void sunnersTopStairsTimer(MohawkEngine_Riven *vm) {
+	// If the sunners are gone, we have no video to play
+	if (vm->_vars["jsunners"] != 0) {
+		vm->removeTimer();
+		return;
+	}
+
+	// Play a random sunners video if the script one is not playing already
+	// and then set a new timer for when the new video should be played
+
+	VideoHandle oldHandle = vm->_video->findVideoHandleRiven(1);
+	uint32 timerTime = 500;
+
+	if (oldHandle == NULL_VID_HANDLE || vm->_video->endOfVideo(oldHandle)) {
+		uint32 &sunnerTime = vm->_vars["jsunnertime"];
+
+		if (sunnerTime == 0) {
+			timerTime = vm->_rnd->getRandomNumberRng(2, 15) * 1000;
+		} else if (sunnerTime < vm->getTotalPlayTime()) {
+			VideoHandle handle = vm->_video->playMovieRiven(vm->_rnd->getRandomNumberRng(1, 3));
+
+			timerTime = vm->_video->getDuration(handle) + vm->_rnd->getRandomNumberRng(2, 15) * 1000;
+		}
+
+		sunnerTime = timerTime + vm->getTotalPlayTime();
+	}
+
+	vm->installTimer(&sunnersTopStairsTimer, timerTime);
+}
+
+static void sunnersMidStairsTimer(MohawkEngine_Riven *vm) {
+	// If the sunners are gone, we have no video to play
+	if (vm->_vars["jsunners"] != 0) {
+		vm->removeTimer();
+		return;
+	}
+
+	// Play a random sunners video if the script one is not playing already
+	// and then set a new timer for when the new video should be played
+
+	VideoHandle oldHandle = vm->_video->findVideoHandleRiven(1);
+	uint32 timerTime = 500;
+
+	if (oldHandle == NULL_VID_HANDLE || vm->_video->endOfVideo(oldHandle)) {
+		uint32 &sunnerTime = vm->_vars["jsunnertime"];
+
+		if (sunnerTime == 0) {
+			timerTime = vm->_rnd->getRandomNumberRng(1, 10) * 1000;
+		} else if (sunnerTime < vm->getTotalPlayTime()) {
+			// Randomize the video
+			int randValue = vm->_rnd->getRandomNumber(5);
+			uint16 movie = 4;
+			if (randValue == 4)
+				movie = 2;
+			else if (randValue == 5)
+				movie = 3;
+
+			VideoHandle handle = vm->_video->playMovieRiven(movie);
+
+			timerTime = vm->_video->getDuration(handle) + vm->_rnd->getRandomNumberRng(1, 10) * 1000;
+		}
+
+		sunnerTime = timerTime + vm->getTotalPlayTime();
+	}
+
+	vm->installTimer(&sunnersMidStairsTimer, timerTime);
+}
+
+static void sunnersLowerStairsTimer(MohawkEngine_Riven *vm) {
+	// If the sunners are gone, we have no video to play
+	if (vm->_vars["jsunners"] != 0) {
+		vm->removeTimer();
+		return;
+	}
+
+	// Play a random sunners video if the script one is not playing already
+	// and then set a new timer for when the new video should be played
+
+	VideoHandle oldHandle = vm->_video->findVideoHandleRiven(1);
+	uint32 timerTime = 500;
+
+	if (oldHandle == NULL_VID_HANDLE || vm->_video->endOfVideo(oldHandle)) {
+		uint32 &sunnerTime = vm->_vars["jsunnertime"];
+
+		if (sunnerTime == 0) {
+			timerTime = vm->_rnd->getRandomNumberRng(1, 30) * 1000;
+		} else if (sunnerTime < vm->getTotalPlayTime()) {
+			VideoHandle handle = vm->_video->playMovieRiven(vm->_rnd->getRandomNumberRng(3, 5));
+
+			timerTime = vm->_video->getDuration(handle) + vm->_rnd->getRandomNumberRng(1, 30) * 1000;
+		}
+
+		sunnerTime = timerTime + vm->getTotalPlayTime();
+	}
+
+	vm->installTimer(&sunnersLowerStairsTimer, timerTime);
+}
+
+static void sunnersBeachTimer(MohawkEngine_Riven *vm) {
+	// If the sunners are gone, we have no video to play
+	if (vm->_vars["jsunners"] != 0) {
+		vm->removeTimer();
+		return;
+	}
+
+	// Play a random sunners video if the script one is not playing already
+	// and then set a new timer for when the new video should be played
+
+	VideoHandle oldHandle = vm->_video->findVideoHandleRiven(3);
+	uint32 timerTime = 500;
+
+	if (oldHandle == NULL_VID_HANDLE || vm->_video->endOfVideo(oldHandle)) {
+		uint32 &sunnerTime = vm->_vars["jsunnertime"];
+
+		if (sunnerTime == 0) {
+			timerTime = vm->_rnd->getRandomNumberRng(1, 30) * 1000;
+		} else if (sunnerTime < vm->getTotalPlayTime()) {
+			// Unlike the other cards' scripts which automatically
+			// activate the MLST, we have to set it manually here.
+			uint16 mlstID = vm->_rnd->getRandomNumberRng(3, 8);
+			vm->_video->activateMLST(mlstID, vm->getCurCard());
+			VideoHandle handle = vm->_video->playMovieRiven(mlstID);
+
+			timerTime = vm->_video->getDuration(handle) + vm->_rnd->getRandomNumberRng(1, 30) * 1000;
+		}
+
+		sunnerTime = timerTime + vm->getTotalPlayTime();
+	}
+
+	vm->installTimer(&sunnersBeachTimer, timerTime);
+}
+
 void MohawkEngine_Riven::installCardTimer() {
 	switch (getCurCardRMAP()) {
 	case 0x3a85: // Top of elevator on prison island
@@ -819,16 +953,16 @@ void MohawkEngine_Riven::installCardTimer() {
 		installTimer(&catherineIdleTimer, _rnd->getRandomNumberRng(1, 33) * 1000);
 		break;
 	case 0x77d6: // Sunners, top of stairs
-		// TODO: Background Sunner videos
+		installTimer(&sunnersTopStairsTimer, 500);
 		break;
 	case 0x79bd: // Sunners, middle of stairs
-		// TODO: Background Sunner videos
+		installTimer(&sunnersMidStairsTimer, 500);
 		break;
 	case 0x7beb: // Sunners, bottom of stairs
-		// TODO: Background Sunner videos
+		installTimer(&sunnersLowerStairsTimer, 500);
 		break;
 	case 0xb6ca: // Sunners, shoreline
-		// TODO: Background Sunner videos
+		installTimer(&sunnersBeachTimer, 500);
 		break;
 	}
 }
@@ -846,6 +980,34 @@ void MohawkEngine_Riven::doVideoTimer(VideoHandle handle, bool force) {
 		_scriptMan->runStoredMovieOpcode();
 }
 
+void MohawkEngine_Riven::checkSunnerAlertClick() {
+	// We need to do a manual hardcoded check for the sunners'
+	// alert movies.
+
+	uint32 &sunners = _vars["jsunners"];
+
+	// If the sunners are gone, there's nothing for us to do
+	if (sunners != 0)
+		return;
+
+	uint32 rmapCode = getCurCardRMAP();
+
+	// This is only for the mid/lower staircase sections
+	if (rmapCode != 0x79bd && rmapCode != 0x7beb)
+		return;
+
+	// Only set the sunners variable on the forward hotspot
+	if ((rmapCode == 0x79bd && _curHotspot != 1) || (rmapCode == 0x7beb && _curHotspot != 2))
+		return;
+
+	// If the alert video is no longer playing, we have nothing left to do
+	VideoHandle handle = _video->findVideoHandleRiven(1);
+	if (handle == NULL_VID_HANDLE || _video->endOfVideo(handle))
+		return;
+
+	sunners = 1;
+}
+
 bool ZipMode::operator== (const ZipMode &z) const {
 	return z.name == name && z.id == id;
 }
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index c7d36e5..01a4fbb 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -164,6 +164,7 @@ private:
 	// Miscellaneous
 	bool _gameOver;
 	bool _ignoreNextMouseUp;
+	void checkSunnerAlertClick();
 
 public:
 	// Stack/card/script funtions
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 60e94ea..c72dafa 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -1889,21 +1889,42 @@ void RivenExternal::xjplaybeetle_1450(uint16 argc, uint16 *argv) {
 }
 
 void RivenExternal::xjlagoon700_alert(uint16 argc, uint16 *argv) {
-	// TODO: Sunner related
+	// Handle sunner reactions (mid-staircase)
+
+	if (_vm->_vars["jsunners"] == 0)
+		_vm->_video->playMovieRiven(1);
 }
 
 void RivenExternal::xjlagoon800_alert(uint16 argc, uint16 *argv) {
-	// TODO: Sunner related
+	// Handle sunner reactions (lower-staircase)
+
+	uint32 &sunners = _vm->_vars["jsunners"];
+
+	if (sunners == 0) {
+		// Show the sunners alert video
+		_vm->_video->playMovieRiven(1);
+	} else if (sunners == 1) {
+		// Show the sunners leaving if you moved forward in their "alert" status
+		_vm->_video->playMovieBlockingRiven(2);
+		_vm->_video->playMovieBlockingRiven(6);
+		sunners = 2;
+		_vm->refreshCard();
+	}
 }
 
 void RivenExternal::xjlagoon1500_alert(uint16 argc, uint16 *argv) {
-	// Have the sunners move a bit as you get closer ;)
+	// Handle sunner reactions (beach)
+
 	uint32 &sunners = _vm->_vars["jsunners"];
+
 	if (sunners == 0) {
+		// Show the sunners alert video
 		_vm->_video->playMovieBlockingRiven(3);
 	} else if (sunners == 1) {
+		// Show the sunners leaving if you moved forward in their "alert" status
 		_vm->_video->playMovieBlockingRiven(2);
 		sunners = 2;
+		_vm->refreshCard();
 	}
 }
 


Commit: bb3b1a2b759d702dcfd4731fed58387bda7e23d3
    https://github.com/scummvm/scummvm/commit/bb3b1a2b759d702dcfd4731fed58387bda7e23d3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-11T10:14:04-07:00

Commit Message:
MOHAWK: Error out on any unknown Riven stack variables

Changed paths:
    engines/mohawk/riven_vars.cpp



diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp
index 946e2e0..8243d28 100644
--- a/engines/mohawk/riven_vars.cpp
+++ b/engines/mohawk/riven_vars.cpp
@@ -268,7 +268,12 @@ static const char *variableNames[] = {
 };
 
 uint32 &MohawkEngine_Riven::getStackVar(uint32 index) {
-	return _vars[getName(VariableNames, index)];
+	Common::String name = getName(VariableNames, index);
+
+	if (!_vars.contains(name))
+		error("Could not find variable '%s' (stack variable %d)", name.c_str(), index);
+
+	return _vars[name];
 }
 
 void MohawkEngine_Riven::initVars() {






More information about the Scummvm-git-logs mailing list