[Scummvm-cvs-logs] scummvm master -> 2053936959f6d079c927866da8936cf5dcc7edde

clone2727 clone2727 at gmail.com
Tue Mar 22 19:29:08 CET 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:
d91c33ca26 MOHAWK: Implement xrwindowsetup
2053936959 MOHAWK: Ignore other 'time' variables when loading saves too


Commit: d91c33ca26e8757ac0408ab4232dc0d749cc25d3
    https://github.com/scummvm/scummvm/commit/d91c33ca26e8757ac0408ab4232dc0d749cc25d3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-22T11:11:24-07:00

Commit Message:
MOHAWK: Implement xrwindowsetup

Changed paths:
    engines/mohawk/riven_external.cpp



diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 2fc0c4e..2ab6c0e 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -2316,8 +2316,53 @@ void RivenExternal::xrhideinventory(uint16 argc, uint16 *argv) {
 	_vm->_gfx->hideInventory();
 }
 
+static void rebelPrisonWindowTimer(MohawkEngine_Riven *vm) {
+	// Randomize a video out in the middle of Tay
+	uint16 movie = vm->_rnd->getRandomNumberRng(2, 13);
+	vm->_video->activateMLST(movie, vm->getCurCard());
+	VideoHandle handle = vm->_video->playMovieRiven(movie);
+
+	// Ensure the next video starts after this one ends
+	uint32 timeUntilNextVideo = vm->_video->getDuration(handle) + vm->_rnd->getRandomNumberRng(38, 58) * 1000;
+
+	// Save the time in case we leave the card and return
+	*vm->getVar("rvillagetime") = timeUntilNextVideo + vm->getTotalPlayTime();
+
+	// Reinstall this timer with the new time
+	vm->installTimer(&rebelPrisonWindowTimer, timeUntilNextVideo);
+}
+
 void RivenExternal::xrwindowsetup(uint16 argc, uint16 *argv) {
-	// TODO: Randomizing what effect happens when you look out into the middle of Tay (useless! :P)
+	// Randomize what effect happens when you look out into the middle of Tay
+
+	uint32 villageTime = *_vm->getVar("rvillagetime");
+
+	// If we have time leftover from a previous run, set up the timer again
+	if (_vm->getTotalPlayTime() < villageTime) {
+		_vm->installTimer(&rebelPrisonWindowTimer, villageTime - _vm->getTotalPlayTime());
+		return;
+	}
+
+	uint32 timeUntilNextVideo;
+
+	// Randomize the time until the next video
+	if (_vm->_rnd->getRandomNumber(2) == 0 && *_vm->getVar("rrichard") == 0) {
+		// In this case, a rebel is placed on a bridge
+		// The video itself is handled by the scripts later on
+		*_vm->getVar("rrebelview") = 0;
+		timeUntilNextVideo = _vm->_rnd->getRandomNumberRng(38, 58) * 1000;
+	} else {
+		// Otherwise, just a random video from the timer
+		*_vm->getVar("rrebelview") = 1;
+		timeUntilNextVideo = _vm->_rnd->getRandomNumber(20) * 1000;
+	}
+
+	// We don't set rvillagetime here because the scripts later just reset it to 0
+	// Of course, because of this, you can't return to the window twice and expect
+	// the timer to reinstall itself...
+
+	// Install our timer and we're on our way
+	_vm->installTimer(&rebelPrisonWindowTimer, timeUntilNextVideo);
 }
 
 // ------------------------------------------------------------------------------------


Commit: 2053936959f6d079c927866da8936cf5dcc7edde
    https://github.com/scummvm/scummvm/commit/2053936959f6d079c927866da8936cf5dcc7edde
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-22T11:27:32-07:00

Commit Message:
MOHAWK: Ignore other 'time' variables when loading saves too

Changed paths:
    engines/mohawk/riven_saveload.cpp



diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index d70c3c6..3aef584 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -166,20 +166,20 @@ bool RivenSaveLoad::loadGame(Common::String filename) {
 			continue;
 
 		uint32 *var = _vm->getVar(name);
+		name.toLowercase();
 
 		// Handle any special variables here
-		// WORKAROUND: bytramtime is reset here for one main reason:
+		// WORKAROUND: time variables are reset here for one main reason:
 		// The save does not store any start point for the time, so we don't know the real time.
 		// Because of this, in many cases, the original would just give a 'free' Ytram upon saving
 		// since the time would be used in a new (improper) time frame.
-		// TODO: Check of the other 'time' variables require this too
 		if (name.equalsIgnoreCase("CurrentStackID"))                  // Remap to our definitions, store for later
 			stackID = mapOldStackIDToNew(rawVariables[i]);
 		else if (name.equalsIgnoreCase("CurrentCardID"))              // Store for later
 			cardID = rawVariables[i];
 		else if (name.equalsIgnoreCase("ReturnStackID") && *var != 0) // if 0, the game did not use the variable yet
 			*var = mapOldStackIDToNew(rawVariables[i]);
-		else if (name.equalsIgnoreCase("bytramtime"))                 // WORKAROUND: See above
+		else if (name.contains("time"))                               // WORKAROUND: See above
 			*var = 0;
 		else                                                          // Otherwise, just store it
 			*var = rawVariables[i];






More information about the Scummvm-git-logs mailing list